@@ -29,12 +29,12 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @var string|array |
| 31 | 31 | */ |
| 32 | - protected $_contentSeparator = ""; |
|
| 32 | + protected $_contentSeparator=""; |
|
| 33 | 33 | |
| 34 | 34 | public function __construct($identifier, $tagName, $baseClass) { |
| 35 | 35 | parent::__construct($identifier, $tagName, $baseClass); |
| 36 | - $this->root = ""; |
|
| 37 | - $this->attr = "data-ajax"; |
|
| 36 | + $this->root=""; |
|
| 37 | + $this->attr="data-ajax"; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -54,23 +54,23 @@ discard block |
||
| 54 | 54 | return JArray::implode($this->_contentSeparator, $this->content); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - public function setContentDivider($divider, $index = NULL) { |
|
| 58 | - $divider = "<div class='divider'> {$divider} </div>"; |
|
| 57 | + public function setContentDivider($divider, $index=NULL) { |
|
| 58 | + $divider="<div class='divider'> {$divider} </div>"; |
|
| 59 | 59 | return $this->setDivider($divider, $index); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public function setIconContentDivider($iconContentDivider, $index = NULL) { |
|
| 63 | - $contentDivider = "<i class='" . $iconContentDivider . " icon divider'></i>"; |
|
| 62 | + public function setIconContentDivider($iconContentDivider, $index=NULL) { |
|
| 63 | + $contentDivider="<i class='".$iconContentDivider." icon divider'></i>"; |
|
| 64 | 64 | return $this->setDivider($contentDivider, $index); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | protected function setDivider($divider, $index) { |
| 68 | 68 | if (isset($index)) { |
| 69 | - if (! \is_array($this->_contentSeparator)) |
|
| 70 | - $this->_contentSeparator = array_fill(0, $this->count() - 1, $this->_contentSeparator); |
|
| 71 | - $this->_contentSeparator[$index] = $divider; |
|
| 69 | + if (!\is_array($this->_contentSeparator)) |
|
| 70 | + $this->_contentSeparator=array_fill(0, $this->count()-1, $this->_contentSeparator); |
|
| 71 | + $this->_contentSeparator[$index]=$divider; |
|
| 72 | 72 | } else { |
| 73 | - $this->_contentSeparator = $divider; |
|
| 73 | + $this->_contentSeparator=$divider; |
|
| 74 | 74 | } |
| 75 | 75 | return $this; |
| 76 | 76 | } |
@@ -66,8 +66,9 @@ |
||
| 66 | 66 | |
| 67 | 67 | protected function setDivider($divider, $index) { |
| 68 | 68 | if (isset($index)) { |
| 69 | - if (! \is_array($this->_contentSeparator)) |
|
| 70 | - $this->_contentSeparator = array_fill(0, $this->count() - 1, $this->_contentSeparator); |
|
| 69 | + if (! \is_array($this->_contentSeparator)) { |
|
| 70 | + $this->_contentSeparator = array_fill(0, $this->count() - 1, $this->_contentSeparator); |
|
| 71 | + } |
|
| 71 | 72 | $this->_contentSeparator[$index] = $divider; |
| 72 | 73 | } else { |
| 73 | 74 | $this->_contentSeparator = $divider; |
@@ -16,11 +16,11 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class HtmlModal extends HtmlSemDoubleElement { |
| 18 | 18 | |
| 19 | - protected $_params = []; |
|
| 19 | + protected $_params=[]; |
|
| 20 | 20 | |
| 21 | - protected $_paramParts = []; |
|
| 21 | + protected $_paramParts=[]; |
|
| 22 | 22 | |
| 23 | - public function __construct($identifier, $header = '', $content = '', $actions = null) { |
|
| 23 | + public function __construct($identifier, $header='', $content='', $actions=null) { |
|
| 24 | 24 | parent::__construct($identifier, 'div', 'ui modal'); |
| 25 | 25 | if (isset($header)) { |
| 26 | 26 | $this->setHeader($header); |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public function setHeader($value) { |
| 37 | - $this->content['header'] = new HtmlSemDoubleElement('header-' . $this->identifier, 'a', 'header', $value); |
|
| 37 | + $this->content['header']=new HtmlSemDoubleElement('header-'.$this->identifier, 'a', 'header', $value); |
|
| 38 | 38 | return $this; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public function setContent($value) { |
| 42 | - $this->content['content'] = new HtmlSemDoubleElement('content-' . $this->identifier, 'div', 'content', $value); |
|
| 42 | + $this->content['content']=new HtmlSemDoubleElement('content-'.$this->identifier, 'div', 'content', $value); |
|
| 43 | 43 | return $this; |
| 44 | 44 | } |
| 45 | 45 | |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | * @return HtmlButton[] |
| 51 | 51 | */ |
| 52 | 52 | public function setActions($actions): array { |
| 53 | - $this->content['actions'] = new HtmlSemDoubleElement('content-' . $this->identifier, 'div', 'actions'); |
|
| 54 | - $r = []; |
|
| 53 | + $this->content['actions']=new HtmlSemDoubleElement('content-'.$this->identifier, 'div', 'actions'); |
|
| 54 | + $r=[]; |
|
| 55 | 55 | if (\is_array($actions)) { |
| 56 | 56 | foreach ($actions as $action) { |
| 57 | - $r[] = $this->addAction($action); |
|
| 57 | + $r[]=$this->addAction($action); |
|
| 58 | 58 | } |
| 59 | 59 | } else { |
| 60 | - $r[] = $this->addAction($actions); |
|
| 60 | + $r[]=$this->addAction($actions); |
|
| 61 | 61 | } |
| 62 | 62 | return $r; |
| 63 | 63 | } |
@@ -68,24 +68,24 @@ discard block |
||
| 68 | 68 | * @return HtmlButton |
| 69 | 69 | */ |
| 70 | 70 | public function addAction($action) { |
| 71 | - if (! $action instanceof BaseHtml) { |
|
| 72 | - $class = ''; |
|
| 71 | + if (!$action instanceof BaseHtml) { |
|
| 72 | + $class=''; |
|
| 73 | 73 | if (\array_search($action, [ |
| 74 | 74 | 'Okay', |
| 75 | 75 | 'Yes', |
| 76 | 76 | 'Validate' |
| 77 | - ]) !== false) { |
|
| 78 | - $class = 'approve'; |
|
| 77 | + ])!==false) { |
|
| 78 | + $class='approve'; |
|
| 79 | 79 | } |
| 80 | 80 | if (\array_search($action, [ |
| 81 | 81 | 'Close', |
| 82 | 82 | 'Cancel', |
| 83 | 83 | 'No' |
| 84 | - ]) !== false) { |
|
| 85 | - $class = 'cancel'; |
|
| 84 | + ])!==false) { |
|
| 85 | + $class='cancel'; |
|
| 86 | 86 | } |
| 87 | - $action = new HtmlButton('action-' . $this->identifier . '-' . JArray::count($this->content['actions']->getContent()), $action); |
|
| 88 | - if ($class !== '') |
|
| 87 | + $action=new HtmlButton('action-'.$this->identifier.'-'.JArray::count($this->content['actions']->getContent()), $action); |
|
| 88 | + if ($class!=='') |
|
| 89 | 89 | $action->addToProperty('class', $class); |
| 90 | 90 | } |
| 91 | 91 | return $this->addElementInPart($action, 'actions'); |
@@ -100,33 +100,33 @@ discard block |
||
| 100 | 100 | return $this->content['actions']->getContent()[$index]; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - public function addContent($content, $before = false) { |
|
| 103 | + public function addContent($content, $before=false) { |
|
| 104 | 104 | $this->content['content']->addContent($content, $before); |
| 105 | 105 | return $this; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - public function addImageContent($image, $description = NULL) { |
|
| 109 | - $content = $this->content['content']; |
|
| 108 | + public function addImageContent($image, $description=NULL) { |
|
| 109 | + $content=$this->content['content']; |
|
| 110 | 110 | if (isset($description)) { |
| 111 | - $description = new HtmlSemDoubleElement('description-' . $this->identifier, 'div', 'description', $description); |
|
| 111 | + $description=new HtmlSemDoubleElement('description-'.$this->identifier, 'div', 'description', $description); |
|
| 112 | 112 | $content->addContent($description, true); |
| 113 | 113 | } |
| 114 | - if ($image !== '') { |
|
| 115 | - $img = new HtmlImage('image-' . $this->identifier, $image, '', 'medium'); |
|
| 114 | + if ($image!=='') { |
|
| 115 | + $img=new HtmlImage('image-'.$this->identifier, $image, '', 'medium'); |
|
| 116 | 116 | $content->addContent($img, true); |
| 117 | 117 | $content->addToProperty('class', 'image'); |
| 118 | 118 | } |
| 119 | 119 | return $this; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - public function addIconContent($icon, $description = NULL) { |
|
| 123 | - $content = $this->content['content']; |
|
| 122 | + public function addIconContent($icon, $description=NULL) { |
|
| 123 | + $content=$this->content['content']; |
|
| 124 | 124 | if (isset($description)) { |
| 125 | - $description = new HtmlSemDoubleElement('description-' . $this->identifier, 'div', 'description', $description); |
|
| 125 | + $description=new HtmlSemDoubleElement('description-'.$this->identifier, 'div', 'description', $description); |
|
| 126 | 126 | $content->addContent($description, true); |
| 127 | 127 | } |
| 128 | - if ($icon !== '') { |
|
| 129 | - $img = new HtmlIcon('image-' . $this->identifier, $icon); |
|
| 128 | + if ($icon!=='') { |
|
| 129 | + $img=new HtmlIcon('image-'.$this->identifier, $icon); |
|
| 130 | 130 | $content->addContent($img, true); |
| 131 | 131 | $content->addToProperty('class', 'image'); |
| 132 | 132 | } |
@@ -139,15 +139,15 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | public function showDimmer($value) { |
| 142 | - $value = $value ? 'show' : 'hide'; |
|
| 143 | - $this->_paramParts[] = [ |
|
| 144 | - "'" . $value . " dimmer'" |
|
| 142 | + $value=$value ? 'show' : 'hide'; |
|
| 143 | + $this->_paramParts[]=[ |
|
| 144 | + "'".$value." dimmer'" |
|
| 145 | 145 | ]; |
| 146 | 146 | return $this; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - public function setInverted($recursive = true) { |
|
| 150 | - $this->_params['inverted'] = true; |
|
| 149 | + public function setInverted($recursive=true) { |
|
| 150 | + $this->_params['inverted']=true; |
|
| 151 | 151 | return $this; |
| 152 | 152 | } |
| 153 | 153 | |
@@ -156,10 +156,10 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | public function setTransition($value) { |
| 159 | - $this->_paramParts[] = [ |
|
| 159 | + $this->_paramParts[]=[ |
|
| 160 | 160 | "'setting'", |
| 161 | 161 | "'transition'", |
| 162 | - "'" . $value . "'" |
|
| 162 | + "'".$value."'" |
|
| 163 | 163 | ]; |
| 164 | 164 | } |
| 165 | 165 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * @param array $params |
| 173 | 173 | * The parameters to pass to the view |
| 174 | 174 | */ |
| 175 | - public function renderView(JsUtils $js, $initialController, $viewName, $params = array()) { |
|
| 175 | + public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) { |
|
| 176 | 176 | return $this->setContent($js->renderContent($initialController, $viewName, $params)); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * the action name |
| 188 | 188 | * @param array $params |
| 189 | 189 | */ |
| 190 | - public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params = NULL) { |
|
| 190 | + public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
| 191 | 191 | return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params)); |
| 192 | 192 | } |
| 193 | 193 | |
@@ -197,8 +197,8 @@ discard block |
||
| 197 | 197 | * |
| 198 | 198 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 199 | 199 | */ |
| 200 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
| 201 | - $this->content = JArray::sortAssociative($this->content, [ |
|
| 200 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 201 | + $this->content=JArray::sortAssociative($this->content, [ |
|
| 202 | 202 | 'header', |
| 203 | 203 | 'content', |
| 204 | 204 | 'actions' |
@@ -214,14 +214,14 @@ discard block |
||
| 214 | 214 | * @see BaseHtml::run() |
| 215 | 215 | */ |
| 216 | 216 | public function run(JsUtils $js) { |
| 217 | - if (isset($this->_bsComponent) === false) |
|
| 218 | - $this->_bsComponent = $js->semantic()->modal('#' . $this->identifier, $this->_params, $this->_paramParts); |
|
| 217 | + if (isset($this->_bsComponent)===false) |
|
| 218 | + $this->_bsComponent=$js->semantic()->modal('#'.$this->identifier, $this->_params, $this->_paramParts); |
|
| 219 | 219 | $this->addEventsOnRun($js); |
| 220 | 220 | return $this->_bsComponent; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | public function jsDo($behavior) { |
| 224 | - return "$('#" . $this->identifier . "').modal('" . $behavior . "');"; |
|
| 224 | + return "$('#".$this->identifier."').modal('".$behavior."');"; |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | public function jsHide() { |
@@ -229,6 +229,6 @@ discard block |
||
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | public function onHidden($js) { |
| 232 | - $this->_params['onHidden'] = $js; |
|
| 232 | + $this->_params['onHidden']=$js; |
|
| 233 | 233 | } |
| 234 | 234 | } |
@@ -85,8 +85,9 @@ discard block |
||
| 85 | 85 | $class = 'cancel'; |
| 86 | 86 | } |
| 87 | 87 | $action = new HtmlButton('action-' . $this->identifier . '-' . JArray::count($this->content['actions']->getContent()), $action); |
| 88 | - if ($class !== '') |
|
| 89 | - $action->addToProperty('class', $class); |
|
| 88 | + if ($class !== '') { |
|
| 89 | + $action->addToProperty('class', $class); |
|
| 90 | + } |
|
| 90 | 91 | } |
| 91 | 92 | return $this->addElementInPart($action, 'actions'); |
| 92 | 93 | } |
@@ -214,8 +215,9 @@ discard block |
||
| 214 | 215 | * @see BaseHtml::run() |
| 215 | 216 | */ |
| 216 | 217 | public function run(JsUtils $js) { |
| 217 | - if (isset($this->_bsComponent) === false) |
|
| 218 | - $this->_bsComponent = $js->semantic()->modal('#' . $this->identifier, $this->_params, $this->_paramParts); |
|
| 218 | + if (isset($this->_bsComponent) === false) { |
|
| 219 | + $this->_bsComponent = $js->semantic()->modal('#' . $this->identifier, $this->_params, $this->_paramParts); |
|
| 220 | + } |
|
| 219 | 221 | $this->addEventsOnRun($js); |
| 220 | 222 | return $this->_bsComponent; |
| 221 | 223 | } |
@@ -86,16 +86,19 @@ discard block |
||
| 86 | 86 | "stopPropagation" => true |
| 87 | 87 | ]); |
| 88 | 88 | } |
| 89 | - if (\is_array($this->_deleteBehavior)) |
|
| 90 | - $this->_generateBehavior("delete", $this->_deleteBehavior, $js); |
|
| 91 | - if (\is_array($this->_editBehavior)) |
|
| 92 | - $this->_generateBehavior("edit", $this->_editBehavior, $js); |
|
| 89 | + if (\is_array($this->_deleteBehavior)) { |
|
| 90 | + $this->_generateBehavior("delete", $this->_deleteBehavior, $js); |
|
| 91 | + } |
|
| 92 | + if (\is_array($this->_editBehavior)) { |
|
| 93 | + $this->_generateBehavior("edit", $this->_editBehavior, $js); |
|
| 94 | + } |
|
| 93 | 95 | if (\is_array($this->_displayBehavior)) { |
| 94 | 96 | $this->_generateBehavior("display", $this->_displayBehavior, $js); |
| 95 | 97 | } |
| 96 | 98 | parent::run($js); |
| 97 | - if (isset($this->_pagination)) |
|
| 98 | - $this->_associatePaginationBehavior($js, $offset); |
|
| 99 | + if (isset($this->_pagination)) { |
|
| 100 | + $this->_associatePaginationBehavior($js, $offset); |
|
| 101 | + } |
|
| 99 | 102 | $this->_associateSearchFieldBehavior($js, $offset); |
| 100 | 103 | $this->_runned = true; |
| 101 | 104 | } |
@@ -146,8 +149,9 @@ discard block |
||
| 146 | 149 | $table->setRowCount(0, \count($captions)); |
| 147 | 150 | $this->_generateHeader($table, $captions); |
| 148 | 151 | |
| 149 | - if (isset($this->_compileParts)) |
|
| 150 | - $table->setCompileParts($this->_compileParts); |
|
| 152 | + if (isset($this->_compileParts)) { |
|
| 153 | + $table->setCompileParts($this->_compileParts); |
|
| 154 | + } |
|
| 151 | 155 | |
| 152 | 156 | $this->_generateContent($table); |
| 153 | 157 | |
@@ -182,8 +186,9 @@ discard block |
||
| 182 | 186 | } |
| 183 | 187 | |
| 184 | 188 | protected function _applyStyleAttributes($table) { |
| 185 | - if (isset($this->_hiddenColumns)) |
|
| 186 | - $this->_hideColumns(); |
|
| 189 | + if (isset($this->_hiddenColumns)) { |
|
| 190 | + $this->_hideColumns(); |
|
| 191 | + } |
|
| 187 | 192 | if (isset($this->_colWidths)) { |
| 188 | 193 | foreach ($this->_colWidths as $colIndex => $width) { |
| 189 | 194 | $table->setColWidth($colIndex, $width); |
@@ -296,8 +301,9 @@ discard block |
||
| 296 | 301 | $field = $ck->getField(); |
| 297 | 302 | $field->setProperty("value", $dataAjax); |
| 298 | 303 | $field->setProperty("name", "selection[]"); |
| 299 | - if (isset($checkedClass)) |
|
| 300 | - $field->setClass($checkedClass); |
|
| 304 | + if (isset($checkedClass)) { |
|
| 305 | + $field->setClass($checkedClass); |
|
| 306 | + } |
|
| 301 | 307 | \array_unshift($values, $ck); |
| 302 | 308 | } |
| 303 | 309 | $result = $table->newRow(); |
@@ -314,8 +320,9 @@ discard block |
||
| 314 | 320 | |
| 315 | 321 | protected function _generatePagination($table) { |
| 316 | 322 | if (isset($this->_toolbar)) { |
| 317 | - if ($this->_toolbarPosition == PositionInTable::FOOTER) |
|
| 318 | - $this->_toolbar->setFloated("left"); |
|
| 323 | + if ($this->_toolbarPosition == PositionInTable::FOOTER) { |
|
| 324 | + $this->_toolbar->setFloated("left"); |
|
| 325 | + } |
|
| 319 | 326 | } |
| 320 | 327 | $footer = $table->getFooter(); |
| 321 | 328 | $footer->mergeCol(); |
@@ -356,8 +363,9 @@ discard block |
||
| 356 | 363 | |
| 357 | 364 | protected function _getFieldName($index) { |
| 358 | 365 | $fieldName = parent::_getFieldName($index); |
| 359 | - if (\is_object($fieldName)) |
|
| 360 | - $fieldName = "field-" . $index; |
|
| 366 | + if (\is_object($fieldName)) { |
|
| 367 | + $fieldName = "field-" . $index; |
|
| 368 | + } |
|
| 361 | 369 | return $fieldName . "[]"; |
| 362 | 370 | } |
| 363 | 371 | |
@@ -546,8 +554,9 @@ discard block |
||
| 546 | 554 | |
| 547 | 555 | protected function getTargetSelector($op) { |
| 548 | 556 | $result = $this->_targetSelector; |
| 549 | - if (! isset($result[$op])) |
|
| 550 | - $result = "#" . $this->identifier; |
|
| 557 | + if (! isset($result[$op])) { |
|
| 558 | + $result = "#" . $this->identifier; |
|
| 559 | + } |
|
| 551 | 560 | return $result[$op]; |
| 552 | 561 | } |
| 553 | 562 | |
@@ -570,8 +579,9 @@ discard block |
||
| 570 | 579 | } |
| 571 | 580 | |
| 572 | 581 | public function getRefreshSelector() { |
| 573 | - if (isset($this->_refreshSelector)) |
|
| 574 | - return $this->_refreshSelector; |
|
| 582 | + if (isset($this->_refreshSelector)) { |
|
| 583 | + return $this->_refreshSelector; |
|
| 584 | + } |
|
| 575 | 585 | return "#" . $this->identifier . " tbody"; |
| 576 | 586 | } |
| 577 | 587 | |
@@ -592,8 +602,9 @@ discard block |
||
| 592 | 602 | */ |
| 593 | 603 | public function show($modelInstance) { |
| 594 | 604 | if (\is_array($modelInstance)) { |
| 595 | - if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) |
|
| 596 | - $modelInstance = \json_decode(\json_encode($modelInstance), FALSE); |
|
| 605 | + if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) { |
|
| 606 | + $modelInstance = \json_decode(\json_encode($modelInstance), FALSE); |
|
| 607 | + } |
|
| 597 | 608 | } |
| 598 | 609 | $this->_modelInstance = $modelInstance; |
| 599 | 610 | } |
@@ -639,8 +650,9 @@ discard block |
||
| 639 | 650 | } |
| 640 | 651 | |
| 641 | 652 | public function hideColumn($colIndex) { |
| 642 | - if (! \is_array($this->_hiddenColumns)) |
|
| 643 | - $this->_hiddenColumns = []; |
|
| 653 | + if (! \is_array($this->_hiddenColumns)) { |
|
| 654 | + $this->_hiddenColumns = []; |
|
| 655 | + } |
|
| 644 | 656 | $this->_hiddenColumns[] = $colIndex; |
| 645 | 657 | return $this; |
| 646 | 658 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | */ |
| 27 | 27 | class DataTable extends Widget { |
| 28 | - use TableTrait,DataTableFieldAsTrait,HasCheckboxesTrait,BaseTrait; |
|
| 28 | + use TableTrait, DataTableFieldAsTrait, HasCheckboxesTrait, BaseTrait; |
|
| 29 | 29 | |
| 30 | 30 | protected $_searchField; |
| 31 | 31 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | protected $_displayBehavior; |
| 43 | 43 | |
| 44 | - protected $_visibleHover = false; |
|
| 44 | + protected $_visibleHover=false; |
|
| 45 | 45 | |
| 46 | 46 | protected $_targetSelector; |
| 47 | 47 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | protected $_json; |
| 53 | 53 | |
| 54 | - protected $_rowClass = "_element"; |
|
| 54 | + protected $_rowClass="_element"; |
|
| 55 | 55 | |
| 56 | 56 | protected $_sortable; |
| 57 | 57 | |
@@ -61,26 +61,26 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | protected $_paginationToolbar; |
| 63 | 63 | |
| 64 | - public function __construct($identifier, $model, $modelInstance = NULL) { |
|
| 64 | + public function __construct($identifier, $model, $modelInstance=NULL) { |
|
| 65 | 65 | parent::__construct($identifier, $model, $modelInstance); |
| 66 | 66 | $this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 0), false); |
| 67 | - $this->_urls = []; |
|
| 68 | - $this->_emptyMessage = new HtmlMessage("", "nothing to display"); |
|
| 67 | + $this->_urls=[]; |
|
| 68 | + $this->_emptyMessage=new HtmlMessage("", "nothing to display"); |
|
| 69 | 69 | $this->_emptyMessage->setIcon("info circle"); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | public function run(JsUtils $js) { |
| 73 | - if ($this->_runned !== true) { |
|
| 74 | - $offset = $js->scriptCount(); |
|
| 73 | + if ($this->_runned!==true) { |
|
| 74 | + $offset=$js->scriptCount(); |
|
| 75 | 75 | if ($this->_hasCheckboxes && isset($js)) { |
| 76 | 76 | $this->_runCheckboxes($js); |
| 77 | 77 | } |
| 78 | 78 | if ($this->_visibleHover) { |
| 79 | - $js->execOn("mouseover", "#" . $this->identifier . " tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'visible');", [ |
|
| 79 | + $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'visible');", [ |
|
| 80 | 80 | "preventDefault" => false, |
| 81 | 81 | "stopPropagation" => true |
| 82 | 82 | ]); |
| 83 | - $js->execOn("mouseout", "#" . $this->identifier . " tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'hidden');$(event.currentTarget).trigger('visibleoverOut');", [ |
|
| 83 | + $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'hidden');$(event.currentTarget).trigger('visibleoverOut');", [ |
|
| 84 | 84 | "preventDefault" => false, |
| 85 | 85 | "stopPropagation" => true |
| 86 | 86 | ]); |
@@ -96,16 +96,16 @@ discard block |
||
| 96 | 96 | if (isset($this->_pagination)) |
| 97 | 97 | $this->_associatePaginationBehavior($js, $offset); |
| 98 | 98 | $this->_associateSearchFieldBehavior($js, $offset); |
| 99 | - $this->_runned = true; |
|
| 99 | + $this->_runned=true; |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | protected function _generateBehavior($op, $params, JsUtils $js) { |
| 104 | 104 | if (isset($this->_urls[$op])) { |
| 105 | - $params = \array_merge($params, [ |
|
| 105 | + $params=\array_merge($params, [ |
|
| 106 | 106 | "attr" => "data-ajax" |
| 107 | 107 | ]); |
| 108 | - $js->ajaxOnClick("#" . $this->identifier . " ._" . $op, $this->_urls[$op], $this->getTargetSelector($op), $params); |
|
| 108 | + $js->ajaxOnClick("#".$this->identifier." ._".$op, $this->_urls[$op], $this->getTargetSelector($op), $params); |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | |
@@ -124,21 +124,21 @@ discard block |
||
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | public function refreshTD($fieldName, $jquery, $view) { |
| 127 | - $index = $this->_getIndex($fieldName); |
|
| 127 | + $index=$this->_getIndex($fieldName); |
|
| 128 | 128 | $this->compile($jquery, $view); |
| 129 | 129 | return $this->refreshTR() |
| 130 | 130 | ->getTable() |
| 131 | 131 | ->getCell(0, $index); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
| 135 | - if (! $this->_generated) { |
|
| 134 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 135 | + if (!$this->_generated) { |
|
| 136 | 136 | if (isset($this->_buttonsColumn)) { |
| 137 | 137 | $this->_instanceViewer->sortColumnContent($this->_buttonsColumn, $this->_buttons); |
| 138 | 138 | } |
| 139 | 139 | $this->_instanceViewer->setInstance($this->_model); |
| 140 | - $captions = $this->_instanceViewer->getCaptions(); |
|
| 141 | - $table = $this->content["table"]; |
|
| 140 | + $captions=$this->_instanceViewer->getCaptions(); |
|
| 141 | + $table=$this->content["table"]; |
|
| 142 | 142 | if ($this->_hasCheckboxes) { |
| 143 | 143 | $this->_generateMainCheckbox($captions); |
| 144 | 144 | } |
@@ -153,14 +153,14 @@ discard block |
||
| 153 | 153 | $this->compileExtraElements($table, $captions); |
| 154 | 154 | $this->_compileSearchFieldBehavior($js); |
| 155 | 155 | |
| 156 | - $this->content = JArray::sortAssociative($this->content, [ |
|
| 156 | + $this->content=JArray::sortAssociative($this->content, [ |
|
| 157 | 157 | PositionInTable::BEFORETABLE, |
| 158 | 158 | "table", |
| 159 | 159 | PositionInTable::AFTERTABLE |
| 160 | 160 | ]); |
| 161 | 161 | $this->_compileForm(); |
| 162 | 162 | $this->_applyStyleAttributes($table); |
| 163 | - $this->_generated = true; |
|
| 163 | + $this->_generated=true; |
|
| 164 | 164 | } |
| 165 | 165 | return parent::compile($js, $view); |
| 166 | 166 | } |
@@ -198,9 +198,9 @@ discard block |
||
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | protected function _generateHeader(HtmlTable $table, $captions) { |
| 201 | - $gbFields = $this->_instanceViewer->getGroupByFields(); |
|
| 201 | + $gbFields=$this->_instanceViewer->getGroupByFields(); |
|
| 202 | 202 | if (\is_array($gbFields)) { |
| 203 | - $captions = \array_values(JArray::removeByKeys($captions, $gbFields)); |
|
| 203 | + $captions=\array_values(JArray::removeByKeys($captions, $gbFields)); |
|
| 204 | 204 | } |
| 205 | 205 | $table->setHeaderValues($captions); |
| 206 | 206 | if (isset($this->_sortable)) { |
@@ -209,22 +209,22 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | protected function _generateContent($table) { |
| 212 | - $objects = $this->_modelInstance; |
|
| 212 | + $objects=$this->_modelInstance; |
|
| 213 | 213 | if (isset($this->_pagination)) { |
| 214 | - $objects = $this->_pagination->getObjects($this->_modelInstance); |
|
| 214 | + $objects=$this->_pagination->getObjects($this->_modelInstance); |
|
| 215 | 215 | } |
| 216 | 216 | InstanceViewer::setIndex(0); |
| 217 | - $fields = $this->_instanceViewer->getSimpleProperties(); |
|
| 218 | - $groupByFields = $this->_instanceViewer->getGroupByFields(); |
|
| 219 | - if (! is_array($groupByFields)) { |
|
| 220 | - $table->fromDatabaseObjects($objects, function ($instance) use ($table, $fields) { |
|
| 217 | + $fields=$this->_instanceViewer->getSimpleProperties(); |
|
| 218 | + $groupByFields=$this->_instanceViewer->getGroupByFields(); |
|
| 219 | + if (!is_array($groupByFields)) { |
|
| 220 | + $table->fromDatabaseObjects($objects, function($instance) use ($table, $fields) { |
|
| 221 | 221 | return $this->_generateRow($instance, $fields, $table); |
| 222 | 222 | }); |
| 223 | 223 | } else { |
| 224 | - $diffFields = \array_values(JArray::removeByKeys($fields, $groupByFields)); |
|
| 225 | - $activeValues = \array_combine($groupByFields, \array_fill(0, \count($groupByFields), null)); |
|
| 226 | - $uuids = []; |
|
| 227 | - $table->fromDatabaseObjects($objects, function ($instance) use ($table, $fields, &$activeValues, $groupByFields, &$uuids, $diffFields) { |
|
| 224 | + $diffFields=\array_values(JArray::removeByKeys($fields, $groupByFields)); |
|
| 225 | + $activeValues=\array_combine($groupByFields, \array_fill(0, \count($groupByFields), null)); |
|
| 226 | + $uuids=[]; |
|
| 227 | + $table->fromDatabaseObjects($objects, function($instance) use ($table, $fields, &$activeValues, $groupByFields, &$uuids, $diffFields) { |
|
| 228 | 228 | $this->_instanceViewer->setInstance($instance); |
| 229 | 229 | foreach ($groupByFields as $index => $gbField) { |
| 230 | 230 | $this->_generateGroupByRow($index, $gbField, $table, $fields, $activeValues, $uuids); |
@@ -232,8 +232,8 @@ discard block |
||
| 232 | 232 | return $this->_generateRow($instance, $diffFields, $table, null, $uuids); |
| 233 | 233 | }); |
| 234 | 234 | } |
| 235 | - if ($table->getRowCount() == 0) { |
|
| 236 | - $result = $table->addRow(); |
|
| 235 | + if ($table->getRowCount()==0) { |
|
| 236 | + $result=$table->addRow(); |
|
| 237 | 237 | $result->mergeRow(); |
| 238 | 238 | $result->setValues([ |
| 239 | 239 | $this->_emptyMessage |
@@ -242,20 +242,20 @@ discard block |
||
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | protected function _generateGroupByRow($index, $gbField, $table, $fields, &$activeValues, &$uuids) { |
| 245 | - $newValue = $this->_instanceViewer->getValue($gbField); |
|
| 246 | - if ($this->getElementContent($activeValues[$gbField]) !== $this->getElementContent($newValue)) { |
|
| 247 | - if ($index == 0) { |
|
| 248 | - $uuids = []; |
|
| 245 | + $newValue=$this->_instanceViewer->getValue($gbField); |
|
| 246 | + if ($this->getElementContent($activeValues[$gbField])!==$this->getElementContent($newValue)) { |
|
| 247 | + if ($index==0) { |
|
| 248 | + $uuids=[]; |
|
| 249 | 249 | } |
| 250 | - $uuid = uniqid("grp"); |
|
| 251 | - $uuids[$gbField] = $uuid; |
|
| 252 | - $id = $this->_instanceViewer->getIdentifier(); |
|
| 253 | - $result = $table->addMergeRow(sizeof($fields) + 1, $newValue); |
|
| 254 | - $result->setIdentifier($this->identifier . "-tr-gb-" . $id); |
|
| 250 | + $uuid=uniqid("grp"); |
|
| 251 | + $uuids[$gbField]=$uuid; |
|
| 252 | + $id=$this->_instanceViewer->getIdentifier(); |
|
| 253 | + $result=$table->addMergeRow(sizeof($fields)+1, $newValue); |
|
| 254 | + $result->setIdentifier($this->identifier."-tr-gb-".$id); |
|
| 255 | 255 | $result->setProperty("data-ajax", $id); |
| 256 | 256 | $result->setProperty("data-group", $uuid); |
| 257 | 257 | $result->addToProperty("class", $this->_rowClass); |
| 258 | - $activeValues[$gbField] = $newValue; |
|
| 258 | + $activeValues[$gbField]=$newValue; |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
@@ -267,9 +267,9 @@ discard block |
||
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | public function getFieldValue($index) { |
| 270 | - $index = $this->_getIndex($index); |
|
| 270 | + $index=$this->_getIndex($index); |
|
| 271 | 271 | if (is_numeric($index)) { |
| 272 | - $values = $this->_instanceViewer->getValues(); |
|
| 272 | + $values=$this->_instanceViewer->getValues(); |
|
| 273 | 273 | if (isset($values[$index])) { |
| 274 | 274 | return $values[$index]; |
| 275 | 275 | } |
@@ -277,30 +277,30 @@ discard block |
||
| 277 | 277 | return null; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - protected function _generateRow($instance, $fields, &$table, $checkedClass = null, $uuids = null) { |
|
| 280 | + protected function _generateRow($instance, $fields, &$table, $checkedClass=null, $uuids=null) { |
|
| 281 | 281 | $this->_instanceViewer->setInstance($instance); |
| 282 | - InstanceViewer::$index ++; |
|
| 283 | - $values = $this->_instanceViewer->getValues(); |
|
| 284 | - $id = $this->_instanceViewer->getIdentifier(); |
|
| 285 | - $dataAjax = $id; |
|
| 286 | - $id = $this->cleanIdentifier($id); |
|
| 282 | + InstanceViewer::$index++; |
|
| 283 | + $values=$this->_instanceViewer->getValues(); |
|
| 284 | + $id=$this->_instanceViewer->getIdentifier(); |
|
| 285 | + $dataAjax=$id; |
|
| 286 | + $id=$this->cleanIdentifier($id); |
|
| 287 | 287 | if ($this->_hasCheckboxes) { |
| 288 | - $ck = new HtmlCheckbox("ck-" . $this->identifier . "-" . $id, ""); |
|
| 289 | - $checked = false; |
|
| 288 | + $ck=new HtmlCheckbox("ck-".$this->identifier."-".$id, ""); |
|
| 289 | + $checked=false; |
|
| 290 | 290 | if (isset($this->_checkedCallback)) { |
| 291 | - $func = $this->_checkedCallback; |
|
| 292 | - $checked = $func($instance); |
|
| 291 | + $func=$this->_checkedCallback; |
|
| 292 | + $checked=$func($instance); |
|
| 293 | 293 | } |
| 294 | 294 | $ck->setChecked($checked); |
| 295 | - $field = $ck->getField(); |
|
| 295 | + $field=$ck->getField(); |
|
| 296 | 296 | $field->setProperty("value", $dataAjax); |
| 297 | 297 | $field->setProperty("name", "selection[]"); |
| 298 | 298 | if (isset($checkedClass)) |
| 299 | 299 | $field->setClass($checkedClass); |
| 300 | 300 | \array_unshift($values, $ck); |
| 301 | 301 | } |
| 302 | - $result = $table->newRow(); |
|
| 303 | - $result->setIdentifier($this->identifier . "-tr-" . $id); |
|
| 302 | + $result=$table->newRow(); |
|
| 303 | + $result->setIdentifier($this->identifier."-tr-".$id); |
|
| 304 | 304 | $result->setProperty("data-ajax", $dataAjax); |
| 305 | 305 | $result->setValues($values); |
| 306 | 306 | $result->addToProperty("class", $this->_rowClass); |
@@ -313,63 +313,63 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | protected function _generatePagination($table) { |
| 315 | 315 | if (isset($this->_toolbar)) { |
| 316 | - if ($this->_toolbarPosition == PositionInTable::FOOTER) |
|
| 316 | + if ($this->_toolbarPosition==PositionInTable::FOOTER) |
|
| 317 | 317 | $this->_toolbar->setFloated("left"); |
| 318 | 318 | } |
| 319 | - $footer = $table->getFooter(); |
|
| 319 | + $footer=$table->getFooter(); |
|
| 320 | 320 | $footer->mergeCol(); |
| 321 | - $this->_paginationToolbar = $this->_pagination->generateMenu($this->identifier); |
|
| 321 | + $this->_paginationToolbar=$this->_pagination->generateMenu($this->identifier); |
|
| 322 | 322 | $footer->addValues($this->_paginationToolbar); |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - protected function _associatePaginationBehavior(JsUtils $js = NULL, $offset = null) { |
|
| 325 | + protected function _associatePaginationBehavior(JsUtils $js=NULL, $offset=null) { |
|
| 326 | 326 | if (isset($this->_urls["refresh"])) { |
| 327 | - $menu = $this->_pagination->getMenu(); |
|
| 327 | + $menu=$this->_pagination->getMenu(); |
|
| 328 | 328 | if (isset($menu) && isset($js)) { |
| 329 | - $js->postOnClick("#" . $menu->getIdentifier() . " .item", $this->_urls["refresh"], "{'p':$(this).attr('data-page'),'_model':'" . JString::doubleBackSlashes($this->_model) . "'}", $this->getRefreshSelector(), [ |
|
| 329 | + $js->postOnClick("#".$menu->getIdentifier()." .item", $this->_urls["refresh"], "{'p':$(this).attr('data-page'),'_model':'".JString::doubleBackSlashes($this->_model)."'}", $this->getRefreshSelector(), [ |
|
| 330 | 330 | "preventDefault" => false, |
| 331 | 331 | "jqueryDone" => "replaceWith", |
| 332 | 332 | "hasLoader" => false, |
| 333 | - "jsCallback" => '$("#' . $this->identifier . '").trigger("pageChange");$("#' . $this->identifier . '").trigger("activeRowChange");' |
|
| 333 | + "jsCallback" => '$("#'.$this->identifier.'").trigger("pageChange");$("#'.$this->identifier.'").trigger("activeRowChange");' |
|
| 334 | 334 | ]); |
| 335 | - $page = $_POST["p"] ?? null; |
|
| 335 | + $page=$_POST["p"] ?? null; |
|
| 336 | 336 | if (isset($page)) { |
| 337 | - $js->execAtLast('$("#' . $this->getIdentifier() . ' .pagination").children("a.item").removeClass("active");$("#' . $this->getIdentifier() . ' .pagination").children("a.item[data-page=' . $page . ']:not(.no-active)").addClass("active");'); |
|
| 337 | + $js->execAtLast('$("#'.$this->getIdentifier().' .pagination").children("a.item").removeClass("active");$("#'.$this->getIdentifier().' .pagination").children("a.item[data-page='.$page.']:not(.no-active)").addClass("active");'); |
|
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - protected function _compileSearchFieldBehavior(JsUtils $js = NULL) { |
|
| 343 | + protected function _compileSearchFieldBehavior(JsUtils $js=NULL) { |
|
| 344 | 344 | if (isset($this->_searchField) && isset($js) && isset($this->_urls["refresh"])) { |
| 345 | - $this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(self).val(),'_model':'" . JString::doubleBackSlashes($this->_model) . "'}", "#" . $this->identifier . " tbody", [ |
|
| 345 | + $this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(self).val(),'_model':'".JString::doubleBackSlashes($this->_model)."'}", "#".$this->identifier." tbody", [ |
|
| 346 | 346 | "preventDefault" => false, |
| 347 | 347 | "jqueryDone" => "replaceWith", |
| 348 | 348 | "hasLoader" => "internal", |
| 349 | - "jsCallback" => '$("#' . $this->identifier . '").trigger("searchTerminate",[$(self).val()]);' |
|
| 349 | + "jsCallback" => '$("#'.$this->identifier.'").trigger("searchTerminate",[$(self).val()]);' |
|
| 350 | 350 | ]); |
| 351 | 351 | } |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | - protected function _associateSearchFieldBehavior(JsUtils $js = NULL, $offset = null) {} |
|
| 354 | + protected function _associateSearchFieldBehavior(JsUtils $js=NULL, $offset=null) {} |
|
| 355 | 355 | |
| 356 | 356 | protected function _getFieldName($index) { |
| 357 | - $fieldName = parent::_getFieldName($index); |
|
| 357 | + $fieldName=parent::_getFieldName($index); |
|
| 358 | 358 | if (\is_object($fieldName)) |
| 359 | - $fieldName = "field-" . $index; |
|
| 360 | - return $fieldName . "[]"; |
|
| 359 | + $fieldName="field-".$index; |
|
| 360 | + return $fieldName."[]"; |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | protected function _getFieldCaption($index) { |
| 364 | 364 | return null; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - protected function applyToolbarPosition(string $position, $table, $captions = NULL) { |
|
| 367 | + protected function applyToolbarPosition(string $position, $table, $captions=NULL) { |
|
| 368 | 368 | switch ($position) { |
| 369 | 369 | case PositionInTable::BEFORETABLE: |
| 370 | 370 | case PositionInTable::AFTERTABLE: |
| 371 | - if (isset($this->_compileParts) === false) { |
|
| 372 | - $this->content[$position] = $this->_toolbar; |
|
| 371 | + if (isset($this->_compileParts)===false) { |
|
| 372 | + $this->content[$position]=$this->_toolbar; |
|
| 373 | 373 | } |
| 374 | 374 | break; |
| 375 | 375 | case PositionInTable::HEADER: |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | } |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - protected function _setToolbarPosition($table, $captions = NULL) { |
|
| 383 | + protected function _setToolbarPosition($table, $captions=NULL) { |
|
| 384 | 384 | if (\is_array($this->_toolbarPosition)) { |
| 385 | 385 | foreach ($this->_toolbarPosition as $tbp) { |
| 386 | 386 | $this->applyToolbarPosition($tbp, $table, $captions); |
@@ -406,11 +406,11 @@ discard block |
||
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | private function addToolbarRow($part, $table, $captions) { |
| 409 | - $hasPart = $table->hasPart($part); |
|
| 409 | + $hasPart=$table->hasPart($part); |
|
| 410 | 410 | if ($hasPart) { |
| 411 | - $row = $table->getPart($part)->addRow(\sizeof($captions)); |
|
| 411 | + $row=$table->getPart($part)->addRow(\sizeof($captions)); |
|
| 412 | 412 | } else { |
| 413 | - $row = $table->getPart($part)->getRow(0); |
|
| 413 | + $row=$table->getPart($part)->getRow(0); |
|
| 414 | 414 | } |
| 415 | 415 | $row->mergeCol(); |
| 416 | 416 | $row->setValues([ |
@@ -442,12 +442,12 @@ discard block |
||
| 442 | 442 | */ |
| 443 | 443 | public function setUrls($urls) { |
| 444 | 444 | if (\is_array($urls)) { |
| 445 | - $this->_urls["refresh"] = JArray::getValue($urls, "refresh", 0); |
|
| 446 | - $this->_urls["edit"] = JArray::getValue($urls, "edit", 1); |
|
| 447 | - $this->_urls["delete"] = JArray::getValue($urls, "delete", 2); |
|
| 448 | - $this->_urls["display"] = JArray::getValue($urls, "display", 3); |
|
| 445 | + $this->_urls["refresh"]=JArray::getValue($urls, "refresh", 0); |
|
| 446 | + $this->_urls["edit"]=JArray::getValue($urls, "edit", 1); |
|
| 447 | + $this->_urls["delete"]=JArray::getValue($urls, "delete", 2); |
|
| 448 | + $this->_urls["display"]=JArray::getValue($urls, "display", 3); |
|
| 449 | 449 | } else { |
| 450 | - $this->_urls = [ |
|
| 450 | + $this->_urls=[ |
|
| 451 | 451 | "refresh" => $urls, |
| 452 | 452 | "edit" => $urls, |
| 453 | 453 | "delete" => $urls, |
@@ -470,8 +470,8 @@ discard block |
||
| 470 | 470 | * The number of visible pages in the Pagination component |
| 471 | 471 | * @return DataTable |
| 472 | 472 | */ |
| 473 | - public function paginate($page, $total_rowcount, $items_per_page = 10, $pages_visibles = null) { |
|
| 474 | - $this->_pagination = new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount); |
|
| 473 | + public function paginate($page, $total_rowcount, $items_per_page=10, $pages_visibles=null) { |
|
| 474 | + $this->_pagination=new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount); |
|
| 475 | 475 | return $this; |
| 476 | 476 | } |
| 477 | 477 | |
@@ -486,8 +486,8 @@ discard block |
||
| 486 | 486 | * The number of visible pages in the Pagination component |
| 487 | 487 | * @return DataTable |
| 488 | 488 | */ |
| 489 | - public function autoPaginate($page = 1, $items_per_page = 10, $pages_visibles = 4) { |
|
| 490 | - $this->_pagination = new Pagination($items_per_page, $pages_visibles, $page); |
|
| 489 | + public function autoPaginate($page=1, $items_per_page=10, $pages_visibles=4) { |
|
| 490 | + $this->_pagination=new Pagination($items_per_page, $pages_visibles, $page); |
|
| 491 | 491 | return $this; |
| 492 | 492 | } |
| 493 | 493 | |
@@ -496,10 +496,10 @@ discard block |
||
| 496 | 496 | * @param array $compileParts |
| 497 | 497 | * @return DataTable |
| 498 | 498 | */ |
| 499 | - public function refresh($compileParts = [ |
|
| 499 | + public function refresh($compileParts=[ |
|
| 500 | 500 | 'tbody' |
| 501 | 501 | ]) { |
| 502 | - $this->_compileParts = $compileParts; |
|
| 502 | + $this->_compileParts=$compileParts; |
|
| 503 | 503 | return $this; |
| 504 | 504 | } |
| 505 | 505 | |
@@ -509,14 +509,14 @@ discard block |
||
| 509 | 509 | * @param string $position |
| 510 | 510 | * @return \Ajax\common\html\HtmlDoubleElement |
| 511 | 511 | */ |
| 512 | - public function addSearchInToolbar($position = Direction::RIGHT) { |
|
| 512 | + public function addSearchInToolbar($position=Direction::RIGHT) { |
|
| 513 | 513 | return $this->addInToolbar($this->getSearchField()) |
| 514 | 514 | ->setPosition($position); |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | public function getSearchField() { |
| 518 | - if (isset($this->_searchField) === false) { |
|
| 519 | - $this->_searchField = new HtmlInput("search-" . $this->identifier, "search", "", "Search..."); |
|
| 518 | + if (isset($this->_searchField)===false) { |
|
| 519 | + $this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search..."); |
|
| 520 | 520 | $this->_searchField->addIcon("search", Direction::RIGHT); |
| 521 | 521 | } |
| 522 | 522 | return $this->_searchField; |
@@ -544,9 +544,9 @@ discard block |
||
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | protected function getTargetSelector($op) { |
| 547 | - $result = $this->_targetSelector; |
|
| 548 | - if (! isset($result[$op])) |
|
| 549 | - $result = "#" . $this->identifier; |
|
| 547 | + $result=$this->_targetSelector; |
|
| 548 | + if (!isset($result[$op])) |
|
| 549 | + $result="#".$this->identifier; |
|
| 550 | 550 | return $result[$op]; |
| 551 | 551 | } |
| 552 | 552 | |
@@ -558,20 +558,20 @@ discard block |
||
| 558 | 558 | * @return DataTable |
| 559 | 559 | */ |
| 560 | 560 | public function setTargetSelector($_targetSelector) { |
| 561 | - if (! \is_array($_targetSelector)) { |
|
| 562 | - $_targetSelector = [ |
|
| 561 | + if (!\is_array($_targetSelector)) { |
|
| 562 | + $_targetSelector=[ |
|
| 563 | 563 | "edit" => $_targetSelector, |
| 564 | 564 | "delete" => $_targetSelector |
| 565 | 565 | ]; |
| 566 | 566 | } |
| 567 | - $this->_targetSelector = $_targetSelector; |
|
| 567 | + $this->_targetSelector=$_targetSelector; |
|
| 568 | 568 | return $this; |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | public function getRefreshSelector() { |
| 572 | 572 | if (isset($this->_refreshSelector)) |
| 573 | 573 | return $this->_refreshSelector; |
| 574 | - return "#" . $this->identifier . " tbody"; |
|
| 574 | + return "#".$this->identifier." tbody"; |
|
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | /** |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | * @return DataTable |
| 581 | 581 | */ |
| 582 | 582 | public function setRefreshSelector($_refreshSelector) { |
| 583 | - $this->_refreshSelector = $_refreshSelector; |
|
| 583 | + $this->_refreshSelector=$_refreshSelector; |
|
| 584 | 584 | return $this; |
| 585 | 585 | } |
| 586 | 586 | |
@@ -592,9 +592,9 @@ discard block |
||
| 592 | 592 | public function show($modelInstance) { |
| 593 | 593 | if (\is_array($modelInstance)) { |
| 594 | 594 | if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) |
| 595 | - $modelInstance = \json_decode(\json_encode($modelInstance), FALSE); |
|
| 595 | + $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
| 596 | 596 | } |
| 597 | - $this->_modelInstance = $modelInstance; |
|
| 597 | + $this->_modelInstance=$modelInstance; |
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | public function getRowClass() { |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | * @return DataTable |
| 609 | 609 | */ |
| 610 | 610 | public function setRowClass($_rowClass) { |
| 611 | - $this->_rowClass = $_rowClass; |
|
| 611 | + $this->_rowClass=$_rowClass; |
|
| 612 | 612 | return $this; |
| 613 | 613 | } |
| 614 | 614 | |
@@ -619,16 +619,16 @@ discard block |
||
| 619 | 619 | * @return DataTable |
| 620 | 620 | */ |
| 621 | 621 | public function setEmptyMessage($_emptyMessage) { |
| 622 | - $this->_emptyMessage = $_emptyMessage; |
|
| 622 | + $this->_emptyMessage=$_emptyMessage; |
|
| 623 | 623 | return $this; |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | - public function setSortable($colIndex = NULL) { |
|
| 627 | - $this->_sortable = $colIndex; |
|
| 626 | + public function setSortable($colIndex=NULL) { |
|
| 627 | + $this->_sortable=$colIndex; |
|
| 628 | 628 | return $this; |
| 629 | 629 | } |
| 630 | 630 | |
| 631 | - public function setActiveRowSelector($class = "active", $event = "click", $multiple = false) { |
|
| 631 | + public function setActiveRowSelector($class="active", $event="click", $multiple=false) { |
|
| 632 | 632 | $this->_self->setActiveRowSelector($class, $event, $multiple); |
| 633 | 633 | return $this; |
| 634 | 634 | } |
@@ -638,19 +638,19 @@ discard block |
||
| 638 | 638 | } |
| 639 | 639 | |
| 640 | 640 | public function hideColumn($colIndex) { |
| 641 | - if (! \is_array($this->_hiddenColumns)) |
|
| 642 | - $this->_hiddenColumns = []; |
|
| 643 | - $this->_hiddenColumns[] = $colIndex; |
|
| 641 | + if (!\is_array($this->_hiddenColumns)) |
|
| 642 | + $this->_hiddenColumns=[]; |
|
| 643 | + $this->_hiddenColumns[]=$colIndex; |
|
| 644 | 644 | return $this; |
| 645 | 645 | } |
| 646 | 646 | |
| 647 | 647 | public function setColWidth($colIndex, $width) { |
| 648 | - $this->_colWidths[$colIndex] = $width; |
|
| 648 | + $this->_colWidths[$colIndex]=$width; |
|
| 649 | 649 | return $this; |
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | public function setColWidths($_colWidths) { |
| 653 | - $this->_colWidths = $_colWidths; |
|
| 653 | + $this->_colWidths=$_colWidths; |
|
| 654 | 654 | return $this; |
| 655 | 655 | } |
| 656 | 656 | |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | return $this; |
| 660 | 660 | } |
| 661 | 661 | |
| 662 | - public function trigger($event, $params = "[]") { |
|
| 662 | + public function trigger($event, $params="[]") { |
|
| 663 | 663 | return $this->getHtmlComponent()->trigger($event, $params); |
| 664 | 664 | } |
| 665 | 665 | |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | * @param mixed $_displayBehavior |
| 698 | 698 | */ |
| 699 | 699 | public function setDisplayBehavior($_displayBehavior) { |
| 700 | - $this->_displayBehavior = $_displayBehavior; |
|
| 700 | + $this->_displayBehavior=$_displayBehavior; |
|
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | /** |
@@ -717,8 +717,8 @@ discard block |
||
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | public function addGroupBy($index) { |
| 720 | - $index = $this->_getIndex($index); |
|
| 721 | - if ($index !== false) { |
|
| 720 | + $index=$this->_getIndex($index); |
|
| 721 | + if ($index!==false) { |
|
| 722 | 722 | $this->_instanceViewer->addGroupBy($index); |
| 723 | 723 | } |
| 724 | 724 | } |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | * @param boolean $_visibleHover |
| 729 | 729 | */ |
| 730 | 730 | public function setVisibleHover($_visibleHover) { |
| 731 | - $this->_visibleHover = $_visibleHover; |
|
| 731 | + $this->_visibleHover=$_visibleHover; |
|
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | /** |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | return $this->_paginationToolbar; |
| 740 | 740 | } |
| 741 | 741 | |
| 742 | - public function setInverted($recursive = true) { |
|
| 742 | + public function setInverted($recursive=true) { |
|
| 743 | 743 | $this->getHtmlComponent()->setInverted($recursive); |
| 744 | 744 | if ($this->_emptyMessage instanceof HtmlSemDoubleElement) { |
| 745 | 745 | $this->_emptyMessage->setInverted($recursive); |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * |
| 21 | 21 | * @var integer the start index for href generation |
| 22 | 22 | */ |
| 23 | - protected $startIndex = 0; |
|
| 23 | + protected $startIndex=0; |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @var boolean if set to true, the path of the elements is absolute |
| 34 | 34 | */ |
| 35 | - protected $absolutePaths = false; |
|
| 35 | + protected $absolutePaths=false; |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * |
@@ -49,16 +49,16 @@ discard block |
||
| 49 | 49 | * @param callable $hrefFunction |
| 50 | 50 | * the function who generates the href elements. default : function($e){return $e->getContent()} |
| 51 | 51 | */ |
| 52 | - public function __construct($identifier, $items = array(), $autoActive = true, $startIndex = 0, $hrefFunction = NULL) { |
|
| 52 | + public function __construct($identifier, $items=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
| 53 | 53 | parent::__construct($identifier, "div", "ui breadcrumb"); |
| 54 | - $this->startIndex = $startIndex; |
|
| 55 | - $this->autoActive = $autoActive; |
|
| 56 | - $this->_contentSeparator = "<div class='divider'> / </div>"; |
|
| 57 | - $this->_hrefFunction = function (HtmlSemDoubleElement $e) { |
|
| 54 | + $this->startIndex=$startIndex; |
|
| 55 | + $this->autoActive=$autoActive; |
|
| 56 | + $this->_contentSeparator="<div class='divider'> / </div>"; |
|
| 57 | + $this->_hrefFunction=function(HtmlSemDoubleElement $e) { |
|
| 58 | 58 | return $e->getContent(); |
| 59 | 59 | }; |
| 60 | 60 | if (isset($hrefFunction)) { |
| 61 | - $this->_hrefFunction = $hrefFunction; |
|
| 61 | + $this->_hrefFunction=$hrefFunction; |
|
| 62 | 62 | } |
| 63 | 63 | $this->addItems($items); |
| 64 | 64 | } |
@@ -88,11 +88,11 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @param int $index |
| 90 | 90 | */ |
| 91 | - public function setActive($index = null) { |
|
| 92 | - if (! isset($index)) { |
|
| 93 | - $index = sizeof($this->content) - 1; |
|
| 91 | + public function setActive($index=null) { |
|
| 92 | + if (!isset($index)) { |
|
| 93 | + $index=sizeof($this->content)-1; |
|
| 94 | 94 | } |
| 95 | - $activeItem = $this->content[$index]; |
|
| 95 | + $activeItem=$this->content[$index]; |
|
| 96 | 96 | $activeItem->addToProperty("class", "active"); |
| 97 | 97 | $activeItem->setTagName("div"); |
| 98 | 98 | } |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | * the request dispatcher |
| 106 | 106 | * @return HtmlBreadcrumb |
| 107 | 107 | */ |
| 108 | - public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex = 0) { |
|
| 109 | - $this->startIndex = $startIndex; |
|
| 108 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
| 109 | + $this->startIndex=$startIndex; |
|
| 110 | 110 | return $this->addItems($js->fromDispatcher($dispatcher)); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -117,16 +117,16 @@ discard block |
||
| 117 | 117 | * @param string $separator |
| 118 | 118 | * @return string |
| 119 | 119 | */ |
| 120 | - public function getHref($index = null, $separator = "/") { |
|
| 121 | - if (! isset($index)) { |
|
| 122 | - $index = sizeof($this->content); |
|
| 120 | + public function getHref($index=null, $separator="/") { |
|
| 121 | + if (!isset($index)) { |
|
| 122 | + $index=sizeof($this->content); |
|
| 123 | 123 | } |
| 124 | - if ($this->absolutePaths === true) { |
|
| 124 | + if ($this->absolutePaths===true) { |
|
| 125 | 125 | return $this->_hrefFunction($this->content[$index]); |
| 126 | 126 | } else { |
| 127 | - return $this->root . implode($separator, array_slice(array_map(function ($e) { |
|
| 127 | + return $this->root.implode($separator, array_slice(array_map(function($e) { |
|
| 128 | 128 | return $this->_hrefFunction($e); |
| 129 | - }, $this->content), $this->startIndex, $index + 1)); |
|
| 129 | + }, $this->content), $this->startIndex, $index+1)); |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | |
@@ -138,17 +138,17 @@ discard block |
||
| 138 | 138 | * @return HtmlBreadcrumb |
| 139 | 139 | */ |
| 140 | 140 | public function setHrefFunction($_hrefFunction) { |
| 141 | - $this->_hrefFunction = $_hrefFunction; |
|
| 141 | + $this->_hrefFunction=$_hrefFunction; |
|
| 142 | 142 | return $this; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | public function setStartIndex($startIndex) { |
| 146 | - $this->startIndex = $startIndex; |
|
| 146 | + $this->startIndex=$startIndex; |
|
| 147 | 147 | return $this; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | public function setAutoActive($autoActive) { |
| 151 | - $this->autoActive = $autoActive; |
|
| 151 | + $this->autoActive=$autoActive; |
|
| 152 | 152 | return $this; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -156,13 +156,13 @@ discard block |
||
| 156 | 156 | * (non-PHPdoc) |
| 157 | 157 | * @see \Ajax\bootstrap\html\BaseHtml::compile() |
| 158 | 158 | */ |
| 159 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
| 159 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 160 | 160 | if ($this->autoActive) { |
| 161 | 161 | $this->setActive(); |
| 162 | 162 | } |
| 163 | - $count = $this->count(); |
|
| 164 | - for ($i = 1; $i < $count; $i ++) { |
|
| 165 | - $this->content[$i]->wrap($this->getContentDivider($i - 1)); |
|
| 163 | + $count=$this->count(); |
|
| 164 | + for ($i=1; $i<$count; $i++) { |
|
| 165 | + $this->content[$i]->wrap($this->getContentDivider($i-1)); |
|
| 166 | 166 | } |
| 167 | 167 | return parent::compile($js, $view); |
| 168 | 168 | } |
@@ -171,16 +171,16 @@ discard block |
||
| 171 | 171 | * (non-PHPdoc) |
| 172 | 172 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
| 173 | 173 | */ |
| 174 | - public function on($event, $jsCode, $stopPropagation = false, $preventDefault = false) { |
|
| 174 | + public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
|
| 175 | 175 | foreach ($this->content as $element) { |
| 176 | 176 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
| 177 | 177 | } |
| 178 | 178 | return $this; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - public function _ajaxOn($operation, $event, $url, $responseElement = "", $parameters = array()) { |
|
| 181 | + public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
|
| 182 | 182 | foreach ($this->content as $element) { |
| 183 | - if ($element->getProperty($this->attr) != NULL) { |
|
| 183 | + if ($element->getProperty($this->attr)!=NULL) { |
|
| 184 | 184 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
| 185 | 185 | } |
| 186 | 186 | } |
@@ -194,10 +194,10 @@ discard block |
||
| 194 | 194 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 195 | 195 | */ |
| 196 | 196 | protected function createItem($value) { |
| 197 | - $count = $this->count(); |
|
| 198 | - $itemO = new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
|
| 197 | + $count=$this->count(); |
|
| 198 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section"); |
|
| 199 | 199 | if (\is_array($value)) { |
| 200 | - @list ($text, $href) = $value; |
|
| 200 | + @list ($text, $href)=$value; |
|
| 201 | 201 | $itemO->setContent($text); |
| 202 | 202 | $itemO->setProperty('href', $href); |
| 203 | 203 | } else { |
@@ -207,16 +207,16 @@ discard block |
||
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | public function addIconAt($icon, $index) { |
| 210 | - $item = $this->getItem($index); |
|
| 210 | + $item=$this->getItem($index); |
|
| 211 | 211 | if (isset($item)) { |
| 212 | - $icon = new HtmlIcon("icon-" . $this->identifier, $icon); |
|
| 212 | + $icon=new HtmlIcon("icon-".$this->identifier, $icon); |
|
| 213 | 213 | $item->wrapContent($icon); |
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | public function addItem($item) { |
| 218 | - $count = $this->count(); |
|
| 219 | - $itemO = parent::addItem($item); |
|
| 218 | + $count=$this->count(); |
|
| 219 | + $itemO=parent::addItem($item); |
|
| 220 | 220 | $this->addToPropertyCtrl("class", "section", array( |
| 221 | 221 | "section" |
| 222 | 222 | )); |
@@ -229,9 +229,9 @@ discard block |
||
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | public function setAbsolutePaths($absolutePaths) { |
| 232 | - $this->absolutePaths = $absolutePaths; |
|
| 233 | - $size = \sizeof($this->content); |
|
| 234 | - for ($i = 0; $i < $size; $i ++) { |
|
| 232 | + $this->absolutePaths=$absolutePaths; |
|
| 233 | + $size=\sizeof($this->content); |
|
| 234 | + for ($i=0; $i<$size; $i++) { |
|
| 235 | 235 | $this->content[$i]->setProperty($this->attr, $this->getHref($i)); |
| 236 | 236 | } |
| 237 | 237 | return $this; |