@@ -23,22 +23,22 @@ discard block |
||
| 23 | 23 | class HtmlSemDoubleElement extends HtmlDoubleElement { |
| 24 | 24 | use BaseTrait; |
| 25 | 25 | |
| 26 | - protected $_popup = NULL; |
|
| 26 | + protected $_popup=NULL; |
|
| 27 | 27 | |
| 28 | - protected $_dimmer = NULL; |
|
| 28 | + protected $_dimmer=NULL; |
|
| 29 | 29 | |
| 30 | - protected $_toast = NULL; |
|
| 30 | + protected $_toast=NULL; |
|
| 31 | 31 | |
| 32 | - protected $_sidebar = NULL; |
|
| 32 | + protected $_sidebar=NULL; |
|
| 33 | 33 | |
| 34 | - protected $_params = array(); |
|
| 34 | + protected $_params=array(); |
|
| 35 | 35 | |
| 36 | - public function __construct($identifier, $tagName = "p", $baseClass = "ui", $content = NULL) { |
|
| 36 | + public function __construct($identifier, $tagName="p", $baseClass="ui", $content=NULL) { |
|
| 37 | 37 | parent::__construct($identifier, $tagName); |
| 38 | - $this->_baseClass = $baseClass; |
|
| 38 | + $this->_baseClass=$baseClass; |
|
| 39 | 39 | $this->setClass($baseClass); |
| 40 | 40 | if (isset($content)) { |
| 41 | - $this->content = $content; |
|
| 41 | + $this->content=$content; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param string $variation |
| 49 | 49 | * @param string $popupEvent |
| 50 | 50 | */ |
| 51 | - public function setPopupAttributes($variation = NULL, $popupEvent = NULL) { |
|
| 51 | + public function setPopupAttributes($variation=NULL, $popupEvent=NULL) { |
|
| 52 | 52 | if (isset($this->_popup)) |
| 53 | 53 | $this->_popup->setAttributes($variation, $popupEvent); |
| 54 | 54 | } |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | * @param array $params |
| 63 | 63 | * @return HtmlSemDoubleElement |
| 64 | 64 | */ |
| 65 | - public function addPopup($title = "", $content = "", $variation = NULL, $params = array()) { |
|
| 66 | - $this->_popup = new InternalPopup($this, $title, $content, $variation, $params); |
|
| 65 | + public function addPopup($title="", $content="", $variation=NULL, $params=array()) { |
|
| 66 | + $this->_popup=new InternalPopup($this, $title, $content, $variation, $params); |
|
| 67 | 67 | return $this; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | * @param array $params |
| 76 | 76 | * @return HtmlSemDoubleElement |
| 77 | 77 | */ |
| 78 | - public function addPopupHtml($html = "", $variation = NULL, $params = array()) { |
|
| 79 | - $this->_popup = new InternalPopup($this); |
|
| 78 | + public function addPopupHtml($html="", $variation=NULL, $params=array()) { |
|
| 79 | + $this->_popup=new InternalPopup($this); |
|
| 80 | 80 | $this->_popup->setHtml($html); |
| 81 | 81 | $this->_popup->setAttributes($variation, $params); |
| 82 | 82 | return $this; |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | * @param mixed $content |
| 90 | 90 | * @return HtmlDimmer |
| 91 | 91 | */ |
| 92 | - public function addDimmer($params = array(), $content = NULL) { |
|
| 93 | - $dimmer = new HtmlDimmer("dimmer-" . $this->identifier, $content); |
|
| 92 | + public function addDimmer($params=array(), $content=NULL) { |
|
| 93 | + $dimmer=new HtmlDimmer("dimmer-".$this->identifier, $content); |
|
| 94 | 94 | $dimmer->setParams($params); |
| 95 | 95 | $dimmer->setContainer($this); |
| 96 | 96 | $this->addContent($dimmer); |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | * @param string $icon |
| 106 | 106 | * @return mixed|HtmlLabel |
| 107 | 107 | */ |
| 108 | - public function addLabel($label, $before = false, $icon = NULL) { |
|
| 109 | - $labelO = $label; |
|
| 110 | - if (\is_object($label) === false) { |
|
| 111 | - $labelO = new HtmlLabel("label-" . $this->identifier, $label); |
|
| 108 | + public function addLabel($label, $before=false, $icon=NULL) { |
|
| 109 | + $labelO=$label; |
|
| 110 | + if (\is_object($label)===false) { |
|
| 111 | + $labelO=new HtmlLabel("label-".$this->identifier, $label); |
|
| 112 | 112 | if (isset($icon)) |
| 113 | 113 | $labelO->addIcon($icon); |
| 114 | 114 | } else { |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | * @param string $icon |
| 130 | 130 | * @return HtmlSemDoubleElement |
| 131 | 131 | */ |
| 132 | - public function attachLabel($label, $side = Side::TOP, $direction = Direction::NONE, $icon = NULL) { |
|
| 133 | - $label = $this->addLabel($label, true, $icon); |
|
| 132 | + public function attachLabel($label, $side=Side::TOP, $direction=Direction::NONE, $icon=NULL) { |
|
| 133 | + $label=$this->addLabel($label, true, $icon); |
|
| 134 | 134 | $label->setAttached($side, $direction); |
| 135 | 135 | return $this; |
| 136 | 136 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @return HtmlSemDoubleElement |
| 142 | 142 | */ |
| 143 | - public function asLink($href = NULL, $target = NULL) { |
|
| 143 | + public function asLink($href=NULL, $target=NULL) { |
|
| 144 | 144 | if (isset($href)) |
| 145 | 145 | $this->setProperty("href", $href); |
| 146 | 146 | if (isset($target)) |
@@ -154,11 +154,11 @@ discard block |
||
| 154 | 154 | * @param boolean $show |
| 155 | 155 | * @return string |
| 156 | 156 | */ |
| 157 | - public function jsShowDimmer($show = true) { |
|
| 158 | - $status = "hide"; |
|
| 159 | - if ($show === true) |
|
| 160 | - $status = "show"; |
|
| 161 | - return '$("#.' . $this->identifier . ').dimmer("' . $status . '");'; |
|
| 157 | + public function jsShowDimmer($show=true) { |
|
| 158 | + $status="hide"; |
|
| 159 | + if ($show===true) |
|
| 160 | + $status="show"; |
|
| 161 | + return '$("#.'.$this->identifier.').dimmer("'.$status.'");'; |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * {@inheritdoc} |
| 167 | 167 | * @see BaseHtml::compile() |
| 168 | 168 | */ |
| 169 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
| 169 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 170 | 170 | if (isset($this->_popup)) { |
| 171 | 171 | $this->_popup->compile($js); |
| 172 | 172 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | * @see HtmlDoubleElement::run() |
| 180 | 180 | */ |
| 181 | 181 | public function run(JsUtils $js) { |
| 182 | - $this->_bsComponent = $js->semantic()->generic("#" . $this->identifier); |
|
| 182 | + $this->_bsComponent=$js->semantic()->generic("#".$this->identifier); |
|
| 183 | 183 | parent::run($js); |
| 184 | 184 | $this->addEventsOnRun($js); |
| 185 | 185 | if (isset($this->_popup)) { |
@@ -197,8 +197,8 @@ discard block |
||
| 197 | 197 | * @param boolean $ordered |
| 198 | 198 | * @return \Ajax\common\html\html5\HtmlList |
| 199 | 199 | */ |
| 200 | - public function addList($items, $ordered = false) { |
|
| 201 | - $list = new HtmlList("list-" . $this->identifier, $items); |
|
| 200 | + public function addList($items, $ordered=false) { |
|
| 201 | + $list=new HtmlList("list-".$this->identifier, $items); |
|
| 202 | 202 | $list->setOrdered($ordered); |
| 203 | 203 | $list->setClass("ui list"); |
| 204 | 204 | $this->addContent($list); |
@@ -210,9 +210,9 @@ discard block |
||
| 210 | 210 | * @param ?array $params |
| 211 | 211 | * @return \Ajax\semantic\components\Toast |
| 212 | 212 | */ |
| 213 | - public function asToast($params = NULL) { |
|
| 214 | - $this->_toast = new Toast(); |
|
| 215 | - $this->_toast->attach('#' . $this->_identifier); |
|
| 213 | + public function asToast($params=NULL) { |
|
| 214 | + $this->_toast=new Toast(); |
|
| 215 | + $this->_toast->attach('#'.$this->_identifier); |
|
| 216 | 216 | $this->setProperty('style', 'display:none;'); |
| 217 | 217 | if (isset($params)) { |
| 218 | 218 | $this->_toast->setParams($params); |
@@ -226,8 +226,8 @@ discard block |
||
| 226 | 226 | * @param string $classes |
| 227 | 227 | * @return \Ajax\semantic\components\Sidebar |
| 228 | 228 | */ |
| 229 | - public function asSideBar($classes = '') { |
|
| 230 | - $this->_sidebar = new Sidebar(); |
|
| 229 | + public function asSideBar($classes='') { |
|
| 230 | + $this->_sidebar=new Sidebar(); |
|
| 231 | 231 | $this->addToProperty('class', 'sidebar'); |
| 232 | 232 | return $this->_sidebar; |
| 233 | 233 | } |
@@ -49,8 +49,9 @@ discard block |
||
| 49 | 49 | * @param string $popupEvent |
| 50 | 50 | */ |
| 51 | 51 | public function setPopupAttributes($variation = NULL, $popupEvent = NULL) { |
| 52 | - if (isset($this->_popup)) |
|
| 53 | - $this->_popup->setAttributes($variation, $popupEvent); |
|
| 52 | + if (isset($this->_popup)) { |
|
| 53 | + $this->_popup->setAttributes($variation, $popupEvent); |
|
| 54 | + } |
|
| 54 | 55 | } |
| 55 | 56 | |
| 56 | 57 | /** |
@@ -109,8 +110,9 @@ discard block |
||
| 109 | 110 | $labelO = $label; |
| 110 | 111 | if (\is_object($label) === false) { |
| 111 | 112 | $labelO = new HtmlLabel("label-" . $this->identifier, $label); |
| 112 | - if (isset($icon)) |
|
| 113 | - $labelO->addIcon($icon); |
|
| 113 | + if (isset($icon)) { |
|
| 114 | + $labelO->addIcon($icon); |
|
| 115 | + } |
|
| 114 | 116 | } else { |
| 115 | 117 | $labelO->addToPropertyCtrl("class", "label", array( |
| 116 | 118 | "label" |
@@ -141,10 +143,12 @@ discard block |
||
| 141 | 143 | * @return HtmlSemDoubleElement |
| 142 | 144 | */ |
| 143 | 145 | public function asLink($href = NULL, $target = NULL) { |
| 144 | - if (isset($href)) |
|
| 145 | - $this->setProperty("href", $href); |
|
| 146 | - if (isset($target)) |
|
| 147 | - $this->setProperty("target", $target); |
|
| 146 | + if (isset($href)) { |
|
| 147 | + $this->setProperty("href", $href); |
|
| 148 | + } |
|
| 149 | + if (isset($target)) { |
|
| 150 | + $this->setProperty("target", $target); |
|
| 151 | + } |
|
| 148 | 152 | return $this->setTagName("a"); |
| 149 | 153 | } |
| 150 | 154 | |
@@ -156,8 +160,9 @@ discard block |
||
| 156 | 160 | */ |
| 157 | 161 | public function jsShowDimmer($show = true) { |
| 158 | 162 | $status = "hide"; |
| 159 | - if ($show === true) |
|
| 160 | - $status = "show"; |
|
| 163 | + if ($show === true) { |
|
| 164 | + $status = "show"; |
|
| 165 | + } |
|
| 161 | 166 | return '$("#.' . $this->identifier . ').dimmer("' . $status . '");'; |
| 162 | 167 | } |
| 163 | 168 | |
@@ -14,9 +14,9 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | class Sidebar extends SimpleSemExtComponent { |
| 16 | 16 | |
| 17 | - public function __construct(JsUtils $js = NULL) { |
|
| 17 | + public function __construct(JsUtils $js=NULL) { |
|
| 18 | 18 | parent::__construct($js); |
| 19 | - $this->uiName = 'sidebar'; |
|
| 19 | + $this->uiName='sidebar'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public function show() { |
@@ -46,32 +46,32 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | public function setContext($value) { |
| 49 | - $this->params['context'] = $value; |
|
| 49 | + $this->params['context']=$value; |
|
| 50 | 50 | return $this; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function setExclusive($value = true) { |
|
| 54 | - $this->params['exclusive'] = true; |
|
| 53 | + public function setExclusive($value=true) { |
|
| 54 | + $this->params['exclusive']=true; |
|
| 55 | 55 | return $this; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - public function setClosable($value = true) { |
|
| 59 | - $this->params['closable'] = $value; |
|
| 58 | + public function setClosable($value=true) { |
|
| 59 | + $this->params['closable']=$value; |
|
| 60 | 60 | return $this; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - public function setDimPage($value = true) { |
|
| 64 | - $this->params['dimPage'] = $value; |
|
| 63 | + public function setDimPage($value=true) { |
|
| 64 | + $this->params['dimPage']=$value; |
|
| 65 | 65 | return $this; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - public function setScrollLock($value = false) { |
|
| 69 | - $this->params['scrollLock'] = $value; |
|
| 68 | + public function setScrollLock($value=false) { |
|
| 69 | + $this->params['scrollLock']=$value; |
|
| 70 | 70 | return $this; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public function setReturnScroll($value = false) { |
|
| 74 | - $this->params['returnScroll'] = $value; |
|
| 73 | + public function setReturnScroll($value=false) { |
|
| 74 | + $this->params['returnScroll']=$value; |
|
| 75 | 75 | return $this; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * |
| 25 | 25 | */ |
| 26 | 26 | class DataTable extends Widget { |
| 27 | - use TableTrait,DataTableFieldAsTrait,HasCheckboxesTrait,BaseTrait; |
|
| 27 | + use TableTrait, DataTableFieldAsTrait, HasCheckboxesTrait, BaseTrait; |
|
| 28 | 28 | |
| 29 | 29 | protected $_searchField; |
| 30 | 30 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | protected $_displayBehavior; |
| 42 | 42 | |
| 43 | - protected $_visibleHover = false; |
|
| 43 | + protected $_visibleHover=false; |
|
| 44 | 44 | |
| 45 | 45 | protected $_targetSelector; |
| 46 | 46 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | protected $_json; |
| 52 | 52 | |
| 53 | - protected $_rowClass = "_element"; |
|
| 53 | + protected $_rowClass="_element"; |
|
| 54 | 54 | |
| 55 | 55 | protected $_sortable; |
| 56 | 56 | |
@@ -58,25 +58,25 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | protected $_colWidths; |
| 60 | 60 | |
| 61 | - public function __construct($identifier, $model, $modelInstance = NULL) { |
|
| 61 | + public function __construct($identifier, $model, $modelInstance=NULL) { |
|
| 62 | 62 | parent::__construct($identifier, $model, $modelInstance); |
| 63 | 63 | $this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 0), false); |
| 64 | - $this->_urls = []; |
|
| 65 | - $this->_emptyMessage = new HtmlMessage("", "nothing to display"); |
|
| 64 | + $this->_urls=[]; |
|
| 65 | + $this->_emptyMessage=new HtmlMessage("", "nothing to display"); |
|
| 66 | 66 | $this->_emptyMessage->setIcon("info circle"); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | public function run(JsUtils $js) { |
| 70 | - $offset = $js->scriptCount(); |
|
| 70 | + $offset=$js->scriptCount(); |
|
| 71 | 71 | if ($this->_hasCheckboxes && isset($js)) { |
| 72 | 72 | $this->_runCheckboxes($js); |
| 73 | 73 | } |
| 74 | 74 | if ($this->_visibleHover) { |
| 75 | - $js->execOn("mouseover", "#" . $this->identifier . " tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');", [ |
|
| 75 | + $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');", [ |
|
| 76 | 76 | "preventDefault" => false, |
| 77 | 77 | "stopPropagation" => true |
| 78 | 78 | ]); |
| 79 | - $js->execOn("mouseout", "#" . $this->identifier . " tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');", [ |
|
| 79 | + $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');", [ |
|
| 80 | 80 | "preventDefault" => false, |
| 81 | 81 | "stopPropagation" => true |
| 82 | 82 | ]); |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | protected function _generateBehavior($op, $params, JsUtils $js) { |
| 98 | 98 | if (isset($this->_urls[$op])) { |
| 99 | - $params = \array_merge($params, [ |
|
| 99 | + $params=\array_merge($params, [ |
|
| 100 | 100 | "attr" => "data-ajax" |
| 101 | 101 | ]); |
| 102 | - $js->ajaxOnClick("#" . $this->identifier . " ._" . $op, $this->_urls[$op], $this->getTargetSelector($op), $params); |
|
| 102 | + $js->ajaxOnClick("#".$this->identifier." ._".$op, $this->_urls[$op], $this->getTargetSelector($op), $params); |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
@@ -118,21 +118,21 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | public function refreshTD($fieldName, $jquery, $view) { |
| 121 | - $index = $this->_getIndex($fieldName); |
|
| 121 | + $index=$this->_getIndex($fieldName); |
|
| 122 | 122 | $this->compile($jquery, $view); |
| 123 | 123 | return $this->refreshTR() |
| 124 | 124 | ->getTable() |
| 125 | 125 | ->getCell(0, $index); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
| 129 | - if (! $this->_generated) { |
|
| 128 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 129 | + if (!$this->_generated) { |
|
| 130 | 130 | if (isset($this->_buttonsColumn)) { |
| 131 | 131 | $this->_instanceViewer->sortColumnContent($this->_buttonsColumn, $this->_buttons); |
| 132 | 132 | } |
| 133 | 133 | $this->_instanceViewer->setInstance($this->_model); |
| 134 | - $captions = $this->_instanceViewer->getCaptions(); |
|
| 135 | - $table = $this->content["table"]; |
|
| 134 | + $captions=$this->_instanceViewer->getCaptions(); |
|
| 135 | + $table=$this->content["table"]; |
|
| 136 | 136 | if ($this->_hasCheckboxes) { |
| 137 | 137 | $this->_generateMainCheckbox($captions); |
| 138 | 138 | } |
@@ -147,14 +147,14 @@ discard block |
||
| 147 | 147 | $this->compileExtraElements($table, $captions); |
| 148 | 148 | $this->_compileSearchFieldBehavior($js); |
| 149 | 149 | |
| 150 | - $this->content = JArray::sortAssociative($this->content, [ |
|
| 150 | + $this->content=JArray::sortAssociative($this->content, [ |
|
| 151 | 151 | PositionInTable::BEFORETABLE, |
| 152 | 152 | "table", |
| 153 | 153 | PositionInTable::AFTERTABLE |
| 154 | 154 | ]); |
| 155 | 155 | $this->_compileForm(); |
| 156 | 156 | $this->_applyStyleAttributes($table); |
| 157 | - $this->_generated = true; |
|
| 157 | + $this->_generated=true; |
|
| 158 | 158 | } |
| 159 | 159 | return parent::compile($js, $view); |
| 160 | 160 | } |
@@ -199,21 +199,21 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | protected function _generateContent($table) { |
| 202 | - $objects = $this->_modelInstance; |
|
| 202 | + $objects=$this->_modelInstance; |
|
| 203 | 203 | if (isset($this->_pagination)) { |
| 204 | - $objects = $this->_pagination->getObjects($this->_modelInstance); |
|
| 204 | + $objects=$this->_pagination->getObjects($this->_modelInstance); |
|
| 205 | 205 | } |
| 206 | 206 | InstanceViewer::setIndex(0); |
| 207 | - $fields = $this->_instanceViewer->getSimpleProperties(); |
|
| 208 | - $groupByFields = $this->_instanceViewer->getGroupByFields(); |
|
| 209 | - if (! is_array($groupByFields)) { |
|
| 210 | - $table->fromDatabaseObjects($objects, function ($instance) use ($table, $fields) { |
|
| 207 | + $fields=$this->_instanceViewer->getSimpleProperties(); |
|
| 208 | + $groupByFields=$this->_instanceViewer->getGroupByFields(); |
|
| 209 | + if (!is_array($groupByFields)) { |
|
| 210 | + $table->fromDatabaseObjects($objects, function($instance) use ($table, $fields) { |
|
| 211 | 211 | return $this->_generateRow($instance, $fields, $table); |
| 212 | 212 | }); |
| 213 | 213 | } else { |
| 214 | - $activeValues = array_combine($groupByFields, array_fill(0, sizeof($groupByFields), null)); |
|
| 215 | - $uuids = []; |
|
| 216 | - $table->fromDatabaseObjects($objects, function ($instance) use ($table, $fields, &$activeValues, $groupByFields, &$uuids) { |
|
| 214 | + $activeValues=array_combine($groupByFields, array_fill(0, sizeof($groupByFields), null)); |
|
| 215 | + $uuids=[]; |
|
| 216 | + $table->fromDatabaseObjects($objects, function($instance) use ($table, $fields, &$activeValues, $groupByFields, &$uuids) { |
|
| 217 | 217 | $this->_instanceViewer->setInstance($instance); |
| 218 | 218 | foreach ($groupByFields as $index => $gbField) { |
| 219 | 219 | $this->_generateGroupByRow($index, $gbField, $table, $fields, $activeValues, $uuids); |
@@ -221,8 +221,8 @@ discard block |
||
| 221 | 221 | return $this->_generateRow($instance, $fields, $table, null, $uuids); |
| 222 | 222 | }); |
| 223 | 223 | } |
| 224 | - if ($table->getRowCount() == 0) { |
|
| 225 | - $result = $table->addRow(); |
|
| 224 | + if ($table->getRowCount()==0) { |
|
| 225 | + $result=$table->addRow(); |
|
| 226 | 226 | $result->mergeRow(); |
| 227 | 227 | $result->setValues([ |
| 228 | 228 | $this->_emptyMessage |
@@ -231,20 +231,20 @@ discard block |
||
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | protected function _generateGroupByRow($index, $gbField, $table, $fields, &$activeValues, &$uuids) { |
| 234 | - $newValue = $this->_instanceViewer->getValue($gbField); |
|
| 235 | - if ($this->getElementContent($activeValues[$gbField]) !== $this->getElementContent($newValue)) { |
|
| 236 | - if ($index == 0) { |
|
| 237 | - $uuids = []; |
|
| 234 | + $newValue=$this->_instanceViewer->getValue($gbField); |
|
| 235 | + if ($this->getElementContent($activeValues[$gbField])!==$this->getElementContent($newValue)) { |
|
| 236 | + if ($index==0) { |
|
| 237 | + $uuids=[]; |
|
| 238 | 238 | } |
| 239 | - $uuid = uniqid("grp"); |
|
| 240 | - $uuids[$gbField] = $uuid; |
|
| 241 | - $id = $this->_instanceViewer->getIdentifier(); |
|
| 242 | - $result = $table->addMergeRow(sizeof($fields) + 1, $newValue); |
|
| 243 | - $result->setIdentifier($this->identifier . "-tr-gb-" . $id); |
|
| 239 | + $uuid=uniqid("grp"); |
|
| 240 | + $uuids[$gbField]=$uuid; |
|
| 241 | + $id=$this->_instanceViewer->getIdentifier(); |
|
| 242 | + $result=$table->addMergeRow(sizeof($fields)+1, $newValue); |
|
| 243 | + $result->setIdentifier($this->identifier."-tr-gb-".$id); |
|
| 244 | 244 | $result->setProperty("data-ajax", $id); |
| 245 | 245 | $result->setProperty("data-group", $uuid); |
| 246 | 246 | $result->addToProperty("class", $this->_rowClass); |
| 247 | - $activeValues[$gbField] = $newValue; |
|
| 247 | + $activeValues[$gbField]=$newValue; |
|
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | |
@@ -256,9 +256,9 @@ discard block |
||
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | public function getFieldValue($index) { |
| 259 | - $index = $this->_getIndex($index); |
|
| 259 | + $index=$this->_getIndex($index); |
|
| 260 | 260 | if (is_numeric($index)) { |
| 261 | - $values = $this->_instanceViewer->getValues(); |
|
| 261 | + $values=$this->_instanceViewer->getValues(); |
|
| 262 | 262 | if (isset($values[$index])) { |
| 263 | 263 | return $values[$index]; |
| 264 | 264 | } |
@@ -266,31 +266,31 @@ discard block |
||
| 266 | 266 | return null; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - protected function _generateRow($instance, $fields, &$table, $checkedClass = null, $uuids = null) { |
|
| 269 | + protected function _generateRow($instance, $fields, &$table, $checkedClass=null, $uuids=null) { |
|
| 270 | 270 | $this->_instanceViewer->setInstance($instance); |
| 271 | - InstanceViewer::$index ++; |
|
| 272 | - $values = $this->_instanceViewer->getValues(); |
|
| 273 | - $id = $this->_instanceViewer->getIdentifier(); |
|
| 274 | - $dataAjax = $id; |
|
| 275 | - $id = $this->cleanIdentifier($id); |
|
| 271 | + InstanceViewer::$index++; |
|
| 272 | + $values=$this->_instanceViewer->getValues(); |
|
| 273 | + $id=$this->_instanceViewer->getIdentifier(); |
|
| 274 | + $dataAjax=$id; |
|
| 275 | + $id=$this->cleanIdentifier($id); |
|
| 276 | 276 | if ($this->_hasCheckboxes) { |
| 277 | - $ck = new HtmlCheckbox("ck-" . $this->identifier . "-" . $id, ""); |
|
| 278 | - $checked = false; |
|
| 277 | + $ck=new HtmlCheckbox("ck-".$this->identifier."-".$id, ""); |
|
| 278 | + $checked=false; |
|
| 279 | 279 | if (isset($this->_checkedCallback)) { |
| 280 | - $func = $this->_checkedCallback; |
|
| 281 | - $checked = $func($instance); |
|
| 280 | + $func=$this->_checkedCallback; |
|
| 281 | + $checked=$func($instance); |
|
| 282 | 282 | } |
| 283 | 283 | $ck->setChecked($checked); |
| 284 | 284 | // $ck->setOnChange("event.stopPropagation();"); |
| 285 | - $field = $ck->getField(); |
|
| 285 | + $field=$ck->getField(); |
|
| 286 | 286 | $field->setProperty("value", $dataAjax); |
| 287 | 287 | $field->setProperty("name", "selection[]"); |
| 288 | 288 | if (isset($checkedClass)) |
| 289 | 289 | $field->setClass($checkedClass); |
| 290 | 290 | \array_unshift($values, $ck); |
| 291 | 291 | } |
| 292 | - $result = $table->newRow(); |
|
| 293 | - $result->setIdentifier($this->identifier . "-tr-" . $id); |
|
| 292 | + $result=$table->newRow(); |
|
| 293 | + $result->setIdentifier($this->identifier."-tr-".$id); |
|
| 294 | 294 | $result->setProperty("data-ajax", $dataAjax); |
| 295 | 295 | $result->setValues($values); |
| 296 | 296 | $result->addToProperty("class", $this->_rowClass); |
@@ -303,62 +303,62 @@ discard block |
||
| 303 | 303 | |
| 304 | 304 | protected function _generatePagination($table) { |
| 305 | 305 | if (isset($this->_toolbar)) { |
| 306 | - if ($this->_toolbarPosition == PositionInTable::FOOTER) |
|
| 306 | + if ($this->_toolbarPosition==PositionInTable::FOOTER) |
|
| 307 | 307 | $this->_toolbar->setFloated("left"); |
| 308 | 308 | } |
| 309 | - $footer = $table->getFooter(); |
|
| 309 | + $footer=$table->getFooter(); |
|
| 310 | 310 | $footer->mergeCol(); |
| 311 | 311 | $footer->addValues($this->_pagination->generateMenu($this->identifier)); |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - protected function _associatePaginationBehavior(JsUtils $js = NULL, $offset = null) { |
|
| 314 | + protected function _associatePaginationBehavior(JsUtils $js=NULL, $offset=null) { |
|
| 315 | 315 | if (isset($this->_urls["refresh"])) { |
| 316 | - $menu = $this->_pagination->getMenu(); |
|
| 316 | + $menu=$this->_pagination->getMenu(); |
|
| 317 | 317 | if (isset($menu) && isset($js)) { |
| 318 | - $js->postOnClick("#" . $menu->getIdentifier() . " .item", $this->_urls["refresh"], "{'p':$(this).attr('data-page'),'_model':'" . JString::doubleBackSlashes($this->_model) . "'}", $this->getRefreshSelector(), [ |
|
| 318 | + $js->postOnClick("#".$menu->getIdentifier()." .item", $this->_urls["refresh"], "{'p':$(this).attr('data-page'),'_model':'".JString::doubleBackSlashes($this->_model)."'}", $this->getRefreshSelector(), [ |
|
| 319 | 319 | "preventDefault" => false, |
| 320 | 320 | "jqueryDone" => "replaceWith", |
| 321 | 321 | "hasLoader" => false, |
| 322 | - "jsCallback" => '$("#' . $this->identifier . '").trigger("pageChange");$("#' . $this->identifier . '").trigger("activeRowChange");' |
|
| 322 | + "jsCallback" => '$("#'.$this->identifier.'").trigger("pageChange");$("#'.$this->identifier.'").trigger("activeRowChange");' |
|
| 323 | 323 | ]); |
| 324 | - $page = $_POST["p"] ?? null; |
|
| 324 | + $page=$_POST["p"] ?? null; |
|
| 325 | 325 | if (isset($page)) { |
| 326 | - $js->execAtLast('$("#' . $this->getIdentifier() . ' .pagination").children("a.item").removeClass("active");$("#' . $this->getIdentifier() . ' .pagination").children("a.item[data-page=' . $page . ']:not(.no-active)").addClass("active");'); |
|
| 326 | + $js->execAtLast('$("#'.$this->getIdentifier().' .pagination").children("a.item").removeClass("active");$("#'.$this->getIdentifier().' .pagination").children("a.item[data-page='.$page.']:not(.no-active)").addClass("active");'); |
|
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | } |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - protected function _compileSearchFieldBehavior(JsUtils $js = NULL) { |
|
| 332 | + protected function _compileSearchFieldBehavior(JsUtils $js=NULL) { |
|
| 333 | 333 | if (isset($this->_searchField) && isset($js) && isset($this->_urls["refresh"])) { |
| 334 | - $this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(self).val(),'_model':'" . JString::doubleBackSlashes($this->_model) . "'}", "#" . $this->identifier . " tbody", [ |
|
| 334 | + $this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(self).val(),'_model':'".JString::doubleBackSlashes($this->_model)."'}", "#".$this->identifier." tbody", [ |
|
| 335 | 335 | "preventDefault" => false, |
| 336 | 336 | "jqueryDone" => "replaceWith", |
| 337 | 337 | "hasLoader" => "internal", |
| 338 | - "jsCallback" => '$("#' . $this->identifier . '").trigger("searchTerminate",[$(self).val()]);' |
|
| 338 | + "jsCallback" => '$("#'.$this->identifier.'").trigger("searchTerminate",[$(self).val()]);' |
|
| 339 | 339 | ]); |
| 340 | 340 | } |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - protected function _associateSearchFieldBehavior(JsUtils $js = NULL, $offset = null) {} |
|
| 343 | + protected function _associateSearchFieldBehavior(JsUtils $js=NULL, $offset=null) {} |
|
| 344 | 344 | |
| 345 | 345 | protected function _getFieldName($index) { |
| 346 | - $fieldName = parent::_getFieldName($index); |
|
| 346 | + $fieldName=parent::_getFieldName($index); |
|
| 347 | 347 | if (\is_object($fieldName)) |
| 348 | - $fieldName = "field-" . $index; |
|
| 349 | - return $fieldName . "[]"; |
|
| 348 | + $fieldName="field-".$index; |
|
| 349 | + return $fieldName."[]"; |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | protected function _getFieldCaption($index) { |
| 353 | 353 | return null; |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | - protected function _setToolbarPosition($table, $captions = NULL) { |
|
| 356 | + protected function _setToolbarPosition($table, $captions=NULL) { |
|
| 357 | 357 | switch ($this->_toolbarPosition) { |
| 358 | 358 | case PositionInTable::BEFORETABLE: |
| 359 | 359 | case PositionInTable::AFTERTABLE: |
| 360 | - if (isset($this->_compileParts) === false) { |
|
| 361 | - $this->content[$this->_toolbarPosition] = $this->_toolbar; |
|
| 360 | + if (isset($this->_compileParts)===false) { |
|
| 361 | + $this->content[$this->_toolbarPosition]=$this->_toolbar; |
|
| 362 | 362 | } |
| 363 | 363 | break; |
| 364 | 364 | case PositionInTable::HEADER: |
@@ -385,11 +385,11 @@ discard block |
||
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | private function addToolbarRow($part, $table, $captions) { |
| 388 | - $hasPart = $table->hasPart($part); |
|
| 388 | + $hasPart=$table->hasPart($part); |
|
| 389 | 389 | if ($hasPart) { |
| 390 | - $row = $table->getPart($part)->addRow(\sizeof($captions)); |
|
| 390 | + $row=$table->getPart($part)->addRow(\sizeof($captions)); |
|
| 391 | 391 | } else { |
| 392 | - $row = $table->getPart($part)->getRow(0); |
|
| 392 | + $row=$table->getPart($part)->getRow(0); |
|
| 393 | 393 | } |
| 394 | 394 | $row->mergeCol(); |
| 395 | 395 | $row->setValues([ |
@@ -421,12 +421,12 @@ discard block |
||
| 421 | 421 | */ |
| 422 | 422 | public function setUrls($urls) { |
| 423 | 423 | if (\is_array($urls)) { |
| 424 | - $this->_urls["refresh"] = JArray::getValue($urls, "refresh", 0); |
|
| 425 | - $this->_urls["edit"] = JArray::getValue($urls, "edit", 1); |
|
| 426 | - $this->_urls["delete"] = JArray::getValue($urls, "delete", 2); |
|
| 427 | - $this->_urls["display"] = JArray::getValue($urls, "display", 3); |
|
| 424 | + $this->_urls["refresh"]=JArray::getValue($urls, "refresh", 0); |
|
| 425 | + $this->_urls["edit"]=JArray::getValue($urls, "edit", 1); |
|
| 426 | + $this->_urls["delete"]=JArray::getValue($urls, "delete", 2); |
|
| 427 | + $this->_urls["display"]=JArray::getValue($urls, "display", 3); |
|
| 428 | 428 | } else { |
| 429 | - $this->_urls = [ |
|
| 429 | + $this->_urls=[ |
|
| 430 | 430 | "refresh" => $urls, |
| 431 | 431 | "edit" => $urls, |
| 432 | 432 | "delete" => $urls, |
@@ -449,8 +449,8 @@ discard block |
||
| 449 | 449 | * The number of visible pages in the Pagination component |
| 450 | 450 | * @return DataTable |
| 451 | 451 | */ |
| 452 | - public function paginate($page, $total_rowcount, $items_per_page = 10, $pages_visibles = null) { |
|
| 453 | - $this->_pagination = new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount); |
|
| 452 | + public function paginate($page, $total_rowcount, $items_per_page=10, $pages_visibles=null) { |
|
| 453 | + $this->_pagination=new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount); |
|
| 454 | 454 | return $this; |
| 455 | 455 | } |
| 456 | 456 | |
@@ -465,8 +465,8 @@ discard block |
||
| 465 | 465 | * The number of visible pages in the Pagination component |
| 466 | 466 | * @return DataTable |
| 467 | 467 | */ |
| 468 | - public function autoPaginate($page = 1, $items_per_page = 10, $pages_visibles = 4) { |
|
| 469 | - $this->_pagination = new Pagination($items_per_page, $pages_visibles, $page); |
|
| 468 | + public function autoPaginate($page=1, $items_per_page=10, $pages_visibles=4) { |
|
| 469 | + $this->_pagination=new Pagination($items_per_page, $pages_visibles, $page); |
|
| 470 | 470 | return $this; |
| 471 | 471 | } |
| 472 | 472 | |
@@ -475,10 +475,10 @@ discard block |
||
| 475 | 475 | * @param array $compileParts |
| 476 | 476 | * @return DataTable |
| 477 | 477 | */ |
| 478 | - public function refresh($compileParts = [ |
|
| 478 | + public function refresh($compileParts=[ |
|
| 479 | 479 | "tbody" |
| 480 | 480 | ]) { |
| 481 | - $this->_compileParts = $compileParts; |
|
| 481 | + $this->_compileParts=$compileParts; |
|
| 482 | 482 | return $this; |
| 483 | 483 | } |
| 484 | 484 | |
@@ -488,14 +488,14 @@ discard block |
||
| 488 | 488 | * @param string $position |
| 489 | 489 | * @return \Ajax\common\html\HtmlDoubleElement |
| 490 | 490 | */ |
| 491 | - public function addSearchInToolbar($position = Direction::RIGHT) { |
|
| 491 | + public function addSearchInToolbar($position=Direction::RIGHT) { |
|
| 492 | 492 | return $this->addInToolbar($this->getSearchField()) |
| 493 | 493 | ->setPosition($position); |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | public function getSearchField() { |
| 497 | - if (isset($this->_searchField) === false) { |
|
| 498 | - $this->_searchField = new HtmlInput("search-" . $this->identifier, "search", "", "Search..."); |
|
| 497 | + if (isset($this->_searchField)===false) { |
|
| 498 | + $this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search..."); |
|
| 499 | 499 | $this->_searchField->addIcon("search", Direction::RIGHT); |
| 500 | 500 | } |
| 501 | 501 | return $this->_searchField; |
@@ -523,9 +523,9 @@ discard block |
||
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | protected function getTargetSelector($op) { |
| 526 | - $result = $this->_targetSelector; |
|
| 527 | - if (! isset($result[$op])) |
|
| 528 | - $result = "#" . $this->identifier; |
|
| 526 | + $result=$this->_targetSelector; |
|
| 527 | + if (!isset($result[$op])) |
|
| 528 | + $result="#".$this->identifier; |
|
| 529 | 529 | return $result[$op]; |
| 530 | 530 | } |
| 531 | 531 | |
@@ -537,20 +537,20 @@ discard block |
||
| 537 | 537 | * @return DataTable |
| 538 | 538 | */ |
| 539 | 539 | public function setTargetSelector($_targetSelector) { |
| 540 | - if (! \is_array($_targetSelector)) { |
|
| 541 | - $_targetSelector = [ |
|
| 540 | + if (!\is_array($_targetSelector)) { |
|
| 541 | + $_targetSelector=[ |
|
| 542 | 542 | "edit" => $_targetSelector, |
| 543 | 543 | "delete" => $_targetSelector |
| 544 | 544 | ]; |
| 545 | 545 | } |
| 546 | - $this->_targetSelector = $_targetSelector; |
|
| 546 | + $this->_targetSelector=$_targetSelector; |
|
| 547 | 547 | return $this; |
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | public function getRefreshSelector() { |
| 551 | 551 | if (isset($this->_refreshSelector)) |
| 552 | 552 | return $this->_refreshSelector; |
| 553 | - return "#" . $this->identifier . " tbody"; |
|
| 553 | + return "#".$this->identifier." tbody"; |
|
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | /** |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | * @return DataTable |
| 560 | 560 | */ |
| 561 | 561 | public function setRefreshSelector($_refreshSelector) { |
| 562 | - $this->_refreshSelector = $_refreshSelector; |
|
| 562 | + $this->_refreshSelector=$_refreshSelector; |
|
| 563 | 563 | return $this; |
| 564 | 564 | } |
| 565 | 565 | |
@@ -571,9 +571,9 @@ discard block |
||
| 571 | 571 | public function show($modelInstance) { |
| 572 | 572 | if (\is_array($modelInstance)) { |
| 573 | 573 | if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) |
| 574 | - $modelInstance = \json_decode(\json_encode($modelInstance), FALSE); |
|
| 574 | + $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
| 575 | 575 | } |
| 576 | - $this->_modelInstance = $modelInstance; |
|
| 576 | + $this->_modelInstance=$modelInstance; |
|
| 577 | 577 | } |
| 578 | 578 | |
| 579 | 579 | public function getRowClass() { |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | * @return DataTable |
| 588 | 588 | */ |
| 589 | 589 | public function setRowClass($_rowClass) { |
| 590 | - $this->_rowClass = $_rowClass; |
|
| 590 | + $this->_rowClass=$_rowClass; |
|
| 591 | 591 | return $this; |
| 592 | 592 | } |
| 593 | 593 | |
@@ -598,34 +598,34 @@ discard block |
||
| 598 | 598 | * @return DataTable |
| 599 | 599 | */ |
| 600 | 600 | public function setEmptyMessage($_emptyMessage) { |
| 601 | - $this->_emptyMessage = $_emptyMessage; |
|
| 601 | + $this->_emptyMessage=$_emptyMessage; |
|
| 602 | 602 | return $this; |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | - public function setSortable($colIndex = NULL) { |
|
| 606 | - $this->_sortable = $colIndex; |
|
| 605 | + public function setSortable($colIndex=NULL) { |
|
| 606 | + $this->_sortable=$colIndex; |
|
| 607 | 607 | return $this; |
| 608 | 608 | } |
| 609 | 609 | |
| 610 | - public function setActiveRowSelector($class = "active", $event = "click", $multiple = false) { |
|
| 610 | + public function setActiveRowSelector($class="active", $event="click", $multiple=false) { |
|
| 611 | 611 | $this->_self->setActiveRowSelector($class, $event, $multiple); |
| 612 | 612 | return $this; |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | public function hideColumn($colIndex) { |
| 616 | - if (! \is_array($this->_hiddenColumns)) |
|
| 617 | - $this->_hiddenColumns = []; |
|
| 618 | - $this->_hiddenColumns[] = $colIndex; |
|
| 616 | + if (!\is_array($this->_hiddenColumns)) |
|
| 617 | + $this->_hiddenColumns=[]; |
|
| 618 | + $this->_hiddenColumns[]=$colIndex; |
|
| 619 | 619 | return $this; |
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | public function setColWidth($colIndex, $width) { |
| 623 | - $this->_colWidths[$colIndex] = $width; |
|
| 623 | + $this->_colWidths[$colIndex]=$width; |
|
| 624 | 624 | return $this; |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | public function setColWidths($_colWidths) { |
| 628 | - $this->_colWidths = $_colWidths; |
|
| 628 | + $this->_colWidths=$_colWidths; |
|
| 629 | 629 | return $this; |
| 630 | 630 | } |
| 631 | 631 | |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | return $this; |
| 635 | 635 | } |
| 636 | 636 | |
| 637 | - public function trigger($event, $params = "[]") { |
|
| 637 | + public function trigger($event, $params="[]") { |
|
| 638 | 638 | return $this->getHtmlComponent()->trigger($event, $params); |
| 639 | 639 | } |
| 640 | 640 | |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | * @param mixed $_displayBehavior |
| 673 | 673 | */ |
| 674 | 674 | public function setDisplayBehavior($_displayBehavior) { |
| 675 | - $this->_displayBehavior = $_displayBehavior; |
|
| 675 | + $this->_displayBehavior=$_displayBehavior; |
|
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | /** |
@@ -696,6 +696,6 @@ discard block |
||
| 696 | 696 | * @param boolean $_visibleHover |
| 697 | 697 | */ |
| 698 | 698 | public function setVisibleHover($_visibleHover) { |
| 699 | - $this->_visibleHover = $_visibleHover; |
|
| 699 | + $this->_visibleHover=$_visibleHover; |
|
| 700 | 700 | } |
| 701 | 701 | } |