@@ -72,6 +72,9 @@ discard block |
||
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | + /** |
|
76 | + * @param HtmlForm $form |
|
77 | + */ |
|
75 | 78 | protected function _generateFields($form,$values,$headers,$sepFirst,$wrappers){ |
76 | 79 | $wrapper=null; |
77 | 80 | if(isset($headers[$sepFirst+1])) |
@@ -136,12 +139,20 @@ discard block |
||
136 | 139 | $this->content[$this->_toolbarPosition]=$this->_toolbar; |
137 | 140 | } |
138 | 141 | |
142 | + /** |
|
143 | + * @param integer $index |
|
144 | + * @param string $title |
|
145 | + */ |
|
139 | 146 | public function addDividerBefore($index,$title){ |
140 | 147 | $index=$this->_getIndex($index); |
141 | 148 | $this->_instanceViewer->addHeaderDividerBefore($index, $title); |
142 | 149 | return $this; |
143 | 150 | } |
144 | 151 | |
152 | + /** |
|
153 | + * @param string $index |
|
154 | + * @param string $contentAfter |
|
155 | + */ |
|
145 | 156 | public function addWrapper($index,$contentBefore,$contentAfter=null){ |
146 | 157 | $index=$this->_getIndex($index); |
147 | 158 | $this->_instanceViewer->addWrapper($index, $contentBefore,$contentAfter); |
@@ -21,83 +21,83 @@ discard block |
||
21 | 21 | use BaseTrait; |
22 | 22 | |
23 | 23 | public function __construct($identifier, $modelInstance=NULL) { |
24 | - parent::__construct($identifier, null,$modelInstance); |
|
24 | + parent::__construct($identifier, null, $modelInstance); |
|
25 | 25 | $this->_form=new HtmlForm($identifier); |
26 | 26 | $this->_init(new FormInstanceViewer($identifier), "form", $this->_form, true); |
27 | 27 | } |
28 | 28 | |
29 | - protected function _getFieldIdentifier($prefix,$name=""){ |
|
29 | + protected function _getFieldIdentifier($prefix, $name="") { |
|
30 | 30 | return $this->identifier."-{$name}-".$this->_instanceViewer->getIdentifier(); |
31 | 31 | } |
32 | 32 | |
33 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
34 | - if(!$this->_generated){ |
|
33 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
34 | + if (!$this->_generated) { |
|
35 | 35 | $this->_instanceViewer->setInstance($this->_modelInstance); |
36 | 36 | |
37 | 37 | $form=$this->content["form"]; |
38 | 38 | $this->_generateContent($form); |
39 | 39 | |
40 | - if(isset($this->_toolbar)){ |
|
40 | + if (isset($this->_toolbar)) { |
|
41 | 41 | $this->_setToolbarPosition($form); |
42 | 42 | } |
43 | - $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"form",PositionInTable::AFTERTABLE]); |
|
43 | + $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "form", PositionInTable::AFTERTABLE]); |
|
44 | 44 | $this->_generated=true; |
45 | 45 | } |
46 | - return parent::compile($js,$view); |
|
46 | + return parent::compile($js, $view); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | 50 | * @param HtmlForm $form |
51 | 51 | */ |
52 | - protected function _generateContent($form){ |
|
53 | - $values= $this->_instanceViewer->getValues(); |
|
52 | + protected function _generateContent($form) { |
|
53 | + $values=$this->_instanceViewer->getValues(); |
|
54 | 54 | $count=$this->_instanceViewer->count(); |
55 | 55 | $separators=$this->_instanceViewer->getSeparators(); |
56 | 56 | $headers=$this->_instanceViewer->getHeaders(); |
57 | 57 | $wrappers=$this->_instanceViewer->getWrappers(); |
58 | 58 | \sort($separators); |
59 | 59 | $size=\sizeof($separators); |
60 | - if($size===1){ |
|
60 | + if ($size===1) { |
|
61 | 61 | $i=-1; |
62 | - foreach ($values as $v){ |
|
62 | + foreach ($values as $v) { |
|
63 | 63 | $this->_generateFields($form, [$v], $headers, $i, $wrappers); |
64 | 64 | $i++; |
65 | 65 | } |
66 | - }else{ |
|
66 | + } else { |
|
67 | 67 | $separators[]=$count; |
68 | - for($i=0;$i<$size;$i++){ |
|
69 | - $fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]); |
|
68 | + for ($i=0; $i<$size; $i++) { |
|
69 | + $fields=\array_slice($values, $separators[$i]+1, $separators[$i+1]-$separators[$i]); |
|
70 | 70 | $this->_generateFields($form, $fields, $headers, $separators[$i], $wrappers); |
71 | 71 | } |
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | - protected function _generateFields($form,$values,$headers,$sepFirst,$wrappers){ |
|
75 | + protected function _generateFields($form, $values, $headers, $sepFirst, $wrappers) { |
|
76 | 76 | $wrapper=null; |
77 | - if(isset($headers[$sepFirst+1])) |
|
78 | - $form->addHeader($headers[$sepFirst+1],4,true); |
|
79 | - if(isset($wrappers[$sepFirst+1])){ |
|
77 | + if (isset($headers[$sepFirst+1])) |
|
78 | + $form->addHeader($headers[$sepFirst+1], 4, true); |
|
79 | + if (isset($wrappers[$sepFirst+1])) { |
|
80 | 80 | $wrapper=$wrappers[$sepFirst+1]; |
81 | 81 | } |
82 | - if(\sizeof($values)===1){ |
|
82 | + if (\sizeof($values)===1) { |
|
83 | 83 | $added=$form->addField($values[0]); |
84 | - }elseif(\sizeof($values)>1){ |
|
84 | + }elseif (\sizeof($values)>1) { |
|
85 | 85 | $added=$form->addFields($values); |
86 | - }else |
|
86 | + } else |
|
87 | 87 | return; |
88 | - if(isset($wrapper)){ |
|
89 | - $added->wrap($wrapper[0],$wrapper[1]); |
|
88 | + if (isset($wrapper)) { |
|
89 | + $added->wrap($wrapper[0], $wrapper[1]); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
94 | 94 | * @return HtmlForm |
95 | 95 | */ |
96 | - public function getForm(){ |
|
96 | + public function getForm() { |
|
97 | 97 | return $this->content["form"]; |
98 | 98 | } |
99 | 99 | |
100 | - public function addSeparatorAfter($fieldNum){ |
|
100 | + public function addSeparatorAfter($fieldNum) { |
|
101 | 101 | $fieldNum=$this->_getIndex($fieldNum); |
102 | 102 | $this->_instanceViewer->addSeparatorAfter($fieldNum); |
103 | 103 | return $this; |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | return $this; |
113 | 113 | } |
114 | 114 | |
115 | - public function fieldAsReset($index,$cssStyle=NULL,$attributes=NULL){ |
|
116 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($cssStyle){ |
|
117 | - $button=new HtmlButton($id,$value,$cssStyle); |
|
115 | + public function fieldAsReset($index, $cssStyle=NULL, $attributes=NULL) { |
|
116 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle){ |
|
117 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
118 | 118 | $button->setProperty("type", "reset"); |
119 | 119 | return $button; |
120 | - }, $index,$attributes); |
|
120 | + }, $index, $attributes); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -136,19 +136,19 @@ discard block |
||
136 | 136 | $this->content[$this->_toolbarPosition]=$this->_toolbar; |
137 | 137 | } |
138 | 138 | |
139 | - public function addDividerBefore($index,$title){ |
|
139 | + public function addDividerBefore($index, $title) { |
|
140 | 140 | $index=$this->_getIndex($index); |
141 | 141 | $this->_instanceViewer->addHeaderDividerBefore($index, $title); |
142 | 142 | return $this; |
143 | 143 | } |
144 | 144 | |
145 | - public function addWrapper($index,$contentBefore,$contentAfter=null){ |
|
145 | + public function addWrapper($index, $contentBefore, $contentAfter=null) { |
|
146 | 146 | $index=$this->_getIndex($index); |
147 | - $this->_instanceViewer->addWrapper($index, $contentBefore,$contentAfter); |
|
147 | + $this->_instanceViewer->addWrapper($index, $contentBefore, $contentAfter); |
|
148 | 148 | return $this; |
149 | 149 | } |
150 | 150 | |
151 | - public function run(JsUtils $js){ |
|
151 | + public function run(JsUtils $js) { |
|
152 | 152 | return parent::run($js); |
153 | 153 | } |
154 | 154 | } |
155 | 155 | \ No newline at end of file |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $this->_generateFields($form, [$v], $headers, $i, $wrappers); |
64 | 64 | $i++; |
65 | 65 | } |
66 | - }else{ |
|
66 | + } else{ |
|
67 | 67 | $separators[]=$count; |
68 | 68 | for($i=0;$i<$size;$i++){ |
69 | 69 | $fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]); |
@@ -74,17 +74,19 @@ discard block |
||
74 | 74 | |
75 | 75 | protected function _generateFields($form,$values,$headers,$sepFirst,$wrappers){ |
76 | 76 | $wrapper=null; |
77 | - if(isset($headers[$sepFirst+1])) |
|
78 | - $form->addHeader($headers[$sepFirst+1],4,true); |
|
77 | + if(isset($headers[$sepFirst+1])) { |
|
78 | + $form->addHeader($headers[$sepFirst+1],4,true); |
|
79 | + } |
|
79 | 80 | if(isset($wrappers[$sepFirst+1])){ |
80 | 81 | $wrapper=$wrappers[$sepFirst+1]; |
81 | 82 | } |
82 | 83 | if(\sizeof($values)===1){ |
83 | 84 | $added=$form->addField($values[0]); |
84 | - }elseif(\sizeof($values)>1){ |
|
85 | + } elseif(\sizeof($values)>1){ |
|
85 | 86 | $added=$form->addFields($values); |
86 | - }else |
|
87 | - return; |
|
87 | + } else { |
|
88 | + return; |
|
89 | + } |
|
88 | 90 | if(isset($wrapper)){ |
89 | 91 | $added->wrap($wrapper[0],$wrapper[1]); |
90 | 92 | } |
@@ -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 | protected $_compiled=false; |
25 | 25 | |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | */ |
31 | 31 | abstract public function run(JsUtils $js); |
32 | 32 | |
33 | - private function _callSetter($setter,$key,$value,&$array){ |
|
33 | + private function _callSetter($setter, $key, $value, &$array) { |
|
34 | 34 | $result=false; |
35 | 35 | if (method_exists($this, $setter) && !JString::startswith($key, "_")) { |
36 | 36 | try { |
37 | 37 | $this->$setter($value); |
38 | 38 | unset($array[$key]); |
39 | 39 | $result=true; |
40 | - } catch ( \Exception $e ) { |
|
40 | + }catch (\Exception $e) { |
|
41 | 41 | $result=false; |
42 | 42 | } |
43 | 43 | } |
@@ -45,17 +45,17 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | protected function getTemplate(JsUtils $js=NULL) { |
48 | - return PropertyWrapper::wrap($this->_wrapBefore, $js) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
48 | + return PropertyWrapper::wrap($this->_wrapBefore, $js).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | protected function ctrl($name, $value, $typeCtrl) { |
52 | 52 | if (\is_array($typeCtrl)) { |
53 | - if (array_search($value, $typeCtrl) === false) { |
|
54 | - throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}"); |
|
53 | + if (array_search($value, $typeCtrl)===false) { |
|
54 | + throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
55 | 55 | } |
56 | 56 | } else { |
57 | 57 | if (!$typeCtrl($value)) { |
58 | - throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name); |
|
58 | + throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | return true; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | |
66 | 66 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
67 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
67 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
68 | 68 | return $name=$value; |
69 | 69 | } |
70 | 70 | return $this; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") { |
74 | 74 | if (\is_array($typeCtrl)) { |
75 | 75 | $this->removeOldValues($name, $typeCtrl); |
76 | - $name.=$separator . $value; |
|
76 | + $name.=$separator.$value; |
|
77 | 77 | } |
78 | 78 | return $this; |
79 | 79 | } |
@@ -81,17 +81,17 @@ discard block |
||
81 | 81 | |
82 | 82 | |
83 | 83 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
84 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
84 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
85 | 85 | if (\is_array($typeCtrl)) { |
86 | 86 | $this->removeOldValues($name, $typeCtrl); |
87 | 87 | } |
88 | - $name.=$separator . $value; |
|
88 | + $name.=$separator.$value; |
|
89 | 89 | } |
90 | 90 | return $this; |
91 | 91 | } |
92 | 92 | |
93 | 93 | protected function addToMember(&$name, $value, $separator=" ") { |
94 | - $name=str_ireplace($value, "", $name) . $separator . $value; |
|
94 | + $name=str_ireplace($value, "", $name).$separator.$value; |
|
95 | 95 | return $this; |
96 | 96 | } |
97 | 97 | |
@@ -102,18 +102,18 @@ discard block |
||
102 | 102 | $oldValue=trim($oldValue); |
103 | 103 | } |
104 | 104 | |
105 | - protected function _getElementBy($callback,$elements){ |
|
105 | + protected function _getElementBy($callback, $elements) { |
|
106 | 106 | if (\is_array($elements)) { |
107 | 107 | $elements=\array_values($elements); |
108 | 108 | $flag=false; |
109 | 109 | $index=0; |
110 | - while ( !$flag && $index < sizeof($elements) ) { |
|
110 | + while (!$flag && $index<sizeof($elements)) { |
|
111 | 111 | if ($elements[$index] instanceof BaseHtml) |
112 | 112 | $flag=($callback($elements[$index])); |
113 | 113 | $index++; |
114 | 114 | } |
115 | - if ($flag === true) |
|
116 | - return $elements[$index - 1]; |
|
115 | + if ($flag===true) |
|
116 | + return $elements[$index-1]; |
|
117 | 117 | } elseif ($elements instanceof BaseHtml) { |
118 | 118 | if ($callback($elements)) |
119 | 119 | return $elements; |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | public function fromArray($array) { |
144 | - foreach ( $this as $key => $value ) { |
|
145 | - if(array_key_exists($key, $array)===true) |
|
146 | - $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
144 | + foreach ($this as $key => $value) { |
|
145 | + if (array_key_exists($key, $array)===true) |
|
146 | + $this->_callSetter("set".ucfirst($key), $key, $array[$key], $array); |
|
147 | 147 | } |
148 | - foreach ( $array as $key => $value ) { |
|
149 | - if($this->_callSetter($key, $key, $value, $array)===false){ |
|
150 | - $this->_callSetter("set" . ucfirst($key), $key, $value, $array); |
|
148 | + foreach ($array as $key => $value) { |
|
149 | + if ($this->_callSetter($key, $key, $value, $array)===false) { |
|
150 | + $this->_callSetter("set".ucfirst($key), $key, $value, $array); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | return $array; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | public function fromDatabaseObjects($objects, $function) { |
157 | 157 | if (isset($objects)) { |
158 | - foreach ( $objects as $object ) { |
|
158 | + foreach ($objects as $object) { |
|
159 | 159 | $this->fromDatabaseObject($object, $function); |
160 | 160 | } |
161 | 161 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | |
178 | 178 | public function getElementById($identifier, $elements) { |
179 | - return $this->_getElementBy(function($element) use ($identifier){return $element->getIdentifier()===$identifier;}, $elements); |
|
179 | + return $this->_getElementBy(function($element) use ($identifier){return $element->getIdentifier()===$identifier; }, $elements); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | public function getBsComponent() { |
@@ -189,11 +189,11 @@ discard block |
||
189 | 189 | } |
190 | 190 | |
191 | 191 | protected function compile_once(JsUtils $js=NULL, &$view=NULL) { |
192 | - if(!$this->_compiled){ |
|
193 | - if(isset($js)){ |
|
192 | + if (!$this->_compiled) { |
|
193 | + if (isset($js)) { |
|
194 | 194 | $beforeCompile=$js->getParam("beforeCompileHtml"); |
195 | - if(\is_callable($beforeCompile)){ |
|
196 | - $beforeCompile($this,$js,$view); |
|
195 | + if (\is_callable($beforeCompile)) { |
|
196 | + $beforeCompile($this, $js, $view); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | $this->_compiled=true; |
@@ -201,21 +201,21 @@ discard block |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
204 | - $this->compile_once($js,$view); |
|
204 | + $this->compile_once($js, $view); |
|
205 | 205 | $result=$this->getTemplate($js); |
206 | - foreach ( $this as $key => $value ) { |
|
207 | - if (JString::startswith($key, "_") === false && $key !== "events") { |
|
206 | + foreach ($this as $key => $value) { |
|
207 | + if (JString::startswith($key, "_")===false && $key!=="events") { |
|
208 | 208 | if (\is_array($value)) { |
209 | 209 | $v=PropertyWrapper::wrap($value, $js); |
210 | 210 | } else { |
211 | 211 | $v=$value; |
212 | 212 | } |
213 | - $result=str_ireplace("%" . $key . "%", $v, $result); |
|
213 | + $result=str_ireplace("%".$key."%", $v, $result); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | if (isset($js)===true) { |
217 | 217 | $this->run($js); |
218 | - if (isset($view) === true) { |
|
218 | + if (isset($view)===true) { |
|
219 | 219 | $js->addViewElement($this->_identifier, $result, $view); |
220 | 220 | } |
221 | 221 | } |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | |
28 | 28 | public function __construct($identifier, $rowCount, $colCount) { |
29 | 29 | parent::__construct($identifier, "table", "ui table"); |
30 | - $this->content=array (); |
|
30 | + $this->content=array(); |
|
31 | 31 | $this->setRowCount($rowCount, $colCount); |
32 | - $this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ]; |
|
33 | - $this->_compileParts=["thead","tbody","tfoot"]; |
|
32 | + $this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT]; |
|
33 | + $this->_compileParts=["thead", "tbody", "tfoot"]; |
|
34 | 34 | $this->_afterCompileEvents=[]; |
35 | 35 | } |
36 | 36 | |
@@ -40,17 +40,17 @@ discard block |
||
40 | 40 | * @return HtmlTableContent |
41 | 41 | */ |
42 | 42 | public function getPart($key) { |
43 | - if (\array_key_exists($key, $this->content) === false) { |
|
43 | + if (\array_key_exists($key, $this->content)===false) { |
|
44 | 44 | $this->content[$key]=new HtmlTableContent("", $key); |
45 | - if ($key !== "tbody") { |
|
45 | + if ($key!=="tbody") { |
|
46 | 46 | $this->content[$key]->setRowCount(1, $this->_colCount); |
47 | 47 | } |
48 | 48 | } |
49 | 49 | return $this->content[$key]; |
50 | 50 | } |
51 | 51 | |
52 | - protected function _getFirstPart(){ |
|
53 | - if(isset($this->content["thead"])){ |
|
52 | + protected function _getFirstPart() { |
|
53 | + if (isset($this->content["thead"])) { |
|
54 | 54 | return $this->content["thead"]; |
55 | 55 | } |
56 | 56 | return $this->content["tbody"]; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @return boolean |
96 | 96 | */ |
97 | 97 | public function hasPart($key) { |
98 | - return \array_key_exists($key, $this->content) === true; |
|
98 | + return \array_key_exists($key, $this->content)===true; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | |
231 | 231 | private function colAlign($colIndex, $function) { |
232 | 232 | if (\is_array($colIndex)) { |
233 | - foreach ( $colIndex as $cIndex ) { |
|
233 | + foreach ($colIndex as $cIndex) { |
|
234 | 234 | $this->colAlign($cIndex, $function); |
235 | 235 | } |
236 | 236 | } else { |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * @see HtmlSemDoubleElement::compile() |
292 | 292 | */ |
293 | 293 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
294 | - if(\sizeof($this->_compileParts)<3){ |
|
294 | + if (\sizeof($this->_compileParts)<3) { |
|
295 | 295 | $this->_template="%content%"; |
296 | 296 | $this->refresh(); |
297 | 297 | } |
@@ -300,11 +300,11 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | protected function compile_once(JsUtils $js=NULL, &$view=NULL) { |
303 | - parent::compile_once($js,$view); |
|
303 | + parent::compile_once($js, $view); |
|
304 | 304 | if ($this->propertyContains("class", "sortable")) { |
305 | - $this->addEvent("execute", "$('#" . $this->identifier . "').tablesort().data('tablesort').sort($('th.default-sort'));"); |
|
305 | + $this->addEvent("execute", "$('#".$this->identifier."').tablesort().data('tablesort').sort($('th.default-sort'));"); |
|
306 | 306 | } |
307 | - if(isset($this->_activeRowSelector)){ |
|
307 | + if (isset($this->_activeRowSelector)) { |
|
308 | 308 | $this->_activeRowSelector->compile(); |
309 | 309 | } |
310 | 310 | } |
@@ -318,13 +318,13 @@ discard block |
||
318 | 318 | public function fromDatabaseObject($object, $function) { |
319 | 319 | $result=$function($object); |
320 | 320 | if (\is_array($result)) { |
321 | - $result= $this->addRow($function($object)); |
|
321 | + $result=$this->addRow($function($object)); |
|
322 | 322 | } else { |
323 | - $result= $this->getBody()->_addRow($result); |
|
323 | + $result=$this->getBody()->_addRow($result); |
|
324 | 324 | } |
325 | - if(isset($this->_afterCompileEvents["onNewRow"])){ |
|
326 | - if(\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
327 | - $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
325 | + if (isset($this->_afterCompileEvents["onNewRow"])) { |
|
326 | + if (\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
327 | + $this->_afterCompileEvents["onNewRow"]($result, $object); |
|
328 | 328 | } |
329 | 329 | return $result; |
330 | 330 | } |
@@ -339,14 +339,14 @@ discard block |
||
339 | 339 | return $this; |
340 | 340 | } |
341 | 341 | |
342 | - public function refresh(){ |
|
342 | + public function refresh() { |
|
343 | 343 | $this->_footer=$this->getFooter(); |
344 | 344 | $this->addEvent("execute", '$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");'); |
345 | 345 | } |
346 | 346 | |
347 | - public function run(JsUtils $js){ |
|
348 | - $result= parent::run($js); |
|
349 | - if(isset($this->_footer)) |
|
347 | + public function run(JsUtils $js) { |
|
348 | + $result=parent::run($js); |
|
349 | + if (isset($this->_footer)) |
|
350 | 350 | $this->_footer->run($js); |
351 | 351 | return $result; |
352 | 352 | } |
@@ -369,38 +369,38 @@ discard block |
||
369 | 369 | * @param boolean $multiple |
370 | 370 | * @return HtmlTable |
371 | 371 | */ |
372 | - public function setActiveRowSelector($class="active",$event="click",$multiple=false){ |
|
373 | - $this->_activeRowSelector=new ActiveRow($this,$class,$event,$multiple); |
|
372 | + public function setActiveRowSelector($class="active", $event="click", $multiple=false) { |
|
373 | + $this->_activeRowSelector=new ActiveRow($this, $class, $event, $multiple); |
|
374 | 374 | return $this; |
375 | 375 | } |
376 | 376 | |
377 | - public function hideColumn($colIndex){ |
|
378 | - if(isset($this->content["thead"])){ |
|
377 | + public function hideColumn($colIndex) { |
|
378 | + if (isset($this->content["thead"])) { |
|
379 | 379 | $this->content["thead"]->hideColumn($colIndex); |
380 | 380 | } |
381 | 381 | $this->content["tbody"]->hideColumn($colIndex); |
382 | - if(isset($this->content["tfoot"])){ |
|
382 | + if (isset($this->content["tfoot"])) { |
|
383 | 383 | $this->content["tfoot"]->hideColumn($colIndex); |
384 | 384 | } |
385 | 385 | return $this; |
386 | 386 | } |
387 | 387 | |
388 | - public function setColWidth($colIndex,$width){ |
|
388 | + public function setColWidth($colIndex, $width) { |
|
389 | 389 | $part=$this->_getFirstPart(); |
390 | - if($part!==null && $part->count()>0) |
|
390 | + if ($part!==null && $part->count()>0) |
|
391 | 391 | $part->getCell(0, $colIndex)->setWidth($width); |
392 | 392 | return $this; |
393 | 393 | } |
394 | 394 | |
395 | - public function setColWidths($widths){ |
|
395 | + public function setColWidths($widths) { |
|
396 | 396 | $part=$this->_getFirstPart(); |
397 | - if($part!==null && $part->count()>0){ |
|
397 | + if ($part!==null && $part->count()>0) { |
|
398 | 398 | $count=$part->getColCount(); |
399 | - if(!\is_array($widths)){ |
|
399 | + if (!\is_array($widths)) { |
|
400 | 400 | $widths=\array_fill(0, $count, $widths); |
401 | 401 | } |
402 | - $max=\min(\sizeof($widths),$count); |
|
403 | - for($i=0;$i<$max;$i++){ |
|
402 | + $max=\min(\sizeof($widths), $count); |
|
403 | + for ($i=0; $i<$max; $i++) { |
|
404 | 404 | $part->getCell(0, $i)->setWidth($widths[$i]); |
405 | 405 | } |
406 | 406 | } |