@@ -2,51 +2,51 @@ |
||
| 2 | 2 | namespace Ajax\service; |
| 3 | 3 | class JString { |
| 4 | 4 | |
| 5 | - public static function contains($hay,$needle){ |
|
| 6 | - return strpos($hay, $needle) !== false; |
|
| 5 | + public static function contains($hay, $needle) { |
|
| 6 | + return strpos($hay, $needle)!==false; |
|
| 7 | 7 | } |
| 8 | 8 | public static function startswith($hay, $needle) { |
| 9 | - return substr($hay, 0, strlen($needle)) === $needle; |
|
| 9 | + return substr($hay, 0, strlen($needle))===$needle; |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | public static function endswith($hay, $needle) { |
| 13 | - return substr($hay, -strlen($needle)) === $needle; |
|
| 13 | + return substr($hay, -strlen($needle))===$needle; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - public static function isNull($s){ |
|
| 16 | + public static function isNull($s) { |
|
| 17 | 17 | return (!isset($s) || NULL===$s || ""===$s); |
| 18 | 18 | } |
| 19 | - public static function isNotNull($s){ |
|
| 19 | + public static function isNotNull($s) { |
|
| 20 | 20 | return (isset($s) && NULL!==$s && ""!==$s); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public static function isBoolean($value){ |
|
| 23 | + public static function isBoolean($value) { |
|
| 24 | 24 | return \is_bool($value) || $value==1 || $value==0; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public static function isBooleanTrue($value){ |
|
| 27 | + public static function isBooleanTrue($value) { |
|
| 28 | 28 | return $value==1 || $value; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public static function isBooleanFalse($value){ |
|
| 31 | + public static function isBooleanFalse($value) { |
|
| 32 | 32 | return $value==0 || !$value; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public static function camelCaseToSeparated($input,$separator=" "){ |
|
| 35 | + public static function camelCaseToSeparated($input, $separator=" ") { |
|
| 36 | 36 | return strtolower(preg_replace('/(?<!^)[A-Z]/', $separator.'$0', $input)); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - public static function replaceAtFirst($subject,$from, $to){ |
|
| 40 | - $from = '/\A'.preg_quote($from, '/').'/'; |
|
| 39 | + public static function replaceAtFirst($subject, $from, $to) { |
|
| 40 | + $from='/\A'.preg_quote($from, '/').'/'; |
|
| 41 | 41 | return \preg_replace($from, $to, $subject, 1); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public static function replaceAtLast($subject,$from, $to){ |
|
| 45 | - $from = '/'.preg_quote($from, '/').'\z/'; |
|
| 44 | + public static function replaceAtLast($subject, $from, $to) { |
|
| 45 | + $from='/'.preg_quote($from, '/').'\z/'; |
|
| 46 | 46 | return \preg_replace($from, $to, $subject, 1); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public static function replaceAtFirstAndLast($subject,$fromFirst,$toFirst,$fromLast,$toLast){ |
|
| 49 | + public static function replaceAtFirstAndLast($subject, $fromFirst, $toFirst, $fromLast, $toLast) { |
|
| 50 | 50 | $s=self::replaceAtFirst($subject, $fromFirst, $toFirst); |
| 51 | 51 | return self::replaceAtLast($s, $fromLast, $toLast); |
| 52 | 52 | } |
@@ -16,17 +16,17 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @see \Ajax\semantic\widgets\dataform\DataForm::__construct() |
| 18 | 18 | */ |
| 19 | - public function __construct($identifier,$modelInstance=null,$fieldsOrder,$fieldsDefinition,$fields=[],$captions=[],$separators=[]) { |
|
| 20 | - if(!isset($modelInstance)){ |
|
| 19 | + public function __construct($identifier, $modelInstance=null, $fieldsOrder, $fieldsDefinition, $fields=[], $captions=[], $separators=[]) { |
|
| 20 | + if (!isset($modelInstance)) { |
|
| 21 | 21 | $modelInstance=$this->getDefaultModelInstance(); |
| 22 | 22 | } |
| 23 | - parent::__construct($identifier,$modelInstance); |
|
| 24 | - $this->_initForm($fieldsOrder, $fieldsDefinition,$fields,$captions,$separators); |
|
| 23 | + parent::__construct($identifier, $modelInstance); |
|
| 24 | + $this->_initForm($fieldsOrder, $fieldsDefinition, $fields, $captions, $separators); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | abstract protected function getDefaultModelInstance(); |
| 28 | 28 | |
| 29 | - protected function _initForm($fieldsOrder,$fieldsDefinition,$fields=[],$captions=[],$separators=[]){ |
|
| 29 | + protected function _initForm($fieldsOrder, $fieldsDefinition, $fields=[], $captions=[], $separators=[]) { |
|
| 30 | 30 | $this->_fieldsOrder=$fieldsOrder; |
| 31 | 31 | $this->setFields($fields); |
| 32 | 32 | $this->setSeparators($separators); |
@@ -34,26 +34,26 @@ discard block |
||
| 34 | 34 | $this->setCaptions($captions); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - protected function _getIndex($fieldName){ |
|
| 37 | + protected function _getIndex($fieldName) { |
|
| 38 | 38 | $index=$fieldName; |
| 39 | - if(\is_string($fieldName)){ |
|
| 39 | + if (\is_string($fieldName)) { |
|
| 40 | 40 | $index=\array_search($fieldName, $this->_fieldsOrder); |
| 41 | 41 | } |
| 42 | 42 | return $index; |
| 43 | 43 | } |
| 44 | - protected function _fieldAs($elementCallback,&$index,$attributes=NULL,$prefix=null){ |
|
| 44 | + protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null) { |
|
| 45 | 45 | $index=$this->_getIndex($index); |
| 46 | - return parent::_fieldAs($elementCallback, $index,$attributes,$prefix); |
|
| 46 | + return parent::_fieldAs($elementCallback, $index, $attributes, $prefix); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | - public function removeField($fieldName){ |
|
| 50 | + public function removeField($fieldName) { |
|
| 51 | 51 | parent::removeField($fieldName); |
| 52 | - \array_splice($this->_fieldsOrder,$this->_getIndex($fieldName),1); |
|
| 52 | + \array_splice($this->_fieldsOrder, $this->_getIndex($fieldName), 1); |
|
| 53 | 53 | return $this; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 57 | - return parent::compile($js,$view); |
|
| 56 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 57 | + return parent::compile($js, $view); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | \ No newline at end of file |
@@ -15,117 +15,117 @@ 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, ["Cancel","No"])!==false){ |
|
| 59 | + if (\array_search($action, ["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"); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function addContent($content,$before=false){ |
|
| 70 | - $this->content["content"]->addContent($content,$before); |
|
| 69 | + public function addContent($content, $before=false) { |
|
| 70 | + $this->content["content"]->addContent($content, $before); |
|
| 71 | 71 | return $this; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public function addImageContent($image,$description=NULL){ |
|
| 74 | + public function addImageContent($image, $description=NULL) { |
|
| 75 | 75 | $content=$this->content["content"]; |
| 76 | - if(isset($description)){ |
|
| 77 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
| 78 | - $content->addContent($description,true); |
|
| 76 | + if (isset($description)) { |
|
| 77 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
| 78 | + $content->addContent($description, true); |
|
| 79 | 79 | } |
| 80 | - if($image!==""){ |
|
| 81 | - $img=new HtmlImage("image-".$this->identifier,$image,"","medium"); |
|
| 82 | - $content->addContent($img,true); |
|
| 83 | - $content->addToProperty("class","image"); |
|
| 80 | + if ($image!=="") { |
|
| 81 | + $img=new HtmlImage("image-".$this->identifier, $image, "", "medium"); |
|
| 82 | + $content->addContent($img, true); |
|
| 83 | + $content->addToProperty("class", "image"); |
|
| 84 | 84 | } |
| 85 | 85 | return $this; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - public function addIconContent($icon,$description=NULL){ |
|
| 88 | + public function addIconContent($icon, $description=NULL) { |
|
| 89 | 89 | $content=$this->content["content"]; |
| 90 | - if(isset($description)){ |
|
| 91 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
| 92 | - $content->addContent($description,true); |
|
| 90 | + if (isset($description)) { |
|
| 91 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
| 92 | + $content->addContent($description, true); |
|
| 93 | 93 | } |
| 94 | - if($icon!==""){ |
|
| 95 | - $img=new HtmlIcon("image-".$this->identifier,$icon); |
|
| 96 | - $content->addContent($img,true); |
|
| 97 | - $content->addToProperty("class","image"); |
|
| 94 | + if ($icon!=="") { |
|
| 95 | + $img=new HtmlIcon("image-".$this->identifier, $icon); |
|
| 96 | + $content->addContent($img, true); |
|
| 97 | + $content->addToProperty("class", "image"); |
|
| 98 | 98 | } |
| 99 | 99 | return $this; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - private function addContentInPart($content,$uiClass,$part) { |
|
| 103 | - return $this->addElementInPart(new HtmlSemDoubleElement($part."-" . $this->identifier, "div", $uiClass, $content), $part); |
|
| 102 | + private function addContentInPart($content, $uiClass, $part) { |
|
| 103 | + return $this->addElementInPart(new HtmlSemDoubleElement($part."-".$this->identifier, "div", $uiClass, $content), $part); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - private function addElementInPart($element,$part) { |
|
| 106 | + private function addElementInPart($element, $part) { |
|
| 107 | 107 | $this->content[$part]->addContent($element); |
| 108 | 108 | return $element; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - public function showDimmer($value){ |
|
| 112 | - $value=$value?"show":"hide"; |
|
| 111 | + public function showDimmer($value) { |
|
| 112 | + $value=$value ? "show" : "hide"; |
|
| 113 | 113 | $this->_paramParts[]=["'".$value." dimmer'"]; |
| 114 | 114 | return $this; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - public function setInverted(){ |
|
| 117 | + public function setInverted() { |
|
| 118 | 118 | $this->_params["inverted"]=true; |
| 119 | 119 | return $this; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - public function setBasic(){ |
|
| 122 | + public function setBasic() { |
|
| 123 | 123 | return $this->addToProperty("class", "basic"); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
| 127 | - public function setTransition($value){ |
|
| 128 | - $this->_paramParts[]=["'setting'","'transition'","'".$value."'"]; |
|
| 127 | + public function setTransition($value) { |
|
| 128 | + $this->_paramParts[]=["'setting'", "'transition'", "'".$value."'"]; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | * @param string $viewName |
| 136 | 136 | * @param $params The parameters to pass to the view |
| 137 | 137 | */ |
| 138 | - public function renderView(JsUtils $js,$initialController,$viewName, $params=array()) { |
|
| 139 | - return $this->setContent($js->renderContent($initialController, $viewName,$params)); |
|
| 138 | + public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) { |
|
| 139 | + return $this->setContent($js->renderContent($initialController, $viewName, $params)); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | * @param string $actionName the action name |
| 148 | 148 | * @param array $params |
| 149 | 149 | */ |
| 150 | - public function forward(JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
| 151 | - return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName,$params)); |
|
| 150 | + public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
| 151 | + return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params)); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 159 | 159 | */ |
| 160 | 160 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 161 | - $this->content=JArray::sortAssociative($this->content, ["header","content","actions" ]); |
|
| 161 | + $this->content=JArray::sortAssociative($this->content, ["header", "content", "actions"]); |
|
| 162 | 162 | return parent::compile($js, $view); |
| 163 | 163 | } |
| 164 | 164 | /* |
@@ -166,8 +166,8 @@ discard block |
||
| 166 | 166 | * @see BaseHtml::run() |
| 167 | 167 | */ |
| 168 | 168 | public function run(JsUtils $js) { |
| 169 | - if(isset($this->_bsComponent)===false) |
|
| 170 | - $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
| 169 | + if (isset($this->_bsComponent)===false) |
|
| 170 | + $this->_bsComponent=$js->semantic()->modal("#".$this->identifier, $this->_params, $this->_paramParts); |
|
| 171 | 171 | $this->addEventsOnRun($js); |
| 172 | 172 | return $this->_bsComponent; |
| 173 | 173 | } |
@@ -17,17 +17,17 @@ discard block |
||
| 17 | 17 | $this->createBar(); |
| 18 | 18 | if (isset($label)) |
| 19 | 19 | $this->setLabel($label); |
| 20 | - $this->_states=[ State::SUCCESS,State::WARNING,State::ERROR,State::ACTIVE,State::DISABLED ]; |
|
| 20 | + $this->_states=[State::SUCCESS, State::WARNING, State::ERROR, State::ACTIVE, State::DISABLED]; |
|
| 21 | 21 | $this->addToProperty("class", $attributes); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public function setLabel($label) { |
| 25 | - $this->content["label"]=new HtmlSemDoubleElement("lbl-" . $this->identifier, "div", "label", $label); |
|
| 25 | + $this->content["label"]=new HtmlSemDoubleElement("lbl-".$this->identifier, "div", "label", $label); |
|
| 26 | 26 | return $this; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | private function createBar() { |
| 30 | - $bar=new HtmlSemDoubleElement("bar-" . $this->identifier, "div", "bar", new HtmlSemDoubleElement("progress-" . $this->identifier, "div", "progress")); |
|
| 30 | + $bar=new HtmlSemDoubleElement("bar-".$this->identifier, "div", "bar", new HtmlSemDoubleElement("progress-".$this->identifier, "div", "progress")); |
|
| 31 | 31 | $this->content["bar"]=$bar; |
| 32 | 32 | return $this; |
| 33 | 33 | } |
@@ -63,20 +63,20 @@ discard block |
||
| 63 | 63 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 64 | 64 | */ |
| 65 | 65 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 66 | - $this->content=JArray::sortAssociative($this->content, [ "bar","label" ]); |
|
| 66 | + $this->content=JArray::sortAssociative($this->content, ["bar", "label"]); |
|
| 67 | 67 | return parent::compile($js, $view); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | public function jsSetValue($value) { |
| 71 | - return '$("#' . $this->identifier . '").progress({value:' . $value . '});'; |
|
| 71 | + return '$("#'.$this->identifier.'").progress({value:'.$value.'});'; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function jsIncValue() { |
| 75 | - return '$("#' . $this->identifier . '").progress("increment");'; |
|
| 75 | + return '$("#'.$this->identifier.'").progress("increment");'; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | public function jsDecValue() { |
| 79 | - return '$("#' . $this->identifier . '").progress("decrement");'; |
|
| 79 | + return '$("#'.$this->identifier.'").progress("decrement");'; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -98,12 +98,12 @@ discard block |
||
| 98 | 98 | $percent=JArray::getDefaultValue($array, "percent", $percent); |
| 99 | 99 | $ratio=JArray::getDefaultValue($array, "ratio", $ratio); |
| 100 | 100 | } |
| 101 | - $this->_params["text"]="%{active : " . \var_export($active, true) . ",error: " . \var_export($error, true) . ",success : " . \var_export($success, true) . ",warning : " . \var_export($warning, true) . ",percent : " . \var_export($percent, true) . ",ratio : " . \var_export($ratio, true) . "}%"; |
|
| 101 | + $this->_params["text"]="%{active : ".\var_export($active, true).",error: ".\var_export($error, true).",success : ".\var_export($success, true).",warning : ".\var_export($warning, true).",percent : ".\var_export($percent, true).",ratio : ".\var_export($ratio, true)."}%"; |
|
| 102 | 102 | return $this; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | public function onChange($jsCode) { |
| 106 | - $this->addBehavior($this->_params, "onChange", $jsCode,"%function(percent, value, total){","}%"); |
|
| 106 | + $this->addBehavior($this->_params, "onChange", $jsCode, "%function(percent, value, total){", "}%"); |
|
| 107 | 107 | return $this; |
| 108 | 108 | } |
| 109 | 109 | |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | * @see BaseHtml::run() |
| 113 | 113 | */ |
| 114 | 114 | public function run(JsUtils $js) { |
| 115 | - if (isset($this->_bsComponent) === false) |
|
| 116 | - $this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params); |
|
| 115 | + if (isset($this->_bsComponent)===false) |
|
| 116 | + $this->_bsComponent=$js->semantic()->progress("#".$this->identifier, $this->_params); |
|
| 117 | 117 | $this->addEventsOnRun($js); |
| 118 | 118 | return $this->_bsComponent; |
| 119 | 119 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | class HtmlForm extends HtmlSemCollection { |
| 23 | 23 | |
| 24 | - use FieldsTrait,FormTrait; |
|
| 24 | + use FieldsTrait, FormTrait; |
|
| 25 | 25 | /** |
| 26 | 26 | * @var array |
| 27 | 27 | */ |
@@ -34,14 +34,14 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function __construct($identifier, $elements=array()) { |
| 36 | 36 | parent::__construct($identifier, "form", "ui form"); |
| 37 | - $this->_states=[ State::ERROR,State::SUCCESS,State::WARNING,State::DISABLED ]; |
|
| 37 | + $this->_states=[State::ERROR, State::SUCCESS, State::WARNING, State::DISABLED]; |
|
| 38 | 38 | $this->setProperty("name", $this->identifier); |
| 39 | - $this->_fields=array (); |
|
| 39 | + $this->_fields=array(); |
|
| 40 | 40 | $this->addItems($elements); |
| 41 | 41 | $this->_validationParams=[]; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - protected function getForm(){ |
|
| 44 | + protected function getForm() { |
|
| 45 | 45 | return $this; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | * @param string $caption |
| 63 | 63 | * @return \Ajax\semantic\html\collections\form\HtmlForm |
| 64 | 64 | */ |
| 65 | - public function addDivider($caption=NULL){ |
|
| 66 | - return $this->addContent(new HtmlDivider("",$caption)); |
|
| 65 | + public function addDivider($caption=NULL) { |
|
| 66 | + return $this->addContent(new HtmlDivider("", $caption)); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | public function addFields($fields=NULL, $label=NULL) { |
@@ -79,12 +79,12 @@ discard block |
||
| 79 | 79 | $label=NULL; |
| 80 | 80 | } |
| 81 | 81 | $this->_fields=\array_merge($this->_fields, $fields); |
| 82 | - $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields); |
|
| 82 | + $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(), $fields); |
|
| 83 | 83 | } |
| 84 | 84 | if (isset($label)) |
| 85 | 85 | $fields=new HtmlFormField("", $fields, $label); |
| 86 | 86 | } else { |
| 87 | - $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count()); |
|
| 87 | + $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count()); |
|
| 88 | 88 | } |
| 89 | 89 | $this->addItem($fields); |
| 90 | 90 | return $fields; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | public function addItem($item) { |
| 94 | 94 | $item=parent::addItem($item); |
| 95 | - if (\is_subclass_of($item, HtmlFormField::class) === true) { |
|
| 95 | + if (\is_subclass_of($item, HtmlFormField::class)===true) { |
|
| 96 | 96 | $this->_fields[]=$item; |
| 97 | 97 | } |
| 98 | 98 | return $item; |
@@ -146,39 +146,39 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | |
| 148 | 148 | |
| 149 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 150 | - if(\sizeof($this->_validationParams)>0) |
|
| 149 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 150 | + if (\sizeof($this->_validationParams)>0) |
|
| 151 | 151 | $this->setProperty("novalidate", ""); |
| 152 | - return parent::compile($js,$view); |
|
| 152 | + return parent::compile($js, $view); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | public function run(JsUtils $js) { |
| 156 | - if(isset($js)){ |
|
| 156 | + if (isset($js)) { |
|
| 157 | 157 | $compo=$js->semantic()->form("#".$this->identifier); |
| 158 | - }else{ |
|
| 158 | + } else { |
|
| 159 | 159 | $compo=new Form(); |
| 160 | 160 | $compo->attach("#".$this->identifier); |
| 161 | 161 | } |
| 162 | - foreach ($this->_fields as $field){ |
|
| 163 | - if($field instanceof HtmlFormField){ |
|
| 162 | + foreach ($this->_fields as $field) { |
|
| 163 | + if ($field instanceof HtmlFormField) { |
|
| 164 | 164 | $compo=$this->addCompoValidation($compo, $field); |
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | - foreach ($this->content as $field){ |
|
| 168 | - if($field instanceof HtmlFormFields){ |
|
| 167 | + foreach ($this->content as $field) { |
|
| 168 | + if ($field instanceof HtmlFormFields) { |
|
| 169 | 169 | $items=$field->getItems(); |
| 170 | - foreach ($items as $_field){ |
|
| 171 | - if($_field instanceof HtmlFormField) |
|
| 170 | + foreach ($items as $_field) { |
|
| 171 | + if ($_field instanceof HtmlFormField) |
|
| 172 | 172 | $compo=$this->addCompoValidation($compo, $_field); |
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | - $this->_runValidationParams($compo,$js); |
|
| 176 | + $this->_runValidationParams($compo, $js); |
|
| 177 | 177 | return $this->_bsComponent; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - public function addValidationParam($paramName,$paramValue,$before="",$after=""){ |
|
| 181 | - $this->addBehavior($this->_validationParams, $paramName, $paramValue,$before,$after); |
|
| 180 | + public function addValidationParam($paramName, $paramValue, $before="", $after="") { |
|
| 181 | + $this->addBehavior($this->_validationParams, $paramName, $paramValue, $before, $after); |
|
| 182 | 182 | return $this; |
| 183 | 183 | } |
| 184 | 184 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | return $this->_validationParams; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - public function removeValidationParam($param){ |
|
| 194 | + public function removeValidationParam($param) { |
|
| 195 | 195 | unset($this->_validationParams[$param]); |
| 196 | 196 | return $this; |
| 197 | 197 | } |
@@ -12,28 +12,28 @@ discard block |
||
| 12 | 12 | * @author jc |
| 13 | 13 | * |
| 14 | 14 | */ |
| 15 | -trait FormTrait{ |
|
| 15 | +trait FormTrait { |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * @return HtmlForm |
| 19 | 19 | */ |
| 20 | 20 | abstract protected function getForm(); |
| 21 | 21 | |
| 22 | - protected function addCompoValidation($compo,$field){ |
|
| 22 | + protected function addCompoValidation($compo, $field) { |
|
| 23 | 23 | $validation=$field->getValidation(); |
| 24 | - if(isset($validation)){ |
|
| 24 | + if (isset($validation)) { |
|
| 25 | 25 | $validation->setIdentifier($field->getDataField()->getIdentifier()); |
| 26 | 26 | $compo->addFieldValidation($validation); |
| 27 | 27 | } |
| 28 | 28 | return $compo; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - protected function _runValidationParams(&$compo,JsUtils $js=NULL){ |
|
| 31 | + protected function _runValidationParams(&$compo, JsUtils $js=NULL) { |
|
| 32 | 32 | $form=$this->getForm(); |
| 33 | 33 | $params=$form->getValidationParams(); |
| 34 | - if(isset($params["_ajaxSubmit"]) && $params["_ajaxSubmit"] instanceof AjaxCall){ |
|
| 34 | + if (isset($params["_ajaxSubmit"]) && $params["_ajaxSubmit"] instanceof AjaxCall) { |
|
| 35 | 35 | $compilation=$params["_ajaxSubmit"]->compile($js); |
| 36 | - $compilation=str_ireplace("\"","%quote%", $compilation); |
|
| 36 | + $compilation=str_ireplace("\"", "%quote%", $compilation); |
|
| 37 | 37 | $this->onSuccess($compilation); |
| 38 | 38 | $form->removeValidationParam("_ajaxSubmit"); |
| 39 | 39 | } |
@@ -51,14 +51,14 @@ discard block |
||
| 51 | 51 | return $this; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - public function setAttached($value=true){ |
|
| 54 | + public function setAttached($value=true) { |
|
| 55 | 55 | $form=$this->getForm(); |
| 56 | - if($value) |
|
| 57 | - $form->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 56 | + if ($value) |
|
| 57 | + $form->addToPropertyCtrl("class", "attached", array("attached")); |
|
| 58 | 58 | return $form; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public function addErrorMessage(){ |
|
| 61 | + public function addErrorMessage() { |
|
| 62 | 62 | return $this->getForm()->addContent((new HtmlMessage(""))->setError()); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -73,38 +73,38 @@ discard block |
||
| 73 | 73 | * @param string $responseElement |
| 74 | 74 | * @return \Ajax\semantic\html\collections\form\HtmlForm |
| 75 | 75 | */ |
| 76 | - public function submitOn($event,$identifier,$url,$responseElement){ |
|
| 76 | + public function submitOn($event, $identifier, $url, $responseElement) { |
|
| 77 | 77 | $form=$this->getForm(); |
| 78 | 78 | $elem=$form->getElementById($identifier, $form->getContent()); |
| 79 | - if(isset($elem)){ |
|
| 80 | - $this->_buttonAsSubmit($elem, $event,$url,$responseElement); |
|
| 79 | + if (isset($elem)) { |
|
| 80 | + $this->_buttonAsSubmit($elem, $event, $url, $responseElement); |
|
| 81 | 81 | } |
| 82 | 82 | return $form; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - public function submitOnClick($identifier,$url,$responseElement){ |
|
| 85 | + public function submitOnClick($identifier, $url, $responseElement) { |
|
| 86 | 86 | return $this->submitOn("click", $identifier, $url, $responseElement); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - public function addSubmit($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL){ |
|
| 90 | - $bt=$this->getForm()->addButton($identifier, $value,$cssStyle); |
|
| 91 | - return $this->_buttonAsSubmit($bt, "click",$url,$responseElement); |
|
| 89 | + public function addSubmit($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL) { |
|
| 90 | + $bt=$this->getForm()->addButton($identifier, $value, $cssStyle); |
|
| 91 | + return $this->_buttonAsSubmit($bt, "click", $url, $responseElement); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - protected function _buttonAsSubmit(HtmlButton &$button,$event,$url,$responseElement=NULL,$parameters=NULL){ |
|
| 94 | + protected function _buttonAsSubmit(HtmlButton&$button, $event, $url, $responseElement=NULL, $parameters=NULL) { |
|
| 95 | 95 | $form=$this->getForm(); |
| 96 | - if(isset($url) && isset($responseElement)){ |
|
| 97 | - $button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');",true,true); |
|
| 98 | - $params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url,"stopPropagation"=>true]; |
|
| 99 | - if(\is_array($parameters)) |
|
| 100 | - $params=\array_merge($params,$parameters); |
|
| 96 | + if (isset($url) && isset($responseElement)) { |
|
| 97 | + $button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');", true, true); |
|
| 98 | + $params=["form"=>$form->getIdentifier(), "responseElement"=>$responseElement, "url"=>$url, "stopPropagation"=>true]; |
|
| 99 | + if (\is_array($parameters)) |
|
| 100 | + $params=\array_merge($params, $parameters); |
|
| 101 | 101 | $form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params)); |
| 102 | 102 | } |
| 103 | 103 | return $button; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - public function addReset($identifier,$value,$cssStyle=NULL){ |
|
| 107 | - $bt=$this->getForm()->addButton($identifier, $value,$cssStyle); |
|
| 106 | + public function addReset($identifier, $value, $cssStyle=NULL) { |
|
| 107 | + $bt=$this->getForm()->addButton($identifier, $value, $cssStyle); |
|
| 108 | 108 | $bt->setProperty("type", "reset"); |
| 109 | 109 | return $bt; |
| 110 | 110 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @param string $jsCode |
| 115 | 115 | * @return \Ajax\semantic\html\collections\form\HtmlForm |
| 116 | 116 | */ |
| 117 | - public function onValid($jsCode){ |
|
| 117 | + public function onValid($jsCode) { |
|
| 118 | 118 | $form=$this->getForm(); |
| 119 | 119 | $form->addValidationParam("onValid", "%function(){".$jsCode."}%"); |
| 120 | 120 | return $form; |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | * @param string $jsCode can use event and fields parameters |
| 126 | 126 | * @return HtmlForm |
| 127 | 127 | */ |
| 128 | - public function onSuccess($jsCode){ |
|
| 128 | + public function onSuccess($jsCode) { |
|
| 129 | 129 | $form=$this->getForm(); |
| 130 | - $form->addValidationParam("onSuccess", $jsCode,"%function(event,fields){","}%"); |
|
| 130 | + $form->addValidationParam("onSuccess", $jsCode, "%function(event,fields){", "}%"); |
|
| 131 | 131 | return $form; |
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | \ No newline at end of file |
@@ -14,34 +14,34 @@ discard block |
||
| 14 | 14 | use FieldTrait; |
| 15 | 15 | protected $_container; |
| 16 | 16 | protected $_validation; |
| 17 | - public function __construct($identifier, $field,$label=NULL) { |
|
| 18 | - parent::__construct($identifier, "div","field"); |
|
| 17 | + public function __construct($identifier, $field, $label=NULL) { |
|
| 18 | + parent::__construct($identifier, "div", "field"); |
|
| 19 | 19 | $this->content=array(); |
| 20 | - $this->_states=[State::ERROR,State::DISABLED]; |
|
| 21 | - if(isset($label) && $label!=="") |
|
| 20 | + $this->_states=[State::ERROR, State::DISABLED]; |
|
| 21 | + if (isset($label) && $label!=="") |
|
| 22 | 22 | $this->setLabel($label); |
| 23 | 23 | $this->setField($field); |
| 24 | 24 | $this->_validation=NULL; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function addPointingLabel($label,$pointing=Direction::NONE){ |
|
| 28 | - $labelO=new HtmlLabel("",$label); |
|
| 27 | + public function addPointingLabel($label, $pointing=Direction::NONE) { |
|
| 28 | + $labelO=new HtmlLabel("", $label); |
|
| 29 | 29 | $labelO->setPointing($pointing); |
| 30 | - $this->addContent($labelO,$pointing==="below" || $pointing==="right"); |
|
| 30 | + $this->addContent($labelO, $pointing==="below" || $pointing==="right"); |
|
| 31 | 31 | return $labelO; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function setLabel($label){ |
|
| 34 | + public function setLabel($label) { |
|
| 35 | 35 | $labelO=$label; |
| 36 | - if(\is_string($label)){ |
|
| 37 | - $labelO=new HtmlSemDoubleElement("","label",""); |
|
| 36 | + if (\is_string($label)) { |
|
| 37 | + $labelO=new HtmlSemDoubleElement("", "label", ""); |
|
| 38 | 38 | $labelO->setContent($label); |
| 39 | - $labelO->setProperty("for", \str_replace("field-", "",$this->identifier)); |
|
| 39 | + $labelO->setProperty("for", \str_replace("field-", "", $this->identifier)); |
|
| 40 | 40 | } |
| 41 | 41 | $this->content["label"]=$labelO; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function setField($field){ |
|
| 44 | + public function setField($field) { |
|
| 45 | 45 | $this->content["field"]=$field; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | * Returns the label or null |
| 50 | 50 | * @return mixed |
| 51 | 51 | */ |
| 52 | - public function getLabel(){ |
|
| 53 | - if(\array_key_exists("label", $this->content)) |
|
| 52 | + public function getLabel() { |
|
| 53 | + if (\array_key_exists("label", $this->content)) |
|
| 54 | 54 | return $this->content["label"]; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * Return the field |
| 59 | 59 | * @return mixed |
| 60 | 60 | */ |
| 61 | - public function getField(){ |
|
| 61 | + public function getField() { |
|
| 62 | 62 | return $this->content["field"]; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -66,14 +66,14 @@ discard block |
||
| 66 | 66 | * Return the field with data |
| 67 | 67 | * @return mixed |
| 68 | 68 | */ |
| 69 | - public function getDataField(){ |
|
| 69 | + public function getDataField() { |
|
| 70 | 70 | return $this->content["field"]; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * puts the label before or behind |
| 75 | 75 | */ |
| 76 | - public function swapLabel(){ |
|
| 76 | + public function swapLabel() { |
|
| 77 | 77 | $label=$this->getLabel(); |
| 78 | 78 | unset($this->content["label"]); |
| 79 | 79 | $this->content["label"]=$label; |
@@ -84,31 +84,31 @@ discard block |
||
| 84 | 84 | * @param int $width |
| 85 | 85 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
| 86 | 86 | */ |
| 87 | - public function setWidth($width){ |
|
| 88 | - if(\is_int($width)){ |
|
| 87 | + public function setWidth($width) { |
|
| 88 | + if (\is_int($width)) { |
|
| 89 | 89 | $width=Wide::getConstants()["W".$width]; |
| 90 | 90 | } |
| 91 | 91 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 92 | - if(isset($this->_container)){ |
|
| 92 | + if (isset($this->_container)) { |
|
| 93 | 93 | $this->_container->setEqualWidth(false); |
| 94 | 94 | } |
| 95 | - return $this->addToPropertyCtrl("class", "wide",array("wide")); |
|
| 95 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | 99 | * Field displays an error state |
| 100 | 100 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
| 101 | 101 | */ |
| 102 | - public function setError(){ |
|
| 102 | + public function setError() { |
|
| 103 | 103 | return $this->addToProperty("class", "error"); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - public function setInline(){ |
|
| 106 | + public function setInline() { |
|
| 107 | 107 | return $this->addToProperty("class", "inline"); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - public function jsState($state){ |
|
| 111 | - return $this->jsDoJquery("addClass",$state); |
|
| 110 | + public function jsState($state) { |
|
| 111 | + return $this->jsDoJquery("addClass", $state); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | public function setContainer($_container) { |
@@ -116,39 +116,39 @@ discard block |
||
| 116 | 116 | return $this; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - public function setReadonly(){ |
|
| 119 | + public function setReadonly() { |
|
| 120 | 120 | $this->getField()->setProperty("readonly", ""); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public function addRule($type,$prompt=NULL,$value=NULL){ |
|
| 123 | + public function addRule($type, $prompt=NULL, $value=NULL) { |
|
| 124 | 124 | $field=$this->getDataField(); |
| 125 | - if(isset($field)){ |
|
| 126 | - if(!isset($this->_validation)){ |
|
| 125 | + if (isset($field)) { |
|
| 126 | + if (!isset($this->_validation)) { |
|
| 127 | 127 | $this->_validation=new FieldValidation($field->getIdentifier()); |
| 128 | 128 | } |
| 129 | - if($type==="empty"){ |
|
| 130 | - $this->addToProperty("class","required"); |
|
| 129 | + if ($type==="empty") { |
|
| 130 | + $this->addToProperty("class", "required"); |
|
| 131 | 131 | } |
| 132 | - $this->_validation->addRule($type,$prompt,$value); |
|
| 132 | + $this->_validation->addRule($type, $prompt, $value); |
|
| 133 | 133 | } |
| 134 | 134 | return $this; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - public function addRules(array $rules){ |
|
| 138 | - foreach ($rules as $rule){ |
|
| 137 | + public function addRules(array $rules) { |
|
| 138 | + foreach ($rules as $rule) { |
|
| 139 | 139 | $this->addRule($rule); |
| 140 | 140 | } |
| 141 | 141 | return $this; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - public function setRules(array $rules){ |
|
| 144 | + public function setRules(array $rules) { |
|
| 145 | 145 | $this->_validation=null; |
| 146 | 146 | return $this->addRules($rules); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - public function addIcon($icon,$direction=Direction::LEFT){ |
|
| 149 | + public function addIcon($icon, $direction=Direction::LEFT) { |
|
| 150 | 150 | $field=$this->getField(); |
| 151 | - return $field->addIcon($icon,$direction); |
|
| 151 | + return $field->addIcon($icon, $direction); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | public function getValidation() { |
@@ -30,42 +30,42 @@ discard block |
||
| 30 | 30 | * @param string|HtmlSemDoubleElement $header |
| 31 | 31 | * @return \Ajax\semantic\html\collections\HtmlMessage |
| 32 | 32 | */ |
| 33 | - public function addHeader($header){ |
|
| 33 | + public function addHeader($header) { |
|
| 34 | 34 | $headerO=$header; |
| 35 | - if(\is_string($header)){ |
|
| 36 | - $headerO=new HtmlSemDoubleElement("header-".$this->identifier,"div"); |
|
| 35 | + if (\is_string($header)) { |
|
| 36 | + $headerO=new HtmlSemDoubleElement("header-".$this->identifier, "div"); |
|
| 37 | 37 | $headerO->setClass("header"); |
| 38 | 38 | $headerO->setContent($header); |
| 39 | 39 | } |
| 40 | - return $this->addContent($headerO,true); |
|
| 40 | + return $this->addContent($headerO, true); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function setHeader($header){ |
|
| 43 | + public function setHeader($header) { |
|
| 44 | 44 | return $this->addHeader($header); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function addList($elements,$ordered=false){ |
|
| 48 | - $list=new HtmlList("list-".$this->identifier,$elements); |
|
| 47 | + public function addList($elements, $ordered=false) { |
|
| 48 | + $list=new HtmlList("list-".$this->identifier, $elements); |
|
| 49 | 49 | $list->setOrdered($ordered); |
| 50 | 50 | $list->setClass("ui list"); |
| 51 | 51 | $this->addContent($list); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - public function setIcon($icon){ |
|
| 54 | + public function setIcon($icon) { |
|
| 55 | 55 | $this->addToProperty("class", "icon"); |
| 56 | - $this->wrapContent("<div class='content'>","</div>"); |
|
| 56 | + $this->wrapContent("<div class='content'>", "</div>"); |
|
| 57 | 57 | $this->icon=new HtmlIcon("icon-".$this->identifier, $icon); |
| 58 | 58 | return $this; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public function addLoader($loaderIcon="notched circle"){ |
|
| 61 | + public function addLoader($loaderIcon="notched circle") { |
|
| 62 | 62 | $this->setIcon($loaderIcon); |
| 63 | 63 | $this->icon->addToIcon("loading"); |
| 64 | 64 | return $this; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - public function setDismissable($dismiss=true){ |
|
| 68 | - if($dismiss===true) |
|
| 67 | + public function setDismissable($dismiss=true) { |
|
| 68 | + if ($dismiss===true) |
|
| 69 | 69 | $this->close=new HtmlIcon("close-".$this->identifier, "close"); |
| 70 | 70 | else |
| 71 | 71 | $this->close=NULL; |
@@ -76,38 +76,38 @@ discard block |
||
| 76 | 76 | * {@inheritDoc} |
| 77 | 77 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
| 78 | 78 | */ |
| 79 | - public function run(JsUtils $js){ |
|
| 79 | + public function run(JsUtils $js) { |
|
| 80 | 80 | parent::run($js); |
| 81 | - if(isset($this->close)){ |
|
| 81 | + if (isset($this->close)) { |
|
| 82 | 82 | $js->execOn("click", "#".$this->identifier." .close", "$(this).closest('.message').transition('fade')"); |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - public function setState($visible=true){ |
|
| 87 | - $visible=($visible===true)?"visible":"hidden"; |
|
| 88 | - return $this->addToPropertyCtrl("class", $visible, array("visible","hidden")); |
|
| 86 | + public function setState($visible=true) { |
|
| 87 | + $visible=($visible===true) ? "visible" : "hidden"; |
|
| 88 | + return $this->addToPropertyCtrl("class", $visible, array("visible", "hidden")); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public function setVariation($value="floating"){ |
|
| 92 | - return $this->addToPropertyCtrl("class", $value, array("floating","compact")); |
|
| 91 | + public function setVariation($value="floating") { |
|
| 92 | + return $this->addToPropertyCtrl("class", $value, array("floating", "compact")); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - public function setStyle($style){ |
|
| 95 | + public function setStyle($style) { |
|
| 96 | 96 | return $this->addToPropertyCtrl("class", $style, Style::getConstants()); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - public function setError(){ |
|
| 99 | + public function setError() { |
|
| 100 | 100 | return $this->setStyle("error"); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - public function setWarning(){ |
|
| 103 | + public function setWarning() { |
|
| 104 | 104 | return $this->setStyle("warning"); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - public function setMessage($message){ |
|
| 108 | - if(\is_array($this->content)){ |
|
| 107 | + public function setMessage($message) { |
|
| 108 | + if (\is_array($this->content)) { |
|
| 109 | 109 | $this->content[\sizeof($this->content)-1]=$message; |
| 110 | - }else |
|
| 110 | + } else |
|
| 111 | 111 | $this->setContent($message); |
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | \ No newline at end of file |
@@ -25,23 +25,23 @@ discard block |
||
| 25 | 25 | * @property boolean $_edition |
| 26 | 26 | * @property mixed _modelInstance |
| 27 | 27 | */ |
| 28 | -trait FieldAsTrait{ |
|
| 28 | +trait FieldAsTrait { |
|
| 29 | 29 | |
| 30 | - abstract protected function _getFieldIdentifier($prefix,$name=""); |
|
| 31 | - abstract public function setValueFunction($index,$callback); |
|
| 30 | + abstract protected function _getFieldIdentifier($prefix, $name=""); |
|
| 31 | + abstract public function setValueFunction($index, $callback); |
|
| 32 | 32 | abstract protected function _getFieldName($index); |
| 33 | 33 | abstract protected function _getFieldCaption($index); |
| 34 | - abstract protected function _buttonAsSubmit(HtmlButton &$button,$event,$url,$responseElement=NULL,$parameters=NULL); |
|
| 34 | + abstract protected function _buttonAsSubmit(HtmlButton&$button, $event, $url, $responseElement=NULL, $parameters=NULL); |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * @param HtmlFormField $element |
| 38 | 38 | * @param array $attributes |
| 39 | 39 | */ |
| 40 | - protected function _applyAttributes($element,&$attributes,$index){ |
|
| 41 | - if(isset($attributes["callback"])){ |
|
| 40 | + protected function _applyAttributes($element, &$attributes, $index) { |
|
| 41 | + if (isset($attributes["callback"])) { |
|
| 42 | 42 | $callback=$attributes["callback"]; |
| 43 | - if(\is_callable($callback)){ |
|
| 44 | - $callback($element,$this->_modelInstance,$index); |
|
| 43 | + if (\is_callable($callback)) { |
|
| 44 | + $callback($element, $this->_modelInstance, $index); |
|
| 45 | 45 | unset($attributes["callback"]); |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -51,43 +51,43 @@ discard block |
||
| 51 | 51 | $element->fromArray($attributes); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - private function _getLabelField($caption,$icon=NULL){ |
|
| 55 | - $label=new HtmlLabel($this->_getFieldIdentifier("lbl"),$caption,$icon); |
|
| 54 | + private function _getLabelField($caption, $icon=NULL) { |
|
| 55 | + $label=new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon); |
|
| 56 | 56 | return $label; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | |
| 60 | - protected function _addRules($element,&$attributes){ |
|
| 61 | - if(isset($attributes["rules"])){ |
|
| 60 | + protected function _addRules($element, &$attributes) { |
|
| 61 | + if (isset($attributes["rules"])) { |
|
| 62 | 62 | $rules=$attributes["rules"]; |
| 63 | - if(\is_array($rules)){ |
|
| 63 | + if (\is_array($rules)) { |
|
| 64 | 64 | $element->addRules($rules); |
| 65 | 65 | } |
| 66 | - else{ |
|
| 66 | + else { |
|
| 67 | 67 | $element->addRule($rules); |
| 68 | 68 | } |
| 69 | 69 | unset($attributes["rules"]); |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - protected function _prepareFormFields(&$field,$name,&$attributes){ |
|
| 73 | + protected function _prepareFormFields(&$field, $name, &$attributes) { |
|
| 74 | 74 | $field->setName($name); |
| 75 | 75 | $this->_addRules($field, $attributes); |
| 76 | 76 | return $field; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - protected function _fieldAs($elementCallback,&$index,$attributes=NULL,$prefix=null){ |
|
| 80 | - $this->setValueFunction($index,function($value,$instance,$index) use (&$attributes,$elementCallback,$prefix){ |
|
| 79 | + protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null) { |
|
| 80 | + $this->setValueFunction($index, function($value, $instance, $index) use (&$attributes, $elementCallback, $prefix){ |
|
| 81 | 81 | $caption=$this->_getFieldCaption($index); |
| 82 | 82 | $name=$this->_getFieldName($index); |
| 83 | - $id=$this->_getFieldIdentifier($prefix,$name); |
|
| 84 | - if(isset($attributes["name"])){ |
|
| 83 | + $id=$this->_getFieldIdentifier($prefix, $name); |
|
| 84 | + if (isset($attributes["name"])) { |
|
| 85 | 85 | $name=$attributes["name"]; |
| 86 | 86 | unset($attributes["name"]); |
| 87 | 87 | } |
| 88 | - $element=$elementCallback($id,$name,$value,$caption); |
|
| 89 | - if(\is_array($attributes)){ |
|
| 90 | - $this->_applyAttributes($element, $attributes,$index); |
|
| 88 | + $element=$elementCallback($id, $name, $value, $caption); |
|
| 89 | + if (\is_array($attributes)) { |
|
| 90 | + $this->_applyAttributes($element, $attributes, $index); |
|
| 91 | 91 | } |
| 92 | 92 | $element->setDisabled(!$this->_edition); |
| 93 | 93 | return $element; |
@@ -96,169 +96,169 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
| 99 | - public function fieldAsProgress($index,$label=NULL, $attributes=array()){ |
|
| 100 | - $this->setValueFunction($index,function($value) use($label,$attributes){ |
|
| 101 | - $pb=new HtmlProgress($this->_getFieldIdentifier("pb"),$value,$label,$attributes); |
|
| 99 | + public function fieldAsProgress($index, $label=NULL, $attributes=array()) { |
|
| 100 | + $this->setValueFunction($index, function($value) use($label, $attributes){ |
|
| 101 | + $pb=new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes); |
|
| 102 | 102 | return $pb; |
| 103 | 103 | }); |
| 104 | 104 | return $this; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - public function fieldAsRating($index,$max=5, $icon=""){ |
|
| 108 | - $this->setValueFunction($index,function($value) use($max,$icon){ |
|
| 109 | - $rating=new HtmlRating($this->_getFieldIdentifier("rat"),$value,$max,$icon); |
|
| 107 | + public function fieldAsRating($index, $max=5, $icon="") { |
|
| 108 | + $this->setValueFunction($index, function($value) use($max, $icon){ |
|
| 109 | + $rating=new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon); |
|
| 110 | 110 | return $rating; |
| 111 | 111 | }); |
| 112 | 112 | return $this; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - public function fieldAsLabel($index,$icon=NULL){ |
|
| 116 | - $this->setValueFunction($index,function($caption) use($icon){ |
|
| 117 | - $lbl=$this->_getLabelField($caption,$icon); |
|
| 115 | + public function fieldAsLabel($index, $icon=NULL) { |
|
| 116 | + $this->setValueFunction($index, function($caption) use($icon){ |
|
| 117 | + $lbl=$this->_getLabelField($caption, $icon); |
|
| 118 | 118 | return $lbl; |
| 119 | 119 | }); |
| 120 | 120 | return $this; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){ |
|
| 124 | - return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){ |
|
| 125 | - $header=new HtmlHeader($id,$niveau,$value); |
|
| 126 | - if(isset($icon)) |
|
| 123 | + public function fieldAsHeader($index, $niveau=1, $icon=NULL, $attributes=NULL) { |
|
| 124 | + return $this->_fieldAs(function($id, $name, $value) use($niveau, $icon){ |
|
| 125 | + $header=new HtmlHeader($id, $niveau, $value); |
|
| 126 | + if (isset($icon)) |
|
| 127 | 127 | $header->asIcon($icon, $value); |
| 128 | 128 | return $header; |
| 129 | - }, $index,$attributes,"header"); |
|
| 129 | + }, $index, $attributes, "header"); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | |
| 133 | - public function fieldAsImage($index,$size=Size::MINI,$circular=false){ |
|
| 134 | - $this->setValueFunction($index,function($img) use($size,$circular){ |
|
| 135 | - $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular(); |
|
| 133 | + public function fieldAsImage($index, $size=Size::MINI, $circular=false) { |
|
| 134 | + $this->setValueFunction($index, function($img) use($size, $circular){ |
|
| 135 | + $image=new HtmlImage($this->_getFieldIdentifier("image"), $img); $image->setSize($size); if ($circular)$image->setCircular(); |
|
| 136 | 136 | return $image; |
| 137 | 137 | }); |
| 138 | 138 | return $this; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - public function fieldAsAvatar($index,$attributes=NULL){ |
|
| 142 | - return $this->_fieldAs(function($id,$name,$value){ |
|
| 143 | - $img=new HtmlImage($id,$value); |
|
| 141 | + public function fieldAsAvatar($index, $attributes=NULL) { |
|
| 142 | + return $this->_fieldAs(function($id, $name, $value) { |
|
| 143 | + $img=new HtmlImage($id, $value); |
|
| 144 | 144 | $img->asAvatar(); |
| 145 | 145 | return $img; |
| 146 | - }, $index,$attributes,"avatar"); |
|
| 146 | + }, $index, $attributes, "avatar"); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - public function fieldAsRadio($index,$attributes=NULL){ |
|
| 150 | - return $this->_fieldAs(function($id,$name,$value){ |
|
| 151 | - $input= new HtmlRadio($id,$name,$value,$value); |
|
| 149 | + public function fieldAsRadio($index, $attributes=NULL) { |
|
| 150 | + return $this->_fieldAs(function($id, $name, $value) { |
|
| 151 | + $input=new HtmlRadio($id, $name, $value, $value); |
|
| 152 | 152 | return $input; |
| 153 | - }, $index,$attributes,"radio"); |
|
| 153 | + }, $index, $attributes, "radio"); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - public function fieldAsRadios($index,$elements=[],$attributes=NULL){ |
|
| 157 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($elements){ |
|
| 158 | - return HtmlFormFields::radios($name,$elements,$caption,$value); |
|
| 159 | - }, $index,$attributes,"radios"); |
|
| 156 | + public function fieldAsRadios($index, $elements=[], $attributes=NULL) { |
|
| 157 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements){ |
|
| 158 | + return HtmlFormFields::radios($name, $elements, $caption, $value); |
|
| 159 | + }, $index, $attributes, "radios"); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - public function fieldAsInput($index,$attributes=NULL){ |
|
| 163 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes){ |
|
| 164 | - $input= new HtmlFormInput($id,$caption,"text",$value); |
|
| 162 | + public function fieldAsInput($index, $attributes=NULL) { |
|
| 163 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes){ |
|
| 164 | + $input=new HtmlFormInput($id, $caption, "text", $value); |
|
| 165 | 165 | return $this->_prepareFormFields($input, $name, $attributes); |
| 166 | - }, $index,$attributes,"input"); |
|
| 166 | + }, $index, $attributes, "input"); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - public function fieldAsTextarea($index,$attributes=NULL){ |
|
| 170 | - return $this->_fieldAs(function($id,$name,$value,$caption){ |
|
| 171 | - $textarea=new HtmlFormTextarea($id,$caption,$value); |
|
| 169 | + public function fieldAsTextarea($index, $attributes=NULL) { |
|
| 170 | + return $this->_fieldAs(function($id, $name, $value, $caption) { |
|
| 171 | + $textarea=new HtmlFormTextarea($id, $caption, $value); |
|
| 172 | 172 | $textarea->setName($name); |
| 173 | 173 | return $textarea; |
| 174 | - }, $index,$attributes,"textarea"); |
|
| 174 | + }, $index, $attributes, "textarea"); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - public function fieldAsHidden($index,$attributes=NULL){ |
|
| 178 | - if(!\is_array($attributes)){ |
|
| 177 | + public function fieldAsHidden($index, $attributes=NULL) { |
|
| 178 | + if (!\is_array($attributes)) { |
|
| 179 | 179 | $attributes=[]; |
| 180 | 180 | } |
| 181 | 181 | $attributes["imputType"]="hidden"; |
| 182 | - return $this->fieldAsInput($index,$attributes); |
|
| 182 | + return $this->fieldAsInput($index, $attributes); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - public function fieldAsCheckbox($index,$attributes=NULL){ |
|
| 186 | - return $this->_fieldAs(function($id,$name,$value,$caption){ |
|
| 187 | - $input=new HtmlFormCheckbox($id,$caption,$this->_instanceViewer->getIdentifier()); |
|
| 185 | + public function fieldAsCheckbox($index, $attributes=NULL) { |
|
| 186 | + return $this->_fieldAs(function($id, $name, $value, $caption) { |
|
| 187 | + $input=new HtmlFormCheckbox($id, $caption, $this->_instanceViewer->getIdentifier()); |
|
| 188 | 188 | $input->setChecked(JString::isBooleanTrue($value)); |
| 189 | 189 | $input->setName($name); |
| 190 | 190 | return $input; |
| 191 | - }, $index,$attributes,"ck"); |
|
| 191 | + }, $index, $attributes, "ck"); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - public function fieldAsDropDown($index,$elements=[],$multiple=false,$attributes=NULL){ |
|
| 195 | - return $this->_fieldAs(function($id,$name,$value,$caption) use($elements,$multiple){ |
|
| 196 | - $dd=new HtmlFormDropdown($id,$elements,$caption,$value); |
|
| 197 | - $dd->asSelect($name,$multiple); |
|
| 194 | + public function fieldAsDropDown($index, $elements=[], $multiple=false, $attributes=NULL) { |
|
| 195 | + return $this->_fieldAs(function($id, $name, $value, $caption) use($elements, $multiple){ |
|
| 196 | + $dd=new HtmlFormDropdown($id, $elements, $caption, $value); |
|
| 197 | + $dd->asSelect($name, $multiple); |
|
| 198 | 198 | return $dd; |
| 199 | - }, $index,$attributes,"dd"); |
|
| 199 | + }, $index, $attributes, "dd"); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - public function fieldAsMessage($index,$attributes=NULL){ |
|
| 203 | - return $this->_fieldAs(function($id,$name,$value,$caption){ |
|
| 204 | - $mess= new HtmlMessage("message-".$id,$caption); |
|
| 202 | + public function fieldAsMessage($index, $attributes=NULL) { |
|
| 203 | + return $this->_fieldAs(function($id, $name, $value, $caption) { |
|
| 204 | + $mess=new HtmlMessage("message-".$id, $caption); |
|
| 205 | 205 | $mess->addHeader($value); |
| 206 | 206 | return $mess; |
| 207 | - }, $index,$attributes,"message"); |
|
| 207 | + }, $index, $attributes, "message"); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - public function fieldAsLink($index,$attributes=NULL){ |
|
| 211 | - return $this->_fieldAs(function($id,$name,$value,$caption){ |
|
| 212 | - $lnk= new HtmlLink("message-".$id,"#",$caption); |
|
| 210 | + public function fieldAsLink($index, $attributes=NULL) { |
|
| 211 | + return $this->_fieldAs(function($id, $name, $value, $caption) { |
|
| 212 | + $lnk=new HtmlLink("message-".$id, "#", $caption); |
|
| 213 | 213 | return $lnk; |
| 214 | - }, $index,$attributes,"link"); |
|
| 214 | + }, $index, $attributes, "link"); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /**Change fields type |
| 218 | 218 | * @param array $types an array or associative array $type=>$attributes |
| 219 | 219 | */ |
| 220 | - public function fieldsAs(array $types){ |
|
| 220 | + public function fieldsAs(array $types) { |
|
| 221 | 221 | $i=0; |
| 222 | - if(JArray::isAssociative($types)){ |
|
| 223 | - foreach ($types as $type=>$attributes){ |
|
| 224 | - if(\is_int($type)) |
|
| 225 | - $this->fieldAs($i++,$attributes,[]); |
|
| 226 | - else{ |
|
| 227 | - $type=preg_replace('/\d/', '', $type ); |
|
| 228 | - $this->fieldAs($i++,$type,$attributes); |
|
| 222 | + if (JArray::isAssociative($types)) { |
|
| 223 | + foreach ($types as $type=>$attributes) { |
|
| 224 | + if (\is_int($type)) |
|
| 225 | + $this->fieldAs($i++, $attributes, []); |
|
| 226 | + else { |
|
| 227 | + $type=preg_replace('/\d/', '', $type); |
|
| 228 | + $this->fieldAs($i++, $type, $attributes); |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | - }else{ |
|
| 232 | - foreach ($types as $type){ |
|
| 233 | - $this->fieldAs($i++,$type); |
|
| 231 | + } else { |
|
| 232 | + foreach ($types as $type) { |
|
| 233 | + $this->fieldAs($i++, $type); |
|
| 234 | 234 | } |
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - public function fieldAs($index,$type,$attributes=NULL){ |
|
| 238 | + public function fieldAs($index, $type, $attributes=NULL) { |
|
| 239 | 239 | $method="fieldAs".\ucfirst($type); |
| 240 | - if(\method_exists($this, $method)){ |
|
| 241 | - if(!\is_array($attributes)){ |
|
| 240 | + if (\method_exists($this, $method)) { |
|
| 241 | + if (!\is_array($attributes)) { |
|
| 242 | 242 | $attributes=[$index]; |
| 243 | - }else{ |
|
| 243 | + } else { |
|
| 244 | 244 | \array_unshift($attributes, $index); |
| 245 | 245 | } |
| 246 | - \call_user_func_array([$this,$method], $attributes); |
|
| 246 | + \call_user_func_array([$this, $method], $attributes); |
|
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){ |
|
| 251 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$attributes){ |
|
| 252 | - $button=new HtmlButton($id,$caption,$cssStyle); |
|
| 253 | - $this->_buttonAsSubmit($button,"click",$url,$responseElement,@$attributes["ajax"]); |
|
| 250 | + public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) { |
|
| 251 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes){ |
|
| 252 | + $button=new HtmlButton($id, $caption, $cssStyle); |
|
| 253 | + $this->_buttonAsSubmit($button, "click", $url, $responseElement, @$attributes["ajax"]); |
|
| 254 | 254 | return $button; |
| 255 | - }, $index,$attributes,"submit"); |
|
| 255 | + }, $index, $attributes, "submit"); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - public function fieldAsButton($index,$cssStyle=NULL,$attributes=NULL){ |
|
| 259 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($cssStyle){ |
|
| 260 | - $button=new HtmlButton($id,$value,$cssStyle); |
|
| 258 | + public function fieldAsButton($index, $cssStyle=NULL, $attributes=NULL) { |
|
| 259 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle){ |
|
| 260 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
| 261 | 261 | return $button; |
| 262 | - }, $index,$attributes,"button"); |
|
| 262 | + }, $index, $attributes, "button"); |
|
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | \ No newline at end of file |