@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | if(!$item instanceof HtmlDropdownItem){ |
| 73 | 73 | $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
| 74 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 74 | + } elseif($itemO instanceof HtmlDropdownItem){ |
|
| 75 | 75 | $this->addToProperty("class", "vertical"); |
| 76 | 76 | } |
| 77 | 77 | return $itemO; |
@@ -85,8 +85,9 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | public function addInput($name){ |
| 88 | - if(!isset($name)) |
|
| 89 | - $name="input-".$this->identifier; |
|
| 88 | + if(!isset($name)) { |
|
| 89 | + $name="input-".$this->identifier; |
|
| 90 | + } |
|
| 90 | 91 | $this->setAction("activate"); |
| 91 | 92 | $this->input=new HtmlInput($name,"hidden"); |
| 92 | 93 | } |
@@ -143,7 +144,7 @@ discard block |
||
| 143 | 144 | foreach ($items as $k=>$v){ |
| 144 | 145 | $this->addItem($v)->setData($k); |
| 145 | 146 | } |
| 146 | - }else{ |
|
| 147 | + } else{ |
|
| 147 | 148 | foreach ($items as $item){ |
| 148 | 149 | $this->addItem($item); |
| 149 | 150 | } |
@@ -167,7 +168,7 @@ discard block |
||
| 167 | 168 | if($dropdown===false){ |
| 168 | 169 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 169 | 170 | $dropdown="menu"; |
| 170 | - }else{ |
|
| 171 | + } else{ |
|
| 171 | 172 | $dropdown="dropdown"; |
| 172 | 173 | $this->mClass="menu"; |
| 173 | 174 | } |
@@ -187,20 +188,24 @@ discard block |
||
| 187 | 188 | } |
| 188 | 189 | |
| 189 | 190 | public function asButton($floating=false){ |
| 190 | - if($floating) |
|
| 191 | - $this->addToProperty("class", "floating"); |
|
| 191 | + if($floating) { |
|
| 192 | + $this->addToProperty("class", "floating"); |
|
| 193 | + } |
|
| 192 | 194 | $this->removePropertyValue("class", "selection"); |
| 193 | 195 | return $this->addToProperty("class", "button"); |
| 194 | 196 | } |
| 195 | 197 | |
| 196 | 198 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
| 197 | - if(isset($name)) |
|
| 198 | - $this->addInput($name); |
|
| 199 | - if($multiple) |
|
| 200 | - $this->addToProperty("class", "multiple"); |
|
| 199 | + if(isset($name)) { |
|
| 200 | + $this->addInput($name); |
|
| 201 | + } |
|
| 202 | + if($multiple) { |
|
| 203 | + $this->addToProperty("class", "multiple"); |
|
| 204 | + } |
|
| 201 | 205 | if ($selection){ |
| 202 | - if($this->propertyContains("class", "button")===false) |
|
| 203 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 206 | + if($this->propertyContains("class", "button")===false) { |
|
| 207 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 208 | + } |
|
| 204 | 209 | } |
| 205 | 210 | return $this; |
| 206 | 211 | } |
@@ -211,8 +216,9 @@ discard block |
||
| 211 | 216 | } |
| 212 | 217 | |
| 213 | 218 | public function setSelect($name=NULL,$multiple=false){ |
| 214 | - if(!isset($name)) |
|
| 215 | - $name="select-".$this->identifier; |
|
| 219 | + if(!isset($name)) { |
|
| 220 | + $name="select-".$this->identifier; |
|
| 221 | + } |
|
| 216 | 222 | $this->input=null; |
| 217 | 223 | if($multiple){ |
| 218 | 224 | $this->setProperty("multiple", true); |
@@ -248,12 +254,13 @@ discard block |
||
| 248 | 254 | $value=$this->value; |
| 249 | 255 | if(isset($this->input) && isset($value)){ |
| 250 | 256 | $this->input->setProperty("value", $value); |
| 251 | - }else{ |
|
| 257 | + } else{ |
|
| 252 | 258 | $this->setProperty("value", $value); |
| 253 | 259 | } |
| 254 | 260 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
| 255 | - if(isset($textElement)) |
|
| 256 | - $textElement->setContent($value); |
|
| 261 | + if(isset($textElement)) { |
|
| 262 | + $textElement->setContent($value); |
|
| 263 | + } |
|
| 257 | 264 | return $this; |
| 258 | 265 | } |
| 259 | 266 | |
@@ -263,8 +270,9 @@ discard block |
||
| 263 | 270 | */ |
| 264 | 271 | public function run(JsUtils $js) { |
| 265 | 272 | if($this->propertyContains("class", "simple")===false){ |
| 266 | - if(isset($this->_bsComponent)===false) |
|
| 267 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
| 273 | + if(isset($this->_bsComponent)===false) { |
|
| 274 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
| 275 | + } |
|
| 268 | 276 | $this->addEventsOnRun($js); |
| 269 | 277 | return $this->_bsComponent; |
| 270 | 278 | } |
@@ -13,53 +13,53 @@ discard block |
||
| 13 | 13 | use Ajax\semantic\html\collections\form\traits\FieldTrait; |
| 14 | 14 | |
| 15 | 15 | class HtmlDropdown extends HtmlSemDoubleElement { |
| 16 | - use FieldTrait,LabeledIconTrait { |
|
| 16 | + use FieldTrait, LabeledIconTrait { |
|
| 17 | 17 | addIcon as addIconP; |
| 18 | 18 | } |
| 19 | 19 | protected $mClass="menu"; |
| 20 | 20 | protected $mTagName="div"; |
| 21 | - protected $items=array (); |
|
| 22 | - protected $_params=array("action"=>"nothing","on"=>"hover"); |
|
| 21 | + protected $items=array(); |
|
| 22 | + protected $_params=array("action"=>"nothing", "on"=>"hover"); |
|
| 23 | 23 | protected $input; |
| 24 | 24 | protected $value; |
| 25 | 25 | protected $_associative; |
| 26 | 26 | |
| 27 | - public function __construct($identifier, $value="", $items=array(),$associative=true) { |
|
| 27 | + public function __construct($identifier, $value="", $items=array(), $associative=true) { |
|
| 28 | 28 | parent::__construct($identifier, "div"); |
| 29 | 29 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
| 30 | 30 | $this->setProperty("class", "ui dropdown"); |
| 31 | - $content=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
|
| 31 | + $content=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
| 32 | 32 | $content->setClass("text"); |
| 33 | 33 | $this->setValue($value); |
| 34 | - $content->wrap("",new HtmlIcon("", "dropdown")); |
|
| 34 | + $content->wrap("", new HtmlIcon("", "dropdown")); |
|
| 35 | 35 | $this->content=array($content); |
| 36 | 36 | $this->tagName="div"; |
| 37 | 37 | $this->_associative=$associative; |
| 38 | 38 | $this->addItems($items); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function getField(){ |
|
| 41 | + public function getField() { |
|
| 42 | 42 | return $this->input; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public function getDataField(){ |
|
| 45 | + public function getDataField() { |
|
| 46 | 46 | return $this->input; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function addItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
| 50 | - $itemO=$this->beforeAddItem($item,$value,$image,$description); |
|
| 49 | + public function addItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
| 50 | + $itemO=$this->beforeAddItem($item, $value, $image, $description); |
|
| 51 | 51 | $this->items[]=$itemO; |
| 52 | 52 | return $itemO; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
| 56 | - $this->addIconP($icon,$before,$labeled); |
|
| 55 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
| 56 | + $this->addIconP($icon, $before, $labeled); |
|
| 57 | 57 | return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter(""); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - public function addIcons($icons){ |
|
| 60 | + public function addIcons($icons) { |
|
| 61 | 61 | $count=$this->count(); |
| 62 | - for ($i=0;$i<\sizeof($icons) && $i<$count;$i++){ |
|
| 62 | + for ($i=0; $i<\sizeof($icons) && $i<$count; $i++) { |
|
| 63 | 63 | $this->getItem($i)->addIcon($icons[$i]); |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -70,26 +70,26 @@ discard block |
||
| 70 | 70 | * @param number $position |
| 71 | 71 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 72 | 72 | */ |
| 73 | - public function insertItem($item,$position=0){ |
|
| 73 | + public function insertItem($item, $position=0) { |
|
| 74 | 74 | $itemO=$this->beforeAddItem($item); |
| 75 | - $start = array_slice($this->items, 0, $position); |
|
| 76 | - $end = array_slice($this->items, $position); |
|
| 77 | - $start[] = $item; |
|
| 75 | + $start=array_slice($this->items, 0, $position); |
|
| 76 | + $end=array_slice($this->items, $position); |
|
| 77 | + $start[]=$item; |
|
| 78 | 78 | $this->items=array_merge($start, $end); |
| 79 | 79 | return $itemO; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - protected function beforeAddItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
| 82 | + protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
| 83 | 83 | $itemO=$item; |
| 84 | - if(\is_array($item)){ |
|
| 84 | + if (\is_array($item)) { |
|
| 85 | 85 | $description=JArray::getValue($item, "description", 3); |
| 86 | 86 | $value=JArray::getValue($item, "value", 1); |
| 87 | 87 | $image=JArray::getValue($item, "image", 2); |
| 88 | 88 | $item=JArray::getValue($item, "item", 0); |
| 89 | 89 | } |
| 90 | - if(!$item instanceof HtmlDropdownItem){ |
|
| 91 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
|
| 92 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 90 | + if (!$item instanceof HtmlDropdownItem) { |
|
| 91 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description); |
|
| 92 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
| 93 | 93 | $this->addToProperty("class", "vertical"); |
| 94 | 94 | } |
| 95 | 95 | return $itemO; |
@@ -102,11 +102,11 @@ discard block |
||
| 102 | 102 | $this->addItem($function($object)); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - public function addInput($name){ |
|
| 106 | - if(!isset($name)) |
|
| 105 | + public function addInput($name) { |
|
| 106 | + if (!isset($name)) |
|
| 107 | 107 | $name="input-".$this->identifier; |
| 108 | 108 | $this->setAction("activate"); |
| 109 | - $this->input=new HtmlInput($name,"hidden"); |
|
| 109 | + $this->input=new HtmlInput($name, "hidden"); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -115,15 +115,15 @@ discard block |
||
| 115 | 115 | * @param string $icon |
| 116 | 116 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 117 | 117 | */ |
| 118 | - public function addSearchInputItem($placeHolder=NULL,$icon=NULL){ |
|
| 119 | - return $this->addItem(HtmlDropdownItem::searchInput($placeHolder,$icon)); |
|
| 118 | + public function addSearchInputItem($placeHolder=NULL, $icon=NULL) { |
|
| 119 | + return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon)); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | 123 | * Adds a divider item |
| 124 | 124 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 125 | 125 | */ |
| 126 | - public function addDividerItem(){ |
|
| 126 | + public function addDividerItem() { |
|
| 127 | 127 | return $this->addItem(HtmlDropdownItem::divider()); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | * @param string $icon |
| 134 | 134 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 135 | 135 | */ |
| 136 | - public function addHeaderItem($caption=NULL,$icon=NULL){ |
|
| 137 | - return $this->addItem(HtmlDropdownItem::header($caption,$icon)); |
|
| 136 | + public function addHeaderItem($caption=NULL, $icon=NULL) { |
|
| 137 | + return $this->addItem(HtmlDropdownItem::header($caption, $icon)); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @param string $color |
| 144 | 144 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 145 | 145 | */ |
| 146 | - public function addCircularLabelItem($caption,$color){ |
|
| 146 | + public function addCircularLabelItem($caption, $color) { |
|
| 147 | 147 | return $this->addItem(HtmlDropdownItem::circular($caption, $color)); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -152,87 +152,87 @@ discard block |
||
| 152 | 152 | * @param string $image |
| 153 | 153 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 154 | 154 | */ |
| 155 | - public function addMiniAvatarImageItem($caption,$image){ |
|
| 155 | + public function addMiniAvatarImageItem($caption, $image) { |
|
| 156 | 156 | return $this->addItem(HtmlDropdownItem::avatar($caption, $image)); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - public function addItems($items){ |
|
| 160 | - if(\is_array($items) && $this->_associative){ |
|
| 161 | - foreach ($items as $k=>$v){ |
|
| 159 | + public function addItems($items) { |
|
| 160 | + if (\is_array($items) && $this->_associative) { |
|
| 161 | + foreach ($items as $k=>$v) { |
|
| 162 | 162 | $this->addItem($v)->setData($k); |
| 163 | 163 | } |
| 164 | - }else{ |
|
| 165 | - foreach ($items as $item){ |
|
| 164 | + } else { |
|
| 165 | + foreach ($items as $item) { |
|
| 166 | 166 | $this->addItem($item); |
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - public function getItem($index){ |
|
| 171 | + public function getItem($index) { |
|
| 172 | 172 | return $this->items[$index]; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | 176 | * @return int |
| 177 | 177 | */ |
| 178 | - public function count(){ |
|
| 178 | + public function count() { |
|
| 179 | 179 | return \sizeof($this->items); |
| 180 | 180 | } |
| 181 | 181 | /** |
| 182 | 182 | * @param boolean $dropdown |
| 183 | 183 | */ |
| 184 | - public function asDropdown($dropdown){ |
|
| 185 | - if($dropdown===false){ |
|
| 184 | + public function asDropdown($dropdown) { |
|
| 185 | + if ($dropdown===false) { |
|
| 186 | 186 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 187 | 187 | $dropdown="menu"; |
| 188 | - }else{ |
|
| 188 | + } else { |
|
| 189 | 189 | $dropdown="dropdown"; |
| 190 | 190 | $this->mClass="menu"; |
| 191 | 191 | } |
| 192 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
| 192 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - public function setVertical(){ |
|
| 196 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
| 195 | + public function setVertical() { |
|
| 196 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - public function setInline(){ |
|
| 200 | - return $this->addToPropertyCtrl("class", "inline",["inline"]); |
|
| 199 | + public function setInline() { |
|
| 200 | + return $this->addToPropertyCtrl("class", "inline", ["inline"]); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - public function setSimple(){ |
|
| 204 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
| 203 | + public function setSimple() { |
|
| 204 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - public function asButton($floating=false){ |
|
| 208 | - if($floating) |
|
| 207 | + public function asButton($floating=false) { |
|
| 208 | + if ($floating) |
|
| 209 | 209 | $this->addToProperty("class", "floating"); |
| 210 | 210 | $this->removePropertyValue("class", "selection"); |
| 211 | 211 | return $this->addToProperty("class", "button"); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
| 215 | - if(isset($name)) |
|
| 214 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
| 215 | + if (isset($name)) |
|
| 216 | 216 | $this->addInput($name); |
| 217 | - if($multiple) |
|
| 217 | + if ($multiple) |
|
| 218 | 218 | $this->addToProperty("class", "multiple"); |
| 219 | - if ($selection){ |
|
| 220 | - if($this->propertyContains("class", "button")===false) |
|
| 221 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 219 | + if ($selection) { |
|
| 220 | + if ($this->propertyContains("class", "button")===false) |
|
| 221 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
| 222 | 222 | } |
| 223 | 223 | return $this; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - public function asSearch($name=NULL,$multiple=false,$selection=true){ |
|
| 227 | - $this->asSelect($name,$multiple,$selection); |
|
| 226 | + public function asSearch($name=NULL, $multiple=false, $selection=true) { |
|
| 227 | + $this->asSelect($name, $multiple, $selection); |
|
| 228 | 228 | return $this->addToProperty("class", "search"); |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - public function setSelect($name=NULL,$multiple=false){ |
|
| 232 | - if(!isset($name)) |
|
| 231 | + public function setSelect($name=NULL, $multiple=false) { |
|
| 232 | + if (!isset($name)) |
|
| 233 | 233 | $name="select-".$this->identifier; |
| 234 | 234 | $this->input=null; |
| 235 | - if($multiple){ |
|
| 235 | + if ($multiple) { |
|
| 236 | 236 | $this->setProperty("multiple", true); |
| 237 | 237 | $this->addToProperty("class", "multiple"); |
| 238 | 238 | } |
@@ -240,37 +240,37 @@ discard block |
||
| 240 | 240 | $this->tagName="select"; |
| 241 | 241 | $this->setProperty("name", $name); |
| 242 | 242 | $this->content=null; |
| 243 | - foreach ($this->items as $item){ |
|
| 243 | + foreach ($this->items as $item) { |
|
| 244 | 244 | $item->asOption(); |
| 245 | 245 | } |
| 246 | 246 | return $this; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - public function asSubmenu($pointing=NULL){ |
|
| 249 | + public function asSubmenu($pointing=NULL) { |
|
| 250 | 250 | $this->setClass("ui dropdown link item"); |
| 251 | - if(isset($pointing)){ |
|
| 251 | + if (isset($pointing)) { |
|
| 252 | 252 | $this->setPointing($pointing); |
| 253 | 253 | } |
| 254 | 254 | return $this; |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - public function setPointing($value=Direction::NONE){ |
|
| 258 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
| 257 | + public function setPointing($value=Direction::NONE) { |
|
| 258 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - public function setValue($value){ |
|
| 261 | + public function setValue($value) { |
|
| 262 | 262 | $this->value=$value; |
| 263 | 263 | return $this; |
| 264 | 264 | } |
| 265 | - private function applyValue(){ |
|
| 265 | + private function applyValue() { |
|
| 266 | 266 | $value=$this->value; |
| 267 | - if(isset($this->input) && isset($value)){ |
|
| 267 | + if (isset($this->input) && isset($value)) { |
|
| 268 | 268 | $this->input->setProperty("value", $value); |
| 269 | - }else{ |
|
| 269 | + } else { |
|
| 270 | 270 | $this->setProperty("value", $value); |
| 271 | 271 | } |
| 272 | 272 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
| 273 | - if(isset($textElement)) |
|
| 273 | + if (isset($textElement)) |
|
| 274 | 274 | $textElement->setContent($value); |
| 275 | 275 | return $this; |
| 276 | 276 | } |
@@ -280,29 +280,29 @@ discard block |
||
| 280 | 280 | * @see BaseHtml::run() |
| 281 | 281 | */ |
| 282 | 282 | public function run(JsUtils $js) { |
| 283 | - if($this->propertyContains("class", "simple")===false){ |
|
| 284 | - if(isset($this->_bsComponent)===false) |
|
| 285 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
| 283 | + if ($this->propertyContains("class", "simple")===false) { |
|
| 284 | + if (isset($this->_bsComponent)===false) |
|
| 285 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
| 286 | 286 | $this->addEventsOnRun($js); |
| 287 | 287 | return $this->_bsComponent; |
| 288 | 288 | } |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - public function setCompact(){ |
|
| 291 | + public function setCompact() { |
|
| 292 | 292 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - public function setAction($action){ |
|
| 295 | + public function setAction($action) { |
|
| 296 | 296 | $this->_params["action"]=$action; |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | - public function setFullTextSearch($value){ |
|
| 299 | + public function setFullTextSearch($value) { |
|
| 300 | 300 | $this->_params["fullTextSearch"]=$value; |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 304 | 304 | $this->applyValue(); |
| 305 | - return parent::compile($js,$view); |
|
| 305 | + return parent::compile($js, $view); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | public function getInput() { |
@@ -24,6 +24,9 @@ discard block |
||
| 24 | 24 | protected $value; |
| 25 | 25 | protected $_associative; |
| 26 | 26 | |
| 27 | + /** |
|
| 28 | + * @param string $identifier |
|
| 29 | + */ |
|
| 27 | 30 | public function __construct($identifier, $value="", $items=array(),$associative=true) { |
| 28 | 31 | parent::__construct($identifier, "div"); |
| 29 | 32 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
@@ -67,7 +70,7 @@ discard block |
||
| 67 | 70 | /** |
| 68 | 71 | * Insert an item at a position |
| 69 | 72 | * @param mixed $item |
| 70 | - * @param number $position |
|
| 73 | + * @param integer $position |
|
| 71 | 74 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 72 | 75 | */ |
| 73 | 76 | public function insertItem($item,$position=0){ |
@@ -168,6 +171,9 @@ discard block |
||
| 168 | 171 | } |
| 169 | 172 | } |
| 170 | 173 | |
| 174 | + /** |
|
| 175 | + * @param integer $index |
|
| 176 | + */ |
|
| 171 | 177 | public function getItem($index){ |
| 172 | 178 | return $this->items[$index]; |
| 173 | 179 | } |
@@ -258,6 +264,9 @@ discard block |
||
| 258 | 264 | return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
| 259 | 265 | } |
| 260 | 266 | |
| 267 | + /** |
|
| 268 | + * @param string $value |
|
| 269 | + */ |
|
| 261 | 270 | public function setValue($value){ |
| 262 | 271 | $this->value=$value; |
| 263 | 272 | return $this; |
@@ -292,6 +301,9 @@ discard block |
||
| 292 | 301 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
| 293 | 302 | } |
| 294 | 303 | |
| 304 | + /** |
|
| 305 | + * @param string $action |
|
| 306 | + */ |
|
| 295 | 307 | public function setAction($action){ |
| 296 | 308 | $this->_params["action"]=$action; |
| 297 | 309 | } |
@@ -12,34 +12,34 @@ discard block |
||
| 12 | 12 | use Ajax\semantic\html\base\traits\MenuItemTrait; |
| 13 | 13 | |
| 14 | 14 | class HtmlDropdownItem extends HtmlSemDoubleElement { |
| 15 | - use IconTrait,MenuItemTrait; |
|
| 16 | - public function __construct($identifier, $content="",$value=NULL,$image=NULL,$description=NULL) { |
|
| 15 | + use IconTrait, MenuItemTrait; |
|
| 16 | + public function __construct($identifier, $content="", $value=NULL, $image=NULL, $description=NULL) { |
|
| 17 | 17 | parent::__construct($identifier, "a"); |
| 18 | 18 | $this->setClass("item"); |
| 19 | 19 | $this->setContent($content); |
| 20 | - if($value!==NULL) |
|
| 20 | + if ($value!==NULL) |
|
| 21 | 21 | $this->setData($value); |
| 22 | - if($image!==NULL) |
|
| 22 | + if ($image!==NULL) |
|
| 23 | 23 | $this->asMiniAvatar($image); |
| 24 | - if($description!==NULL) |
|
| 24 | + if ($description!==NULL) |
|
| 25 | 25 | $this->setDescription($description); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function setDescription($description){ |
|
| 29 | - $descO=new HtmlDoubleElement("desc-".$this->identifier,"span"); |
|
| 28 | + public function setDescription($description) { |
|
| 29 | + $descO=new HtmlDoubleElement("desc-".$this->identifier, "span"); |
|
| 30 | 30 | $descO->setClass("description"); |
| 31 | 31 | $descO->setContent($description); |
| 32 | - return $this->addContent($descO,true); |
|
| 32 | + return $this->addContent($descO, true); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function setData($value){ |
|
| 35 | + public function setData($value) { |
|
| 36 | 36 | $this->setProperty("data-value", $value); |
| 37 | 37 | return $this; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function asOption(){ |
|
| 40 | + public function asOption() { |
|
| 41 | 41 | $this->tagName="option"; |
| 42 | - if($this->getProperty("data-value")!==null) |
|
| 42 | + if ($this->getProperty("data-value")!==null) |
|
| 43 | 43 | $this->setProperty("value", $this->getProperty("data-value")); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | * @param string $image the image src |
| 48 | 48 | * @return \Ajax\common\html\html5\HtmlImg |
| 49 | 49 | */ |
| 50 | - public function asMiniAvatar($image){ |
|
| 50 | + public function asMiniAvatar($image) { |
|
| 51 | 51 | $this->tagName="div"; |
| 52 | - $img=new HtmlImg("image-".$this->identifier,$image); |
|
| 52 | + $img=new HtmlImg("image-".$this->identifier, $image); |
|
| 53 | 53 | $img->setClass("ui mini avatar image"); |
| 54 | - $this->addContent($img,true); |
|
| 54 | + $this->addContent($img, true); |
|
| 55 | 55 | return $this; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | * @param string $icon |
| 61 | 61 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 62 | 62 | */ |
| 63 | - public function asIcon($caption,$icon){ |
|
| 63 | + public function asIcon($caption, $icon) { |
|
| 64 | 64 | $this->setContent($caption); |
| 65 | - $this->addContent(new HtmlIcon("", $icon),true); |
|
| 65 | + $this->addContent(new HtmlIcon("", $icon), true); |
|
| 66 | 66 | return $this; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -71,23 +71,23 @@ discard block |
||
| 71 | 71 | * @param string $color |
| 72 | 72 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 73 | 73 | */ |
| 74 | - public function asCircularLabel($caption,$color){ |
|
| 74 | + public function asCircularLabel($caption, $color) { |
|
| 75 | 75 | $this->setContent($caption); |
| 76 | 76 | $lbl=new HtmlLabel(""); |
| 77 | 77 | $lbl->setCircular()->setColor($color)->setEmpty(); |
| 78 | - $this->addContent($lbl,true); |
|
| 78 | + $this->addContent($lbl, true); |
|
| 79 | 79 | return $this; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | public function addMenuItem($items) { |
| 85 | - $menu=new HtmlMenu("menu-" . $this->identifier, $items); |
|
| 85 | + $menu=new HtmlMenu("menu-".$this->identifier, $items); |
|
| 86 | 86 | $content=$this->content; |
| 87 | 87 | $this->setTagName("div"); |
| 88 | 88 | $this->setProperty("class", "item"); |
| 89 | 89 | $icon=new HtmlIcon("", "dropdown"); |
| 90 | - $this->content=[$icon,new HtmlSemDoubleElement("","span","text",$content),$menu]; |
|
| 90 | + $this->content=[$icon, new HtmlSemDoubleElement("", "span", "text", $content), $menu]; |
|
| 91 | 91 | return $menu; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -96,14 +96,14 @@ discard block |
||
| 96 | 96 | * @param string $icon |
| 97 | 97 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 98 | 98 | */ |
| 99 | - public static function searchInput($placeholder=NULL,$icon=NULL){ |
|
| 100 | - return (new HtmlDropdownItem(""))->asSearchInput($placeholder,$icon); |
|
| 99 | + public static function searchInput($placeholder=NULL, $icon=NULL) { |
|
| 100 | + return (new HtmlDropdownItem(""))->asSearchInput($placeholder, $icon); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 105 | 105 | */ |
| 106 | - public static function divider(){ |
|
| 106 | + public static function divider() { |
|
| 107 | 107 | return (new HtmlDropdownItem(""))->asDivider(); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | * @param string $icon |
| 113 | 113 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 114 | 114 | */ |
| 115 | - public static function header($caption=NULL,$icon=NULL){ |
|
| 116 | - return (new HtmlDropdownItem(""))->asHeader($caption,$icon); |
|
| 115 | + public static function header($caption=NULL, $icon=NULL) { |
|
| 116 | + return (new HtmlDropdownItem(""))->asHeader($caption, $icon); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | * @param string $color |
| 122 | 122 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 123 | 123 | */ |
| 124 | - public static function circular($caption,$color){ |
|
| 125 | - return (new HtmlDropdownItem(""))->asCircularLabel($caption,$color); |
|
| 124 | + public static function circular($caption, $color) { |
|
| 125 | + return (new HtmlDropdownItem(""))->asCircularLabel($caption, $color); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | * @param string $icon |
| 131 | 131 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 132 | 132 | */ |
| 133 | - public static function icon($caption,$icon){ |
|
| 134 | - return (new HtmlDropdownItem(""))->asIcon($caption,$icon); |
|
| 133 | + public static function icon($caption, $icon) { |
|
| 134 | + return (new HtmlDropdownItem(""))->asIcon($caption, $icon); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @param unknown $image |
| 140 | 140 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 141 | 141 | */ |
| 142 | - public static function avatar($caption,$image){ |
|
| 143 | - return (new HtmlDropdownItem("",$caption))->asMiniAvatar($image); |
|
| 142 | + public static function avatar($caption, $image) { |
|
| 143 | + return (new HtmlDropdownItem("", $caption))->asMiniAvatar($image); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | \ No newline at end of file |
@@ -17,12 +17,15 @@ discard block |
||
| 17 | 17 | parent::__construct($identifier, "a"); |
| 18 | 18 | $this->setClass("item"); |
| 19 | 19 | $this->setContent($content); |
| 20 | - if($value!==NULL) |
|
| 21 | - $this->setData($value); |
|
| 22 | - if($image!==NULL) |
|
| 23 | - $this->asMiniAvatar($image); |
|
| 24 | - if($description!==NULL) |
|
| 25 | - $this->setDescription($description); |
|
| 20 | + if($value!==NULL) { |
|
| 21 | + $this->setData($value); |
|
| 22 | + } |
|
| 23 | + if($image!==NULL) { |
|
| 24 | + $this->asMiniAvatar($image); |
|
| 25 | + } |
|
| 26 | + if($description!==NULL) { |
|
| 27 | + $this->setDescription($description); |
|
| 28 | + } |
|
| 26 | 29 | } |
| 27 | 30 | |
| 28 | 31 | public function setDescription($description){ |
@@ -39,8 +42,9 @@ discard block |
||
| 39 | 42 | |
| 40 | 43 | public function asOption(){ |
| 41 | 44 | $this->tagName="option"; |
| 42 | - if($this->getProperty("data-value")!==null) |
|
| 43 | - $this->setProperty("value", $this->getProperty("data-value")); |
|
| 45 | + if($this->getProperty("data-value")!==null) { |
|
| 46 | + $this->setProperty("value", $this->getProperty("data-value")); |
|
| 47 | + } |
|
| 44 | 48 | } |
| 45 | 49 | |
| 46 | 50 | /** |
@@ -51,8 +51,9 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function getSideContent($index){ |
| 53 | 53 | $item= $this->getItem($index); |
| 54 | - if(isset($item)) |
|
| 55 | - return $item->getContent(); |
|
| 54 | + if(isset($item)) { |
|
| 55 | + return $item->getContent(); |
|
| 56 | + } |
|
| 56 | 57 | return null; |
| 57 | 58 | } |
| 58 | 59 | |
@@ -85,15 +86,17 @@ discard block |
||
| 85 | 86 | * @see BaseHtml::run() |
| 86 | 87 | */ |
| 87 | 88 | public function run(JsUtils $js) { |
| 88 | - if (isset($this->_bsComponent) === false) |
|
| 89 | - $this->_bsComponent=$js->semantic()->shape("#" . $this->identifier, $this->_params); |
|
| 89 | + if (isset($this->_bsComponent) === false) { |
|
| 90 | + $this->_bsComponent=$js->semantic()->shape("#" . $this->identifier, $this->_params); |
|
| 91 | + } |
|
| 90 | 92 | $this->addEventsOnRun($js); |
| 91 | 93 | return $this->_bsComponent; |
| 92 | 94 | } |
| 93 | 95 | |
| 94 | 96 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 95 | - if($this->_autoActive) |
|
| 96 | - $this->setActiveSide(0); |
|
| 97 | + if($this->_autoActive) { |
|
| 98 | + $this->setActiveSide(0); |
|
| 99 | + } |
|
| 97 | 100 | return parent::compile($js,$view); |
| 98 | 101 | } |
| 99 | 102 | } |
| 100 | 103 | \ No newline at end of file |
@@ -8,13 +8,13 @@ discard block |
||
| 8 | 8 | use Ajax\common\html\BaseHtml; |
| 9 | 9 | |
| 10 | 10 | |
| 11 | -class HtmlShape extends HtmlSemCollection{ |
|
| 11 | +class HtmlShape extends HtmlSemCollection { |
|
| 12 | 12 | |
| 13 | 13 | protected $_params=array(); |
| 14 | 14 | protected $_autoActive=true; |
| 15 | 15 | |
| 16 | - public function __construct( $identifier, $sides){ |
|
| 17 | - parent::__construct( $identifier, "div", "ui shape"); |
|
| 16 | + public function __construct($identifier, $sides) { |
|
| 17 | + parent::__construct($identifier, "div", "ui shape"); |
|
| 18 | 18 | $this->_template="<%tagName% id='%identifier%' %properties%><div class='sides'>%wrapContentBefore%%content%%wrapContentAfter%</div></%tagName%>"; |
| 19 | 19 | $this->addItems($sides); |
| 20 | 20 | } |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | * {@inheritDoc} |
| 24 | 24 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 25 | 25 | */ |
| 26 | - protected function createItem($value){ |
|
| 27 | - if(\is_object($value)===false){ |
|
| 28 | - $value=new HtmlSemDoubleElement("","div","content",$value); |
|
| 26 | + protected function createItem($value) { |
|
| 27 | + if (\is_object($value)===false) { |
|
| 28 | + $value=new HtmlSemDoubleElement("", "div", "content", $value); |
|
| 29 | 29 | } |
| 30 | 30 | return new HtmlShapeItem("side-".$this->identifier."-".$this->count(), $value); |
| 31 | 31 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * {@inheritDoc} |
| 35 | 35 | * @see \Ajax\common\html\HtmlCollection::createCondition() |
| 36 | 36 | */ |
| 37 | - protected function createCondition($value){ |
|
| 37 | + protected function createCondition($value) { |
|
| 38 | 38 | return ($value instanceof HtmlShapeItem)===false; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @param int $index |
| 43 | 43 | * @return \Ajax\semantic\html\content\HtmlShapeItem |
| 44 | 44 | */ |
| 45 | - public function getSide($index){ |
|
| 45 | + public function getSide($index) { |
|
| 46 | 46 | return $this->getItem($index); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -50,96 +50,96 @@ discard block |
||
| 50 | 50 | * @param int $index |
| 51 | 51 | * @return mixed|NULL |
| 52 | 52 | */ |
| 53 | - public function getSideContent($index){ |
|
| 54 | - $item= $this->getItem($index); |
|
| 55 | - if(isset($item)) |
|
| 53 | + public function getSideContent($index) { |
|
| 54 | + $item=$this->getItem($index); |
|
| 55 | + if (isset($item)) |
|
| 56 | 56 | return $item->getContent(); |
| 57 | 57 | return null; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - public function jsDo($action){ |
|
| 60 | + public function jsDo($action) { |
|
| 61 | 61 | return "$('#".$this->identifier."').shape('".$action."');"; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public function jsFlipLeft(){ |
|
| 64 | + public function jsFlipLeft() { |
|
| 65 | 65 | return $this->jsDo("flip left"); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - public function jsFlipRight(){ |
|
| 68 | + public function jsFlipRight() { |
|
| 69 | 69 | return $this->jsDo("flip right"); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public function jsFlipUp(){ |
|
| 72 | + public function jsFlipUp() { |
|
| 73 | 73 | return $this->jsDo("flip up"); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - public function jsFlipDown(){ |
|
| 76 | + public function jsFlipDown() { |
|
| 77 | 77 | return $this->jsDo("flip down"); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function jsFlipOver(){ |
|
| 80 | + public function jsFlipOver() { |
|
| 81 | 81 | return $this->jsDo("flip over"); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - public function jsFlipBack(){ |
|
| 84 | + public function jsFlipBack() { |
|
| 85 | 85 | return $this->jsDo("flip back"); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - private function doActionOn($element,$event,$what){ |
|
| 89 | - if($element instanceof BaseHtml){ |
|
| 90 | - return $element->on($event, $what,true,true); |
|
| 88 | + private function doActionOn($element, $event, $what) { |
|
| 89 | + if ($element instanceof BaseHtml) { |
|
| 90 | + return $element->on($event, $what, true, true); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - public function flipLeftOn($element,$event){ |
|
| 94 | + public function flipLeftOn($element, $event) { |
|
| 95 | 95 | return $this->doActionOn($element, $event, $this->jsFlipLeft()); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - public function flipRightOn($element,$event){ |
|
| 98 | + public function flipRightOn($element, $event) { |
|
| 99 | 99 | return $this->doActionOn($element, $event, $this->jsFlipRight()); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public function flipUpOn($element,$event){ |
|
| 102 | + public function flipUpOn($element, $event) { |
|
| 103 | 103 | return $this->doActionOn($element, $event, $this->jsFlipUp()); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - public function flipDownOn($element,$event){ |
|
| 106 | + public function flipDownOn($element, $event) { |
|
| 107 | 107 | return $this->doActionOn($element, $event, $this->jsFlipDown()); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - public function flipBackOn($element,$event){ |
|
| 110 | + public function flipBackOn($element, $event) { |
|
| 111 | 111 | return $this->doActionOn($element, $event, $this->jsFlipBack()); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - public function flipOverOn($element,$event){ |
|
| 114 | + public function flipOverOn($element, $event) { |
|
| 115 | 115 | return $this->doActionOn($element, $event, $this->jsFlipOver()); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - public function setActiveSide($index){ |
|
| 118 | + public function setActiveSide($index) { |
|
| 119 | 119 | $side=$this->getSide($index); |
| 120 | - if(isset($side)){ |
|
| 120 | + if (isset($side)) { |
|
| 121 | 121 | $side->setActive(true); |
| 122 | 122 | } |
| 123 | 123 | return $this; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - public function asCube(){ |
|
| 126 | + public function asCube() { |
|
| 127 | 127 | return $this->addToPropertyCtrl("class", "cube", ["cube"]); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - public function asText(){ |
|
| 130 | + public function asText() { |
|
| 131 | 131 | return $this->addToPropertyCtrl("class", "text", ["text"]); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - public function setWidth($width="initial"){ |
|
| 134 | + public function setWidth($width="initial") { |
|
| 135 | 135 | $this->_params["width"]=$width; |
| 136 | 136 | } |
| 137 | - public function onChange($jsCode){ |
|
| 138 | - return $this->_params["onChange"]="%function(){" . $jsCode . "}%"; |
|
| 137 | + public function onChange($jsCode) { |
|
| 138 | + return $this->_params["onChange"]="%function(){".$jsCode."}%"; |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - public function beforeChange($jsCode){ |
|
| 142 | - return $this->_params["beforeChange"]="%function(){" . $jsCode . "}%"; |
|
| 141 | + public function beforeChange($jsCode) { |
|
| 142 | + return $this->_params["beforeChange"]="%function(){".$jsCode."}%"; |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /* |
@@ -147,15 +147,15 @@ discard block |
||
| 147 | 147 | * @see BaseHtml::run() |
| 148 | 148 | */ |
| 149 | 149 | public function run(JsUtils $js) { |
| 150 | - if (isset($this->_bsComponent) === false) |
|
| 151 | - $this->_bsComponent=$js->semantic()->shape("#" . $this->identifier, $this->_params); |
|
| 150 | + if (isset($this->_bsComponent)===false) |
|
| 151 | + $this->_bsComponent=$js->semantic()->shape("#".$this->identifier, $this->_params); |
|
| 152 | 152 | $this->addEventsOnRun($js); |
| 153 | 153 | return $this->_bsComponent; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 157 | - if($this->_autoActive) |
|
| 157 | + if ($this->_autoActive) |
|
| 158 | 158 | $this->setActiveSide(0); |
| 159 | - return parent::compile($js,$view); |
|
| 159 | + return parent::compile($js, $view); |
|
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | \ No newline at end of file |
@@ -15,33 +15,33 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | public function __construct($identifier, $elements=array(), $asIcons=false) { |
| 17 | 17 | parent::__construct($identifier, "div", "ui buttons"); |
| 18 | - if ($asIcons === true) |
|
| 18 | + if ($asIcons===true) |
|
| 19 | 19 | $this->asIcons(); |
| 20 | 20 | $this->addElements($elements, $asIcons); |
| 21 | 21 | } |
| 22 | - protected function createItem($value){ |
|
| 23 | - return new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content), $value); |
|
| 22 | + protected function createItem($value) { |
|
| 23 | + return new HtmlButton("button-".$this->identifier."-".\sizeof($this->content), $value); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | public function addElement($element, $asIcon=false) { |
| 28 | 28 | $item=$this->addItem($element); |
| 29 | - if($asIcon) |
|
| 29 | + if ($asIcon) |
|
| 30 | 30 | $item->asIcon($element); |
| 31 | 31 | return $item; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public function addElements($elements, $asIcons=false) { |
| 35 | - foreach ( $elements as $element ) { |
|
| 35 | + foreach ($elements as $element) { |
|
| 36 | 36 | $this->addElement($element, $asIcons); |
| 37 | 37 | } |
| 38 | 38 | return $this; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public function insertOr($aferIndex=0, $or="or") { |
| 42 | - $orElement=new HtmlSemDoubleElement("or-" . $this->identifier, "div", "or"); |
|
| 42 | + $orElement=new HtmlSemDoubleElement("or-".$this->identifier, "div", "or"); |
|
| 43 | 43 | $orElement->setProperty("data-text", $or); |
| 44 | - array_splice($this->content, $aferIndex + 1, 0, array ($orElement )); |
|
| 44 | + array_splice($this->content, $aferIndex+1, 0, array($orElement)); |
|
| 45 | 45 | return $this; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public function asIcons() { |
| 57 | - foreach ( $this->content as $item ) { |
|
| 58 | - if($item instanceof HtmlButton) |
|
| 57 | + foreach ($this->content as $item) { |
|
| 58 | + if ($item instanceof HtmlButton) |
|
| 59 | 59 | $item->asIcon($item->getContent()); |
| 60 | 60 | } |
| 61 | 61 | return $this->addToProperty("class", "icons"); |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
| 89 | 89 | */ |
| 90 | 90 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 91 | - foreach ( $this->content as $element ) { |
|
| 91 | + foreach ($this->content as $element) { |
|
| 92 | 92 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
| 93 | 93 | } |
| 94 | 94 | return $this; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | public function addClasses($classes=array()) { |
| 102 | 102 | $i=0; |
| 103 | - foreach ( $this->content as $button ) { |
|
| 103 | + foreach ($this->content as $button) { |
|
| 104 | 104 | $button->addToProperty("class", $classes[$i++]); |
| 105 | 105 | } |
| 106 | 106 | return $this; |
@@ -15,8 +15,9 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | public function __construct($identifier, $elements=array(), $asIcons=false) { |
| 17 | 17 | parent::__construct($identifier, "div", "ui buttons"); |
| 18 | - if ($asIcons === true) |
|
| 19 | - $this->asIcons(); |
|
| 18 | + if ($asIcons === true) { |
|
| 19 | + $this->asIcons(); |
|
| 20 | + } |
|
| 20 | 21 | $this->addElements($elements, $asIcons); |
| 21 | 22 | } |
| 22 | 23 | protected function createItem($value){ |
@@ -26,8 +27,9 @@ discard block |
||
| 26 | 27 | |
| 27 | 28 | public function addElement($element, $asIcon=false) { |
| 28 | 29 | $item=$this->addItem($element); |
| 29 | - if($asIcon) |
|
| 30 | - $item->asIcon($element); |
|
| 30 | + if($asIcon) { |
|
| 31 | + $item->asIcon($element); |
|
| 32 | + } |
|
| 31 | 33 | return $item; |
| 32 | 34 | } |
| 33 | 35 | |
@@ -55,8 +57,9 @@ discard block |
||
| 55 | 57 | |
| 56 | 58 | public function asIcons() { |
| 57 | 59 | foreach ( $this->content as $item ) { |
| 58 | - if($item instanceof HtmlButton) |
|
| 59 | - $item->asIcon($item->getContent()); |
|
| 60 | + if($item instanceof HtmlButton) { |
|
| 61 | + $item->asIcon($item->getContent()); |
|
| 62 | + } |
|
| 60 | 63 | } |
| 61 | 64 | return $this->addToProperty("class", "icons"); |
| 62 | 65 | } |
@@ -13,6 +13,9 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class HtmlButtonGroups extends HtmlSemCollection { |
| 15 | 15 | |
| 16 | + /** |
|
| 17 | + * @param string $identifier |
|
| 18 | + */ |
|
| 16 | 19 | public function __construct($identifier, $elements=array(), $asIcons=false) { |
| 17 | 20 | parent::__construct($identifier, "div", "ui buttons"); |
| 18 | 21 | if ($asIcons === true) |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * @return \Ajax\semantic\html\elements\HtmlDivider |
| 23 | 23 | */ |
| 24 | 24 | public function setVertical() { |
| 25 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical","horizontal" )); |
|
| 25 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical", "horizontal")); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @return \Ajax\semantic\html\elements\HtmlDivider |
| 31 | 31 | */ |
| 32 | 32 | public function setHorizontal() { |
| 33 | - return $this->addToPropertyCtrl("class", "horizontal", array ("vertical","horizontal" )); |
|
| 33 | + return $this->addToPropertyCtrl("class", "horizontal", array("vertical", "horizontal")); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | return $this->addToProperty("class", "inverted"); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - public function setIgnored(){ |
|
| 68 | + public function setIgnored() { |
|
| 69 | 69 | return $this->addToProperty("class", "ignored"); |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | \ No newline at end of file |
@@ -5,13 +5,13 @@ |
||
| 5 | 5 | |
| 6 | 6 | class HtmlShapeItem extends HtmlSemDoubleElement { |
| 7 | 7 | public function __construct($identifier, $content) { |
| 8 | - parent::__construct($identifier,"div","side",$content); |
|
| 8 | + parent::__construct($identifier, "div", "side", $content); |
|
| 9 | 9 | } |
| 10 | 10 | |
| 11 | - public function setActive($value=true){ |
|
| 12 | - if($value){ |
|
| 11 | + public function setActive($value=true) { |
|
| 12 | + if ($value) { |
|
| 13 | 13 | $this->addToPropertyCtrl("class", "active", ["active"]); |
| 14 | - }else{ |
|
| 14 | + } else { |
|
| 15 | 15 | $this->removePropertyValue("class", "active"); |
| 16 | 16 | } |
| 17 | 17 | return $this; |
@@ -4,6 +4,10 @@ |
||
| 4 | 4 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
| 5 | 5 | |
| 6 | 6 | class HtmlShapeItem extends HtmlSemDoubleElement { |
| 7 | + |
|
| 8 | + /** |
|
| 9 | + * @param string $identifier |
|
| 10 | + */ |
|
| 7 | 11 | public function __construct($identifier, $content) { |
| 8 | 12 | parent::__construct($identifier,"div","side",$content); |
| 9 | 13 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | public function setActive($value=true){ |
| 12 | 12 | if($value){ |
| 13 | 13 | $this->addToPropertyCtrl("class", "active", ["active"]); |
| 14 | - }else{ |
|
| 14 | + } else{ |
|
| 15 | 15 | $this->removePropertyValue("class", "active"); |
| 16 | 16 | } |
| 17 | 17 | return $this; |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | * @version 1.001 |
| 11 | 11 | */ |
| 12 | 12 | abstract class BaseComponent { |
| 13 | - public $jquery_code_for_compile=array (); |
|
| 14 | - protected $params=array (); |
|
| 13 | + public $jquery_code_for_compile=array(); |
|
| 14 | + protected $params=array(); |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | public function setParams($params) { |
| 71 | - foreach ( $params as $k => $v ) { |
|
| 71 | + foreach ($params as $k => $v) { |
|
| 72 | 72 | $method="set".ucfirst($k); |
| 73 | 73 | if (method_exists($this, $method)) |
| 74 | 74 | $this->$method($v); |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | return $this; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - public function addParams($params){ |
|
| 85 | - foreach ($params as $k=>$v){ |
|
| 84 | + public function addParams($params) { |
|
| 85 | + foreach ($params as $k=>$v) { |
|
| 86 | 86 | $this->setParam($k, $v); |
| 87 | 87 | } |
| 88 | 88 | return $this; |
@@ -39,8 +39,9 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | public function getParam($key) { |
| 41 | 41 | $value=null; |
| 42 | - if (array_key_exists($key, $this->params)) |
|
| 43 | - $value=$this->params [$key]; |
|
| 42 | + if (array_key_exists($key, $this->params)) { |
|
| 43 | + $value=$this->params [$key]; |
|
| 44 | + } |
|
| 44 | 45 | return $value; |
| 45 | 46 | } |
| 46 | 47 | |
@@ -49,16 +50,18 @@ discard block |
||
| 49 | 50 | } |
| 50 | 51 | |
| 51 | 52 | public function compile(JsUtils $js=NULL) { |
| 52 | - if ($js==NULL) |
|
| 53 | - $js=$this->js; |
|
| 53 | + if ($js==NULL) { |
|
| 54 | + $js=$this->js; |
|
| 55 | + } |
|
| 54 | 56 | $script=$this->getScript(); |
| 55 | 57 | $js->addToCompile($script); |
| 56 | 58 | } |
| 57 | 59 | |
| 58 | 60 | protected function setParamCtrl($key, $value, $typeCtrl) { |
| 59 | 61 | if (\is_array($typeCtrl)) { |
| 60 | - if (array_search($value, $typeCtrl)===false) |
|
| 61 | - throw new \Exception("La valeur passée a propriété `".$key."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
| 62 | + if (array_search($value, $typeCtrl)===false) { |
|
| 63 | + throw new \Exception("La valeur passée a propriété `".$key."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
| 64 | + } |
|
| 62 | 65 | } else { |
| 63 | 66 | if (!$typeCtrl($value)) { |
| 64 | 67 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key); |
@@ -70,9 +73,9 @@ discard block |
||
| 70 | 73 | public function setParams($params) { |
| 71 | 74 | foreach ( $params as $k => $v ) { |
| 72 | 75 | $method="set".ucfirst($k); |
| 73 | - if (method_exists($this, $method)) |
|
| 74 | - $this->$method($v); |
|
| 75 | - else { |
|
| 76 | + if (method_exists($this, $method)) { |
|
| 77 | + $this->$method($v); |
|
| 78 | + } else { |
|
| 76 | 79 | $this->setParam($k, $v); |
| 77 | 80 | trigger_error("`".$k."` property n'existe pas", E_USER_NOTICE); |
| 78 | 81 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | * @param int $colCount |
| 19 | 19 | * @return HtmlTable |
| 20 | 20 | */ |
| 21 | - public function htmlTable($identifier, $rowCount, $colCount){ |
|
| 21 | + public function htmlTable($identifier, $rowCount, $colCount) { |
|
| 22 | 22 | return $this->addHtmlComponent(new HtmlTable($identifier, $rowCount, $colCount)); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | * @param $styles string|array|NULL |
| 30 | 30 | * @return HtmlMessage |
| 31 | 31 | */ |
| 32 | - public function htmlMessage($identifier, $content="",$styles=NULL) { |
|
| 33 | - $msg= $this->addHtmlComponent(new HtmlMessage($identifier, $content)); |
|
| 34 | - if(isset($msg)) |
|
| 32 | + public function htmlMessage($identifier, $content="", $styles=NULL) { |
|
| 33 | + $msg=$this->addHtmlComponent(new HtmlMessage($identifier, $content)); |
|
| 34 | + if (isset($msg)) |
|
| 35 | 35 | $msg->setStyle($styles); |
| 36 | 36 | return $msg; |
| 37 | 37 | } |
@@ -31,8 +31,9 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public function htmlMessage($identifier, $content="",$styles=NULL) { |
| 33 | 33 | $msg= $this->addHtmlComponent(new HtmlMessage($identifier, $content)); |
| 34 | - if(isset($msg)) |
|
| 35 | - $msg->setStyle($styles); |
|
| 34 | + if(isset($msg)) { |
|
| 35 | + $msg->setStyle($styles); |
|
| 36 | + } |
|
| 36 | 37 | return $msg; |
| 37 | 38 | } |
| 38 | 39 | |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | * @param string|array $params |
| 128 | 128 | * @return Modal |
| 129 | 129 | */ |
| 130 | - public function modal($attachTo=NULL, $params=NULL,$paramsParts=NULL) { |
|
| 131 | - $result= $this->addComponent(new Modal($this->js), $attachTo, $params); |
|
| 130 | + public function modal($attachTo=NULL, $params=NULL, $paramsParts=NULL) { |
|
| 131 | + $result=$this->addComponent(new Modal($this->js), $attachTo, $params); |
|
| 132 | 132 | $result->setParamParts($paramsParts); |
| 133 | 133 | return $result; |
| 134 | 134 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @return Tab |
| 140 | 140 | */ |
| 141 | 141 | public function tab($attachTo=NULL, $params=NULL) { |
| 142 | - $result= $this->addComponent(new Tab($this->js), $attachTo, $params); |
|
| 142 | + $result=$this->addComponent(new Tab($this->js), $attachTo, $params); |
|
| 143 | 143 | return $result; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * @return Shape |
| 150 | 150 | */ |
| 151 | 151 | public function shape($attachTo=NULL, $params=NULL) { |
| 152 | - $result= $this->addComponent(new Shape($this->js), $attachTo, $params); |
|
| 152 | + $result=$this->addComponent(new Shape($this->js), $attachTo, $params); |
|
| 153 | 153 | return $result; |
| 154 | 154 | } |
| 155 | 155 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @return Form |
| 160 | 160 | */ |
| 161 | 161 | public function form($attachTo=NULL, $params=NULL) { |
| 162 | - $result= $this->addComponent(new Form($this->js), $attachTo, $params); |
|
| 162 | + $result=$this->addComponent(new Form($this->js), $attachTo, $params); |
|
| 163 | 163 | return $result; |
| 164 | 164 | } |
| 165 | 165 | |