@@ -17,31 +17,31 @@ discard block |
||
| 17 | 17 | } |
| 18 | 18 | protected $mClass="menu"; |
| 19 | 19 | protected $mTagName="div"; |
| 20 | - protected $items=array (); |
|
| 21 | - protected $_params=array("action"=>"nothing","on"=>"hover"); |
|
| 20 | + protected $items=array(); |
|
| 21 | + protected $_params=array("action"=>"nothing", "on"=>"hover"); |
|
| 22 | 22 | protected $input; |
| 23 | 23 | |
| 24 | 24 | public function __construct($identifier, $value="", $items=array()) { |
| 25 | 25 | parent::__construct($identifier, "div"); |
| 26 | 26 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
| 27 | 27 | $this->setProperty("class", "ui dropdown"); |
| 28 | - $content=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
|
| 28 | + $content=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
| 29 | 29 | $content->setClass("text"); |
| 30 | 30 | $content->setContent($value); |
| 31 | - $content->wrap("",new HtmlIcon("", "dropdown")); |
|
| 31 | + $content->wrap("", new HtmlIcon("", "dropdown")); |
|
| 32 | 32 | $this->content=array($content); |
| 33 | 33 | $this->tagName="div"; |
| 34 | 34 | $this->addItems($items); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
| 38 | - $itemO=$this->beforeAddItem($item,$value,$image); |
|
| 37 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
| 38 | + $itemO=$this->beforeAddItem($item, $value, $image); |
|
| 39 | 39 | $this->items[]=$itemO; |
| 40 | 40 | return $itemO; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
| 44 | - $this->addIconP($icon,$before,$labeled); |
|
| 43 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
| 44 | + $this->addIconP($icon, $before, $labeled); |
|
| 45 | 45 | return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter(""); |
| 46 | 46 | } |
| 47 | 47 | /** |
@@ -50,25 +50,25 @@ discard block |
||
| 50 | 50 | * @param number $position |
| 51 | 51 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 52 | 52 | */ |
| 53 | - public function insertItem($item,$position=0){ |
|
| 53 | + public function insertItem($item, $position=0) { |
|
| 54 | 54 | $itemO=$this->beforeAddItem($item); |
| 55 | - $start = array_slice($this->items, 0, $position); |
|
| 56 | - $end = array_slice($this->items, $position); |
|
| 57 | - $start[] = $item; |
|
| 55 | + $start=array_slice($this->items, 0, $position); |
|
| 56 | + $end=array_slice($this->items, $position); |
|
| 57 | + $start[]=$item; |
|
| 58 | 58 | $this->items=array_merge($start, $end); |
| 59 | 59 | return $itemO; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - protected function beforeAddItem($item,$value=NULL,$image=NULL){ |
|
| 62 | + protected function beforeAddItem($item, $value=NULL, $image=NULL) { |
|
| 63 | 63 | $itemO=$item; |
| 64 | - if(\is_array($item)){ |
|
| 64 | + if (\is_array($item)) { |
|
| 65 | 65 | $value=JArray::getValue($item, "value", 1); |
| 66 | 66 | $image=JArray::getValue($item, "image", 2); |
| 67 | 67 | $item=JArray::getValue($item, "item", 0); |
| 68 | 68 | } |
| 69 | - if(!$item instanceof HtmlDropdownItem){ |
|
| 70 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
|
| 71 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 69 | + if (!$item instanceof HtmlDropdownItem) { |
|
| 70 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image); |
|
| 71 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
| 72 | 72 | $this->addToProperty("class", "vertical"); |
| 73 | 73 | } |
| 74 | 74 | return $itemO; |
@@ -81,76 +81,76 @@ discard block |
||
| 81 | 81 | $this->addItem($function($object)); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - public function addInput($name){ |
|
| 85 | - if(!isset($name)) |
|
| 84 | + public function addInput($name) { |
|
| 85 | + if (!isset($name)) |
|
| 86 | 86 | $name="input-".$this->identifier; |
| 87 | 87 | $this->setAction("activate"); |
| 88 | - $this->input=new HtmlInput($name,"hidden"); |
|
| 88 | + $this->input=new HtmlInput($name, "hidden"); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public function addItems($items){ |
|
| 92 | - if(JArray::isAssociative($items)){ |
|
| 93 | - foreach ($items as $k=>$v){ |
|
| 91 | + public function addItems($items) { |
|
| 92 | + if (JArray::isAssociative($items)) { |
|
| 93 | + foreach ($items as $k=>$v) { |
|
| 94 | 94 | $this->addItem($v)->setData($k); |
| 95 | 95 | } |
| 96 | - }else{ |
|
| 97 | - foreach ($items as $item){ |
|
| 96 | + } else { |
|
| 97 | + foreach ($items as $item) { |
|
| 98 | 98 | $this->addItem($item); |
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - public function count(){ |
|
| 103 | + public function count() { |
|
| 104 | 104 | return \sizeof($this->items); |
| 105 | 105 | } |
| 106 | 106 | /** |
| 107 | 107 | * @param boolean $dropdown |
| 108 | 108 | */ |
| 109 | - public function asDropdown($dropdown){ |
|
| 110 | - if($dropdown===false){ |
|
| 109 | + public function asDropdown($dropdown) { |
|
| 110 | + if ($dropdown===false) { |
|
| 111 | 111 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 112 | 112 | $dropdown="menu"; |
| 113 | - }else{ |
|
| 113 | + } else { |
|
| 114 | 114 | $dropdown="dropdown"; |
| 115 | 115 | $this->mClass="menu"; |
| 116 | 116 | } |
| 117 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
| 117 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - public function setVertical(){ |
|
| 121 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
| 120 | + public function setVertical() { |
|
| 121 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - public function setSimple(){ |
|
| 125 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
| 124 | + public function setSimple() { |
|
| 125 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - public function asButton($floating=false){ |
|
| 129 | - if($floating) |
|
| 128 | + public function asButton($floating=false) { |
|
| 129 | + if ($floating) |
|
| 130 | 130 | $this->addToProperty("class", "floating"); |
| 131 | 131 | return $this->addToProperty("class", "button"); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
| 135 | - if(isset($name)) |
|
| 134 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
| 135 | + if (isset($name)) |
|
| 136 | 136 | $this->addInput($name); |
| 137 | - if($multiple) |
|
| 137 | + if ($multiple) |
|
| 138 | 138 | $this->addToProperty("class", "multiple"); |
| 139 | 139 | if ($selection) |
| 140 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 140 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
| 141 | 141 | return $this; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - public function asSearch($name=NULL,$multiple=false,$selection=false){ |
|
| 145 | - $this->asSelect($name,$multiple,$selection); |
|
| 144 | + public function asSearch($name=NULL, $multiple=false, $selection=false) { |
|
| 145 | + $this->asSelect($name, $multiple, $selection); |
|
| 146 | 146 | return $this->addToProperty("class", "search"); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - public function setSelect($name=NULL,$multiple=false){ |
|
| 150 | - if(!isset($name)) |
|
| 149 | + public function setSelect($name=NULL, $multiple=false) { |
|
| 150 | + if (!isset($name)) |
|
| 151 | 151 | $name="select-".$this->identifier; |
| 152 | 152 | $this->input=null; |
| 153 | - if($multiple){ |
|
| 153 | + if ($multiple) { |
|
| 154 | 154 | $this->setProperty("multiple", true); |
| 155 | 155 | $this->addToProperty("class", "multiple"); |
| 156 | 156 | } |
@@ -158,32 +158,32 @@ discard block |
||
| 158 | 158 | $this->tagName="select"; |
| 159 | 159 | $this->setProperty("name", $name); |
| 160 | 160 | $this->content=null; |
| 161 | - foreach ($this->items as $item){ |
|
| 161 | + foreach ($this->items as $item) { |
|
| 162 | 162 | $item->asOption(); |
| 163 | 163 | } |
| 164 | 164 | return $this; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - public function asSubmenu($pointing=NULL){ |
|
| 167 | + public function asSubmenu($pointing=NULL) { |
|
| 168 | 168 | $this->setClass("ui dropdown link item"); |
| 169 | - if(isset($pointing)){ |
|
| 169 | + if (isset($pointing)) { |
|
| 170 | 170 | $this->setPointing($pointing); |
| 171 | 171 | } |
| 172 | 172 | return $this; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - public function setPointing($value=Direction::NONE){ |
|
| 176 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
| 175 | + public function setPointing($value=Direction::NONE) { |
|
| 176 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - public function setValue($value){ |
|
| 180 | - if(isset($this->input)){ |
|
| 179 | + public function setValue($value) { |
|
| 180 | + if (isset($this->input)) { |
|
| 181 | 181 | $this->input->setProperty("value", $value); |
| 182 | - }else{ |
|
| 182 | + } else { |
|
| 183 | 183 | $this->setProperty("value", $value); |
| 184 | 184 | } |
| 185 | 185 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
| 186 | - if(isset($textElement)) |
|
| 186 | + if (isset($textElement)) |
|
| 187 | 187 | $textElement->setContent($value); |
| 188 | 188 | return $this; |
| 189 | 189 | } |
@@ -193,23 +193,23 @@ discard block |
||
| 193 | 193 | * @see BaseHtml::run() |
| 194 | 194 | */ |
| 195 | 195 | public function run(JsUtils $js) { |
| 196 | - if($this->propertyContains("class", "simple")===false){ |
|
| 197 | - if(isset($this->_bsComponent)===false) |
|
| 198 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
| 196 | + if ($this->propertyContains("class", "simple")===false) { |
|
| 197 | + if (isset($this->_bsComponent)===false) |
|
| 198 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
| 199 | 199 | $this->addEventsOnRun($js); |
| 200 | 200 | return $this->_bsComponent; |
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - public function setCompact(){ |
|
| 204 | + public function setCompact() { |
|
| 205 | 205 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - public function setAction($action){ |
|
| 208 | + public function setAction($action) { |
|
| 209 | 209 | $this->_params["action"]=$action; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - public function setFullTextSearch($value){ |
|
| 212 | + public function setFullTextSearch($value) { |
|
| 213 | 213 | $this->_params["fullTextSearch"]=$value; |
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | \ No newline at end of file |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | if(!$item instanceof HtmlDropdownItem){ |
| 70 | 70 | $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
| 71 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 71 | + } elseif($itemO instanceof HtmlDropdownItem){ |
|
| 72 | 72 | $this->addToProperty("class", "vertical"); |
| 73 | 73 | } |
| 74 | 74 | return $itemO; |
@@ -82,8 +82,9 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | public function addInput($name){ |
| 85 | - if(!isset($name)) |
|
| 86 | - $name="input-".$this->identifier; |
|
| 85 | + if(!isset($name)) { |
|
| 86 | + $name="input-".$this->identifier; |
|
| 87 | + } |
|
| 87 | 88 | $this->setAction("activate"); |
| 88 | 89 | $this->input=new HtmlInput($name,"hidden"); |
| 89 | 90 | } |
@@ -93,7 +94,7 @@ discard block |
||
| 93 | 94 | foreach ($items as $k=>$v){ |
| 94 | 95 | $this->addItem($v)->setData($k); |
| 95 | 96 | } |
| 96 | - }else{ |
|
| 97 | + } else{ |
|
| 97 | 98 | foreach ($items as $item){ |
| 98 | 99 | $this->addItem($item); |
| 99 | 100 | } |
@@ -110,7 +111,7 @@ discard block |
||
| 110 | 111 | if($dropdown===false){ |
| 111 | 112 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 112 | 113 | $dropdown="menu"; |
| 113 | - }else{ |
|
| 114 | + } else{ |
|
| 114 | 115 | $dropdown="dropdown"; |
| 115 | 116 | $this->mClass="menu"; |
| 116 | 117 | } |
@@ -126,18 +127,22 @@ discard block |
||
| 126 | 127 | } |
| 127 | 128 | |
| 128 | 129 | public function asButton($floating=false){ |
| 129 | - if($floating) |
|
| 130 | - $this->addToProperty("class", "floating"); |
|
| 130 | + if($floating) { |
|
| 131 | + $this->addToProperty("class", "floating"); |
|
| 132 | + } |
|
| 131 | 133 | return $this->addToProperty("class", "button"); |
| 132 | 134 | } |
| 133 | 135 | |
| 134 | 136 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
| 135 | - if(isset($name)) |
|
| 136 | - $this->addInput($name); |
|
| 137 | - if($multiple) |
|
| 138 | - $this->addToProperty("class", "multiple"); |
|
| 139 | - if ($selection) |
|
| 140 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 137 | + if(isset($name)) { |
|
| 138 | + $this->addInput($name); |
|
| 139 | + } |
|
| 140 | + if($multiple) { |
|
| 141 | + $this->addToProperty("class", "multiple"); |
|
| 142 | + } |
|
| 143 | + if ($selection) { |
|
| 144 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 145 | + } |
|
| 141 | 146 | return $this; |
| 142 | 147 | } |
| 143 | 148 | |
@@ -147,8 +152,9 @@ discard block |
||
| 147 | 152 | } |
| 148 | 153 | |
| 149 | 154 | public function setSelect($name=NULL,$multiple=false){ |
| 150 | - if(!isset($name)) |
|
| 151 | - $name="select-".$this->identifier; |
|
| 155 | + if(!isset($name)) { |
|
| 156 | + $name="select-".$this->identifier; |
|
| 157 | + } |
|
| 152 | 158 | $this->input=null; |
| 153 | 159 | if($multiple){ |
| 154 | 160 | $this->setProperty("multiple", true); |
@@ -179,12 +185,13 @@ discard block |
||
| 179 | 185 | public function setValue($value){ |
| 180 | 186 | if(isset($this->input)){ |
| 181 | 187 | $this->input->setProperty("value", $value); |
| 182 | - }else{ |
|
| 188 | + } else{ |
|
| 183 | 189 | $this->setProperty("value", $value); |
| 184 | 190 | } |
| 185 | 191 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
| 186 | - if(isset($textElement)) |
|
| 187 | - $textElement->setContent($value); |
|
| 192 | + if(isset($textElement)) { |
|
| 193 | + $textElement->setContent($value); |
|
| 194 | + } |
|
| 188 | 195 | return $this; |
| 189 | 196 | } |
| 190 | 197 | |
@@ -194,8 +201,9 @@ discard block |
||
| 194 | 201 | */ |
| 195 | 202 | public function run(JsUtils $js) { |
| 196 | 203 | if($this->propertyContains("class", "simple")===false){ |
| 197 | - if(isset($this->_bsComponent)===false) |
|
| 198 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
| 204 | + if(isset($this->_bsComponent)===false) { |
|
| 205 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
| 206 | + } |
|
| 199 | 207 | $this->addEventsOnRun($js); |
| 200 | 208 | return $this->_bsComponent; |
| 201 | 209 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | * @param int $max |
| 14 | 14 | * @param string $icon star or heart |
| 15 | 15 | */ |
| 16 | - public function __construct($identifier, $value,$max=5,$icon="") { |
|
| 16 | + public function __construct($identifier, $value, $max=5, $icon="") { |
|
| 17 | 17 | parent::__construct($identifier, "div", "ui {$icon} rating"); |
| 18 | 18 | $this->setValue($value); |
| 19 | 19 | $this->setMax($max); |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | * {@inheritDoc} |
| 24 | 24 | * @see \Ajax\common\html\HtmlDoubleElement::setValue() |
| 25 | 25 | */ |
| 26 | - public function setValue($value){ |
|
| 26 | + public function setValue($value) { |
|
| 27 | 27 | $this->setProperty("data-rating", $value); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function setMax($max){ |
|
| 30 | + public function setMax($max) { |
|
| 31 | 31 | $this->setProperty("data-max-rating", $max); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -35,20 +35,20 @@ discard block |
||
| 35 | 35 | * {@inheritDoc} |
| 36 | 36 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
| 37 | 37 | */ |
| 38 | - public function run(JsUtils $js){ |
|
| 38 | + public function run(JsUtils $js) { |
|
| 39 | 39 | parent::run($js); |
| 40 | - return $js->semantic()->rating("#".$this->identifier,$this->_params); |
|
| 40 | + return $js->semantic()->rating("#".$this->identifier, $this->_params); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function asStar(){ |
|
| 43 | + public function asStar() { |
|
| 44 | 44 | return $this->setIcon(); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function asHeart(){ |
|
| 47 | + public function asHeart() { |
|
| 48 | 48 | return $this->setIcon("heart"); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function setIcon($icon="star"){ |
|
| 52 | - return $this->addToPropertyCtrl("class", $icon, ["star","heart",""]); |
|
| 51 | + public function setIcon($icon="star") { |
|
| 52 | + return $this->addToPropertyCtrl("class", $icon, ["star", "heart", ""]); |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | \ No newline at end of file |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | use Ajax\semantic\html\base\constants\CheckboxType; |
| 7 | 7 | |
| 8 | 8 | abstract class AbstractCheckbox extends HtmlSemDoubleElement { |
| 9 | - protected $_params=array (); |
|
| 9 | + protected $_params=array(); |
|
| 10 | 10 | |
| 11 | 11 | public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL, $inputType="checkbox", $type="checkbox") { |
| 12 | 12 | parent::__construct("ck-".$identifier, "div", "ui ".$type); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox |
| 74 | 74 | */ |
| 75 | 75 | public function attachEvent($selector, $action=NULL) { |
| 76 | - if (isset($action)!==false||\is_numeric($action)===true) { |
|
| 76 | + if (isset($action)!==false || \is_numeric($action)===true) { |
|
| 77 | 77 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'", "'.$action.'");'; |
| 78 | 78 | } else { |
| 79 | 79 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'");'; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function attachEvents($events=array()) { |
| 91 | 91 | if (\is_array($events)) { |
| 92 | - foreach ( $events as $action => $selector ) { |
|
| 92 | + foreach ($events as $action => $selector) { |
|
| 93 | 93 | $this->attachEvent($selector, $action); |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | $field=new \Ajax\common\html\html5\HtmlInput($identifier, $inputType, $value); |
| 14 | 14 | $field->setProperty("name", $name); |
| 15 | 15 | $this->setField($field); |
| 16 | - if (isset($label)) |
|
| 17 | - $this->setLabel($label); |
|
| 16 | + if (isset($label)) { |
|
| 17 | + $this->setLabel($label); |
|
| 18 | + } |
|
| 18 | 19 | } |
| 19 | 20 | |
| 20 | 21 | public function setType($checkboxType) { |
@@ -40,8 +41,9 @@ discard block |
||
| 40 | 41 | * @return mixed |
| 41 | 42 | */ |
| 42 | 43 | public function getLabel() { |
| 43 | - if (\array_key_exists("label", $this->content)) |
|
| 44 | - return $this->content["label"]; |
|
| 44 | + if (\array_key_exists("label", $this->content)) { |
|
| 45 | + return $this->content["label"]; |
|
| 46 | + } |
|
| 45 | 47 | } |
| 46 | 48 | |
| 47 | 49 | /** |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class HtmlDimmer extends HtmlSemDoubleElement { |
| 11 | 11 | private $_container; |
| 12 | - private $_params=array (); |
|
| 12 | + private $_params=array(); |
|
| 13 | 13 | private $_inverted; |
| 14 | 14 | |
| 15 | 15 | public function __construct($identifier, $content=NULL) { |
@@ -19,14 +19,14 @@ discard block |
||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function setContent($content) { |
| 22 | - $this->content=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", new HtmlSemDoubleElement("", "div", "center", $content)); |
|
| 22 | + $this->content=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", new HtmlSemDoubleElement("", "div", "center", $content)); |
|
| 23 | 23 | return $this; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function asIcon($icon, $title, $subHeader=NULL) { |
| 27 | - $header=new HtmlHeader("header-" . $this->identifier); |
|
| 27 | + $header=new HtmlHeader("header-".$this->identifier); |
|
| 28 | 28 | $header->asIcon($icon, $title, $subHeader); |
| 29 | - if ($this->_inverted === false) |
|
| 29 | + if ($this->_inverted===false) |
|
| 30 | 30 | $header->setInverted(); |
| 31 | 31 | return $this->setContent($header); |
| 32 | 32 | } |
@@ -43,13 +43,13 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | public function run(JsUtils $js) { |
| 45 | 45 | if ($this->_container instanceof HtmlSingleElement) |
| 46 | - $this->_bsComponent=$js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params); |
|
| 46 | + $this->_bsComponent=$js->semantic()->dimmer("#".$this->_container->getIdentifier(), $this->_params); |
|
| 47 | 47 | return parent::run($js); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function jsShow() { |
| 51 | - if (isset($this->_container) === true) |
|
| 52 | - return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");'; |
|
| 51 | + if (isset($this->_container)===true) |
|
| 52 | + return '$("#.'.$this->_container->getIdentifier().').dimmer("show");'; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | public function setBlurring() { |
@@ -26,8 +26,9 @@ discard block |
||
| 26 | 26 | public function asIcon($icon, $title, $subHeader=NULL) { |
| 27 | 27 | $header=new HtmlHeader("header-" . $this->identifier); |
| 28 | 28 | $header->asIcon($icon, $title, $subHeader); |
| 29 | - if ($this->_inverted === false) |
|
| 30 | - $header->setInverted(); |
|
| 29 | + if ($this->_inverted === false) { |
|
| 30 | + $header->setInverted(); |
|
| 31 | + } |
|
| 31 | 32 | return $this->setContent($header); |
| 32 | 33 | } |
| 33 | 34 | |
@@ -42,14 +43,16 @@ discard block |
||
| 42 | 43 | } |
| 43 | 44 | |
| 44 | 45 | public function run(JsUtils $js) { |
| 45 | - if ($this->_container instanceof HtmlSingleElement) |
|
| 46 | - $this->_bsComponent=$js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params); |
|
| 46 | + if ($this->_container instanceof HtmlSingleElement) { |
|
| 47 | + $this->_bsComponent=$js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params); |
|
| 48 | + } |
|
| 47 | 49 | return parent::run($js); |
| 48 | 50 | } |
| 49 | 51 | |
| 50 | 52 | public function jsShow() { |
| 51 | - if (isset($this->_container) === true) |
|
| 52 | - return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");'; |
|
| 53 | + if (isset($this->_container) === true) { |
|
| 54 | + return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");'; |
|
| 55 | + } |
|
| 53 | 56 | } |
| 54 | 57 | |
| 55 | 58 | public function setBlurring() { |
@@ -8,13 +8,13 @@ discard block |
||
| 8 | 8 | class HtmlSticky extends HtmlSemDoubleElement { |
| 9 | 9 | private $_params=array(); |
| 10 | 10 | |
| 11 | - public function __construct($identifier,$context=NULL,$content=NULL) { |
|
| 11 | + public function __construct($identifier, $context=NULL, $content=NULL) { |
|
| 12 | 12 | parent::__construct($identifier, "div", "ui sticky", $content); |
| 13 | - if(isset($content)) |
|
| 13 | + if (isset($content)) |
|
| 14 | 14 | $this->setContext($context); |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - public function setContext($context){ |
|
| 17 | + public function setContext($context) { |
|
| 18 | 18 | $this->_params["context"]=$context; |
| 19 | 19 | return $this; |
| 20 | 20 | } |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | * {@inheritDoc} |
| 24 | 24 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
| 25 | 25 | */ |
| 26 | - public function run(JsUtils $js){ |
|
| 26 | + public function run(JsUtils $js) { |
|
| 27 | 27 | parent::run($js); |
| 28 | - return $js->semantic()->sticky("#".$this->identifier,$this->_params); |
|
| 28 | + return $js->semantic()->sticky("#".$this->identifier, $this->_params); |
|
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | \ No newline at end of file |
@@ -10,8 +10,9 @@ |
||
| 10 | 10 | |
| 11 | 11 | public function __construct($identifier,$context=NULL,$content=NULL) { |
| 12 | 12 | parent::__construct($identifier, "div", "ui sticky", $content); |
| 13 | - if(isset($content)) |
|
| 14 | - $this->setContext($context); |
|
| 13 | + if(isset($content)) { |
|
| 14 | + $this->setContext($context); |
|
| 15 | + } |
|
| 15 | 16 | } |
| 16 | 17 | |
| 17 | 18 | public function setContext($context){ |
@@ -8,13 +8,13 @@ discard block |
||
| 8 | 8 | use Ajax\semantic\html\base\constants\Direction; |
| 9 | 9 | |
| 10 | 10 | class HtmlSearch extends HtmlSemDoubleElement { |
| 11 | - private $_elements=array (); |
|
| 12 | - private $_params=array (); |
|
| 13 | - private $_searchFields=array ("title" ); |
|
| 11 | + private $_elements=array(); |
|
| 12 | + private $_params=array(); |
|
| 13 | + private $_searchFields=array("title"); |
|
| 14 | 14 | private $_local=false; |
| 15 | 15 | |
| 16 | 16 | public function __construct($identifier, $placeholder=NULL, $icon=NULL) { |
| 17 | - parent::__construct("search-" . $identifier, "div", "ui search", array ()); |
|
| 17 | + parent::__construct("search-".$identifier, "div", "ui search", array()); |
|
| 18 | 18 | $this->createField($placeholder, $icon); |
| 19 | 19 | $this->createResult(); |
| 20 | 20 | $this->_params["type"]="standard"; |
@@ -22,9 +22,9 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | private function createField($placeholder=NULL, $icon=NULL) { |
| 24 | 24 | $field=new HtmlInput($this->identifier); |
| 25 | - if (isset($placeholder) === true) |
|
| 25 | + if (isset($placeholder)===true) |
|
| 26 | 26 | $field->setPlaceholder($placeholder); |
| 27 | - if (isset($icon) === true) |
|
| 27 | + if (isset($icon)===true) |
|
| 28 | 28 | $field->addIcon($icon, Direction::RIGHT); |
| 29 | 29 | $field->getField()->setClass("prompt"); |
| 30 | 30 | $this->content["field"]=$field; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | private function createResult() { |
| 35 | - $this->content["result"]=new HtmlSemDoubleElement("results-" . $this->identifier, "div", "results"); |
|
| 35 | + $this->content["result"]=new HtmlSemDoubleElement("results-".$this->identifier, "div", "results"); |
|
| 36 | 36 | return $this->content["result"]; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | public function setUrl($url) { |
| 52 | - $this->_params["apiSettings"]="%{url: %quote%" . $url . "%quote%}%"; |
|
| 52 | + $this->_params["apiSettings"]="%{url: %quote%".$url."%quote%}%"; |
|
| 53 | 53 | return $this; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -72,16 +72,16 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function run(JsUtils $js) { |
| 75 | - $this->_params["onSelect"]='%function(result,response){$(%quote%#' . $this->identifier . '%quote%).trigger(%quote%onSelect%quote%, {%quote%result%quote%: result, %quote%response%quote%:response} );}%'; |
|
| 75 | + $this->_params["onSelect"]='%function(result,response){$(%quote%#'.$this->identifier.'%quote%).trigger(%quote%onSelect%quote%, {%quote%result%quote%: result, %quote%response%quote%:response} );}%'; |
|
| 76 | 76 | $searchFields=\json_encode($this->_searchFields); |
| 77 | 77 | $searchFields=str_ireplace("\"", "%quote%", $searchFields); |
| 78 | - $this->_params["searchFields"]="%" . $searchFields . "%"; |
|
| 79 | - if ($this->_local === true) { |
|
| 78 | + $this->_params["searchFields"]="%".$searchFields."%"; |
|
| 79 | + if ($this->_local===true) { |
|
| 80 | 80 | $this->_params["source"]="%content%"; |
| 81 | - $this->addEvent("beforeExecute", "var content=" . $this->resultsToJson() . ";"); |
|
| 81 | + $this->addEvent("beforeExecute", "var content=".$this->resultsToJson().";"); |
|
| 82 | 82 | } |
| 83 | - if (isset($this->_bsComponent) === false) { |
|
| 84 | - $this->_bsComponent=$js->semantic()->search("#" . $this->identifier, $this->_params); |
|
| 83 | + if (isset($this->_bsComponent)===false) { |
|
| 84 | + $this->_bsComponent=$js->semantic()->search("#".$this->identifier, $this->_params); |
|
| 85 | 85 | } |
| 86 | 86 | $this->addEventsOnRun($js); |
| 87 | 87 | return $this->_bsComponent; |
@@ -22,10 +22,12 @@ |
||
| 22 | 22 | |
| 23 | 23 | private function createField($placeholder=NULL, $icon=NULL) { |
| 24 | 24 | $field=new HtmlInput($this->identifier); |
| 25 | - if (isset($placeholder) === true) |
|
| 26 | - $field->setPlaceholder($placeholder); |
|
| 27 | - if (isset($icon) === true) |
|
| 28 | - $field->addIcon($icon, Direction::RIGHT); |
|
| 25 | + if (isset($placeholder) === true) { |
|
| 26 | + $field->setPlaceholder($placeholder); |
|
| 27 | + } |
|
| 28 | + if (isset($icon) === true) { |
|
| 29 | + $field->addIcon($icon, Direction::RIGHT); |
|
| 30 | + } |
|
| 29 | 31 | $field->getField()->setClass("prompt"); |
| 30 | 32 | $this->content["field"]=$field; |
| 31 | 33 | return $field; |
@@ -6,20 +6,20 @@ discard block |
||
| 6 | 6 | use Ajax\semantic\html\base\HtmlSemCollection; |
| 7 | 7 | use Ajax\semantic\html\base\constants\Sens; |
| 8 | 8 | |
| 9 | -class HtmlSegmentGroups extends HtmlSemCollection{ |
|
| 9 | +class HtmlSegmentGroups extends HtmlSemCollection { |
|
| 10 | 10 | |
| 11 | 11 | |
| 12 | - public function __construct( $identifier, $items=array()){ |
|
| 13 | - parent::__construct( $identifier, "div","ui segments"); |
|
| 12 | + public function __construct($identifier, $items=array()) { |
|
| 13 | + parent::__construct($identifier, "div", "ui segments"); |
|
| 14 | 14 | $this->addItems($items); |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | |
| 18 | - protected function createItem($value){ |
|
| 19 | - return new HtmlSegment("segment-".$this->count(),$value); |
|
| 18 | + protected function createItem($value) { |
|
| 19 | + return new HtmlSegment("segment-".$this->count(), $value); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - protected function createCondition($value){ |
|
| 22 | + protected function createCondition($value) { |
|
| 23 | 23 | return !($value instanceof HtmlSegment); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -28,16 +28,16 @@ discard block |
||
| 28 | 28 | * @param string $type one of "raised","stacked","piled" default : "" |
| 29 | 29 | * @return \Ajax\semantic\html\elements\HtmlSegmentGroups |
| 30 | 30 | */ |
| 31 | - public function setType($type){ |
|
| 31 | + public function setType($type) { |
|
| 32 | 32 | return $this->addToPropertyCtrl("class", $type, SegmentType::getConstants()); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function setSens($sens=Sens::VERTICAL){ |
|
| 35 | + public function setSens($sens=Sens::VERTICAL) { |
|
| 36 | 36 | return $this->addToPropertyCtrl("class", $sens, Sens::getConstants()); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - public static function group($identifier,$items=array(),$type="",$sens=Sens::VERTICAL){ |
|
| 40 | - $group=new HtmlSegmentGroups($identifier,$items); |
|
| 39 | + public static function group($identifier, $items=array(), $type="", $sens=Sens::VERTICAL) { |
|
| 40 | + $group=new HtmlSegmentGroups($identifier, $items); |
|
| 41 | 41 | $group->setSens($sens); |
| 42 | 42 | return $group->setType($type); |
| 43 | 43 | } |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | use IconTrait; |
| 14 | 14 | |
| 15 | 15 | public function __construct($identifier, $type="text", $value="", $placeholder="") { |
| 16 | - parent::__construct("div-" . $identifier, "div", "ui input"); |
|
| 17 | - $this->content=[ "field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder) ]; |
|
| 18 | - $this->_states=[ State::DISABLED,State::FOCUS,State::ERROR ]; |
|
| 19 | - $this->_variations=[ Variation::TRANSPARENT ]; |
|
| 16 | + parent::__construct("div-".$identifier, "div", "ui input"); |
|
| 17 | + $this->content=["field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder)]; |
|
| 18 | + $this->_states=[State::DISABLED, State::FOCUS, State::ERROR]; |
|
| 19 | + $this->_variations=[Variation::TRANSPARENT]; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public function setFocus() { |
@@ -24,38 +24,38 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function addLoading() { |
| 27 | - if ($this->_hasIcon === false) { |
|
| 27 | + if ($this->_hasIcon===false) { |
|
| 28 | 28 | throw new \Exception("Input must have an icon for showing a loader, use addIcon before"); |
| 29 | 29 | } |
| 30 | 30 | return $this->addToProperty("class", State::LOADING); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public function labeled($label, $direction=Direction::LEFT, $icon=NULL) { |
| 34 | - $labelO=$this->addLabel($label,$direction===Direction::LEFT,$icon); |
|
| 35 | - $this->addToProperty("class", $direction . " labeled"); |
|
| 34 | + $labelO=$this->addLabel($label, $direction===Direction::LEFT, $icon); |
|
| 35 | + $this->addToProperty("class", $direction." labeled"); |
|
| 36 | 36 | return $labelO; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function labeledToCorner($icon, $direction=Direction::LEFT) { |
| 40 | - return $this->labeled("", $direction . " corner", $icon)->toCorner($direction); |
|
| 40 | + return $this->labeled("", $direction." corner", $icon)->toCorner($direction); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) { |
| 44 | 44 | $actionO=$action; |
| 45 | - if (\is_object($action) === false) { |
|
| 46 | - $actionO=new HtmlButton("action-" . $this->identifier, $action); |
|
| 45 | + if (\is_object($action)===false) { |
|
| 46 | + $actionO=new HtmlButton("action-".$this->identifier, $action); |
|
| 47 | 47 | if (isset($icon)) |
| 48 | 48 | $actionO->addIcon($icon, true, $labeled); |
| 49 | 49 | } |
| 50 | - $this->addToProperty("class", $direction . " action"); |
|
| 51 | - $this->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
|
| 50 | + $this->addToProperty("class", $direction." action"); |
|
| 51 | + $this->addContent($actionO, \strstr($direction, Direction::LEFT)!==false); |
|
| 52 | 52 | return $actionO; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function addDropdown($label="", $items=array(),$direction=Direction::RIGHT){ |
|
| 56 | - $labelO=new HtmlDropdown("dd-".$this->identifier,$label,$items); |
|
| 57 | - $labelO->asSelect("select-".$this->identifier,false,true); |
|
| 58 | - return $this->labeled($labelO,$direction); |
|
| 55 | + public function addDropdown($label="", $items=array(), $direction=Direction::RIGHT) { |
|
| 56 | + $labelO=new HtmlDropdown("dd-".$this->identifier, $label, $items); |
|
| 57 | + $labelO->asSelect("select-".$this->identifier, false, true); |
|
| 58 | + return $this->labeled($labelO, $direction); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | public function getField() { |
@@ -44,8 +44,9 @@ |
||
| 44 | 44 | $actionO=$action; |
| 45 | 45 | if (\is_object($action) === false) { |
| 46 | 46 | $actionO=new HtmlButton("action-" . $this->identifier, $action); |
| 47 | - if (isset($icon)) |
|
| 48 | - $actionO->addIcon($icon, true, $labeled); |
|
| 47 | + if (isset($icon)) { |
|
| 48 | + $actionO->addIcon($icon, true, $labeled); |
|
| 49 | + } |
|
| 49 | 50 | } |
| 50 | 51 | $this->addToProperty("class", $direction . " action"); |
| 51 | 52 | $this->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
@@ -18,12 +18,12 @@ discard block |
||
| 18 | 18 | * @version 1.001 |
| 19 | 19 | */ |
| 20 | 20 | class HtmlSegment extends HtmlSemDoubleElement { |
| 21 | - use AttachedTrait,TextAlignmentTrait; |
|
| 21 | + use AttachedTrait, TextAlignmentTrait; |
|
| 22 | 22 | |
| 23 | 23 | public function __construct($identifier, $content="") { |
| 24 | 24 | parent::__construct($identifier, "div", "ui segment"); |
| 25 | - $this->_variations=\array_merge($this->_variations, [ Variation::PADDED,Variation::COMPACT ]); |
|
| 26 | - $this->_states=\array_merge($this->_states, [ State::LOADING ]); |
|
| 25 | + $this->_variations=\array_merge($this->_variations, [Variation::PADDED, Variation::COMPACT]); |
|
| 26 | + $this->_states=\array_merge($this->_states, [State::LOADING]); |
|
| 27 | 27 | $this->content=$content; |
| 28 | 28 | } |
| 29 | 29 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function setSens($sens="vertical") { |
| 40 | - return $this->addToPropertyCtrl("class", $sens, array ("vertical","horizontal" )); |
|
| 40 | + return $this->addToPropertyCtrl("class", $sens, array("vertical", "horizontal")); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function setEmphasis($value=Emphasis::SECONDARY) { |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | public function asContainer() { |
| 64 | - return $this->addToPropertyCtrl("class", "container", array ("container" )); |
|
| 64 | + return $this->addToPropertyCtrl("class", "container", array("container")); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - public function addGrid($numRows=1, $numCols=NULL){ |
|
| 68 | - $grid=new HtmlGrid("Grid-".$this->identifier,$numRows,$numCols); |
|
| 67 | + public function addGrid($numRows=1, $numCols=NULL) { |
|
| 68 | + $grid=new HtmlGrid("Grid-".$this->identifier, $numRows, $numCols); |
|
| 69 | 69 | $this->content=$grid; |
| 70 | 70 | return $grid; |
| 71 | 71 | } |