@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | if (isset($label)) |
| 37 | 37 | $this->setLabel($label); |
| 38 | - foreach ( $fields as $field ) { |
|
| 38 | + foreach ($fields as $field) { |
|
| 39 | 39 | $this->addItem($field); |
| 40 | 40 | } |
| 41 | 41 | return $this; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public function addItem($item) { |
| 59 | 59 | $item=parent::addItem($item); |
| 60 | - if($item instanceof HtmlFormField) |
|
| 60 | + if ($item instanceof HtmlFormField) |
|
| 61 | 61 | $item->setContainer($this); |
| 62 | 62 | return $item; |
| 63 | 63 | } |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | |
| 100 | 100 | public static function radios($name, $items=array(), $label=NULL, $value=null, $type=NULL) { |
| 101 | - $fields=array (); |
|
| 101 | + $fields=array(); |
|
| 102 | 102 | $i=0; |
| 103 | - foreach ( $items as $val => $caption ) { |
|
| 103 | + foreach ($items as $val => $caption) { |
|
| 104 | 104 | $itemO=new HtmlFormRadio($name."-".$i++, $name, $caption, $val, $type); |
| 105 | 105 | if ($val===$value) { |
| 106 | 106 | $itemO->getDataField()->setProperty("checked", ""); |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | public static function checkeds($name, $items=array(), $label=NULL, $values=array(), $type=NULL) { |
| 117 | - $fields=array (); |
|
| 117 | + $fields=array(); |
|
| 118 | 118 | $i=0; |
| 119 | - foreach ( $items as $val => $caption ) { |
|
| 119 | + foreach ($items as $val => $caption) { |
|
| 120 | 120 | $itemO=new HtmlFormCheckbox($name."-".$i++, $caption, $val, $type); |
| 121 | 121 | $itemO->setName($name); |
| 122 | 122 | if (\array_search($val, $values)!==false) { |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function setFocusable($value=true) { |
| 58 | - if ($value === true) |
|
| 58 | + if ($value===true) |
|
| 59 | 59 | $this->setProperty("tabindex", "0"); |
| 60 | 60 | else { |
| 61 | 61 | $this->removeProperty("tabindex"); |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function setAnimated($content, $animation="") { |
| 67 | 67 | $this->setTagName("div"); |
| 68 | - $this->addToProperty("class", "animated " . $animation); |
|
| 69 | - $visible=new HtmlSemDoubleElement("visible-" . $this->identifier, "div"); |
|
| 68 | + $this->addToProperty("class", "animated ".$animation); |
|
| 69 | + $visible=new HtmlSemDoubleElement("visible-".$this->identifier, "div"); |
|
| 70 | 70 | $visible->setClass("visible content"); |
| 71 | 71 | $visible->setContent($this->content); |
| 72 | - $hidden=new HtmlSemDoubleElement("hidden-" . $this->identifier, "div"); |
|
| 72 | + $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier, "div"); |
|
| 73 | 73 | $hidden->setClass("hidden content"); |
| 74 | 74 | $hidden->setContent($content); |
| 75 | - $this->content=array ($visible,$hidden ); |
|
| 75 | + $this->content=array($visible, $hidden); |
|
| 76 | 76 | return $hidden; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | public function asIcon($icon) { |
| 85 | 85 | $iconO=$icon; |
| 86 | 86 | if (\is_string($icon)) { |
| 87 | - $iconO=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
| 87 | + $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
|
| 88 | 88 | } |
| 89 | 89 | $this->addToProperty("class", "icon"); |
| 90 | 90 | $this->content=$iconO; |
@@ -104,17 +104,17 @@ discard block |
||
| 104 | 104 | * @return HtmlLabel |
| 105 | 105 | */ |
| 106 | 106 | public function addLabel($label, $before=false, $icon=NULL) { |
| 107 | - $this->tagName="div";$prefix=""; |
|
| 108 | - if($before) |
|
| 107 | + $this->tagName="div"; $prefix=""; |
|
| 108 | + if ($before) |
|
| 109 | 109 | $prefix="left "; |
| 110 | 110 | $this->addToProperty("class", $prefix."labeled"); |
| 111 | 111 | $isIcon=(isset($this->content[0]) && $this->content[0] instanceof HtmlIcon); |
| 112 | - $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
|
| 113 | - if($isIcon){ |
|
| 112 | + $this->content=new HtmlButton("button-".$this->identifier, $this->content); |
|
| 113 | + if ($isIcon) { |
|
| 114 | 114 | $this->content->addClass("icon"); |
| 115 | 115 | } |
| 116 | 116 | $this->content->setTagName("div"); |
| 117 | - $label=new HtmlLabel("label-" . $this->identifier, $label, $icon,"a"); |
|
| 117 | + $label=new HtmlLabel("label-".$this->identifier, $label, $icon, "a"); |
|
| 118 | 118 | $label->setBasic(); |
| 119 | 119 | $this->addContent($label, $before); |
| 120 | 120 | return $label; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function fromArray($array) { |
| 128 | 128 | $array=parent::fromArray($array); |
| 129 | - foreach ( $array as $key => $value ) { |
|
| 129 | + foreach ($array as $key => $value) { |
|
| 130 | 130 | $this->setProperty($key, $value); |
| 131 | 131 | } |
| 132 | 132 | return $array; |
@@ -140,10 +140,10 @@ discard block |
||
| 140 | 140 | return $this->addToProperty("class", "positive"); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - public function setColor($color){ |
|
| 144 | - if(\is_array($this->content)){ |
|
| 145 | - foreach ($this->content as $content){ |
|
| 146 | - if($content instanceof HtmlButton) |
|
| 143 | + public function setColor($color) { |
|
| 144 | + if (\is_array($this->content)) { |
|
| 145 | + foreach ($this->content as $content) { |
|
| 146 | + if ($content instanceof HtmlButton) |
|
| 147 | 147 | $content->setColor($color); |
| 148 | 148 | } |
| 149 | 149 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | * @return HtmlButton |
| 202 | 202 | */ |
| 203 | 203 | public static function social($identifier, $social, $value=NULL) { |
| 204 | - if ($value === NULL) |
|
| 204 | + if ($value===NULL) |
|
| 205 | 205 | $value=\ucfirst($social); |
| 206 | 206 | $return=new HtmlButton($identifier, $value); |
| 207 | 207 | $return->addIcon($social); |
@@ -238,8 +238,8 @@ discard block |
||
| 238 | 238 | * {@inheritDoc} |
| 239 | 239 | * @see HtmlSemDoubleElement::asLink() |
| 240 | 240 | */ |
| 241 | - public function asLink($href=NULL,$target=NULL) { |
|
| 242 | - parent::asLink($href,$target); |
|
| 241 | + public function asLink($href=NULL, $target=NULL) { |
|
| 242 | + parent::asLink($href, $target); |
|
| 243 | 243 | return $this; |
| 244 | 244 | } |
| 245 | 245 | |
@@ -252,10 +252,10 @@ discard block |
||
| 252 | 252 | * @param string $icon |
| 253 | 253 | * @return HtmlButtonGroups |
| 254 | 254 | */ |
| 255 | - public static function dropdown($identifier,$value,$items=[],$asCombo=false,$icon=null){ |
|
| 256 | - $result=new HtmlButtonGroups($identifier,[$value]); |
|
| 257 | - $result->addDropdown($items,$asCombo); |
|
| 258 | - if(isset($icon)) |
|
| 255 | + public static function dropdown($identifier, $value, $items=[], $asCombo=false, $icon=null) { |
|
| 256 | + $result=new HtmlButtonGroups($identifier, [$value]); |
|
| 257 | + $result->addDropdown($items, $asCombo); |
|
| 258 | + if (isset($icon)) |
|
| 259 | 259 | $result->setIcon($icon); |
| 260 | 260 | return $result; |
| 261 | 261 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | abstract class HtmlAbsractItem extends HtmlSemDoubleElement { |
| 13 | 13 | |
| 14 | - public function __construct($identifier, $baseClass,$content=NULL) { |
|
| 14 | + public function __construct($identifier, $baseClass, $content=NULL) { |
|
| 15 | 15 | parent::__construct($identifier, "div", $baseClass); |
| 16 | 16 | $this->content=array(); |
| 17 | 17 | $this->initContent($content); |
@@ -19,59 +19,59 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | abstract protected function initContent($content); |
| 21 | 21 | |
| 22 | - public function setIcon($icon){ |
|
| 22 | + public function setIcon($icon) { |
|
| 23 | 23 | $this->content["icon"]=new HtmlIcon("icon-".$this->identifier, $icon); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function removeIcon(){ |
|
| 27 | - if(isset($this->content["icon"])) |
|
| 26 | + public function removeIcon() { |
|
| 27 | + if (isset($this->content["icon"])) |
|
| 28 | 28 | unset($this->content["icon"]); |
| 29 | 29 | return $this; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function setImage($image){ |
|
| 32 | + public function setImage($image) { |
|
| 33 | 33 | $image=new HtmlImg("icon-".$this->identifier, $image); |
| 34 | 34 | $image->asAvatar(); |
| 35 | 35 | $this->content["image"]=$image; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - private function createContent(){ |
|
| 39 | - $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier,"div","content"); |
|
| 38 | + private function createContent() { |
|
| 39 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content"); |
|
| 40 | 40 | return $this->content["content"]; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function setTitle($title,$description=NULL,$baseClass="title"){ |
|
| 44 | - $title=new HtmlSemDoubleElement("","div",$baseClass,$title); |
|
| 45 | - if(\array_key_exists("content", $this->content)===false){ |
|
| 43 | + public function setTitle($title, $description=NULL, $baseClass="title") { |
|
| 44 | + $title=new HtmlSemDoubleElement("", "div", $baseClass, $title); |
|
| 45 | + if (\array_key_exists("content", $this->content)===false) { |
|
| 46 | 46 | $this->createContent(); |
| 47 | 47 | } |
| 48 | 48 | $this->content["content"]->addContent($title); |
| 49 | - if(isset($description)){ |
|
| 50 | - $description=new HtmlSemDoubleElement("","div","description",$description); |
|
| 49 | + if (isset($description)) { |
|
| 50 | + $description=new HtmlSemDoubleElement("", "div", "description", $description); |
|
| 51 | 51 | $this->content["content"]->addContent($description); |
| 52 | 52 | } |
| 53 | 53 | return $this; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - public function getPart($partName="header"){ |
|
| 57 | - $content=\array_merge($this->content["content"]->getContent(),array(@$this->content["icon"],@$this->content["image"])); |
|
| 56 | + public function getPart($partName="header") { |
|
| 57 | + $content=\array_merge($this->content["content"]->getContent(), array(@$this->content["icon"], @$this->content["image"])); |
|
| 58 | 58 | return $this->getElementByPropertyValue("class", $partName, $content); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public function setActive($value=true){ |
|
| 62 | - if($value){ |
|
| 61 | + public function setActive($value=true) { |
|
| 62 | + if ($value) { |
|
| 63 | 63 | $this->setTagName("div"); |
| 64 | 64 | $this->removeProperty("href"); |
| 65 | 65 | $this->addToPropertyCtrl("class", "active", array("active")); |
| 66 | - }else{ |
|
| 66 | + } else { |
|
| 67 | 67 | $this->removePropertyValue("class", "active"); |
| 68 | 68 | } |
| 69 | 69 | return $this; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public function asLink($href=NULL,$part=NULL){ |
|
| 72 | + public function asLink($href=NULL, $part=NULL) { |
|
| 73 | 73 | $this->setTagName("a"); |
| 74 | - if(isset($href)) |
|
| 74 | + if (isset($href)) |
|
| 75 | 75 | $this->setProperty("href", $href); |
| 76 | 76 | return $this; |
| 77 | 77 | } |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 84 | 84 | */ |
| 85 | 85 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 86 | - if(\is_array($this->content) && JArray::isAssociative($this->content)) |
|
| 87 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
| 86 | + if (\is_array($this->content) && JArray::isAssociative($this->content)) |
|
| 87 | + $this->content=JArray::sortAssociative($this->content, ["icon", "image", "content"]); |
|
| 88 | 88 | return parent::compile($js, $view); |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -8,53 +8,53 @@ |
||
| 8 | 8 | class HtmlStepItem extends HtmlAbsractItem { |
| 9 | 9 | |
| 10 | 10 | public function __construct($identifier, $content) { |
| 11 | - parent::__construct($identifier,"step",$content); |
|
| 11 | + parent::__construct($identifier, "step", $content); |
|
| 12 | 12 | } |
| 13 | - protected function initContent($content){ |
|
| 14 | - if(\is_array($content)){ |
|
| 15 | - if(JArray::isAssociative($content)===false){ |
|
| 13 | + protected function initContent($content) { |
|
| 14 | + if (\is_array($content)) { |
|
| 15 | + if (JArray::isAssociative($content)===false) { |
|
| 16 | 16 | $icon=@$content[0]; |
| 17 | 17 | $title=@$content[1]; |
| 18 | 18 | $desc=@$content[2]; |
| 19 | 19 | $status=@$content[3]; |
| 20 | - }else{ |
|
| 20 | + } else { |
|
| 21 | 21 | $icon=@$content["icon"]; |
| 22 | 22 | $title=@$content["title"]; |
| 23 | 23 | $desc=@$content["description"]; |
| 24 | 24 | $status=@$content["status"]; |
| 25 | 25 | } |
| 26 | - if(isset($icon)){ |
|
| 26 | + if (isset($icon)) { |
|
| 27 | 27 | $this->setIcon($icon); |
| 28 | 28 | } |
| 29 | - if(isset($status)){ |
|
| 29 | + if (isset($status)) { |
|
| 30 | 30 | $this->setStatus($status); |
| 31 | 31 | } |
| 32 | - if(isset($title)){ |
|
| 33 | - $this->setTitle($title,$desc); |
|
| 32 | + if (isset($title)) { |
|
| 33 | + $this->setTitle($title, $desc); |
|
| 34 | 34 | } |
| 35 | - }else{ |
|
| 35 | + } else { |
|
| 36 | 36 | $this->setContent($content); |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function setActive($value=true){ |
|
| 41 | - if($value) |
|
| 40 | + public function setActive($value=true) { |
|
| 41 | + if ($value) |
|
| 42 | 42 | $this->setStatus(StepStatus::ACTIVE); |
| 43 | 43 | else |
| 44 | 44 | $this->setStatus(StepStatus::NONE); |
| 45 | 45 | return $this; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function setCompleted(){ |
|
| 49 | - $this->removePropertyValues("class", [StepStatus::COMPLETED,StepStatus::DISABLED]); |
|
| 48 | + public function setCompleted() { |
|
| 49 | + $this->removePropertyValues("class", [StepStatus::COMPLETED, StepStatus::DISABLED]); |
|
| 50 | 50 | return $this->setStatus(StepStatus::COMPLETED); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function setStatus($status){ |
|
| 53 | + public function setStatus($status) { |
|
| 54 | 54 | return $this->addToPropertyCtrl("class", $status, StepStatus::getConstants()); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - public function removeStatus(){ |
|
| 57 | + public function removeStatus() { |
|
| 58 | 58 | $this->removePropertyValues("class", StepStatus::getConstants()); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -9,15 +9,15 @@ discard block |
||
| 9 | 9 | protected $image; |
| 10 | 10 | |
| 11 | 11 | public function __construct($identifier, $content=NULL) { |
| 12 | - parent::__construct($identifier,"item",$content); |
|
| 12 | + parent::__construct($identifier, "item", $content); |
|
| 13 | 13 | } |
| 14 | - protected function initContent($content){ |
|
| 15 | - if(\is_array($content)){ |
|
| 16 | - if(JArray::isAssociative($content)===false){ |
|
| 14 | + protected function initContent($content) { |
|
| 15 | + if (\is_array($content)) { |
|
| 16 | + if (JArray::isAssociative($content)===false) { |
|
| 17 | 17 | $icon=@$content[0]; |
| 18 | 18 | $title=@$content[1]; |
| 19 | 19 | $desc=@$content[2]; |
| 20 | - }else{ |
|
| 20 | + } else { |
|
| 21 | 21 | $icon=@$content["icon"]; |
| 22 | 22 | $image=@$content["image"]; |
| 23 | 23 | $title=@$content["title"]; |
@@ -25,38 +25,38 @@ discard block |
||
| 25 | 25 | $desc=@$content["description"]; |
| 26 | 26 | $items=@$content["items"]; |
| 27 | 27 | } |
| 28 | - if(isset($icon)){ |
|
| 28 | + if (isset($icon)) { |
|
| 29 | 29 | $this->setIcon($icon); |
| 30 | 30 | } |
| 31 | - if(isset($image)){ |
|
| 31 | + if (isset($image)) { |
|
| 32 | 32 | $this->setImage($image); |
| 33 | 33 | } |
| 34 | - if(isset($title)){ |
|
| 35 | - $this->setTitle($title,$desc); |
|
| 36 | - }elseif (isset($header)){ |
|
| 37 | - $this->setTitle($header,$desc,"header"); |
|
| 34 | + if (isset($title)) { |
|
| 35 | + $this->setTitle($title, $desc); |
|
| 36 | + }elseif (isset($header)) { |
|
| 37 | + $this->setTitle($header, $desc, "header"); |
|
| 38 | 38 | } |
| 39 | - if(isset($items)){ |
|
| 39 | + if (isset($items)) { |
|
| 40 | 40 | $this->addList($items); |
| 41 | 41 | } |
| 42 | - }else{ |
|
| 42 | + } else { |
|
| 43 | 43 | $this->setContent($content); |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | - public function addList($items=array(),$ordered=false) { |
|
| 46 | + public function addList($items=array(), $ordered=false) { |
|
| 47 | 47 | $list=new HtmlList("", $items); |
| 48 | - if($ordered) |
|
| 48 | + if ($ordered) |
|
| 49 | 49 | $list->setOrdered(); |
| 50 | 50 | $list->setClass("list"); |
| 51 | 51 | $this->content["list"]=$list; |
| 52 | 52 | return $list; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function getList(){ |
|
| 55 | + public function getList() { |
|
| 56 | 56 | return $this->content["list"]; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function getItem($index){ |
|
| 59 | + public function getItem($index) { |
|
| 60 | 60 | return $this->getList()->getItem($index); |
| 61 | 61 | } |
| 62 | 62 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | class HtmlPopup extends HtmlSemDoubleElement { |
| 13 | 13 | private $_container; |
| 14 | - public function __construct(BaseHtml $container,$identifier, $content="") { |
|
| 14 | + public function __construct(BaseHtml $container, $identifier, $content="") { |
|
| 15 | 15 | parent::__construct($identifier, "div"); |
| 16 | 16 | $this->_container=$container; |
| 17 | 17 | $this->setClass("ui popup"); |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | * {@inheritDoc} |
| 24 | 24 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::addList() |
| 25 | 25 | */ |
| 26 | - public function addList($items=array(),$header=NULL){ |
|
| 27 | - if(!$this->content instanceof HtmlGrid){ |
|
| 28 | - $this->content=new HtmlGrid("Grid-".$this->identifier,0); |
|
| 26 | + public function addList($items=array(), $header=NULL) { |
|
| 27 | + if (!$this->content instanceof HtmlGrid) { |
|
| 28 | + $this->content=new HtmlGrid("Grid-".$this->identifier, 0); |
|
| 29 | 29 | } |
| 30 | 30 | $grid=$this->content; |
| 31 | 31 | |
@@ -33,12 +33,12 @@ discard block |
||
| 33 | 33 | $colCount++; |
| 34 | 34 | $grid->setColsCount($colCount); |
| 35 | 35 | |
| 36 | - $list=new HtmlList("",$items); |
|
| 36 | + $list=new HtmlList("", $items); |
|
| 37 | 37 | $list->asLink(); |
| 38 | - if(isset($header)){ |
|
| 39 | - $list->addHeader(4,$header); |
|
| 38 | + if (isset($header)) { |
|
| 39 | + $list->addHeader(4, $header); |
|
| 40 | 40 | } |
| 41 | - $grid->getCell(0,$colCount-1)->setContent($list); |
|
| 41 | + $grid->getCell(0, $colCount-1)->setContent($list); |
|
| 42 | 42 | $grid->setDivided()->setRelaxed(true); |
| 43 | 43 | return $list; |
| 44 | 44 | } |
@@ -46,14 +46,14 @@ discard block |
||
| 46 | 46 | /** |
| 47 | 47 | * A popup can have no maximum width and continue to flow to fit its content |
| 48 | 48 | */ |
| 49 | - public function setFlowing(){ |
|
| 49 | + public function setFlowing() { |
|
| 50 | 50 | return $this->addToProperty("class", "flowing"); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * A popup can provide more basic formatting |
| 55 | 55 | */ |
| 56 | - public function setBasic(){ |
|
| 56 | + public function setBasic() { |
|
| 57 | 57 | return $this->addToProperty("class", "basic"); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -61,23 +61,23 @@ discard block |
||
| 61 | 61 | * {@inheritDoc} |
| 62 | 62 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
| 63 | 63 | */ |
| 64 | - public function run(JsUtils $js){ |
|
| 64 | + public function run(JsUtils $js) { |
|
| 65 | 65 | parent::run($js); |
| 66 | 66 | $this->_params["popup"]="#".$this->identifier; |
| 67 | - $js->semantic()->popup("#".$this->_container->getIdentifier(),$this->_params); |
|
| 67 | + $js->semantic()->popup("#".$this->_container->getIdentifier(), $this->_params); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - public function setOn($event="click"){ |
|
| 70 | + public function setOn($event="click") { |
|
| 71 | 71 | $this->_params["on"]=$event; |
| 72 | 72 | return $this; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function setInline($value=true){ |
|
| 75 | + public function setInline($value=true) { |
|
| 76 | 76 | $this->_params["inline"]=$value; |
| 77 | 77 | return $this; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function setPosition($position){ |
|
| 80 | + public function setPosition($position) { |
|
| 81 | 81 | $this->_params["position"]=$position; |
| 82 | 82 | return $this; |
| 83 | 83 | } |
@@ -38,22 +38,22 @@ discard block |
||
| 38 | 38 | return $this->getHtmlCk()->attachEvents($events); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function getField(){ |
|
| 41 | + public function getField() { |
|
| 42 | 42 | return $this->content["field"]; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public function getHtmlCk(){ |
|
| 45 | + public function getHtmlCk() { |
|
| 46 | 46 | return $this->content["field"]; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function setName($name){ |
|
| 49 | + public function setName($name) { |
|
| 50 | 50 | $this->getDataField()->setProperty("name", $name); |
| 51 | 51 | return $this; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - public function getDataField(){ |
|
| 55 | - $field= $this->getField(); |
|
| 56 | - if($field instanceof AbstractCheckbox) |
|
| 54 | + public function getDataField() { |
|
| 55 | + $field=$this->getField(); |
|
| 56 | + if ($field instanceof AbstractCheckbox) |
|
| 57 | 57 | $field=$field->getField(); |
| 58 | 58 | return $field; |
| 59 | 59 | } |
@@ -63,10 +63,10 @@ discard block |
||
| 63 | 63 | * @param boolean $value |
| 64 | 64 | * @return HtmlFormField |
| 65 | 65 | */ |
| 66 | - public function setChecked($value=true){ |
|
| 67 | - if($value===true){ |
|
| 66 | + public function setChecked($value=true) { |
|
| 67 | + if ($value===true) { |
|
| 68 | 68 | $this->getDataField()->setProperty("checked", "checked"); |
| 69 | - }else{ |
|
| 69 | + } else { |
|
| 70 | 70 | $this->getDataField()->removeProperty("checked"); |
| 71 | 71 | } |
| 72 | 72 | return $this; |
@@ -12,9 +12,9 @@ discard block |
||
| 12 | 12 | * @property string identifier |
| 13 | 13 | * @property BaseHtml _self |
| 14 | 14 | */ |
| 15 | -trait BaseHtmlEventsTrait{ |
|
| 15 | +trait BaseHtmlEventsTrait { |
|
| 16 | 16 | |
| 17 | - protected $_events=array (); |
|
| 17 | + protected $_events=array(); |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @param string $event |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | * @return BaseHtml |
| 25 | 25 | */ |
| 26 | 26 | public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 27 | - if ($stopPropagation === true) { |
|
| 28 | - $jsCode=Javascript::$stopPropagation . $jsCode; |
|
| 27 | + if ($stopPropagation===true) { |
|
| 28 | + $jsCode=Javascript::$stopPropagation.$jsCode; |
|
| 29 | 29 | } |
| 30 | - if ($preventDefault === true) { |
|
| 31 | - $jsCode=Javascript::$preventDefault . $jsCode; |
|
| 30 | + if ($preventDefault===true) { |
|
| 31 | + $jsCode=Javascript::$preventDefault.$jsCode; |
|
| 32 | 32 | } |
| 33 | 33 | return $this->_addEvent($event, $jsCode); |
| 34 | 34 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | if (\is_array($this->_events[$event])) { |
| 44 | 44 | $this->_events[$event][]=$jsCode; |
| 45 | 45 | } else { |
| 46 | - $this->_events[$event]=array ($this->_events[$event],$jsCode ); |
|
| 46 | + $this->_events[$event]=array($this->_events[$event], $jsCode); |
|
| 47 | 47 | } |
| 48 | 48 | } else { |
| 49 | 49 | $this->_events[$event]=$jsCode; |
@@ -70,10 +70,10 @@ discard block |
||
| 70 | 70 | return $this->onClick($jsCode); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public function onCreate($jsCode){ |
|
| 74 | - if(isset($this->_events["_create"])){ |
|
| 73 | + public function onCreate($jsCode) { |
|
| 74 | + if (isset($this->_events["_create"])) { |
|
| 75 | 75 | $this->_events["_create"][]=$jsCode; |
| 76 | - }else{ |
|
| 76 | + } else { |
|
| 77 | 77 | $this->_events["_create"]=[$jsCode]; |
| 78 | 78 | } |
| 79 | 79 | return $this; |
@@ -82,15 +82,15 @@ discard block |
||
| 82 | 82 | public function addEventsOnRun(JsUtils $js=NULL) { |
| 83 | 83 | $this->_eventsOnCreate($js); |
| 84 | 84 | if (isset($this->_bsComponent)) { |
| 85 | - foreach ( $this->_events as $event => $jsCode ) { |
|
| 85 | + foreach ($this->_events as $event => $jsCode) { |
|
| 86 | 86 | $code=$jsCode; |
| 87 | 87 | if (\is_array($jsCode)) { |
| 88 | 88 | $code=""; |
| 89 | - foreach ( $jsCode as $jsC ) { |
|
| 89 | + foreach ($jsCode as $jsC) { |
|
| 90 | 90 | if ($jsC instanceof AjaxCall) { |
| 91 | - $code.="\n" . $jsC->compile($js); |
|
| 91 | + $code.="\n".$jsC->compile($js); |
|
| 92 | 92 | } else { |
| 93 | - $code.="\n" . $jsC; |
|
| 93 | + $code.="\n".$jsC; |
|
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | } elseif ($jsCode instanceof AjaxCall) { |
@@ -98,18 +98,18 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | $this->_bsComponent->addEvent($event, $code); |
| 100 | 100 | } |
| 101 | - $this->_events=array (); |
|
| 101 | + $this->_events=array(); |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - protected function _eventsOnCreate(JsUtils $js=NULL){ |
|
| 106 | - if(isset($this->_events["_create"])){ |
|
| 105 | + protected function _eventsOnCreate(JsUtils $js=NULL) { |
|
| 106 | + if (isset($this->_events["_create"])) { |
|
| 107 | 107 | $create=$this->_events["_create"]; |
| 108 | - if(\is_array($create)){ |
|
| 108 | + if (\is_array($create)) { |
|
| 109 | 109 | $create=\implode("", $create); |
| 110 | 110 | } |
| 111 | - if(isset($js) && $create!=="") |
|
| 112 | - $js->exec($create,true); |
|
| 111 | + if (isset($js) && $create!=="") |
|
| 112 | + $js->exec($create, true); |
|
| 113 | 113 | unset($this->_events["_create"]); |
| 114 | 114 | } |
| 115 | 115 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * @return BaseHtml |
| 124 | 124 | */ |
| 125 | 125 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 126 | - $params=array ("url" => $url,"responseElement" => $responseElement ); |
|
| 126 | + $params=array("url" => $url, "responseElement" => $responseElement); |
|
| 127 | 127 | $params=array_merge($params, $parameters); |
| 128 | 128 | $this->_addEvent($event, new AjaxCall($operation, $params)); |
| 129 | 129 | return $this; |
@@ -139,10 +139,10 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | public function postOn($event, $url, $params="{}", $responseElement="", $parameters=array()) { |
| 141 | 141 | $allParameters=[]; |
| 142 | - if(isset($parameters["params"])){ |
|
| 142 | + if (isset($parameters["params"])) { |
|
| 143 | 143 | $allParameters[]=JsUtils::_correctParams($parameters["params"]); |
| 144 | 144 | } |
| 145 | - if(isset($params)){ |
|
| 145 | + if (isset($params)) { |
|
| 146 | 146 | $allParameters[]=JsUtils::_correctParams($params); |
| 147 | 147 | } |
| 148 | 148 | $parameters["params"]=\implode("+'&'+", $allParameters); |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | public function jsDoJquery($jqueryCall, $param="") { |
| 166 | - return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . Javascript::prep_value($param) . ");"; |
|
| 166 | + return "$('#".$this->identifier."').".$jqueryCall."(".Javascript::prep_value($param).");"; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | public function executeOnRun($jsCode) { |
@@ -183,6 +183,6 @@ discard block |
||
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | public function jsToggle($value) { |
| 186 | - return $this->jsDoJquery("toggle",$value); |
|
| 186 | + return $this->jsDoJquery("toggle", $value); |
|
| 187 | 187 | } |
| 188 | 188 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | abstract public function addToProperty($name, $value, $separator=" "); |
| 21 | 21 | abstract public function addLabel($caption, $style="label-default", $leftSeparator=" "); |
| 22 | - abstract public function addContent($content,$before=false); |
|
| 22 | + abstract public function addContent($content, $before=false); |
|
| 23 | 23 | abstract public function getField(); |
| 24 | 24 | abstract public function getDataField(); |
| 25 | 25 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function addLoading() { |
| 31 | - if ($this->_hasIcon === false) { |
|
| 31 | + if ($this->_hasIcon===false) { |
|
| 32 | 32 | throw new \Exception("Input must have an icon for showing a loader, use addIcon before"); |
| 33 | 33 | } |
| 34 | 34 | return $this->addToProperty("class", State::LOADING); |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function labeled($label, $direction=Direction::LEFT, $icon=NULL) { |
| 44 | 44 | $field=$this->getField(); |
| 45 | - $labelO=$field->addLabel($label,$direction===Direction::LEFT,$icon); |
|
| 46 | - $field->addToProperty("class", $direction . " labeled"); |
|
| 45 | + $labelO=$field->addLabel($label, $direction===Direction::LEFT, $icon); |
|
| 46 | + $field->addToProperty("class", $direction." labeled"); |
|
| 47 | 47 | return $labelO; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | * @param string $checkboxType |
| 55 | 55 | * @return HtmlLabel |
| 56 | 56 | */ |
| 57 | - public function labeledCheckbox($direction=Direction::LEFT,$caption="",$value=NULL,$checkboxType=NULL){ |
|
| 58 | - return $this->labeled(new HtmlCheckbox("lbl-ck-".$this->getField()->getIdentifier(),$caption,$value,$checkboxType),$direction); |
|
| 57 | + public function labeledCheckbox($direction=Direction::LEFT, $caption="", $value=NULL, $checkboxType=NULL) { |
|
| 58 | + return $this->labeled(new HtmlCheckbox("lbl-ck-".$this->getField()->getIdentifier(), $caption, $value, $checkboxType), $direction); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * @return HtmlLabel |
| 65 | 65 | */ |
| 66 | 66 | public function labeledToCorner($icon, $direction=Direction::LEFT) { |
| 67 | - return $this->labeled("", $direction . " corner", $icon)->toCorner($direction); |
|
| 67 | + return $this->labeled("", $direction." corner", $icon)->toCorner($direction); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -77,13 +77,13 @@ discard block |
||
| 77 | 77 | public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) { |
| 78 | 78 | $field=$this->getField(); |
| 79 | 79 | $actionO=$action; |
| 80 | - if (\is_object($action) === false) { |
|
| 81 | - $actionO=new HtmlButton("action-" . $this->identifier, $action); |
|
| 80 | + if (\is_object($action)===false) { |
|
| 81 | + $actionO=new HtmlButton("action-".$this->identifier, $action); |
|
| 82 | 82 | if (isset($icon)) |
| 83 | 83 | $actionO->addIcon($icon, true, $labeled); |
| 84 | 84 | } |
| 85 | - $field->addToProperty("class", $direction . " action"); |
|
| 86 | - $field->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
|
| 85 | + $field->addToProperty("class", $direction." action"); |
|
| 86 | + $field->addContent($actionO, \strstr($direction, Direction::LEFT)!==false); |
|
| 87 | 87 | return $actionO; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -93,34 +93,34 @@ discard block |
||
| 93 | 93 | * @param string $direction |
| 94 | 94 | * @return HtmlLabel |
| 95 | 95 | */ |
| 96 | - public function addDropdown($label="", $items=array(),$direction=Direction::RIGHT){ |
|
| 97 | - $labelO=new HtmlDropdown("dd-".$this->identifier,$label,$items); |
|
| 98 | - $labelO->asSelect("select-".$this->identifier,false,true); |
|
| 99 | - return $this->labeled($labelO,$direction); |
|
| 96 | + public function addDropdown($label="", $items=array(), $direction=Direction::RIGHT) { |
|
| 97 | + $labelO=new HtmlDropdown("dd-".$this->identifier, $label, $items); |
|
| 98 | + $labelO->asSelect("select-".$this->identifier, false, true); |
|
| 99 | + return $this->labeled($labelO, $direction); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | public function setTransparent() { |
| 103 | 103 | return $this->getField()->addToProperty("class", "transparent"); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - public function setReadonly(){ |
|
| 106 | + public function setReadonly() { |
|
| 107 | 107 | $this->getDataField()->setProperty("readonly", ""); |
| 108 | 108 | return $this; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - public function setName($name){ |
|
| 112 | - $this->getDataField()->setProperty("name",$name); |
|
| 111 | + public function setName($name) { |
|
| 112 | + $this->getDataField()->setProperty("name", $name); |
|
| 113 | 113 | return $this; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - public function setFluid(){ |
|
| 117 | - $this->getField()->addToProperty("class","fluid"); |
|
| 116 | + public function setFluid() { |
|
| 117 | + $this->getField()->addToProperty("class", "fluid"); |
|
| 118 | 118 | return $this; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | public function setDisabled($disable=true) { |
| 122 | 122 | $field=$this->getField(); |
| 123 | - if($disable) |
|
| 123 | + if ($disable) |
|
| 124 | 124 | $field->addToProperty("class", "disabled"); |
| 125 | 125 | return $this; |
| 126 | 126 | } |