@@ -13,9 +13,9 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | protected $_hasCheckedList; |
| 15 | 15 | |
| 16 | - protected $_fireOnInit = false; |
|
| 16 | + protected $_fireOnInit=false; |
|
| 17 | 17 | |
| 18 | - protected $_ckItemChange = ""; |
|
| 18 | + protected $_ckItemChange=""; |
|
| 19 | 19 | |
| 20 | 20 | protected $_maxVisible; |
| 21 | 21 | |
@@ -23,25 +23,25 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | protected $_visibility; |
| 25 | 25 | |
| 26 | - public function __construct($identifier, $items = array()) { |
|
| 26 | + public function __construct($identifier, $items=array()) { |
|
| 27 | 27 | parent::__construct($identifier, "div", "ui list"); |
| 28 | 28 | $this->addItems($items); |
| 29 | - $this->_hasCheckedList = false; |
|
| 29 | + $this->_hasCheckedList=false; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | protected function createItem($value) { |
| 33 | - $count = $this->count(); |
|
| 34 | - $item = new HtmlListItem("item-" . $this->identifier . "-" . $count, $value); |
|
| 33 | + $count=$this->count(); |
|
| 34 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
| 35 | 35 | return $item; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function addHeader($niveau, $content) { |
| 39 | - $header = new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page"); |
|
| 39 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $content, "page"); |
|
| 40 | 40 | $this->wrap($header); |
| 41 | 41 | return $header; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function getItemPart($index, $partName = "header") { |
|
| 44 | + public function getItemPart($index, $partName="header") { |
|
| 45 | 45 | return $this->getItem($index)->getPart($partName); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -49,15 +49,15 @@ discard block |
||
| 49 | 49 | return $this->contentAs($tagName); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function asLinks($hrefs = [], $target = NUll) { |
|
| 52 | + public function asLinks($hrefs=[], $target=NUll) { |
|
| 53 | 53 | $this->addToPropertyCtrl("class", "link", array( |
| 54 | 54 | "link" |
| 55 | 55 | )); |
| 56 | 56 | return parent::asLinks($hrefs, $target); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function addList($items = array()) { |
|
| 60 | - $list = new HtmlList("", $items); |
|
| 59 | + public function addList($items=array()) { |
|
| 60 | + $list=new HtmlList("", $items); |
|
| 61 | 61 | $list->setClass("list"); |
| 62 | 62 | return $this->addItem($list); |
| 63 | 63 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | protected function getItemToAdd($item) { |
| 74 | - $itemO = parent::getItemToAdd($item); |
|
| 74 | + $itemO=parent::getItemToAdd($item); |
|
| 75 | 75 | if ($itemO instanceof AbstractCheckbox) |
| 76 | 76 | $itemO->addClass("item"); |
| 77 | 77 | return $itemO; |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | public function run(JsUtils $js) { |
| 93 | - if ($this->_hasCheckedList === true) { |
|
| 94 | - $jsCode = include dirname(__FILE__) . '/../../components/jsTemplates/tplCheckedList.php'; |
|
| 95 | - $jsCode = \str_replace("%identifier%", "#" . $this->identifier, $jsCode); |
|
| 96 | - $jsCode = \str_replace("%fireOnInit%", $this->_fireOnInit, $jsCode); |
|
| 97 | - $jsCode = \str_replace("%onChange%", $this->_ckItemChange, $jsCode); |
|
| 93 | + if ($this->_hasCheckedList===true) { |
|
| 94 | + $jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php'; |
|
| 95 | + $jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode); |
|
| 96 | + $jsCode=\str_replace("%fireOnInit%", $this->_fireOnInit, $jsCode); |
|
| 97 | + $jsCode=\str_replace("%onChange%", $this->_ckItemChange, $jsCode); |
|
| 98 | 98 | $this->executeOnRun($jsCode); |
| 99 | 99 | } |
| 100 | 100 | /* |
@@ -106,19 +106,19 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | protected function addFollowPoints() { |
| 109 | - $count = $this->count(); |
|
| 110 | - for ($i = $this->_maxVisible; $i < $count; $i ++) { |
|
| 109 | + $count=$this->count(); |
|
| 110 | + for ($i=$this->_maxVisible; $i<$count; $i++) { |
|
| 111 | 111 | $this->getItem($i) |
| 112 | 112 | ->addClass("notVisible") |
| 113 | 113 | ->setProperty("style", "display: none;"); |
| 114 | 114 | } |
| 115 | - $item = $this->addItem("..."); |
|
| 115 | + $item=$this->addItem("..."); |
|
| 116 | 116 | $item->addClass("points"); |
| 117 | - $item->onClick('$(this).hide();$("#' . $this->identifier . ' .notVisible").show();'); |
|
| 117 | + $item->onClick('$(this).hide();$("#'.$this->identifier.' .notVisible").show();'); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | public function onCkItemChange($jsCode) { |
| 121 | - $this->_ckItemChange = $jsCode; |
|
| 121 | + $this->_ckItemChange=$jsCode; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @param boolean $fireOnInit |
| 127 | 127 | */ |
| 128 | 128 | public function setFireOnInit($fireOnInit) { |
| 129 | - $this->_fireOnInit = $fireOnInit; |
|
| 129 | + $this->_fireOnInit=$fireOnInit; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | public function setRelaxed() { |
@@ -150,15 +150,15 @@ discard block |
||
| 150 | 150 | * {@inheritdoc} |
| 151 | 151 | * @see \Ajax\common\html\HtmlCollection::compile() |
| 152 | 152 | */ |
| 153 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
| 154 | - if (isset($this->_maxVisible) && $this->_maxVisible < $this->count()) { |
|
| 153 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 154 | + if (isset($this->_maxVisible) && $this->_maxVisible<$this->count()) { |
|
| 155 | 155 | $this->addFollowPoints(); |
| 156 | 156 | if (isset($js)) { |
| 157 | - $visibility = new Visibility($js); |
|
| 158 | - $visibility->attach("#" . $this->identifier); |
|
| 157 | + $visibility=new Visibility($js); |
|
| 158 | + $visibility->attach("#".$this->identifier); |
|
| 159 | 159 | $visibility->setOnTopVisible("$(this).children('.notVisible').hide();$(this).find('.points').show();"); |
| 160 | 160 | $visibility->compile($js, $view); |
| 161 | - $this->_visibility = $visibility; |
|
| 161 | + $this->_visibility=$visibility; |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | return parent::compile($js, $view); |
@@ -173,21 +173,21 @@ discard block |
||
| 173 | 173 | * @param string $notAllChecked |
| 174 | 174 | * @return HtmlList |
| 175 | 175 | */ |
| 176 | - public function addCheckedList($items = array(), $masterItem = NULL, $values = array(), $notAllChecked = false, $name = null) { |
|
| 177 | - $count = $this->count(); |
|
| 178 | - $identifier = $this->identifier . "-" . $count; |
|
| 176 | + public function addCheckedList($items=array(), $masterItem=NULL, $values=array(), $notAllChecked=false, $name=null) { |
|
| 177 | + $count=$this->count(); |
|
| 178 | + $identifier=$this->identifier."-".$count; |
|
| 179 | 179 | if (isset($masterItem)) { |
| 180 | 180 | if (\is_array($masterItem)) { |
| 181 | - $masterO = new HtmlFormCheckbox("master-" . $identifier, @$masterItem[0], @$masterItem[1]); |
|
| 181 | + $masterO=new HtmlFormCheckbox("master-".$identifier, @$masterItem[0], @$masterItem[1]); |
|
| 182 | 182 | if (isset($name)) |
| 183 | 183 | $masterO->setName($name); |
| 184 | 184 | if (isset($masterItem[1])) { |
| 185 | - if (\array_search($masterItem[1], $values) !== false) { |
|
| 185 | + if (\array_search($masterItem[1], $values)!==false) { |
|
| 186 | 186 | $masterO->getDataField()->setProperty("checked", ""); |
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | } else { |
| 190 | - $masterO = new HtmlFormCheckbox("master-" . $identifier, $masterItem); |
|
| 190 | + $masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem); |
|
| 191 | 191 | } |
| 192 | 192 | if ($notAllChecked) { |
| 193 | 193 | $masterO->getDataField()->addClass("_notAllChecked"); |
@@ -196,36 +196,36 @@ discard block |
||
| 196 | 196 | $masterO->setClass("item"); |
| 197 | 197 | $this->addItem($masterO); |
| 198 | 198 | } |
| 199 | - $fields = array(); |
|
| 200 | - $i = 0; |
|
| 201 | - $this->setFireOnInit(UString::getBooleanStr($this->_fireOnInit || count($items) < 30)); |
|
| 199 | + $fields=array(); |
|
| 200 | + $i=0; |
|
| 201 | + $this->setFireOnInit(UString::getBooleanStr($this->_fireOnInit || count($items)<30)); |
|
| 202 | 202 | foreach ($items as $val => $caption) { |
| 203 | - $itemO = new HtmlFormCheckbox($identifier . "-" . $i ++, $caption, $val, "child"); |
|
| 204 | - if (\array_search($val, $values) !== false) { |
|
| 203 | + $itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child"); |
|
| 204 | + if (\array_search($val, $values)!==false) { |
|
| 205 | 205 | $itemO->getDataField()->setProperty("checked", ""); |
| 206 | 206 | } |
| 207 | 207 | if (isset($name)) |
| 208 | 208 | $itemO->setName($name); |
| 209 | 209 | $itemO->setClass("item"); |
| 210 | - $fields[] = $itemO; |
|
| 210 | + $fields[]=$itemO; |
|
| 211 | 211 | } |
| 212 | - if (isset($masterO) === true) { |
|
| 213 | - $list = new HtmlList("", $fields); |
|
| 212 | + if (isset($masterO)===true) { |
|
| 213 | + $list=new HtmlList("", $fields); |
|
| 214 | 214 | $list->setClass("list"); |
| 215 | 215 | $masterO->addContent($list); |
| 216 | 216 | } else { |
| 217 | 217 | $this->addList($fields); |
| 218 | 218 | } |
| 219 | - $this->_hasCheckedList = true; |
|
| 219 | + $this->_hasCheckedList=true; |
|
| 220 | 220 | return $this; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | public function setIcons($icons) { |
| 224 | - if (! \is_array($icons)) { |
|
| 225 | - $icons = \array_fill(0, \sizeof($this->content), $icons); |
|
| 224 | + if (!\is_array($icons)) { |
|
| 225 | + $icons=\array_fill(0, \sizeof($this->content), $icons); |
|
| 226 | 226 | } |
| 227 | - $max = \min(\sizeof($icons), \sizeof($this->content)); |
|
| 228 | - for ($i = 0; $i < $max; $i ++) { |
|
| 227 | + $max=\min(\sizeof($icons), \sizeof($this->content)); |
|
| 228 | + for ($i=0; $i<$max; $i++) { |
|
| 229 | 229 | $this->content[$i]->addIcon($icons[$i]); |
| 230 | 230 | } |
| 231 | 231 | return $this; |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | * @param mixed $_maxVisible |
| 245 | 245 | */ |
| 246 | 246 | public function setMaxVisible($_maxVisible) { |
| 247 | - $this->_maxVisible = $_maxVisible; |
|
| 247 | + $this->_maxVisible=$_maxVisible; |
|
| 248 | 248 | return $this; |
| 249 | 249 | } |
| 250 | 250 | } |
@@ -72,8 +72,9 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | protected function getItemToAdd($item) { |
| 74 | 74 | $itemO = parent::getItemToAdd($item); |
| 75 | - if ($itemO instanceof AbstractCheckbox) |
|
| 76 | - $itemO->addClass("item"); |
|
| 75 | + if ($itemO instanceof AbstractCheckbox) { |
|
| 76 | + $itemO->addClass("item"); |
|
| 77 | + } |
|
| 77 | 78 | return $itemO; |
| 78 | 79 | } |
| 79 | 80 | |
@@ -179,8 +180,9 @@ discard block |
||
| 179 | 180 | if (isset($masterItem)) { |
| 180 | 181 | if (\is_array($masterItem)) { |
| 181 | 182 | $masterO = new HtmlFormCheckbox("master-" . $identifier, @$masterItem[0], @$masterItem[1]); |
| 182 | - if (isset($name)) |
|
| 183 | - $masterO->setName($name); |
|
| 183 | + if (isset($name)) { |
|
| 184 | + $masterO->setName($name); |
|
| 185 | + } |
|
| 184 | 186 | if (isset($masterItem[1])) { |
| 185 | 187 | if (\array_search($masterItem[1], $values) !== false) { |
| 186 | 188 | $masterO->getDataField()->setProperty("checked", ""); |
@@ -204,8 +206,9 @@ discard block |
||
| 204 | 206 | if (\array_search($val, $values) !== false) { |
| 205 | 207 | $itemO->getDataField()->setProperty("checked", ""); |
| 206 | 208 | } |
| 207 | - if (isset($name)) |
|
| 208 | - $itemO->setName($name); |
|
| 209 | + if (isset($name)) { |
|
| 210 | + $itemO->setName($name); |
|
| 211 | + } |
|
| 209 | 212 | $itemO->setClass("item"); |
| 210 | 213 | $fields[] = $itemO; |
| 211 | 214 | } |