@@ -9,25 +9,25 @@ |
||
| 9 | 9 | class HtmlMenuItem extends HtmlSemDoubleElement { |
| 10 | 10 | use MenuItemTrait; |
| 11 | 11 | public function __construct($identifier, $content) { |
| 12 | - parent::__construct($identifier,"div","item",$content); |
|
| 12 | + parent::__construct($identifier, "div", "item", $content); |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - protected function initContent($content){ |
|
| 16 | - if(\is_array($content)){ |
|
| 17 | - if(JArray::isAssociative($content)===false){ |
|
| 15 | + protected function initContent($content) { |
|
| 16 | + if (\is_array($content)) { |
|
| 17 | + if (JArray::isAssociative($content)===false) { |
|
| 18 | 18 | $icon=@$content[0]; |
| 19 | 19 | $title=@$content[1]; |
| 20 | - }else{ |
|
| 20 | + } else { |
|
| 21 | 21 | $icon=@$content["icon"]; |
| 22 | 22 | $title=@$content["title"]; |
| 23 | 23 | } |
| 24 | - if(isset($icon)){ |
|
| 24 | + if (isset($icon)) { |
|
| 25 | 25 | $this->addIcon($icon); |
| 26 | 26 | } |
| 27 | - if(isset($title)){ |
|
| 27 | + if (isset($title)) { |
|
| 28 | 28 | $this->setTitle($title); |
| 29 | 29 | } |
| 30 | - }else{ |
|
| 30 | + } else { |
|
| 31 | 31 | $this->setContent($content); |
| 32 | 32 | } |
| 33 | 33 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | if(JArray::isAssociative($content)===false){ |
| 18 | 18 | $icon=@$content[0]; |
| 19 | 19 | $title=@$content[1]; |
| 20 | - }else{ |
|
| 20 | + } else{ |
|
| 21 | 21 | $icon=@$content["icon"]; |
| 22 | 22 | $title=@$content["title"]; |
| 23 | 23 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | if(isset($title)){ |
| 28 | 28 | $this->setTitle($title); |
| 29 | 29 | } |
| 30 | - }else{ |
|
| 30 | + } else{ |
|
| 31 | 31 | $this->setContent($content); |
| 32 | 32 | } |
| 33 | 33 | } |
@@ -20,35 +20,35 @@ discard block |
||
| 20 | 20 | * @property string $identifier |
| 21 | 21 | */ |
| 22 | 22 | trait FieldsTrait { |
| 23 | - abstract public function addFields($fields=NULL,$label=NULL); |
|
| 23 | + abstract public function addFields($fields=NULL, $label=NULL); |
|
| 24 | 24 | abstract public function addItem($item); |
| 25 | 25 | abstract public function getItem($index); |
| 26 | 26 | abstract public function count(); |
| 27 | 27 | |
| 28 | - protected function createItem($value){ |
|
| 29 | - if(\is_array($value)){ |
|
| 30 | - $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id",""),JArray::getDefaultValue($value, "label",null),JArray::getDefaultValue($value, "type", "text"),JArray::getDefaultValue($value, "value",""),JArray::getDefaultValue($value, "placeholder",JArray::getDefaultValue($value, "label",null))); |
|
| 28 | + protected function createItem($value) { |
|
| 29 | + if (\is_array($value)) { |
|
| 30 | + $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id", ""), JArray::getDefaultValue($value, "label", null), JArray::getDefaultValue($value, "type", "text"), JArray::getDefaultValue($value, "value", ""), JArray::getDefaultValue($value, "placeholder", JArray::getDefaultValue($value, "label", null))); |
|
| 31 | 31 | return $itemO; |
| 32 | - }elseif(\is_object($value)){ |
|
| 32 | + }elseif (\is_object($value)) { |
|
| 33 | 33 | $itemO=new HtmlFormField("field-".$this->identifier, $value); |
| 34 | 34 | return $itemO; |
| 35 | - }else |
|
| 35 | + } else |
|
| 36 | 36 | return new HtmlFormInput($value); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - protected function createCondition($value){ |
|
| 39 | + protected function createCondition($value) { |
|
| 40 | 40 | return \is_object($value)===false || $value instanceof \Ajax\semantic\html\elements\HtmlInput; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function addInputs($inputs,$fieldslabel=null){ |
|
| 43 | + public function addInputs($inputs, $fieldslabel=null) { |
|
| 44 | 44 | $fields=array(); |
| 45 | - foreach ($inputs as $input){ |
|
| 45 | + foreach ($inputs as $input) { |
|
| 46 | 46 | \extract($input); |
| 47 | - $f=new HtmlFormInput("",""); |
|
| 47 | + $f=new HtmlFormInput("", ""); |
|
| 48 | 48 | $f->fromArray($input); |
| 49 | 49 | $fields[]=$f; |
| 50 | 50 | } |
| 51 | - return $this->addFields($fields,$fieldslabel); |
|
| 51 | + return $this->addFields($fields, $fieldslabel); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -57,35 +57,35 @@ discard block |
||
| 57 | 57 | * @param array|mixed $values |
| 58 | 58 | * @return HtmlFormFields |
| 59 | 59 | */ |
| 60 | - public function setFieldsPropertyValues($property,$values){ |
|
| 60 | + public function setFieldsPropertyValues($property, $values) { |
|
| 61 | 61 | $i=0; |
| 62 | - if(\is_array($values)===false){ |
|
| 63 | - $values=\array_fill(0, $this->count(),$values); |
|
| 62 | + if (\is_array($values)===false) { |
|
| 63 | + $values=\array_fill(0, $this->count(), $values); |
|
| 64 | 64 | } |
| 65 | - foreach ($values as $value){ |
|
| 65 | + foreach ($values as $value) { |
|
| 66 | 66 | $c=$this->content[$i++]; |
| 67 | - if(isset($c)){ |
|
| 67 | + if (isset($c)) { |
|
| 68 | 68 | $df=$c->getDataField(); |
| 69 | - $df->setProperty($property,$value); |
|
| 69 | + $df->setProperty($property, $value); |
|
| 70 | 70 | } |
| 71 | - else{ |
|
| 71 | + else { |
|
| 72 | 72 | return $this; |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | return $this; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - public function addFieldRule($index,$type,$prompt=NULL,$value=NULL){ |
|
| 78 | + public function addFieldRule($index, $type, $prompt=NULL, $value=NULL) { |
|
| 79 | 79 | $field=$this->getItem($index); |
| 80 | - if(isset($field)){ |
|
| 81 | - $field->addRule($type,$prompt,$value); |
|
| 80 | + if (isset($field)) { |
|
| 81 | + $field->addRule($type, $prompt, $value); |
|
| 82 | 82 | } |
| 83 | 83 | return $this; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - public function addFieldRules($index,$rules){ |
|
| 86 | + public function addFieldRules($index, $rules) { |
|
| 87 | 87 | $field=$this->getItem($index); |
| 88 | - if(isset($field)){ |
|
| 88 | + if (isset($field)) { |
|
| 89 | 89 | $field->addRules($rules); |
| 90 | 90 | } |
| 91 | 91 | return $this; |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | * @param boolean $multiple |
| 101 | 101 | * @return HtmlFormDropdown |
| 102 | 102 | */ |
| 103 | - public function addDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false){ |
|
| 104 | - return $this->addItem(new HtmlFormDropdown($identifier,$items,$label,$value,$multiple)); |
|
| 103 | + public function addDropdown($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false) { |
|
| 104 | + return $this->addItem(new HtmlFormDropdown($identifier, $items, $label, $value, $multiple)); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | * @param boolean $asIcons |
| 112 | 112 | * @return HtmlButtonGroups |
| 113 | 113 | */ |
| 114 | - public function addButtonGroups($identifier,$elements=[],$asIcons=false){ |
|
| 115 | - return $this->addItem(new HtmlButtonGroups($identifier,$elements,$asIcons)); |
|
| 114 | + public function addButtonGroups($identifier, $elements=[], $asIcons=false) { |
|
| 115 | + return $this->addItem(new HtmlButtonGroups($identifier, $elements, $asIcons)); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -124,8 +124,8 @@ discard block |
||
| 124 | 124 | * @param string $icon |
| 125 | 125 | * @return HtmlButtonGroups |
| 126 | 126 | */ |
| 127 | - public function addDropdownButton($identifier,$value,$items=[],$asCombo=false,$icon=null){ |
|
| 128 | - return $this->addItem(HtmlButton::dropdown($identifier, $value,$items,$asCombo,$icon)); |
|
| 127 | + public function addDropdownButton($identifier, $value, $items=[], $asCombo=false, $icon=null) { |
|
| 128 | + return $this->addItem(HtmlButton::dropdown($identifier, $value, $items, $asCombo, $icon)); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | * @param string $placeholder |
| 137 | 137 | * @return HtmlFormInput |
| 138 | 138 | */ |
| 139 | - public function addInput($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL){ |
|
| 140 | - return $this->addItem(new HtmlFormInput($identifier,$label,$type,$value,$placeholder)); |
|
| 139 | + public function addInput($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
| 140 | + return $this->addItem(new HtmlFormInput($identifier, $label, $type, $value, $placeholder)); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /** |
@@ -148,16 +148,16 @@ discard block |
||
| 148 | 148 | * @param int $rows |
| 149 | 149 | * @return HtmlTextarea |
| 150 | 150 | */ |
| 151 | - public function addTextarea($identifier, $label,$value=NULL,$placeholder=NULL,$rows=5){ |
|
| 152 | - return $this->addItem(new HtmlFormTextarea($identifier,$label,$value,$placeholder,$rows)); |
|
| 151 | + public function addTextarea($identifier, $label, $value=NULL, $placeholder=NULL, $rows=5) { |
|
| 152 | + return $this->addItem(new HtmlFormTextarea($identifier, $label, $value, $placeholder, $rows)); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - public function addPassword($identifier, $label=NULL){ |
|
| 156 | - return $this->addItem(new HtmlFormInput($identifier,$label,"password","","")); |
|
| 155 | + public function addPassword($identifier, $label=NULL) { |
|
| 156 | + return $this->addItem(new HtmlFormInput($identifier, $label, "password", "", "")); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - public function addButton($identifier,$value,$cssStyle=NULL,$onClick=NULL){ |
|
| 160 | - return $this->addItem(new HtmlButton($identifier,$value,$cssStyle,$onClick)); |
|
| 159 | + public function addButton($identifier, $value, $cssStyle=NULL, $onClick=NULL) { |
|
| 160 | + return $this->addItem(new HtmlButton($identifier, $value, $cssStyle, $onClick)); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -167,16 +167,16 @@ discard block |
||
| 167 | 167 | * @param string $type |
| 168 | 168 | * @return HtmlFormCheckbox |
| 169 | 169 | */ |
| 170 | - public function addCheckbox($identifier, $label=NULL,$value=NULL,$type=NULL){ |
|
| 171 | - return $this->addItem(new HtmlFormCheckbox($identifier,$label,$value,$type)); |
|
| 170 | + public function addCheckbox($identifier, $label=NULL, $value=NULL, $type=NULL) { |
|
| 171 | + return $this->addItem(new HtmlFormCheckbox($identifier, $label, $value, $type)); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - public function addRadio($identifier, $name,$label=NULL,$value=NULL){ |
|
| 175 | - return $this->addItem(new HtmlFormRadio($identifier,$name,$label,$value)); |
|
| 174 | + public function addRadio($identifier, $name, $label=NULL, $value=NULL) { |
|
| 175 | + return $this->addItem(new HtmlFormRadio($identifier, $name, $label, $value)); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - public function addElement($identifier,$content,$label,$tagName="div",$baseClass=""){ |
|
| 179 | - $div=new HtmlSemDoubleElement($identifier,$tagName,$baseClass,$content); |
|
| 180 | - return $this->addItem(new HtmlFormField("field-".$identifier, $div,$label)); |
|
| 178 | + public function addElement($identifier, $content, $label, $tagName="div", $baseClass="") { |
|
| 179 | + $div=new HtmlSemDoubleElement($identifier, $tagName, $baseClass, $content); |
|
| 180 | + return $this->addItem(new HtmlFormField("field-".$identifier, $div, $label)); |
|
| 181 | 181 | } |
| 182 | 182 | } |
@@ -29,16 +29,16 @@ discard block |
||
| 29 | 29 | $this->_colSizing=false; |
| 30 | 30 | $this->setWide($numCols); |
| 31 | 31 | } |
| 32 | - if($createCols) |
|
| 32 | + if ($createCols) |
|
| 33 | 33 | $this->setRowsCount($numRows, $numCols); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public function asSegment() { |
| 37 | - return $this->addToPropertyCtrl("class", "segment", array ("segment" )); |
|
| 37 | + return $this->addToPropertyCtrl("class", "segment", array("segment")); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function asContainer() { |
| 41 | - return $this->addToPropertyCtrl("class", "container", array ("container" )); |
|
| 41 | + return $this->addToPropertyCtrl("class", "container", array("container")); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | * @param int $wide |
| 47 | 47 | */ |
| 48 | 48 | public function setWide($wide) { |
| 49 | - if(isset(Wide::getConstants()["W" . $wide])){ |
|
| 50 | - $wide=Wide::getConstants()["W" . $wide]; |
|
| 49 | + if (isset(Wide::getConstants()["W".$wide])) { |
|
| 50 | + $wide=Wide::getConstants()["W".$wide]; |
|
| 51 | 51 | $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
| 52 | - return $this->addToPropertyCtrl("class", "column", array ("column" )); |
|
| 52 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
| 53 | 53 | } |
| 54 | 54 | return $this; |
| 55 | 55 | } |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | * @return mixed |
| 70 | 70 | */ |
| 71 | 71 | public function addRow($colsCount=NULL) { |
| 72 | - $rowCount=$this->rowCount() + 1; |
|
| 72 | + $rowCount=$this->rowCount()+1; |
|
| 73 | 73 | $this->setRowsCount($rowCount, $colsCount, true); |
| 74 | - return $this->content[$rowCount - 1]; |
|
| 74 | + return $this->content[$rowCount-1]; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | * @return mixed|\Ajax\semantic\html\collections\HtmlGrid |
| 81 | 81 | */ |
| 82 | 82 | public function addCol($width=NULL) { |
| 83 | - $colCount=$this->colCount() + 1; |
|
| 83 | + $colCount=$this->colCount()+1; |
|
| 84 | 84 | $this->setColsCount($colCount, true, $width); |
| 85 | 85 | if ($this->hasOnlyCols($this->count())) |
| 86 | - return $this->content[$colCount - 1]; |
|
| 86 | + return $this->content[$colCount-1]; |
|
| 87 | 87 | return $this; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 94 | 94 | */ |
| 95 | 95 | public function addCols($sizes=array()) { |
| 96 | - foreach ( $sizes as $size ) { |
|
| 96 | + foreach ($sizes as $size) { |
|
| 97 | 97 | $this->addCol($size); |
| 98 | 98 | } |
| 99 | 99 | return $this; |
@@ -107,19 +107,19 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function setRowsCount($rowsCount, $colsCount=NULL, $force=false) { |
| 109 | 109 | $count=$this->count(); |
| 110 | - if ($rowsCount < 2 && $force === false) { |
|
| 111 | - for($i=$count; $i < $colsCount; $i++) { |
|
| 112 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i)); |
|
| 110 | + if ($rowsCount<2 && $force===false) { |
|
| 111 | + for ($i=$count; $i<$colsCount; $i++) { |
|
| 112 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i)); |
|
| 113 | 113 | } |
| 114 | 114 | } else { |
| 115 | 115 | if ($this->hasOnlyCols($count)) { |
| 116 | 116 | $tmpContent=$this->content; |
| 117 | 117 | $item=$this->addItem($colsCount); |
| 118 | 118 | $item->setContent($tmpContent); |
| 119 | - $this->content=array (); |
|
| 119 | + $this->content=array(); |
|
| 120 | 120 | $count=1; |
| 121 | 121 | } |
| 122 | - for($i=$count; $i < $rowsCount; $i++) { |
|
| 122 | + for ($i=$count; $i<$rowsCount; $i++) { |
|
| 123 | 123 | $this->addItem($colsCount); |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | protected function hasOnlyCols($count) { |
| 130 | - return $count > 0 && $this->content[0] instanceof HtmlGridCol; |
|
| 130 | + return $count>0 && $this->content[0] instanceof HtmlGridCol; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -141,14 +141,14 @@ discard block |
||
| 141 | 141 | if (isset($width)===false) { |
| 142 | 142 | $this->setWide($numCols); |
| 143 | 143 | } |
| 144 | - if ($toCreate === true) { |
|
| 144 | + if ($toCreate===true) { |
|
| 145 | 145 | $count=$this->count(); |
| 146 | - if ($count == 0 || $this->hasOnlyCols($count)) { |
|
| 147 | - for($i=$count; $i < $numCols; $i++) { |
|
| 148 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i, $width)); |
|
| 146 | + if ($count==0 || $this->hasOnlyCols($count)) { |
|
| 147 | + for ($i=$count; $i<$numCols; $i++) { |
|
| 148 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i, $width)); |
|
| 149 | 149 | } |
| 150 | 150 | } else { |
| 151 | - for($i=0; $i < $count; $i++) { |
|
| 151 | + for ($i=0; $i<$count; $i++) { |
|
| 152 | 152 | $this->getItem($i)->setColsCount($numCols); |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | /** |
| 169 | 169 | * @return HtmlGridRow |
| 170 | 170 | */ |
| 171 | - public function getItem($index){ |
|
| 171 | + public function getItem($index) { |
|
| 172 | 172 | return parent::getItem($index); |
| 173 | 173 | } |
| 174 | 174 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $count=$this->count(); |
| 192 | 192 | if ($this->hasOnlyCols($count)) |
| 193 | 193 | return $count; |
| 194 | - if ($count > 0) |
|
| 194 | + if ($count>0) |
|
| 195 | 195 | return $this->getItem(0)->count(); |
| 196 | 196 | return 0; |
| 197 | 197 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * @return HtmlGridCol|HtmlGridRow |
| 204 | 204 | */ |
| 205 | 205 | public function getCell($row, $col) { |
| 206 | - if ($row < 2 && $this->hasOnlyCols($this->count())) |
|
| 206 | + if ($row<2 && $this->hasOnlyCols($this->count())) |
|
| 207 | 207 | return $this->getItem($col); |
| 208 | 208 | $row=$this->getItem($row); |
| 209 | 209 | if (isset($row)) { |
@@ -218,8 +218,8 @@ discard block |
||
| 218 | 218 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 219 | 219 | */ |
| 220 | 220 | public function setDivided($vertically=false) { |
| 221 | - $value=($vertically === true) ? "vertically divided" : "divided"; |
|
| 222 | - return $this->addToPropertyCtrl("class", $value, array ("divided" )); |
|
| 221 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
| 222 | + return $this->addToPropertyCtrl("class", $value, array("divided")); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | /** |
@@ -228,15 +228,15 @@ discard block |
||
| 228 | 228 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 229 | 229 | */ |
| 230 | 230 | public function setCelled($internally=false) { |
| 231 | - $value=($internally === true) ? "internally celled" : "celled"; |
|
| 232 | - return $this->addToPropertyCtrl("class", $value, array ("celled","internally celled" )); |
|
| 231 | + $value=($internally===true) ? "internally celled" : "celled"; |
|
| 232 | + return $this->addToPropertyCtrl("class", $value, array("celled", "internally celled")); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | /** |
| 236 | 236 | * A grid can have its columns centered |
| 237 | 237 | */ |
| 238 | 238 | public function setCentered() { |
| 239 | - return $this->addToPropertyCtrl("class", "centered", array ("centered" )); |
|
| 239 | + return $this->addToPropertyCtrl("class", "centered", array("centered")); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /** |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | public function setPadded($value=NULL) { |
| 256 | 256 | if (isset($value)) |
| 257 | - $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
| 257 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
| 258 | 258 | return $this->addToProperty("class", "padded"); |
| 259 | 259 | } |
| 260 | 260 | |
@@ -264,12 +264,12 @@ discard block |
||
| 264 | 264 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 265 | 265 | */ |
| 266 | 266 | public function setRelaxed($very=false) { |
| 267 | - $value=($very === true) ? "very relaxed" : "relaxed"; |
|
| 268 | - return $this->addToPropertyCtrl("class", $value, array ("relaxed","very relaxed" )); |
|
| 267 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
| 268 | + return $this->addToPropertyCtrl("class", $value, array("relaxed", "very relaxed")); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
| 272 | - return $this->addToPropertyCtrl("class", $value . " aligned", VerticalAlignment::getConstantValues("aligned")); |
|
| 272 | + return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned")); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
@@ -279,9 +279,9 @@ discard block |
||
| 279 | 279 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 280 | 280 | */ |
| 281 | 281 | protected function createItem($value) { |
| 282 | - if ($this->_createCols === false) |
|
| 282 | + if ($this->_createCols===false) |
|
| 283 | 283 | $value=null; |
| 284 | - $item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows); |
|
| 284 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows); |
|
| 285 | 285 | return $item; |
| 286 | 286 | } |
| 287 | 287 | |
@@ -292,20 +292,20 @@ discard block |
||
| 292 | 292 | public function setValues($values, $force=true) { |
| 293 | 293 | $count=$this->count(); |
| 294 | 294 | $valuesSize=\sizeof($values); |
| 295 | - if ($this->_createCols === false || $force === true) { |
|
| 296 | - for($i=$count; $i < $valuesSize; $i++) { |
|
| 295 | + if ($this->_createCols===false || $force===true) { |
|
| 296 | + for ($i=$count; $i<$valuesSize; $i++) { |
|
| 297 | 297 | $colSize=\sizeof($values[$i]); |
| 298 | - $this->addItem(new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
| 298 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | - $count=\min(array ($this->count(),$valuesSize )); |
|
| 302 | - for($i=0; $i < $count; $i++) { |
|
| 303 | - $this->content[$i]->setValues($values[$i], $this->_createCols === false); |
|
| 301 | + $count=\min(array($this->count(), $valuesSize)); |
|
| 302 | + for ($i=0; $i<$count; $i++) { |
|
| 303 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - public function setColWidth($numCol,$width){ |
|
| 308 | - foreach ($this->content as $row){ |
|
| 307 | + public function setColWidth($numCol, $width) { |
|
| 308 | + foreach ($this->content as $row) { |
|
| 309 | 309 | $row->getCol($numCol)->setWidth($width); |
| 310 | 310 | } |
| 311 | 311 | return $this; |
@@ -29,8 +29,9 @@ discard block |
||
| 29 | 29 | $this->_colSizing=false; |
| 30 | 30 | $this->setWide($numCols); |
| 31 | 31 | } |
| 32 | - if($createCols) |
|
| 33 | - $this->setRowsCount($numRows, $numCols); |
|
| 32 | + if($createCols) { |
|
| 33 | + $this->setRowsCount($numRows, $numCols); |
|
| 34 | + } |
|
| 34 | 35 | } |
| 35 | 36 | |
| 36 | 37 | public function asSegment() { |
@@ -82,8 +83,9 @@ discard block |
||
| 82 | 83 | public function addCol($width=NULL) { |
| 83 | 84 | $colCount=$this->colCount() + 1; |
| 84 | 85 | $this->setColsCount($colCount, true, $width); |
| 85 | - if ($this->hasOnlyCols($this->count())) |
|
| 86 | - return $this->content[$colCount - 1]; |
|
| 86 | + if ($this->hasOnlyCols($this->count())) { |
|
| 87 | + return $this->content[$colCount - 1]; |
|
| 88 | + } |
|
| 87 | 89 | return $this; |
| 88 | 90 | } |
| 89 | 91 | |
@@ -178,8 +180,9 @@ discard block |
||
| 178 | 180 | */ |
| 179 | 181 | public function rowCount() { |
| 180 | 182 | $count=$this->count(); |
| 181 | - if ($this->hasOnlyCols($count)) |
|
| 182 | - return 0; |
|
| 183 | + if ($this->hasOnlyCols($count)) { |
|
| 184 | + return 0; |
|
| 185 | + } |
|
| 183 | 186 | return $count; |
| 184 | 187 | } |
| 185 | 188 | |
@@ -189,10 +192,12 @@ discard block |
||
| 189 | 192 | */ |
| 190 | 193 | public function colCount() { |
| 191 | 194 | $count=$this->count(); |
| 192 | - if ($this->hasOnlyCols($count)) |
|
| 193 | - return $count; |
|
| 194 | - if ($count > 0) |
|
| 195 | - return $this->getItem(0)->count(); |
|
| 195 | + if ($this->hasOnlyCols($count)) { |
|
| 196 | + return $count; |
|
| 197 | + } |
|
| 198 | + if ($count > 0) { |
|
| 199 | + return $this->getItem(0)->count(); |
|
| 200 | + } |
|
| 196 | 201 | return 0; |
| 197 | 202 | } |
| 198 | 203 | |
@@ -203,8 +208,9 @@ discard block |
||
| 203 | 208 | * @return HtmlGridCol|HtmlGridRow |
| 204 | 209 | */ |
| 205 | 210 | public function getCell($row, $col) { |
| 206 | - if ($row < 2 && $this->hasOnlyCols($this->count())) |
|
| 207 | - return $this->getItem($col); |
|
| 211 | + if ($row < 2 && $this->hasOnlyCols($this->count())) { |
|
| 212 | + return $this->getItem($col); |
|
| 213 | + } |
|
| 208 | 214 | $row=$this->getItem($row); |
| 209 | 215 | if (isset($row)) { |
| 210 | 216 | $col=$row->getItem($col); |
@@ -253,8 +259,9 @@ discard block |
||
| 253 | 259 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 254 | 260 | */ |
| 255 | 261 | public function setPadded($value=NULL) { |
| 256 | - if (isset($value)) |
|
| 257 | - $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
| 262 | + if (isset($value)) { |
|
| 263 | + $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
| 264 | + } |
|
| 258 | 265 | return $this->addToProperty("class", "padded"); |
| 259 | 266 | } |
| 260 | 267 | |
@@ -279,8 +286,9 @@ discard block |
||
| 279 | 286 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 280 | 287 | */ |
| 281 | 288 | protected function createItem($value) { |
| 282 | - if ($this->_createCols === false) |
|
| 283 | - $value=null; |
|
| 289 | + if ($this->_createCols === false) { |
|
| 290 | + $value=null; |
|
| 291 | + } |
|
| 284 | 292 | $item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows); |
| 285 | 293 | return $item; |
| 286 | 294 | } |
@@ -18,11 +18,11 @@ discard block |
||
| 18 | 18 | protected $_dropdown; |
| 19 | 19 | public function __construct($identifier, $elements=array(), $asIcons=false) { |
| 20 | 20 | parent::__construct($identifier, "div", "ui buttons"); |
| 21 | - if ($asIcons === true) |
|
| 21 | + if ($asIcons===true) |
|
| 22 | 22 | $this->asIcons(); |
| 23 | 23 | $this->addElements($elements, $asIcons); |
| 24 | 24 | } |
| 25 | - protected function createItem($value){ |
|
| 25 | + protected function createItem($value) { |
|
| 26 | 26 | return new HtmlButton("", $value); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | * @param boolean $asCombo |
| 32 | 32 | * @return HtmlDropdown|HtmlButton |
| 33 | 33 | */ |
| 34 | - public function addDropdown($items,$asCombo=false){ |
|
| 35 | - $dd= new HtmlDropdown("dd-".$this->identifier,null,$items); |
|
| 34 | + public function addDropdown($items, $asCombo=false) { |
|
| 35 | + $dd=new HtmlDropdown("dd-".$this->identifier, null, $items); |
|
| 36 | 36 | $dd->asButton(); |
| 37 | - if($asCombo){ |
|
| 37 | + if ($asCombo) { |
|
| 38 | 38 | $dd->setAction("combo"); |
| 39 | 39 | $dd->addToProperty("class", "combo"); |
| 40 | 40 | } |
@@ -50,13 +50,13 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function addElement($element, $asIcon=false) { |
| 52 | 52 | $item=$this->addItem($element); |
| 53 | - if($asIcon) |
|
| 53 | + if ($asIcon) |
|
| 54 | 54 | $item->asIcon($element); |
| 55 | 55 | return $item; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public function addElements($elements, $asIcons=false) { |
| 59 | - foreach ( $elements as $element ) { |
|
| 59 | + foreach ($elements as $element) { |
|
| 60 | 60 | $this->addElement($element, $asIcons); |
| 61 | 61 | } |
| 62 | 62 | return $this; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | public function insertOr($aferIndex=0, $or="or") { |
| 66 | 66 | $orElement=new HtmlSemDoubleElement("", "div", "or"); |
| 67 | 67 | $orElement->setProperty("data-text", $or); |
| 68 | - array_splice($this->content, $aferIndex + 1, 0, array ($orElement )); |
|
| 68 | + array_splice($this->content, $aferIndex+1, 0, array($orElement)); |
|
| 69 | 69 | return $this; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | public function asIcons() { |
| 81 | - foreach ( $this->content as $item ) { |
|
| 82 | - if($item instanceof HtmlButton) |
|
| 81 | + foreach ($this->content as $item) { |
|
| 82 | + if ($item instanceof HtmlButton) |
|
| 83 | 83 | $item->asIcon($item->getContent()); |
| 84 | 84 | } |
| 85 | 85 | return $this->addToProperty("class", "icons"); |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | * @param array $icons |
| 91 | 91 | * @return HtmlButtonGroups |
| 92 | 92 | */ |
| 93 | - public function addIcons($icons){ |
|
| 94 | - foreach ( $this->content as $index=>$item ) { |
|
| 95 | - if($item instanceof HtmlButton && isset($icons[$index])) |
|
| 93 | + public function addIcons($icons) { |
|
| 94 | + foreach ($this->content as $index=>$item) { |
|
| 95 | + if ($item instanceof HtmlButton && isset($icons[$index])) |
|
| 96 | 96 | $item->addIcon($icons[$index]); |
| 97 | 97 | } |
| 98 | 98 | return $this; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
| 126 | 126 | */ |
| 127 | 127 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 128 | - foreach ( $this->content as $element ) { |
|
| 128 | + foreach ($this->content as $element) { |
|
| 129 | 129 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
| 130 | 130 | } |
| 131 | 131 | return $this; |
@@ -137,10 +137,10 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | public function addClasses($classes=array()) { |
| 139 | 139 | $i=0; |
| 140 | - if(!\is_array($classes)){ |
|
| 141 | - $classes=array_fill (0,$this->count(),$classes); |
|
| 140 | + if (!\is_array($classes)) { |
|
| 141 | + $classes=array_fill(0, $this->count(), $classes); |
|
| 142 | 142 | } |
| 143 | - foreach ( $this->content as $button ) { |
|
| 143 | + foreach ($this->content as $button) { |
|
| 144 | 144 | $button->addToProperty("class", $classes[$i++]); |
| 145 | 145 | } |
| 146 | 146 | return $this; |
@@ -154,8 +154,8 @@ discard block |
||
| 154 | 154 | $this->addElement($function($object)); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - public function run(JsUtils $js){ |
|
| 158 | - $result= parent::run($js); |
|
| 157 | + public function run(JsUtils $js) { |
|
| 158 | + $result=parent::run($js); |
|
| 159 | 159 | return $result->setItemSelector(".ui.button"); |
| 160 | 160 | } |
| 161 | 161 | |
@@ -40,8 +40,9 @@ |
||
| 40 | 40 | * @return HtmlBsDoubleElement default : "list-group-item-default" |
| 41 | 41 | */ |
| 42 | 42 | public function setStyle($cssStyle) { |
| 43 | - if (!JString::startsWith($cssStyle, "list-group-item")) |
|
| 44 | - $cssStyle="list-group-item".$cssStyle; |
|
| 43 | + if (!JString::startsWith($cssStyle, "list-group-item")) { |
|
| 44 | + $cssStyle="list-group-item".$cssStyle; |
|
| 45 | + } |
|
| 45 | 46 | $this->element->addToPropertyCtrl("class", $cssStyle, CssRef::Styles("list-group-item")); |
| 46 | 47 | return $this->element; |
| 47 | 48 | } |