@@ -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'); |
@@ -73,15 +73,15 @@ |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | - /** |
|
77 | - * Actually outputs the form. |
|
78 | - * |
|
79 | - * If you want to customize the form's appearance (you most certainly will), |
|
80 | - * then you should override this method. There is no need to override perform() |
|
81 | - * |
|
82 | - * @access private |
|
83 | - * @param HTML_QuickForm_Page the page being processed |
|
84 | - */ |
|
76 | + /** |
|
77 | + * Actually outputs the form. |
|
78 | + * |
|
79 | + * If you want to customize the form's appearance (you most certainly will), |
|
80 | + * then you should override this method. There is no need to override perform() |
|
81 | + * |
|
82 | + * @access private |
|
83 | + * @param HTML_QuickForm_Page the page being processed |
|
84 | + */ |
|
85 | 85 | function _renderForm(&$page) |
86 | 86 | { |
87 | 87 | $page->display(); |
@@ -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); |
@@ -60,7 +60,7 @@ |
||
60 | 60 | * Freeze the element so that only its value is returned |
61 | 61 | * |
62 | 62 | * @access public |
63 | - * @return void |
|
63 | + * @return boolean |
|
64 | 64 | */ |
65 | 65 | function freeze() |
66 | 66 | { |
@@ -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 | // }}} |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | class HTML_QuickForm_Renderer_ObjectFlexy extends HTML_QuickForm_Renderer_Object |
52 | 52 | { |
53 | - /**#@+ |
|
53 | + /**#@+ |
|
54 | 54 | * @access private |
55 | 55 | */ |
56 | 56 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @var string $_elementType |
92 | 92 | */ |
93 | 93 | var $_elementType = 'QuickformFlexyElement'; |
94 | - /**#@-*/ |
|
94 | + /**#@-*/ |
|
95 | 95 | |
96 | 96 | /** |
97 | 97 | * Constructor |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | { |
104 | 104 | $this->HTML_QuickForm_Renderer_Object(true); |
105 | 105 | $this->_obj = new QuickformFlexyForm(); |
106 | - $this->_flexy =& $flexy; |
|
106 | + $this->_flexy = & $flexy; |
|
107 | 107 | } // end constructor |
108 | 108 | |
109 | 109 | function renderHeader(&$header) |
110 | 110 | { |
111 | - if($name = $header->getName()) { |
|
111 | + if ($name = $header->getName()) { |
|
112 | 112 | $this->_obj->header->$name = $header->toHtml(); |
113 | 113 | } else { |
114 | 114 | $this->_obj->header[$this->_sectionCount] = $header->toHtml(); |
@@ -135,15 +135,15 @@ discard block |
||
135 | 135 | function _elementToObject(&$element, $required, $error) |
136 | 136 | { |
137 | 137 | $ret = parent::_elementToObject($element, $required, $error); |
138 | - if($ret->type == 'group') { |
|
138 | + if ($ret->type == 'group') { |
|
139 | 139 | $ret->html = $element->toHtml(); |
140 | 140 | unset($ret->elements); |
141 | 141 | } |
142 | - if(!empty($this->_label)) { |
|
142 | + if (!empty($this->_label)) { |
|
143 | 143 | $this->_renderLabel($ret); |
144 | 144 | } |
145 | 145 | |
146 | - if(!empty($this->_html)) { |
|
146 | + if (!empty($this->_html)) { |
|
147 | 147 | $this->_renderHtml($ret); |
148 | 148 | $ret->error = $error; |
149 | 149 | } |
@@ -151,12 +151,12 @@ discard block |
||
151 | 151 | // Create an element key from the name |
152 | 152 | if (false !== ($pos = strpos($ret->name, '[')) || is_object($this->_currentGroup)) { |
153 | 153 | if (!$pos) { |
154 | - $keys = '->{\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret->name) . '\'}'; |
|
154 | + $keys = '->{\''.str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret->name).'\'}'; |
|
155 | 155 | } else { |
156 | - $keys = '->{\'' . str_replace( |
|
156 | + $keys = '->{\''.str_replace( |
|
157 | 157 | array('\\', '\'', '[', ']'), array('\\\\', '\\\'', '\'}->{\'', ''), |
158 | 158 | $ret->name |
159 | - ) . '\'}'; |
|
159 | + ).'\'}'; |
|
160 | 160 | } |
161 | 161 | // special handling for elements in native groups |
162 | 162 | if (is_object($this->_currentGroup)) { |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | } |
172 | 172 | } |
173 | 173 | } elseif (0 == strlen($ret->name)) { |
174 | - $keys = '->{\'element_' . $this->_elementIdx . '\'}'; |
|
174 | + $keys = '->{\'element_'.$this->_elementIdx.'\'}'; |
|
175 | 175 | } else { |
176 | - $keys = '->{\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret->name) . '\'}'; |
|
176 | + $keys = '->{\''.str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret->name).'\'}'; |
|
177 | 177 | } |
178 | 178 | // for radios: add extra key from value |
179 | 179 | if ('radio' == $ret->type && '[]' != substr($keys, -2)) { |
180 | - $keys .= '->{\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret->value) . '\'}'; |
|
180 | + $keys .= '->{\''.str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret->value).'\'}'; |
|
181 | 181 | } |
182 | 182 | $ret->keys = $keys; |
183 | 183 | $this->_elementIdx++; |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | if ($elObj) { |
198 | 198 | $keys = $elObj->keys; |
199 | 199 | unset($elObj->keys); |
200 | - if(is_object($this->_currentGroup) && ('group' != $elObj->type)) { |
|
201 | - $code = '$this->_currentGroup' . $keys . ' = $elObj;'; |
|
200 | + if (is_object($this->_currentGroup) && ('group' != $elObj->type)) { |
|
201 | + $code = '$this->_currentGroup'.$keys.' = $elObj;'; |
|
202 | 202 | } else { |
203 | - $code = '$this->_obj' . $keys . ' = $elObj;'; |
|
203 | + $code = '$this->_obj'.$keys.' = $elObj;'; |
|
204 | 204 | } |
205 | 205 | eval($code); |
206 | 206 | } |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | foreach (array_keys($this->renderedElements) as $key) { |
79 | 79 | if (!$this->renderedElements[$key]['rendered']) { |
80 | 80 | $this->renderedElements[$key]['rendered'] = true; |
81 | - $data .= $this->renderedElements[$key]['html'] . "\n"; |
|
81 | + $data .= $this->renderedElements[$key]['html']."\n"; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | 85 | // Insert the extra data and form elements at the end of the form |
86 | - $this->_html = str_replace('</form>', $data . "\n</form>", $this->_html); |
|
86 | + $this->_html = str_replace('</form>', $data."\n</form>", $this->_html); |
|
87 | 87 | return $this->_html; |
88 | 88 | } // end func toHtml |
89 | 89 | |
@@ -117,13 +117,11 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | if (is_null($elementKey)) { |
120 | - $msg = is_null($elementValue) ? "Element $elementName does not exist." : |
|
121 | - "Element $elementName with value of $elementValue does not exist."; |
|
120 | + $msg = is_null($elementValue) ? "Element $elementName does not exist." : "Element $elementName with value of $elementValue does not exist."; |
|
122 | 121 | return PEAR::raiseError(null, QUICKFORM_UNREGISTERED_ELEMENT, null, E_USER_WARNING, $msg, 'HTML_QuickForm_Error', true); |
123 | 122 | } else { |
124 | 123 | if ($this->renderedElements[$elementKey]['rendered']) { |
125 | - $msg = is_null($elementValue) ? "Element $elementName has already been rendered." : |
|
126 | - "Element $elementName with value of $elementValue has already been rendered."; |
|
124 | + $msg = is_null($elementValue) ? "Element $elementName has already been rendered." : "Element $elementName with value of $elementValue has already been rendered."; |
|
127 | 125 | return PEAR::raiseError(null, QUICKFORM_ERROR, null, E_USER_WARNING, $msg, 'HTML_QuickForm_Error', true); |
128 | 126 | } else { |
129 | 127 | $this->renderedElements[$elementKey]['rendered'] = true; |