@@ -107,9 +107,10 @@ |
||
107 | 107 | { |
108 | 108 | parent::addAttributesToRender($writer); |
109 | 109 | $writer->addAttribute('id', $this->getClientID()); |
110 | - if ($this->getAutoPostBack()) |
|
111 | - $this->getActiveControl()->registerCallbackClientScript( |
|
110 | + if ($this->getAutoPostBack()) { |
|
111 | + $this->getActiveControl()->registerCallbackClientScript( |
|
112 | 112 | $this->getClientClassName(), $this->getPostBackOptions()); |
113 | + } |
|
113 | 114 | } |
114 | 115 | |
115 | 116 | /** |
@@ -41,15 +41,15 @@ discard block |
||
41 | 41 | $this->_items = []; |
42 | 42 | $this->_expressions = []; |
43 | 43 | $this->_statements = []; |
44 | - foreach($items as $id => $item) |
|
44 | + foreach ($items as $id => $item) |
|
45 | 45 | { |
46 | - if(is_array($item)) |
|
46 | + if (is_array($item)) |
|
47 | 47 | { |
48 | - if($item[0] === self::TYPE_EXPRESSION) |
|
48 | + if ($item[0] === self::TYPE_EXPRESSION) |
|
49 | 49 | $this->_expressions[$id] = $item[1]; |
50 | - elseif($item[0] === self::TYPE_STATEMENTS) |
|
50 | + elseif ($item[0] === self::TYPE_STATEMENTS) |
|
51 | 51 | $this->_statements[$id] = $item[1]; |
52 | - elseif($item[0] === self::TYPE_DATABINDING) |
|
52 | + elseif ($item[0] === self::TYPE_DATABINDING) |
|
53 | 53 | $this->_bindings[$id] = $item[1]; |
54 | 54 | $this->_items[$id] = ''; |
55 | 55 | } |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function evaluateDynamicContent() |
81 | 81 | { |
82 | - $context = $this->_container === null?$this:$this->_container; |
|
83 | - foreach($this->_expressions as $id => $expression) |
|
82 | + $context = $this->_container === null ? $this : $this->_container; |
|
83 | + foreach ($this->_expressions as $id => $expression) |
|
84 | 84 | $this->_items[$id] = $context->evaluateExpression($expression); |
85 | - foreach($this->_statements as $id => $statement) |
|
85 | + foreach ($this->_statements as $id => $statement) |
|
86 | 86 | $this->_items[$id] = $context->evaluateStatements($statement); |
87 | 87 | } |
88 | 88 | |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function dataBind() |
94 | 94 | { |
95 | - $context = $this->_container === null?$this:$this->_container; |
|
96 | - foreach($this->_bindings as $id => $binding) |
|
95 | + $context = $this->_container === null ? $this : $this->_container; |
|
96 | + foreach ($this->_bindings as $id => $binding) |
|
97 | 97 | $this->_items[$id] = $context->evaluateExpression($binding); |
98 | 98 | } |
99 | 99 |
@@ -45,16 +45,17 @@ discard block |
||
45 | 45 | { |
46 | 46 | if(is_array($item)) |
47 | 47 | { |
48 | - if($item[0] === self::TYPE_EXPRESSION) |
|
49 | - $this->_expressions[$id] = $item[1]; |
|
50 | - elseif($item[0] === self::TYPE_STATEMENTS) |
|
51 | - $this->_statements[$id] = $item[1]; |
|
52 | - elseif($item[0] === self::TYPE_DATABINDING) |
|
53 | - $this->_bindings[$id] = $item[1]; |
|
48 | + if($item[0] === self::TYPE_EXPRESSION) { |
|
49 | + $this->_expressions[$id] = $item[1]; |
|
50 | + } elseif($item[0] === self::TYPE_STATEMENTS) { |
|
51 | + $this->_statements[$id] = $item[1]; |
|
52 | + } elseif($item[0] === self::TYPE_DATABINDING) { |
|
53 | + $this->_bindings[$id] = $item[1]; |
|
54 | + } |
|
54 | 55 | $this->_items[$id] = ''; |
56 | + } else { |
|
57 | + $this->_items[$id] = $item; |
|
55 | 58 | } |
56 | - else |
|
57 | - $this->_items[$id] = $item; |
|
58 | 59 | } |
59 | 60 | } |
60 | 61 | |
@@ -80,10 +81,12 @@ discard block |
||
80 | 81 | public function evaluateDynamicContent() |
81 | 82 | { |
82 | 83 | $context = $this->_container === null?$this:$this->_container; |
83 | - foreach($this->_expressions as $id => $expression) |
|
84 | - $this->_items[$id] = $context->evaluateExpression($expression); |
|
85 | - foreach($this->_statements as $id => $statement) |
|
86 | - $this->_items[$id] = $context->evaluateStatements($statement); |
|
84 | + foreach($this->_expressions as $id => $expression) { |
|
85 | + $this->_items[$id] = $context->evaluateExpression($expression); |
|
86 | + } |
|
87 | + foreach($this->_statements as $id => $statement) { |
|
88 | + $this->_items[$id] = $context->evaluateStatements($statement); |
|
89 | + } |
|
87 | 90 | } |
88 | 91 | |
89 | 92 | /** |
@@ -93,8 +96,9 @@ discard block |
||
93 | 96 | public function dataBind() |
94 | 97 | { |
95 | 98 | $context = $this->_container === null?$this:$this->_container; |
96 | - foreach($this->_bindings as $id => $binding) |
|
97 | - $this->_items[$id] = $context->evaluateExpression($binding); |
|
99 | + foreach($this->_bindings as $id => $binding) { |
|
100 | + $this->_items[$id] = $context->evaluateExpression($binding); |
|
101 | + } |
|
98 | 102 | } |
99 | 103 | |
100 | 104 | /** |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function getTemplate() |
68 | 68 | { |
69 | - if($this->_localTemplate === null) |
|
69 | + if ($this->_localTemplate === null) |
|
70 | 70 | { |
71 | 71 | $class = get_class($this); |
72 | - if(!isset(self::$_template[$class])) |
|
72 | + if (!isset(self::$_template[$class])) |
|
73 | 73 | self::$_template[$class] = $this->loadTemplate(); |
74 | 74 | return self::$_template[$class]; |
75 | 75 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function getIsSourceTemplateControl() |
97 | 97 | { |
98 | - if(($template = $this->getTemplate()) !== null) |
|
98 | + if (($template = $this->getTemplate()) !== null) |
|
99 | 99 | return $template->getIsSourceTemplate(); |
100 | 100 | else |
101 | 101 | return false; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function getTemplateDirectory() |
108 | 108 | { |
109 | - if(($template = $this->getTemplate()) !== null) |
|
109 | + if (($template = $this->getTemplate()) !== null) |
|
110 | 110 | return $template->getContextPath(); |
111 | 111 | else |
112 | 112 | return ''; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | protected function loadTemplate() |
120 | 120 | { |
121 | - Prado::trace("Loading template " . get_class($this), '\Prado\Web\UI\TTemplateControl'); |
|
121 | + Prado::trace("Loading template ".get_class($this), '\Prado\Web\UI\TTemplateControl'); |
|
122 | 122 | $template = $this->getService()->getTemplateManager()->getTemplateByClassName(get_class($this)); |
123 | 123 | return $template; |
124 | 124 | } |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function createChildControls() |
132 | 132 | { |
133 | - if($tpl = $this->getTemplate()) |
|
133 | + if ($tpl = $this->getTemplate()) |
|
134 | 134 | { |
135 | - foreach($tpl->getDirective() as $name => $value) |
|
135 | + foreach ($tpl->getDirective() as $name => $value) |
|
136 | 136 | { |
137 | - if(is_string($value)) |
|
137 | + if (is_string($value)) |
|
138 | 138 | $this->setSubProperty($name, $value); |
139 | 139 | else |
140 | 140 | throw new TConfigurationException('templatecontrol_directive_invalid', get_class($this), $name); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function registerContent($id, TContent $object) |
152 | 152 | { |
153 | - if(isset($this->_contents[$id])) |
|
153 | + if (isset($this->_contents[$id])) |
|
154 | 154 | throw new TConfigurationException('templatecontrol_contentid_duplicated', $id); |
155 | 155 | else |
156 | 156 | $this->_contents[$id] = $object; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public function registerContentPlaceHolder($id, TContentPlaceHolder $object) |
166 | 166 | { |
167 | - if(isset($this->_placeholders[$id])) |
|
167 | + if (isset($this->_placeholders[$id])) |
|
168 | 168 | throw new TConfigurationException('templatecontrol_placeholderid_duplicated', $id); |
169 | 169 | else |
170 | 170 | $this->_placeholders[$id] = $object; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function injectContent($id, $content) |
204 | 204 | { |
205 | - if(isset($this->_placeholders[$id])) |
|
205 | + if (isset($this->_placeholders[$id])) |
|
206 | 206 | { |
207 | 207 | $placeholder = $this->_placeholders[$id]; |
208 | 208 | $controls = $placeholder->getParent()->getControls(); |
@@ -224,19 +224,19 @@ discard block |
||
224 | 224 | protected function initRecursive($namingContainer = null) |
225 | 225 | { |
226 | 226 | $this->ensureChildControls(); |
227 | - if($this->_masterClass !== '') |
|
227 | + if ($this->_masterClass !== '') |
|
228 | 228 | { |
229 | 229 | $master = Prado::createComponent($this->_masterClass); |
230 | - if(!($master instanceof TTemplateControl)) |
|
230 | + if (!($master instanceof TTemplateControl)) |
|
231 | 231 | throw new TInvalidDataValueException('templatecontrol_mastercontrol_invalid'); |
232 | 232 | $this->_master = $master; |
233 | 233 | $this->getControls()->clear(); |
234 | 234 | $this->getControls()->add($master); |
235 | 235 | $master->ensureChildControls(); |
236 | - foreach($this->_contents as $id => $content) |
|
236 | + foreach ($this->_contents as $id => $content) |
|
237 | 237 | $master->injectContent($id, $content); |
238 | 238 | } |
239 | - elseif(!empty($this->_contents)) |
|
239 | + elseif (!empty($this->_contents)) |
|
240 | 240 | throw new TConfigurationException('templatecontrol_mastercontrol_required', get_class($this)); |
241 | 241 | parent::initRecursive($namingContainer); |
242 | 242 | } |
@@ -69,12 +69,13 @@ discard block |
||
69 | 69 | if($this->_localTemplate === null) |
70 | 70 | { |
71 | 71 | $class = get_class($this); |
72 | - if(!isset(self::$_template[$class])) |
|
73 | - self::$_template[$class] = $this->loadTemplate(); |
|
72 | + if(!isset(self::$_template[$class])) { |
|
73 | + self::$_template[$class] = $this->loadTemplate(); |
|
74 | + } |
|
74 | 75 | return self::$_template[$class]; |
76 | + } else { |
|
77 | + return $this->_localTemplate; |
|
75 | 78 | } |
76 | - else |
|
77 | - return $this->_localTemplate; |
|
78 | 79 | } |
79 | 80 | |
80 | 81 | /** |
@@ -95,10 +96,11 @@ discard block |
||
95 | 96 | */ |
96 | 97 | public function getIsSourceTemplateControl() |
97 | 98 | { |
98 | - if(($template = $this->getTemplate()) !== null) |
|
99 | - return $template->getIsSourceTemplate(); |
|
100 | - else |
|
101 | - return false; |
|
99 | + if(($template = $this->getTemplate()) !== null) { |
|
100 | + return $template->getIsSourceTemplate(); |
|
101 | + } else { |
|
102 | + return false; |
|
103 | + } |
|
102 | 104 | } |
103 | 105 | |
104 | 106 | /** |
@@ -106,10 +108,11 @@ discard block |
||
106 | 108 | */ |
107 | 109 | public function getTemplateDirectory() |
108 | 110 | { |
109 | - if(($template = $this->getTemplate()) !== null) |
|
110 | - return $template->getContextPath(); |
|
111 | - else |
|
112 | - return ''; |
|
111 | + if(($template = $this->getTemplate()) !== null) { |
|
112 | + return $template->getContextPath(); |
|
113 | + } else { |
|
114 | + return ''; |
|
115 | + } |
|
113 | 116 | } |
114 | 117 | |
115 | 118 | /** |
@@ -134,10 +137,11 @@ discard block |
||
134 | 137 | { |
135 | 138 | foreach($tpl->getDirective() as $name => $value) |
136 | 139 | { |
137 | - if(is_string($value)) |
|
138 | - $this->setSubProperty($name, $value); |
|
139 | - else |
|
140 | - throw new TConfigurationException('templatecontrol_directive_invalid', get_class($this), $name); |
|
140 | + if(is_string($value)) { |
|
141 | + $this->setSubProperty($name, $value); |
|
142 | + } else { |
|
143 | + throw new TConfigurationException('templatecontrol_directive_invalid', get_class($this), $name); |
|
144 | + } |
|
141 | 145 | } |
142 | 146 | $tpl->instantiateIn($this); |
143 | 147 | } |
@@ -150,10 +154,11 @@ discard block |
||
150 | 154 | */ |
151 | 155 | public function registerContent($id, TContent $object) |
152 | 156 | { |
153 | - if(isset($this->_contents[$id])) |
|
154 | - throw new TConfigurationException('templatecontrol_contentid_duplicated', $id); |
|
155 | - else |
|
156 | - $this->_contents[$id] = $object; |
|
157 | + if(isset($this->_contents[$id])) { |
|
158 | + throw new TConfigurationException('templatecontrol_contentid_duplicated', $id); |
|
159 | + } else { |
|
160 | + $this->_contents[$id] = $object; |
|
161 | + } |
|
157 | 162 | } |
158 | 163 | |
159 | 164 | /** |
@@ -164,10 +169,11 @@ discard block |
||
164 | 169 | */ |
165 | 170 | public function registerContentPlaceHolder($id, TContentPlaceHolder $object) |
166 | 171 | { |
167 | - if(isset($this->_placeholders[$id])) |
|
168 | - throw new TConfigurationException('templatecontrol_placeholderid_duplicated', $id); |
|
169 | - else |
|
170 | - $this->_placeholders[$id] = $object; |
|
172 | + if(isset($this->_placeholders[$id])) { |
|
173 | + throw new TConfigurationException('templatecontrol_placeholderid_duplicated', $id); |
|
174 | + } else { |
|
175 | + $this->_placeholders[$id] = $object; |
|
176 | + } |
|
171 | 177 | } |
172 | 178 | |
173 | 179 | /** |
@@ -208,9 +214,9 @@ discard block |
||
208 | 214 | $controls = $placeholder->getParent()->getControls(); |
209 | 215 | $loc = $controls->remove($placeholder); |
210 | 216 | $controls->insertAt($loc, $content); |
217 | + } else { |
|
218 | + throw new TConfigurationException('templatecontrol_placeholder_inexistent', $id); |
|
211 | 219 | } |
212 | - else |
|
213 | - throw new TConfigurationException('templatecontrol_placeholder_inexistent', $id); |
|
214 | 220 | } |
215 | 221 | |
216 | 222 | /** |
@@ -227,17 +233,19 @@ discard block |
||
227 | 233 | if($this->_masterClass !== '') |
228 | 234 | { |
229 | 235 | $master = Prado::createComponent($this->_masterClass); |
230 | - if(!($master instanceof TTemplateControl)) |
|
231 | - throw new TInvalidDataValueException('templatecontrol_mastercontrol_invalid'); |
|
236 | + if(!($master instanceof TTemplateControl)) { |
|
237 | + throw new TInvalidDataValueException('templatecontrol_mastercontrol_invalid'); |
|
238 | + } |
|
232 | 239 | $this->_master = $master; |
233 | 240 | $this->getControls()->clear(); |
234 | 241 | $this->getControls()->add($master); |
235 | 242 | $master->ensureChildControls(); |
236 | - foreach($this->_contents as $id => $content) |
|
237 | - $master->injectContent($id, $content); |
|
243 | + foreach($this->_contents as $id => $content) { |
|
244 | + $master->injectContent($id, $content); |
|
245 | + } |
|
246 | + } elseif(!empty($this->_contents)) { |
|
247 | + throw new TConfigurationException('templatecontrol_mastercontrol_required', get_class($this)); |
|
238 | 248 | } |
239 | - elseif(!empty($this->_contents)) |
|
240 | - throw new TConfigurationException('templatecontrol_mastercontrol_required', get_class($this)); |
|
241 | 249 | parent::initRecursive($namingContainer); |
242 | 250 | } |
243 | 251 | |
@@ -258,14 +266,14 @@ discard block |
||
258 | 266 | if ($key != "RELATIONS") |
259 | 267 | { |
260 | 268 | $control = $this->{$key}; |
261 | - if ($control instanceof TTextBox) |
|
262 | - $control->Text = $arObj->{$key}; |
|
263 | - elseif ($control instanceof TCheckBox) |
|
264 | - $control->Checked = (boolean) $arObj->{$key}; |
|
265 | - elseif ($control instanceof TDatePicker) |
|
266 | - $control->Date = $arObj->{$key}; |
|
267 | - } |
|
268 | - else |
|
269 | + if ($control instanceof TTextBox) { |
|
270 | + $control->Text = $arObj->{$key}; |
|
271 | + } elseif ($control instanceof TCheckBox) { |
|
272 | + $control->Checked = (boolean) $arObj->{$key}; |
|
273 | + } elseif ($control instanceof TDatePicker) { |
|
274 | + $control->Date = $arObj->{$key}; |
|
275 | + } |
|
276 | + } else |
|
269 | 277 | { |
270 | 278 | foreach ($objAttrs["RELATIONS"] as $relKey => $relValues) |
271 | 279 | { |
@@ -287,11 +295,11 @@ discard block |
||
287 | 295 | } |
288 | 296 | break; |
289 | 297 | } |
290 | - } |
|
291 | - catch (Exception $ex) |
|
298 | + } catch (Exception $ex) |
|
292 | 299 | { |
293 | - if ($throwExceptions) |
|
294 | - throw $ex; |
|
300 | + if ($throwExceptions) { |
|
301 | + throw $ex; |
|
302 | + } |
|
295 | 303 | } |
296 | 304 | } |
297 | 305 | } |
@@ -309,20 +317,22 @@ discard block |
||
309 | 317 | { |
310 | 318 | try |
311 | 319 | { |
312 | - if ($key == "RELATIONS") |
|
313 | - break; |
|
320 | + if ($key == "RELATIONS") { |
|
321 | + break; |
|
322 | + } |
|
314 | 323 | $control = $this->{$key}; |
315 | - if ($control instanceof TTextBox) |
|
316 | - $arObj->{$key} = $control->Text; |
|
317 | - elseif ($control instanceof TCheckBox) |
|
318 | - $arObj->{$key} = $control->Checked; |
|
319 | - elseif ($control instanceof TDatePicker) |
|
320 | - $arObj->{$key} = $control->Date; |
|
321 | - } |
|
322 | - catch (Exception $ex) |
|
324 | + if ($control instanceof TTextBox) { |
|
325 | + $arObj->{$key} = $control->Text; |
|
326 | + } elseif ($control instanceof TCheckBox) { |
|
327 | + $arObj->{$key} = $control->Checked; |
|
328 | + } elseif ($control instanceof TDatePicker) { |
|
329 | + $arObj->{$key} = $control->Date; |
|
330 | + } |
|
331 | + } catch (Exception $ex) |
|
323 | 332 | { |
324 | - if ($throwExceptions) |
|
325 | - throw $ex; |
|
333 | + if ($throwExceptions) { |
|
334 | + throw $ex; |
|
335 | + } |
|
326 | 336 | } |
327 | 337 | } |
328 | 338 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $writer->addAttribute('id', $this->getClientID()); |
126 | 126 | $options = TJavaScript::encode($this->getPostBackOptions()); |
127 | 127 | $cs = $this->getPage()->getClientScript(); |
128 | - $code = "jQuery('#" . $this->getWidgetID() . "')." . $this->getWidget() . "(" . $options . ");"; |
|
128 | + $code = "jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
|
129 | 129 | $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); |
130 | 130 | } |
131 | 131 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * Raises the OnCreate event |
144 | 144 | * @param object $params event parameters |
145 | 145 | */ |
146 | - public function onCreate ($params) |
|
146 | + public function onCreate($params) |
|
147 | 147 | { |
148 | 148 | $this->raiseEvent('OnCreate', $this, $params); |
149 | 149 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * Raises the OnResize event |
153 | 153 | * @param object $params event parameters |
154 | 154 | */ |
155 | - public function onResize ($params) |
|
155 | + public function onResize($params) |
|
156 | 156 | { |
157 | 157 | $this->raiseEvent('OnResize', $this, $params); |
158 | 158 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * Raises the OnStart event |
162 | 162 | * @param object $params event parameters |
163 | 163 | */ |
164 | - public function onStart ($params) |
|
164 | + public function onStart($params) |
|
165 | 165 | { |
166 | 166 | $this->raiseEvent('OnStart', $this, $params); |
167 | 167 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * Raises the OnStop event |
171 | 171 | * @param object $params event parameters |
172 | 172 | */ |
173 | - public function onStop ($params) |
|
173 | + public function onStop($params) |
|
174 | 174 | { |
175 | 175 | $this->raiseEvent('OnStop', $this, $params); |
176 | 176 | } |
@@ -76,7 +76,7 @@ |
||
76 | 76 | $name = strtolower(substr($name, 0, $pos)); |
77 | 77 | |
78 | 78 | $cp = $this->getCallbackParameter(); |
79 | - if(!isset($cp->$name) || $cp->$name == '') |
|
79 | + if (!isset($cp->$name) || $cp->$name == '') |
|
80 | 80 | return null; |
81 | 81 | |
82 | 82 | return $this->getControl($cp->$name); |
@@ -76,8 +76,9 @@ |
||
76 | 76 | $name = strtolower(substr($name, 0, $pos)); |
77 | 77 | |
78 | 78 | $cp = $this->getCallbackParameter(); |
79 | - if(!isset($cp->$name) || $cp->$name == '') |
|
80 | - return null; |
|
79 | + if(!isset($cp->$name) || $cp->$name == '') { |
|
80 | + return null; |
|
81 | + } |
|
81 | 82 | |
82 | 83 | return $this->getControl($cp->$name); |
83 | 84 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function getWidgetID() |
74 | 74 | { |
75 | - return $this->getClientID() . '_0'; |
|
75 | + return $this->getClientID().'_0'; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | { |
115 | 115 | $options = $this->getOptions()->toArray(); |
116 | 116 | // overload the "OnStop" event to add information about the current selected items |
117 | - if(isset($options['stop'])) |
|
117 | + if (isset($options['stop'])) |
|
118 | 118 | { |
119 | - $options['stop'] = new TJavaScriptLiteral('function( event, ui ) { ui.index = new Array(); jQuery(\'#' . $this->getClientID() . ' .ui-selected\').each(function(idx, item){ ui.index.push(item.id) }); Prado.JuiCallback(' . TJavaScript::encode($this->getUniqueID()) . ', \'stop\', event, ui, this); }'); |
|
119 | + $options['stop'] = new TJavaScriptLiteral('function( event, ui ) { ui.index = new Array(); jQuery(\'#'.$this->getClientID().' .ui-selected\').each(function(idx, item){ ui.index.push(item.id) }); Prado.JuiCallback('.TJavaScript::encode($this->getUniqueID()).', \'stop\', event, ui, this); }'); |
|
120 | 120 | } |
121 | 121 | return $options; |
122 | 122 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $writer->addAttribute('id', $this->getClientID()); |
132 | 132 | $options = TJavaScript::encode($this->getPostBackOptions()); |
133 | 133 | $cs = $this->getPage()->getClientScript(); |
134 | - $code = "jQuery('#" . $this->getWidgetID() . "')." . $this->getWidget() . "(" . $options . ");"; |
|
134 | + $code = "jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
|
135 | 135 | $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); |
136 | 136 | } |
137 | 137 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * Raises the OnCreate event |
150 | 150 | * @param object $params event parameters |
151 | 151 | */ |
152 | - public function onCreate ($params) |
|
152 | + public function onCreate($params) |
|
153 | 153 | { |
154 | 154 | $this->raiseEvent('OnCreate', $this, $params); |
155 | 155 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * Raises the OnSelected event |
159 | 159 | * @param object $params event parameters |
160 | 160 | */ |
161 | - public function onSelected ($params) |
|
161 | + public function onSelected($params) |
|
162 | 162 | { |
163 | 163 | $this->raiseEvent('OnSelected', $this, $params); |
164 | 164 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * Raises the OnSelecting event |
168 | 168 | * @param object $params event parameters |
169 | 169 | */ |
170 | - public function onSelecting ($params) |
|
170 | + public function onSelecting($params) |
|
171 | 171 | { |
172 | 172 | $this->raiseEvent('OnSelecting', $this, $params); |
173 | 173 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * Raises the OnStart event |
177 | 177 | * @param object $params event parameters |
178 | 178 | */ |
179 | - public function onStart ($params) |
|
179 | + public function onStart($params) |
|
180 | 180 | { |
181 | 181 | $this->raiseEvent('OnStart', $this, $params); |
182 | 182 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * Raises the OnStop event |
186 | 186 | * @param object $params event parameters |
187 | 187 | */ |
188 | - public function onStop ($params) |
|
188 | + public function onStop($params) |
|
189 | 189 | { |
190 | 190 | $this->raiseEvent('OnStop', $this, $params); |
191 | 191 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * Raises the OnUnselected event |
195 | 195 | * @param object $params event parameters |
196 | 196 | */ |
197 | - public function onUnselected ($params) |
|
197 | + public function onUnselected($params) |
|
198 | 198 | { |
199 | 199 | $this->raiseEvent('OnUnselected', $this, $params); |
200 | 200 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * Raises the OnUnselecting event |
204 | 204 | * @param object $params event parameters |
205 | 205 | */ |
206 | - public function onUnselecting ($params) |
|
206 | + public function onUnselecting($params) |
|
207 | 207 | { |
208 | 208 | $this->raiseEvent('OnUnselecting', $this, $params); |
209 | 209 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | public function dataBind() |
229 | 229 | { |
230 | 230 | parent::dataBind(); |
231 | - if($this->getPage()->getIsCallback()) |
|
231 | + if ($this->getPage()->getIsCallback()) |
|
232 | 232 | $this->renderSelectables($this->getResponse()->createHtmlWriter()); |
233 | 233 | } |
234 | 234 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function getSelectables() |
239 | 239 | { |
240 | - if($this->_repeater === null) |
|
240 | + if ($this->_repeater === null) |
|
241 | 241 | $this->_repeater = $this->createRepeater(); |
242 | 242 | return $this->_repeater; |
243 | 243 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | protected function createRepeater() |
249 | 249 | { |
250 | 250 | $repeater = new TRepeater; |
251 | - $repeater->setHeaderTemplate(new TJuiSelectableTemplate('<ul id="' . $this->getWidgetID() . '">')); |
|
251 | + $repeater->setHeaderTemplate(new TJuiSelectableTemplate('<ul id="'.$this->getWidgetID().'">')); |
|
252 | 252 | $repeater->setFooterTemplate(new TJuiSelectableTemplate('</ul>')); |
253 | 253 | $repeater->setItemTemplate(new TTemplate('<li id="<%# $this->ItemIndex %>"><%# $this->Data %></li>', null)); |
254 | 254 | $repeater->setEmptyTemplate(new TJuiSelectableTemplate('<ul></ul>')); |
@@ -228,8 +228,9 @@ discard block |
||
228 | 228 | public function dataBind() |
229 | 229 | { |
230 | 230 | parent::dataBind(); |
231 | - if($this->getPage()->getIsCallback()) |
|
232 | - $this->renderSelectables($this->getResponse()->createHtmlWriter()); |
|
231 | + if($this->getPage()->getIsCallback()) { |
|
232 | + $this->renderSelectables($this->getResponse()->createHtmlWriter()); |
|
233 | + } |
|
233 | 234 | } |
234 | 235 | |
235 | 236 | /** |
@@ -237,8 +238,9 @@ discard block |
||
237 | 238 | */ |
238 | 239 | public function getSelectables() |
239 | 240 | { |
240 | - if($this->_repeater === null) |
|
241 | - $this->_repeater = $this->createRepeater(); |
|
241 | + if($this->_repeater === null) { |
|
242 | + $this->_repeater = $this->createRepeater(); |
|
243 | + } |
|
242 | 244 | return $this->_repeater; |
243 | 245 | } |
244 | 246 |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function getWidgetID() |
71 | 71 | { |
72 | - return $this->getClientID() . '_0'; |
|
72 | + return $this->getClientID().'_0'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | { |
112 | 112 | $options = $this->getOptions()->toArray(); |
113 | 113 | // overload some events to add information about the items order |
114 | - foreach($options as $event => $implementation) |
|
114 | + foreach ($options as $event => $implementation) |
|
115 | 115 | { |
116 | - if($event == 'sort' || $event == 'stop') |
|
117 | - $options[$event] = new TJavaScriptLiteral('function( event, ui ) { ui.index = jQuery(this).sortable(\'toArray\'); Prado.JuiCallback(' . TJavaScript::encode($this->getUniqueID()) . ', \'' . $event . '\', event, ui, this); }'); |
|
116 | + if ($event == 'sort' || $event == 'stop') |
|
117 | + $options[$event] = new TJavaScriptLiteral('function( event, ui ) { ui.index = jQuery(this).sortable(\'toArray\'); Prado.JuiCallback('.TJavaScript::encode($this->getUniqueID()).', \''.$event.'\', event, ui, this); }'); |
|
118 | 118 | } |
119 | 119 | return $options; |
120 | 120 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $writer->addAttribute('id', $this->getClientID()); |
130 | 130 | $options = TJavaScript::encode($this->getPostBackOptions()); |
131 | 131 | $cs = $this->getPage()->getClientScript(); |
132 | - $code = "jQuery('#" . $this->getWidgetID() . "')." . $this->getWidget() . "(" . $options . ");"; |
|
132 | + $code = "jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
|
133 | 133 | $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); |
134 | 134 | } |
135 | 135 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * Raises the OnActivate event |
148 | 148 | * @param object $params event parameters |
149 | 149 | */ |
150 | - public function onActivate ($params) |
|
150 | + public function onActivate($params) |
|
151 | 151 | { |
152 | 152 | $this->raiseEvent('OnActivate', $this, $params); |
153 | 153 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * Raises the OnBeforeStop event |
157 | 157 | * @param object $params event parameters |
158 | 158 | */ |
159 | - public function onBeforeStop ($params) |
|
159 | + public function onBeforeStop($params) |
|
160 | 160 | { |
161 | 161 | $this->raiseEvent('OnBeforeStop', $this, $params); |
162 | 162 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * Raises the OnChange event |
166 | 166 | * @param object $params event parameters |
167 | 167 | */ |
168 | - public function onChange ($params) |
|
168 | + public function onChange($params) |
|
169 | 169 | { |
170 | 170 | $this->raiseEvent('OnChange', $this, $params); |
171 | 171 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * Raises the OnCreate event |
175 | 175 | * @param object $params event parameters |
176 | 176 | */ |
177 | - public function onCreate ($params) |
|
177 | + public function onCreate($params) |
|
178 | 178 | { |
179 | 179 | $this->raiseEvent('OnCreate', $this, $params); |
180 | 180 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * Raises the OnDeactivate event |
184 | 184 | * @param object $params event parameters |
185 | 185 | */ |
186 | - public function onDeactivate ($params) |
|
186 | + public function onDeactivate($params) |
|
187 | 187 | { |
188 | 188 | $this->raiseEvent('OnDeactivate', $this, $params); |
189 | 189 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * Raises the OnOut event |
193 | 193 | * @param object $params event parameters |
194 | 194 | */ |
195 | - public function onOut ($params) |
|
195 | + public function onOut($params) |
|
196 | 196 | { |
197 | 197 | $this->raiseEvent('OnOut', $this, $params); |
198 | 198 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * Raises the OnOver event |
202 | 202 | * @param object $params event parameters |
203 | 203 | */ |
204 | - public function onOver ($params) |
|
204 | + public function onOver($params) |
|
205 | 205 | { |
206 | 206 | $this->raiseEvent('OnOver', $this, $params); |
207 | 207 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * Raises the OnReceive event |
211 | 211 | * @param object $params event parameters |
212 | 212 | */ |
213 | - public function onReceive ($params) |
|
213 | + public function onReceive($params) |
|
214 | 214 | { |
215 | 215 | $this->raiseEvent('OnReceive', $this, $params); |
216 | 216 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * Raises the OnRemove event |
220 | 220 | * @param object $params event parameters |
221 | 221 | */ |
222 | - public function onRemove ($params) |
|
222 | + public function onRemove($params) |
|
223 | 223 | { |
224 | 224 | $this->raiseEvent('OnRemove', $this, $params); |
225 | 225 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * Raises the OnSort event |
229 | 229 | * @param object $params event parameters |
230 | 230 | */ |
231 | - public function onSort ($params) |
|
231 | + public function onSort($params) |
|
232 | 232 | { |
233 | 233 | $this->raiseEvent('OnSort', $this, $params); |
234 | 234 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * Raises the OnStart event |
238 | 238 | * @param object $params event parameters |
239 | 239 | */ |
240 | - public function onStart ($params) |
|
240 | + public function onStart($params) |
|
241 | 241 | { |
242 | 242 | $this->raiseEvent('OnStart', $this, $params); |
243 | 243 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * Raises the OnStop event |
247 | 247 | * @param object $params event parameters |
248 | 248 | */ |
249 | - public function OnStop ($params) |
|
249 | + public function OnStop($params) |
|
250 | 250 | { |
251 | 251 | $this->raiseEvent('OnStop', $this, $params); |
252 | 252 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * Raises the OnUpdate event |
256 | 256 | * @param object $params event parameters |
257 | 257 | */ |
258 | - public function onUpdate ($params) |
|
258 | + public function onUpdate($params) |
|
259 | 259 | { |
260 | 260 | $this->raiseEvent('OnUpdate', $this, $params); |
261 | 261 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | public function dataBind() |
281 | 281 | { |
282 | 282 | parent::dataBind(); |
283 | - if($this->getPage()->getIsCallback()) |
|
283 | + if ($this->getPage()->getIsCallback()) |
|
284 | 284 | $this->renderSortables($this->getResponse()->createHtmlWriter()); |
285 | 285 | } |
286 | 286 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | */ |
290 | 290 | public function getSortables() |
291 | 291 | { |
292 | - if($this->_repeater === null) |
|
292 | + if ($this->_repeater === null) |
|
293 | 293 | $this->_repeater = $this->createRepeater(); |
294 | 294 | return $this->_repeater; |
295 | 295 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | protected function createRepeater() |
301 | 301 | { |
302 | 302 | $repeater = new TRepeater; |
303 | - $repeater->setHeaderTemplate(new TJuiSortableTemplate('<ul id="' . $this->getWidgetID() . '">')); |
|
303 | + $repeater->setHeaderTemplate(new TJuiSortableTemplate('<ul id="'.$this->getWidgetID().'">')); |
|
304 | 304 | $repeater->setFooterTemplate(new TJuiSortableTemplate('</ul>')); |
305 | 305 | $repeater->setItemTemplate(new TTemplate('<li id="<%# $this->ItemIndex %>"><%# $this->Data %></li>', null)); |
306 | 306 | $repeater->setEmptyTemplate(new TJuiSortableTemplate('<ul></ul>')); |
@@ -113,8 +113,9 @@ discard block |
||
113 | 113 | // overload some events to add information about the items order |
114 | 114 | foreach($options as $event => $implementation) |
115 | 115 | { |
116 | - if($event == 'sort' || $event == 'stop') |
|
117 | - $options[$event] = new TJavaScriptLiteral('function( event, ui ) { ui.index = jQuery(this).sortable(\'toArray\'); Prado.JuiCallback(' . TJavaScript::encode($this->getUniqueID()) . ', \'' . $event . '\', event, ui, this); }'); |
|
116 | + if($event == 'sort' || $event == 'stop') { |
|
117 | + $options[$event] = new TJavaScriptLiteral('function( event, ui ) { ui.index = jQuery(this).sortable(\'toArray\'); Prado.JuiCallback(' . TJavaScript::encode($this->getUniqueID()) . ', \'' . $event . '\', event, ui, this); }'); |
|
118 | + } |
|
118 | 119 | } |
119 | 120 | return $options; |
120 | 121 | } |
@@ -280,8 +281,9 @@ discard block |
||
280 | 281 | public function dataBind() |
281 | 282 | { |
282 | 283 | parent::dataBind(); |
283 | - if($this->getPage()->getIsCallback()) |
|
284 | - $this->renderSortables($this->getResponse()->createHtmlWriter()); |
|
284 | + if($this->getPage()->getIsCallback()) { |
|
285 | + $this->renderSortables($this->getResponse()->createHtmlWriter()); |
|
286 | + } |
|
285 | 287 | } |
286 | 288 | |
287 | 289 | /** |
@@ -289,8 +291,9 @@ discard block |
||
289 | 291 | */ |
290 | 292 | public function getSortables() |
291 | 293 | { |
292 | - if($this->_repeater === null) |
|
293 | - $this->_repeater = $this->createRepeater(); |
|
294 | + if($this->_repeater === null) { |
|
295 | + $this->_repeater = $this->createRepeater(); |
|
296 | + } |
|
294 | 297 | return $this->_repeater; |
295 | 298 | } |
296 | 299 |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | protected function addAttributesToRender($writer) |
119 | 119 | { |
120 | 120 | $cs = $this->getPage()->getClientScript(); |
121 | - if(self::$_first) |
|
121 | + if (self::$_first) |
|
122 | 122 | { |
123 | 123 | $culture = $this->getCurrentCulture(); |
124 | - if($culture != 'en') |
|
124 | + if ($culture != 'en') |
|
125 | 125 | { |
126 | - $url = $this->getPage()->getClientScript()->getPradoScriptAssetUrl('jquery-ui') . "/ui/i18n/datepicker-{$culture}.js"; |
|
126 | + $url = $this->getPage()->getClientScript()->getPradoScriptAssetUrl('jquery-ui')."/ui/i18n/datepicker-{$culture}.js"; |
|
127 | 127 | $cs->registerScriptFile(sprintf('%08X', crc32($url)), $url); |
128 | 128 | } |
129 | 129 | $code = "jQuery(document).ready(function(){jQuery.datepicker.setDefaults(jQuery.datepicker.regional['{$culture}']);});"; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | } |
133 | 133 | parent::addAttributesToRender($writer); |
134 | 134 | $options = TJavaScript::encode($this->getOptions()->toArray()); |
135 | - $code = "jQuery('#" . $this->getWidgetID() . "')." . $this->getWidget() . "(" . $options . ");"; |
|
135 | + $code = "jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
|
136 | 136 | $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); |
137 | 137 | } |
138 | 138 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function getTimeStamp() |
249 | 249 | { |
250 | - if(trim($this->getText()) === '') |
|
250 | + if (trim($this->getText()) === '') |
|
251 | 251 | return null; |
252 | 252 | else |
253 | 253 | return $this->getTimeStampFromText(); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | */ |
260 | 260 | public function setTimeStamp($value) |
261 | 261 | { |
262 | - if($value === null || (is_string($value) && trim($value) === '')) |
|
262 | + if ($value === null || (is_string($value) && trim($value) === '')) |
|
263 | 263 | $this->setText(''); |
264 | 264 | else |
265 | 265 | { |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | protected function getTimeStampFromText() |
277 | 277 | { |
278 | 278 | $pattern = $this->getDateFormat(); |
279 | - $pattern = str_replace(['MMMM', 'MMM'], ['MM','MM'], $pattern); |
|
279 | + $pattern = str_replace(['MMMM', 'MMM'], ['MM', 'MM'], $pattern); |
|
280 | 280 | $formatter = new TSimpleDateFormatter($pattern); |
281 | 281 | return $formatter->parse($this->getText()); |
282 | 282 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | */ |
289 | 289 | public function getValidationPropertyValue() |
290 | 290 | { |
291 | - if(($text = $this->getText()) === '') |
|
291 | + if (($text = $this->getText()) === '') |
|
292 | 292 | return ''; |
293 | 293 | $date = $this->getTimeStamp(); |
294 | 294 | return $date == null ? $text : $date; |
@@ -247,10 +247,11 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function getTimeStamp() |
249 | 249 | { |
250 | - if(trim($this->getText()) === '') |
|
251 | - return null; |
|
252 | - else |
|
253 | - return $this->getTimeStampFromText(); |
|
250 | + if(trim($this->getText()) === '') { |
|
251 | + return null; |
|
252 | + } else { |
|
253 | + return $this->getTimeStampFromText(); |
|
254 | + } |
|
254 | 255 | } |
255 | 256 | |
256 | 257 | /** |
@@ -259,9 +260,9 @@ discard block |
||
259 | 260 | */ |
260 | 261 | public function setTimeStamp($value) |
261 | 262 | { |
262 | - if($value === null || (is_string($value) && trim($value) === '')) |
|
263 | - $this->setText(''); |
|
264 | - else |
|
263 | + if($value === null || (is_string($value) && trim($value) === '')) { |
|
264 | + $this->setText(''); |
|
265 | + } else |
|
265 | 266 | { |
266 | 267 | $date = TPropertyValue::ensureFloat($value); |
267 | 268 | $formatter = new TSimpleDateFormatter($this->getDateFormat()); |
@@ -288,8 +289,9 @@ discard block |
||
288 | 289 | */ |
289 | 290 | public function getValidationPropertyValue() |
290 | 291 | { |
291 | - if(($text = $this->getText()) === '') |
|
292 | - return ''; |
|
292 | + if(($text = $this->getText()) === '') { |
|
293 | + return ''; |
|
294 | + } |
|
293 | 295 | $date = $this->getTimeStamp(); |
294 | 296 | return $date == null ? $text : $date; |
295 | 297 | } |
@@ -118,7 +118,7 @@ |
||
118 | 118 | $writer->addAttribute('id', $this->getClientID()); |
119 | 119 | $options = TJavaScript::encode($this->getPostBackOptions()); |
120 | 120 | $cs = $this->getPage()->getClientScript(); |
121 | - $code = "jQuery('#" . $this->getWidgetID() . "')." . $this->getWidget() . "(" . $options . ");"; |
|
121 | + $code = "jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
|
122 | 122 | $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); |
123 | 123 | } |
124 | 124 |