@@ -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 | } |
@@ -10,61 +10,61 @@ |
||
| 10 | 10 | * @param string $identifier |
| 11 | 11 | * @param object $modelInstance |
| 12 | 12 | */ |
| 13 | - public function __construct($identifier,$modelInstance=null,$fieldsOrder=[],$fieldsDefinition=[],$fields=[],$captions=[],$separators=[]) { |
|
| 14 | - parent::__construct($identifier,$modelInstance,$fieldsOrder,$fieldsDefinition,$fields,$captions,$separators); |
|
| 13 | + public function __construct($identifier, $modelInstance=null, $fieldsOrder=[], $fieldsDefinition=[], $fields=[], $captions=[], $separators=[]) { |
|
| 14 | + parent::__construct($identifier, $modelInstance, $fieldsOrder, $fieldsDefinition, $fields, $captions, $separators); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - protected function getDefaultModelInstance(){ |
|
| 17 | + protected function getDefaultModelInstance() { |
|
| 18 | 18 | return new UserModel(); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public static function regular($identifier,$modelInstance=null){ |
|
| 22 | - return new FormAccount($identifier,$modelInstance, |
|
| 23 | - ["message","login","password","passwordConf","email","submit","error"], |
|
| 21 | + public static function regular($identifier, $modelInstance=null) { |
|
| 22 | + return new FormAccount($identifier, $modelInstance, |
|
| 23 | + ["message", "login", "password", "passwordConf", "email", "submit", "error"], |
|
| 24 | 24 | ["message"=>[["icon"=>"sign in"]], |
| 25 | 25 | "input0"=>[["rules"=>"empty"]], |
| 26 | - "input1"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty']]], |
|
| 27 | - "input2"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
| 26 | + "input1"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty']]], |
|
| 27 | + "input2"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
| 28 | 28 | "input3"=>[["rules"=>"email"]], |
| 29 | 29 | "submit"=>["green fluid"], |
| 30 | 30 | "message2"=>[["error"=>true]]], |
| 31 | - ["Account","login","password","passwordConf","email","submit","error"], |
|
| 32 | - ["Please enter your account informations","Login","Password","Password confirmation","Email address","Creation"], |
|
| 33 | - [0,1,3,4,5,6]); |
|
| 31 | + ["Account", "login", "password", "passwordConf", "email", "submit", "error"], |
|
| 32 | + ["Please enter your account informations", "Login", "Password", "Password confirmation", "Email address", "Creation"], |
|
| 33 | + [0, 1, 3, 4, 5, 6]); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public static function smallInline($identifier,$modelInstance=null){ |
|
| 37 | - $result=new FormAccount($identifier,$modelInstance, |
|
| 38 | - ["login","password","submit"], |
|
| 39 | - ["input0"=>[["rules"=>"empty"]],"input1"=>[["inputType"=>"password","rules"=>"empty"]],"submit"=>["green basic"]], |
|
| 40 | - ["login","password","submit"], |
|
| 41 | - ["","","Connection"], |
|
| 36 | + public static function smallInline($identifier, $modelInstance=null) { |
|
| 37 | + $result=new FormAccount($identifier, $modelInstance, |
|
| 38 | + ["login", "password", "submit"], |
|
| 39 | + ["input0"=>[["rules"=>"empty"]], "input1"=>[["inputType"=>"password", "rules"=>"empty"]], "submit"=>["green basic"]], |
|
| 40 | + ["login", "password", "submit"], |
|
| 41 | + ["", "", "Connection"], |
|
| 42 | 42 | [2]); |
| 43 | 43 | $result->addDividerBefore(0, "Connection"); |
| 44 | 44 | return $result; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public static function small($identifier,$modelInstance=null){ |
|
| 48 | - $result=new FormAccount($identifier,$modelInstance, |
|
| 49 | - ["login","password","passwordConf","email","submit"], |
|
| 47 | + public static function small($identifier, $modelInstance=null) { |
|
| 48 | + $result=new FormAccount($identifier, $modelInstance, |
|
| 49 | + ["login", "password", "passwordConf", "email", "submit"], |
|
| 50 | 50 | [ |
| 51 | 51 | "input0"=>[["rules"=>"empty"]], |
| 52 | - "input1"=>[["inputType"=>"password","rules"=>['minLength[6]', 'empty']]], |
|
| 53 | - "input2"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
| 52 | + "input1"=>[["inputType"=>"password", "rules"=>['minLength[6]', 'empty']]], |
|
| 53 | + "input2"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
| 54 | 54 | "input3"=>[["rules"=>"email"]], |
| 55 | 55 | "submit"=>["green basic"]], |
| 56 | - ["login","password","passwordConf","email","submit"], |
|
| 57 | - ["Login","Password","Password confirmation","Email address","Creation"], |
|
| 58 | - [1,2]); |
|
| 56 | + ["login", "password", "passwordConf", "email", "submit"], |
|
| 57 | + ["Login", "Password", "Password confirmation", "Email address", "Creation"], |
|
| 58 | + [1, 2]); |
|
| 59 | 59 | $result->addDividerBefore(0, "Creation"); |
| 60 | 60 | return $result; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - public static function attachedSegment($identifier,$modelInstance=null){ |
|
| 64 | - $result=self::regular($identifier,$modelInstance); |
|
| 65 | - $result->fieldAsMessage("message",["icon"=>"sign in","attached"=>true]); |
|
| 66 | - $result->addWrapper("message",null,"<div class='ui attached segment'>"); |
|
| 67 | - $result->addWrapper("error", null,"</div>"); |
|
| 63 | + public static function attachedSegment($identifier, $modelInstance=null) { |
|
| 64 | + $result=self::regular($identifier, $modelInstance); |
|
| 65 | + $result->fieldAsMessage("message", ["icon"=>"sign in", "attached"=>true]); |
|
| 66 | + $result->addWrapper("message", null, "<div class='ui attached segment'>"); |
|
| 67 | + $result->addWrapper("error", null, "</div>"); |
|
| 68 | 68 | return $result; |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -16,19 +16,19 @@ discard block |
||
| 16 | 16 | protected $ajaxLoader='<span></span><span></span><span></span><span></span><span></span>'; |
| 17 | 17 | |
| 18 | 18 | abstract public function getUrl($url); |
| 19 | - abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true); |
|
| 19 | + abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true); |
|
| 20 | 20 | |
| 21 | - protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) { |
|
| 22 | - if(JString::isNull($params)){$params="{}";} |
|
| 21 | + protected function _ajax($method, $url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) { |
|
| 22 | + if (JString::isNull($params)) {$params="{}"; } |
|
| 23 | 23 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 24 | 24 | $retour=$this->_getAjaxUrl($url, $attr); |
| 25 | 25 | $responseElement=$this->_getResponseElement($responseElement); |
| 26 | 26 | $retour.="var self=this;\n"; |
| 27 | - if($hasLoader===true){ |
|
| 27 | + if ($hasLoader===true) { |
|
| 28 | 28 | $this->addLoading($retour, $responseElement); |
| 29 | 29 | } |
| 30 | 30 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
| 31 | - $retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n"; |
|
| 31 | + $retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback)."});\n"; |
|
| 32 | 32 | if ($immediatly) |
| 33 | 33 | $this->jquery_code_for_compile[]=$retour; |
| 34 | 34 | return $retour; |
@@ -36,33 +36,33 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | |
| 39 | - protected function _getAjaxUrl($url,$attr){ |
|
| 39 | + protected function _getAjaxUrl($url, $attr) { |
|
| 40 | 40 | $url=$this->_correctAjaxUrl($url); |
| 41 | 41 | $retour="url='".$url."';"; |
| 42 | 42 | $slash="/"; |
| 43 | - if(JString::endswith($url, "/")===true) |
|
| 43 | + if (JString::endswith($url, "/")===true) |
|
| 44 | 44 | $slash=""; |
| 45 | - if(JString::isNotNull($attr)){ |
|
| 45 | + if (JString::isNotNull($attr)) { |
|
| 46 | 46 | if ($attr==="value") |
| 47 | 47 | $retour.="url=url+'".$slash."'+$(this).val();\n"; |
| 48 | 48 | elseif ($attr==="html") |
| 49 | 49 | $retour.="url=url+'".$slash."'+$(this).html();\n"; |
| 50 | - elseif($attr!==null && $attr!=="") |
|
| 50 | + elseif ($attr!==null && $attr!=="") |
|
| 51 | 51 | $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
| 52 | 52 | } |
| 53 | 53 | return $retour; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - protected function _getOnAjaxDone($responseElement,$jqueryDone,$ajaxTransition,$jsCallback){ |
|
| 57 | - $retour="";$call=null; |
|
| 56 | + protected function _getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback) { |
|
| 57 | + $retour=""; $call=null; |
|
| 58 | 58 | if ($responseElement!=="") { |
| 59 | - if(isset($ajaxTransition)){ |
|
| 59 | + if (isset($ajaxTransition)) { |
|
| 60 | 60 | $call=$this->setAjaxDataCall($ajaxTransition); |
| 61 | - }elseif(isset($this->ajaxTransition)){ |
|
| 61 | + }elseif (isset($this->ajaxTransition)) { |
|
| 62 | 62 | $call=$this->ajaxTransition; |
| 63 | 63 | } |
| 64 | - if(\is_callable($call)) |
|
| 65 | - $retour="\t".$call($responseElement,$jqueryDone).";\n"; |
|
| 64 | + if (\is_callable($call)) |
|
| 65 | + $retour="\t".$call($responseElement, $jqueryDone).";\n"; |
|
| 66 | 66 | else |
| 67 | 67 | $retour="\t$({$responseElement}).{$jqueryDone}( data );\n"; |
| 68 | 68 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | return $retour; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - protected function _getResponseElement($responseElement){ |
|
| 73 | + protected function _getResponseElement($responseElement) { |
|
| 74 | 74 | if ($responseElement!=="") { |
| 75 | 75 | $responseElement=Javascript::prep_value($responseElement); |
| 76 | 76 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | protected function _correctAjaxUrl($url) { |
| 81 | 81 | if ($url!=="/" && JString::endsWith($url, "/")===true) |
| 82 | 82 | $url=substr($url, 0, strlen($url)-1); |
| 83 | - if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
|
| 83 | + if (strncmp($url, 'http://', 7)!=0 && strncmp($url, 'https://', 8)!=0) { |
|
| 84 | 84 | $url=$this->getUrl($url); |
| 85 | 85 | } |
| 86 | 86 | return $url; |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | $retour.="\t\t$({$responseElement}).prepend('{$loading_notifier}');\n"; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - protected function setAjaxDataCall($params){ |
|
| 101 | + protected function setAjaxDataCall($params) { |
|
| 102 | 102 | $result=null; |
| 103 | - if(!\is_callable($params)){ |
|
| 104 | - $result=function ($responseElement,$jqueryDone="html") use($params){ |
|
| 105 | - return AjaxTransition::{$params}($responseElement,$jqueryDone); |
|
| 103 | + if (!\is_callable($params)) { |
|
| 104 | + $result=function($responseElement, $jqueryDone="html") use($params){ |
|
| 105 | + return AjaxTransition::{$params}($responseElement, $jqueryDone); |
|
| 106 | 106 | }; |
| 107 | 107 | } |
| 108 | 108 | return $result; |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | * @param string $jqueryDone the jquery function call on ajax data. default:html |
| 123 | 123 | * @param string|callable $ajaxTransition |
| 124 | 124 | */ |
| 125 | - private function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) { |
|
| 126 | - return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$jqueryDone,$ajaxTransition,$immediatly); |
|
| 125 | + private function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) { |
|
| 126 | + return $this->_ajax("get", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, $immediatly); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | * @param string $jqueryDone the jquery function call on ajax data. default:html |
| 137 | 137 | * @param string|callable $ajaxTransition |
| 138 | 138 | */ |
| 139 | - public function get($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) { |
|
| 140 | - return $this->_get($url,$params,$responseElement,$jsCallback,null,$hasLoader,$jqueryDone,$ajaxTransition,true); |
|
| 139 | + public function get($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) { |
|
| 140 | + return $this->_get($url, $params, $responseElement, $jsCallback, null, $hasLoader, $jqueryDone, $ajaxTransition, true); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /** |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * @param string $context |
| 151 | 151 | * @param boolean $immediatly |
| 152 | 152 | */ |
| 153 | - private function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) { |
|
| 153 | + private function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) { |
|
| 154 | 154 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 155 | 155 | $retour=$this->_getAjaxUrl($url, $attr); |
| 156 | 156 | $retour.="$.{$method}(url,".$params.").done(function( data ) {\n"; |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | * @param string $context |
| 174 | 174 | * @param boolean $immediatly |
| 175 | 175 | */ |
| 176 | - public function json($url, $method="get", $params="{}", $jsCallback=NULL,$context="document",$immediatly=false) { |
|
| 177 | - return $this->_json($url,$method,$params,$jsCallback,NULL,$context,$immediatly); |
|
| 176 | + public function json($url, $method="get", $params="{}", $jsCallback=NULL, $context="document", $immediatly=false) { |
|
| 177 | + return $this->_json($url, $method, $params, $jsCallback, NULL, $context, $immediatly); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | /** |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | * @param string $url the request address |
| 185 | 185 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true) |
| 186 | 186 | */ |
| 187 | - public function jsonOn($event,$element, $url,$parameters=array()) { |
|
| 187 | + public function jsonOn($event, $element, $url, $parameters=array()) { |
|
| 188 | 188 | $preventDefault=true; |
| 189 | 189 | $stopPropagation=true; |
| 190 | 190 | $jsCallback=null; |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $params="{}"; |
| 195 | 195 | $immediatly=true; |
| 196 | 196 | extract($parameters); |
| 197 | - return $this->_add_event($element, $this->_json($url,$method, $params,$jsCallback, $attr,$context), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 197 | + return $this->_add_event($element, $this->_json($url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | /** |
@@ -205,8 +205,8 @@ discard block |
||
| 205 | 205 | * @param string $jsCallback javascript code to execute after the request |
| 206 | 206 | * @param string $context jquery DOM element, array container. |
| 207 | 207 | */ |
| 208 | - public function jsonDeferred($url, $method="get", $params="{}", $jsCallback=NULL,$context=NULL) { |
|
| 209 | - return $this->json($url, $method, $params, $jsCallback, $context,false); |
|
| 208 | + public function jsonDeferred($url, $method="get", $params="{}", $jsCallback=NULL, $context=NULL) { |
|
| 209 | + return $this->json($url, $method, $params, $jsCallback, $context, false); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -219,22 +219,22 @@ discard block |
||
| 219 | 219 | * @param string $rowClass the css class for the new element |
| 220 | 220 | * @param boolean $immediatly |
| 221 | 221 | */ |
| 222 | - private function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL,$rowClass="_json",$context=NULL,$attr="id",$immediatly=false) { |
|
| 222 | + private function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $rowClass="_json", $context=NULL, $attr="id", $immediatly=false) { |
|
| 223 | 223 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 224 | 224 | $retour=$this->_getAjaxUrl($url, $attr); |
| 225 | - if($context===null){ |
|
| 225 | + if ($context===null) { |
|
| 226 | 226 | $parent="$('".$maskSelector."').parent()"; |
| 227 | - $newElm = "$('#'+newId)"; |
|
| 228 | - }else{ |
|
| 227 | + $newElm="$('#'+newId)"; |
|
| 228 | + } else { |
|
| 229 | 229 | $parent=$context; |
| 230 | - $newElm = $context.".find('#'+newId)"; |
|
| 230 | + $newElm=$context.".find('#'+newId)"; |
|
| 231 | 231 | } |
| 232 | 232 | $appendTo="\t\tnewElm.appendTo(".$parent.");\n"; |
| 233 | 233 | $retour.="var self = $(this);\n$.{$method}(url,".$params.").done(function( data ) {\n"; |
| 234 | 234 | $retour.=$parent.".find('._json').remove();"; |
| 235 | 235 | $retour.="\tdata=$.parseJSON(data);$.each(data, function(index, value) {\n"."\tvar created=false;var maskElm=$('".$maskSelector."').first();maskElm.hide();"."\tvar newId=(maskElm.attr('id') || 'mask')+'-'+index;"."\tvar newElm=".$newElm.";\n"."\tif(!newElm.length){\n"."\t\tnewElm=maskElm.clone(); |
| 236 | 236 | newElm.attr('id',newId);\n;newElm.addClass('{$rowClass}').removeClass('_jsonArrayModel');\nnewElm.find('[id]').each(function(){ var newId=$(this).attr('id')+'-'+index;$(this).attr('id',newId).removeClass('_jsonArrayChecked');});\n"; |
| 237 | - $retour.= $appendTo; |
|
| 237 | + $retour.=$appendTo; |
|
| 238 | 238 | $retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('__'+key+'__')>-1){\n"."\t\t\t\tcontent=$(html.split('__'+key+'__').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."\n"."\t$(newElm).removeClass('hide');"."});\n"; |
| 239 | 239 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
| 240 | 240 | $retour.="\t".$jsCallback."\n"."});\n"; |
@@ -253,8 +253,8 @@ discard block |
||
| 253 | 253 | * @param string $context jquery DOM element, array container. |
| 254 | 254 | * @param boolean $immediatly |
| 255 | 255 | */ |
| 256 | - public function jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL,$rowClass="_json",$context=NULL,$immediatly=false) { |
|
| 257 | - return $this->_jsonArray($maskSelector, $url,$method,$params,$jsCallback,$rowClass,$context,NULL,$immediatly); |
|
| 256 | + public function jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $rowClass="_json", $context=NULL, $immediatly=false) { |
|
| 257 | + return $this->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, $rowClass, $context, NULL, $immediatly); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | /** |
@@ -267,8 +267,8 @@ discard block |
||
| 267 | 267 | * @param string $rowClass the css class for the new element |
| 268 | 268 | * @param string $context jquery DOM element, array container. |
| 269 | 269 | */ |
| 270 | - public function jsonArrayDeferred($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL,$rowClass="_json",$context=NULL) { |
|
| 271 | - return $this->jsonArray($maskSelector, $url, $method, $params, $jsCallback,$rowClass,$context,false); |
|
| 270 | + public function jsonArrayDeferred($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $rowClass="_json", $context=NULL) { |
|
| 271 | + return $this->jsonArray($maskSelector, $url, $method, $params, $jsCallback, $rowClass, $context, false); |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | /** |
@@ -278,18 +278,18 @@ discard block |
||
| 278 | 278 | * @param string $url the request url |
| 279 | 279 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","rowClass"=>"_json","immediatly"=>true) |
| 280 | 280 | */ |
| 281 | - public function jsonArrayOn($event,$element,$maskSelector, $url,$parameters=array()) { |
|
| 281 | + public function jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) { |
|
| 282 | 282 | $preventDefault=true; |
| 283 | 283 | $stopPropagation=true; |
| 284 | 284 | $jsCallback=null; |
| 285 | 285 | $attr="id"; |
| 286 | 286 | $method="get"; |
| 287 | - $context = null; |
|
| 287 | + $context=null; |
|
| 288 | 288 | $params="{}"; |
| 289 | 289 | $immediatly=true; |
| 290 | 290 | $rowClass="_json"; |
| 291 | 291 | extract($parameters); |
| 292 | - return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $rowClass, $context,$attr), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 292 | + return $this->_add_event($element, $this->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, $rowClass, $context, $attr), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | /** |
@@ -303,8 +303,8 @@ discard block |
||
| 303 | 303 | * @param string $jqueryDone the jquery function call on ajax data. default:html |
| 304 | 304 | * @param string|callable $ajaxTransition |
| 305 | 305 | */ |
| 306 | - public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL,$attr="id",$jqueryDone="html",$ajaxTransition=null) { |
|
| 307 | - return $this->_get($url, $params,$responseElement,$jsCallback,$attr,false,$jqueryDone,$ajaxTransition); |
|
| 306 | + public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $jqueryDone="html", $ajaxTransition=null) { |
|
| 307 | + return $this->_get($url, $params, $responseElement, $jsCallback, $attr, false, $jqueryDone, $ajaxTransition); |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | /** |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | $ajaxTransition=null; |
| 328 | 328 | $params="{}"; |
| 329 | 329 | extract($parameters); |
| 330 | - return $this->_add_event($element, $this->_get($url, $params,$responseElement,$jsCallback,$attr, $hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 330 | + return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | /** |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | $ajaxTransition=null; |
| 352 | 352 | $params="{}"; |
| 353 | 353 | extract($parameters); |
| 354 | - return $this->_add_event($element, $this->_ajax($method,$url, $params,$responseElement,$jsCallback,$attr, $hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 354 | + return $this->_add_event($element, $this->_ajax($method, $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | /** |
@@ -378,8 +378,8 @@ discard block |
||
| 378 | 378 | return $this->getOn("click", $element, $url, $responseElement, $parameters); |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - private function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) { |
|
| 382 | - return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$jqueryDone,$ajaxTransition,$immediatly); |
|
| 381 | + private function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) { |
|
| 382 | + return $this->_ajax("post", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, $immediatly); |
|
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | /** |
@@ -392,8 +392,8 @@ discard block |
||
| 392 | 392 | * @param string $jqueryDone the jquery function call on ajax data. default:html |
| 393 | 393 | * @param string|callable $ajaxTransition |
| 394 | 394 | */ |
| 395 | - public function post($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) { |
|
| 396 | - return $this->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true); |
|
| 395 | + public function post($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) { |
|
| 396 | + return $this->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true); |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | /** |
@@ -408,8 +408,8 @@ discard block |
||
| 408 | 408 | * @param string $jqueryDone the jquery function call on ajax data. default:html |
| 409 | 409 | * @param string|callable $ajaxTransition |
| 410 | 410 | */ |
| 411 | - public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id",$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) { |
|
| 412 | - return $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader,$jqueryDone,$ajaxTransition,false); |
|
| 411 | + public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) { |
|
| 412 | + return $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, false); |
|
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | /** |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | $jqueryDone="html"; |
| 433 | 433 | $ajaxTransition=null; |
| 434 | 434 | extract($parameters); |
| 435 | - return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 435 | + return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | /** |
@@ -448,20 +448,20 @@ discard block |
||
| 448 | 448 | return $this->postOn("click", $element, $url, $params, $responseElement, $parameters); |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | - private function _postForm($url, $form, $responseElement, $params=null,$validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) { |
|
| 451 | + private function _postForm($url, $form, $responseElement, $params=null, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) { |
|
| 452 | 452 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 453 | 453 | $retour=$this->_getAjaxUrl($url, $attr); |
| 454 | 454 | $retour.="\nvar params=$('#".$form."').serialize();\n"; |
| 455 | - if(isset($params)){ |
|
| 455 | + if (isset($params)) { |
|
| 456 | 456 | $retour.="params+='&'+$.param(".$params.");\n"; |
| 457 | 457 | } |
| 458 | 458 | $responseElement=$this->_getResponseElement($responseElement); |
| 459 | 459 | $retour.="var self=this;\n"; |
| 460 | - if($hasLoader===true){ |
|
| 460 | + if ($hasLoader===true) { |
|
| 461 | 461 | $this->addLoading($retour, $responseElement); |
| 462 | 462 | } |
| 463 | 463 | $retour.="$.post(url,params).done(function( data ) {\n"; |
| 464 | - $retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n"; |
|
| 464 | + $retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback)."});\n"; |
|
| 465 | 465 | |
| 466 | 466 | if ($validation) { |
| 467 | 467 | $retour="$('#".$form."').validate({submitHandler: function(form) { |
@@ -485,8 +485,8 @@ discard block |
||
| 485 | 485 | * @param string $jqueryDone the jquery function call on ajax data. default:html |
| 486 | 486 | * @param string|callable $ajaxTransition |
| 487 | 487 | */ |
| 488 | - public function postForm($url, $form, $responseElement, $params=NULL,$validation=false, $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) { |
|
| 489 | - return $this->_postForm($url, $form, $responseElement, $params,$validation, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true); |
|
| 488 | + public function postForm($url, $form, $responseElement, $params=NULL, $validation=false, $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) { |
|
| 489 | + return $this->_postForm($url, $form, $responseElement, $params, $validation, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true); |
|
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | /** |
@@ -503,8 +503,8 @@ discard block |
||
| 503 | 503 | * @param string $jqueryDone the jquery function call on ajax data. default:html |
| 504 | 504 | * @param string|callable $ajaxTransition |
| 505 | 505 | */ |
| 506 | - public function postFormDeferred($url, $form, $responseElement, $params=NULL,$validation=false, $jsCallback=NULL,$attr="id",$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) { |
|
| 507 | - return $this->_postForm($url, $form, $responseElement, $params,$validation, $jsCallback, $attr, $hasLoader,$jqueryDone,$ajaxTransition,false); |
|
| 506 | + public function postFormDeferred($url, $form, $responseElement, $params=NULL, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) { |
|
| 507 | + return $this->_postForm($url, $form, $responseElement, $params, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, false); |
|
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | /** |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | $jqueryDone="html"; |
| 530 | 530 | $ajaxTransition=null; |
| 531 | 531 | extract($parameters); |
| 532 | - return $this->_add_event($element, $this->_postForm($url, $form, $responseElement,$params, $validation, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 532 | + return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $params, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | /** |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | trait LabeledIconTrait { |
| 14 | 14 | |
| 15 | 15 | abstract public function addToProperty($name, $value, $separator=" "); |
| 16 | - abstract public function addContent($content,$before=false); |
|
| 16 | + abstract public function addContent($content, $before=false); |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Adds an icon before or after |
@@ -22,17 +22,17 @@ discard block |
||
| 22 | 22 | * @param boolean $labeled |
| 23 | 23 | * @return \Ajax\semantic\html\elements\HtmlIcon |
| 24 | 24 | */ |
| 25 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
| 25 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
| 26 | 26 | $iconO=$icon; |
| 27 | - if(\is_string($icon)){ |
|
| 27 | + if (\is_string($icon)) { |
|
| 28 | 28 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
| 29 | 29 | } |
| 30 | - if($labeled!==false){ |
|
| 31 | - $direction=($before===true)?Direction::LEFT:Direction::RIGHT; |
|
| 30 | + if ($labeled!==false) { |
|
| 31 | + $direction=($before===true) ?Direction::LEFT : Direction::RIGHT; |
|
| 32 | 32 | $this->addToProperty("class", $direction." labeled icon"); |
| 33 | 33 | $this->tagName="div"; |
| 34 | 34 | } |
| 35 | - $this->addContent($iconO,$before); |
|
| 35 | + $this->addContent($iconO, $before); |
|
| 36 | 36 | return $iconO; |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | private $pages_visibles; |
| 10 | 10 | private $row_count; |
| 11 | 11 | |
| 12 | - public function __construct($items_per_page=10,$pages_visibles=null,$page=1,$row_count=null){ |
|
| 12 | + public function __construct($items_per_page=10, $pages_visibles=null, $page=1, $row_count=null) { |
|
| 13 | 13 | $this->items_per_page=$items_per_page; |
| 14 | 14 | $this->row_count=$row_count; |
| 15 | 15 | $this->page=$page; |
@@ -17,30 +17,30 @@ discard block |
||
| 17 | 17 | $this->visible=true; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - public function getObjects($objects){ |
|
| 20 | + public function getObjects($objects) { |
|
| 21 | 21 | $auto=(!isset($this->row_count)); |
| 22 | 22 | $os=$objects; |
| 23 | - if(!\is_array($os)){ |
|
| 23 | + if (!\is_array($os)) { |
|
| 24 | 24 | $os=[]; |
| 25 | - foreach ($objects as $o){ |
|
| 25 | + foreach ($objects as $o) { |
|
| 26 | 26 | $os[]=$o; |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | - $this->page_count = 0; |
|
| 30 | - $row_count=($auto)?\sizeof($os):$this->row_count; |
|
| 31 | - if (0 === $row_count) { |
|
| 29 | + $this->page_count=0; |
|
| 30 | + $row_count=($auto) ?\sizeof($os) : $this->row_count; |
|
| 31 | + if (0===$row_count) { |
|
| 32 | 32 | $this->visible=false; |
| 33 | 33 | } else { |
| 34 | 34 | |
| 35 | - $this->page_count = (int)ceil($row_count / $this->items_per_page); |
|
| 35 | + $this->page_count=(int)ceil($row_count/$this->items_per_page); |
|
| 36 | 36 | $this->visible=$this->page_count>1; |
| 37 | - if($this->page > $this->page_count+1) { |
|
| 38 | - $this->page = 1; |
|
| 37 | + if ($this->page>$this->page_count+1) { |
|
| 38 | + $this->page=1; |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | - if($auto){ |
|
| 42 | - $offset = ($this->page - 1) * $this->items_per_page; |
|
| 43 | - return array_slice($os, $offset,$this->items_per_page); |
|
| 41 | + if ($auto) { |
|
| 42 | + $offset=($this->page-1)*$this->items_per_page; |
|
| 43 | + return array_slice($os, $offset, $this->items_per_page); |
|
| 44 | 44 | } |
| 45 | 45 | return $os; |
| 46 | 46 | } |
@@ -76,22 +76,22 @@ discard block |
||
| 76 | 76 | return $this->page_count; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - public function getPagesNumbers(){ |
|
| 80 | - $middle= (int)ceil(($this->pages_visibles-1)/ 2); |
|
| 79 | + public function getPagesNumbers() { |
|
| 80 | + $middle=(int)ceil(($this->pages_visibles-1)/2); |
|
| 81 | 81 | $first=$this->page-$middle; |
| 82 | - if($first<1){ |
|
| 82 | + if ($first<1) { |
|
| 83 | 83 | $first=1; |
| 84 | 84 | } |
| 85 | 85 | $last=$first+$this->pages_visibles-1; |
| 86 | - if($last>$this->page_count){ |
|
| 86 | + if ($last>$this->page_count) { |
|
| 87 | 87 | $last=$this->page_count; |
| 88 | 88 | } |
| 89 | 89 | return \range($first, $last); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | public function setPagesVisibles($pages_visibles) { |
| 93 | - if(!isset($pages_visibles)) |
|
| 94 | - $pages_visibles=(int)ceil($this->row_count / $this->items_per_page)+1; |
|
| 93 | + if (!isset($pages_visibles)) |
|
| 94 | + $pages_visibles=(int)ceil($this->row_count/$this->items_per_page)+1; |
|
| 95 | 95 | $this->pages_visibles=$pages_visibles; |
| 96 | 96 | return $this; |
| 97 | 97 | } |
@@ -13,19 +13,19 @@ discard block |
||
| 13 | 13 | * @property boolean $_visibleHover |
| 14 | 14 | * @property InstanceViewer $_instanceViewer |
| 15 | 15 | */ |
| 16 | -trait DataTableFieldAsTrait{ |
|
| 16 | +trait DataTableFieldAsTrait { |
|
| 17 | 17 | abstract public function addField($field); |
| 18 | - abstract public function insertField($index,$field); |
|
| 19 | - abstract public function insertInField($index,$field); |
|
| 20 | - abstract public function fieldAs($index,$type,$attributes=NULL); |
|
| 18 | + abstract public function insertField($index, $field); |
|
| 19 | + abstract public function insertInField($index, $field); |
|
| 20 | + abstract public function fieldAs($index, $type, $attributes=NULL); |
|
| 21 | 21 | /** |
| 22 | 22 | * @param string $caption |
| 23 | 23 | * @param callable $callback |
| 24 | 24 | * @param boolean $visibleHover |
| 25 | 25 | * @return callable |
| 26 | 26 | */ |
| 27 | - private function getFieldButtonCallable($caption,$visibleHover=true,$callback=null){ |
|
| 28 | - return $this->getCallable("getFieldButton",[$caption,$visibleHover],$callback); |
|
| 27 | + private function getFieldButtonCallable($caption, $visibleHover=true, $callback=null) { |
|
| 28 | + return $this->getCallable("getFieldButton", [$caption, $visibleHover], $callback); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -34,19 +34,19 @@ discard block |
||
| 34 | 34 | * @param callable $callback |
| 35 | 35 | * @return callable |
| 36 | 36 | */ |
| 37 | - private function getCallable($thisCallback,$parameters,$callback=null){ |
|
| 38 | - $result=function($instance) use($thisCallback,$parameters,$callback){ |
|
| 39 | - $object=call_user_func_array(array($this,$thisCallback), $parameters); |
|
| 40 | - if(isset($callback)){ |
|
| 41 | - if(\is_callable($callback)){ |
|
| 42 | - $callback($object,$instance); |
|
| 37 | + private function getCallable($thisCallback, $parameters, $callback=null) { |
|
| 38 | + $result=function($instance) use($thisCallback, $parameters, $callback){ |
|
| 39 | + $object=call_user_func_array(array($this, $thisCallback), $parameters); |
|
| 40 | + if (isset($callback)) { |
|
| 41 | + if (\is_callable($callback)) { |
|
| 42 | + $callback($object, $instance); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | - if($object instanceof HtmlSemDoubleElement){ |
|
| 46 | - $object->setProperty("data-ajax",$this->_instanceViewer->getIdentifier()); |
|
| 47 | - if($object->propertyContains("class","visibleover")){ |
|
| 45 | + if ($object instanceof HtmlSemDoubleElement) { |
|
| 46 | + $object->setProperty("data-ajax", $this->_instanceViewer->getIdentifier()); |
|
| 47 | + if ($object->propertyContains("class", "visibleover")) { |
|
| 48 | 48 | $this->_visibleHover=true; |
| 49 | - $object->setProperty("style","visibility:hidden;"); |
|
| 49 | + $object->setProperty("style", "visibility:hidden;"); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | return $object; |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | * @param string $caption |
| 59 | 59 | * @return HtmlButton |
| 60 | 60 | */ |
| 61 | - private function getFieldButton($caption,$visibleHover=true){ |
|
| 62 | - $bt= new HtmlButton("",$caption); |
|
| 63 | - if($visibleHover) |
|
| 61 | + private function getFieldButton($caption, $visibleHover=true) { |
|
| 62 | + $bt=new HtmlButton("", $caption); |
|
| 63 | + if ($visibleHover) |
|
| 64 | 64 | $this->_visibleOver($bt); |
| 65 | 65 | return $bt; |
| 66 | 66 | } |
@@ -74,19 +74,19 @@ discard block |
||
| 74 | 74 | * @param array $attributes associative array (<b>ajax</b> key is for ajax post) |
| 75 | 75 | * @return DataTable |
| 76 | 76 | */ |
| 77 | - public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){ |
|
| 78 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$index,$attributes){ |
|
| 79 | - $button=new HtmlButton($id,$value,$cssStyle); |
|
| 80 | - $button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]); |
|
| 81 | - if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) |
|
| 77 | + public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) { |
|
| 78 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $index, $attributes){ |
|
| 79 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
| 80 | + $button->postOnClick($url, "$(event.target).closest('tr').find(':input').serialize()", $responseElement, $attributes["ajax"]); |
|
| 81 | + if (!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) |
|
| 82 | 82 | $this->_visibleOver($button); |
| 83 | 83 | return $button; |
| 84 | - }, $index,$attributes); |
|
| 84 | + }, $index, $attributes); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - protected function _visibleOver(BaseHtml $element){ |
|
| 87 | + protected function _visibleOver(BaseHtml $element) { |
|
| 88 | 88 | $this->_visibleHover=true; |
| 89 | - return $element->addToProperty("class", "visibleover")->setProperty("style","visibility:hidden;"); |
|
| 89 | + return $element->addToProperty("class", "visibleover")->setProperty("style", "visibility:hidden;"); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | * @param boolean $visibleHover |
| 97 | 97 | * @return DataTable |
| 98 | 98 | */ |
| 99 | - public function addFieldButton($caption,$visibleHover=true,$callback=null){ |
|
| 100 | - $this->addField($this->getCallable("getFieldButton",[$caption,$visibleHover],$callback)); |
|
| 99 | + public function addFieldButton($caption, $visibleHover=true, $callback=null) { |
|
| 100 | + $this->addField($this->getCallable("getFieldButton", [$caption, $visibleHover], $callback)); |
|
| 101 | 101 | return $this; |
| 102 | 102 | } |
| 103 | 103 | |
@@ -108,8 +108,8 @@ discard block |
||
| 108 | 108 | * @param callable $callback |
| 109 | 109 | * @return DataTable |
| 110 | 110 | */ |
| 111 | - public function insertFieldButton($index,$caption,$visibleHover=true,$callback=null){ |
|
| 112 | - $this->insertField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback)); |
|
| 111 | + public function insertFieldButton($index, $caption, $visibleHover=true, $callback=null) { |
|
| 112 | + $this->insertField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback)); |
|
| 113 | 113 | return $this; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -120,25 +120,25 @@ discard block |
||
| 120 | 120 | * @param callable $callback |
| 121 | 121 | * @return DataTable |
| 122 | 122 | */ |
| 123 | - public function insertInFieldButton($index,$caption,$visibleHover=true,$callback=null){ |
|
| 124 | - $this->insertInField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback)); |
|
| 123 | + public function insertInFieldButton($index, $caption, $visibleHover=true, $callback=null) { |
|
| 124 | + $this->insertInField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback)); |
|
| 125 | 125 | return $this; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - private function addDefaultButton($icon,$class=null,$visibleHover=true,$callback=null){ |
|
| 129 | - $this->addField($this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback)); |
|
| 128 | + private function addDefaultButton($icon, $class=null, $visibleHover=true, $callback=null) { |
|
| 129 | + $this->addField($this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback)); |
|
| 130 | 130 | return $this; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - private function insertDefaultButtonIn($index,$icon,$class=null,$visibleHover=true,$callback=null){ |
|
| 134 | - $this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback)); |
|
| 133 | + private function insertDefaultButtonIn($index, $icon, $class=null, $visibleHover=true, $callback=null) { |
|
| 134 | + $this->insertInField($index, $this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback)); |
|
| 135 | 135 | return $this; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - private function getDefaultButton($icon,$class=null,$visibleHover=true){ |
|
| 139 | - $bt=$this->getFieldButton("",$visibleHover); |
|
| 138 | + private function getDefaultButton($icon, $class=null, $visibleHover=true) { |
|
| 139 | + $bt=$this->getFieldButton("", $visibleHover); |
|
| 140 | 140 | $bt->asIcon($icon); |
| 141 | - if(isset($class)) |
|
| 141 | + if (isset($class)) |
|
| 142 | 142 | $bt->addClass($class); |
| 143 | 143 | return $bt; |
| 144 | 144 | } |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
| 151 | 151 | * @return DataTable |
| 152 | 152 | */ |
| 153 | - public function addDeleteButton($visibleHover=true,$deleteBehavior=[],$callback=null){ |
|
| 153 | + public function addDeleteButton($visibleHover=true, $deleteBehavior=[], $callback=null) { |
|
| 154 | 154 | $this->_deleteBehavior=$deleteBehavior; |
| 155 | - return $this->addDefaultButton("remove","_delete red basic",$visibleHover,$callback); |
|
| 155 | + return $this->addDefaultButton("remove", "_delete red basic", $visibleHover, $callback); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -162,9 +162,9 @@ discard block |
||
| 162 | 162 | * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
| 163 | 163 | * @return DataTable |
| 164 | 164 | */ |
| 165 | - public function addEditButton($visibleHover=true,$editBehavior=[],$callback=null){ |
|
| 165 | + public function addEditButton($visibleHover=true, $editBehavior=[], $callback=null) { |
|
| 166 | 166 | $this->_editBehavior=$editBehavior; |
| 167 | - return $this->addDefaultButton("edit","_edit basic",$visibleHover,$callback); |
|
| 167 | + return $this->addDefaultButton("edit", "_edit basic", $visibleHover, $callback); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -175,20 +175,20 @@ discard block |
||
| 175 | 175 | * @param callable $callbackDelete this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
| 176 | 176 | * @return DataTable |
| 177 | 177 | */ |
| 178 | - public function addEditDeleteButtons($visibleHover=true,$behavior=[],$callbackEdit=null,$callbackDelete=null){ |
|
| 179 | - $this->addEditButton($visibleHover,$behavior,$callbackEdit); |
|
| 178 | + public function addEditDeleteButtons($visibleHover=true, $behavior=[], $callbackEdit=null, $callbackDelete=null) { |
|
| 179 | + $this->addEditButton($visibleHover, $behavior, $callbackEdit); |
|
| 180 | 180 | $index=$this->_instanceViewer->visiblePropertiesCount()-1; |
| 181 | - $this->insertDeleteButtonIn($index,$visibleHover,$behavior,$callbackDelete); |
|
| 181 | + $this->insertDeleteButtonIn($index, $visibleHover, $behavior, $callbackDelete); |
|
| 182 | 182 | return $this; |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - public function insertDeleteButtonIn($index,$visibleHover=true,$deleteBehavior=[],$callback=null){ |
|
| 185 | + public function insertDeleteButtonIn($index, $visibleHover=true, $deleteBehavior=[], $callback=null) { |
|
| 186 | 186 | $this->_deleteBehavior=$deleteBehavior; |
| 187 | - return $this->insertDefaultButtonIn($index,"remove","_delete red basic",$visibleHover,$callback); |
|
| 187 | + return $this->insertDefaultButtonIn($index, "remove", "_delete red basic", $visibleHover, $callback); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - public function insertEditButtonIn($index,$visibleHover=true,$editBehavior=[],$callback=null){ |
|
| 190 | + public function insertEditButtonIn($index, $visibleHover=true, $editBehavior=[], $callback=null) { |
|
| 191 | 191 | $this->_editBehavior=$editBehavior; |
| 192 | - return $this->insertDefaultButtonIn($index,"edit","_edit basic",$visibleHover,$callback); |
|
| 192 | + return $this->insertDefaultButtonIn($index, "edit", "_edit basic", $visibleHover, $callback); |
|
| 193 | 193 | } |
| 194 | 194 | } |
@@ -15,52 +15,52 @@ 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; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function addAction($action){ |
|
| 54 | - if(!$action instanceof BaseHtml){ |
|
| 53 | + public function addAction($action) { |
|
| 54 | + if (!$action instanceof BaseHtml) { |
|
| 55 | 55 | $class=""; |
| 56 | - if(\array_search($action, ["Okay","Yes"])!==false){ |
|
| 56 | + if (\array_search($action, ["Okay", "Yes"])!==false) { |
|
| 57 | 57 | $class="approve"; |
| 58 | 58 | } |
| 59 | - if(\array_search($action, ["Close","Cancel","No"])!==false){ |
|
| 59 | + if (\array_search($action, ["Close", "Cancel", "No"])!==false) { |
|
| 60 | 60 | $class="cancel"; |
| 61 | 61 | } |
| 62 | - $action=new HtmlButton("action-".$this->identifier,$action); |
|
| 63 | - if($class!=="") |
|
| 62 | + $action=new HtmlButton("action-".$this->identifier, $action); |
|
| 63 | + if ($class!=="") |
|
| 64 | 64 | $action->addToProperty("class", $class); |
| 65 | 65 | } |
| 66 | 66 | return $this->addElementInPart($action, "actions"); |
@@ -70,66 +70,66 @@ discard block |
||
| 70 | 70 | * @param int $index |
| 71 | 71 | * @return HtmlButton |
| 72 | 72 | */ |
| 73 | - public function getAction($index){ |
|
| 73 | + public function getAction($index) { |
|
| 74 | 74 | return $this->content["actions"]->getContent()[$index]; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - public function addContent($content,$before=false){ |
|
| 78 | - $this->content["content"]->addContent($content,$before); |
|
| 77 | + public function addContent($content, $before=false) { |
|
| 78 | + $this->content["content"]->addContent($content, $before); |
|
| 79 | 79 | return $this; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public function addImageContent($image,$description=NULL){ |
|
| 82 | + public function addImageContent($image, $description=NULL) { |
|
| 83 | 83 | $content=$this->content["content"]; |
| 84 | - if(isset($description)){ |
|
| 85 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
| 86 | - $content->addContent($description,true); |
|
| 84 | + if (isset($description)) { |
|
| 85 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
| 86 | + $content->addContent($description, true); |
|
| 87 | 87 | } |
| 88 | - if($image!==""){ |
|
| 89 | - $img=new HtmlImage("image-".$this->identifier,$image,"","medium"); |
|
| 90 | - $content->addContent($img,true); |
|
| 91 | - $content->addToProperty("class","image"); |
|
| 88 | + if ($image!=="") { |
|
| 89 | + $img=new HtmlImage("image-".$this->identifier, $image, "", "medium"); |
|
| 90 | + $content->addContent($img, true); |
|
| 91 | + $content->addToProperty("class", "image"); |
|
| 92 | 92 | } |
| 93 | 93 | return $this; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - public function addIconContent($icon,$description=NULL){ |
|
| 96 | + public function addIconContent($icon, $description=NULL) { |
|
| 97 | 97 | $content=$this->content["content"]; |
| 98 | - if(isset($description)){ |
|
| 99 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
| 100 | - $content->addContent($description,true); |
|
| 98 | + if (isset($description)) { |
|
| 99 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
| 100 | + $content->addContent($description, true); |
|
| 101 | 101 | } |
| 102 | - if($icon!==""){ |
|
| 103 | - $img=new HtmlIcon("image-".$this->identifier,$icon); |
|
| 104 | - $content->addContent($img,true); |
|
| 105 | - $content->addToProperty("class","image"); |
|
| 102 | + if ($icon!=="") { |
|
| 103 | + $img=new HtmlIcon("image-".$this->identifier, $icon); |
|
| 104 | + $content->addContent($img, true); |
|
| 105 | + $content->addToProperty("class", "image"); |
|
| 106 | 106 | } |
| 107 | 107 | return $this; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - private function addElementInPart($element,$part) { |
|
| 110 | + private function addElementInPart($element, $part) { |
|
| 111 | 111 | $this->content[$part]->addContent($element); |
| 112 | 112 | return $element; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - public function showDimmer($value){ |
|
| 116 | - $value=$value?"show":"hide"; |
|
| 115 | + public function showDimmer($value) { |
|
| 116 | + $value=$value ? "show" : "hide"; |
|
| 117 | 117 | $this->_paramParts[]=["'".$value." dimmer'"]; |
| 118 | 118 | return $this; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - public function setInverted($recursive=true){ |
|
| 121 | + public function setInverted($recursive=true) { |
|
| 122 | 122 | $this->_params["inverted"]=true; |
| 123 | 123 | return $this; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - public function setBasic(){ |
|
| 126 | + public function setBasic() { |
|
| 127 | 127 | return $this->addToProperty("class", "basic"); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | |
| 131 | - public function setTransition($value){ |
|
| 132 | - $this->_paramParts[]=["'setting'","'transition'","'".$value."'"]; |
|
| 131 | + public function setTransition($value) { |
|
| 132 | + $this->_paramParts[]=["'setting'", "'transition'", "'".$value."'"]; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | * @param string $viewName |
| 140 | 140 | * @param $params The parameters to pass to the view |
| 141 | 141 | */ |
| 142 | - public function renderView(JsUtils $js,$initialController,$viewName, $params=array()) { |
|
| 143 | - return $this->setContent($js->renderContent($initialController, $viewName,$params)); |
|
| 142 | + public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) { |
|
| 143 | + return $this->setContent($js->renderContent($initialController, $viewName, $params)); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -151,8 +151,8 @@ discard block |
||
| 151 | 151 | * @param string $actionName the action name |
| 152 | 152 | * @param array $params |
| 153 | 153 | */ |
| 154 | - public function forward(JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
| 155 | - return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName,$params)); |
|
| 154 | + public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
| 155 | + return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params)); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 163 | 163 | */ |
| 164 | 164 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 165 | - $this->content=JArray::sortAssociative($this->content, ["header","content","actions" ]); |
|
| 165 | + $this->content=JArray::sortAssociative($this->content, ["header", "content", "actions"]); |
|
| 166 | 166 | return parent::compile($js, $view); |
| 167 | 167 | } |
| 168 | 168 | /* |
@@ -170,8 +170,8 @@ discard block |
||
| 170 | 170 | * @see BaseHtml::run() |
| 171 | 171 | */ |
| 172 | 172 | public function run(JsUtils $js) { |
| 173 | - if(isset($this->_bsComponent)===false) |
|
| 174 | - $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
| 173 | + if (isset($this->_bsComponent)===false) |
|
| 174 | + $this->_bsComponent=$js->semantic()->modal("#".$this->identifier, $this->_params, $this->_paramParts); |
|
| 175 | 175 | $this->addEventsOnRun($js); |
| 176 | 176 | return $this->_bsComponent; |
| 177 | 177 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | return $this->jsDo("hide"); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - public function onHidden($js){ |
|
| 187 | + public function onHidden($js) { |
|
| 188 | 188 | $this->_params["onHidden"]=$js; |
| 189 | 189 | } |
| 190 | 190 | } |
@@ -16,16 +16,16 @@ |
||
| 16 | 16 | return $this; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - public function showDimmer(){ |
|
| 19 | + public function showDimmer() { |
|
| 20 | 20 | return $this->setBehavior("hide dimmer"); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function setInverted(){ |
|
| 23 | + public function setInverted() { |
|
| 24 | 24 | $this->params["inverted"]=true; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function setOnHidden($jsCode) { |
| 28 | - $jsCode=str_ireplace("\"","%quote%", $jsCode); |
|
| 28 | + $jsCode=str_ireplace("\"", "%quote%", $jsCode); |
|
| 29 | 29 | return $this->setParam("onHidden", "%function(){".$jsCode."}%"); |
| 30 | 30 | } |
| 31 | 31 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | use Ajax\semantic\html\modules\HtmlModal; |
| 21 | 21 | |
| 22 | 22 | abstract class Widget extends HtmlDoubleElement { |
| 23 | - use FieldAsTrait,FormTrait; |
|
| 23 | + use FieldAsTrait, FormTrait; |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * @var string classname |
@@ -53,17 +53,17 @@ discard block |
||
| 53 | 53 | protected $_generated; |
| 54 | 54 | |
| 55 | 55 | |
| 56 | - public function __construct($identifier,$model,$modelInstance=NULL) { |
|
| 56 | + public function __construct($identifier, $model, $modelInstance=NULL) { |
|
| 57 | 57 | parent::__construct($identifier); |
| 58 | 58 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
| 59 | 59 | $this->setModel($model); |
| 60 | - if(isset($modelInstance)){ |
|
| 60 | + if (isset($modelInstance)) { |
|
| 61 | 61 | $this->show($modelInstance); |
| 62 | 62 | } |
| 63 | 63 | $this->_generated=false; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - protected function _init($instanceViewer,$contentKey,$content,$edition){ |
|
| 66 | + protected function _init($instanceViewer, $contentKey, $content, $edition) { |
|
| 67 | 67 | $this->_instanceViewer=$instanceViewer; |
| 68 | 68 | $this->content=[$contentKey=>$content]; |
| 69 | 69 | $this->_self=$content; |
@@ -75,31 +75,31 @@ discard block |
||
| 75 | 75 | * @param int|string $fieldName |
| 76 | 76 | * @return int|string |
| 77 | 77 | */ |
| 78 | - protected function _getIndex($fieldName){ |
|
| 78 | + protected function _getIndex($fieldName) { |
|
| 79 | 79 | $index=$fieldName; |
| 80 | - if(\is_string($fieldName)){ |
|
| 80 | + if (\is_string($fieldName)) { |
|
| 81 | 81 | $fields=$this->_instanceViewer->getVisibleProperties(); |
| 82 | 82 | $index=\array_search($fieldName, $fields); |
| 83 | 83 | } |
| 84 | 84 | return $index; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - protected function _getFieldIdentifier($prefix,$name=""){ |
|
| 87 | + protected function _getFieldIdentifier($prefix, $name="") { |
|
| 88 | 88 | return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier(); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - protected function _getFieldName($index){ |
|
| 91 | + protected function _getFieldName($index) { |
|
| 92 | 92 | return $this->_instanceViewer->getFieldName($index); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - protected function _getFieldCaption($index){ |
|
| 95 | + protected function _getFieldCaption($index) { |
|
| 96 | 96 | return $this->_instanceViewer->getCaption($index); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - abstract protected function _setToolbarPosition($table,$captions=NULL); |
|
| 99 | + abstract protected function _setToolbarPosition($table, $captions=NULL); |
|
| 100 | 100 | |
| 101 | - public function show($modelInstance){ |
|
| 102 | - if(\is_array($modelInstance)){ |
|
| 101 | + public function show($modelInstance) { |
|
| 102 | + if (\is_array($modelInstance)) { |
|
| 103 | 103 | $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
| 104 | 104 | } |
| 105 | 105 | $this->_modelInstance=$modelInstance; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | abstract public function getHtmlComponent(); |
| 127 | 127 | |
| 128 | - public function setAttached($value=true){ |
|
| 128 | + public function setAttached($value=true) { |
|
| 129 | 129 | return $this->getHtmlComponent()->setAttached($value); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -136,71 +136,71 @@ discard block |
||
| 136 | 136 | * @param callable $callback function called after the field compilation |
| 137 | 137 | * @return Widget |
| 138 | 138 | */ |
| 139 | - public function afterCompile($index,$callback){ |
|
| 139 | + public function afterCompile($index, $callback) { |
|
| 140 | 140 | $index=$this->_getIndex($index); |
| 141 | 141 | $this->_instanceViewer->afterCompile($index, $callback); |
| 142 | 142 | return $this; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - public function setColor($color){ |
|
| 145 | + public function setColor($color) { |
|
| 146 | 146 | return $this->getHtmlComponent()->setColor($color); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | |
| 150 | - public function setCaptions($captions){ |
|
| 150 | + public function setCaptions($captions) { |
|
| 151 | 151 | $this->_instanceViewer->setCaptions($captions); |
| 152 | 152 | return $this; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - public function setCaption($index,$caption){ |
|
| 155 | + public function setCaption($index, $caption) { |
|
| 156 | 156 | $this->_instanceViewer->setCaption($this->_getIndex($index), $caption); |
| 157 | 157 | return $this; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - public function setFields($fields){ |
|
| 160 | + public function setFields($fields) { |
|
| 161 | 161 | $this->_instanceViewer->setVisibleProperties($fields); |
| 162 | 162 | return $this; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - public function addField($field){ |
|
| 165 | + public function addField($field) { |
|
| 166 | 166 | $this->_instanceViewer->addField($field); |
| 167 | 167 | return $this; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - public function addFields($fields){ |
|
| 170 | + public function addFields($fields) { |
|
| 171 | 171 | $this->_instanceViewer->addFields($fields); |
| 172 | 172 | return $this; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - public function addMessage($attributes=NULL,$fieldName="message"){ |
|
| 175 | + public function addMessage($attributes=NULL, $fieldName="message") { |
|
| 176 | 176 | $this->_instanceViewer->addField($fieldName); |
| 177 | 177 | $count=$this->_instanceViewer->visiblePropertiesCount(); |
| 178 | - return $this->fieldAsMessage($count-1,$attributes); |
|
| 178 | + return $this->fieldAsMessage($count-1, $attributes); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - public function addErrorMessage(){ |
|
| 182 | - return $this->addMessage(["error"=>true],"message"); |
|
| 181 | + public function addErrorMessage() { |
|
| 182 | + return $this->addMessage(["error"=>true], "message"); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - public function insertField($index,$field){ |
|
| 185 | + public function insertField($index, $field) { |
|
| 186 | 186 | $index=$this->_getIndex($index); |
| 187 | 187 | $this->_instanceViewer->insertField($index, $field); |
| 188 | 188 | return $this; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - public function insertInField($index,$field){ |
|
| 191 | + public function insertInField($index, $field) { |
|
| 192 | 192 | $index=$this->_getIndex($index); |
| 193 | 193 | $this->_instanceViewer->insertInField($index, $field); |
| 194 | 194 | return $this; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - public function setValueFunction($index,$callback){ |
|
| 197 | + public function setValueFunction($index, $callback) { |
|
| 198 | 198 | $index=$this->_getIndex($index); |
| 199 | 199 | $this->_instanceViewer->setValueFunction($index, $callback); |
| 200 | 200 | return $this; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - public function setIdentifierFunction($callback){ |
|
| 203 | + public function setIdentifierFunction($callback) { |
|
| 204 | 204 | $this->_instanceViewer->setIdentifierFunction($callback); |
| 205 | 205 | return $this; |
| 206 | 206 | } |
@@ -208,8 +208,8 @@ discard block |
||
| 208 | 208 | /** |
| 209 | 209 | * @return \Ajax\semantic\html\collections\menus\HtmlMenu |
| 210 | 210 | */ |
| 211 | - public function getToolbar(){ |
|
| 212 | - if(isset($this->_toolbar)===false){ |
|
| 211 | + public function getToolbar() { |
|
| 212 | + if (isset($this->_toolbar)===false) { |
|
| 213 | 213 | $this->_toolbar=new HtmlMenu("toolbar-".$this->identifier); |
| 214 | 214 | } |
| 215 | 215 | return $this->_toolbar; |
@@ -221,15 +221,15 @@ discard block |
||
| 221 | 221 | * @param callable $callback function to call on $element |
| 222 | 222 | * @return \Ajax\common\html\HtmlDoubleElement |
| 223 | 223 | */ |
| 224 | - public function addInToolbar($element,$callback=NULL){ |
|
| 224 | + public function addInToolbar($element, $callback=NULL) { |
|
| 225 | 225 | $tb=$this->getToolbar(); |
| 226 | - if($element instanceof BaseWidget){ |
|
| 227 | - if($element->getIdentifier()===""){ |
|
| 226 | + if ($element instanceof BaseWidget) { |
|
| 227 | + if ($element->getIdentifier()==="") { |
|
| 228 | 228 | $element->setIdentifier("tb-item-".$this->identifier."-".$tb->count()); |
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | - if(isset($callback)){ |
|
| 232 | - if(\is_callable($callback)){ |
|
| 231 | + if (isset($callback)) { |
|
| 232 | + if (\is_callable($callback)) { |
|
| 233 | 233 | $callback($element); |
| 234 | 234 | } |
| 235 | 235 | } |
@@ -242,9 +242,9 @@ discard block |
||
| 242 | 242 | * @param callable $callback function($element) |
| 243 | 243 | * @return \Ajax\common\html\HtmlDoubleElement |
| 244 | 244 | */ |
| 245 | - public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){ |
|
| 246 | - $result=$this->addInToolbar($caption,$callback); |
|
| 247 | - if(isset($icon)) |
|
| 245 | + public function addItemInToolbar($caption, $icon=NULL, $callback=NULL) { |
|
| 246 | + $result=$this->addInToolbar($caption, $callback); |
|
| 247 | + if (isset($icon)) |
|
| 248 | 248 | $result->addIcon($icon); |
| 249 | 249 | return $result; |
| 250 | 250 | } |
@@ -254,14 +254,14 @@ discard block |
||
| 254 | 254 | * @param callable $callback function($element) |
| 255 | 255 | * @return \Ajax\common\Widget |
| 256 | 256 | */ |
| 257 | - public function addItemsInToolbar(array $items,$callback=NULL){ |
|
| 258 | - if(JArray::isAssociative($items)){ |
|
| 259 | - foreach ($items as $icon=>$item){ |
|
| 260 | - $this->addItemInToolbar($item,$icon,$callback); |
|
| 257 | + public function addItemsInToolbar(array $items, $callback=NULL) { |
|
| 258 | + if (JArray::isAssociative($items)) { |
|
| 259 | + foreach ($items as $icon=>$item) { |
|
| 260 | + $this->addItemInToolbar($item, $icon, $callback); |
|
| 261 | 261 | } |
| 262 | - }else{ |
|
| 263 | - foreach ($items as $item){ |
|
| 264 | - $this->addItemInToolbar($item,null,$callback); |
|
| 262 | + } else { |
|
| 263 | + foreach ($items as $item) { |
|
| 264 | + $this->addItemInToolbar($item, null, $callback); |
|
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | return $this; |
@@ -273,12 +273,12 @@ discard block |
||
| 273 | 273 | * @param callable $callback function($element) |
| 274 | 274 | * @return \Ajax\common\html\HtmlDoubleElement |
| 275 | 275 | */ |
| 276 | - public function addDropdownInToolbar($value,$items,$callback=NULL){ |
|
| 276 | + public function addDropdownInToolbar($value, $items, $callback=NULL) { |
|
| 277 | 277 | $dd=$value; |
| 278 | 278 | if (\is_string($value)) { |
| 279 | - $dd=new HtmlDropdown("dropdown-". $this->identifier."-".$value, $value, $items); |
|
| 279 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$value, $value, $items); |
|
| 280 | 280 | } |
| 281 | - return $this->addInToolbar($dd,$callback); |
|
| 281 | + return $this->addInToolbar($dd, $callback); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | /** |
@@ -287,9 +287,9 @@ discard block |
||
| 287 | 287 | * @param callable $callback function($element) |
| 288 | 288 | * @return \Ajax\common\html\HtmlDoubleElement |
| 289 | 289 | */ |
| 290 | - public function addButtonInToolbar($caption,$cssStyle=null,$callback=NULL){ |
|
| 291 | - $bt=new HtmlButton("bt-".$caption,$caption,$cssStyle); |
|
| 292 | - return $this->addInToolbar($bt,$callback); |
|
| 290 | + public function addButtonInToolbar($caption, $cssStyle=null, $callback=NULL) { |
|
| 291 | + $bt=new HtmlButton("bt-".$caption, $caption, $cssStyle); |
|
| 292 | + return $this->addInToolbar($bt, $callback); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | /** |
@@ -298,9 +298,9 @@ discard block |
||
| 298 | 298 | * @param callable $callback function($element) |
| 299 | 299 | * @return \Ajax\common\html\HtmlDoubleElement |
| 300 | 300 | */ |
| 301 | - public function addButtonsInToolbar(array $captions,$asIcon=false,$callback=NULL){ |
|
| 302 | - $bts=new HtmlButtonGroups("",$captions,$asIcon); |
|
| 303 | - return $this->addInToolbar($bts,$callback); |
|
| 301 | + public function addButtonsInToolbar(array $captions, $asIcon=false, $callback=NULL) { |
|
| 302 | + $bts=new HtmlButtonGroups("", $captions, $asIcon); |
|
| 303 | + return $this->addInToolbar($bts, $callback); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | /** |
@@ -310,15 +310,15 @@ discard block |
||
| 310 | 310 | * @param boolean $labeled |
| 311 | 311 | * @return \Ajax\common\html\HtmlDoubleElement |
| 312 | 312 | */ |
| 313 | - public function addLabelledIconButtonInToolbar($caption,$icon,$before=true,$labeled=false){ |
|
| 314 | - $bt=new HtmlButton("",$caption); |
|
| 315 | - $bt->addIcon($icon,$before,$labeled); |
|
| 313 | + public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) { |
|
| 314 | + $bt=new HtmlButton("", $caption); |
|
| 315 | + $bt->addIcon($icon, $before, $labeled); |
|
| 316 | 316 | return $this->addInToolbar($bt); |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - public function addSubmitInToolbar($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){ |
|
| 320 | - $button=new HtmlButton($identifier,$value,$cssStyle); |
|
| 321 | - $this->_buttonAsSubmit($button,"click",$url,$responseElement,$parameters); |
|
| 319 | + public function addSubmitInToolbar($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) { |
|
| 320 | + $button=new HtmlButton($identifier, $value, $cssStyle); |
|
| 321 | + $this->_buttonAsSubmit($button, "click", $url, $responseElement, $parameters); |
|
| 322 | 322 | return $this->addInToolbar($button); |
| 323 | 323 | } |
| 324 | 324 | |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | * @param callable $defaultValueFunction function parameters are : $name : the field name, $value : the field value ,$index : the field index, $instance : the active instance of model |
| 349 | 349 | * @return \Ajax\common\Widget |
| 350 | 350 | */ |
| 351 | - public function setDefaultValueFunction($defaultValueFunction){ |
|
| 351 | + public function setDefaultValueFunction($defaultValueFunction) { |
|
| 352 | 352 | $this->_instanceViewer->setDefaultValueFunction($defaultValueFunction); |
| 353 | 353 | return $this; |
| 354 | 354 | } |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | * @param string|boolean $disable |
| 358 | 358 | * @return string |
| 359 | 359 | */ |
| 360 | - public function jsDisabled($disable=true){ |
|
| 360 | + public function jsDisabled($disable=true) { |
|
| 361 | 361 | return "$('#".$this->identifier." .ui.input,#".$this->identifier." .ui.dropdown,#".$this->identifier." .ui.checkbox').toggleClass('disabled',".$disable.");"; |
| 362 | 362 | } |
| 363 | 363 | |
@@ -366,12 +366,12 @@ discard block |
||
| 366 | 366 | * @param callable $callback function($element) |
| 367 | 367 | * @return \Ajax\common\html\HtmlDoubleElement |
| 368 | 368 | */ |
| 369 | - public function addEditButtonInToolbar($caption,$callback=NULL){ |
|
| 370 | - $bt=new HtmlButton($this->identifier."-editBtn",$caption); |
|
| 369 | + public function addEditButtonInToolbar($caption, $callback=NULL) { |
|
| 370 | + $bt=new HtmlButton($this->identifier."-editBtn", $caption); |
|
| 371 | 371 | $bt->setToggle(); |
| 372 | 372 | $bt->setActive($this->_edition); |
| 373 | 373 | $bt->onClick($this->jsDisabled(Javascript::prep_value("!$(event.target).hasClass('active')"))); |
| 374 | - return $this->addInToolbar($bt,$callback); |
|
| 374 | + return $this->addInToolbar($bt, $callback); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | public function setToolbar(HtmlMenu $_toolbar) { |
@@ -385,35 +385,35 @@ discard block |
||
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | public function getForm() { |
| 388 | - if(!isset($this->_form)){ |
|
| 388 | + if (!isset($this->_form)) { |
|
| 389 | 389 | $this->_form=new HtmlForm("frm-".$this->identifier); |
| 390 | 390 | $this->setEdition(true); |
| 391 | 391 | } |
| 392 | 392 | return $this->_form; |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - public function run(JsUtils $js){ |
|
| 395 | + public function run(JsUtils $js) { |
|
| 396 | 396 | $result=parent::run($js); |
| 397 | - if(isset($this->_form)){ |
|
| 397 | + if (isset($this->_form)) { |
|
| 398 | 398 | $result=$this->runForm($js); |
| 399 | 399 | } |
| 400 | 400 | return $result; |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | - protected function runForm(JsUtils $js){ |
|
| 403 | + protected function runForm(JsUtils $js) { |
|
| 404 | 404 | $fields=$this->getContentInstances(HtmlFormField::class); |
| 405 | - foreach ($fields as $field){ |
|
| 405 | + foreach ($fields as $field) { |
|
| 406 | 406 | $this->_form->addField($field); |
| 407 | 407 | } |
| 408 | 408 | return $this->_form->run($js); |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | - protected function _compileForm(){ |
|
| 412 | - if(isset($this->_form)){ |
|
| 411 | + protected function _compileForm() { |
|
| 412 | + if (isset($this->_form)) { |
|
| 413 | 413 | $noValidate=""; |
| 414 | - if(\sizeof($this->_form->getValidationParams())>0) |
|
| 414 | + if (\sizeof($this->_form->getValidationParams())>0) |
|
| 415 | 415 | $noValidate="novalidate"; |
| 416 | - $this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">","</form>"); |
|
| 416 | + $this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">", "</form>"); |
|
| 417 | 417 | } |
| 418 | 418 | } |
| 419 | 419 | |
@@ -422,32 +422,32 @@ discard block |
||
| 422 | 422 | return $this; |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | - public function moveFieldTo($from,$to){ |
|
| 425 | + public function moveFieldTo($from, $to) { |
|
| 426 | 426 | return $this->_instanceViewer->moveFieldTo($from, $to); |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | - public function swapFields($index1,$index2){ |
|
| 429 | + public function swapFields($index1, $index2) { |
|
| 430 | 430 | $index1=$this->_getIndex($index1); |
| 431 | 431 | $index2=$this->_getIndex($index2); |
| 432 | 432 | return $this->_instanceViewer->swapFields($index1, $index2); |
| 433 | 433 | } |
| 434 | 434 | |
| 435 | - public function removeField($index){ |
|
| 435 | + public function removeField($index) { |
|
| 436 | 436 | $index=$this->_getIndex($index); |
| 437 | 437 | $this->_instanceViewer->removeField($index); |
| 438 | 438 | return $this; |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | - public function asModal($header=null){ |
|
| 442 | - $modal=new HtmlModal("modal-".$this->identifier,$header); |
|
| 441 | + public function asModal($header=null) { |
|
| 442 | + $modal=new HtmlModal("modal-".$this->identifier, $header); |
|
| 443 | 443 | $modal->setContent($this); |
| 444 | - if(isset($this->_form)){ |
|
| 444 | + if (isset($this->_form)) { |
|
| 445 | 445 | $this->_form->onSuccess($modal->jsHide()); |
| 446 | 446 | } |
| 447 | 447 | return $modal; |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | public function addToProperty($name, $value, $separator=" ") { |
| 451 | - return $this->getHtmlComponent()->addToProperty($name,$value,$separator); |
|
| 451 | + return $this->getHtmlComponent()->addToProperty($name, $value, $separator); |
|
| 452 | 452 | } |
| 453 | 453 | } |