@@ -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,20 +50,20 @@ 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(!$item instanceof HtmlDropdownItem){ |
|
| 65 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
|
| 66 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 64 | + if (!$item instanceof HtmlDropdownItem) { |
|
| 65 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image); |
|
| 66 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
| 67 | 67 | $this->addToProperty("class", "vertical"); |
| 68 | 68 | } |
| 69 | 69 | return $itemO; |
@@ -76,76 +76,76 @@ discard block |
||
| 76 | 76 | $this->addItem($function($object)); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - public function addInput($name){ |
|
| 80 | - if(!isset($name)) |
|
| 79 | + public function addInput($name) { |
|
| 80 | + if (!isset($name)) |
|
| 81 | 81 | $name="input-".$this->identifier; |
| 82 | 82 | $this->setAction("activate"); |
| 83 | - $this->input=new HtmlInput($name,"hidden"); |
|
| 83 | + $this->input=new HtmlInput($name, "hidden"); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - public function addItems($items){ |
|
| 87 | - if(JArray::isAssociative($items)){ |
|
| 88 | - foreach ($items as $k=>$v){ |
|
| 86 | + public function addItems($items) { |
|
| 87 | + if (JArray::isAssociative($items)) { |
|
| 88 | + foreach ($items as $k=>$v) { |
|
| 89 | 89 | $this->addItem($v)->setData($k); |
| 90 | 90 | } |
| 91 | - }else{ |
|
| 92 | - foreach ($items as $item){ |
|
| 91 | + }else { |
|
| 92 | + foreach ($items as $item) { |
|
| 93 | 93 | $this->addItem($item); |
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - public function count(){ |
|
| 98 | + public function count() { |
|
| 99 | 99 | return \sizeof($this->items); |
| 100 | 100 | } |
| 101 | 101 | /** |
| 102 | 102 | * @param boolean $dropdown |
| 103 | 103 | */ |
| 104 | - public function asDropdown($dropdown){ |
|
| 105 | - if($dropdown===false){ |
|
| 104 | + public function asDropdown($dropdown) { |
|
| 105 | + if ($dropdown===false) { |
|
| 106 | 106 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 107 | 107 | $dropdown="menu"; |
| 108 | - }else{ |
|
| 108 | + }else { |
|
| 109 | 109 | $dropdown="dropdown"; |
| 110 | 110 | $this->mClass="menu"; |
| 111 | 111 | } |
| 112 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
| 112 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - public function setVertical(){ |
|
| 116 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
| 115 | + public function setVertical() { |
|
| 116 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - public function setSimple(){ |
|
| 120 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
| 119 | + public function setSimple() { |
|
| 120 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public function asButton($floating=false){ |
|
| 124 | - if($floating) |
|
| 123 | + public function asButton($floating=false) { |
|
| 124 | + if ($floating) |
|
| 125 | 125 | $this->addToProperty("class", "floating"); |
| 126 | 126 | return $this->addToProperty("class", "button"); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
| 130 | - if(isset($name)) |
|
| 129 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
| 130 | + if (isset($name)) |
|
| 131 | 131 | $this->addInput($name); |
| 132 | - if($multiple) |
|
| 132 | + if ($multiple) |
|
| 133 | 133 | $this->addToProperty("class", "multiple"); |
| 134 | 134 | if ($selection) |
| 135 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 135 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
| 136 | 136 | return $this; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - public function asSearch($name=NULL,$multiple=false,$selection=false){ |
|
| 140 | - $this->asSelect($name,$multiple,$selection); |
|
| 139 | + public function asSearch($name=NULL, $multiple=false, $selection=false) { |
|
| 140 | + $this->asSelect($name, $multiple, $selection); |
|
| 141 | 141 | return $this->addToProperty("class", "search"); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - public function setSelect($name=NULL,$multiple=false){ |
|
| 145 | - if(!isset($name)) |
|
| 144 | + public function setSelect($name=NULL, $multiple=false) { |
|
| 145 | + if (!isset($name)) |
|
| 146 | 146 | $name="select-".$this->identifier; |
| 147 | 147 | $this->input=null; |
| 148 | - if($multiple){ |
|
| 148 | + if ($multiple) { |
|
| 149 | 149 | $this->setProperty("multiple", true); |
| 150 | 150 | $this->addToProperty("class", "multiple"); |
| 151 | 151 | } |
@@ -153,32 +153,32 @@ discard block |
||
| 153 | 153 | $this->tagName="select"; |
| 154 | 154 | $this->setProperty("name", $name); |
| 155 | 155 | $this->content=null; |
| 156 | - foreach ($this->items as $item){ |
|
| 156 | + foreach ($this->items as $item) { |
|
| 157 | 157 | $item->asOption(); |
| 158 | 158 | } |
| 159 | 159 | return $this; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - public function asSubmenu($pointing=NULL){ |
|
| 162 | + public function asSubmenu($pointing=NULL) { |
|
| 163 | 163 | $this->setClass("ui dropdown link item"); |
| 164 | - if(isset($pointing)){ |
|
| 164 | + if (isset($pointing)) { |
|
| 165 | 165 | $this->setPointing($pointing); |
| 166 | 166 | } |
| 167 | 167 | return $this; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - public function setPointing($value=Direction::NONE){ |
|
| 171 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
| 170 | + public function setPointing($value=Direction::NONE) { |
|
| 171 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - public function setValue($value){ |
|
| 175 | - if(isset($this->input)){ |
|
| 174 | + public function setValue($value) { |
|
| 175 | + if (isset($this->input)) { |
|
| 176 | 176 | $this->input->setProperty("value", $value); |
| 177 | - }else{ |
|
| 177 | + }else { |
|
| 178 | 178 | $this->setProperty("value", $value); |
| 179 | 179 | } |
| 180 | 180 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
| 181 | - if(isset($textElement)) |
|
| 181 | + if (isset($textElement)) |
|
| 182 | 182 | $textElement->setContent($value); |
| 183 | 183 | return $this; |
| 184 | 184 | } |
@@ -188,19 +188,19 @@ discard block |
||
| 188 | 188 | * @see BaseHtml::run() |
| 189 | 189 | */ |
| 190 | 190 | public function run(JsUtils $js) { |
| 191 | - if($this->propertyContains("class", "simple")===false){ |
|
| 192 | - if(isset($this->_bsComponent)===false) |
|
| 193 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->params); |
|
| 191 | + if ($this->propertyContains("class", "simple")===false) { |
|
| 192 | + if (isset($this->_bsComponent)===false) |
|
| 193 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->params); |
|
| 194 | 194 | $this->addEventsOnRun($js); |
| 195 | 195 | return $this->_bsComponent; |
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - public function setAction($action){ |
|
| 199 | + public function setAction($action) { |
|
| 200 | 200 | $this->params["action"]=$action; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - public function setFullTextSearch($value){ |
|
| 203 | + public function setFullTextSearch($value) { |
|
| 204 | 204 | $this->params["fullTextSearch"]=$value; |
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | \ No newline at end of file |
@@ -13,17 +13,17 @@ |
||
| 13 | 13 | * @param boolean $labeled |
| 14 | 14 | * @return \Ajax\semantic\html\elements\HtmlIcon |
| 15 | 15 | */ |
| 16 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
| 16 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
| 17 | 17 | $iconO=$icon; |
| 18 | - if(\is_string($icon)){ |
|
| 18 | + if (\is_string($icon)) { |
|
| 19 | 19 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
| 20 | 20 | } |
| 21 | - if($labeled!==false){ |
|
| 22 | - $direction=($before===true)?Direction::LEFT:Direction::RIGHT; |
|
| 21 | + if ($labeled!==false) { |
|
| 22 | + $direction=($before===true) ? Direction::LEFT : Direction::RIGHT; |
|
| 23 | 23 | $this->addToProperty("class", $direction." labeled icon"); |
| 24 | 24 | $this->tagName="div"; |
| 25 | 25 | } |
| 26 | - $this->addContent($iconO,$before); |
|
| 26 | + $this->addContent($iconO, $before); |
|
| 27 | 27 | return $iconO; |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | \ No newline at end of file |
@@ -5,8 +5,8 @@ |
||
| 5 | 5 | use Ajax\common\BaseEnum; |
| 6 | 6 | |
| 7 | 7 | abstract class Color extends BaseEnum { |
| 8 | - const STANDARD="",RED="red",ORANGE="orange",YELLOW="yellow", |
|
| 9 | - OLIVE="olive",GREEN="green",TEAL="teal", |
|
| 10 | - BLUE="blue",VIOLET="violet",PURPLE="purple", |
|
| 11 | - PINK="pink",BROWN="brown",GREY="grey",BLACK="black"; |
|
| 8 | + const STANDARD="", RED="red", ORANGE="orange", YELLOW="yellow", |
|
| 9 | + OLIVE="olive", GREEN="green", TEAL="teal", |
|
| 10 | + BLUE="blue", VIOLET="violet", PURPLE="purple", |
|
| 11 | + PINK="pink", BROWN="brown", GREY="grey", BLACK="black"; |
|
| 12 | 12 | } |
| 13 | 13 | \ No newline at end of file |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * @param string $onClick JS Code for click event |
| 23 | 23 | */ |
| 24 | 24 | public function __construct($identifier, $value="", $cssStyle=null, $onClick=null) { |
| 25 | - parent::__construct($identifier, "button","ui button"); |
|
| 25 | + parent::__construct($identifier, "button", "ui button"); |
|
| 26 | 26 | $this->content=$value; |
| 27 | 27 | if (isset($cssStyle)) { |
| 28 | 28 | $this->setStyle($cssStyle); |
@@ -48,28 +48,28 @@ discard block |
||
| 48 | 48 | * @return \Ajax\semantic\html\HtmlButton default : "" |
| 49 | 49 | */ |
| 50 | 50 | public function setStyle($cssStyle) { |
| 51 | - return $this->addToProperty("class",$cssStyle); |
|
| 51 | + return $this->addToProperty("class", $cssStyle); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - public function setFocusable($value=true){ |
|
| 55 | - if($value===true) |
|
| 54 | + public function setFocusable($value=true) { |
|
| 55 | + if ($value===true) |
|
| 56 | 56 | $this->setProperty("tabindex", "0"); |
| 57 | - else{ |
|
| 57 | + else { |
|
| 58 | 58 | $this->removeProperty("tabindex"); |
| 59 | 59 | } |
| 60 | 60 | return $this; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - public function setAnimated($content,$animation=""){ |
|
| 63 | + public function setAnimated($content, $animation="") { |
|
| 64 | 64 | $this->setTagName("div"); |
| 65 | 65 | $this->addToProperty("class", "animated ".$animation); |
| 66 | - $visible=new HtmlSemDoubleElement("visible-".$this->identifier,"div"); |
|
| 66 | + $visible=new HtmlSemDoubleElement("visible-".$this->identifier, "div"); |
|
| 67 | 67 | $visible->setClass("visible content"); |
| 68 | 68 | $visible->setContent($this->content); |
| 69 | - $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier,"div"); |
|
| 69 | + $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier, "div"); |
|
| 70 | 70 | $hidden->setClass("hidden content"); |
| 71 | 71 | $hidden->setContent($content); |
| 72 | - $this->content=array($visible,$hidden); |
|
| 72 | + $this->content=array($visible, $hidden); |
|
| 73 | 73 | return $hidden; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | * @param string|HtmlIcon $icon |
| 78 | 78 | * @return \Ajax\semantic\html\elements\HtmlButton |
| 79 | 79 | */ |
| 80 | - public function asIcon($icon){ |
|
| 80 | + public function asIcon($icon) { |
|
| 81 | 81 | $iconO=$icon; |
| 82 | - if(\is_string($icon)){ |
|
| 82 | + if (\is_string($icon)) { |
|
| 83 | 83 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
| 84 | 84 | } |
| 85 | 85 | $this->addToProperty("class", "icon"); |
@@ -93,14 +93,14 @@ discard block |
||
| 93 | 93 | * @param string $before |
| 94 | 94 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 95 | 95 | */ |
| 96 | - public function addLabel($caption,$before=false){ |
|
| 96 | + public function addLabel($caption, $before=false) { |
|
| 97 | 97 | $this->tagName="div"; |
| 98 | 98 | $this->addToProperty("class", "labeled"); |
| 99 | - $this->content=new HtmlButton("button-".$this->identifier,$this->content); |
|
| 99 | + $this->content=new HtmlButton("button-".$this->identifier, $this->content); |
|
| 100 | 100 | $this->content->setTagName("div"); |
| 101 | - $label=new HtmlLabel("label-".$this->identifier,$caption,"a"); |
|
| 101 | + $label=new HtmlLabel("label-".$this->identifier, $caption, "a"); |
|
| 102 | 102 | $label->setBasic(); |
| 103 | - $this->addContent($label,$before); |
|
| 103 | + $this->addContent($label, $before); |
|
| 104 | 104 | return $label; |
| 105 | 105 | } |
| 106 | 106 | /* |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function fromArray($array) { |
| 111 | 111 | $array=parent::fromArray($array); |
| 112 | - foreach ( $array as $key => $value ) { |
|
| 112 | + foreach ($array as $key => $value) { |
|
| 113 | 113 | $this->setProperty($key, $value); |
| 114 | 114 | } |
| 115 | 115 | return $array; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | * show it is currently the active user selection |
| 120 | 120 | * @return \Ajax\semantic\html\elements\HtmlButton |
| 121 | 121 | */ |
| 122 | - public function setActive(){ |
|
| 122 | + public function setActive() { |
|
| 123 | 123 | return $this->addToProperty("class", "active"); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * hint towards a positive consequence |
| 128 | 128 | * @return \Ajax\semantic\html\elements\HtmlButton |
| 129 | 129 | */ |
| 130 | - public function setPositive(){ |
|
| 130 | + public function setPositive() { |
|
| 131 | 131 | return $this->addToProperty("class", "positive"); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * hint towards a negative consequence |
| 136 | 136 | * @return \Ajax\semantic\html\elements\HtmlButton |
| 137 | 137 | */ |
| 138 | - public function setNegative(){ |
|
| 138 | + public function setNegative() { |
|
| 139 | 139 | return $this->addToProperty("class", "negative"); |
| 140 | 140 | } |
| 141 | 141 | |
@@ -143,14 +143,14 @@ discard block |
||
| 143 | 143 | * formatted to toggle on/off |
| 144 | 144 | * @return \Ajax\semantic\html\elements\HtmlButton |
| 145 | 145 | */ |
| 146 | - public function setToggle(){ |
|
| 146 | + public function setToggle() { |
|
| 147 | 147 | return $this->addToProperty("class", "toggle"); |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
| 151 | 151 | * @return \Ajax\semantic\html\elements\HtmlButton |
| 152 | 152 | */ |
| 153 | - public function setCircular(){ |
|
| 153 | + public function setCircular() { |
|
| 154 | 154 | return $this->addToProperty("class", "circular"); |
| 155 | 155 | } |
| 156 | 156 | |
@@ -158,15 +158,15 @@ discard block |
||
| 158 | 158 | * button is less pronounced |
| 159 | 159 | * @return \Ajax\semantic\html\elements\HtmlButton |
| 160 | 160 | */ |
| 161 | - public function setBasic(){ |
|
| 161 | + public function setBasic() { |
|
| 162 | 162 | return $this->addToProperty("class", "basic"); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - public function setEmphasis($value){ |
|
| 165 | + public function setEmphasis($value) { |
|
| 166 | 166 | return $this->addToPropertyCtrl("class", $value, Emphasis::getConstants()); |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - public function setLoading(){ |
|
| 169 | + public function setLoading() { |
|
| 170 | 170 | return $this->addToProperty("class", "loading"); |
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | \ No newline at end of file |
@@ -11,35 +11,35 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | class HtmlButtonGroups extends HtmlSemDoubleElement { |
| 13 | 13 | |
| 14 | - public function __construct($identifier, $elements=array(),$asIcons=false) { |
|
| 15 | - parent::__construct($identifier, "div","ui buttons"); |
|
| 14 | + public function __construct($identifier, $elements=array(), $asIcons=false) { |
|
| 15 | + parent::__construct($identifier, "div", "ui buttons"); |
|
| 16 | 16 | $this->content=array(); |
| 17 | - if($asIcons===true) |
|
| 17 | + if ($asIcons===true) |
|
| 18 | 18 | $this->asIcons(); |
| 19 | - $this->addElements($elements,$asIcons); |
|
| 19 | + $this->addElements($elements, $asIcons); |
|
| 20 | 20 | } |
| 21 | - public function addElement($element,$asIcon=false){ |
|
| 21 | + public function addElement($element, $asIcon=false) { |
|
| 22 | 22 | $elementO=$element; |
| 23 | - if(\is_string($element)){ |
|
| 24 | - if($asIcon){ |
|
| 23 | + if (\is_string($element)) { |
|
| 24 | + if ($asIcon) { |
|
| 25 | 25 | $elementO=new HtmlButton("button-".\sizeof($this->content)); |
| 26 | 26 | $elementO->asIcon($element); |
| 27 | 27 | }else |
| 28 | - $elementO=new HtmlButton("button-".\sizeof($this->content),$element); |
|
| 28 | + $elementO=new HtmlButton("button-".\sizeof($this->content), $element); |
|
| 29 | 29 | } |
| 30 | 30 | $this->addContent($elementO); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
| 34 | - public function addElements($elements,$asIcons=false) { |
|
| 35 | - foreach ( $elements as $element ) { |
|
| 36 | - $this->addElement($element,$asIcons); |
|
| 34 | + public function addElements($elements, $asIcons=false) { |
|
| 35 | + foreach ($elements as $element) { |
|
| 36 | + $this->addElement($element, $asIcons); |
|
| 37 | 37 | } |
| 38 | 38 | return $this; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function insertOr($aferIndex=0,$or="or"){ |
|
| 42 | - $orElement=new HtmlSemDoubleElement("or-".$this->identifier,"div","or"); |
|
| 41 | + public function insertOr($aferIndex=0, $or="or") { |
|
| 42 | + $orElement=new HtmlSemDoubleElement("or-".$this->identifier, "div", "or"); |
|
| 43 | 43 | $orElement->setProperty("data-text", $or); |
| 44 | 44 | array_splice($this->content, $aferIndex+1, 0, array($orElement)); |
| 45 | 45 | return $this; |
@@ -52,18 +52,18 @@ discard block |
||
| 52 | 52 | $this->addElements($array); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function asIcons(){ |
|
| 56 | - foreach ($this->content as $item){ |
|
| 55 | + public function asIcons() { |
|
| 56 | + foreach ($this->content as $item) { |
|
| 57 | 57 | $item->asIcon($item->getContent()); |
| 58 | 58 | } |
| 59 | 59 | return $this->addToProperty("class", "icons"); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public function setVertical(){ |
|
| 62 | + public function setVertical() { |
|
| 63 | 63 | return $this->addToProperty("class", "vertical"); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - public function setLabeled(){ |
|
| 66 | + public function setLabeled() { |
|
| 67 | 67 | return $this->addToProperty("class", "labeled icon"); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
| 92 | 92 | */ |
| 93 | 93 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 94 | - foreach ( $this->content as $element ) { |
|
| 94 | + foreach ($this->content as $element) { |
|
| 95 | 95 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
| 96 | 96 | } |
| 97 | 97 | return $this; |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | * @param string $action one of "select","auto","activate","combo","nothing","hide" |
| 18 | 18 | * @return \Ajax\semantic\components\Dropdown |
| 19 | 19 | */ |
| 20 | - public function setAction($action){ |
|
| 21 | - return $this->setParamCtrl("action", $action,array("select","auto","activate","combo","nothing","hide")); |
|
| 20 | + public function setAction($action) { |
|
| 21 | + return $this->setParamCtrl("action", $action, array("select", "auto", "activate", "combo", "nothing", "hide")); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -26,11 +26,11 @@ discard block |
||
| 26 | 26 | * @param string $event Event used to trigger dropdown (Hover, Click, Custom Event) |
| 27 | 27 | * @return \Ajax\semantic\components\Dropdown |
| 28 | 28 | */ |
| 29 | - public function setOn($event){ |
|
| 29 | + public function setOn($event) { |
|
| 30 | 30 | return $this->setParam("on", $event); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function setFullTextSearch($value){ |
|
| 33 | + public function setFullTextSearch($value) { |
|
| 34 | 34 | return $this->setParam("fullTextSearch", $value); |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | \ No newline at end of file |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | abstract class BaseHtml extends BaseWidget { |
| 17 | 17 | protected $_template; |
| 18 | 18 | protected $tagName; |
| 19 | - protected $properties=array (); |
|
| 20 | - protected $events=array (); |
|
| 19 | + protected $properties=array(); |
|
| 20 | + protected $events=array(); |
|
| 21 | 21 | protected $wrapBefore=""; |
| 22 | 22 | protected $wrapAfter=""; |
| 23 | 23 | protected $_bsComponent; |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | public function addToProperty($name, $value, $separator=" ") { |
| 58 | 58 | $v=@$this->properties[$name]; |
| 59 | - if (isset($v)&&$v!=="") |
|
| 59 | + if (isset($v) && $v!=="") |
|
| 60 | 60 | $v=$v.$separator.$value; |
| 61 | 61 | else |
| 62 | 62 | $v=$value; |
@@ -71,11 +71,11 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 73 | 73 | $result=$this->getTemplate(); |
| 74 | - foreach ( $this as $key => $value ) { |
|
| 75 | - if (PhalconUtils::startsWith($key, "_")===false&&$key!=="events") { |
|
| 74 | + foreach ($this as $key => $value) { |
|
| 75 | + if (PhalconUtils::startsWith($key, "_")===false && $key!=="events") { |
|
| 76 | 76 | if (is_array($value)) { |
| 77 | 77 | $v=PropertyWrapper::wrap($value, $js); |
| 78 | - } else { |
|
| 78 | + }else { |
|
| 79 | 79 | $v=$value; |
| 80 | 80 | } |
| 81 | 81 | $result=str_ireplace("%".$key."%", $v, $result); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | if (isset($view)===true) { |
| 88 | 88 | $controls=$view->getVar("q"); |
| 89 | 89 | if (isset($controls)===false) { |
| 90 | - $controls=array (); |
|
| 90 | + $controls=array(); |
|
| 91 | 91 | } |
| 92 | 92 | $controls [$this->identifier]=$result; |
| 93 | 93 | $view->setVar("q", $controls); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | if (array_search($value, $typeCtrl)===false) { |
| 101 | 101 | throw new \Exception("La valeur passée a propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
| 102 | 102 | } |
| 103 | - } else { |
|
| 103 | + }else { |
|
| 104 | 104 | if (!$typeCtrl($value)) { |
| 105 | 105 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
| 106 | 106 | } |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | return true; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - protected function propertyContains($propertyName,$value){ |
|
| 111 | + protected function propertyContains($propertyName, $value) { |
|
| 112 | 112 | $values=$this->getProperty($propertyName); |
| 113 | - if(isset($values)){ |
|
| 113 | + if (isset($values)) { |
|
| 114 | 114 | return JString::contains($values, $value); |
| 115 | 115 | } |
| 116 | 116 | return false; |
@@ -137,13 +137,13 @@ discard block |
||
| 137 | 137 | return $this; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - protected function removePropertyValue($name,$value){ |
|
| 140 | + protected function removePropertyValue($name, $value) { |
|
| 141 | 141 | $this->properties[$name]=\str_replace($value, "", $this->properties[$name]); |
| 142 | 142 | return $this; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - protected function removeProperty($name){ |
|
| 146 | - if(\array_key_exists($name, $this->properties)) |
|
| 145 | + protected function removeProperty($name) { |
|
| 146 | + if (\array_key_exists($name, $this->properties)) |
|
| 147 | 147 | unset($this->properties[$name]); |
| 148 | 148 | return $this; |
| 149 | 149 | } |
@@ -196,28 +196,28 @@ discard block |
||
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | public function fromArray($array) { |
| 199 | - foreach ( $this as $key => $value ) { |
|
| 199 | + foreach ($this as $key => $value) { |
|
| 200 | 200 | if (array_key_exists($key, $array) && !PhalconUtils::startsWith($key, "_")) { |
| 201 | 201 | $setter="set".ucfirst($key); |
| 202 | 202 | $this->$setter($array [$key]); |
| 203 | 203 | unset($array [$key]); |
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | - foreach ( $array as $key => $value ) { |
|
| 206 | + foreach ($array as $key => $value) { |
|
| 207 | 207 | if (method_exists($this, $key)) { |
| 208 | 208 | try { |
| 209 | 209 | $this->$key($value); |
| 210 | 210 | unset($array [$key]); |
| 211 | - } catch ( \Exception $e ) { |
|
| 211 | + } catch (\Exception $e) { |
|
| 212 | 212 | // Nothing to do |
| 213 | 213 | } |
| 214 | - } else { |
|
| 214 | + }else { |
|
| 215 | 215 | $setter="set".ucfirst($key); |
| 216 | 216 | if (method_exists($this, $setter)) { |
| 217 | 217 | try { |
| 218 | 218 | $this->$setter($value); |
| 219 | 219 | unset($array [$key]); |
| 220 | - } catch ( \Exception $e ) { |
|
| 220 | + } catch (\Exception $e) { |
|
| 221 | 221 | // Nothing to do |
| 222 | 222 | } |
| 223 | 223 | } |
@@ -226,21 +226,21 @@ discard block |
||
| 226 | 226 | return $array; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - public function fromDatabaseObjects($objects,$function) { |
|
| 230 | - if(isset($objects)){ |
|
| 231 | - foreach ($objects as $object){ |
|
| 232 | - $this->fromDatabaseObject($object,$function); |
|
| 229 | + public function fromDatabaseObjects($objects, $function) { |
|
| 230 | + if (isset($objects)) { |
|
| 231 | + foreach ($objects as $object) { |
|
| 232 | + $this->fromDatabaseObject($object, $function); |
|
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | return $this; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - public function fromDatabaseObject($object,$function){ |
|
| 238 | + public function fromDatabaseObject($object, $function) { |
|
| 239 | 239 | |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | public function wrap($before, $after="") { |
| 243 | - if(isset($before)){ |
|
| 243 | + if (isset($before)) { |
|
| 244 | 244 | $this->wrapBefore.=$before; |
| 245 | 245 | } |
| 246 | 246 | $this->wrapAfter=$after.$this->wrapAfter; |
@@ -262,13 +262,13 @@ discard block |
||
| 262 | 262 | if (array_key_exists($event, $this->events)) { |
| 263 | 263 | if (is_array($this->events [$event])) { |
| 264 | 264 | $this->events [$event] []=$jsCode; |
| 265 | - } else { |
|
| 266 | - $this->events [$event]=array ( |
|
| 265 | + }else { |
|
| 266 | + $this->events [$event]=array( |
|
| 267 | 267 | $this->events [$event], |
| 268 | 268 | $jsCode |
| 269 | 269 | ); |
| 270 | 270 | } |
| 271 | - } else { |
|
| 271 | + }else { |
|
| 272 | 272 | $this->events [$event]=$jsCode; |
| 273 | 273 | } |
| 274 | 274 | } |
@@ -287,14 +287,14 @@ discard block |
||
| 287 | 287 | |
| 288 | 288 | public function addEventsOnRun(JsUtils $js) { |
| 289 | 289 | if (isset($this->_bsComponent)) { |
| 290 | - foreach ( $this->events as $event => $jsCode ) { |
|
| 290 | + foreach ($this->events as $event => $jsCode) { |
|
| 291 | 291 | $code=$jsCode; |
| 292 | 292 | if (is_array($jsCode)) { |
| 293 | 293 | $code=""; |
| 294 | - foreach ( $jsCode as $jsC ) { |
|
| 294 | + foreach ($jsCode as $jsC) { |
|
| 295 | 295 | if ($jsC instanceof AjaxCall) { |
| 296 | 296 | $code.="\n".$jsC->compile($js); |
| 297 | - } else { |
|
| 297 | + }else { |
|
| 298 | 298 | $code.="\n".$jsC; |
| 299 | 299 | } |
| 300 | 300 | } |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 311 | - $params=array ( |
|
| 311 | + $params=array( |
|
| 312 | 312 | "url" => $url, |
| 313 | 313 | "responseElement" => $responseElement |
| 314 | 314 | ); |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | if (is_array($elements)) { |
| 348 | 348 | $flag=false; |
| 349 | 349 | $index=0; |
| 350 | - while ( !$flag&&$index<sizeof($elements) ) { |
|
| 350 | + while (!$flag && $index<sizeof($elements)) { |
|
| 351 | 351 | if ($elements [$index] instanceof BaseHtml) |
| 352 | 352 | $flag=($elements [$index]->getIdentifier()===$identifier); |
| 353 | 353 | $index++; |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | return null; |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | - public function __toString(){ |
|
| 364 | + public function __toString() { |
|
| 365 | 365 | return $this->compile(); |
| 366 | 366 | } |
| 367 | 367 | |
@@ -377,25 +377,25 @@ discard block |
||
| 377 | 377 | if (is_array($value)) { |
| 378 | 378 | $value=implode(",", $value); |
| 379 | 379 | } |
| 380 | - if (strrpos($value, 'this')===false&&strrpos($value, 'event')===false) { |
|
| 380 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false) { |
|
| 381 | 381 | $value='"'.$value.'"'; |
| 382 | 382 | } |
| 383 | 383 | return $value; |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | - public function jsDoJquery($jqueryCall, $param=""){ |
|
| 386 | + public function jsDoJquery($jqueryCall, $param="") { |
|
| 387 | 387 | return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");"; |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | - public function jsHtml($content=""){ |
|
| 391 | - return $this->jsDoJquery("html",$content); |
|
| 390 | + public function jsHtml($content="") { |
|
| 391 | + return $this->jsDoJquery("html", $content); |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | - public function jsShow(){ |
|
| 394 | + public function jsShow() { |
|
| 395 | 395 | return $this->jsDoJquery("show"); |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - public function jsHide(){ |
|
| 398 | + public function jsHide() { |
|
| 399 | 399 | return $this->jsDoJquery("hide"); |
| 400 | 400 | } |
| 401 | 401 | |