@@ -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) { |
@@ -15,36 +15,36 @@ discard block |
||
| 15 | 15 | protected $_paramParts=array(); |
| 16 | 16 | |
| 17 | 17 | public function __construct($identifier, $header="", $content="", $actions=null) { |
| 18 | - parent::__construct($identifier, "div","ui modal"); |
|
| 19 | - if(isset($header)){ |
|
| 18 | + parent::__construct($identifier, "div", "ui modal"); |
|
| 19 | + if (isset($header)) { |
|
| 20 | 20 | $this->setHeader($header); |
| 21 | 21 | } |
| 22 | - if(isset($content)){ |
|
| 22 | + if (isset($content)) { |
|
| 23 | 23 | $this->setContent($content); |
| 24 | 24 | } |
| 25 | - if(isset($actions)){ |
|
| 25 | + if (isset($actions)) { |
|
| 26 | 26 | $this->setActions($actions); |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function setHeader($value) { |
| 31 | - $this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value); |
|
| 31 | + $this->content["header"]=new HtmlSemDoubleElement("header-".$this->identifier, "a", "header", $value); |
|
| 32 | 32 | return $this; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function setContent($value) { |
| 36 | - $this->content["content"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", $value); |
|
| 36 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", $value); |
|
| 37 | 37 | return $this; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function setActions($actions) { |
| 41 | - $this->content["actions"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "actions"); |
|
| 42 | - if(\is_array($actions)){ |
|
| 43 | - foreach ($actions as $action){ |
|
| 41 | + $this->content["actions"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "actions"); |
|
| 42 | + if (\is_array($actions)) { |
|
| 43 | + foreach ($actions as $action) { |
|
| 44 | 44 | $this->addAction($action); |
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | - else{ |
|
| 47 | + else { |
|
| 48 | 48 | $this->addAction($actions); |
| 49 | 49 | } |
| 50 | 50 | return $this; |
@@ -54,17 +54,17 @@ discard block |
||
| 54 | 54 | * @param string|BaseHtml $action |
| 55 | 55 | * @return HtmlButton |
| 56 | 56 | */ |
| 57 | - public function addAction($action){ |
|
| 58 | - if(!$action instanceof BaseHtml){ |
|
| 57 | + public function addAction($action) { |
|
| 58 | + if (!$action instanceof BaseHtml) { |
|
| 59 | 59 | $class=""; |
| 60 | - if(\array_search($action, ["Okay","Yes"])!==false){ |
|
| 60 | + if (\array_search($action, ["Okay", "Yes"])!==false) { |
|
| 61 | 61 | $class="approve"; |
| 62 | 62 | } |
| 63 | - if(\array_search($action, ["Close","Cancel","No"])!==false){ |
|
| 63 | + if (\array_search($action, ["Close", "Cancel", "No"])!==false) { |
|
| 64 | 64 | $class="cancel"; |
| 65 | 65 | } |
| 66 | - $action=new HtmlButton("action-".$this->identifier."-".\sizeof($this->content["actions"]->getContent()),$action); |
|
| 67 | - if($class!=="") |
|
| 66 | + $action=new HtmlButton("action-".$this->identifier."-".\sizeof($this->content["actions"]->getContent()), $action); |
|
| 67 | + if ($class!=="") |
|
| 68 | 68 | $action->addToProperty("class", $class); |
| 69 | 69 | } |
| 70 | 70 | return $this->addElementInPart($action, "actions"); |
@@ -74,66 +74,66 @@ discard block |
||
| 74 | 74 | * @param int $index |
| 75 | 75 | * @return HtmlButton |
| 76 | 76 | */ |
| 77 | - public function getAction($index){ |
|
| 77 | + public function getAction($index) { |
|
| 78 | 78 | return $this->content["actions"]->getContent()[$index]; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - public function addContent($content,$before=false){ |
|
| 82 | - $this->content["content"]->addContent($content,$before); |
|
| 81 | + public function addContent($content, $before=false) { |
|
| 82 | + $this->content["content"]->addContent($content, $before); |
|
| 83 | 83 | return $this; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - public function addImageContent($image,$description=NULL){ |
|
| 86 | + public function addImageContent($image, $description=NULL) { |
|
| 87 | 87 | $content=$this->content["content"]; |
| 88 | - if(isset($description)){ |
|
| 89 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
| 90 | - $content->addContent($description,true); |
|
| 88 | + if (isset($description)) { |
|
| 89 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
| 90 | + $content->addContent($description, true); |
|
| 91 | 91 | } |
| 92 | - if($image!==""){ |
|
| 93 | - $img=new HtmlImage("image-".$this->identifier,$image,"","medium"); |
|
| 94 | - $content->addContent($img,true); |
|
| 95 | - $content->addToProperty("class","image"); |
|
| 92 | + if ($image!=="") { |
|
| 93 | + $img=new HtmlImage("image-".$this->identifier, $image, "", "medium"); |
|
| 94 | + $content->addContent($img, true); |
|
| 95 | + $content->addToProperty("class", "image"); |
|
| 96 | 96 | } |
| 97 | 97 | return $this; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - public function addIconContent($icon,$description=NULL){ |
|
| 100 | + public function addIconContent($icon, $description=NULL) { |
|
| 101 | 101 | $content=$this->content["content"]; |
| 102 | - if(isset($description)){ |
|
| 103 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
| 104 | - $content->addContent($description,true); |
|
| 102 | + if (isset($description)) { |
|
| 103 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
| 104 | + $content->addContent($description, true); |
|
| 105 | 105 | } |
| 106 | - if($icon!==""){ |
|
| 107 | - $img=new HtmlIcon("image-".$this->identifier,$icon); |
|
| 108 | - $content->addContent($img,true); |
|
| 109 | - $content->addToProperty("class","image"); |
|
| 106 | + if ($icon!=="") { |
|
| 107 | + $img=new HtmlIcon("image-".$this->identifier, $icon); |
|
| 108 | + $content->addContent($img, true); |
|
| 109 | + $content->addToProperty("class", "image"); |
|
| 110 | 110 | } |
| 111 | 111 | return $this; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - private function addElementInPart($element,$part) { |
|
| 114 | + private function addElementInPart($element, $part) { |
|
| 115 | 115 | $this->content[$part]->addContent($element); |
| 116 | 116 | return $element; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - public function showDimmer($value){ |
|
| 120 | - $value=$value?"show":"hide"; |
|
| 119 | + public function showDimmer($value) { |
|
| 120 | + $value=$value ? "show" : "hide"; |
|
| 121 | 121 | $this->_paramParts[]=["'".$value." dimmer'"]; |
| 122 | 122 | return $this; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - public function setInverted($recursive=true){ |
|
| 125 | + public function setInverted($recursive=true) { |
|
| 126 | 126 | $this->_params["inverted"]=true; |
| 127 | 127 | return $this; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - public function setBasic(){ |
|
| 130 | + public function setBasic() { |
|
| 131 | 131 | return $this->addToProperty("class", "basic"); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | |
| 135 | - public function setTransition($value){ |
|
| 136 | - $this->_paramParts[]=["'setting'","'transition'","'".$value."'"]; |
|
| 135 | + public function setTransition($value) { |
|
| 136 | + $this->_paramParts[]=["'setting'", "'transition'", "'".$value."'"]; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -143,8 +143,8 @@ discard block |
||
| 143 | 143 | * @param string $viewName |
| 144 | 144 | * @param $params The parameters to pass to the view |
| 145 | 145 | */ |
| 146 | - public function renderView(JsUtils $js,$initialController,$viewName, $params=array()) { |
|
| 147 | - return $this->setContent($js->renderContent($initialController, $viewName,$params)); |
|
| 146 | + public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) { |
|
| 147 | + return $this->setContent($js->renderContent($initialController, $viewName, $params)); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | * @param string $actionName the action name |
| 156 | 156 | * @param array $params |
| 157 | 157 | */ |
| 158 | - public function forward(JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
| 159 | - return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName,$params)); |
|
| 158 | + public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
| 159 | + return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params)); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 167 | 167 | */ |
| 168 | 168 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 169 | - $this->content=JArray::sortAssociative($this->content, ["header","content","actions" ]); |
|
| 169 | + $this->content=JArray::sortAssociative($this->content, ["header", "content", "actions"]); |
|
| 170 | 170 | return parent::compile($js, $view); |
| 171 | 171 | } |
| 172 | 172 | /* |
@@ -174,8 +174,8 @@ discard block |
||
| 174 | 174 | * @see BaseHtml::run() |
| 175 | 175 | */ |
| 176 | 176 | public function run(JsUtils $js) { |
| 177 | - if(isset($this->_bsComponent)===false) |
|
| 178 | - $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
| 177 | + if (isset($this->_bsComponent)===false) |
|
| 178 | + $this->_bsComponent=$js->semantic()->modal("#".$this->identifier, $this->_params, $this->_paramParts); |
|
| 179 | 179 | $this->addEventsOnRun($js); |
| 180 | 180 | return $this->_bsComponent; |
| 181 | 181 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | return $this->jsDo("hide"); |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - public function onHidden($js){ |
|
| 191 | + public function onHidden($js) { |
|
| 192 | 192 | $this->_params["onHidden"]=$js; |
| 193 | 193 | } |
| 194 | 194 | } |
@@ -14,19 +14,19 @@ discard block |
||
| 14 | 14 | * @property boolean $_visibleHover |
| 15 | 15 | * @property InstanceViewer $_instanceViewer |
| 16 | 16 | */ |
| 17 | -trait DataTableFieldAsTrait{ |
|
| 17 | +trait DataTableFieldAsTrait { |
|
| 18 | 18 | abstract public function addField($field); |
| 19 | - abstract public function insertField($index,$field); |
|
| 20 | - abstract public function insertInField($index,$field); |
|
| 21 | - abstract public function fieldAs($index,$type,$attributes=NULL); |
|
| 19 | + abstract public function insertField($index, $field); |
|
| 20 | + abstract public function insertInField($index, $field); |
|
| 21 | + abstract public function fieldAs($index, $type, $attributes=NULL); |
|
| 22 | 22 | /** |
| 23 | 23 | * @param string $caption |
| 24 | 24 | * @param callable $callback |
| 25 | 25 | * @param boolean $visibleHover |
| 26 | 26 | * @return callable |
| 27 | 27 | */ |
| 28 | - private function getFieldButtonCallable($caption,$visibleHover=true,$callback=null){ |
|
| 29 | - return $this->getCallable("getFieldButton",[$caption,$visibleHover],$callback); |
|
| 28 | + private function getFieldButtonCallable($caption, $visibleHover=true, $callback=null) { |
|
| 29 | + return $this->getCallable("getFieldButton", [$caption, $visibleHover], $callback); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -35,20 +35,20 @@ discard block |
||
| 35 | 35 | * @param callable $callback |
| 36 | 36 | * @return callable |
| 37 | 37 | */ |
| 38 | - private function getCallable($thisCallback,$parameters,$callback=null){ |
|
| 39 | - $result=function($instance) use($thisCallback,$parameters,$callback){ |
|
| 40 | - $object=call_user_func_array(array($this,$thisCallback), $parameters); |
|
| 41 | - if(isset($callback)){ |
|
| 42 | - if(\is_callable($callback)){ |
|
| 43 | - $callback($object,$instance,$this->_instanceViewer->count()+1); |
|
| 38 | + private function getCallable($thisCallback, $parameters, $callback=null) { |
|
| 39 | + $result=function($instance) use($thisCallback, $parameters, $callback){ |
|
| 40 | + $object=call_user_func_array(array($this, $thisCallback), $parameters); |
|
| 41 | + if (isset($callback)) { |
|
| 42 | + if (\is_callable($callback)) { |
|
| 43 | + $callback($object, $instance, $this->_instanceViewer->count()+1); |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | - if($object instanceof HtmlSemDoubleElement){ |
|
| 46 | + if ($object instanceof HtmlSemDoubleElement) { |
|
| 47 | 47 | $id=$this->_instanceViewer->getIdentifier(); |
| 48 | - $object->setProperty("data-ajax",$id); |
|
| 49 | - if($object->propertyContains("class","visibleover")){ |
|
| 48 | + $object->setProperty("data-ajax", $id); |
|
| 49 | + if ($object->propertyContains("class", "visibleover")) { |
|
| 50 | 50 | $this->_visibleHover=true; |
| 51 | - $object->setProperty("style","visibility:hidden;"); |
|
| 51 | + $object->setProperty("style", "visibility:hidden;"); |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | return $object; |
@@ -60,16 +60,16 @@ discard block |
||
| 60 | 60 | * @param string $caption |
| 61 | 61 | * @return HtmlButton |
| 62 | 62 | */ |
| 63 | - private function getFieldButton($caption,$visibleHover=true){ |
|
| 64 | - $bt= new HtmlButton("",$caption); |
|
| 65 | - if($visibleHover) |
|
| 63 | + private function getFieldButton($caption, $visibleHover=true) { |
|
| 64 | + $bt=new HtmlButton("", $caption); |
|
| 65 | + if ($visibleHover) |
|
| 66 | 66 | $this->_visibleOver($bt); |
| 67 | 67 | return $bt; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - private function getFieldButtons($buttons,$visibleHover=true){ |
|
| 71 | - $bts=new HtmlButtonGroups("",$buttons); |
|
| 72 | - if($visibleHover) |
|
| 70 | + private function getFieldButtons($buttons, $visibleHover=true) { |
|
| 71 | + $bts=new HtmlButtonGroups("", $buttons); |
|
| 72 | + if ($visibleHover) |
|
| 73 | 73 | $this->_visibleOver($bts); |
| 74 | 74 | return $bts; |
| 75 | 75 | } |
@@ -83,19 +83,19 @@ discard block |
||
| 83 | 83 | * @param array $attributes associative array (<b>ajax</b> key is for ajax post) |
| 84 | 84 | * @return DataTable |
| 85 | 85 | */ |
| 86 | - public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){ |
|
| 87 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$index,$attributes){ |
|
| 88 | - $button=new HtmlButton($id,$value,$cssStyle); |
|
| 89 | - $button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]); |
|
| 90 | - if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) |
|
| 86 | + public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) { |
|
| 87 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $index, $attributes){ |
|
| 88 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
| 89 | + $button->postOnClick($url, "$(event.target).closest('tr').find(':input').serialize()", $responseElement, $attributes["ajax"]); |
|
| 90 | + if (!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) |
|
| 91 | 91 | $this->_visibleOver($button); |
| 92 | 92 | return $button; |
| 93 | - }, $index,$attributes); |
|
| 93 | + }, $index, $attributes); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - protected function _visibleOver(BaseHtml $element){ |
|
| 96 | + protected function _visibleOver(BaseHtml $element) { |
|
| 97 | 97 | $this->_visibleHover=true; |
| 98 | - return $element->addToProperty("class", "visibleover")->setProperty("style","visibility:hidden;"); |
|
| 98 | + return $element->addToProperty("class", "visibleover")->setProperty("style", "visibility:hidden;"); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | * @param boolean $visibleHover |
| 106 | 106 | * @return DataTable |
| 107 | 107 | */ |
| 108 | - public function addFieldButton($caption,$visibleHover=true,$callback=null){ |
|
| 109 | - $this->addField($this->getCallable("getFieldButton",[$caption,$visibleHover],$callback)); |
|
| 108 | + public function addFieldButton($caption, $visibleHover=true, $callback=null) { |
|
| 109 | + $this->addField($this->getCallable("getFieldButton", [$caption, $visibleHover], $callback)); |
|
| 110 | 110 | return $this; |
| 111 | 111 | } |
| 112 | 112 | |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | * @param boolean $visibleHover |
| 118 | 118 | * @return DataTable |
| 119 | 119 | */ |
| 120 | - public function addFieldButtons($buttons,$visibleHover=true,$callback=null){ |
|
| 121 | - $this->addField($this->getCallable("getFieldButtons",[$buttons,$visibleHover],$callback)); |
|
| 120 | + public function addFieldButtons($buttons, $visibleHover=true, $callback=null) { |
|
| 121 | + $this->addField($this->getCallable("getFieldButtons", [$buttons, $visibleHover], $callback)); |
|
| 122 | 122 | return $this; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | * @param callable $callback |
| 130 | 130 | * @return DataTable |
| 131 | 131 | */ |
| 132 | - public function insertFieldButton($index,$caption,$visibleHover=true,$callback=null){ |
|
| 133 | - $this->insertField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback)); |
|
| 132 | + public function insertFieldButton($index, $caption, $visibleHover=true, $callback=null) { |
|
| 133 | + $this->insertField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback)); |
|
| 134 | 134 | return $this; |
| 135 | 135 | } |
| 136 | 136 | |
@@ -141,25 +141,25 @@ discard block |
||
| 141 | 141 | * @param callable $callback |
| 142 | 142 | * @return DataTable |
| 143 | 143 | */ |
| 144 | - public function insertInFieldButton($index,$caption,$visibleHover=true,$callback=null){ |
|
| 145 | - $this->insertInField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback)); |
|
| 144 | + public function insertInFieldButton($index, $caption, $visibleHover=true, $callback=null) { |
|
| 145 | + $this->insertInField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback)); |
|
| 146 | 146 | return $this; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - private function addDefaultButton($icon,$class=null,$visibleHover=true,$callback=null){ |
|
| 150 | - $this->addField($this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback)); |
|
| 149 | + private function addDefaultButton($icon, $class=null, $visibleHover=true, $callback=null) { |
|
| 150 | + $this->addField($this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback)); |
|
| 151 | 151 | return $this; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - private function insertDefaultButtonIn($index,$icon,$class=null,$visibleHover=true,$callback=null){ |
|
| 155 | - $this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback)); |
|
| 154 | + private function insertDefaultButtonIn($index, $icon, $class=null, $visibleHover=true, $callback=null) { |
|
| 155 | + $this->insertInField($index, $this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback)); |
|
| 156 | 156 | return $this; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - private function getDefaultButton($icon,$class=null,$visibleHover=true){ |
|
| 160 | - $bt=$this->getFieldButton("",$visibleHover); |
|
| 159 | + private function getDefaultButton($icon, $class=null, $visibleHover=true) { |
|
| 160 | + $bt=$this->getFieldButton("", $visibleHover); |
|
| 161 | 161 | $bt->asIcon($icon); |
| 162 | - if(isset($class)) |
|
| 162 | + if (isset($class)) |
|
| 163 | 163 | $bt->addClass($class); |
| 164 | 164 | return $bt; |
| 165 | 165 | } |
@@ -171,9 +171,9 @@ discard block |
||
| 171 | 171 | * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
| 172 | 172 | * @return DataTable |
| 173 | 173 | */ |
| 174 | - public function addDeleteButton($visibleHover=true,$deleteBehavior=[],$callback=null){ |
|
| 174 | + public function addDeleteButton($visibleHover=true, $deleteBehavior=[], $callback=null) { |
|
| 175 | 175 | $this->_deleteBehavior=$deleteBehavior; |
| 176 | - return $this->addDefaultButton("remove","_delete red basic",$visibleHover,$callback); |
|
| 176 | + return $this->addDefaultButton("remove", "_delete red basic", $visibleHover, $callback); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
@@ -183,9 +183,9 @@ discard block |
||
| 183 | 183 | * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
| 184 | 184 | * @return DataTable |
| 185 | 185 | */ |
| 186 | - public function addEditButton($visibleHover=true,$editBehavior=[],$callback=null){ |
|
| 186 | + public function addEditButton($visibleHover=true, $editBehavior=[], $callback=null) { |
|
| 187 | 187 | $this->_editBehavior=$editBehavior; |
| 188 | - return $this->addDefaultButton("edit","_edit basic",$visibleHover,$callback); |
|
| 188 | + return $this->addDefaultButton("edit", "_edit basic", $visibleHover, $callback); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
@@ -196,20 +196,20 @@ discard block |
||
| 196 | 196 | * @param callable $callbackDelete this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
| 197 | 197 | * @return DataTable |
| 198 | 198 | */ |
| 199 | - public function addEditDeleteButtons($visibleHover=true,$behavior=[],$callbackEdit=null,$callbackDelete=null){ |
|
| 200 | - $this->addEditButton($visibleHover,$behavior,$callbackEdit); |
|
| 199 | + public function addEditDeleteButtons($visibleHover=true, $behavior=[], $callbackEdit=null, $callbackDelete=null) { |
|
| 200 | + $this->addEditButton($visibleHover, $behavior, $callbackEdit); |
|
| 201 | 201 | $index=$this->_instanceViewer->visiblePropertiesCount()-1; |
| 202 | - $this->insertDeleteButtonIn($index,$visibleHover,$behavior,$callbackDelete); |
|
| 202 | + $this->insertDeleteButtonIn($index, $visibleHover, $behavior, $callbackDelete); |
|
| 203 | 203 | return $this; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - public function insertDeleteButtonIn($index,$visibleHover=true,$deleteBehavior=[],$callback=null){ |
|
| 206 | + public function insertDeleteButtonIn($index, $visibleHover=true, $deleteBehavior=[], $callback=null) { |
|
| 207 | 207 | $this->_deleteBehavior=$deleteBehavior; |
| 208 | - return $this->insertDefaultButtonIn($index,"remove","_delete red basic",$visibleHover,$callback); |
|
| 208 | + return $this->insertDefaultButtonIn($index, "remove", "_delete red basic", $visibleHover, $callback); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - public function insertEditButtonIn($index,$visibleHover=true,$editBehavior=[],$callback=null){ |
|
| 211 | + public function insertEditButtonIn($index, $visibleHover=true, $editBehavior=[], $callback=null) { |
|
| 212 | 212 | $this->_editBehavior=$editBehavior; |
| 213 | - return $this->insertDefaultButtonIn($index,"edit","_edit basic",$visibleHover,$callback); |
|
| 213 | + return $this->insertDefaultButtonIn($index, "edit", "_edit basic", $visibleHover, $callback); |
|
| 214 | 214 | } |
| 215 | 215 | } |
@@ -20,46 +20,46 @@ discard block |
||
| 20 | 20 | * @property string $identifier |
| 21 | 21 | */ |
| 22 | 22 | trait FieldsTrait { |
| 23 | - abstract public function addFields($fields=NULL,$label=NULL); |
|
| 23 | + abstract public function addFields($fields=NULL, $label=NULL); |
|
| 24 | 24 | abstract public function addItem($item); |
| 25 | 25 | |
| 26 | - protected function createItem($value){ |
|
| 27 | - if(\is_array($value)){ |
|
| 28 | - $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id",""),JArray::getDefaultValue($value, "label",null),JArray::getDefaultValue($value, "type", "text"),JArray::getDefaultValue($value, "value",""),JArray::getDefaultValue($value, "placeholder",JArray::getDefaultValue($value, "label",null))); |
|
| 26 | + protected function createItem($value) { |
|
| 27 | + if (\is_array($value)) { |
|
| 28 | + $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id", ""), JArray::getDefaultValue($value, "label", null), JArray::getDefaultValue($value, "type", "text"), JArray::getDefaultValue($value, "value", ""), JArray::getDefaultValue($value, "placeholder", JArray::getDefaultValue($value, "label", null))); |
|
| 29 | 29 | return $itemO; |
| 30 | - }elseif(\is_object($value)){ |
|
| 30 | + }elseif (\is_object($value)) { |
|
| 31 | 31 | $itemO=new HtmlFormField("field-".$this->identifier, $value); |
| 32 | 32 | return $itemO; |
| 33 | - }else |
|
| 33 | + } else |
|
| 34 | 34 | return new HtmlFormInput($value); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - protected function createCondition($value){ |
|
| 37 | + protected function createCondition($value) { |
|
| 38 | 38 | return \is_object($value)===false || $value instanceof \Ajax\semantic\html\elements\HtmlInput; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function addInputs($inputs,$fieldslabel=null){ |
|
| 41 | + public function addInputs($inputs, $fieldslabel=null) { |
|
| 42 | 42 | $fields=array(); |
| 43 | - foreach ($inputs as $input){ |
|
| 43 | + foreach ($inputs as $input) { |
|
| 44 | 44 | \extract($input); |
| 45 | - $f=new HtmlFormInput("",""); |
|
| 45 | + $f=new HtmlFormInput("", ""); |
|
| 46 | 46 | $f->fromArray($input); |
| 47 | 47 | $fields[]=$f; |
| 48 | 48 | } |
| 49 | - return $this->addFields($fields,$fieldslabel); |
|
| 49 | + return $this->addFields($fields, $fieldslabel); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function addFieldRule($index,$type,$prompt=NULL,$value=NULL){ |
|
| 52 | + public function addFieldRule($index, $type, $prompt=NULL, $value=NULL) { |
|
| 53 | 53 | $field=$this->getItem($index); |
| 54 | - if(isset($field)){ |
|
| 55 | - $field->addRule($type,$prompt,$value); |
|
| 54 | + if (isset($field)) { |
|
| 55 | + $field->addRule($type, $prompt, $value); |
|
| 56 | 56 | } |
| 57 | 57 | return $this; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - public function addFieldRules($index,$rules){ |
|
| 60 | + public function addFieldRules($index, $rules) { |
|
| 61 | 61 | $field=$this->getItem($index); |
| 62 | - if(isset($field)){ |
|
| 62 | + if (isset($field)) { |
|
| 63 | 63 | $field->addRules($rules); |
| 64 | 64 | } |
| 65 | 65 | return $this; |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | * @param boolean $multiple |
| 75 | 75 | * @return HtmlFormDropdown |
| 76 | 76 | */ |
| 77 | - public function addDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false){ |
|
| 78 | - return $this->addItem(new HtmlFormDropdown($identifier,$items,$label,$value,$multiple)); |
|
| 77 | + public function addDropdown($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false) { |
|
| 78 | + return $this->addItem(new HtmlFormDropdown($identifier, $items, $label, $value, $multiple)); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | * @param boolean $asIcons |
| 86 | 86 | * @return HtmlButtonGroups |
| 87 | 87 | */ |
| 88 | - public function addButtonGroups($identifier,$elements=[],$asIcons=false){ |
|
| 89 | - return $this->addItem(new HtmlButtonGroups($identifier,$elements,$asIcons)); |
|
| 88 | + public function addButtonGroups($identifier, $elements=[], $asIcons=false) { |
|
| 89 | + return $this->addItem(new HtmlButtonGroups($identifier, $elements, $asIcons)); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | * @param string $icon |
| 99 | 99 | * @return HtmlButtonGroups |
| 100 | 100 | */ |
| 101 | - public function addDropdownButton($identifier,$value,$items=[],$asCombo=false,$icon=null){ |
|
| 102 | - return $this->addItem(HtmlButton::dropdown($identifier, $value,$items,$asCombo,$icon)); |
|
| 101 | + public function addDropdownButton($identifier, $value, $items=[], $asCombo=false, $icon=null) { |
|
| 102 | + return $this->addItem(HtmlButton::dropdown($identifier, $value, $items, $asCombo, $icon)); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -110,8 +110,8 @@ discard block |
||
| 110 | 110 | * @param string $placeholder |
| 111 | 111 | * @return HtmlFormInput |
| 112 | 112 | */ |
| 113 | - public function addInput($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL){ |
|
| 114 | - return $this->addItem(new HtmlFormInput($identifier,$label,$type,$value,$placeholder)); |
|
| 113 | + public function addInput($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
| 114 | + return $this->addItem(new HtmlFormInput($identifier, $label, $type, $value, $placeholder)); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -122,28 +122,28 @@ discard block |
||
| 122 | 122 | * @param int $rows |
| 123 | 123 | * @return HtmlTextarea |
| 124 | 124 | */ |
| 125 | - public function addTextarea($identifier, $label,$value=NULL,$placeholder=NULL,$rows=5){ |
|
| 126 | - return $this->addItem(new HtmlFormTextarea($identifier,$label,$value,$placeholder,$rows)); |
|
| 125 | + public function addTextarea($identifier, $label, $value=NULL, $placeholder=NULL, $rows=5) { |
|
| 126 | + return $this->addItem(new HtmlFormTextarea($identifier, $label, $value, $placeholder, $rows)); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - public function addPassword($identifier, $label=NULL){ |
|
| 130 | - return $this->addItem(new HtmlFormInput($identifier,$label,"password","","")); |
|
| 129 | + public function addPassword($identifier, $label=NULL) { |
|
| 130 | + return $this->addItem(new HtmlFormInput($identifier, $label, "password", "", "")); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - public function addButton($identifier,$value,$cssStyle=NULL,$onClick=NULL){ |
|
| 134 | - return $this->addItem(new HtmlButton($identifier,$value,$cssStyle,$onClick)); |
|
| 133 | + public function addButton($identifier, $value, $cssStyle=NULL, $onClick=NULL) { |
|
| 134 | + return $this->addItem(new HtmlButton($identifier, $value, $cssStyle, $onClick)); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - public function addCheckbox($identifier, $label=NULL,$value=NULL,$type=NULL){ |
|
| 138 | - return $this->addItem(new HtmlFormCheckbox($identifier,$label,$value,$type)); |
|
| 137 | + public function addCheckbox($identifier, $label=NULL, $value=NULL, $type=NULL) { |
|
| 138 | + return $this->addItem(new HtmlFormCheckbox($identifier, $label, $value, $type)); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - public function addRadio($identifier, $name,$label=NULL,$value=NULL){ |
|
| 142 | - return $this->addItem(new HtmlFormRadio($identifier,$name,$label,$value)); |
|
| 141 | + public function addRadio($identifier, $name, $label=NULL, $value=NULL) { |
|
| 142 | + return $this->addItem(new HtmlFormRadio($identifier, $name, $label, $value)); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - public function addElement($identifier,$content,$label,$tagName="div",$baseClass=""){ |
|
| 146 | - $div=new HtmlSemDoubleElement($identifier,$tagName,$baseClass,$content); |
|
| 147 | - return $this->addItem(new HtmlFormField("field-".$identifier, $div,$label)); |
|
| 145 | + public function addElement($identifier, $content, $label, $tagName="div", $baseClass="") { |
|
| 146 | + $div=new HtmlSemDoubleElement($identifier, $tagName, $baseClass, $content); |
|
| 147 | + return $this->addItem(new HtmlFormField("field-".$identifier, $div, $label)); |
|
| 148 | 148 | } |
| 149 | 149 | } |
@@ -18,11 +18,11 @@ discard block |
||
| 18 | 18 | protected $_dropdown; |
| 19 | 19 | public function __construct($identifier, $elements=array(), $asIcons=false) { |
| 20 | 20 | parent::__construct($identifier, "div", "ui buttons"); |
| 21 | - if ($asIcons === true) |
|
| 21 | + if ($asIcons===true) |
|
| 22 | 22 | $this->asIcons(); |
| 23 | 23 | $this->addElements($elements, $asIcons); |
| 24 | 24 | } |
| 25 | - protected function createItem($value){ |
|
| 25 | + protected function createItem($value) { |
|
| 26 | 26 | return new HtmlButton("", $value); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | * @param boolean $asCombo |
| 32 | 32 | * @return HtmlDropdown |
| 33 | 33 | */ |
| 34 | - public function addDropdown($items,$asCombo=false){ |
|
| 35 | - $dd= new HtmlDropdown("dd-".$this->identifier,null,$items); |
|
| 34 | + public function addDropdown($items, $asCombo=false) { |
|
| 35 | + $dd=new HtmlDropdown("dd-".$this->identifier, null, $items); |
|
| 36 | 36 | $dd->asButton(); |
| 37 | - if($asCombo){ |
|
| 37 | + if ($asCombo) { |
|
| 38 | 38 | $dd->setAction("combo"); |
| 39 | 39 | $dd->addToProperty("class", "combo"); |
| 40 | 40 | } |
@@ -45,13 +45,13 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | public function addElement($element, $asIcon=false) { |
| 47 | 47 | $item=$this->addItem($element); |
| 48 | - if($asIcon) |
|
| 48 | + if ($asIcon) |
|
| 49 | 49 | $item->asIcon($element); |
| 50 | 50 | return $item; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | public function addElements($elements, $asIcons=false) { |
| 54 | - foreach ( $elements as $element ) { |
|
| 54 | + foreach ($elements as $element) { |
|
| 55 | 55 | $this->addElement($element, $asIcons); |
| 56 | 56 | } |
| 57 | 57 | return $this; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | public function insertOr($aferIndex=0, $or="or") { |
| 61 | 61 | $orElement=new HtmlSemDoubleElement("", "div", "or"); |
| 62 | 62 | $orElement->setProperty("data-text", $or); |
| 63 | - array_splice($this->content, $aferIndex + 1, 0, array ($orElement )); |
|
| 63 | + array_splice($this->content, $aferIndex+1, 0, array($orElement)); |
|
| 64 | 64 | return $this; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public function asIcons() { |
| 76 | - foreach ( $this->content as $item ) { |
|
| 77 | - if($item instanceof HtmlButton) |
|
| 76 | + foreach ($this->content as $item) { |
|
| 77 | + if ($item instanceof HtmlButton) |
|
| 78 | 78 | $item->asIcon($item->getContent()); |
| 79 | 79 | } |
| 80 | 80 | return $this->addToProperty("class", "icons"); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
| 108 | 108 | */ |
| 109 | 109 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 110 | - foreach ( $this->content as $element ) { |
|
| 110 | + foreach ($this->content as $element) { |
|
| 111 | 111 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
| 112 | 112 | } |
| 113 | 113 | return $this; |
@@ -119,10 +119,10 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | public function addClasses($classes=array()) { |
| 121 | 121 | $i=0; |
| 122 | - if(!\is_array($classes)){ |
|
| 123 | - $classes=array_fill (0,$this->count(),$classes); |
|
| 122 | + if (!\is_array($classes)) { |
|
| 123 | + $classes=array_fill(0, $this->count(), $classes); |
|
| 124 | 124 | } |
| 125 | - foreach ( $this->content as $button ) { |
|
| 125 | + foreach ($this->content as $button) { |
|
| 126 | 126 | $button->addToProperty("class", $classes[$i++]); |
| 127 | 127 | } |
| 128 | 128 | return $this; |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | $this->addElement($function($object)); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - public function run(JsUtils $js){ |
|
| 140 | - $result= parent::run($js); |
|
| 139 | + public function run(JsUtils $js) { |
|
| 140 | + $result=parent::run($js); |
|
| 141 | 141 | return $result->setItemSelector(".ui.button"); |
| 142 | 142 | } |
| 143 | 143 | |
@@ -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,11 +11,11 @@ discard block |
||
| 11 | 11 | trait JsUtilsEventsTrait { |
| 12 | 12 | |
| 13 | 13 | |
| 14 | - protected $jquery_events=array ( |
|
| 15 | - "bind","blur","change","click","dblclick","delegate","die","error","focus","focusin","focusout","hover","keydown","keypress","keyup","live","load","mousedown","mousseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","off","on","one","ready","resize","scroll","select","submit","toggle","trigger","triggerHandler","undind","undelegate","unload" |
|
| 14 | + protected $jquery_events=array( |
|
| 15 | + "bind", "blur", "change", "click", "dblclick", "delegate", "die", "error", "focus", "focusin", "focusout", "hover", "keydown", "keypress", "keyup", "live", "load", "mousedown", "mousseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "off", "on", "one", "ready", "resize", "scroll", "select", "submit", "toggle", "trigger", "triggerHandler", "undind", "undelegate", "unload" |
|
| 16 | 16 | ); |
| 17 | 17 | |
| 18 | - abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true); |
|
| 18 | + abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true); |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Outputs a javascript library blur event |
@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | * @param boolean $stopPropagation |
| 50 | 50 | * @return string |
| 51 | 51 | */ |
| 52 | - public function click($element='this', $js='', $ret_false=TRUE,$preventDefault=false,$stopPropagation=false) { |
|
| 52 | + public function click($element='this', $js='', $ret_false=TRUE, $preventDefault=false, $stopPropagation=false) { |
|
| 53 | 53 | if (!is_array($js)) { |
| 54 | - $js=array ( |
|
| 54 | + $js=array( |
|
| 55 | 55 | $js |
| 56 | 56 | ); |
| 57 | 57 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $js[]="return false;"; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - return $this->_add_event($element, $js, 'click',$preventDefault,$stopPropagation); |
|
| 63 | + return $this->_add_event($element, $js, 'click', $preventDefault, $stopPropagation); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -13,29 +13,29 @@ discard block |
||
| 13 | 13 | use Ajax\semantic\html\collections\form\traits\FieldTrait; |
| 14 | 14 | |
| 15 | 15 | class HtmlDropdown extends HtmlSemDoubleElement { |
| 16 | - use FieldTrait,LabeledIconTrait { |
|
| 16 | + use FieldTrait, LabeledIconTrait { |
|
| 17 | 17 | addIcon as addIconP; |
| 18 | 18 | } |
| 19 | 19 | protected $mClass="menu"; |
| 20 | 20 | protected $mTagName="div"; |
| 21 | - protected $items=array (); |
|
| 22 | - protected $_params=array("action"=>"nothing","on"=>"hover"); |
|
| 21 | + protected $items=array(); |
|
| 22 | + protected $_params=array("action"=>"nothing", "on"=>"hover"); |
|
| 23 | 23 | protected $input; |
| 24 | 24 | protected $value; |
| 25 | 25 | protected $_associative; |
| 26 | 26 | protected $_multiple; |
| 27 | 27 | |
| 28 | - public function __construct($identifier, $value="", $items=array(),$associative=true) { |
|
| 28 | + public function __construct($identifier, $value="", $items=array(), $associative=true) { |
|
| 29 | 29 | parent::__construct($identifier, "div"); |
| 30 | 30 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
| 31 | 31 | $this->setProperty("class", "ui dropdown"); |
| 32 | 32 | $this->_multiple=false; |
| 33 | 33 | $content=[]; |
| 34 | - if(isset($value)){ |
|
| 35 | - if($value instanceof HtmlSemDoubleElement){ |
|
| 34 | + if (isset($value)) { |
|
| 35 | + if ($value instanceof HtmlSemDoubleElement) { |
|
| 36 | 36 | $text=$value; |
| 37 | - }else{ |
|
| 38 | - $text=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
|
| 37 | + } else { |
|
| 38 | + $text=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
| 39 | 39 | $text->setClass("text"); |
| 40 | 40 | $this->setValue($value); |
| 41 | 41 | } |
@@ -48,29 +48,29 @@ discard block |
||
| 48 | 48 | $this->addItems($items); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function getField(){ |
|
| 51 | + public function getField() { |
|
| 52 | 52 | return $this->input; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function getDataField(){ |
|
| 55 | + public function getDataField() { |
|
| 56 | 56 | return $this->input; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function addItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
| 60 | - $itemO=$this->beforeAddItem($item,$value,$image,$description); |
|
| 59 | + public function addItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
| 60 | + $itemO=$this->beforeAddItem($item, $value, $image, $description); |
|
| 61 | 61 | $this->items[]=$itemO; |
| 62 | 62 | return $itemO; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
| 65 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
| 66 | 66 | $this->removeArrow(); |
| 67 | - $this->addIconP($icon,$before,$labeled); |
|
| 67 | + $this->addIconP($icon, $before, $labeled); |
|
| 68 | 68 | return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter(""); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function addIcons($icons){ |
|
| 71 | + public function addIcons($icons) { |
|
| 72 | 72 | $count=$this->count(); |
| 73 | - for ($i=0;$i<\sizeof($icons) && $i<$count;$i++){ |
|
| 73 | + for ($i=0; $i<\sizeof($icons) && $i<$count; $i++) { |
|
| 74 | 74 | $this->getItem($i)->addIcon($icons[$i]); |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -81,33 +81,33 @@ discard block |
||
| 81 | 81 | * @param number $position |
| 82 | 82 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 83 | 83 | */ |
| 84 | - public function insertItem($item,$position=0){ |
|
| 84 | + public function insertItem($item, $position=0) { |
|
| 85 | 85 | $itemO=$this->beforeAddItem($item); |
| 86 | - $start = array_slice($this->items, 0, $position); |
|
| 87 | - $end = array_slice($this->items, $position); |
|
| 88 | - $start[] = $item; |
|
| 86 | + $start=array_slice($this->items, 0, $position); |
|
| 87 | + $end=array_slice($this->items, $position); |
|
| 88 | + $start[]=$item; |
|
| 89 | 89 | $this->items=array_merge($start, $end); |
| 90 | 90 | return $itemO; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - protected function removeArrow(){ |
|
| 94 | - if(\sizeof($this->content)>1){ |
|
| 93 | + protected function removeArrow() { |
|
| 94 | + if (\sizeof($this->content)>1) { |
|
| 95 | 95 | unset($this->content["arrow"]); |
| 96 | 96 | $this->content=\array_values($this->content); |
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - protected function beforeAddItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
| 100 | + protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
| 101 | 101 | $itemO=$item; |
| 102 | - if(\is_array($item)){ |
|
| 102 | + if (\is_array($item)) { |
|
| 103 | 103 | $description=JArray::getValue($item, "description", 3); |
| 104 | 104 | $value=JArray::getValue($item, "value", 1); |
| 105 | 105 | $image=JArray::getValue($item, "image", 2); |
| 106 | 106 | $item=JArray::getValue($item, "item", 0); |
| 107 | 107 | } |
| 108 | - if(!$item instanceof HtmlDropdownItem){ |
|
| 109 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
|
| 110 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 108 | + if (!$item instanceof HtmlDropdownItem) { |
|
| 109 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description); |
|
| 110 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
| 111 | 111 | $this->addToProperty("class", "vertical"); |
| 112 | 112 | } |
| 113 | 113 | return $itemO; |
@@ -120,11 +120,11 @@ discard block |
||
| 120 | 120 | $this->addItem($function($object)); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public function addInput($name){ |
|
| 124 | - if(!isset($name)) |
|
| 123 | + public function addInput($name) { |
|
| 124 | + if (!isset($name)) |
|
| 125 | 125 | $name="input-".$this->identifier; |
| 126 | 126 | $this->setAction("activate"); |
| 127 | - $this->input=new HtmlInput($name,"hidden"); |
|
| 127 | + $this->input=new HtmlInput($name, "hidden"); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -133,15 +133,15 @@ discard block |
||
| 133 | 133 | * @param string $icon |
| 134 | 134 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 135 | 135 | */ |
| 136 | - public function addSearchInputItem($placeHolder=NULL,$icon=NULL){ |
|
| 137 | - return $this->addItem(HtmlDropdownItem::searchInput($placeHolder,$icon)); |
|
| 136 | + public function addSearchInputItem($placeHolder=NULL, $icon=NULL) { |
|
| 137 | + return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon)); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
| 141 | 141 | * Adds a divider item |
| 142 | 142 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 143 | 143 | */ |
| 144 | - public function addDividerItem(){ |
|
| 144 | + public function addDividerItem() { |
|
| 145 | 145 | return $this->addItem(HtmlDropdownItem::divider()); |
| 146 | 146 | } |
| 147 | 147 | |
@@ -151,8 +151,8 @@ discard block |
||
| 151 | 151 | * @param string $icon |
| 152 | 152 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 153 | 153 | */ |
| 154 | - public function addHeaderItem($caption=NULL,$icon=NULL){ |
|
| 155 | - return $this->addItem(HtmlDropdownItem::header($caption,$icon)); |
|
| 154 | + public function addHeaderItem($caption=NULL, $icon=NULL) { |
|
| 155 | + return $this->addItem(HtmlDropdownItem::header($caption, $icon)); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * @param string $color |
| 162 | 162 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 163 | 163 | */ |
| 164 | - public function addCircularLabelItem($caption,$color){ |
|
| 164 | + public function addCircularLabelItem($caption, $color) { |
|
| 165 | 165 | return $this->addItem(HtmlDropdownItem::circular($caption, $color)); |
| 166 | 166 | } |
| 167 | 167 | |
@@ -170,17 +170,17 @@ discard block |
||
| 170 | 170 | * @param string $image |
| 171 | 171 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 172 | 172 | */ |
| 173 | - public function addMiniAvatarImageItem($caption,$image){ |
|
| 173 | + public function addMiniAvatarImageItem($caption, $image) { |
|
| 174 | 174 | return $this->addItem(HtmlDropdownItem::avatar($caption, $image)); |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - public function addItems($items){ |
|
| 178 | - if(\is_array($items) && $this->_associative){ |
|
| 179 | - foreach ($items as $k=>$v){ |
|
| 177 | + public function addItems($items) { |
|
| 178 | + if (\is_array($items) && $this->_associative) { |
|
| 179 | + foreach ($items as $k=>$v) { |
|
| 180 | 180 | $this->addItem($v)->setData($k); |
| 181 | 181 | } |
| 182 | - }else{ |
|
| 183 | - foreach ($items as $item){ |
|
| 182 | + } else { |
|
| 183 | + foreach ($items as $item) { |
|
| 184 | 184 | $this->addItem($item); |
| 185 | 185 | } |
| 186 | 186 | } |
@@ -192,98 +192,98 @@ discard block |
||
| 192 | 192 | * @param array $values |
| 193 | 193 | * @return HtmlCollection |
| 194 | 194 | */ |
| 195 | - public function setPropertyValues($property,$values){ |
|
| 195 | + public function setPropertyValues($property, $values) { |
|
| 196 | 196 | $i=0; |
| 197 | - if(\is_array($values)===false){ |
|
| 198 | - $values=\array_fill(0, $this->count(),$values); |
|
| 197 | + if (\is_array($values)===false) { |
|
| 198 | + $values=\array_fill(0, $this->count(), $values); |
|
| 199 | 199 | } |
| 200 | - foreach ($values as $value){ |
|
| 200 | + foreach ($values as $value) { |
|
| 201 | 201 | $c=$this->items[$i++]; |
| 202 | - if(isset($c)){ |
|
| 203 | - $c->setProperty($property,$value); |
|
| 202 | + if (isset($c)) { |
|
| 203 | + $c->setProperty($property, $value); |
|
| 204 | 204 | } |
| 205 | - else{ |
|
| 205 | + else { |
|
| 206 | 206 | return $this; |
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | return $this; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - public function each($callBack){ |
|
| 213 | - foreach ($this->items as $index=>$value){ |
|
| 214 | - $callBack($index,$value); |
|
| 212 | + public function each($callBack) { |
|
| 213 | + foreach ($this->items as $index=>$value) { |
|
| 214 | + $callBack($index, $value); |
|
| 215 | 215 | } |
| 216 | 216 | return $this; |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - public function getItem($index){ |
|
| 219 | + public function getItem($index) { |
|
| 220 | 220 | return $this->items[$index]; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | /** |
| 224 | 224 | * @return int |
| 225 | 225 | */ |
| 226 | - public function count(){ |
|
| 226 | + public function count() { |
|
| 227 | 227 | return \sizeof($this->items); |
| 228 | 228 | } |
| 229 | 229 | /** |
| 230 | 230 | * @param boolean $dropdown |
| 231 | 231 | */ |
| 232 | - public function asDropdown($dropdown){ |
|
| 233 | - if($dropdown===false){ |
|
| 232 | + public function asDropdown($dropdown) { |
|
| 233 | + if ($dropdown===false) { |
|
| 234 | 234 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 235 | 235 | $dropdown="menu"; |
| 236 | - }else{ |
|
| 236 | + } else { |
|
| 237 | 237 | $dropdown="dropdown"; |
| 238 | 238 | $this->mClass="menu"; |
| 239 | 239 | } |
| 240 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
| 240 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - public function setVertical(){ |
|
| 244 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
| 243 | + public function setVertical() { |
|
| 244 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - public function setInline(){ |
|
| 248 | - return $this->addToPropertyCtrl("class", "inline",["inline"]); |
|
| 247 | + public function setInline() { |
|
| 248 | + return $this->addToPropertyCtrl("class", "inline", ["inline"]); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | - public function setSimple(){ |
|
| 252 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
| 251 | + public function setSimple() { |
|
| 252 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - public function asButton($floating=false){ |
|
| 255 | + public function asButton($floating=false) { |
|
| 256 | 256 | $this->removeArrow(); |
| 257 | - if($floating) |
|
| 257 | + if ($floating) |
|
| 258 | 258 | $this->addToProperty("class", "floating"); |
| 259 | 259 | $this->removePropertyValue("class", "selection"); |
| 260 | 260 | return $this->addToProperty("class", "button"); |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
| 263 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
| 264 | 264 | $this->_multiple=$multiple; |
| 265 | - if(isset($name)) |
|
| 265 | + if (isset($name)) |
|
| 266 | 266 | $this->addInput($name); |
| 267 | - if($multiple){ |
|
| 267 | + if ($multiple) { |
|
| 268 | 268 | $this->addToProperty("class", "multiple"); |
| 269 | 269 | } |
| 270 | - if ($selection){ |
|
| 271 | - if($this->propertyContains("class", "button")===false) |
|
| 272 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 270 | + if ($selection) { |
|
| 271 | + if ($this->propertyContains("class", "button")===false) |
|
| 272 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
| 273 | 273 | } |
| 274 | 274 | return $this; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - public function asSearch($name=NULL,$multiple=false,$selection=true){ |
|
| 278 | - $this->asSelect($name,$multiple,$selection); |
|
| 277 | + public function asSearch($name=NULL, $multiple=false, $selection=true) { |
|
| 278 | + $this->asSelect($name, $multiple, $selection); |
|
| 279 | 279 | return $this->addToProperty("class", "search"); |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - public function setSelect($name=NULL,$multiple=false){ |
|
| 283 | - if(!isset($name)) |
|
| 282 | + public function setSelect($name=NULL, $multiple=false) { |
|
| 283 | + if (!isset($name)) |
|
| 284 | 284 | $name="select-".$this->identifier; |
| 285 | 285 | $this->input=null; |
| 286 | - if($multiple){ |
|
| 286 | + if ($multiple) { |
|
| 287 | 287 | $this->setProperty("multiple", true); |
| 288 | 288 | $this->addToProperty("class", "multiple"); |
| 289 | 289 | } |
@@ -291,37 +291,37 @@ discard block |
||
| 291 | 291 | $this->tagName="select"; |
| 292 | 292 | $this->setProperty("name", $name); |
| 293 | 293 | $this->content=null; |
| 294 | - foreach ($this->items as $item){ |
|
| 294 | + foreach ($this->items as $item) { |
|
| 295 | 295 | $item->asOption(); |
| 296 | 296 | } |
| 297 | 297 | return $this; |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - public function asSubmenu($pointing=NULL){ |
|
| 300 | + public function asSubmenu($pointing=NULL) { |
|
| 301 | 301 | $this->setClass("ui dropdown link item"); |
| 302 | - if(isset($pointing)){ |
|
| 302 | + if (isset($pointing)) { |
|
| 303 | 303 | $this->setPointing($pointing); |
| 304 | 304 | } |
| 305 | 305 | return $this; |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - public function setPointing($value=Direction::NONE){ |
|
| 309 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
| 308 | + public function setPointing($value=Direction::NONE) { |
|
| 309 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | - public function setValue($value){ |
|
| 312 | + public function setValue($value) { |
|
| 313 | 313 | $this->value=$value; |
| 314 | 314 | return $this; |
| 315 | 315 | } |
| 316 | - private function applyValue(){ |
|
| 316 | + private function applyValue() { |
|
| 317 | 317 | $value=$this->value; |
| 318 | - if(isset($this->input) && isset($value)){ |
|
| 318 | + if (isset($this->input) && isset($value)) { |
|
| 319 | 319 | $this->input->setProperty("value", $value); |
| 320 | - }else{ |
|
| 320 | + } else { |
|
| 321 | 321 | $this->setProperty("value", $value); |
| 322 | 322 | } |
| 323 | 323 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
| 324 | - if(isset($textElement) && !$this->_multiple) |
|
| 324 | + if (isset($textElement) && !$this->_multiple) |
|
| 325 | 325 | $textElement->setContent($value); |
| 326 | 326 | return $this; |
| 327 | 327 | } |
@@ -331,9 +331,9 @@ discard block |
||
| 331 | 331 | * @see BaseHtml::run() |
| 332 | 332 | */ |
| 333 | 333 | public function run(JsUtils $js) { |
| 334 | - if($this->propertyContains("class", "simple")===false){ |
|
| 335 | - if(isset($this->_bsComponent)===false){ |
|
| 336 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
| 334 | + if ($this->propertyContains("class", "simple")===false) { |
|
| 335 | + if (isset($this->_bsComponent)===false) { |
|
| 336 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
| 337 | 337 | $this->_bsComponent->setItemSelector(".item"); |
| 338 | 338 | } |
| 339 | 339 | $this->addEventsOnRun($js); |
@@ -341,36 +341,36 @@ discard block |
||
| 341 | 341 | } |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - public function setCompact(){ |
|
| 344 | + public function setCompact() { |
|
| 345 | 345 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | - public function setAction($action){ |
|
| 348 | + public function setAction($action) { |
|
| 349 | 349 | $this->_params["action"]=$action; |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - public function setFullTextSearch($value){ |
|
| 352 | + public function setFullTextSearch($value) { |
|
| 353 | 353 | $this->_params["fullTextSearch"]=$value; |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 357 | 357 | $this->applyValue(); |
| 358 | - return parent::compile($js,$view); |
|
| 358 | + return parent::compile($js, $view); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | public function getInput() { |
| 362 | 362 | return $this->input; |
| 363 | 363 | } |
| 364 | 364 | public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) { |
| 365 | - return $this->_addAction($this, $action,$direction,$icon,$labeled); |
|
| 365 | + return $this->_addAction($this, $action, $direction, $icon, $labeled); |
|
| 366 | 366 | } |
| 367 | 367 | |
| 368 | - public function setIcon($icon="dropdown"){ |
|
| 368 | + public function setIcon($icon="dropdown") { |
|
| 369 | 369 | $this->content["arrow"]=new HtmlIcon($this->identifier."-icon", $icon); |
| 370 | 370 | return $this; |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - public function jsAddItem($caption){ |
|
| 373 | + public function jsAddItem($caption) { |
|
| 374 | 374 | $js="var first=$('#{$this->identifier} .item').first();if(first!=undefined){var new =first.clone();first.parent().append(new);first.html('{$caption}};')"; |
| 375 | 375 | return $js; |
| 376 | 376 | } |
@@ -2,10 +2,10 @@ discard block |
||
| 2 | 2 | namespace Ajax\common\traits; |
| 3 | 3 | use Ajax\common\BaseGui; |
| 4 | 4 | |
| 5 | -trait JsUtilsInternalTrait{ |
|
| 5 | +trait JsUtilsInternalTrait { |
|
| 6 | 6 | |
| 7 | - protected $jquery_code_for_compile=array (); |
|
| 8 | - protected $jquery_code_for_compile_at_last=array (); |
|
| 7 | + protected $jquery_code_for_compile=array(); |
|
| 8 | + protected $jquery_code_for_compile_at_last=array(); |
|
| 9 | 9 | |
| 10 | 10 | protected function _addToCompile($jsScript) { |
| 11 | 11 | $this->jquery_code_for_compile[]=$jsScript; |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | * @param BaseGui $library |
| 16 | 16 | * @param mixed $view |
| 17 | 17 | */ |
| 18 | - protected function _compileLibrary(BaseGui $library=NULL, &$view=NULL){ |
|
| 18 | + protected function _compileLibrary(BaseGui $library=NULL, &$view=NULL) { |
|
| 19 | 19 | if ($library!=NULL) { |
| 20 | - if(isset($view)) |
|
| 20 | + if (isset($view)) |
|
| 21 | 21 | $library->compileHtml($this, $view); |
| 22 | 22 | if ($library->isAutoCompile()) { |
| 23 | 23 | $library->compile(true); |
@@ -25,20 +25,20 @@ discard block |
||
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - protected function defer($script){ |
|
| 28 | + protected function defer($script) { |
|
| 29 | 29 | $result="window.defer=function (method) {if (window.jQuery) method(); else setTimeout(function() { defer(method) }, 50);};"; |
| 30 | 30 | $result.="window.defer(function(){".$script."})"; |
| 31 | 31 | return $result; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - protected function ready($script){ |
|
| 34 | + protected function ready($script) { |
|
| 35 | 35 | $result='$(document).ready(function() {'."\n"; |
| 36 | 36 | $result.=$script.'})'; |
| 37 | 37 | return $result; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | protected function minify($input) { |
| 41 | - if(trim($input) === "") return $input; |
|
| 41 | + if (trim($input)==="") return $input; |
|
| 42 | 42 | return preg_replace( |
| 43 | 43 | array( |
| 44 | 44 | // Remove comment(s) |