@@ -19,17 +19,17 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | protected function createItem($value) { |
| 21 | 21 | $count=$this->count(); |
| 22 | - $item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value); |
|
| 22 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
| 23 | 23 | return $item; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function addHeader($niveau, $content) { |
| 27 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page"); |
|
| 27 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $content, "page"); |
|
| 28 | 28 | $this->wrap($header); |
| 29 | 29 | return $header; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function getItemPart($index,$partName="header"){ |
|
| 32 | + public function getItemPart($index, $partName="header") { |
|
| 33 | 33 | return $this->getItem($index)->getPart($partName); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | return $this->contentAs($tagName); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function asLinks($hrefs=[],$target=NUll) { |
|
| 41 | - $this->addToPropertyCtrl("class", "link", array ("link" )); |
|
| 42 | - return parent::asLinks($hrefs,$target); |
|
| 40 | + public function asLinks($hrefs=[], $target=NUll) { |
|
| 41 | + $this->addToPropertyCtrl("class", "link", array("link")); |
|
| 42 | + return parent::asLinks($hrefs, $target); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public function addList($items=array()) { |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | return $this->addItem($list); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - protected function getItemToAdd($item){ |
|
| 51 | + protected function getItemToAdd($item) { |
|
| 52 | 52 | $itemO=parent::getItemToAdd($item); |
| 53 | - if($itemO instanceof AbstractCheckbox) |
|
| 53 | + if ($itemO instanceof AbstractCheckbox) |
|
| 54 | 54 | $itemO->addClass("item"); |
| 55 | 55 | return $itemO; |
| 56 | 56 | } |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | public function run(JsUtils $js) { |
| 71 | - if ($this->_hasCheckedList === true) { |
|
| 72 | - $jsCode=include dirname(__FILE__) . '/../../components/jsTemplates/tplCheckedList.php'; |
|
| 73 | - $jsCode=\str_replace("%identifier%", "#" . $this->identifier, $jsCode); |
|
| 71 | + if ($this->_hasCheckedList===true) { |
|
| 72 | + $jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php'; |
|
| 73 | + $jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode); |
|
| 74 | 74 | $this->executeOnRun($jsCode); |
| 75 | 75 | } |
| 76 | 76 | return parent::run($js); |
@@ -100,42 +100,42 @@ discard block |
||
| 100 | 100 | * @param string $notAllChecked |
| 101 | 101 | * @return HtmlList |
| 102 | 102 | */ |
| 103 | - public function addCheckedList($items=array(), $masterItem=NULL, $values=array(),$notAllChecked=false,$name=null) { |
|
| 103 | + public function addCheckedList($items=array(), $masterItem=NULL, $values=array(), $notAllChecked=false, $name=null) { |
|
| 104 | 104 | $count=$this->count(); |
| 105 | - $identifier=$this->identifier . "-" . $count; |
|
| 105 | + $identifier=$this->identifier."-".$count; |
|
| 106 | 106 | if (isset($masterItem)) { |
| 107 | - if(\is_array($masterItem)){ |
|
| 108 | - $masterO=new HtmlFormCheckbox("master-" . $identifier, @$masterItem[0],@$masterItem[1]); |
|
| 109 | - if(isset($name)) |
|
| 107 | + if (\is_array($masterItem)) { |
|
| 108 | + $masterO=new HtmlFormCheckbox("master-".$identifier, @$masterItem[0], @$masterItem[1]); |
|
| 109 | + if (isset($name)) |
|
| 110 | 110 | $masterO->setName($name); |
| 111 | - if(isset($masterItem[1])){ |
|
| 112 | - if(\array_search($masterItem[1], $values)!==false){ |
|
| 111 | + if (isset($masterItem[1])) { |
|
| 112 | + if (\array_search($masterItem[1], $values)!==false) { |
|
| 113 | 113 | $masterO->getDataField()->setProperty("checked", ""); |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | - }else{ |
|
| 117 | - $masterO=new HtmlFormCheckbox("master-" . $identifier, $masterItem); |
|
| 116 | + } else { |
|
| 117 | + $masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem); |
|
| 118 | 118 | } |
| 119 | - if($notAllChecked){ |
|
| 119 | + if ($notAllChecked) { |
|
| 120 | 120 | $masterO->getDataField()->addClass("_notAllChecked"); |
| 121 | 121 | } |
| 122 | 122 | $masterO->getHtmlCk()->addToProperty("class", "master"); |
| 123 | 123 | $masterO->setClass("item"); |
| 124 | 124 | $this->addItem($masterO); |
| 125 | 125 | } |
| 126 | - $fields=array (); |
|
| 126 | + $fields=array(); |
|
| 127 | 127 | $i=0; |
| 128 | - foreach ( $items as $val => $caption ) { |
|
| 129 | - $itemO=new HtmlFormCheckbox($identifier . "-" . $i++, $caption, $val, "child"); |
|
| 130 | - if (\array_search($val, $values) !== false) { |
|
| 128 | + foreach ($items as $val => $caption) { |
|
| 129 | + $itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child"); |
|
| 130 | + if (\array_search($val, $values)!==false) { |
|
| 131 | 131 | $itemO->getDataField()->setProperty("checked", ""); |
| 132 | 132 | } |
| 133 | - if(isset($name)) |
|
| 133 | + if (isset($name)) |
|
| 134 | 134 | $itemO->setName($name); |
| 135 | 135 | $itemO->setClass("item"); |
| 136 | 136 | $fields[]=$itemO; |
| 137 | 137 | } |
| 138 | - if (isset($masterO) === true) { |
|
| 138 | + if (isset($masterO)===true) { |
|
| 139 | 139 | $list=new HtmlList("", $fields); |
| 140 | 140 | $list->setClass("list"); |
| 141 | 141 | $masterO->addContent($list); |
@@ -146,12 +146,12 @@ discard block |
||
| 146 | 146 | return $this; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - public function setIcons($icons){ |
|
| 150 | - if(!\is_array($icons)){ |
|
| 149 | + public function setIcons($icons) { |
|
| 150 | + if (!\is_array($icons)) { |
|
| 151 | 151 | $icons=\array_fill(0, \sizeof($this->content), $icons); |
| 152 | 152 | } |
| 153 | - $max=\min(\sizeof($icons),\sizeof($this->content)); |
|
| 154 | - for($i=0;$i<$max;$i++){ |
|
| 153 | + $max=\min(\sizeof($icons), \sizeof($this->content)); |
|
| 154 | + for ($i=0; $i<$max; $i++) { |
|
| 155 | 155 | $this->content[$i]->addIcon($icons[$i]); |
| 156 | 156 | } |
| 157 | 157 | return $this; |