@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function setFocusable($value=true) { |
| 58 | - if ($value === true) |
|
| 58 | + if ($value===true) |
|
| 59 | 59 | $this->setProperty("tabindex", "0"); |
| 60 | 60 | else { |
| 61 | 61 | $this->removeProperty("tabindex"); |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function setAnimated($content, $animation="") { |
| 67 | 67 | $this->setTagName("div"); |
| 68 | - $this->addToProperty("class", "animated " . $animation); |
|
| 69 | - $visible=new HtmlSemDoubleElement("visible-" . $this->identifier, "div"); |
|
| 68 | + $this->addToProperty("class", "animated ".$animation); |
|
| 69 | + $visible=new HtmlSemDoubleElement("visible-".$this->identifier, "div"); |
|
| 70 | 70 | $visible->setClass("visible content"); |
| 71 | 71 | $visible->setContent($this->content); |
| 72 | - $hidden=new HtmlSemDoubleElement("hidden-" . $this->identifier, "div"); |
|
| 72 | + $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier, "div"); |
|
| 73 | 73 | $hidden->setClass("hidden content"); |
| 74 | 74 | $hidden->setContent($content); |
| 75 | - $this->content=array ($visible,$hidden ); |
|
| 75 | + $this->content=array($visible, $hidden); |
|
| 76 | 76 | return $hidden; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | public function asIcon($icon) { |
| 85 | 85 | $iconO=$icon; |
| 86 | 86 | if (\is_string($icon)) { |
| 87 | - $iconO=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
| 87 | + $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
|
| 88 | 88 | } |
| 89 | 89 | $this->addToProperty("class", "icon"); |
| 90 | 90 | $this->content=$iconO; |
@@ -104,17 +104,17 @@ discard block |
||
| 104 | 104 | * @return HtmlLabel |
| 105 | 105 | */ |
| 106 | 106 | public function addLabel($label, $before=false, $icon=NULL) { |
| 107 | - $this->tagName="div";$prefix=""; |
|
| 108 | - if($before) |
|
| 107 | + $this->tagName="div"; $prefix=""; |
|
| 108 | + if ($before) |
|
| 109 | 109 | $prefix="left "; |
| 110 | 110 | $this->addToProperty("class", $prefix."labeled"); |
| 111 | 111 | $isIcon=(isset($this->content[0]) && $this->content[0] instanceof HtmlIcon); |
| 112 | - $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
|
| 113 | - if($isIcon){ |
|
| 112 | + $this->content=new HtmlButton("button-".$this->identifier, $this->content); |
|
| 113 | + if ($isIcon) { |
|
| 114 | 114 | $this->content->addClass("icon"); |
| 115 | 115 | } |
| 116 | 116 | $this->content->setTagName("div"); |
| 117 | - $label=new HtmlLabel("label-" . $this->identifier, $label, $icon,"a"); |
|
| 117 | + $label=new HtmlLabel("label-".$this->identifier, $label, $icon, "a"); |
|
| 118 | 118 | $label->setBasic(); |
| 119 | 119 | $this->addContent($label, $before); |
| 120 | 120 | return $label; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function fromArray($array) { |
| 128 | 128 | $array=parent::fromArray($array); |
| 129 | - foreach ( $array as $key => $value ) { |
|
| 129 | + foreach ($array as $key => $value) { |
|
| 130 | 130 | $this->setProperty($key, $value); |
| 131 | 131 | } |
| 132 | 132 | return $array; |
@@ -140,10 +140,10 @@ discard block |
||
| 140 | 140 | return $this->addToProperty("class", "positive"); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - public function setColor($color){ |
|
| 144 | - if(\is_array($this->content)){ |
|
| 145 | - foreach ($this->content as $content){ |
|
| 146 | - if($content instanceof HtmlButton) |
|
| 143 | + public function setColor($color) { |
|
| 144 | + if (\is_array($this->content)) { |
|
| 145 | + foreach ($this->content as $content) { |
|
| 146 | + if ($content instanceof HtmlButton) |
|
| 147 | 147 | $content->setColor($color); |
| 148 | 148 | } |
| 149 | 149 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | * @return HtmlButton |
| 202 | 202 | */ |
| 203 | 203 | public static function social($identifier, $social, $value=NULL) { |
| 204 | - if ($value === NULL) |
|
| 204 | + if ($value===NULL) |
|
| 205 | 205 | $value=\ucfirst($social); |
| 206 | 206 | $return=new HtmlButton($identifier, $value); |
| 207 | 207 | $return->addIcon($social); |
@@ -238,8 +238,8 @@ discard block |
||
| 238 | 238 | * {@inheritDoc} |
| 239 | 239 | * @see HtmlSemDoubleElement::asLink() |
| 240 | 240 | */ |
| 241 | - public function asLink($href=NULL,$target=NULL) { |
|
| 242 | - parent::asLink($href,$target); |
|
| 241 | + public function asLink($href=NULL, $target=NULL) { |
|
| 242 | + parent::asLink($href, $target); |
|
| 243 | 243 | return $this; |
| 244 | 244 | } |
| 245 | 245 | } |
@@ -13,29 +13,29 @@ 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 | protected $_multiple; |
| 27 | 27 | |
| 28 | - public function __construct($identifier, $value="", $items=array(),$associative=true) { |
|
| 28 | + public function __construct($identifier, $value="", $items=array(), $associative=true) { |
|
| 29 | 29 | parent::__construct($identifier, "div"); |
| 30 | 30 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
| 31 | 31 | $this->setProperty("class", "ui dropdown"); |
| 32 | 32 | $this->_multiple=false; |
| 33 | 33 | $content=[]; |
| 34 | - if(isset($value)){ |
|
| 35 | - if($value instanceof HtmlSemDoubleElement){ |
|
| 34 | + if (isset($value)) { |
|
| 35 | + if ($value instanceof HtmlSemDoubleElement) { |
|
| 36 | 36 | $text=$value; |
| 37 | - }else{ |
|
| 38 | - $text=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
|
| 37 | + } else { |
|
| 38 | + $text=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
| 39 | 39 | $text->setClass("text"); |
| 40 | 40 | $this->setValue($value); |
| 41 | 41 | } |
@@ -48,29 +48,29 @@ discard block |
||
| 48 | 48 | $this->addItems($items); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function getField(){ |
|
| 51 | + public function getField() { |
|
| 52 | 52 | return $this->input; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function getDataField(){ |
|
| 55 | + public function getDataField() { |
|
| 56 | 56 | return $this->input; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function addItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
| 60 | - $itemO=$this->beforeAddItem($item,$value,$image,$description); |
|
| 59 | + public function addItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
| 60 | + $itemO=$this->beforeAddItem($item, $value, $image, $description); |
|
| 61 | 61 | $this->items[]=$itemO; |
| 62 | 62 | return $itemO; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
| 65 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
| 66 | 66 | $this->removeArrow(); |
| 67 | - $this->addIconP($icon,$before,$labeled); |
|
| 67 | + $this->addIconP($icon, $before, $labeled); |
|
| 68 | 68 | return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter(""); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function addIcons($icons){ |
|
| 71 | + public function addIcons($icons) { |
|
| 72 | 72 | $count=$this->count(); |
| 73 | - for ($i=0;$i<\sizeof($icons) && $i<$count;$i++){ |
|
| 73 | + for ($i=0; $i<\sizeof($icons) && $i<$count; $i++) { |
|
| 74 | 74 | $this->getItem($i)->addIcon($icons[$i]); |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -81,33 +81,33 @@ discard block |
||
| 81 | 81 | * @param number $position |
| 82 | 82 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 83 | 83 | */ |
| 84 | - public function insertItem($item,$position=0){ |
|
| 84 | + public function insertItem($item, $position=0) { |
|
| 85 | 85 | $itemO=$this->beforeAddItem($item); |
| 86 | - $start = array_slice($this->items, 0, $position); |
|
| 87 | - $end = array_slice($this->items, $position); |
|
| 88 | - $start[] = $item; |
|
| 86 | + $start=array_slice($this->items, 0, $position); |
|
| 87 | + $end=array_slice($this->items, $position); |
|
| 88 | + $start[]=$item; |
|
| 89 | 89 | $this->items=array_merge($start, $end); |
| 90 | 90 | return $itemO; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - protected function removeArrow(){ |
|
| 94 | - if(\sizeof($this->content)>1){ |
|
| 93 | + protected function removeArrow() { |
|
| 94 | + if (\sizeof($this->content)>1) { |
|
| 95 | 95 | unset($this->content["arrow"]); |
| 96 | 96 | $this->content=\array_values($this->content); |
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - protected function beforeAddItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
| 100 | + protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
| 101 | 101 | $itemO=$item; |
| 102 | - if(\is_array($item)){ |
|
| 102 | + if (\is_array($item)) { |
|
| 103 | 103 | $description=JArray::getValue($item, "description", 3); |
| 104 | 104 | $value=JArray::getValue($item, "value", 1); |
| 105 | 105 | $image=JArray::getValue($item, "image", 2); |
| 106 | 106 | $item=JArray::getValue($item, "item", 0); |
| 107 | 107 | } |
| 108 | - if(!$item instanceof HtmlDropdownItem){ |
|
| 109 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
|
| 110 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 108 | + if (!$item instanceof HtmlDropdownItem) { |
|
| 109 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description); |
|
| 110 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
| 111 | 111 | $this->addToProperty("class", "vertical"); |
| 112 | 112 | } |
| 113 | 113 | return $itemO; |
@@ -120,11 +120,11 @@ discard block |
||
| 120 | 120 | $this->addItem($function($object)); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public function addInput($name){ |
|
| 124 | - if(!isset($name)) |
|
| 123 | + public function addInput($name) { |
|
| 124 | + if (!isset($name)) |
|
| 125 | 125 | $name="input-".$this->identifier; |
| 126 | 126 | $this->setAction("activate"); |
| 127 | - $this->input=new HtmlInput($name,"hidden"); |
|
| 127 | + $this->input=new HtmlInput($name, "hidden"); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -133,15 +133,15 @@ discard block |
||
| 133 | 133 | * @param string $icon |
| 134 | 134 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 135 | 135 | */ |
| 136 | - public function addSearchInputItem($placeHolder=NULL,$icon=NULL){ |
|
| 137 | - return $this->addItem(HtmlDropdownItem::searchInput($placeHolder,$icon)); |
|
| 136 | + public function addSearchInputItem($placeHolder=NULL, $icon=NULL) { |
|
| 137 | + return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon)); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
| 141 | 141 | * Adds a divider item |
| 142 | 142 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 143 | 143 | */ |
| 144 | - public function addDividerItem(){ |
|
| 144 | + public function addDividerItem() { |
|
| 145 | 145 | return $this->addItem(HtmlDropdownItem::divider()); |
| 146 | 146 | } |
| 147 | 147 | |
@@ -151,8 +151,8 @@ discard block |
||
| 151 | 151 | * @param string $icon |
| 152 | 152 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 153 | 153 | */ |
| 154 | - public function addHeaderItem($caption=NULL,$icon=NULL){ |
|
| 155 | - return $this->addItem(HtmlDropdownItem::header($caption,$icon)); |
|
| 154 | + public function addHeaderItem($caption=NULL, $icon=NULL) { |
|
| 155 | + return $this->addItem(HtmlDropdownItem::header($caption, $icon)); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * @param string $color |
| 162 | 162 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 163 | 163 | */ |
| 164 | - public function addCircularLabelItem($caption,$color){ |
|
| 164 | + public function addCircularLabelItem($caption, $color) { |
|
| 165 | 165 | return $this->addItem(HtmlDropdownItem::circular($caption, $color)); |
| 166 | 166 | } |
| 167 | 167 | |
@@ -170,90 +170,90 @@ discard block |
||
| 170 | 170 | * @param string $image |
| 171 | 171 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 172 | 172 | */ |
| 173 | - public function addMiniAvatarImageItem($caption,$image){ |
|
| 173 | + public function addMiniAvatarImageItem($caption, $image) { |
|
| 174 | 174 | return $this->addItem(HtmlDropdownItem::avatar($caption, $image)); |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - public function addItems($items){ |
|
| 178 | - if(\is_array($items) && $this->_associative){ |
|
| 179 | - foreach ($items as $k=>$v){ |
|
| 177 | + public function addItems($items) { |
|
| 178 | + if (\is_array($items) && $this->_associative) { |
|
| 179 | + foreach ($items as $k=>$v) { |
|
| 180 | 180 | $this->addItem($v)->setData($k); |
| 181 | 181 | } |
| 182 | - }else{ |
|
| 183 | - foreach ($items as $item){ |
|
| 182 | + } else { |
|
| 183 | + foreach ($items as $item) { |
|
| 184 | 184 | $this->addItem($item); |
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - public function getItem($index){ |
|
| 189 | + public function getItem($index) { |
|
| 190 | 190 | return $this->items[$index]; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | 194 | * @return int |
| 195 | 195 | */ |
| 196 | - public function count(){ |
|
| 196 | + public function count() { |
|
| 197 | 197 | return \sizeof($this->items); |
| 198 | 198 | } |
| 199 | 199 | /** |
| 200 | 200 | * @param boolean $dropdown |
| 201 | 201 | */ |
| 202 | - public function asDropdown($dropdown){ |
|
| 203 | - if($dropdown===false){ |
|
| 202 | + public function asDropdown($dropdown) { |
|
| 203 | + if ($dropdown===false) { |
|
| 204 | 204 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 205 | 205 | $dropdown="menu"; |
| 206 | - }else{ |
|
| 206 | + } else { |
|
| 207 | 207 | $dropdown="dropdown"; |
| 208 | 208 | $this->mClass="menu"; |
| 209 | 209 | } |
| 210 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
| 210 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - public function setVertical(){ |
|
| 214 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
| 213 | + public function setVertical() { |
|
| 214 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | - public function setInline(){ |
|
| 218 | - return $this->addToPropertyCtrl("class", "inline",["inline"]); |
|
| 217 | + public function setInline() { |
|
| 218 | + return $this->addToPropertyCtrl("class", "inline", ["inline"]); |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - public function setSimple(){ |
|
| 222 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
| 221 | + public function setSimple() { |
|
| 222 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - public function asButton($floating=false){ |
|
| 225 | + public function asButton($floating=false) { |
|
| 226 | 226 | $this->removeArrow(); |
| 227 | - if($floating) |
|
| 227 | + if ($floating) |
|
| 228 | 228 | $this->addToProperty("class", "floating"); |
| 229 | 229 | $this->removePropertyValue("class", "selection"); |
| 230 | 230 | return $this->addToProperty("class", "button"); |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
| 233 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
| 234 | 234 | $this->_multiple=$multiple; |
| 235 | - if(isset($name)) |
|
| 235 | + if (isset($name)) |
|
| 236 | 236 | $this->addInput($name); |
| 237 | - if($multiple){ |
|
| 237 | + if ($multiple) { |
|
| 238 | 238 | $this->addToProperty("class", "multiple"); |
| 239 | 239 | } |
| 240 | - if ($selection){ |
|
| 241 | - if($this->propertyContains("class", "button")===false) |
|
| 242 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 240 | + if ($selection) { |
|
| 241 | + if ($this->propertyContains("class", "button")===false) |
|
| 242 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
| 243 | 243 | } |
| 244 | 244 | return $this; |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - public function asSearch($name=NULL,$multiple=false,$selection=true){ |
|
| 248 | - $this->asSelect($name,$multiple,$selection); |
|
| 247 | + public function asSearch($name=NULL, $multiple=false, $selection=true) { |
|
| 248 | + $this->asSelect($name, $multiple, $selection); |
|
| 249 | 249 | return $this->addToProperty("class", "search"); |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - public function setSelect($name=NULL,$multiple=false){ |
|
| 253 | - if(!isset($name)) |
|
| 252 | + public function setSelect($name=NULL, $multiple=false) { |
|
| 253 | + if (!isset($name)) |
|
| 254 | 254 | $name="select-".$this->identifier; |
| 255 | 255 | $this->input=null; |
| 256 | - if($multiple){ |
|
| 256 | + if ($multiple) { |
|
| 257 | 257 | $this->setProperty("multiple", true); |
| 258 | 258 | $this->addToProperty("class", "multiple"); |
| 259 | 259 | } |
@@ -261,37 +261,37 @@ discard block |
||
| 261 | 261 | $this->tagName="select"; |
| 262 | 262 | $this->setProperty("name", $name); |
| 263 | 263 | $this->content=null; |
| 264 | - foreach ($this->items as $item){ |
|
| 264 | + foreach ($this->items as $item) { |
|
| 265 | 265 | $item->asOption(); |
| 266 | 266 | } |
| 267 | 267 | return $this; |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - public function asSubmenu($pointing=NULL){ |
|
| 270 | + public function asSubmenu($pointing=NULL) { |
|
| 271 | 271 | $this->setClass("ui dropdown link item"); |
| 272 | - if(isset($pointing)){ |
|
| 272 | + if (isset($pointing)) { |
|
| 273 | 273 | $this->setPointing($pointing); |
| 274 | 274 | } |
| 275 | 275 | return $this; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - public function setPointing($value=Direction::NONE){ |
|
| 279 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
| 278 | + public function setPointing($value=Direction::NONE) { |
|
| 279 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - public function setValue($value){ |
|
| 282 | + public function setValue($value) { |
|
| 283 | 283 | $this->value=$value; |
| 284 | 284 | return $this; |
| 285 | 285 | } |
| 286 | - private function applyValue(){ |
|
| 286 | + private function applyValue() { |
|
| 287 | 287 | $value=$this->value; |
| 288 | - if(isset($this->input) && isset($value)){ |
|
| 288 | + if (isset($this->input) && isset($value)) { |
|
| 289 | 289 | $this->input->setProperty("value", $value); |
| 290 | - }else{ |
|
| 290 | + } else { |
|
| 291 | 291 | $this->setProperty("value", $value); |
| 292 | 292 | } |
| 293 | 293 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
| 294 | - if(isset($textElement) && !$this->_multiple) |
|
| 294 | + if (isset($textElement) && !$this->_multiple) |
|
| 295 | 295 | $textElement->setContent($value); |
| 296 | 296 | return $this; |
| 297 | 297 | } |
@@ -301,9 +301,9 @@ discard block |
||
| 301 | 301 | * @see BaseHtml::run() |
| 302 | 302 | */ |
| 303 | 303 | public function run(JsUtils $js) { |
| 304 | - if($this->propertyContains("class", "simple")===false){ |
|
| 305 | - if(isset($this->_bsComponent)===false){ |
|
| 306 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
| 304 | + if ($this->propertyContains("class", "simple")===false) { |
|
| 305 | + if (isset($this->_bsComponent)===false) { |
|
| 306 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
| 307 | 307 | $this->_bsComponent->setItemSelector(".item"); |
| 308 | 308 | } |
| 309 | 309 | $this->addEventsOnRun($js); |
@@ -311,31 +311,31 @@ discard block |
||
| 311 | 311 | } |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - public function setCompact(){ |
|
| 314 | + public function setCompact() { |
|
| 315 | 315 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - public function setAction($action){ |
|
| 318 | + public function setAction($action) { |
|
| 319 | 319 | $this->_params["action"]=$action; |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | - public function setFullTextSearch($value){ |
|
| 322 | + public function setFullTextSearch($value) { |
|
| 323 | 323 | $this->_params["fullTextSearch"]=$value; |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 327 | 327 | $this->applyValue(); |
| 328 | - return parent::compile($js,$view); |
|
| 328 | + return parent::compile($js, $view); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | public function getInput() { |
| 332 | 332 | return $this->input; |
| 333 | 333 | } |
| 334 | 334 | public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) { |
| 335 | - return $this->_addAction($this, $action,$direction,$icon,$labeled); |
|
| 335 | + return $this->_addAction($this, $action, $direction, $icon, $labeled); |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - public function jsAddItem($caption){ |
|
| 338 | + public function jsAddItem($caption) { |
|
| 339 | 339 | $js="var first=$('#{$this->identifier} .item').first();if(first!=undefined){var new =first.clone();first.parent().append(new);first.html('{$caption}};')"; |
| 340 | 340 | return $js; |
| 341 | 341 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | if(isset($value)){ |
| 35 | 35 | if($value instanceof HtmlSemDoubleElement){ |
| 36 | 36 | $text=$value; |
| 37 | - }else{ |
|
| 37 | + } else{ |
|
| 38 | 38 | $text=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
| 39 | 39 | $text->setClass("text"); |
| 40 | 40 | $this->setValue($value); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | if(!$item instanceof HtmlDropdownItem){ |
| 109 | 109 | $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
| 110 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 110 | + } elseif($itemO instanceof HtmlDropdownItem){ |
|
| 111 | 111 | $this->addToProperty("class", "vertical"); |
| 112 | 112 | } |
| 113 | 113 | return $itemO; |
@@ -121,8 +121,9 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | public function addInput($name){ |
| 124 | - if(!isset($name)) |
|
| 125 | - $name="input-".$this->identifier; |
|
| 124 | + if(!isset($name)) { |
|
| 125 | + $name="input-".$this->identifier; |
|
| 126 | + } |
|
| 126 | 127 | $this->setAction("activate"); |
| 127 | 128 | $this->input=new HtmlInput($name,"hidden"); |
| 128 | 129 | } |
@@ -179,7 +180,7 @@ discard block |
||
| 179 | 180 | foreach ($items as $k=>$v){ |
| 180 | 181 | $this->addItem($v)->setData($k); |
| 181 | 182 | } |
| 182 | - }else{ |
|
| 183 | + } else{ |
|
| 183 | 184 | foreach ($items as $item){ |
| 184 | 185 | $this->addItem($item); |
| 185 | 186 | } |
@@ -203,7 +204,7 @@ discard block |
||
| 203 | 204 | if($dropdown===false){ |
| 204 | 205 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 205 | 206 | $dropdown="menu"; |
| 206 | - }else{ |
|
| 207 | + } else{ |
|
| 207 | 208 | $dropdown="dropdown"; |
| 208 | 209 | $this->mClass="menu"; |
| 209 | 210 | } |
@@ -224,22 +225,25 @@ discard block |
||
| 224 | 225 | |
| 225 | 226 | public function asButton($floating=false){ |
| 226 | 227 | $this->removeArrow(); |
| 227 | - if($floating) |
|
| 228 | - $this->addToProperty("class", "floating"); |
|
| 228 | + if($floating) { |
|
| 229 | + $this->addToProperty("class", "floating"); |
|
| 230 | + } |
|
| 229 | 231 | $this->removePropertyValue("class", "selection"); |
| 230 | 232 | return $this->addToProperty("class", "button"); |
| 231 | 233 | } |
| 232 | 234 | |
| 233 | 235 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
| 234 | 236 | $this->_multiple=$multiple; |
| 235 | - if(isset($name)) |
|
| 236 | - $this->addInput($name); |
|
| 237 | + if(isset($name)) { |
|
| 238 | + $this->addInput($name); |
|
| 239 | + } |
|
| 237 | 240 | if($multiple){ |
| 238 | 241 | $this->addToProperty("class", "multiple"); |
| 239 | 242 | } |
| 240 | 243 | if ($selection){ |
| 241 | - if($this->propertyContains("class", "button")===false) |
|
| 242 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 244 | + if($this->propertyContains("class", "button")===false) { |
|
| 245 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 246 | + } |
|
| 243 | 247 | } |
| 244 | 248 | return $this; |
| 245 | 249 | } |
@@ -250,8 +254,9 @@ discard block |
||
| 250 | 254 | } |
| 251 | 255 | |
| 252 | 256 | public function setSelect($name=NULL,$multiple=false){ |
| 253 | - if(!isset($name)) |
|
| 254 | - $name="select-".$this->identifier; |
|
| 257 | + if(!isset($name)) { |
|
| 258 | + $name="select-".$this->identifier; |
|
| 259 | + } |
|
| 255 | 260 | $this->input=null; |
| 256 | 261 | if($multiple){ |
| 257 | 262 | $this->setProperty("multiple", true); |
@@ -287,12 +292,13 @@ discard block |
||
| 287 | 292 | $value=$this->value; |
| 288 | 293 | if(isset($this->input) && isset($value)){ |
| 289 | 294 | $this->input->setProperty("value", $value); |
| 290 | - }else{ |
|
| 295 | + } else{ |
|
| 291 | 296 | $this->setProperty("value", $value); |
| 292 | 297 | } |
| 293 | 298 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
| 294 | - if(isset($textElement) && !$this->_multiple) |
|
| 295 | - $textElement->setContent($value); |
|
| 299 | + if(isset($textElement) && !$this->_multiple) { |
|
| 300 | + $textElement->setContent($value); |
|
| 301 | + } |
|
| 296 | 302 | return $this; |
| 297 | 303 | } |
| 298 | 304 | |
@@ -10,61 +10,61 @@ |
||
| 10 | 10 | * @param string $identifier |
| 11 | 11 | * @param object $modelInstance |
| 12 | 12 | */ |
| 13 | - public function __construct($identifier,$modelInstance=null,$fieldsOrder=[],$fieldsDefinition=[],$fields=[],$captions=[],$separators=[]) { |
|
| 14 | - parent::__construct($identifier,$modelInstance,$fieldsOrder,$fieldsDefinition,$fields,$captions,$separators); |
|
| 13 | + public function __construct($identifier, $modelInstance=null, $fieldsOrder=[], $fieldsDefinition=[], $fields=[], $captions=[], $separators=[]) { |
|
| 14 | + parent::__construct($identifier, $modelInstance, $fieldsOrder, $fieldsDefinition, $fields, $captions, $separators); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - protected function getDefaultModelInstance(){ |
|
| 17 | + protected function getDefaultModelInstance() { |
|
| 18 | 18 | return new UserModel(); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public static function regular($identifier,$modelInstance=null){ |
|
| 22 | - return new FormAccount($identifier,$modelInstance, |
|
| 23 | - ["message","login","password","passwordConf","email","submit","error"], |
|
| 21 | + public static function regular($identifier, $modelInstance=null) { |
|
| 22 | + return new FormAccount($identifier, $modelInstance, |
|
| 23 | + ["message", "login", "password", "passwordConf", "email", "submit", "error"], |
|
| 24 | 24 | ["message"=>[["icon"=>"sign in"]], |
| 25 | 25 | "input0"=>[["rules"=>"empty"]], |
| 26 | - "input1"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty']]], |
|
| 27 | - "input2"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
| 26 | + "input1"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty']]], |
|
| 27 | + "input2"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
| 28 | 28 | "input3"=>[["rules"=>"email"]], |
| 29 | 29 | "submit"=>["green fluid"], |
| 30 | 30 | "message2"=>[["error"=>true]]], |
| 31 | - ["Account","login","password","passwordConf","email","submit","error"], |
|
| 32 | - ["Please enter your account informations","Login","Password","Password confirmation","Email address","Creation"], |
|
| 33 | - [0,1,3,4,5,6]); |
|
| 31 | + ["Account", "login", "password", "passwordConf", "email", "submit", "error"], |
|
| 32 | + ["Please enter your account informations", "Login", "Password", "Password confirmation", "Email address", "Creation"], |
|
| 33 | + [0, 1, 3, 4, 5, 6]); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public static function smallInline($identifier,$modelInstance=null){ |
|
| 37 | - $result=new FormAccount($identifier,$modelInstance, |
|
| 38 | - ["login","password","submit"], |
|
| 39 | - ["input0"=>[["rules"=>"empty"]],"input1"=>[["inputType"=>"password","rules"=>"empty"]],"submit"=>["green basic"]], |
|
| 40 | - ["login","password","submit"], |
|
| 41 | - ["","","Connection"], |
|
| 36 | + public static function smallInline($identifier, $modelInstance=null) { |
|
| 37 | + $result=new FormAccount($identifier, $modelInstance, |
|
| 38 | + ["login", "password", "submit"], |
|
| 39 | + ["input0"=>[["rules"=>"empty"]], "input1"=>[["inputType"=>"password", "rules"=>"empty"]], "submit"=>["green basic"]], |
|
| 40 | + ["login", "password", "submit"], |
|
| 41 | + ["", "", "Connection"], |
|
| 42 | 42 | [2]); |
| 43 | 43 | $result->addDividerBefore(0, "Connection"); |
| 44 | 44 | return $result; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public static function small($identifier,$modelInstance=null){ |
|
| 48 | - $result=new FormAccount($identifier,$modelInstance, |
|
| 49 | - ["login","password","passwordConf","email","submit"], |
|
| 47 | + public static function small($identifier, $modelInstance=null) { |
|
| 48 | + $result=new FormAccount($identifier, $modelInstance, |
|
| 49 | + ["login", "password", "passwordConf", "email", "submit"], |
|
| 50 | 50 | [ |
| 51 | 51 | "input0"=>[["rules"=>"empty"]], |
| 52 | - "input1"=>[["inputType"=>"password","rules"=>['minLength[6]', 'empty']]], |
|
| 53 | - "input2"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
| 52 | + "input1"=>[["inputType"=>"password", "rules"=>['minLength[6]', 'empty']]], |
|
| 53 | + "input2"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
| 54 | 54 | "input3"=>[["rules"=>"email"]], |
| 55 | 55 | "submit"=>["green basic"]], |
| 56 | - ["login","password","passwordConf","email","submit"], |
|
| 57 | - ["Login","Password","Password confirmation","Email address","Creation"], |
|
| 58 | - [1,2]); |
|
| 56 | + ["login", "password", "passwordConf", "email", "submit"], |
|
| 57 | + ["Login", "Password", "Password confirmation", "Email address", "Creation"], |
|
| 58 | + [1, 2]); |
|
| 59 | 59 | $result->addDividerBefore(0, "Creation"); |
| 60 | 60 | return $result; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - public static function attachedSegment($identifier,$modelInstance=null){ |
|
| 64 | - $result=self::regular($identifier,$modelInstance); |
|
| 65 | - $result->fieldAsMessage("message",["icon"=>"sign in","attached"=>true]); |
|
| 66 | - $result->addWrapper("message",null,"<div class='ui attached segment'>"); |
|
| 67 | - $result->addWrapper("error", null,"</div>"); |
|
| 63 | + public static function attachedSegment($identifier, $modelInstance=null) { |
|
| 64 | + $result=self::regular($identifier, $modelInstance); |
|
| 65 | + $result->fieldAsMessage("message", ["icon"=>"sign in", "attached"=>true]); |
|
| 66 | + $result->addWrapper("message", null, "<div class='ui attached segment'>"); |
|
| 67 | + $result->addWrapper("error", null, "</div>"); |
|
| 68 | 68 | return $result; |
| 69 | 69 | } |
| 70 | 70 | } |