@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | if(is_array($element)){ |
| 68 | 68 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size); |
| 69 | 69 | $elm->fromArray($element); |
| 70 | - }else if($element instanceof HtmlLink){ |
|
| 70 | + } else if($element instanceof HtmlLink){ |
|
| 71 | 71 | $elm=$element; |
| 72 | - }else{ |
|
| 72 | + } else{ |
|
| 73 | 73 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size,$href,$element); |
| 74 | 74 | if(isset($glyph)){ |
| 75 | 75 | $elm->wrapContentWithGlyph($glyph); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | if($this->absolutePaths===true){ |
| 118 | 118 | return $this->_hrefFunction($this->content[$index]); |
| 119 | - }else{ |
|
| 119 | + } else{ |
|
| 120 | 120 | return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),0,$index+1)); |
| 121 | 121 | } |
| 122 | 122 | } |
@@ -41,15 +41,15 @@ discard block |
||
| 41 | 41 | * @param boolean $autoActive sets the last element's class to <b>active</b> if true |
| 42 | 42 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
| 43 | 43 | */ |
| 44 | - public function __construct($identifier,$elements=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
|
| 45 | - parent::__construct($identifier,"ol"); |
|
| 44 | + public function __construct($identifier, $elements=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
| 45 | + parent::__construct($identifier, "ol"); |
|
| 46 | 46 | $this->startIndex=$startIndex; |
| 47 | 47 | $this->setProperty("class", "breadcrumb"); |
| 48 | 48 | $this->content=array(); |
| 49 | 49 | $this->autoActive=$autoActive; |
| 50 | 50 | $this->absolutePaths; |
| 51 | - $this->_hrefFunction=function ($e){return $e->getContent();}; |
|
| 52 | - if(isset($hrefFunction)){ |
|
| 51 | + $this->_hrefFunction=function($e) {return $e->getContent(); }; |
|
| 52 | + if (isset($hrefFunction)) { |
|
| 53 | 53 | $this->_hrefFunction=$hrefFunction; |
| 54 | 54 | } |
| 55 | 55 | $this->addElements($elements); |
@@ -60,43 +60,43 @@ discard block |
||
| 60 | 60 | * @param string $href |
| 61 | 61 | * @return \Ajax\bootstrap\html\HtmlLink |
| 62 | 62 | */ |
| 63 | - public function addElement($element,$href="",$glyph=NULL){ |
|
| 63 | + public function addElement($element, $href="", $glyph=NULL) { |
|
| 64 | 64 | $size=sizeof($this->content); |
| 65 | - if(is_array($element)){ |
|
| 65 | + if (is_array($element)) { |
|
| 66 | 66 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size); |
| 67 | 67 | $elm->fromArray($element); |
| 68 | - }else if($element instanceof HtmlLink){ |
|
| 68 | + }else if ($element instanceof HtmlLink) { |
|
| 69 | 69 | $elm=$element; |
| 70 | - }else{ |
|
| 71 | - $elm=new HtmlLink("lnk-".$this->identifier."-".$size,$href,$element); |
|
| 72 | - if(isset($glyph)){ |
|
| 70 | + }else { |
|
| 71 | + $elm=new HtmlLink("lnk-".$this->identifier."-".$size, $href, $element); |
|
| 72 | + if (isset($glyph)) { |
|
| 73 | 73 | $elm->wrapContentWithGlyph($glyph); |
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | - $elm->wrap("<li>","</li>"); |
|
| 76 | + $elm->wrap("<li>", "</li>"); |
|
| 77 | 77 | $this->content[]=$elm; |
| 78 | 78 | $elm->setProperty($this->attr, $this->getHref($size)); |
| 79 | 79 | return $elm; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public function setActive($index=null){ |
|
| 83 | - if(!isset($index)){ |
|
| 82 | + public function setActive($index=null) { |
|
| 83 | + if (!isset($index)) { |
|
| 84 | 84 | $index=sizeof($this->content)-1; |
| 85 | 85 | } |
| 86 | - $li=new HtmlBsDoubleElement("","li"); |
|
| 86 | + $li=new HtmlBsDoubleElement("", "li"); |
|
| 87 | 87 | $li->setClass("active"); |
| 88 | 88 | $li->setContent($this->content[$index]->getContent()); |
| 89 | 89 | $this->content[$index]=$li; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - public function addElements($elements){ |
|
| 93 | - foreach ( $elements as $element ) { |
|
| 92 | + public function addElements($elements) { |
|
| 93 | + foreach ($elements as $element) { |
|
| 94 | 94 | $this->addElement($element); |
| 95 | 95 | } |
| 96 | 96 | return $this; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - public function fromArray($array){ |
|
| 99 | + public function fromArray($array) { |
|
| 100 | 100 | $array=parent::fromArray($array); |
| 101 | 101 | $this->addElements($array); |
| 102 | 102 | return $array; |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | * @param string $separator |
| 109 | 109 | * @return string |
| 110 | 110 | */ |
| 111 | - public function getHref($index=null,$separator="/"){ |
|
| 112 | - if(!isset($index)){ |
|
| 111 | + public function getHref($index=null, $separator="/") { |
|
| 112 | + if (!isset($index)) { |
|
| 113 | 113 | $index=sizeof($this->content); |
| 114 | 114 | } |
| 115 | - if($this->absolutePaths===true){ |
|
| 115 | + if ($this->absolutePaths===true) { |
|
| 116 | 116 | return $this->_hrefFunction($this->content[$index]); |
| 117 | - }else{ |
|
| 118 | - return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),$this->startIndex,$index+1)); |
|
| 117 | + }else { |
|
| 118 | + return $this->root.implode($separator, array_slice(array_map(function($e) {return $this->_hrefFunction($e); }, $this->content), $this->startIndex, $index+1)); |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @see \Ajax\bootstrap\html\BaseHtml::compile() |
| 125 | 125 | */ |
| 126 | 126 | public function compile(JsUtils $js=NULL, $view=NULL) { |
| 127 | - if($this->autoActive){ |
|
| 127 | + if ($this->autoActive) { |
|
| 128 | 128 | $this->setActive(); |
| 129 | 129 | } |
| 130 | 130 | return parent::compile($js, $view); |
@@ -142,19 +142,19 @@ discard block |
||
| 142 | 142 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
| 143 | 143 | */ |
| 144 | 144 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 145 | - foreach ($this->content as $element){ |
|
| 146 | - $element->on($event,$jsCode,$stopPropagation,$preventDefault); |
|
| 145 | + foreach ($this->content as $element) { |
|
| 146 | + $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
|
| 147 | 147 | } |
| 148 | 148 | return $this; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | public function setAutoActive($autoActive) { |
| 152 | - $this->autoActive = $autoActive; |
|
| 152 | + $this->autoActive=$autoActive; |
|
| 153 | 153 | return $this; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 157 | - foreach ($this->content as $element){ |
|
| 157 | + foreach ($this->content as $element) { |
|
| 158 | 158 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
| 159 | 159 | } |
| 160 | 160 | return $this; |
@@ -166,18 +166,18 @@ discard block |
||
| 166 | 166 | * @param string $targetSelector the target of the get |
| 167 | 167 | * @return HtmlBreadcrumbs |
| 168 | 168 | */ |
| 169 | - public function autoGetOnClick($targetSelector){ |
|
| 170 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
| 169 | + public function autoGetOnClick($targetSelector) { |
|
| 170 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - public function contentAsString(){ |
|
| 174 | - if($this->autoActive){ |
|
| 173 | + public function contentAsString() { |
|
| 174 | + if ($this->autoActive) { |
|
| 175 | 175 | $this->setActive(); |
| 176 | 176 | } |
| 177 | 177 | return parent::contentAsString(); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - public function getElement($index){ |
|
| 180 | + public function getElement($index) { |
|
| 181 | 181 | return $this->content[$index]; |
| 182 | 182 | } |
| 183 | 183 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * @param mixed $glyph |
| 187 | 187 | * @param int $index |
| 188 | 188 | */ |
| 189 | - public function addGlyph($glyph,$index=0){ |
|
| 189 | + public function addGlyph($glyph, $index=0) { |
|
| 190 | 190 | $elm=$this->getElement($index); |
| 191 | 191 | return $elm->wrapContentWithGlyph($glyph); |
| 192 | 192 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * @param Dispatcher $dispatcher the request dispatcher |
| 198 | 198 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 199 | 199 | */ |
| 200 | - public function fromDispatcher(JsUtils $js,$dispatcher,$startIndex=0){ |
|
| 200 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
| 201 | 201 | $this->startIndex=$startIndex; |
| 202 | 202 | return $this->addElements($js->fromDispatcher($dispatcher)); |
| 203 | 203 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 210 | 210 | */ |
| 211 | 211 | public function setHrefFunction($_hrefFunction) { |
| 212 | - $this->_hrefFunction = $_hrefFunction; |
|
| 212 | + $this->_hrefFunction=$_hrefFunction; |
|
| 213 | 213 | return $this; |
| 214 | 214 | } |
| 215 | 215 | |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | private static $constCacheArray=NULL; |
| 13 | 13 | |
| 14 | 14 | public static function getConstants() { |
| 15 | - if (self::$constCacheArray == NULL) { |
|
| 16 | - self::$constCacheArray=[ ]; |
|
| 15 | + if (self::$constCacheArray==NULL) { |
|
| 16 | + self::$constCacheArray=[]; |
|
| 17 | 17 | } |
| 18 | 18 | $calledClass=get_called_class(); |
| 19 | 19 | if (!array_key_exists($calledClass, self::$constCacheArray)) { |
@@ -23,16 +23,16 @@ discard block |
||
| 23 | 23 | return self::$constCacheArray[$calledClass]; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public static function getConstantValues($postFix="",$prefixBefore=false) { |
|
| 27 | - if ($postFix == "") |
|
| 26 | + public static function getConstantValues($postFix="", $prefixBefore=false) { |
|
| 27 | + if ($postFix=="") |
|
| 28 | 28 | return \array_values(self::getConstants()); |
| 29 | 29 | else { |
| 30 | - if($prefixBefore===false){ |
|
| 31 | - return \array_map(function ($elem) use($postFix) { |
|
| 32 | - return $elem . " " . $postFix; |
|
| 30 | + if ($prefixBefore===false) { |
|
| 31 | + return \array_map(function($elem) use($postFix) { |
|
| 32 | + return $elem." ".$postFix; |
|
| 33 | 33 | }, \array_values(self::getConstants())); |
| 34 | - }else{ |
|
| 35 | - return \array_map(function ($elem) use($postFix) { |
|
| 34 | + }else { |
|
| 35 | + return \array_map(function($elem) use($postFix) { |
|
| 36 | 36 | return $postFix." ".$elem; |
| 37 | 37 | }, \array_values(self::getConstants())); |
| 38 | 38 | } |
@@ -24,14 +24,14 @@ |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public static function getConstantValues($postFix="",$prefixBefore=false) { |
| 27 | - if ($postFix == "") |
|
| 28 | - return \array_values(self::getConstants()); |
|
| 29 | - else { |
|
| 27 | + if ($postFix == "") { |
|
| 28 | + return \array_values(self::getConstants()); |
|
| 29 | + } else { |
|
| 30 | 30 | if($prefixBefore===false){ |
| 31 | 31 | return \array_map(function ($elem) use($postFix) { |
| 32 | 32 | return $elem . " " . $postFix; |
| 33 | 33 | }, \array_values(self::getConstants())); |
| 34 | - }else{ |
|
| 34 | + } else{ |
|
| 35 | 35 | return \array_map(function ($elem) use($postFix) { |
| 36 | 36 | return $postFix." ".$elem; |
| 37 | 37 | }, \array_values(self::getConstants())); |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | class HtmlInput extends HtmlSingleElement { |
| 9 | 9 | |
| 10 | - public function __construct($identifier,$type="text",$value=NULL,$placeholder=NULL) { |
|
| 10 | + public function __construct($identifier, $type="text", $value=NULL, $placeholder=NULL) { |
|
| 11 | 11 | parent::__construct($identifier, "input"); |
| 12 | 12 | $this->setProperty("name", $identifier); |
| 13 | 13 | $this->setValue($value); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | public function setValue($value) { |
| 19 | - if(isset($value)) |
|
| 19 | + if (isset($value)) |
|
| 20 | 20 | $this->setProperty("value", $value); |
| 21 | 21 | return $this; |
| 22 | 22 | } |
@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | return $this->setProperty("type", $value); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function setPlaceholder($value){ |
|
| 29 | - if(JString::isNull($value)){ |
|
| 30 | - if(JString::isNotNull($this->identifier)) |
|
| 28 | + public function setPlaceholder($value) { |
|
| 29 | + if (JString::isNull($value)) { |
|
| 30 | + if (JString::isNotNull($this->identifier)) |
|
| 31 | 31 | $value=\ucfirst($this->identifier); |
| 32 | 32 | } |
| 33 | - if(JString::isNotNull($value)) |
|
| 33 | + if (JString::isNotNull($value)) |
|
| 34 | 34 | $this->setProperty("placeholder", $value); |
| 35 | 35 | return $this; |
| 36 | 36 | } |
@@ -16,8 +16,9 @@ discard block |
||
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | public function setValue($value) { |
| 19 | - if(isset($value)) |
|
| 20 | - $this->setProperty("value", $value); |
|
| 19 | + if(isset($value)) { |
|
| 20 | + $this->setProperty("value", $value); |
|
| 21 | + } |
|
| 21 | 22 | return $this; |
| 22 | 23 | } |
| 23 | 24 | |
@@ -27,11 +28,13 @@ discard block |
||
| 27 | 28 | |
| 28 | 29 | public function setPlaceholder($value){ |
| 29 | 30 | if(JString::isNull($value)){ |
| 30 | - if(JString::isNotNull($this->identifier)) |
|
| 31 | - $value=\ucfirst($this->identifier); |
|
| 31 | + if(JString::isNotNull($this->identifier)) { |
|
| 32 | + $value=\ucfirst($this->identifier); |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | + if(JString::isNotNull($value)) { |
|
| 36 | + $this->setProperty("placeholder", $value); |
|
| 32 | 37 | } |
| 33 | - if(JString::isNotNull($value)) |
|
| 34 | - $this->setProperty("placeholder", $value); |
|
| 35 | 38 | return $this; |
| 36 | 39 | } |
| 37 | 40 | } |
| 38 | 41 | \ No newline at end of file |
@@ -16,10 +16,10 @@ 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 (); |
|
| 21 | - protected $_wrapBefore=array (); |
|
| 22 | - protected $_wrapAfter=array (); |
|
| 19 | + protected $properties=array(); |
|
| 20 | + protected $_events=array(); |
|
| 21 | + protected $_wrapBefore=array(); |
|
| 22 | + protected $_wrapAfter=array(); |
|
| 23 | 23 | protected $_bsComponent; |
| 24 | 24 | |
| 25 | 25 | public function getBsComponent() { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | protected function getTemplate(JsUtils $js=NULL) { |
| 35 | - return PropertyWrapper::wrap($this->_wrapBefore, $js) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
| 35 | + return PropertyWrapper::wrap($this->_wrapBefore, $js).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function getProperties() { |
@@ -56,13 +56,13 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | public function addToProperty($name, $value, $separator=" ") { |
| 58 | 58 | if (\is_array($value)) { |
| 59 | - foreach ( $value as $v ) { |
|
| 59 | + foreach ($value as $v) { |
|
| 60 | 60 | $this->addToProperty($name, $v, $separator); |
| 61 | 61 | } |
| 62 | - } else if ($value !== "" && $this->propertyContains($name, $value) === false) { |
|
| 62 | + }else if ($value!=="" && $this->propertyContains($name, $value)===false) { |
|
| 63 | 63 | $v=@$this->properties[$name]; |
| 64 | - if (isset($v) && $v !== "") |
|
| 65 | - $v=$v . $separator . $value; |
|
| 64 | + if (isset($v) && $v!=="") |
|
| 65 | + $v=$v.$separator.$value; |
|
| 66 | 66 | else |
| 67 | 67 | $v=$value; |
| 68 | 68 | |
@@ -78,19 +78,19 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | public function compile(JsUtils $js=NULL, $view=NULL) { |
| 80 | 80 | $result=$this->getTemplate($js); |
| 81 | - foreach ( $this as $key => $value ) { |
|
| 82 | - if (JString::startswith($key, "_") === false && $key !== "events") { |
|
| 81 | + foreach ($this as $key => $value) { |
|
| 82 | + if (JString::startswith($key, "_")===false && $key!=="events") { |
|
| 83 | 83 | if (is_array($value)) { |
| 84 | 84 | $v=PropertyWrapper::wrap($value, $js); |
| 85 | - } else { |
|
| 85 | + }else { |
|
| 86 | 86 | $v=$value; |
| 87 | 87 | } |
| 88 | - $result=str_ireplace("%" . $key . "%", $v, $result); |
|
| 88 | + $result=str_ireplace("%".$key."%", $v, $result); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | if (isset($js)===true) { |
| 92 | 92 | $this->run($js); |
| 93 | - if (isset($view) === true) { |
|
| 93 | + if (isset($view)===true) { |
|
| 94 | 94 | $js->addViewElement($this->identifier, $result, $view); |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | protected function ctrl($name, $value, $typeCtrl) { |
| 101 | 101 | if (is_array($typeCtrl)) { |
| 102 | - if (array_search($value, $typeCtrl) === false) { |
|
| 103 | - throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}"); |
|
| 102 | + if (array_search($value, $typeCtrl)===false) { |
|
| 103 | + throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
| 104 | 104 | } |
| 105 | - } else { |
|
| 105 | + }else { |
|
| 106 | 106 | if (!$typeCtrl($value)) { |
| 107 | - throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name); |
|
| 107 | + throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | return true; |
@@ -119,13 +119,13 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
| 122 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
| 122 | + if ($this->ctrl($name, $value, $typeCtrl)===true) |
|
| 123 | 123 | return $this->setProperty($name, $value); |
| 124 | 124 | return $this; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
| 128 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 128 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 129 | 129 | return $name=$value; |
| 130 | 130 | } |
| 131 | 131 | return $this; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") { |
| 135 | 135 | if (is_array($typeCtrl)) { |
| 136 | 136 | $this->removeOldValues($name, $typeCtrl); |
| 137 | - $name.=$separator . $value; |
|
| 137 | + $name.=$separator.$value; |
|
| 138 | 138 | } |
| 139 | 139 | return $this; |
| 140 | 140 | } |
@@ -156,17 +156,17 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
| 159 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 159 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 160 | 160 | if (is_array($typeCtrl)) { |
| 161 | 161 | $this->removeOldValues($name, $typeCtrl); |
| 162 | 162 | } |
| 163 | - $name.=$separator . $value; |
|
| 163 | + $name.=$separator.$value; |
|
| 164 | 164 | } |
| 165 | 165 | return $this; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | protected function addToMember(&$name, $value, $separator=" ") { |
| 169 | - $name=str_ireplace($value, "", $name) . $separator . $value; |
|
| 169 | + $name=str_ireplace($value, "", $name).$separator.$value; |
|
| 170 | 170 | return $this; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | public function addToPropertyCtrlCheck($name, $value, $typeCtrl) { |
| 187 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 187 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 188 | 188 | return $this->addToProperty($name, $value); |
| 189 | 189 | } |
| 190 | 190 | return $this; |
@@ -212,28 +212,28 @@ discard block |
||
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | public function fromArray($array) { |
| 215 | - foreach ( $this as $key => $value ) { |
|
| 215 | + foreach ($this as $key => $value) { |
|
| 216 | 216 | if (array_key_exists($key, $array) && !JString::startswith($key, "_")) { |
| 217 | - $setter="set" . ucfirst($key); |
|
| 217 | + $setter="set".ucfirst($key); |
|
| 218 | 218 | $this->$setter($array[$key]); |
| 219 | 219 | unset($array[$key]); |
| 220 | 220 | } |
| 221 | 221 | } |
| 222 | - foreach ( $array as $key => $value ) { |
|
| 222 | + foreach ($array as $key => $value) { |
|
| 223 | 223 | if (method_exists($this, $key)) { |
| 224 | 224 | try { |
| 225 | 225 | $this->$key($value); |
| 226 | 226 | unset($array[$key]); |
| 227 | - } catch ( \Exception $e ) { |
|
| 227 | + } catch (\Exception $e) { |
|
| 228 | 228 | // Nothing to do |
| 229 | 229 | } |
| 230 | - } else { |
|
| 231 | - $setter="set" . ucfirst($key); |
|
| 230 | + }else { |
|
| 231 | + $setter="set".ucfirst($key); |
|
| 232 | 232 | if (method_exists($this, $setter)) { |
| 233 | 233 | try { |
| 234 | 234 | $this->$setter($value); |
| 235 | 235 | unset($array[$key]); |
| 236 | - } catch ( \Exception $e ) { |
|
| 236 | + } catch (\Exception $e) { |
|
| 237 | 237 | // Nothing to do |
| 238 | 238 | } |
| 239 | 239 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | public function fromDatabaseObjects($objects, $function) { |
| 246 | 246 | if (isset($objects)) { |
| 247 | - foreach ( $objects as $object ) { |
|
| 247 | + foreach ($objects as $object) { |
|
| 248 | 248 | $this->fromDatabaseObject($object, $function); |
| 249 | 249 | } |
| 250 | 250 | } |
@@ -264,11 +264,11 @@ discard block |
||
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 267 | - if ($stopPropagation === true) { |
|
| 268 | - $jsCode="event.stopPropagation();" . $jsCode; |
|
| 267 | + if ($stopPropagation===true) { |
|
| 268 | + $jsCode="event.stopPropagation();".$jsCode; |
|
| 269 | 269 | } |
| 270 | - if ($preventDefault === true) { |
|
| 271 | - $jsCode="event.preventDefault();" . $jsCode; |
|
| 270 | + if ($preventDefault===true) { |
|
| 271 | + $jsCode="event.preventDefault();".$jsCode; |
|
| 272 | 272 | } |
| 273 | 273 | return $this->_addEvent($event, $jsCode); |
| 274 | 274 | } |
@@ -277,10 +277,10 @@ discard block |
||
| 277 | 277 | if (array_key_exists($event, $this->_events)) { |
| 278 | 278 | if (is_array($this->_events[$event])) { |
| 279 | 279 | $this->_events[$event][]=$jsCode; |
| 280 | - } else { |
|
| 281 | - $this->_events[$event]=array ($this->_events[$event],$jsCode ); |
|
| 280 | + }else { |
|
| 281 | + $this->_events[$event]=array($this->_events[$event], $jsCode); |
|
| 282 | 282 | } |
| 283 | - } else { |
|
| 283 | + }else { |
|
| 284 | 284 | $this->_events[$event]=$jsCode; |
| 285 | 285 | } |
| 286 | 286 | return $this; |
@@ -300,15 +300,15 @@ discard block |
||
| 300 | 300 | |
| 301 | 301 | public function addEventsOnRun(JsUtils $js) { |
| 302 | 302 | if (isset($this->_bsComponent)) { |
| 303 | - foreach ( $this->_events as $event => $jsCode ) { |
|
| 303 | + foreach ($this->_events as $event => $jsCode) { |
|
| 304 | 304 | $code=$jsCode; |
| 305 | 305 | if (is_array($jsCode)) { |
| 306 | 306 | $code=""; |
| 307 | - foreach ( $jsCode as $jsC ) { |
|
| 307 | + foreach ($jsCode as $jsC) { |
|
| 308 | 308 | if ($jsC instanceof AjaxCall) { |
| 309 | - $code.="\n" . $jsC->compile($js); |
|
| 310 | - } else { |
|
| 311 | - $code.="\n" . $jsC; |
|
| 309 | + $code.="\n".$jsC->compile($js); |
|
| 310 | + }else { |
|
| 311 | + $code.="\n".$jsC; |
|
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | 314 | } elseif ($jsCode instanceof AjaxCall) { |
@@ -316,12 +316,12 @@ discard block |
||
| 316 | 316 | } |
| 317 | 317 | $this->_bsComponent->addEvent($event, $code); |
| 318 | 318 | } |
| 319 | - $this->_events=array (); |
|
| 319 | + $this->_events=array(); |
|
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 324 | - $params=array ("url" => $url,"responseElement" => $responseElement ); |
|
| 324 | + $params=array("url" => $url, "responseElement" => $responseElement); |
|
| 325 | 325 | $params=array_merge($params, $parameters); |
| 326 | 326 | $this->_addEvent($event, new AjaxCall($operation, $params)); |
| 327 | 327 | return $this; |
@@ -357,33 +357,33 @@ discard block |
||
| 357 | 357 | if (is_array($elements)) { |
| 358 | 358 | $flag=false; |
| 359 | 359 | $index=0; |
| 360 | - while ( !$flag && $index < sizeof($elements) ) { |
|
| 360 | + while (!$flag && $index<sizeof($elements)) { |
|
| 361 | 361 | if ($elements[$index] instanceof BaseHtml) |
| 362 | - $flag=($elements[$index]->getIdentifier() === $identifier); |
|
| 362 | + $flag=($elements[$index]->getIdentifier()===$identifier); |
|
| 363 | 363 | $index++; |
| 364 | 364 | } |
| 365 | - if ($flag === true) |
|
| 366 | - return $elements[$index - 1]; |
|
| 365 | + if ($flag===true) |
|
| 366 | + return $elements[$index-1]; |
|
| 367 | 367 | } elseif ($elements instanceof BaseHtml) { |
| 368 | - if ($elements->getIdentifier() === $identifier) |
|
| 368 | + if ($elements->getIdentifier()===$identifier) |
|
| 369 | 369 | return $elements; |
| 370 | 370 | } |
| 371 | 371 | return null; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - protected function getElementByPropertyValue($propertyName,$value, $elements) { |
|
| 374 | + protected function getElementByPropertyValue($propertyName, $value, $elements) { |
|
| 375 | 375 | if (is_array($elements)) { |
| 376 | 376 | $flag=false; |
| 377 | 377 | $index=0; |
| 378 | - while ( !$flag && $index < sizeof($elements) ) { |
|
| 378 | + while (!$flag && $index<sizeof($elements)) { |
|
| 379 | 379 | if ($elements[$index] instanceof BaseHtml) |
| 380 | - $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
| 380 | + $flag=($elements[$index]->propertyContains($propertyName, $value)===true); |
|
| 381 | 381 | $index++; |
| 382 | 382 | } |
| 383 | - if ($flag === true) |
|
| 384 | - return $elements[$index - 1]; |
|
| 383 | + if ($flag===true) |
|
| 384 | + return $elements[$index-1]; |
|
| 385 | 385 | } elseif ($elements instanceof BaseHtml) { |
| 386 | - if ($elements->propertyContains($propertyName, $value) === true) |
|
| 386 | + if ($elements->propertyContains($propertyName, $value)===true) |
|
| 387 | 387 | return $elements; |
| 388 | 388 | } |
| 389 | 389 | return null; |
@@ -405,14 +405,14 @@ discard block |
||
| 405 | 405 | if (is_array($value)) { |
| 406 | 406 | $value=implode(",", $value); |
| 407 | 407 | } |
| 408 | - if (strrpos($value, 'this') === false && strrpos($value, 'event') === false) { |
|
| 409 | - $value='"' . $value . '"'; |
|
| 408 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false) { |
|
| 409 | + $value='"'.$value.'"'; |
|
| 410 | 410 | } |
| 411 | 411 | return $value; |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | public function jsDoJquery($jqueryCall, $param="") { |
| 415 | - return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . $this->_prep_value($param) . ");"; |
|
| 415 | + return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");"; |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | public function executeOnRun($jsCode) { |
@@ -50,8 +50,9 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public function getProperty($name) { |
| 53 | - if (array_key_exists($name, $this->properties)) |
|
| 54 | - return $this->properties[$name]; |
|
| 53 | + if (array_key_exists($name, $this->properties)) { |
|
| 54 | + return $this->properties[$name]; |
|
| 55 | + } |
|
| 55 | 56 | } |
| 56 | 57 | |
| 57 | 58 | public function addToProperty($name, $value, $separator=" ") { |
@@ -61,10 +62,11 @@ discard block |
||
| 61 | 62 | } |
| 62 | 63 | } else if ($value !== "" && $this->propertyContains($name, $value) === false) { |
| 63 | 64 | $v=@$this->properties[$name]; |
| 64 | - if (isset($v) && $v !== "") |
|
| 65 | - $v=$v . $separator . $value; |
|
| 66 | - else |
|
| 67 | - $v=$value; |
|
| 65 | + if (isset($v) && $v !== "") { |
|
| 66 | + $v=$v . $separator . $value; |
|
| 67 | + } else { |
|
| 68 | + $v=$value; |
|
| 69 | + } |
|
| 68 | 70 | |
| 69 | 71 | return $this->setProperty($name, $v); |
| 70 | 72 | } |
@@ -119,8 +121,9 @@ discard block |
||
| 119 | 121 | } |
| 120 | 122 | |
| 121 | 123 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
| 122 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
| 123 | - return $this->setProperty($name, $value); |
|
| 124 | + if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 125 | + return $this->setProperty($name, $value); |
|
| 126 | + } |
|
| 124 | 127 | return $this; |
| 125 | 128 | } |
| 126 | 129 | |
@@ -150,8 +153,9 @@ discard block |
||
| 150 | 153 | } |
| 151 | 154 | |
| 152 | 155 | protected function removeProperty($name) { |
| 153 | - if (\array_key_exists($name, $this->properties)) |
|
| 154 | - unset($this->properties[$name]); |
|
| 156 | + if (\array_key_exists($name, $this->properties)) { |
|
| 157 | + unset($this->properties[$name]); |
|
| 158 | + } |
|
| 155 | 159 | return $this; |
| 156 | 160 | } |
| 157 | 161 | |
@@ -171,8 +175,9 @@ discard block |
||
| 171 | 175 | } |
| 172 | 176 | |
| 173 | 177 | protected function addToPropertyUnique($name, $value, $typeCtrl) { |
| 174 | - if (@class_exists($typeCtrl, true)) |
|
| 175 | - $typeCtrl=$typeCtrl::getConstants(); |
|
| 178 | + if (@class_exists($typeCtrl, true)) { |
|
| 179 | + $typeCtrl=$typeCtrl::getConstants(); |
|
| 180 | + } |
|
| 176 | 181 | if (is_array($typeCtrl)) { |
| 177 | 182 | $this->removeOldValues($this->properties[$name], $typeCtrl); |
| 178 | 183 | } |
@@ -358,15 +363,18 @@ discard block |
||
| 358 | 363 | $flag=false; |
| 359 | 364 | $index=0; |
| 360 | 365 | while ( !$flag && $index < sizeof($elements) ) { |
| 361 | - if ($elements[$index] instanceof BaseHtml) |
|
| 362 | - $flag=($elements[$index]->getIdentifier() === $identifier); |
|
| 366 | + if ($elements[$index] instanceof BaseHtml) { |
|
| 367 | + $flag=($elements[$index]->getIdentifier() === $identifier); |
|
| 368 | + } |
|
| 363 | 369 | $index++; |
| 364 | 370 | } |
| 365 | - if ($flag === true) |
|
| 366 | - return $elements[$index - 1]; |
|
| 371 | + if ($flag === true) { |
|
| 372 | + return $elements[$index - 1]; |
|
| 373 | + } |
|
| 367 | 374 | } elseif ($elements instanceof BaseHtml) { |
| 368 | - if ($elements->getIdentifier() === $identifier) |
|
| 369 | - return $elements; |
|
| 375 | + if ($elements->getIdentifier() === $identifier) { |
|
| 376 | + return $elements; |
|
| 377 | + } |
|
| 370 | 378 | } |
| 371 | 379 | return null; |
| 372 | 380 | } |
@@ -376,15 +384,18 @@ discard block |
||
| 376 | 384 | $flag=false; |
| 377 | 385 | $index=0; |
| 378 | 386 | while ( !$flag && $index < sizeof($elements) ) { |
| 379 | - if ($elements[$index] instanceof BaseHtml) |
|
| 380 | - $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
| 387 | + if ($elements[$index] instanceof BaseHtml) { |
|
| 388 | + $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
| 389 | + } |
|
| 381 | 390 | $index++; |
| 382 | 391 | } |
| 383 | - if ($flag === true) |
|
| 384 | - return $elements[$index - 1]; |
|
| 392 | + if ($flag === true) { |
|
| 393 | + return $elements[$index - 1]; |
|
| 394 | + } |
|
| 385 | 395 | } elseif ($elements instanceof BaseHtml) { |
| 386 | - if ($elements->propertyContains($propertyName, $value) === true) |
|
| 387 | - return $elements; |
|
| 396 | + if ($elements->propertyContains($propertyName, $value) === true) { |
|
| 397 | + return $elements; |
|
| 398 | + } |
|
| 388 | 399 | } |
| 389 | 400 | return null; |
| 390 | 401 | } |
@@ -130,12 +130,12 @@ |
||
| 130 | 130 | * @param string $tagName |
| 131 | 131 | * @return HtmlLabel |
| 132 | 132 | */ |
| 133 | - public function htmlLabel($identifier, $content="", $icon=NULL,$tagName="div") { |
|
| 134 | - return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$icon, $tagName)); |
|
| 133 | + public function htmlLabel($identifier, $content="", $icon=NULL, $tagName="div") { |
|
| 134 | + return $this->addHtmlComponent(new HtmlLabel($identifier, $content, $icon, $tagName)); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - public function htmlLabelGroups($identifier,$labels=array(),$attributes=array()){ |
|
| 138 | - return $this->addHtmlComponent(new HtmlLabelGroups($identifier,$labels,$attributes)); |
|
| 137 | + public function htmlLabelGroups($identifier, $labels=array(), $attributes=array()) { |
|
| 138 | + return $this->addHtmlComponent(new HtmlLabelGroups($identifier, $labels, $attributes)); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | class HtmlLabelGroups extends HtmlSemCollection { |
| 17 | 17 | |
| 18 | - public function __construct($identifier,$labels=array(), $attributes=array()) { |
|
| 18 | + public function __construct($identifier, $labels=array(), $attributes=array()) { |
|
| 19 | 19 | parent::__construct($identifier, "div", "ui labels"); |
| 20 | - $this->_states=\array_merge(Size::getConstants(),Color::getConstants(),["tag","circular"]); |
|
| 20 | + $this->_states=\array_merge(Size::getConstants(), Color::getConstants(), ["tag", "circular"]); |
|
| 21 | 21 | $this->addItems($labels); |
| 22 | 22 | $this->setStates($attributes); |
| 23 | 23 | } |
@@ -31,12 +31,12 @@ discard block |
||
| 31 | 31 | $icon=JArray::getValue($value, "icon", 1); |
| 32 | 32 | $tagName=JArray::getValue($value, "tagName", 2); |
| 33 | 33 | } |
| 34 | - $labelO=new HtmlLabel("label-" . $this->identifier, $caption,$icon,$tagName); |
|
| 34 | + $labelO=new HtmlLabel("label-".$this->identifier, $caption, $icon, $tagName); |
|
| 35 | 35 | return $labelO; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | protected function createCondition($value) { |
| 39 | - return ($value instanceof HtmlLabel) === false; |
|
| 39 | + return ($value instanceof HtmlLabel)===false; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | } |
| 43 | 43 | \ No newline at end of file |
@@ -18,17 +18,17 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | protected function createItem($value) { |
| 20 | 20 | $count=$this->count(); |
| 21 | - $item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value); |
|
| 21 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
| 22 | 22 | return $item; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function addHeader($niveau, $content) { |
| 26 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page"); |
|
| 26 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $content, "page"); |
|
| 27 | 27 | $this->wrap($header); |
| 28 | 28 | return $header; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function getItemPart($index,$partName="header"){ |
|
| 31 | + public function getItemPart($index, $partName="header") { |
|
| 32 | 32 | return $this->getItem($index)->getPart($partName); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function asLink() { |
| 40 | - $this->addToPropertyCtrl("class", "link", array ("link" )); |
|
| 40 | + $this->addToPropertyCtrl("class", "link", array("link")); |
|
| 41 | 41 | return $this->contentAs("a"); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | public function run(JsUtils $js) { |
| 63 | - if ($this->_hasCheckedList === true) { |
|
| 64 | - $jsCode=include dirname(__FILE__) . '/../../components/jsTemplates/tplCheckedList.php'; |
|
| 65 | - $jsCode=\str_replace("%identifier%", "#" . $this->identifier, $jsCode); |
|
| 63 | + if ($this->_hasCheckedList===true) { |
|
| 64 | + $jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php'; |
|
| 65 | + $jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode); |
|
| 66 | 66 | $this->executeOnRun($jsCode); |
| 67 | 67 | } |
| 68 | 68 | return parent::run($js); |
@@ -86,28 +86,28 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | public function addCheckedList($items=array(), $masterItem=NULL, $values=array()) { |
| 88 | 88 | $count=$this->count(); |
| 89 | - $identifier=$this->identifier . "-" . $count; |
|
| 89 | + $identifier=$this->identifier."-".$count; |
|
| 90 | 90 | if (isset($masterItem)) { |
| 91 | - $masterO=new HtmlFormCheckbox("master-" . $identifier, $masterItem); |
|
| 91 | + $masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem); |
|
| 92 | 92 | $masterO->getField()->addToProperty("class", "master"); |
| 93 | 93 | $masterO->setClass("item"); |
| 94 | 94 | $this->addItem($masterO); |
| 95 | 95 | } |
| 96 | - $fields=array (); |
|
| 96 | + $fields=array(); |
|
| 97 | 97 | $i=0; |
| 98 | - foreach ( $items as $val => $caption ) { |
|
| 99 | - $itemO=new HtmlFormCheckbox($identifier . "-" . $i++, $caption, $val, "child"); |
|
| 100 | - if (\array_search($val, $values) !== false) { |
|
| 98 | + foreach ($items as $val => $caption) { |
|
| 99 | + $itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child"); |
|
| 100 | + if (\array_search($val, $values)!==false) { |
|
| 101 | 101 | $itemO->getField()->getField()->setProperty("checked", ""); |
| 102 | 102 | } |
| 103 | 103 | $itemO->setClass("item"); |
| 104 | 104 | $fields[]=$itemO; |
| 105 | 105 | } |
| 106 | - if (isset($masterO) === true) { |
|
| 106 | + if (isset($masterO)===true) { |
|
| 107 | 107 | $list=new HtmlList("", $fields); |
| 108 | 108 | $list->setClass("list"); |
| 109 | 109 | $masterO->addContent($list); |
| 110 | - } else { |
|
| 110 | + }else { |
|
| 111 | 111 | $this->addList($fields); |
| 112 | 112 | } |
| 113 | 113 | $this->_hasCheckedList=true; |
@@ -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); |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 25 | 25 | */ |
| 26 | 26 | public function setPointing($value=Direction::NONE) { |
| 27 | - if($value==="left" || $value==="right") |
|
| 27 | + if ($value==="left" || $value==="right") |
|
| 28 | 28 | return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
| 29 | 29 | else |
| 30 | - return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true)); |
|
| 30 | + return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing", true)); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -36,15 +36,15 @@ discard block |
||
| 36 | 36 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 37 | 37 | */ |
| 38 | 38 | public function toCorner($side="left") { |
| 39 | - return $this->addToPropertyCtrl("class", $side . " corner", array ("right corner","left corner" )); |
|
| 39 | + return $this->addToPropertyCtrl("class", $side." corner", array("right corner", "left corner")); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function setHorizontal(){ |
|
| 43 | - return $this->addToPropertyCtrl("class", "hozizontal",array("horizontal")); |
|
| 42 | + public function setHorizontal() { |
|
| 43 | + return $this->addToPropertyCtrl("class", "hozizontal", array("horizontal")); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public function setFloating(){ |
|
| 47 | - return $this->addToPropertyCtrl("class", "floating",array("floating")); |
|
| 46 | + public function setFloating() { |
|
| 47 | + return $this->addToPropertyCtrl("class", "floating", array("floating")); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | return $this->addToProperty("class", "tag"); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - public function setEmpty(){ |
|
| 58 | + public function setEmpty() { |
|
| 59 | 59 | $this->content=NULL; |
| 60 | - return $this->addToPropertyCtrl("class", "empty",array("empty")); |
|
| 60 | + return $this->addToPropertyCtrl("class", "empty", array("empty")); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | public function setBasic() { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function addEmphasisImage($src, $alt="", $before=true) { |
| 75 | 75 | $this->addToProperty("class", "image"); |
| 76 | - return $this->addImage($src,$alt,$before); |
|
| 76 | + return $this->addImage($src, $alt, $before); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @return \Ajax\semantic\html\elements\html5\HtmlImg |
| 85 | 85 | */ |
| 86 | 86 | public function addAvatarImage($src, $alt="", $before=true) { |
| 87 | - $img=$this->addImage($src,$alt,$before); |
|
| 87 | + $img=$this->addImage($src, $alt, $before); |
|
| 88 | 88 | $img->setClass("ui image"); |
| 89 | 89 | $img->asAvatar(); |
| 90 | 90 | return $img; |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @return \Ajax\semantic\html\elements\html5\HtmlImg |
| 99 | 99 | */ |
| 100 | 100 | public function addImage($src, $alt="", $before=true) { |
| 101 | - $img=new HtmlImg("image-" . $this->identifier, $src, $alt); |
|
| 101 | + $img=new HtmlImg("image-".$this->identifier, $src, $alt); |
|
| 102 | 102 | $img->setClass(""); |
| 103 | 103 | $this->addContent($img, $before); |
| 104 | 104 | return $img; |
@@ -110,21 +110,21 @@ discard block |
||
| 110 | 110 | * @return \Ajax\common\html\HtmlDoubleElement |
| 111 | 111 | */ |
| 112 | 112 | public function addDetail($detail) { |
| 113 | - $div=new HtmlSemDoubleElement("detail-" . $this->identifier, $this->tagName,"detail"); |
|
| 113 | + $div=new HtmlSemDoubleElement("detail-".$this->identifier, $this->tagName, "detail"); |
|
| 114 | 114 | $div->setContent($detail); |
| 115 | 115 | $this->addContent($div); |
| 116 | 116 | return $div; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | public function asRibbon($direction=Direction::NONE) { |
| 120 | - return $this->addToPropertyCtrl("class", $direction." ribbon", array ("ribbon","right ribbon","left ribbon" )); |
|
| 120 | + return $this->addToPropertyCtrl("class", $direction." ribbon", array("ribbon", "right ribbon", "left ribbon")); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public function setAttached($side=Side::TOP,$direction=Direction::NONE){ |
|
| 124 | - if($direction!==Direction::NONE) |
|
| 125 | - return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached")); |
|
| 123 | + public function setAttached($side=Side::TOP, $direction=Direction::NONE) { |
|
| 124 | + if ($direction!==Direction::NONE) |
|
| 125 | + return $this->addToPropertyCtrl("class", $side." ".$direction." attached", Side::getConstantValues($direction." attached")); |
|
| 126 | 126 | else |
| 127 | - return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
| 127 | + return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached")); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | public static function ribbon($identifier, $caption) { |
@@ -14,8 +14,9 @@ discard block |
||
| 14 | 14 | public function __construct($identifier, $caption="", $icon=NULL, $tagName="div") { |
| 15 | 15 | parent::__construct($identifier, $tagName, "ui label"); |
| 16 | 16 | $this->content=$caption; |
| 17 | - if (isset($icon)===true) |
|
| 18 | - $this->addIcon($icon); |
|
| 17 | + if (isset($icon)===true) { |
|
| 18 | + $this->addIcon($icon); |
|
| 19 | + } |
|
| 19 | 20 | } |
| 20 | 21 | |
| 21 | 22 | /** |
@@ -24,10 +25,11 @@ discard block |
||
| 24 | 25 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 25 | 26 | */ |
| 26 | 27 | public function setPointing($value=Direction::NONE) { |
| 27 | - if($value==="left" || $value==="right") |
|
| 28 | - return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 29 | - else |
|
| 30 | - return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true)); |
|
| 28 | + if($value==="left" || $value==="right") { |
|
| 29 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 30 | + } else { |
|
| 31 | + return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true)); |
|
| 32 | + } |
|
| 31 | 33 | } |
| 32 | 34 | |
| 33 | 35 | /** |
@@ -121,10 +123,11 @@ discard block |
||
| 121 | 123 | } |
| 122 | 124 | |
| 123 | 125 | public function setAttached($side=Side::TOP,$direction=Direction::NONE){ |
| 124 | - if($direction!==Direction::NONE) |
|
| 125 | - return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached")); |
|
| 126 | - else |
|
| 127 | - return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
| 126 | + if($direction!==Direction::NONE) { |
|
| 127 | + return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached")); |
|
| 128 | + } else { |
|
| 129 | + return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
| 130 | + } |
|
| 128 | 131 | } |
| 129 | 132 | |
| 130 | 133 | public static function ribbon($identifier, $caption) { |