@@ -19,64 +19,64 @@ discard block |
||
19 | 19 | class DataForm extends Widget { |
20 | 20 | |
21 | 21 | public function __construct($identifier, $modelInstance=NULL) { |
22 | - parent::__construct($identifier, null,$modelInstance); |
|
22 | + parent::__construct($identifier, null, $modelInstance); |
|
23 | 23 | $this->_form=new HtmlForm($identifier); |
24 | 24 | $this->_init(new FormInstanceViewer($identifier), "form", $this->_form, true); |
25 | 25 | } |
26 | 26 | |
27 | - protected function _getFieldIdentifier($prefix,$name=""){ |
|
27 | + protected function _getFieldIdentifier($prefix, $name="") { |
|
28 | 28 | return $this->identifier."-{$name}-".$this->_instanceViewer->getIdentifier(); |
29 | 29 | } |
30 | 30 | |
31 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
32 | - if(!$this->_generated){ |
|
31 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
32 | + if (!$this->_generated) { |
|
33 | 33 | $this->_instanceViewer->setInstance($this->_modelInstance); |
34 | 34 | |
35 | 35 | $form=$this->content["form"]; |
36 | 36 | $this->_generateContent($form); |
37 | 37 | |
38 | - if(isset($this->_toolbar)){ |
|
38 | + if (isset($this->_toolbar)) { |
|
39 | 39 | $this->_setToolbarPosition($form); |
40 | 40 | } |
41 | - $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"form",PositionInTable::AFTERTABLE]); |
|
41 | + $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "form", PositionInTable::AFTERTABLE]); |
|
42 | 42 | $this->_generated=true; |
43 | 43 | } |
44 | - return parent::compile($js,$view); |
|
44 | + return parent::compile($js, $view); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
48 | 48 | * @param HtmlForm $form |
49 | 49 | */ |
50 | - protected function _generateContent($form){ |
|
51 | - $values= $this->_instanceViewer->getValues(); |
|
50 | + protected function _generateContent($form) { |
|
51 | + $values=$this->_instanceViewer->getValues(); |
|
52 | 52 | $count=$this->_instanceViewer->count(); |
53 | 53 | $separators=$this->_instanceViewer->getSeparators(); |
54 | 54 | $headers=$this->_instanceViewer->getHeaders(); |
55 | 55 | $wrappers=$this->_instanceViewer->getWrappers(); |
56 | 56 | \sort($separators); |
57 | 57 | $size=\sizeof($separators); |
58 | - if($size===1){ |
|
59 | - foreach ($values as $v){ |
|
58 | + if ($size===1) { |
|
59 | + foreach ($values as $v) { |
|
60 | 60 | $form->addField($v); |
61 | 61 | } |
62 | - }else{ |
|
62 | + } else { |
|
63 | 63 | $separators[]=$count; |
64 | - for($i=0;$i<$size;$i++){ |
|
64 | + for ($i=0; $i<$size; $i++) { |
|
65 | 65 | $wrapper=null; |
66 | - $fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]); |
|
67 | - if(isset($headers[$separators[$i]+1])) |
|
68 | - $form->addHeader($headers[$separators[$i]+1],4,true); |
|
69 | - if(isset($wrappers[$separators[$i]+1])){ |
|
66 | + $fields=\array_slice($values, $separators[$i]+1, $separators[$i+1]-$separators[$i]); |
|
67 | + if (isset($headers[$separators[$i]+1])) |
|
68 | + $form->addHeader($headers[$separators[$i]+1], 4, true); |
|
69 | + if (isset($wrappers[$separators[$i]+1])) { |
|
70 | 70 | $wrapper=$wrappers[$separators[$i]+1]; |
71 | 71 | } |
72 | 72 | //TODO check why $fields is empty |
73 | - if(\sizeof($fields)===1){ |
|
73 | + if (\sizeof($fields)===1) { |
|
74 | 74 | $added=$form->addField($fields[0]); |
75 | - }elseif(\sizeof($fields)>1){ |
|
75 | + }elseif (\sizeof($fields)>1) { |
|
76 | 76 | $added=$form->addFields($fields); |
77 | 77 | } |
78 | - if(isset($wrapper)) |
|
79 | - $added->wrap($wrapper[0],$wrapper[1]); |
|
78 | + if (isset($wrapper)) |
|
79 | + $added->wrap($wrapper[0], $wrapper[1]); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | } |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | * {@inheritDoc} |
86 | 86 | * @see \Ajax\common\Widget::getForm() |
87 | 87 | */ |
88 | - public function getForm(){ |
|
88 | + public function getForm() { |
|
89 | 89 | return $this->content["form"]; |
90 | 90 | } |
91 | 91 | |
92 | - public function addSeparatorAfter($fieldNum){ |
|
92 | + public function addSeparatorAfter($fieldNum) { |
|
93 | 93 | $fieldNum=$this->_getIndex($fieldNum); |
94 | 94 | $this->_instanceViewer->addSeparatorAfter($fieldNum); |
95 | 95 | return $this; |
@@ -104,12 +104,12 @@ discard block |
||
104 | 104 | return $this; |
105 | 105 | } |
106 | 106 | |
107 | - public function fieldAsReset($index,$cssStyle=NULL,$attributes=NULL){ |
|
108 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($cssStyle){ |
|
109 | - $button=new HtmlButton($id,$value,$cssStyle); |
|
107 | + public function fieldAsReset($index, $cssStyle=NULL, $attributes=NULL) { |
|
108 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle){ |
|
109 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
110 | 110 | $button->setProperty("type", "reset"); |
111 | 111 | return $button; |
112 | - }, $index,$attributes); |
|
112 | + }, $index, $attributes); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -128,19 +128,19 @@ discard block |
||
128 | 128 | $this->content[$this->_toolbarPosition]=$this->_toolbar; |
129 | 129 | } |
130 | 130 | |
131 | - public function addDividerBefore($index,$title){ |
|
131 | + public function addDividerBefore($index, $title) { |
|
132 | 132 | $index=$this->_getIndex($index); |
133 | 133 | $this->_instanceViewer->addHeaderDividerBefore($index, $title); |
134 | 134 | return $this; |
135 | 135 | } |
136 | 136 | |
137 | - public function addWrapper($index,$contentBefore,$contentAfter=null){ |
|
137 | + public function addWrapper($index, $contentBefore, $contentAfter=null) { |
|
138 | 138 | $index=$this->_getIndex($index); |
139 | - $this->_instanceViewer->addWrapper($index, $contentBefore,$contentAfter); |
|
139 | + $this->_instanceViewer->addWrapper($index, $contentBefore, $contentAfter); |
|
140 | 140 | return $this; |
141 | 141 | } |
142 | 142 | |
143 | - public function run(JsUtils $js){ |
|
143 | + public function run(JsUtils $js) { |
|
144 | 144 | return parent::run($js); |
145 | 145 | } |
146 | 146 | } |
147 | 147 | \ No newline at end of file |
@@ -10,50 +10,50 @@ |
||
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 FormLogin($identifier,$modelInstance, |
|
23 | - ["message","login","password","remember","forget","submit","error"], |
|
24 | - ["message"=>[["icon"=>"sign in"]],"input0"=>[["rules"=>"empty"]],"input1"=>[["inputType"=>"password","rules"=>"empty"]],"checkbox","link","submit"=>["green fluid"],"message2"=>[["error"=>true]]], |
|
25 | - ["Connection","login","password","remember","forget","submit","error"], |
|
26 | - ["Please enter login and password to connect","Login","Password","Remember me.","Forgot your password?","Connection"], |
|
27 | - [0,2,4,5,6]); |
|
21 | + public static function regular($identifier, $modelInstance=null) { |
|
22 | + return new FormLogin($identifier, $modelInstance, |
|
23 | + ["message", "login", "password", "remember", "forget", "submit", "error"], |
|
24 | + ["message"=>[["icon"=>"sign in"]], "input0"=>[["rules"=>"empty"]], "input1"=>[["inputType"=>"password", "rules"=>"empty"]], "checkbox", "link", "submit"=>["green fluid"], "message2"=>[["error"=>true]]], |
|
25 | + ["Connection", "login", "password", "remember", "forget", "submit", "error"], |
|
26 | + ["Please enter login and password to connect", "Login", "Password", "Remember me.", "Forgot your password?", "Connection"], |
|
27 | + [0, 2, 4, 5, 6]); |
|
28 | 28 | } |
29 | 29 | |
30 | - public static function smallInline($identifier,$modelInstance=null){ |
|
31 | - $result=new FormLogin($identifier,$modelInstance, |
|
32 | - ["login","password","submit"], |
|
33 | - ["input0"=>[["rules"=>"empty"]],"input1"=>[["inputType"=>"password","rules"=>"empty"]],"submit"=>["green basic"]], |
|
34 | - ["login","password","submit"], |
|
35 | - ["","","Connection"], |
|
30 | + public static function smallInline($identifier, $modelInstance=null) { |
|
31 | + $result=new FormLogin($identifier, $modelInstance, |
|
32 | + ["login", "password", "submit"], |
|
33 | + ["input0"=>[["rules"=>"empty"]], "input1"=>[["inputType"=>"password", "rules"=>"empty"]], "submit"=>["green basic"]], |
|
34 | + ["login", "password", "submit"], |
|
35 | + ["", "", "Connection"], |
|
36 | 36 | [2]); |
37 | 37 | $result->addDividerBefore(0, "Connection"); |
38 | 38 | return $result; |
39 | 39 | } |
40 | 40 | |
41 | - public static function small($identifier,$modelInstance=null){ |
|
42 | - $result=new FormLogin($identifier,$modelInstance, |
|
43 | - ["login","password","submit"], |
|
44 | - ["input0"=>[["rules"=>"empty"]],"input1"=>[["inputType"=>"password","rules"=>"empty"]],"submit"=>["green basic"]], |
|
45 | - ["login","password","submit"], |
|
46 | - ["Login","Password","Connection"], |
|
47 | - [1,2]); |
|
41 | + public static function small($identifier, $modelInstance=null) { |
|
42 | + $result=new FormLogin($identifier, $modelInstance, |
|
43 | + ["login", "password", "submit"], |
|
44 | + ["input0"=>[["rules"=>"empty"]], "input1"=>[["inputType"=>"password", "rules"=>"empty"]], "submit"=>["green basic"]], |
|
45 | + ["login", "password", "submit"], |
|
46 | + ["Login", "Password", "Connection"], |
|
47 | + [1, 2]); |
|
48 | 48 | $result->addDividerBefore(0, "Connection"); |
49 | 49 | return $result; |
50 | 50 | } |
51 | 51 | |
52 | - public static function attachedSegment($identifier,$modelInstance=null){ |
|
53 | - $result=self::regular($identifier,$modelInstance); |
|
54 | - $result->fieldAsMessage("message",["icon"=>"sign in","attached"=>true]); |
|
55 | - $result->addWrapper("message",null,"<div class='ui attached segment'>"); |
|
56 | - $result->addWrapper("error", null,"</div>"); |
|
52 | + public static function attachedSegment($identifier, $modelInstance=null) { |
|
53 | + $result=self::regular($identifier, $modelInstance); |
|
54 | + $result->fieldAsMessage("message", ["icon"=>"sign in", "attached"=>true]); |
|
55 | + $result->addWrapper("message", null, "<div class='ui attached segment'>"); |
|
56 | + $result->addWrapper("error", null, "</div>"); |
|
57 | 57 | return $result; |
58 | 58 | } |
59 | 59 | } |
60 | 60 | \ No newline at end of file |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | * @param array $instances |
17 | 17 | * @return DataTable |
18 | 18 | */ |
19 | - public function dataTable($identifier,$model, $instances){ |
|
20 | - return $this->addHtmlComponent(new DataTable($identifier,$model,$instances)); |
|
19 | + public function dataTable($identifier, $model, $instances) { |
|
20 | + return $this->addHtmlComponent(new DataTable($identifier, $model, $instances)); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | * @param object $instance |
26 | 26 | * @return DataElement |
27 | 27 | */ |
28 | - public function dataElement($identifier, $instance){ |
|
29 | - return $this->addHtmlComponent(new DataElement($identifier,$instance)); |
|
28 | + public function dataElement($identifier, $instance) { |
|
29 | + return $this->addHtmlComponent(new DataElement($identifier, $instance)); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -34,19 +34,19 @@ discard block |
||
34 | 34 | * @param object $instance |
35 | 35 | * @return DataForm |
36 | 36 | */ |
37 | - public function dataForm($identifier, $instance){ |
|
38 | - return $this->addHtmlComponent(new DataForm($identifier,$instance)); |
|
37 | + public function dataForm($identifier, $instance) { |
|
38 | + return $this->addHtmlComponent(new DataForm($identifier, $instance)); |
|
39 | 39 | } |
40 | 40 | |
41 | - public function defaultLogin($identifier,$instance=null){ |
|
42 | - return $this->addHtmlComponent(FormLogin::regular($identifier,$instance)); |
|
41 | + public function defaultLogin($identifier, $instance=null) { |
|
42 | + return $this->addHtmlComponent(FormLogin::regular($identifier, $instance)); |
|
43 | 43 | } |
44 | 44 | |
45 | - public function smallLogin($identifier,$instance=null){ |
|
46 | - return $this->addHtmlComponent(FormLogin::small($identifier,$instance)); |
|
45 | + public function smallLogin($identifier, $instance=null) { |
|
46 | + return $this->addHtmlComponent(FormLogin::small($identifier, $instance)); |
|
47 | 47 | } |
48 | 48 | |
49 | - public function segmentedLogin($identifier,$instance=null){ |
|
50 | - return $this->addHtmlComponent(FormLogin::attachedSegment($identifier,$instance)); |
|
49 | + public function segmentedLogin($identifier, $instance=null) { |
|
50 | + return $this->addHtmlComponent(FormLogin::attachedSegment($identifier, $instance)); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | \ No newline at end of file |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | * @version 1.3 |
16 | 16 | */ |
17 | 17 | abstract class BaseHtml extends BaseWidget { |
18 | - use BaseHtmlEventsTrait,BaseHtmlPropertiesTrait; |
|
18 | + use BaseHtmlEventsTrait, BaseHtmlPropertiesTrait; |
|
19 | 19 | protected $_template; |
20 | 20 | protected $tagName; |
21 | - protected $_wrapBefore=array (); |
|
22 | - protected $_wrapAfter=array (); |
|
21 | + protected $_wrapBefore=array(); |
|
22 | + protected $_wrapAfter=array(); |
|
23 | 23 | protected $_bsComponent; |
24 | 24 | |
25 | 25 | /** |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | */ |
30 | 30 | abstract public function run(JsUtils $js); |
31 | 31 | |
32 | - private function _callSetter($setter,$key,$value,&$array){ |
|
32 | + private function _callSetter($setter, $key, $value, &$array) { |
|
33 | 33 | $result=false; |
34 | 34 | if (method_exists($this, $setter) && !JString::startswith($key, "_")) { |
35 | 35 | try { |
36 | 36 | $this->$setter($value); |
37 | 37 | unset($array[$key]); |
38 | 38 | $result=true; |
39 | - } catch ( \Exception $e ) { |
|
39 | + }catch (\Exception $e) { |
|
40 | 40 | $result=false; |
41 | 41 | } |
42 | 42 | } |
@@ -44,17 +44,17 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | protected function getTemplate(JsUtils $js=NULL) { |
47 | - return PropertyWrapper::wrap($this->_wrapBefore, $js) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
47 | + return PropertyWrapper::wrap($this->_wrapBefore, $js).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | protected function ctrl($name, $value, $typeCtrl) { |
51 | 51 | if (\is_array($typeCtrl)) { |
52 | - if (array_search($value, $typeCtrl) === false) { |
|
53 | - throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}"); |
|
52 | + if (array_search($value, $typeCtrl)===false) { |
|
53 | + throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
54 | 54 | } |
55 | 55 | } else { |
56 | 56 | if (!$typeCtrl($value)) { |
57 | - throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name); |
|
57 | + throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | return true; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | |
65 | 65 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
66 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
66 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
67 | 67 | return $name=$value; |
68 | 68 | } |
69 | 69 | return $this; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") { |
73 | 73 | if (\is_array($typeCtrl)) { |
74 | 74 | $this->removeOldValues($name, $typeCtrl); |
75 | - $name.=$separator . $value; |
|
75 | + $name.=$separator.$value; |
|
76 | 76 | } |
77 | 77 | return $this; |
78 | 78 | } |
@@ -80,17 +80,17 @@ discard block |
||
80 | 80 | |
81 | 81 | |
82 | 82 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
83 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
83 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
84 | 84 | if (\is_array($typeCtrl)) { |
85 | 85 | $this->removeOldValues($name, $typeCtrl); |
86 | 86 | } |
87 | - $name.=$separator . $value; |
|
87 | + $name.=$separator.$value; |
|
88 | 88 | } |
89 | 89 | return $this; |
90 | 90 | } |
91 | 91 | |
92 | 92 | protected function addToMember(&$name, $value, $separator=" ") { |
93 | - $name=str_ireplace($value, "", $name) . $separator . $value; |
|
93 | + $name=str_ireplace($value, "", $name).$separator.$value; |
|
94 | 94 | return $this; |
95 | 95 | } |
96 | 96 | |
@@ -101,17 +101,17 @@ discard block |
||
101 | 101 | $oldValue=trim($oldValue); |
102 | 102 | } |
103 | 103 | |
104 | - protected function _getElementBy($callback,$elements){ |
|
104 | + protected function _getElementBy($callback, $elements) { |
|
105 | 105 | if (\is_array($elements)) { |
106 | 106 | $flag=false; |
107 | 107 | $index=0; |
108 | - while ( !$flag && $index < sizeof($elements) ) { |
|
108 | + while (!$flag && $index<sizeof($elements)) { |
|
109 | 109 | if ($elements[$index] instanceof BaseHtml) |
110 | 110 | $flag=($callback($elements[$index])); |
111 | 111 | $index++; |
112 | 112 | } |
113 | - if ($flag === true) |
|
114 | - return $elements[$index - 1]; |
|
113 | + if ($flag===true) |
|
114 | + return $elements[$index-1]; |
|
115 | 115 | } elseif ($elements instanceof BaseHtml) { |
116 | 116 | if ($callback($elements)) |
117 | 117 | return $elements; |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | public function fromArray($array) { |
142 | - foreach ( $this as $key => $value ) { |
|
143 | - if(array_key_exists($key, $array)===true) |
|
144 | - $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
142 | + foreach ($this as $key => $value) { |
|
143 | + if (array_key_exists($key, $array)===true) |
|
144 | + $this->_callSetter("set".ucfirst($key), $key, $array[$key], $array); |
|
145 | 145 | } |
146 | - foreach ( $array as $key => $value ) { |
|
147 | - if($this->_callSetter($key, $key, $value, $array)===false){ |
|
148 | - $this->_callSetter("set" . ucfirst($key), $key, $value, $array); |
|
146 | + foreach ($array as $key => $value) { |
|
147 | + if ($this->_callSetter($key, $key, $value, $array)===false) { |
|
148 | + $this->_callSetter("set".ucfirst($key), $key, $value, $array); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | return $array; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | public function fromDatabaseObjects($objects, $function) { |
155 | 155 | if (isset($objects)) { |
156 | - foreach ( $objects as $object ) { |
|
156 | + foreach ($objects as $object) { |
|
157 | 157 | $this->fromDatabaseObject($object, $function); |
158 | 158 | } |
159 | 159 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | |
175 | 175 | |
176 | 176 | public function getElementById($identifier, $elements) { |
177 | - return $this->_getElementBy(function($element) use ($identifier){return $element->getIdentifier()===$identifier;}, $elements); |
|
177 | + return $this->_getElementBy(function($element) use ($identifier){return $element->getIdentifier()===$identifier; }, $elements); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | public function getBsComponent() { |
@@ -188,19 +188,19 @@ discard block |
||
188 | 188 | |
189 | 189 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
190 | 190 | $result=$this->getTemplate($js); |
191 | - foreach ( $this as $key => $value ) { |
|
192 | - if (JString::startswith($key, "_") === false && $key !== "events") { |
|
191 | + foreach ($this as $key => $value) { |
|
192 | + if (JString::startswith($key, "_")===false && $key!=="events") { |
|
193 | 193 | if (\is_array($value)) { |
194 | 194 | $v=PropertyWrapper::wrap($value, $js); |
195 | 195 | } else { |
196 | 196 | $v=$value; |
197 | 197 | } |
198 | - $result=str_ireplace("%" . $key . "%", $v, $result); |
|
198 | + $result=str_ireplace("%".$key."%", $v, $result); |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | if (isset($js)===true) { |
202 | 202 | $this->run($js); |
203 | - if (isset($view) === true) { |
|
203 | + if (isset($view)===true) { |
|
204 | 204 | $js->addViewElement($this->_identifier, $result, $view); |
205 | 205 | } |
206 | 206 | } |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | use Ajax\semantic\html\base\constants\Direction; |
9 | 9 | |
10 | 10 | class HtmlSearch extends HtmlSemDoubleElement { |
11 | - private $_elements=array (); |
|
12 | - private $_searchFields=array ("title" ); |
|
11 | + private $_elements=array(); |
|
12 | + private $_searchFields=array("title"); |
|
13 | 13 | private $_local=false; |
14 | 14 | |
15 | 15 | public function __construct($identifier, $placeholder=NULL, $icon=NULL) { |
16 | - parent::__construct("search-" . $identifier, "div", "ui search", array ()); |
|
16 | + parent::__construct("search-".$identifier, "div", "ui search", array()); |
|
17 | 17 | $this->_identifier=$identifier; |
18 | 18 | $this->createField($placeholder, $icon); |
19 | 19 | $this->createResult(); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | private function createResult() { |
36 | - $this->content["result"]=new HtmlSemDoubleElement("results-" . $this->identifier, "div", "results"); |
|
36 | + $this->content["result"]=new HtmlSemDoubleElement("results-".$this->identifier, "div", "results"); |
|
37 | 37 | return $this->content["result"]; |
38 | 38 | } |
39 | 39 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | public function setUrl($url) { |
53 | - $this->_params["apiSettings"]="%{url: %quote%" . $url . "%quote%}%"; |
|
53 | + $this->_params["apiSettings"]="%{url: %quote%".$url."%quote%}%"; |
|
54 | 54 | return $this; |
55 | 55 | } |
56 | 56 | |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | public function run(JsUtils $js) { |
76 | - $this->_params["onSelect"]='%function(result,response){$(%quote%#' . $this->identifier . '%quote%).trigger(%quote%onSelect%quote%, {%quote%result%quote%: result, %quote%response%quote%:response} );}%'; |
|
76 | + $this->_params["onSelect"]='%function(result,response){$(%quote%#'.$this->identifier.'%quote%).trigger(%quote%onSelect%quote%, {%quote%result%quote%: result, %quote%response%quote%:response} );}%'; |
|
77 | 77 | $searchFields=\json_encode($this->_searchFields); |
78 | 78 | $searchFields=str_ireplace("\"", "%quote%", $searchFields); |
79 | - $this->_params["searchFields"]="%" . $searchFields . "%"; |
|
80 | - if ($this->_local === true) { |
|
79 | + $this->_params["searchFields"]="%".$searchFields."%"; |
|
80 | + if ($this->_local===true) { |
|
81 | 81 | $this->_params["source"]="%content%"; |
82 | - $this->addEvent("beforeExecute", "var content=" . $this->resultsToJson() . ";"); |
|
82 | + $this->addEvent("beforeExecute", "var content=".$this->resultsToJson().";"); |
|
83 | 83 | } |
84 | - if (isset($this->_bsComponent) === false) { |
|
85 | - $this->_bsComponent=$js->semantic()->search("#" . $this->identifier, $this->_params); |
|
84 | + if (isset($this->_bsComponent)===false) { |
|
85 | + $this->_bsComponent=$js->semantic()->search("#".$this->identifier, $this->_params); |
|
86 | 86 | } |
87 | 87 | $this->addEventsOnRun($js); |
88 | 88 | return $this->_bsComponent; |
@@ -15,7 +15,7 @@ |
||
15 | 15 | class HtmlFormCheckbox extends HtmlFormField { |
16 | 16 | use CheckboxTrait; |
17 | 17 | public function __construct($identifier, $label=NULL, $value=NULL, $type=NULL) { |
18 | - parent::__construct("field-".$identifier, new HtmlCheckbox($identifier,$label,$value,$type)); |
|
18 | + parent::__construct("field-".$identifier, new HtmlCheckbox($identifier, $label, $value, $type)); |
|
19 | 19 | $this->_identifier=$identifier; |
20 | 20 | } |
21 | 21 |
@@ -8,17 +8,17 @@ |
||
8 | 8 | class HtmlFormInput extends HtmlFormField { |
9 | 9 | use TextFieldsTrait; |
10 | 10 | |
11 | - public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
|
12 | - if(!isset($placeholder) && $type==="text") |
|
11 | + public function __construct($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
12 | + if (!isset($placeholder) && $type==="text") |
|
13 | 13 | $placeholder=$label; |
14 | - parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
|
14 | + parent::__construct("field-".$identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label); |
|
15 | 15 | $this->_identifier=$identifier; |
16 | 16 | } |
17 | 17 | |
18 | - public function getDataField(){ |
|
19 | - $field= $this->getField(); |
|
18 | + public function getDataField() { |
|
19 | + $field=$this->getField(); |
|
20 | 20 | //TODO check getField |
21 | - if($field instanceof HtmlInput) |
|
21 | + if ($field instanceof HtmlInput) |
|
22 | 22 | $field=$field->getDataField(); |
23 | 23 | return $field; |
24 | 24 | } |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | class HtmlFormTextarea extends HtmlFormField { |
10 | 10 | use TextFieldsTrait; |
11 | 11 | |
12 | - public function __construct($identifier, $label=NULL,$value=NULL,$placeholder=NULL,$rows=NULL) { |
|
13 | - if(!isset($placeholder)) |
|
12 | + public function __construct($identifier, $label=NULL, $value=NULL, $placeholder=NULL, $rows=NULL) { |
|
13 | + if (!isset($placeholder)) |
|
14 | 14 | $placeholder=$label; |
15 | - parent::__construct("field-".$identifier, new HtmlTextarea($identifier,$value,$placeholder,$rows), $label); |
|
15 | + parent::__construct("field-".$identifier, new HtmlTextarea($identifier, $value, $placeholder, $rows), $label); |
|
16 | 16 | $this->_identifier=$identifier; |
17 | 17 | } |
18 | 18 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * Defines the textarea row count |
21 | 21 | * @param int $count |
22 | 22 | */ |
23 | - public function setRows($count){ |
|
23 | + public function setRows($count) { |
|
24 | 24 | $this->getField()->setRows($count); |
25 | 25 | } |
26 | 26 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | return $this->content["field"]; |
29 | 29 | } |
30 | 30 | |
31 | - public function setName($name){ |
|
32 | - $this->getDataField()->setProperty("name",$name); |
|
31 | + public function setName($name) { |
|
32 | + $this->getDataField()->setProperty("name", $name); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | \ No newline at end of file |
@@ -7,26 +7,26 @@ |
||
7 | 7 | |
8 | 8 | class HtmlFormDropdown extends HtmlFormField { |
9 | 9 | |
10 | - public function __construct($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false,$associative=true) { |
|
11 | - parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier,$value,$items,$associative))->asSelect($identifier,$multiple), $label); |
|
10 | + public function __construct($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false, $associative=true) { |
|
11 | + parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier, $value, $items, $associative))->asSelect($identifier, $multiple), $label); |
|
12 | 12 | $this->_identifier=$identifier; |
13 | 13 | } |
14 | 14 | |
15 | - public function setItems($items){ |
|
15 | + public function setItems($items) { |
|
16 | 16 | return $this->getField()->setItems($items); |
17 | 17 | } |
18 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
19 | - return $this->getField()->addItem($item,$value,$image); |
|
18 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
19 | + return $this->getField()->addItem($item, $value, $image); |
|
20 | 20 | } |
21 | - public static function multipleDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$associative=true){ |
|
22 | - return new HtmlFormDropdown($identifier,$items,$label,$value,true,$associative); |
|
21 | + public static function multipleDropdown($identifier, $items=array(), $label=NULL, $value=NULL, $associative=true) { |
|
22 | + return new HtmlFormDropdown($identifier, $items, $label, $value, true, $associative); |
|
23 | 23 | } |
24 | 24 | |
25 | - public function getDataField(){ |
|
25 | + public function getDataField() { |
|
26 | 26 | return $this->getField()->getInput(); |
27 | 27 | } |
28 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
29 | - $this->getField()->asSelect($name,$multiple,$selection); |
|
28 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
29 | + $this->getField()->asSelect($name, $multiple, $selection); |
|
30 | 30 | return $this; |
31 | 31 | } |
32 | 32 | } |
33 | 33 | \ No newline at end of file |