@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | { |
36 | 36 | // save the form values and validation status to the session |
37 | 37 | $page->isFormBuilt() or $page->buildForm(); |
38 | - $pageName = $page->getAttribute('id'); |
|
39 | - $data =& $page->controller->container(); |
|
38 | + $pageName = $page->getAttribute('id'); |
|
39 | + $data = & $page->controller->container(); |
|
40 | 40 | $data['values'][$pageName] = $page->exportValues(); |
41 | 41 | if (!$page->controller->isModal()) { |
42 | 42 | if (PEAR::isError($valid = $page->validate())) { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | return $page->handle('jump'); |
54 | 54 | // |
55 | 55 | } else { |
56 | - $prev =& $page->controller->getPage($prevName); |
|
56 | + $prev = & $page->controller->getPage($prevName); |
|
57 | 57 | // Modified by Chamilo team, 16-MAR-2010. |
58 | 58 | //$prev->handle('jump'); |
59 | 59 | return $prev->handle('jump'); |
@@ -45,13 +45,13 @@ |
||
45 | 45 | // If the controller is "modal" we should not allow direct access to a page |
46 | 46 | // unless all previous pages are valid (see also bug #2323) |
47 | 47 | if ($page->controller->isModal() && !$page->controller->isValid($page->getAttribute('id'))) { |
48 | - $target =& $page->controller->getPage($page->controller->findInvalid()); |
|
48 | + $target = & $page->controller->getPage($page->controller->findInvalid()); |
|
49 | 49 | // Modified by Chamilo team, 16-MAR-2010. |
50 | 50 | //$target->handle('jump'); |
51 | 51 | return $target->handle('jump'); |
52 | 52 | // |
53 | 53 | } |
54 | - $data =& $page->controller->container(); |
|
54 | + $data = & $page->controller->container(); |
|
55 | 55 | if (!empty($data['values'][$pageName])) { |
56 | 56 | $page->loadValues($data['values'][$pageName]); |
57 | 57 | $validate = false === $data['valid'][$pageName]; |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | { |
36 | 36 | // save the form values and validation status to the session |
37 | 37 | $page->isFormBuilt() or $page->buildForm(); |
38 | - $pageName = $page->getAttribute('id'); |
|
39 | - $data =& $page->controller->container(); |
|
38 | + $pageName = $page->getAttribute('id'); |
|
39 | + $data = & $page->controller->container(); |
|
40 | 40 | $data['values'][$pageName] = $page->exportValues(); |
41 | 41 | if (PEAR::isError($valid = $page->validate())) { |
42 | 42 | return $valid; |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | } |
50 | 50 | // More pages? |
51 | 51 | if (null !== ($nextName = $page->controller->getNextName($pageName))) { |
52 | - $next =& $page->controller->getPage($nextName); |
|
52 | + $next = & $page->controller->getPage($nextName); |
|
53 | 53 | // Modified by Chamilo team, 16-MAR-2010. |
54 | 54 | //$next->handle('jump'); |
55 | 55 | return $next->handle('jump'); |
56 | 56 | // |
57 | 57 | // Consider this a 'finish' button, if there is no explicit one |
58 | - } elseif($page->controller->isModal()) { |
|
58 | + } elseif ($page->controller->isModal()) { |
|
59 | 59 | if ($page->controller->isValid()) { |
60 | 60 | // Modified by Chamilo team, 16-MAR-2010. |
61 | 61 | //$page->handle('process'); |
@@ -38,15 +38,15 @@ |
||
38 | 38 | { |
39 | 39 | // save the form values and validation status to the session |
40 | 40 | $page->isFormBuilt() or $page->buildForm(); |
41 | - $pageName = $page->getAttribute('id'); |
|
42 | - $data =& $page->controller->container(); |
|
41 | + $pageName = $page->getAttribute('id'); |
|
42 | + $data = & $page->controller->container(); |
|
43 | 43 | $data['values'][$pageName] = $page->exportValues(); |
44 | 44 | if (PEAR::isError($valid = $page->validate())) { |
45 | 45 | return $valid; |
46 | 46 | } |
47 | 47 | $data['valid'][$pageName] = $valid; |
48 | 48 | |
49 | - $target =& $page->controller->getPage($actionName); |
|
49 | + $target = & $page->controller->getPage($actionName); |
|
50 | 50 | if (PEAR::isError($target)) { |
51 | 51 | return $target; |
52 | 52 | } else { |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | { |
36 | 36 | // save the form values and validation status to the session |
37 | 37 | $page->isFormBuilt() or $page->buildForm(); |
38 | - $pageName = $page->getAttribute('id'); |
|
39 | - $data =& $page->controller->container(); |
|
38 | + $pageName = $page->getAttribute('id'); |
|
39 | + $data = & $page->controller->container(); |
|
40 | 40 | $data['values'][$pageName] = $page->exportValues(); |
41 | 41 | if (PEAR::isError($valid = $page->validate())) { |
42 | 42 | return $valid; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | // Some other page is invalid, redirect to it |
61 | 61 | } else { |
62 | - $target =& $page->controller->getPage($page->controller->findInvalid()); |
|
62 | + $target = & $page->controller->getPage($page->controller->findInvalid()); |
|
63 | 63 | // Modified by Chamilo team, 16-MAR-2010. |
64 | 64 | //$target->handle('jump'); |
65 | 65 | return $target->handle('jump'); |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * @access public |
16 | 16 | * @return void |
17 | 17 | */ |
18 | - public function __construct($elementName=null, $value=null, $attributes=null) |
|
18 | + public function __construct($elementName = null, $value = null, $attributes = null) |
|
19 | 19 | { |
20 | 20 | parent::__construct($elementName, null, $attributes); |
21 | 21 | $this->setValue($value); |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | function toHtml() |
117 | 117 | { |
118 | 118 | // prevent problems with grouped elements |
119 | - $arrayName = str_replace(array('[', ']'), array('__', ''), $this->getName()) . '_values'; |
|
119 | + $arrayName = str_replace(array('[', ']'), array('__', ''), $this->getName()).'_values'; |
|
120 | 120 | |
121 | 121 | $this->updateAttributes(array( |
122 | - 'onkeypress' => 'return autocomplete(this, event, ' . $arrayName . ');' |
|
122 | + 'onkeypress' => 'return autocomplete(this, event, '.$arrayName.');' |
|
123 | 123 | )); |
124 | 124 | if ($this->_flagFrozen) { |
125 | 125 | $js = ''; |
@@ -239,13 +239,13 @@ discard block |
||
239 | 239 | ); |
240 | 240 | |
241 | 241 | $js .= $this->_js; |
242 | - $js .= 'var ' . $arrayName . " = new Array();\n"; |
|
242 | + $js .= 'var '.$arrayName." = new Array();\n"; |
|
243 | 243 | for ($i = 0; $i < count($this->_options); $i++) { |
244 | - $js .= $arrayName . '[' . $i . "] = '" . strtr($this->_options[$i], $jsEscape) . "';\n"; |
|
244 | + $js .= $arrayName.'['.$i."] = '".strtr($this->_options[$i], $jsEscape)."';\n"; |
|
245 | 245 | } |
246 | 246 | $js .= "//]]>\n</script>"; |
247 | 247 | } |
248 | - return $js . parent::toHtml(); |
|
248 | + return $js.parent::toHtml(); |
|
249 | 249 | }// end func toHtml |
250 | 250 | |
251 | 251 | // }}} |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * The object being generated |
42 | 42 | * @var QuickformForm |
43 | 43 | */ |
44 | - var $_obj= null; |
|
44 | + var $_obj = null; |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Number of sections in the form (i.e. number of headers in it) |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $this->_obj->requirednote = $form->getRequiredNote(); |
122 | 122 | $this->_obj->errors = new StdClass; |
123 | 123 | |
124 | - if($this->_collectHidden) { |
|
124 | + if ($this->_collectHidden) { |
|
125 | 125 | $this->_obj->hidden = ''; |
126 | 126 | } |
127 | 127 | $this->_elementIdx = 1; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | function renderElement(&$element, $required, $error) |
141 | 141 | { |
142 | 142 | $elObj = $this->_elementToObject($element, $required, $error); |
143 | - if(!empty($error)) { |
|
143 | + if (!empty($error)) { |
|
144 | 144 | $name = $elObj->name; |
145 | 145 | $this->_obj->errors->$name = $error; |
146 | 146 | } |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | |
150 | 150 | function renderHidden(&$element) |
151 | 151 | { |
152 | - if($this->_collectHidden) { |
|
153 | - $this->_obj->hidden .= $element->toHtml() . "\n"; |
|
152 | + if ($this->_collectHidden) { |
|
153 | + $this->_obj->hidden .= $element->toHtml()."\n"; |
|
154 | 154 | } else { |
155 | 155 | $this->renderElement($element, false, null); |
156 | 156 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | function startGroup(&$group, $required, $error) |
160 | 160 | { |
161 | 161 | $this->_currentGroup = $this->_elementToObject($group, $required, $error); |
162 | - if(!empty($error)) { |
|
162 | + if (!empty($error)) { |
|
163 | 163 | $name = $this->_currentGroup->name; |
164 | 164 | $this->_obj->errors->$name = $error; |
165 | 165 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | function _elementToObject(&$element, $required, $error) |
184 | 184 | { |
185 | - if($this->_elementType) { |
|
185 | + if ($this->_elementType) { |
|
186 | 186 | $ret = new $this->_elementType; |
187 | 187 | } |
188 | 188 | $ret->name = $element->getName(); |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | if (is_array($labels)) { |
194 | 194 | $ret->label = array_shift($labels); |
195 | 195 | foreach ($labels as $key => $label) { |
196 | - $key = is_int($key)? $key + 2: $key; |
|
197 | - $ret->{'label_' . $key} = $label; |
|
196 | + $key = is_int($key) ? $key + 2 : $key; |
|
197 | + $ret->{'label_'.$key} = $label; |
|
198 | 198 | } |
199 | 199 | } else { |
200 | 200 | $ret->label = $labels; |
@@ -202,11 +202,11 @@ discard block |
||
202 | 202 | $ret->required = $required; |
203 | 203 | $ret->error = $error; |
204 | 204 | |
205 | - if(isset($this->_elementStyles[$ret->name])) { |
|
205 | + if (isset($this->_elementStyles[$ret->name])) { |
|
206 | 206 | $ret->style = $this->_elementStyles[$ret->name]; |
207 | - $ret->styleTemplate = "styles/". $ret->style .".html"; |
|
207 | + $ret->styleTemplate = "styles/".$ret->style.".html"; |
|
208 | 208 | } |
209 | - if($ret->type == 'group') { |
|
209 | + if ($ret->type == 'group') { |
|
210 | 210 | $ret->separator = $element->_separator; |
211 | 211 | $ret->elements = array(); |
212 | 212 | } else { |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | function _storeObject($elObj) |
226 | 226 | { |
227 | 227 | $name = $elObj->name; |
228 | - if(is_object($this->_currentGroup) && $elObj->type != 'group') { |
|
228 | + if (is_object($this->_currentGroup) && $elObj->type != 'group') { |
|
229 | 229 | $this->_currentGroup->elements[] = $elObj; |
230 | 230 | } elseif (isset($this->_currentSection)) { |
231 | 231 | $this->_obj->sections[$this->_currentSection]->elements[] = $elObj; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | function setElementStyle($elementName, $styleName = null) |
238 | 238 | { |
239 | - if(is_array($elementName)) { |
|
239 | + if (is_array($elementName)) { |
|
240 | 240 | $this->_elementStyles = array_merge($this->_elementStyles, $elementName); |
241 | 241 | } else { |
242 | 242 | $this->_elementStyles[$elementName] = $styleName; |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | */ |
330 | 330 | function outputHeader() |
331 | 331 | { |
332 | - return "<form " . $this->attributes . ">\n"; |
|
332 | + return "<form ".$this->attributes.">\n"; |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | function outputStyle() |
448 | 448 | { |
449 | 449 | ob_start(); |
450 | - HTML_Template_Flexy::staticQuickTemplate('styles/' . $this->style . '.html', $this); |
|
450 | + HTML_Template_Flexy::staticQuickTemplate('styles/'.$this->style.'.html', $this); |
|
451 | 451 | $ret = ob_get_contents(); |
452 | 452 | ob_end_clean(); |
453 | 453 | return $ret; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | function HTML_QuickForm_Renderer_ITStatic(&$tpl) |
111 | 111 | { |
112 | 112 | $this->HTML_QuickForm_Renderer(); |
113 | - $this->_tpl =& $tpl; |
|
113 | + $this->_tpl = & $tpl; |
|
114 | 114 | } // end constructor |
115 | 115 | |
116 | 116 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | } |
155 | 155 | // add hidden elements, if collected |
156 | 156 | if (!empty($this->_hidden)) { |
157 | - $this->_tpl->setVariable($this->_formName . '_hidden', $this->_hidden); |
|
157 | + $this->_tpl->setVariable($this->_formName.'_hidden', $this->_hidden); |
|
158 | 158 | } |
159 | 159 | // assign form attributes |
160 | 160 | $this->_tpl->setVariable($this->_formName.'_attributes', $form->getAttributes(true)); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $this->_elementIndex++; |
204 | 204 | } |
205 | 205 | if ($varName != $this->_inGroup) { |
206 | - $varName .= '_' == substr($varName, -1)? '': '_'; |
|
206 | + $varName .= '_' == substr($varName, -1) ? '' : '_'; |
|
207 | 207 | // element name is of type : group[name] |
208 | 208 | $label = $element->getLabel(); |
209 | 209 | $html = $element->toHtml(); |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | */ |
267 | 267 | function renderHidden(&$element) |
268 | 268 | { |
269 | - if ($this->_tpl->placeholderExists($this->_formName . '_hidden')) { |
|
269 | + if ($this->_tpl->placeholderExists($this->_formName.'_hidden')) { |
|
270 | 270 | $this->_hidden .= $element->toHtml(); |
271 | 271 | } else { |
272 | 272 | $name = $element->getName(); |
@@ -307,14 +307,14 @@ discard block |
||
307 | 307 | // <!-- BEGIN form_group_error -->{form_group_error}<!-- END form_group_error --> |
308 | 308 | if (!empty($error)) { |
309 | 309 | if ($this->_tpl->placeholderExists($varName.'_error')) { |
310 | - if ($this->_tpl->blockExists($this->_formName . '_error_block')) { |
|
311 | - $this->_tpl->setVariable($this->_formName . '_error', $error); |
|
312 | - $error = $this->_getTplBlock($this->_formName . '_error_block'); |
|
310 | + if ($this->_tpl->blockExists($this->_formName.'_error_block')) { |
|
311 | + $this->_tpl->setVariable($this->_formName.'_error', $error); |
|
312 | + $error = $this->_getTplBlock($this->_formName.'_error_block'); |
|
313 | 313 | } elseif (strpos($this->_error, '{html}') !== false || strpos($this->_error, '{label}') !== false) { |
314 | 314 | $error = str_replace('{error}', $error, $this->_error); |
315 | 315 | } |
316 | 316 | } |
317 | - $this->_tpl->setVariable($varName . '_error', $error); |
|
317 | + $this->_tpl->setVariable($varName.'_error', $error); |
|
318 | 318 | array_pop($this->_errors); |
319 | 319 | } |
320 | 320 | } |
@@ -401,17 +401,17 @@ discard block |
||
401 | 401 | */ |
402 | 402 | function _renderRequired(&$label, &$html) |
403 | 403 | { |
404 | - if ($this->_tpl->blockExists($tplBlock = $this->_formName . '_required_block')) { |
|
405 | - if (!empty($label) && $this->_tpl->placeholderExists($this->_formName . '_label', $tplBlock)) { |
|
406 | - $this->_tpl->setVariable($this->_formName . '_label', is_array($label)? $label[0]: $label); |
|
404 | + if ($this->_tpl->blockExists($tplBlock = $this->_formName.'_required_block')) { |
|
405 | + if (!empty($label) && $this->_tpl->placeholderExists($this->_formName.'_label', $tplBlock)) { |
|
406 | + $this->_tpl->setVariable($this->_formName.'_label', is_array($label) ? $label[0] : $label); |
|
407 | 407 | if (is_array($label)) { |
408 | 408 | $label[0] = $this->_getTplBlock($tplBlock); |
409 | 409 | } else { |
410 | 410 | $label = $this->_getTplBlock($tplBlock); |
411 | 411 | } |
412 | 412 | } |
413 | - if (!empty($html) && $this->_tpl->placeholderExists($this->_formName . '_html', $tplBlock)) { |
|
414 | - $this->_tpl->setVariable($this->_formName . '_html', $html); |
|
413 | + if (!empty($html) && $this->_tpl->placeholderExists($this->_formName.'_html', $tplBlock)) { |
|
414 | + $this->_tpl->setVariable($this->_formName.'_html', $html); |
|
415 | 415 | $html = $this->_getTplBlock($tplBlock); |
416 | 416 | } |
417 | 417 | } else { |
@@ -444,21 +444,21 @@ discard block |
||
444 | 444 | */ |
445 | 445 | function _renderError(&$label, &$html, $error) |
446 | 446 | { |
447 | - if ($this->_tpl->blockExists($tplBlock = $this->_formName . '_error_block')) { |
|
448 | - $this->_tpl->setVariable($this->_formName . '_error', $error); |
|
449 | - if (!empty($label) && $this->_tpl->placeholderExists($this->_formName . '_label', $tplBlock)) { |
|
450 | - $this->_tpl->setVariable($this->_formName . '_label', is_array($label)? $label[0]: $label); |
|
447 | + if ($this->_tpl->blockExists($tplBlock = $this->_formName.'_error_block')) { |
|
448 | + $this->_tpl->setVariable($this->_formName.'_error', $error); |
|
449 | + if (!empty($label) && $this->_tpl->placeholderExists($this->_formName.'_label', $tplBlock)) { |
|
450 | + $this->_tpl->setVariable($this->_formName.'_label', is_array($label) ? $label[0] : $label); |
|
451 | 451 | if (is_array($label)) { |
452 | 452 | $label[0] = $this->_getTplBlock($tplBlock); |
453 | 453 | } else { |
454 | 454 | $label = $this->_getTplBlock($tplBlock); |
455 | 455 | } |
456 | - } elseif (!empty($html) && $this->_tpl->placeholderExists($this->_formName . '_html', $tplBlock)) { |
|
457 | - $this->_tpl->setVariable($this->_formName . '_html', $html); |
|
456 | + } elseif (!empty($html) && $this->_tpl->placeholderExists($this->_formName.'_html', $tplBlock)) { |
|
457 | + $this->_tpl->setVariable($this->_formName.'_html', $html); |
|
458 | 458 | $html = $this->_getTplBlock($tplBlock); |
459 | 459 | } |
460 | 460 | // clean up after ourselves |
461 | - $this->_tpl->setVariable($this->_formName . '_error', null); |
|
461 | + $this->_tpl->setVariable($this->_formName.'_error', null); |
|
462 | 462 | } elseif (!empty($label) && strpos($this->_error, '{label}') !== false) { |
463 | 463 | if (is_array($label)) { |
464 | 464 | $label[0] = str_replace(array('{label}', '{error}'), array($label[0], $error), $this->_error); |