@@ -186,6 +186,8 @@ |
||
186 | 186 | * Parse the pair of values into the appropriate value type. |
187 | 187 | * @param string value one |
188 | 188 | * @param string second value |
189 | + * @param string $value1 |
|
190 | + * @param string $value2 |
|
189 | 191 | * @return array appropriate type of the value pair, array($value1, $value2); |
190 | 192 | */ |
191 | 193 | protected function getComparisonValues($value1, $value2) |
@@ -124,9 +124,9 @@ |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
127 | - * Sets the date format for a date validation |
|
128 | - * @param string the date format value |
|
129 | - */ |
|
127 | + * Sets the date format for a date validation |
|
128 | + * @param string the date format value |
|
129 | + */ |
|
130 | 130 | public function setDateFormat($value) |
131 | 131 | { |
132 | 132 | $this->setViewState('DateFormat', $value, ''); |
@@ -163,8 +163,7 @@ discard block |
||
163 | 163 | if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
164 | 164 | $this->copyFile($fullpath,$dst); |
165 | 165 | return $this->_published[$path]=$this->_baseUrl.'/'.$dir.'/'.$fileName; |
166 | - } |
|
167 | - else |
|
166 | + } else |
|
168 | 167 | { |
169 | 168 | $dir=$this->hash($fullpath); |
170 | 169 | if(!is_dir($this->_basePath.DIRECTORY_SEPARATOR.$dir) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
@@ -287,8 +286,7 @@ discard block |
||
287 | 286 | @copy($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file); |
288 | 287 | @chmod($dst.DIRECTORY_SEPARATOR.$file, PRADO_CHMOD); |
289 | 288 | } |
290 | - } |
|
291 | - else |
|
289 | + } else |
|
292 | 290 | $this->copyDirectory($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file); |
293 | 291 | } |
294 | 292 | closedir($folder); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function getDataType() |
62 | 62 | { |
63 | - return $this->getViewState('DataType',TValidationDataType::String); |
|
63 | + return $this->getViewState('DataType', TValidationDataType::String); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function setDataType($value) |
72 | 72 | { |
73 | - $this->setViewState('DataType',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TValidationDataType'),TValidationDataType::String); |
|
73 | + $this->setViewState('DataType', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TValidationDataType'), TValidationDataType::String); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function getControlToCompare() |
80 | 80 | { |
81 | - return $this->getViewState('ControlToCompare',''); |
|
81 | + return $this->getViewState('ControlToCompare', ''); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function setControlToCompare($value) |
89 | 89 | { |
90 | - $this->setViewState('ControlToCompare',$value,''); |
|
90 | + $this->setViewState('ControlToCompare', $value, ''); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function getValueToCompare() |
97 | 97 | { |
98 | - return $this->getViewState('ValueToCompare',''); |
|
98 | + return $this->getViewState('ValueToCompare', ''); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function setValueToCompare($value) |
106 | 106 | { |
107 | - $this->setViewState('ValueToCompare',$value,''); |
|
107 | + $this->setViewState('ValueToCompare', $value, ''); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function getOperator() |
114 | 114 | { |
115 | - return $this->getViewState('Operator',TValidationCompareOperator::Equal); |
|
115 | + return $this->getViewState('Operator', TValidationCompareOperator::Equal); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function setOperator($value) |
123 | 123 | { |
124 | - $this->setViewState('Operator',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TValidationCompareOperator'),TValidationCompareOperator::Equal); |
|
124 | + $this->setViewState('Operator', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TValidationCompareOperator'), TValidationCompareOperator::Equal); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -163,13 +163,13 @@ discard block |
||
163 | 163 | else |
164 | 164 | $value2=$this->getValueToCompare(); |
165 | 165 | |
166 | - $values = $this->getComparisonValues($value, $value2); |
|
166 | + $values=$this->getComparisonValues($value, $value2); |
|
167 | 167 | switch($this->getOperator()) |
168 | 168 | { |
169 | 169 | case TValidationCompareOperator::Equal: |
170 | - return $values[0] == $values[1]; |
|
170 | + return $values[0]==$values[1]; |
|
171 | 171 | case TValidationCompareOperator::NotEqual: |
172 | - return $values[0] != $values[1]; |
|
172 | + return $values[0]!=$values[1]; |
|
173 | 173 | case TValidationCompareOperator::GreaterThan: |
174 | 174 | return $values[0] > $values[1]; |
175 | 175 | case TValidationCompareOperator::GreaterThanEqual: |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | case TValidationDataType::Float: |
199 | 199 | return array(floatval($value1), floatval($value2)); |
200 | 200 | case TValidationDataType::Date: |
201 | - $dateFormat = $this->getDateFormat(); |
|
201 | + $dateFormat=$this->getDateFormat(); |
|
202 | 202 | if($dateFormat!=='') |
203 | 203 | { |
204 | - $formatter = new TSimpleDateFormatter($dateFormat); |
|
204 | + $formatter=new TSimpleDateFormatter($dateFormat); |
|
205 | 205 | return array($formatter->parse($value1), $formatter->parse($value2)); |
206 | 206 | } |
207 | 207 | else |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | */ |
217 | 217 | protected function getClientScriptOptions() |
218 | 218 | { |
219 | - $options = parent::getClientScriptOptions(); |
|
219 | + $options=parent::getClientScriptOptions(); |
|
220 | 220 | if(($name=$this->getControlToCompare())!=='') |
221 | 221 | { |
222 | 222 | if(($control=$this->findControl($name))!==null) |
@@ -281,6 +281,7 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @param string the name of the viewstate value to be returned |
283 | 283 | * @param mixed the default value. If $key is not found in viewstate, $defaultValue will be returned |
284 | + * @param string $key |
|
284 | 285 | * @return mixed the viewstate value corresponding to $key |
285 | 286 | */ |
286 | 287 | protected function getViewState($key,$defaultValue=null) |
@@ -295,6 +296,7 @@ discard block |
||
295 | 296 | * @param string the name of the viewstate value |
296 | 297 | * @param mixed the viewstate value to be set |
297 | 298 | * @param mixed default value. If $value===$defaultValue, the item will be cleared from the viewstate. |
299 | + * @param string $key |
|
298 | 300 | */ |
299 | 301 | protected function setViewState($key,$value,$defaultValue=null) |
300 | 302 | { |
@@ -356,6 +358,7 @@ discard block |
||
356 | 358 | * If the data is a component, the field is used as the name of a property. |
357 | 359 | * @param mixed data containing the field of value |
358 | 360 | * @param string the data field |
361 | + * @param string $field |
|
359 | 362 | * @return mixed data value at the specified field |
360 | 363 | * @throws TInvalidDataValueException if the data or the field is invalid. |
361 | 364 | */ |
@@ -515,6 +518,7 @@ discard block |
||
515 | 518 | * as the first and second parameters in {@link sprintf}. |
516 | 519 | * @param string format string |
517 | 520 | * @param mixed the data to be formatted |
521 | + * @param string $formatString |
|
518 | 522 | * @return string the formatted result |
519 | 523 | */ |
520 | 524 | protected function formatDataValue($formatString,$value) |
@@ -432,8 +432,7 @@ discard block |
||
432 | 432 | } |
433 | 433 | $control->setData($text); |
434 | 434 | } |
435 | - } |
|
436 | - else if($this->getAllowSorting()) |
|
435 | + } else if($this->getAllowSorting()) |
|
437 | 436 | { |
438 | 437 | $sortExpression=$this->getSortExpression(); |
439 | 438 | if(($url=$this->getHeaderImageUrl())!=='') |
@@ -446,8 +445,7 @@ discard block |
||
446 | 445 | $button->setAlternateText($text); |
447 | 446 | $button->setCausesValidation(false); |
448 | 447 | $cell->getControls()->add($button); |
449 | - } |
|
450 | - else if($text!=='') |
|
448 | + } else if($text!=='') |
|
451 | 449 | { |
452 | 450 | $button=Prado::createComponent('\\Prado\\Web\\UI\\WebControls\\TLinkButton'); |
453 | 451 | $button->setText($text); |
@@ -455,11 +453,9 @@ discard block |
||
455 | 453 | $button->setCommandParameter($sortExpression); |
456 | 454 | $button->setCausesValidation(false); |
457 | 455 | $cell->getControls()->add($button); |
458 | - } |
|
459 | - else |
|
456 | + } else |
|
460 | 457 | $cell->setText(' '); |
461 | - } |
|
462 | - else |
|
458 | + } else |
|
463 | 459 | { |
464 | 460 | if(($url=$this->getHeaderImageUrl())!=='') |
465 | 461 | { |
@@ -468,8 +464,7 @@ discard block |
||
468 | 464 | if($text!=='') |
469 | 465 | $image->setAlternateText($text); |
470 | 466 | $cell->getControls()->add($image); |
471 | - } |
|
472 | - else if($text!=='') |
|
467 | + } else if($text!=='') |
|
473 | 468 | $cell->setText($text); |
474 | 469 | else |
475 | 470 | $cell->setText(' '); |
@@ -503,8 +498,7 @@ discard block |
||
503 | 498 | } |
504 | 499 | $control->setData($text); |
505 | 500 | } |
506 | - } |
|
507 | - else if($text!=='') |
|
501 | + } else if($text!=='') |
|
508 | 502 | $cell->setText($text); |
509 | 503 | else |
510 | 504 | $cell->setText(' '); |
@@ -534,13 +528,11 @@ discard block |
||
534 | 528 | if(eval("\$result=$expression;")===false) |
535 | 529 | throw new Exception(''); |
536 | 530 | return $result; |
537 | - } |
|
538 | - catch(Exception $e) |
|
531 | + } catch(Exception $e) |
|
539 | 532 | { |
540 | 533 | throw new TInvalidDataValueException('datagridcolumn_expression_invalid',get_class($this),$expression,$e->getMessage()); |
541 | 534 | } |
542 | - } |
|
543 | - else |
|
535 | + } else |
|
544 | 536 | return sprintf($formatString,$value); |
545 | 537 | } |
546 | 538 | } |
547 | 539 | \ No newline at end of file |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function setID($value) |
90 | 90 | { |
91 | - if(!preg_match(TControl::ID_FORMAT,$value)) |
|
92 | - throw new TInvalidDataValueException('datagridcolumn_id_invalid',get_class($this),$value); |
|
91 | + if(!preg_match(TControl::ID_FORMAT, $value)) |
|
92 | + throw new TInvalidDataValueException('datagridcolumn_id_invalid', get_class($this), $value); |
|
93 | 93 | $this->_id=$value; |
94 | 94 | } |
95 | 95 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function getHeaderText() |
100 | 100 | { |
101 | - return $this->getViewState('HeaderText',''); |
|
101 | + return $this->getViewState('HeaderText', ''); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function setHeaderText($value) |
108 | 108 | { |
109 | - $this->setViewState('HeaderText',$value,''); |
|
109 | + $this->setViewState('HeaderText', $value, ''); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function getHeaderImageUrl() |
116 | 116 | { |
117 | - return $this->getViewState('HeaderImageUrl',''); |
|
117 | + return $this->getViewState('HeaderImageUrl', ''); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function setHeaderImageUrl($value) |
124 | 124 | { |
125 | - $this->setViewState('HeaderImageUrl',$value,''); |
|
125 | + $this->setViewState('HeaderImageUrl', $value, ''); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function getHeaderRenderer() |
133 | 133 | { |
134 | - return $this->getViewState('HeaderRenderer',''); |
|
134 | + return $this->getViewState('HeaderRenderer', ''); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function setHeaderRenderer($value) |
148 | 148 | { |
149 | - $this->setViewState('HeaderRenderer',$value,''); |
|
149 | + $this->setViewState('HeaderRenderer', $value, ''); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -155,10 +155,10 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function getHeaderStyle($createStyle=true) |
157 | 157 | { |
158 | - if(($style=$this->getViewState('HeaderStyle',null))===null && $createStyle) |
|
158 | + if(($style=$this->getViewState('HeaderStyle', null))===null && $createStyle) |
|
159 | 159 | { |
160 | 160 | $style=new TTableItemStyle; |
161 | - $this->setViewState('HeaderStyle',$style,null); |
|
161 | + $this->setViewState('HeaderStyle', $style, null); |
|
162 | 162 | } |
163 | 163 | return $style; |
164 | 164 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | */ |
169 | 169 | public function getFooterText() |
170 | 170 | { |
171 | - return $this->getViewState('FooterText',''); |
|
171 | + return $this->getViewState('FooterText', ''); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public function setFooterText($value) |
178 | 178 | { |
179 | - $this->setViewState('FooterText',$value,''); |
|
179 | + $this->setViewState('FooterText', $value, ''); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function getFooterRenderer() |
187 | 187 | { |
188 | - return $this->getViewState('FooterRenderer',''); |
|
188 | + return $this->getViewState('FooterRenderer', ''); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function setFooterRenderer($value) |
202 | 202 | { |
203 | - $this->setViewState('FooterRenderer',$value,''); |
|
203 | + $this->setViewState('FooterRenderer', $value, ''); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -209,10 +209,10 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function getFooterStyle($createStyle=true) |
211 | 211 | { |
212 | - if(($style=$this->getViewState('FooterStyle',null))===null && $createStyle) |
|
212 | + if(($style=$this->getViewState('FooterStyle', null))===null && $createStyle) |
|
213 | 213 | { |
214 | 214 | $style=new TTableItemStyle; |
215 | - $this->setViewState('FooterStyle',$style,null); |
|
215 | + $this->setViewState('FooterStyle', $style, null); |
|
216 | 216 | } |
217 | 217 | return $style; |
218 | 218 | } |
@@ -223,10 +223,10 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public function getItemStyle($createStyle=true) |
225 | 225 | { |
226 | - if(($style=$this->getViewState('ItemStyle',null))===null && $createStyle) |
|
226 | + if(($style=$this->getViewState('ItemStyle', null))===null && $createStyle) |
|
227 | 227 | { |
228 | 228 | $style=new TTableItemStyle; |
229 | - $this->setViewState('ItemStyle',$style,null); |
|
229 | + $this->setViewState('ItemStyle', $style, null); |
|
230 | 230 | } |
231 | 231 | return $style; |
232 | 232 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public function getSortExpression() |
238 | 238 | { |
239 | - return $this->getViewState('SortExpression',''); |
|
239 | + return $this->getViewState('SortExpression', ''); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function setSortExpression($value) |
246 | 246 | { |
247 | - $this->setViewState('SortExpression',$value,''); |
|
247 | + $this->setViewState('SortExpression', $value, ''); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | /** |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function getEnableCellGrouping() |
255 | 255 | { |
256 | - return $this->getViewState('EnableCellGrouping',false); |
|
256 | + return $this->getViewState('EnableCellGrouping', false); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | */ |
263 | 263 | public function setEnableCellGrouping($value) |
264 | 264 | { |
265 | - $this->setViewState('EnableCellGrouping',TPropertyValue::ensureBoolean($value),false); |
|
265 | + $this->setViewState('EnableCellGrouping', TPropertyValue::ensureBoolean($value), false); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | */ |
271 | 271 | public function getVisible($checkParents=true) |
272 | 272 | { |
273 | - return $this->getViewState('Visible',true); |
|
273 | + return $this->getViewState('Visible', true); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | /** |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | */ |
279 | 279 | public function setVisible($value) |
280 | 280 | { |
281 | - $this->setViewState('Visible',TPropertyValue::ensureBoolean($value),true); |
|
281 | + $this->setViewState('Visible', TPropertyValue::ensureBoolean($value), true); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -288,9 +288,9 @@ discard block |
||
288 | 288 | * @param mixed the default value. If $key is not found in viewstate, $defaultValue will be returned |
289 | 289 | * @return mixed the viewstate value corresponding to $key |
290 | 290 | */ |
291 | - protected function getViewState($key,$defaultValue=null) |
|
291 | + protected function getViewState($key, $defaultValue=null) |
|
292 | 292 | { |
293 | - return isset($this->_viewState[$key])?$this->_viewState[$key]:$defaultValue; |
|
293 | + return isset($this->_viewState[$key]) ? $this->_viewState[$key] : $defaultValue; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * @param mixed the viewstate value to be set |
302 | 302 | * @param mixed default value. If $value===$defaultValue, the item will be cleared from the viewstate. |
303 | 303 | */ |
304 | - protected function setViewState($key,$value,$defaultValue=null) |
|
304 | + protected function setViewState($key, $value, $defaultValue=null) |
|
305 | 305 | { |
306 | 306 | if($value===$defaultValue) |
307 | 307 | unset($this->_viewState[$key]); |
@@ -364,9 +364,9 @@ discard block |
||
364 | 364 | * @return mixed data value at the specified field |
365 | 365 | * @throws TInvalidDataValueException if the data or the field is invalid. |
366 | 366 | */ |
367 | - protected function getDataFieldValue($data,$field) |
|
367 | + protected function getDataFieldValue($data, $field) |
|
368 | 368 | { |
369 | - return TDataFieldAccessor::getDataFieldValue($data,$field); |
|
369 | + return TDataFieldAccessor::getDataFieldValue($data, $field); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | |
@@ -381,12 +381,12 @@ discard block |
||
381 | 381 | * @param integer the index to the Columns property that the cell resides in. |
382 | 382 | * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem) |
383 | 383 | */ |
384 | - public function initializeCell($cell,$columnIndex,$itemType) |
|
384 | + public function initializeCell($cell, $columnIndex, $itemType) |
|
385 | 385 | { |
386 | 386 | if($itemType===TListItemType::Header) |
387 | - $this->initializeHeaderCell($cell,$columnIndex); |
|
387 | + $this->initializeHeaderCell($cell, $columnIndex); |
|
388 | 388 | else if($itemType===TListItemType::Footer) |
389 | - $this->initializeFooterCell($cell,$columnIndex); |
|
389 | + $this->initializeFooterCell($cell, $columnIndex); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | /** |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | * @param TTableCell the cell to be initialized |
415 | 415 | * @param integer the index to the Columns property that the cell resides in. |
416 | 416 | */ |
417 | - protected function initializeHeaderCell($cell,$columnIndex) |
|
417 | + protected function initializeHeaderCell($cell, $columnIndex) |
|
418 | 418 | { |
419 | 419 | $text=$this->getHeaderText(); |
420 | 420 | |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | $sortExpression=$this->getSortExpression(); |
439 | 439 | if(($url=$this->getHeaderImageUrl())!=='') |
440 | 440 | { |
441 | - $button= new TImageButton; |
|
441 | + $button=new TImageButton; |
|
442 | 442 | $button->setImageUrl($url); |
443 | 443 | $button->setCommandName(TDataGrid::CMD_SORT); |
444 | 444 | $button->setCommandParameter($sortExpression); |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | } |
450 | 450 | else if($text!=='') |
451 | 451 | { |
452 | - $button= new TLinkButton; |
|
452 | + $button=new TLinkButton; |
|
453 | 453 | $button->setText($text); |
454 | 454 | $button->setCommandName(TDataGrid::CMD_SORT); |
455 | 455 | $button->setCommandParameter($sortExpression); |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | { |
464 | 464 | if(($url=$this->getHeaderImageUrl())!=='') |
465 | 465 | { |
466 | - $image= new TImage; |
|
466 | + $image=new TImage; |
|
467 | 467 | $image->setImageUrl($url); |
468 | 468 | if($text!=='') |
469 | 469 | $image->setAlternateText($text); |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | * @param TTableCell the cell to be initialized |
487 | 487 | * @param integer the index to the Columns property that the cell resides in. |
488 | 488 | */ |
489 | - protected function initializeFooterCell($cell,$columnIndex) |
|
489 | + protected function initializeFooterCell($cell, $columnIndex) |
|
490 | 490 | { |
491 | 491 | $text=$this->getFooterText(); |
492 | 492 | if(($classPath=$this->getFooterRenderer())!=='') |
@@ -522,13 +522,13 @@ discard block |
||
522 | 522 | * @param mixed the data to be formatted |
523 | 523 | * @return string the formatted result |
524 | 524 | */ |
525 | - protected function formatDataValue($formatString,$value) |
|
525 | + protected function formatDataValue($formatString, $value) |
|
526 | 526 | { |
527 | 527 | if($formatString==='') |
528 | 528 | return TPropertyValue::ensureString($value); |
529 | 529 | else if($formatString[0]==='#') |
530 | 530 | { |
531 | - $expression=strtr(substr($formatString,1),array('{0}'=>'$value')); |
|
531 | + $expression=strtr(substr($formatString, 1), array('{0}'=>'$value')); |
|
532 | 532 | try |
533 | 533 | { |
534 | 534 | if(eval("\$result=$expression;")===false) |
@@ -537,10 +537,10 @@ discard block |
||
537 | 537 | } |
538 | 538 | catch(Exception $e) |
539 | 539 | { |
540 | - throw new TInvalidDataValueException('datagridcolumn_expression_invalid',get_class($this),$expression,$e->getMessage()); |
|
540 | + throw new TInvalidDataValueException('datagridcolumn_expression_invalid', get_class($this), $expression, $e->getMessage()); |
|
541 | 541 | } |
542 | 542 | } |
543 | 543 | else |
544 | - return sprintf($formatString,$value); |
|
544 | + return sprintf($formatString, $value); |
|
545 | 545 | } |
546 | 546 | } |
547 | 547 | \ No newline at end of file |
@@ -55,7 +55,7 @@ |
||
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Returns an array of javascript validator options. |
58 | - * @return array javascript validator options. |
|
58 | + * @return boolean javascript validator options. |
|
59 | 59 | */ |
60 | 60 | public function evaluateIsValid() |
61 | 61 | { |
@@ -70,8 +70,7 @@ |
||
70 | 70 | { |
71 | 71 | $domain=substr($value,$pos+1); |
72 | 72 | return $domain===''?false:checkdnsrr($domain,'MX'); |
73 | - } |
|
74 | - else |
|
73 | + } else |
|
75 | 74 | return false; |
76 | 75 | } |
77 | 76 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | public function getRegularExpression() |
51 | 51 | { |
52 | 52 | $regex=parent::getRegularExpression(); |
53 | - return $regex===''?self::EMAIL_REGEXP:$regex; |
|
53 | + return $regex==='' ? self::EMAIL_REGEXP : $regex; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -60,16 +60,16 @@ discard block |
||
60 | 60 | public function evaluateIsValid() |
61 | 61 | { |
62 | 62 | $value=$this->getValidationValue($this->getValidationTarget()); |
63 | - $valid=$valid=is_string($value) && strlen($value)<=254 && parent::evaluateIsValid(); |
|
63 | + $valid=$valid=is_string($value) && strlen($value) <= 254 && parent::evaluateIsValid(); |
|
64 | 64 | |
65 | 65 | if($valid && $this->getCheckMXRecord() && function_exists('checkdnsrr')) |
66 | 66 | { |
67 | 67 | if($value!=='') |
68 | 68 | { |
69 | - if(($pos=strpos($value,'@'))!==false) |
|
69 | + if(($pos=strpos($value, '@'))!==false) |
|
70 | 70 | { |
71 | - $domain=substr($value,$pos+1); |
|
72 | - return $domain===''?false:checkdnsrr($domain,'MX'); |
|
71 | + $domain=substr($value, $pos + 1); |
|
72 | + return $domain==='' ? false : checkdnsrr($domain, 'MX'); |
|
73 | 73 | } |
74 | 74 | else |
75 | 75 | return false; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function getCheckMXRecord() |
85 | 85 | { |
86 | - return $this->getViewState('CheckMXRecord',false); |
|
86 | + return $this->getViewState('CheckMXRecord', false); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function setCheckMXRecord($value) |
94 | 94 | { |
95 | - $this->setViewState('CheckMXRecord',TPropertyValue::ensureBoolean($value),false); |
|
95 | + $this->setViewState('CheckMXRecord', TPropertyValue::ensureBoolean($value), false); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 |
@@ -177,6 +177,7 @@ discard block |
||
177 | 177 | * @param string the file name used to save the uploaded file |
178 | 178 | * @param boolean whether to delete the temporary file after saving. |
179 | 179 | * If true, you will not be able to save the uploaded file again. |
180 | + * @param string $fileName |
|
180 | 181 | * @return boolean true if the file saving is successful |
181 | 182 | */ |
182 | 183 | public function saveAs($fileName,$deleteTempFile=true) |
@@ -199,6 +200,7 @@ discard block |
||
199 | 200 | * This method is primarly used by framework developers. |
200 | 201 | * @param string the key that can be used to retrieve data from the input data collection |
201 | 202 | * @param array the input data collection |
203 | + * @param boolean $key |
|
202 | 204 | * @return boolean whether the data of the control has been changed |
203 | 205 | */ |
204 | 206 | public function loadPostData($key,$values) |
@@ -251,7 +253,7 @@ discard block |
||
251 | 253 | /** |
252 | 254 | * Returns the original file name as the property value to be validated. |
253 | 255 | * This method is required by IValidatable property. |
254 | - * @return mixed the property value to be validated |
|
256 | + * @return string the property value to be validated |
|
255 | 257 | */ |
256 | 258 | public function getValidationPropertyValue() |
257 | 259 | { |
@@ -463,14 +463,14 @@ |
||
463 | 463 | */ |
464 | 464 | public function getIsValid() |
465 | 465 | { |
466 | - return $this->_isValid; |
|
466 | + return $this->_isValid; |
|
467 | 467 | } |
468 | 468 | /** |
469 | 469 | * @param bool wether this control is valid. |
470 | 470 | */ |
471 | 471 | public function setIsValid($value) |
472 | 472 | { |
473 | - $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
473 | + $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | /** |
@@ -189,8 +189,7 @@ discard block |
||
189 | 189 | return file_put_contents($fileName,file_get_contents($this->_localName))!==false; |
190 | 190 | else |
191 | 191 | return false; |
192 | - } |
|
193 | - else |
|
192 | + } else |
|
194 | 193 | return false; |
195 | 194 | } |
196 | 195 | |
@@ -211,8 +210,7 @@ discard block |
||
211 | 210 | $this->_errorCode=$_FILES[$key]['error']; |
212 | 211 | $this->_localName=$_FILES[$key]['tmp_name']; |
213 | 212 | return $this->_dataChanged=true; |
214 | - } |
|
215 | - else |
|
213 | + } else |
|
216 | 214 | return false; |
217 | 215 | } |
218 | 216 |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | { |
77 | 77 | $this->getPage()->ensureRenderInForm($this); |
78 | 78 | parent::addAttributesToRender($writer); |
79 | - $writer->addAttribute('type','file'); |
|
80 | - $writer->addAttribute('name',$this->getUniqueID()); |
|
79 | + $writer->addAttribute('type', 'file'); |
|
80 | + $writer->addAttribute('name', $this->getUniqueID()); |
|
81 | 81 | $isEnabled=$this->getEnabled(true); |
82 | 82 | if(!$isEnabled && $this->getEnabled()) // in this case parent will not render 'disabled' |
83 | - $writer->addAttribute('disabled','disabled'); |
|
83 | + $writer->addAttribute('disabled', 'disabled'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | parent::onPreRender($param); |
94 | 94 | if(($form=$this->getPage()->getForm())!==null) |
95 | 95 | $form->setEnctype('multipart/form-data'); |
96 | - $this->getPage()->getClientScript()->registerHiddenField('MAX_FILE_SIZE',$this->getMaxFileSize()); |
|
96 | + $this->getPage()->getClientScript()->registerHiddenField('MAX_FILE_SIZE', $this->getMaxFileSize()); |
|
97 | 97 | if($this->getEnabled(true)) |
98 | 98 | $this->getPage()->registerRequiresPostData($this); |
99 | 99 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function getMaxFileSize() |
106 | 106 | { |
107 | - return $this->getViewState('MaxFileSize',self::MAX_FILE_SIZE); |
|
107 | + return $this->getViewState('MaxFileSize', self::MAX_FILE_SIZE); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function setMaxFileSize($size) |
119 | 119 | { |
120 | - $this->setViewState('MaxFileSize',TPropertyValue::ensureInteger($size),self::MAX_FILE_SIZE); |
|
120 | + $this->setViewState('MaxFileSize', TPropertyValue::ensureInteger($size), self::MAX_FILE_SIZE); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -179,14 +179,14 @@ discard block |
||
179 | 179 | * If true, you will not be able to save the uploaded file again. |
180 | 180 | * @return boolean true if the file saving is successful |
181 | 181 | */ |
182 | - public function saveAs($fileName,$deleteTempFile=true) |
|
182 | + public function saveAs($fileName, $deleteTempFile=true) |
|
183 | 183 | { |
184 | 184 | if($this->_errorCode===UPLOAD_ERR_OK) |
185 | 185 | { |
186 | 186 | if($deleteTempFile) |
187 | - return move_uploaded_file($this->_localName,$fileName); |
|
187 | + return move_uploaded_file($this->_localName, $fileName); |
|
188 | 188 | else if(is_uploaded_file($this->_localName)) |
189 | - return file_put_contents($fileName,file_get_contents($this->_localName))!==false; |
|
189 | + return file_put_contents($fileName, file_get_contents($this->_localName))!==false; |
|
190 | 190 | else |
191 | 191 | return false; |
192 | 192 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @param array the input data collection |
202 | 202 | * @return boolean whether the data of the control has been changed |
203 | 203 | */ |
204 | - public function loadPostData($key,$values) |
|
204 | + public function loadPostData($key, $values) |
|
205 | 205 | { |
206 | 206 | if(isset($_FILES[$key])) |
207 | 207 | { |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public function onFileUpload($param) |
237 | 237 | { |
238 | - $this->raiseEvent('OnFileUpload',$this,$param); |
|
238 | + $this->raiseEvent('OnFileUpload', $this, $param); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
@@ -49,7 +49,7 @@ |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
52 | - * @return Tells whether buffering of output can continue after this point |
|
52 | + * @return boolean whether buffering of output can continue after this point |
|
53 | 53 | */ |
54 | 54 | public function getContinueBuffering() |
55 | 55 | { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function __construct() |
46 | 46 | { |
47 | 47 | parent::__construct(); |
48 | - $this->EnableViewState = false; |
|
48 | + $this->EnableViewState=false; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function setContinueBuffering($value) |
63 | 63 | { |
64 | - $this->_continueBuffering = TPropertyValue::ensureBoolean($value); |
|
64 | + $this->_continueBuffering=TPropertyValue::ensureBoolean($value); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | //$writer->write('<!-- flush -->'); |
74 | 74 | // ajax responses can't be parsed by the client side before loaded and returned completely, |
75 | 75 | // so don't bother with flushing output somewhere mid-page if refreshing in a callback |
76 | - if (!$this->Page->IsCallback) |
|
76 | + if(!$this->Page->IsCallback) |
|
77 | 77 | { |
78 | 78 | $this->Page->flushWriter(); |
79 | 79 | // $this->Application->flushOutput($this->ContinueBuffering); |
@@ -422,6 +422,7 @@ discard block |
||
422 | 422 | |
423 | 423 | /** |
424 | 424 | * Parse additional options set in the Options property. |
425 | + * @param string $string |
|
425 | 426 | * @return array additional custom options |
426 | 427 | */ |
427 | 428 | protected function parseEditorOptions($string) |
@@ -446,6 +447,7 @@ discard block |
||
446 | 447 | } |
447 | 448 | |
448 | 449 | /** |
450 | + * @param string $culture |
|
449 | 451 | * @return string localized editor interface language extension. |
450 | 452 | */ |
451 | 453 | protected function getLanguageSuffix($culture) |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * @var array list of locale => language file pairs. |
64 | 64 | */ |
65 | - private static $_langs = array( |
|
65 | + private static $_langs=array( |
|
66 | 66 | 'ar' => 'ar', |
67 | 67 | 'bg_BG' => 'bg_BG', |
68 | 68 | 'bs' => 'bs', |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | /** |
121 | 121 | * @var array list of default plugins to load, override using getAvailablePlugins(); |
122 | 122 | */ |
123 | - private static $_plugins = array( |
|
123 | + private static $_plugins=array( |
|
124 | 124 | 'advlist', |
125 | 125 | 'anchor', |
126 | 126 | 'autolink', |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | /** |
165 | 165 | * @var array default themes to load |
166 | 166 | */ |
167 | - private static $_themes = array( |
|
167 | + private static $_themes=array( |
|
168 | 168 | 'modern', |
169 | 169 | ); |
170 | 170 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function getEnableVisualEdit() |
213 | 213 | { |
214 | - return $this->getViewState('EnableVisualEdit',true); |
|
214 | + return $this->getViewState('EnableVisualEdit', true); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public function setEnableVisualEdit($value) |
222 | 222 | { |
223 | - $this->setViewState('EnableVisualEdit',TPropertyValue::ensureBoolean($value),true); |
|
223 | + $this->setViewState('EnableVisualEdit', TPropertyValue::ensureBoolean($value), true); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | /** |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | { |
306 | 306 | if($this->getEnableVisualEdit() && $this->getEnabled(true)) |
307 | 307 | { |
308 | - $writer->addAttribute('id',$this->getClientID()); |
|
308 | + $writer->addAttribute('id', $this->getClientID()); |
|
309 | 309 | $this->registerEditorClientScript($writer); |
310 | 310 | } |
311 | 311 | |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | |
341 | 341 | protected function loadJavascriptLibrary() |
342 | 342 | { |
343 | - $scripts = $this->getPage()->getClientScript(); |
|
343 | + $scripts=$this->getPage()->getClientScript(); |
|
344 | 344 | $scripts->registerPradoScript('htmlarea4'); |
345 | 345 | $this->copyCustomPlugins(); |
346 | 346 | } |
@@ -351,25 +351,25 @@ discard block |
||
351 | 351 | protected function registerEditorClientScript($writer) |
352 | 352 | { |
353 | 353 | $this->loadJavascriptLibrary(); |
354 | - $scripts = $this->getPage()->getClientScript(); |
|
355 | - $options = array( |
|
354 | + $scripts=$this->getPage()->getClientScript(); |
|
355 | + $options=array( |
|
356 | 356 | 'EditorOptions' => $this->getEditorOptions() |
357 | 357 | ); |
358 | 358 | |
359 | - $options = TJavaScript::encode($options,true,true); |
|
360 | - $script = "new {$this->getClientClassName()}($options)"; |
|
361 | - $scripts->registerEndScript('prado:THtmlArea4'.$this->ClientID,$script); |
|
359 | + $options=TJavaScript::encode($options, true, true); |
|
360 | + $script="new {$this->getClientClassName()}($options)"; |
|
361 | + $scripts->registerEndScript('prado:THtmlArea4'.$this->ClientID, $script); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | protected function copyCustomPlugins() |
365 | 365 | { |
366 | - if($plugins = $this->getCustomPluginPath()) |
|
366 | + if($plugins=$this->getCustomPluginPath()) |
|
367 | 367 | { |
368 | - $basepath = $this->getPage()->getClientScript()->getPradoScriptAssetPath('tinymce'); |
|
369 | - $assets = $this->getApplication()->getAssetManager(); |
|
370 | - $path = is_dir($plugins) ? $plugins : Prado::getPathOfNameSpace($plugins); |
|
371 | - $name = basename($path); |
|
372 | - $dest = $basepath.'/plugins/'.$name; |
|
368 | + $basepath=$this->getPage()->getClientScript()->getPradoScriptAssetPath('tinymce'); |
|
369 | + $assets=$this->getApplication()->getAssetManager(); |
|
370 | + $path=is_dir($plugins) ? $plugins : Prado::getPathOfNameSpace($plugins); |
|
371 | + $name=basename($path); |
|
372 | + $dest=$basepath.'/plugins/'.$name; |
|
373 | 373 | if(!is_dir($dest) || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
374 | 374 | $assets->copyDirectory($path, $dest); |
375 | 375 | } |
@@ -381,26 +381,26 @@ discard block |
||
381 | 381 | */ |
382 | 382 | protected function getEditorOptions() |
383 | 383 | { |
384 | - $options['mode'] = 'exact'; |
|
385 | - $options['elements'] = $this->getClientID(); |
|
386 | - $options['language'] = $this->getLanguageSuffix($this->getCulture()); |
|
384 | + $options['mode']='exact'; |
|
385 | + $options['elements']=$this->getClientID(); |
|
386 | + $options['language']=$this->getLanguageSuffix($this->getCulture()); |
|
387 | 387 | //$options['theme'] = 'modern'; //default |
388 | 388 | // mimic previous (tinyMCE3) sizing behaviour |
389 | - $options['width'] = $this->getWidth(); |
|
390 | - $options['height'] = $this->getHeight(); |
|
391 | - $options['resize'] = 'both'; |
|
392 | - $options['menubar'] = false; |
|
389 | + $options['width']=$this->getWidth(); |
|
390 | + $options['height']=$this->getHeight(); |
|
391 | + $options['resize']='both'; |
|
392 | + $options['menubar']=false; |
|
393 | 393 | if($this->getReadOnly()) |
394 | 394 | { |
395 | - $options['readonly'] = true; |
|
396 | - $options['toolbar'] = false; |
|
397 | - $options['menubar'] = false; |
|
398 | - $options['statusbar'] = false; |
|
395 | + $options['readonly']=true; |
|
396 | + $options['toolbar']=false; |
|
397 | + $options['menubar']=false; |
|
398 | + $options['statusbar']=false; |
|
399 | 399 | } |
400 | 400 | |
401 | - $options['extended_valid_elements'] = 'a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]'; |
|
401 | + $options['extended_valid_elements']='a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]'; |
|
402 | 402 | |
403 | - $options = array_merge($options, $this->parseEditorOptions($this->getOptions())); |
|
403 | + $options=array_merge($options, $this->parseEditorOptions($this->getOptions())); |
|
404 | 404 | return $options; |
405 | 405 | } |
406 | 406 | |
@@ -410,20 +410,20 @@ discard block |
||
410 | 410 | */ |
411 | 411 | protected function parseEditorOptions($string) |
412 | 412 | { |
413 | - $options = array(); |
|
414 | - $substrings = preg_split('/,\s*\n|\n/', trim($string)); |
|
413 | + $options=array(); |
|
414 | + $substrings=preg_split('/,\s*\n|\n/', trim($string)); |
|
415 | 415 | foreach($substrings as $bits) |
416 | 416 | { |
417 | - $option = explode(":",$bits,2); |
|
417 | + $option=explode(":", $bits, 2); |
|
418 | 418 | |
419 | - if(count($option) == 2) |
|
419 | + if(count($option)==2) |
|
420 | 420 | { |
421 | - $value=trim(trim($option[1]),"'\""); |
|
422 | - if (($s=strtolower($value))==='false') |
|
421 | + $value=trim(trim($option[1]), "'\""); |
|
422 | + if(($s=strtolower($value))==='false') |
|
423 | 423 | $value=false; |
424 | - elseif ($s==='true') |
|
424 | + elseif($s==='true') |
|
425 | 425 | $value=true; |
426 | - $options[trim($option[0])] = $value; |
|
426 | + $options[trim($option[0])]=$value; |
|
427 | 427 | } |
428 | 428 | } |
429 | 429 | return $options; |
@@ -434,12 +434,12 @@ discard block |
||
434 | 434 | */ |
435 | 435 | protected function getLanguageSuffix($culture) |
436 | 436 | { |
437 | - $app = $this->getApplication()->getGlobalization(); |
|
437 | + $app=$this->getApplication()->getGlobalization(); |
|
438 | 438 | if(empty($culture) && ($app!==null)) |
439 | - $culture = $app->getCulture(); |
|
440 | - $variants = array(); |
|
439 | + $culture=$app->getCulture(); |
|
440 | + $variants=array(); |
|
441 | 441 | if($app!==null) |
442 | - $variants = $app->getCultureVariants($culture); |
|
442 | + $variants=$app->getCultureVariants($culture); |
|
443 | 443 | |
444 | 444 | foreach($variants as $variant) |
445 | 445 | { |
@@ -213,7 +213,7 @@ |
||
213 | 213 | /** |
214 | 214 | * Returns the value to be validated. |
215 | 215 | * This methid is required by IValidatable interface. |
216 | - * @return mixed the value of the property to be validated. |
|
216 | + * @return string the value of the property to be validated. |
|
217 | 217 | */ |
218 | 218 | public function getValidationPropertyValue() |
219 | 219 | { |
@@ -101,8 +101,7 @@ discard block |
||
101 | 101 | { |
102 | 102 | $this->setSelectedIndex($index); |
103 | 103 | return $this->_dataChanged=true; |
104 | - } |
|
105 | - else |
|
104 | + } else |
|
106 | 105 | return false; |
107 | 106 | } |
108 | 107 | if(!is_array($selections)) |
@@ -124,8 +123,7 @@ discard block |
||
124 | 123 | break; |
125 | 124 | } |
126 | 125 | } |
127 | - } |
|
128 | - else |
|
126 | + } else |
|
129 | 127 | $flag=true; |
130 | 128 | if($flag) |
131 | 129 | { |
@@ -133,13 +131,11 @@ discard block |
||
133 | 131 | $this->_dataChanged=true; |
134 | 132 | } |
135 | 133 | return $flag; |
136 | - } |
|
137 | - else if($this->getSelectedIndex()!==-1) |
|
134 | + } else if($this->getSelectedIndex()!==-1) |
|
138 | 135 | { |
139 | 136 | $this->clearSelection(); |
140 | 137 | return $this->_dataChanged=true; |
141 | - } |
|
142 | - else |
|
138 | + } else |
|
143 | 139 | return false; |
144 | 140 | } |
145 | 141 |
@@ -225,13 +225,13 @@ |
||
225 | 225 | */ |
226 | 226 | public function getIsValid() |
227 | 227 | { |
228 | - return $this->_isValid; |
|
228 | + return $this->_isValid; |
|
229 | 229 | } |
230 | 230 | /** |
231 | 231 | * @param bool wether this control is valid. |
232 | 232 | */ |
233 | 233 | public function setIsValid($value) |
234 | 234 | { |
235 | - $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
235 | + $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
236 | 236 | } |
237 | 237 | } |
238 | 238 | \ No newline at end of file |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | protected function addAttributesToRender($writer) |
46 | 46 | { |
47 | 47 | $rows=$this->getRows(); |
48 | - $writer->addAttribute('size',"$rows"); |
|
48 | + $writer->addAttribute('size', "$rows"); |
|
49 | 49 | if($this->getSelectionMode()===TListSelectionMode::Multiple) |
50 | - $writer->addAttribute('name',$this->getUniqueID().'[]'); |
|
50 | + $writer->addAttribute('name', $this->getUniqueID().'[]'); |
|
51 | 51 | else |
52 | - $writer->addAttribute('name',$this->getUniqueID()); |
|
52 | + $writer->addAttribute('name', $this->getUniqueID()); |
|
53 | 53 | parent::addAttributesToRender($writer); |
54 | 54 | } |
55 | 55 | |
@@ -82,19 +82,19 @@ discard block |
||
82 | 82 | * @param array the input data collection |
83 | 83 | * @return boolean whether the data of the component has been changed |
84 | 84 | */ |
85 | - public function loadPostData($key,$values) |
|
85 | + public function loadPostData($key, $values) |
|
86 | 86 | { |
87 | 87 | if(!$this->getEnabled(true)) |
88 | 88 | return false; |
89 | 89 | $this->ensureDataBound(); |
90 | - $selections=isset($values[$key])?$values[$key]:null; |
|
90 | + $selections=isset($values[$key]) ? $values[$key] : null; |
|
91 | 91 | if($selections!==null) |
92 | 92 | { |
93 | 93 | $items=$this->getItems(); |
94 | 94 | if($this->getSelectionMode()===TListSelectionMode::Single) |
95 | 95 | { |
96 | - $selection=is_array($selections)?$selections[0]:$selections; |
|
97 | - $index=$items->findIndexByValue($selection,false); |
|
96 | + $selection=is_array($selections) ? $selections[0] : $selections; |
|
97 | + $index=$items->findIndexByValue($selection, false); |
|
98 | 98 | if($this->getSelectedIndex()!==$index) |
99 | 99 | { |
100 | 100 | $this->setSelectedIndex($index); |
@@ -107,14 +107,14 @@ discard block |
||
107 | 107 | $selections=array($selections); |
108 | 108 | $list=array(); |
109 | 109 | foreach($selections as $selection) |
110 | - $list[]=$items->findIndexByValue($selection,false); |
|
110 | + $list[]=$items->findIndexByValue($selection, false); |
|
111 | 111 | $list2=$this->getSelectedIndices(); |
112 | 112 | $n=count($list); |
113 | 113 | $flag=false; |
114 | 114 | if($n===count($list2)) |
115 | 115 | { |
116 | - sort($list,SORT_NUMERIC); |
|
117 | - for($i=0;$i<$n;++$i) |
|
116 | + sort($list, SORT_NUMERIC); |
|
117 | + for($i=0; $i < $n; ++$i) |
|
118 | 118 | { |
119 | 119 | if($list[$i]!==$list2[$i]) |
120 | 120 | { |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | public function setRows($value) |
188 | 188 | { |
189 | 189 | $value=TPropertyValue::ensureInteger($value); |
190 | - if($value<=0) |
|
190 | + if($value <= 0) |
|
191 | 191 | $value=4; |
192 | 192 | $this->setViewState('Rows', $value, 4); |
193 | 193 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | public function setSelectionMode($value) |
207 | 207 | { |
208 | - $this->setViewState('SelectionMode',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TListSelectionMode'),TListSelectionMode::Single); |
|
208 | + $this->setViewState('SelectionMode', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TListSelectionMode'), TListSelectionMode::Single); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -333,6 +333,7 @@ discard block |
||
333 | 333 | |
334 | 334 | /** |
335 | 335 | * @param integer the zero-based index of the current page |
336 | + * @param integer $value |
|
336 | 337 | * @throws TInvalidDataValueException if the value is less than 0 |
337 | 338 | */ |
338 | 339 | protected function setCurrentPageIndex($value) |
@@ -352,6 +353,7 @@ discard block |
||
352 | 353 | |
353 | 354 | /** |
354 | 355 | * @param integer number of pages of data items available |
356 | + * @param integer $value |
|
355 | 357 | * @throws TInvalidDataValueException if the value is less than 0 |
356 | 358 | */ |
357 | 359 | protected function setPageCount($value) |
@@ -446,6 +448,9 @@ discard block |
||
446 | 448 | * @param string caption of the button. |
447 | 449 | * @param string CommandName corresponding to the OnCommand event of the button. |
448 | 450 | * @param string CommandParameter corresponding to the OnCommand event of the button |
451 | + * @param TPagerButtonType $buttonType |
|
452 | + * @param boolean $enabled |
|
453 | + * @param string $commandName |
|
449 | 454 | * @return mixed the button instance |
450 | 455 | */ |
451 | 456 | protected function createPagerButton($buttonType,$enabled,$text,$commandName,$commandParameter) |
@@ -660,6 +665,7 @@ discard block |
||
660 | 665 | /** |
661 | 666 | * This event is raised when page index is changed due to a page button click. |
662 | 667 | * @param TPagerPageChangedEventParameter event parameter |
668 | + * @param TPagerPageChangedEventParameter $param |
|
663 | 669 | */ |
664 | 670 | public function onPageIndexChanged($param) |
665 | 671 | { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function getControlToPaginate() |
87 | 87 | { |
88 | - return $this->getViewState('ControlToPaginate',''); |
|
88 | + return $this->getViewState('ControlToPaginate', ''); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function setControlToPaginate($value) |
98 | 98 | { |
99 | - $this->setViewState('ControlToPaginate',$value,''); |
|
99 | + $this->setViewState('ControlToPaginate', $value, ''); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function getButtonCssClass() |
107 | 107 | { |
108 | - return $this->getViewState('ButtonCssClass',''); |
|
108 | + return $this->getViewState('ButtonCssClass', ''); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function setButtonCssClass($value) |
116 | 116 | { |
117 | - $this->setViewState('ButtonCssClass',TPropertyValue::ensureString($value,''),''); |
|
117 | + $this->setViewState('ButtonCssClass', TPropertyValue::ensureString($value, ''), ''); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function getMode() |
124 | 124 | { |
125 | - return $this->getViewState('Mode',TPagerMode::NextPrev); |
|
125 | + return $this->getViewState('Mode', TPagerMode::NextPrev); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function setMode($value) |
132 | 132 | { |
133 | - $this->setViewState('Mode',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TPagerMode'),TPagerMode::NextPrev); |
|
133 | + $this->setViewState('Mode', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TPagerMode'), TPagerMode::NextPrev); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function getButtonType() |
140 | 140 | { |
141 | - return $this->getViewState('ButtonType',TPagerButtonType::LinkButton); |
|
141 | + return $this->getViewState('ButtonType', TPagerButtonType::LinkButton); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function setButtonType($value) |
148 | 148 | { |
149 | - $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TPagerButtonType'),TPagerButtonType::LinkButton); |
|
149 | + $this->setViewState('ButtonType', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TPagerButtonType'), TPagerButtonType::LinkButton); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function getNextPageText() |
156 | 156 | { |
157 | - return $this->getViewState('NextPageText','>'); |
|
157 | + return $this->getViewState('NextPageText', '>'); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function setNextPageText($value) |
164 | 164 | { |
165 | - $this->setViewState('NextPageText',$value,'>'); |
|
165 | + $this->setViewState('NextPageText', $value, '>'); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function getPrevPageText() |
172 | 172 | { |
173 | - return $this->getViewState('PrevPageText','<'); |
|
173 | + return $this->getViewState('PrevPageText', '<'); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function setPrevPageText($value) |
180 | 180 | { |
181 | - $this->setViewState('PrevPageText',$value,'<'); |
|
181 | + $this->setViewState('PrevPageText', $value, '<'); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function getFirstPageText() |
188 | 188 | { |
189 | - return $this->getViewState('FirstPageText','<<'); |
|
189 | + return $this->getViewState('FirstPageText', '<<'); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public function setFirstPageText($value) |
196 | 196 | { |
197 | - $this->setViewState('FirstPageText',$value,'<<'); |
|
197 | + $this->setViewState('FirstPageText', $value, '<<'); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | /** |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function getLastPageText() |
204 | 204 | { |
205 | - return $this->getViewState('LastPageText','>>'); |
|
205 | + return $this->getViewState('LastPageText', '>>'); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | public function setLastPageText($value) |
212 | 212 | { |
213 | - $this->setViewState('LastPageText',$value,'>>'); |
|
213 | + $this->setViewState('LastPageText', $value, '>>'); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public function getFirstPageImageUrl() |
221 | 221 | { |
222 | - return $this->getViewState('FirstPageImageUrl',''); |
|
222 | + return $this->getViewState('FirstPageImageUrl', ''); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /** |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function setFirstPageImageUrl($value) |
230 | 230 | { |
231 | - $this->setViewState('FirstPageImageUrl',$value); |
|
231 | + $this->setViewState('FirstPageImageUrl', $value); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function getLastPageImageUrl() |
239 | 239 | { |
240 | - return $this->getViewState('LastPageImageUrl',''); |
|
240 | + return $this->getViewState('LastPageImageUrl', ''); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | */ |
247 | 247 | public function setLastPageImageUrl($value) |
248 | 248 | { |
249 | - $this->setViewState('LastPageImageUrl',$value); |
|
249 | + $this->setViewState('LastPageImageUrl', $value); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | public function getNextPageImageUrl() |
257 | 257 | { |
258 | - return $this->getViewState('NextPageImageUrl',''); |
|
258 | + return $this->getViewState('NextPageImageUrl', ''); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | */ |
265 | 265 | public function setNextPageImageUrl($value) |
266 | 266 | { |
267 | - $this->setViewState('NextPageImageUrl',$value); |
|
267 | + $this->setViewState('NextPageImageUrl', $value); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function getPrevPageImageUrl() |
275 | 275 | { |
276 | - return $this->getViewState('PrevPageImageUrl',''); |
|
276 | + return $this->getViewState('PrevPageImageUrl', ''); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | */ |
283 | 283 | public function setPrevPageImageUrl($value) |
284 | 284 | { |
285 | - $this->setViewState('PrevPageImageUrl',$value); |
|
285 | + $this->setViewState('PrevPageImageUrl', $value); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | /** |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | */ |
293 | 293 | public function getNumericPageImageUrl() |
294 | 294 | { |
295 | - return $this->getViewState('NumericPageImageUrl',''); |
|
295 | + return $this->getViewState('NumericPageImageUrl', ''); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | /** |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | */ |
307 | 307 | public function setNumericPageImageUrl($value) |
308 | 308 | { |
309 | - $this->setViewState('NumericPageImageUrl',$value); |
|
309 | + $this->setViewState('NumericPageImageUrl', $value); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | */ |
315 | 315 | public function getPageButtonCount() |
316 | 316 | { |
317 | - return $this->getViewState('PageButtonCount',10); |
|
317 | + return $this->getViewState('PageButtonCount', 10); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | /** |
@@ -323,9 +323,9 @@ discard block |
||
323 | 323 | */ |
324 | 324 | public function setPageButtonCount($value) |
325 | 325 | { |
326 | - if(($value=TPropertyValue::ensureInteger($value))<1) |
|
326 | + if(($value=TPropertyValue::ensureInteger($value)) < 1) |
|
327 | 327 | throw new TInvalidDataValueException('pager_pagebuttoncount_invalid'); |
328 | - $this->setViewState('PageButtonCount',$value,10); |
|
328 | + $this->setViewState('PageButtonCount', $value, 10); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | */ |
334 | 334 | public function getCurrentPageIndex() |
335 | 335 | { |
336 | - return $this->getViewState('CurrentPageIndex',0); |
|
336 | + return $this->getViewState('CurrentPageIndex', 0); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
@@ -342,9 +342,9 @@ discard block |
||
342 | 342 | */ |
343 | 343 | protected function setCurrentPageIndex($value) |
344 | 344 | { |
345 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
345 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
346 | 346 | throw new TInvalidDataValueException('pager_currentpageindex_invalid'); |
347 | - $this->setViewState('CurrentPageIndex',$value,0); |
|
347 | + $this->setViewState('CurrentPageIndex', $value, 0); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | /** |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | */ |
353 | 353 | public function getPageCount() |
354 | 354 | { |
355 | - return $this->getViewState('PageCount',0); |
|
355 | + return $this->getViewState('PageCount', 0); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
@@ -361,9 +361,9 @@ discard block |
||
361 | 361 | */ |
362 | 362 | protected function setPageCount($value) |
363 | 363 | { |
364 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
364 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
365 | 365 | throw new TInvalidDataValueException('pager_pagecount_invalid'); |
366 | - $this->setViewState('PageCount',$value,0); |
|
366 | + $this->setViewState('PageCount', $value, 0); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | /** |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | */ |
380 | 380 | public function getIsLastPage() |
381 | 381 | { |
382 | - return $this->getCurrentPageIndex()===$this->getPageCount()-1; |
|
382 | + return $this->getCurrentPageIndex()===$this->getPageCount() - 1; |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | /** |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | |
395 | 395 | $controlID=$this->getControlToPaginate(); |
396 | 396 | if(($targetControl=$this->getNamingContainer()->findControl($controlID))===null || !($targetControl instanceof TDataBoundControl)) |
397 | - throw new TConfigurationException('pager_controltopaginate_invalid',$controlID); |
|
397 | + throw new TConfigurationException('pager_controltopaginate_invalid', $controlID); |
|
398 | 398 | |
399 | 399 | if($targetControl->getAllowPaging()) |
400 | 400 | { |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | */ |
417 | 417 | public function render($writer) |
418 | 418 | { |
419 | - if($this->_pageCount>1) |
|
419 | + if($this->_pageCount > 1) |
|
420 | 420 | parent::render($writer); |
421 | 421 | } |
422 | 422 | |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | * @param string CommandParameter corresponding to the OnCommand event of the button |
454 | 454 | * @return mixed the button instance |
455 | 455 | */ |
456 | - protected function createPagerButton($buttonType,$enabled,$text,$commandName,$commandParameter) |
|
456 | + protected function createPagerButton($buttonType, $enabled, $text, $commandName, $commandParameter) |
|
457 | 457 | { |
458 | 458 | if($buttonType===TPagerButtonType::LinkButton) |
459 | 459 | { |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | if($buttonType===TPagerButtonType::ImageButton) |
473 | 473 | { |
474 | 474 | $button=new TImageButton; |
475 | - $button->setImageUrl($this->getPageImageUrl($text,$commandName)); |
|
475 | + $button->setImageUrl($this->getPageImageUrl($text, $commandName)); |
|
476 | 476 | } |
477 | 477 | else |
478 | 478 | $button=new TButton; |
@@ -492,13 +492,13 @@ discard block |
||
492 | 492 | * @param string the command name associated with the image button |
493 | 493 | * @since 3.1.1 |
494 | 494 | */ |
495 | - protected function getPageImageUrl($text,$commandName) |
|
495 | + protected function getPageImageUrl($text, $commandName) |
|
496 | 496 | { |
497 | 497 | switch($commandName) |
498 | 498 | { |
499 | 499 | case self::CMD_PAGE: |
500 | 500 | $url=$this->getNumericPageImageUrl(); |
501 | - return str_replace('{0}',$text,$url); |
|
501 | + return str_replace('{0}', $text, $url); |
|
502 | 502 | case self::CMD_PAGE_NEXT: |
503 | 503 | return $this->getNextPageImageUrl(); |
504 | 504 | case self::CMD_PAGE_PREV: |
@@ -523,44 +523,44 @@ discard block |
||
523 | 523 | { |
524 | 524 | if(($text=$this->getFirstPageText())!=='') |
525 | 525 | { |
526 | - $label=$this->createPagerButton($buttonType,false,$text,self::CMD_PAGE_FIRST,''); |
|
526 | + $label=$this->createPagerButton($buttonType, false, $text, self::CMD_PAGE_FIRST, ''); |
|
527 | 527 | $controls->add($label); |
528 | 528 | $controls->add("\n"); |
529 | 529 | } |
530 | - $label=$this->createPagerButton($buttonType,false,$this->getPrevPageText(),self::CMD_PAGE_PREV,''); |
|
530 | + $label=$this->createPagerButton($buttonType, false, $this->getPrevPageText(), self::CMD_PAGE_PREV, ''); |
|
531 | 531 | $controls->add($label); |
532 | 532 | } |
533 | 533 | else |
534 | 534 | { |
535 | 535 | if(($text=$this->getFirstPageText())!=='') |
536 | 536 | { |
537 | - $button=$this->createPagerButton($buttonType,true,$text,self::CMD_PAGE_FIRST,''); |
|
537 | + $button=$this->createPagerButton($buttonType, true, $text, self::CMD_PAGE_FIRST, ''); |
|
538 | 538 | $controls->add($button); |
539 | 539 | $controls->add("\n"); |
540 | 540 | } |
541 | - $button=$this->createPagerButton($buttonType,true,$this->getPrevPageText(),self::CMD_PAGE_PREV,''); |
|
541 | + $button=$this->createPagerButton($buttonType, true, $this->getPrevPageText(), self::CMD_PAGE_PREV, ''); |
|
542 | 542 | $controls->add($button); |
543 | 543 | } |
544 | 544 | $controls->add("\n"); |
545 | 545 | if($this->getIsLastPage()) |
546 | 546 | { |
547 | - $label=$this->createPagerButton($buttonType,false,$this->getNextPageText(),self::CMD_PAGE_NEXT,''); |
|
547 | + $label=$this->createPagerButton($buttonType, false, $this->getNextPageText(), self::CMD_PAGE_NEXT, ''); |
|
548 | 548 | $controls->add($label); |
549 | 549 | if(($text=$this->getLastPageText())!=='') |
550 | 550 | { |
551 | 551 | $controls->add("\n"); |
552 | - $label=$this->createPagerButton($buttonType,false,$text,self::CMD_PAGE_LAST,''); |
|
552 | + $label=$this->createPagerButton($buttonType, false, $text, self::CMD_PAGE_LAST, ''); |
|
553 | 553 | $controls->add($label); |
554 | 554 | } |
555 | 555 | } |
556 | 556 | else |
557 | 557 | { |
558 | - $button=$this->createPagerButton($buttonType,true,$this->getNextPageText(),self::CMD_PAGE_NEXT,''); |
|
558 | + $button=$this->createPagerButton($buttonType, true, $this->getNextPageText(), self::CMD_PAGE_NEXT, ''); |
|
559 | 559 | $controls->add($button); |
560 | 560 | if(($text=$this->getLastPageText())!=='') |
561 | 561 | { |
562 | 562 | $controls->add("\n"); |
563 | - $button=$this->createPagerButton($buttonType,true,$text,self::CMD_PAGE_LAST,''); |
|
563 | + $button=$this->createPagerButton($buttonType, true, $text, self::CMD_PAGE_LAST, ''); |
|
564 | 564 | $controls->add($button); |
565 | 565 | } |
566 | 566 | } |
@@ -574,63 +574,63 @@ discard block |
||
574 | 574 | $buttonType=$this->getButtonType(); |
575 | 575 | $controls=$this->getControls(); |
576 | 576 | $pageCount=$this->getPageCount(); |
577 | - $pageIndex=$this->getCurrentPageIndex()+1; |
|
577 | + $pageIndex=$this->getCurrentPageIndex() + 1; |
|
578 | 578 | $maxButtonCount=$this->getPageButtonCount(); |
579 | - $buttonCount=$maxButtonCount>$pageCount?$pageCount:$maxButtonCount; |
|
579 | + $buttonCount=$maxButtonCount > $pageCount ? $pageCount : $maxButtonCount; |
|
580 | 580 | $startPageIndex=1; |
581 | 581 | $endPageIndex=$buttonCount; |
582 | - if($pageIndex>$endPageIndex) |
|
582 | + if($pageIndex > $endPageIndex) |
|
583 | 583 | { |
584 | - $startPageIndex=((int)(($pageIndex-1)/$maxButtonCount))*$maxButtonCount+1; |
|
585 | - if(($endPageIndex=$startPageIndex+$maxButtonCount-1)>$pageCount) |
|
584 | + $startPageIndex=((int) (($pageIndex - 1) / $maxButtonCount)) * $maxButtonCount + 1; |
|
585 | + if(($endPageIndex=$startPageIndex + $maxButtonCount - 1) > $pageCount) |
|
586 | 586 | $endPageIndex=$pageCount; |
587 | - if($endPageIndex-$startPageIndex+1<$maxButtonCount) |
|
587 | + if($endPageIndex - $startPageIndex + 1 < $maxButtonCount) |
|
588 | 588 | { |
589 | - if(($startPageIndex=$endPageIndex-$maxButtonCount+1)<1) |
|
589 | + if(($startPageIndex=$endPageIndex - $maxButtonCount + 1) < 1) |
|
590 | 590 | $startPageIndex=1; |
591 | 591 | } |
592 | 592 | } |
593 | 593 | |
594 | - if($startPageIndex>1) |
|
594 | + if($startPageIndex > 1) |
|
595 | 595 | { |
596 | 596 | if(($text=$this->getFirstPageText())!=='') |
597 | 597 | { |
598 | - $button=$this->createPagerButton($buttonType,true,$text,self::CMD_PAGE_FIRST,''); |
|
598 | + $button=$this->createPagerButton($buttonType, true, $text, self::CMD_PAGE_FIRST, ''); |
|
599 | 599 | $controls->add($button); |
600 | 600 | $controls->add("\n"); |
601 | 601 | } |
602 | - $prevPageIndex=$startPageIndex-1; |
|
603 | - $button=$this->createPagerButton($buttonType,true,$this->getPrevPageText(),self::CMD_PAGE,"$prevPageIndex"); |
|
602 | + $prevPageIndex=$startPageIndex - 1; |
|
603 | + $button=$this->createPagerButton($buttonType, true, $this->getPrevPageText(), self::CMD_PAGE, "$prevPageIndex"); |
|
604 | 604 | $controls->add($button); |
605 | 605 | $controls->add("\n"); |
606 | 606 | } |
607 | 607 | |
608 | - for($i=$startPageIndex;$i<=$endPageIndex;++$i) |
|
608 | + for($i=$startPageIndex; $i <= $endPageIndex; ++$i) |
|
609 | 609 | { |
610 | 610 | if($i===$pageIndex) |
611 | 611 | { |
612 | - $label=$this->createPagerButton($buttonType,false,"$i",self::CMD_PAGE,''); |
|
612 | + $label=$this->createPagerButton($buttonType, false, "$i", self::CMD_PAGE, ''); |
|
613 | 613 | $controls->add($label); |
614 | 614 | } |
615 | 615 | else |
616 | 616 | { |
617 | - $button=$this->createPagerButton($buttonType,true,"$i",self::CMD_PAGE,"$i"); |
|
617 | + $button=$this->createPagerButton($buttonType, true, "$i", self::CMD_PAGE, "$i"); |
|
618 | 618 | $controls->add($button); |
619 | 619 | } |
620 | - if($i<$endPageIndex) |
|
620 | + if($i < $endPageIndex) |
|
621 | 621 | $controls->add("\n"); |
622 | 622 | } |
623 | 623 | |
624 | - if($pageCount>$endPageIndex) |
|
624 | + if($pageCount > $endPageIndex) |
|
625 | 625 | { |
626 | 626 | $controls->add("\n"); |
627 | - $nextPageIndex=$endPageIndex+1; |
|
628 | - $button=$this->createPagerButton($buttonType,true,$this->getNextPageText(),self::CMD_PAGE,"$nextPageIndex"); |
|
627 | + $nextPageIndex=$endPageIndex + 1; |
|
628 | + $button=$this->createPagerButton($buttonType, true, $this->getNextPageText(), self::CMD_PAGE, "$nextPageIndex"); |
|
629 | 629 | $controls->add($button); |
630 | 630 | if(($text=$this->getLastPageText())!=='') |
631 | 631 | { |
632 | 632 | $controls->add("\n"); |
633 | - $button=$this->createPagerButton($buttonType,true,$text,self::CMD_PAGE_LAST,''); |
|
633 | + $button=$this->createPagerButton($buttonType, true, $text, self::CMD_PAGE_LAST, ''); |
|
634 | 634 | $controls->add($button); |
635 | 635 | } |
636 | 636 | } |
@@ -643,11 +643,11 @@ discard block |
||
643 | 643 | { |
644 | 644 | $list=new TDropDownList; |
645 | 645 | $this->getControls()->add($list); |
646 | - $list->setDataSource(range(1,$this->getPageCount())); |
|
646 | + $list->setDataSource(range(1, $this->getPageCount())); |
|
647 | 647 | $list->dataBind(); |
648 | 648 | $list->setSelectedIndex($this->getCurrentPageIndex()); |
649 | 649 | $list->setAutoPostBack(true); |
650 | - $list->attachEventHandler('OnSelectedIndexChanged',array($this,'listIndexChanged')); |
|
650 | + $list->attachEventHandler('OnSelectedIndexChanged', array($this, 'listIndexChanged')); |
|
651 | 651 | } |
652 | 652 | |
653 | 653 | /** |
@@ -656,10 +656,10 @@ discard block |
||
656 | 656 | * @param TDropDownList the dropdown list control raising the event |
657 | 657 | * @param TEventParameter event parameter |
658 | 658 | */ |
659 | - public function listIndexChanged($sender,$param) |
|
659 | + public function listIndexChanged($sender, $param) |
|
660 | 660 | { |
661 | 661 | $pageIndex=$sender->getSelectedIndex(); |
662 | - $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex)); |
|
662 | + $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex)); |
|
663 | 663 | } |
664 | 664 | |
665 | 665 | /** |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | */ |
669 | 669 | public function onPageIndexChanged($param) |
670 | 670 | { |
671 | - $this->raiseEvent('OnPageIndexChanged',$this,$param); |
|
671 | + $this->raiseEvent('OnPageIndexChanged', $this, $param); |
|
672 | 672 | } |
673 | 673 | |
674 | 674 | /** |
@@ -679,37 +679,37 @@ discard block |
||
679 | 679 | * @param TEventParameter event parameter |
680 | 680 | * @return boolean whether the event bubbling should stop here. |
681 | 681 | */ |
682 | - public function bubbleEvent($sender,$param) |
|
682 | + public function bubbleEvent($sender, $param) |
|
683 | 683 | { |
684 | 684 | if($param instanceof \Prado\Web\UI\TCommandEventParameter) |
685 | 685 | { |
686 | 686 | $command=$param->getCommandName(); |
687 | - if(strcasecmp($command,self::CMD_PAGE)===0) |
|
687 | + if(strcasecmp($command, self::CMD_PAGE)===0) |
|
688 | 688 | { |
689 | - $pageIndex=TPropertyValue::ensureInteger($param->getCommandParameter())-1; |
|
690 | - $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex)); |
|
689 | + $pageIndex=TPropertyValue::ensureInteger($param->getCommandParameter()) - 1; |
|
690 | + $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex)); |
|
691 | 691 | return true; |
692 | 692 | } |
693 | - else if(strcasecmp($command,self::CMD_PAGE_NEXT)===0) |
|
693 | + else if(strcasecmp($command, self::CMD_PAGE_NEXT)===0) |
|
694 | 694 | { |
695 | - $pageIndex=$this->getCurrentPageIndex()+1; |
|
696 | - $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex)); |
|
695 | + $pageIndex=$this->getCurrentPageIndex() + 1; |
|
696 | + $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex)); |
|
697 | 697 | return true; |
698 | 698 | } |
699 | - else if(strcasecmp($command,self::CMD_PAGE_PREV)===0) |
|
699 | + else if(strcasecmp($command, self::CMD_PAGE_PREV)===0) |
|
700 | 700 | { |
701 | - $pageIndex=$this->getCurrentPageIndex()-1; |
|
702 | - $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex)); |
|
701 | + $pageIndex=$this->getCurrentPageIndex() - 1; |
|
702 | + $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex)); |
|
703 | 703 | return true; |
704 | 704 | } |
705 | - else if(strcasecmp($command,self::CMD_PAGE_FIRST)===0) |
|
705 | + else if(strcasecmp($command, self::CMD_PAGE_FIRST)===0) |
|
706 | 706 | { |
707 | - $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,0)); |
|
707 | + $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, 0)); |
|
708 | 708 | return true; |
709 | 709 | } |
710 | - else if(strcasecmp($command,self::CMD_PAGE_LAST)===0) |
|
710 | + else if(strcasecmp($command, self::CMD_PAGE_LAST)===0) |
|
711 | 711 | { |
712 | - $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$this->getPageCount()-1)); |
|
712 | + $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $this->getPageCount() - 1)); |
|
713 | 713 | return true; |
714 | 714 | } |
715 | 715 | return false; |
@@ -403,8 +403,7 @@ discard block |
||
403 | 403 | $this->setPageCount($targetControl->getPageCount()); |
404 | 404 | $this->setCurrentPageIndex($targetControl->getCurrentPageIndex()); |
405 | 405 | $this->buildPager(); |
406 | - } |
|
407 | - else |
|
406 | + } else |
|
408 | 407 | $this->_pageCount=0; |
409 | 408 | } |
410 | 409 | |
@@ -466,15 +465,13 @@ discard block |
||
466 | 465 | $button->setCssClass($this->getButtonCssClass()); |
467 | 466 | return $button; |
468 | 467 | } |
469 | - } |
|
470 | - else |
|
468 | + } else |
|
471 | 469 | { |
472 | 470 | if($buttonType===TPagerButtonType::ImageButton) |
473 | 471 | { |
474 | 472 | $button=new TImageButton; |
475 | 473 | $button->setImageUrl($this->getPageImageUrl($text,$commandName)); |
476 | - } |
|
477 | - else |
|
474 | + } else |
|
478 | 475 | $button=new TButton; |
479 | 476 | if(!$enabled) |
480 | 477 | $button->setEnabled(false); |
@@ -529,8 +526,7 @@ discard block |
||
529 | 526 | } |
530 | 527 | $label=$this->createPagerButton($buttonType,false,$this->getPrevPageText(),self::CMD_PAGE_PREV,''); |
531 | 528 | $controls->add($label); |
532 | - } |
|
533 | - else |
|
529 | + } else |
|
534 | 530 | { |
535 | 531 | if(($text=$this->getFirstPageText())!=='') |
536 | 532 | { |
@@ -552,8 +548,7 @@ discard block |
||
552 | 548 | $label=$this->createPagerButton($buttonType,false,$text,self::CMD_PAGE_LAST,''); |
553 | 549 | $controls->add($label); |
554 | 550 | } |
555 | - } |
|
556 | - else |
|
551 | + } else |
|
557 | 552 | { |
558 | 553 | $button=$this->createPagerButton($buttonType,true,$this->getNextPageText(),self::CMD_PAGE_NEXT,''); |
559 | 554 | $controls->add($button); |
@@ -611,8 +606,7 @@ discard block |
||
611 | 606 | { |
612 | 607 | $label=$this->createPagerButton($buttonType,false,"$i",self::CMD_PAGE,''); |
613 | 608 | $controls->add($label); |
614 | - } |
|
615 | - else |
|
609 | + } else |
|
616 | 610 | { |
617 | 611 | $button=$this->createPagerButton($buttonType,true,"$i",self::CMD_PAGE,"$i"); |
618 | 612 | $controls->add($button); |
@@ -689,32 +683,27 @@ discard block |
||
689 | 683 | $pageIndex=TPropertyValue::ensureInteger($param->getCommandParameter())-1; |
690 | 684 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex)); |
691 | 685 | return true; |
692 | - } |
|
693 | - else if(strcasecmp($command,self::CMD_PAGE_NEXT)===0) |
|
686 | + } else if(strcasecmp($command,self::CMD_PAGE_NEXT)===0) |
|
694 | 687 | { |
695 | 688 | $pageIndex=$this->getCurrentPageIndex()+1; |
696 | 689 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex)); |
697 | 690 | return true; |
698 | - } |
|
699 | - else if(strcasecmp($command,self::CMD_PAGE_PREV)===0) |
|
691 | + } else if(strcasecmp($command,self::CMD_PAGE_PREV)===0) |
|
700 | 692 | { |
701 | 693 | $pageIndex=$this->getCurrentPageIndex()-1; |
702 | 694 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex)); |
703 | 695 | return true; |
704 | - } |
|
705 | - else if(strcasecmp($command,self::CMD_PAGE_FIRST)===0) |
|
696 | + } else if(strcasecmp($command,self::CMD_PAGE_FIRST)===0) |
|
706 | 697 | { |
707 | 698 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,0)); |
708 | 699 | return true; |
709 | - } |
|
710 | - else if(strcasecmp($command,self::CMD_PAGE_LAST)===0) |
|
700 | + } else if(strcasecmp($command,self::CMD_PAGE_LAST)===0) |
|
711 | 701 | { |
712 | 702 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$this->getPageCount()-1)); |
713 | 703 | return true; |
714 | 704 | } |
715 | 705 | return false; |
716 | - } |
|
717 | - else |
|
706 | + } else |
|
718 | 707 | return false; |
719 | 708 | } |
720 | 709 | } |
721 | 710 | \ No newline at end of file |
@@ -96,6 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | /** |
98 | 98 | * @param boolean true to perform strict comparison (i.e. strictly less than max and/or strictly greater than min). |
99 | + * @param boolean $value |
|
99 | 100 | */ |
100 | 101 | public function setStrictComparison($value) |
101 | 102 | { |
@@ -191,6 +192,7 @@ discard block |
||
191 | 192 | /** |
192 | 193 | * Determine if the value is within the integer range. |
193 | 194 | * @param string value to validate true |
195 | + * @param string $value |
|
194 | 196 | * @return boolean true if within integer range. |
195 | 197 | */ |
196 | 198 | protected function isValidInteger($value) |
@@ -220,6 +222,7 @@ discard block |
||
220 | 222 | /** |
221 | 223 | * Determine if the value is within the specified float range. |
222 | 224 | * @param string value to validate |
225 | + * @param string $value |
|
223 | 226 | * @return boolean true if within range. |
224 | 227 | */ |
225 | 228 | protected function isValidFloat($value) |
@@ -240,6 +243,7 @@ discard block |
||
240 | 243 | * Determine if the date is within the specified range. |
241 | 244 | * Uses pradoParseDate and strtotime to get the date from string. |
242 | 245 | * @param string date as string to validate |
246 | + * @param string $value |
|
243 | 247 | * @return boolean true if within range. |
244 | 248 | */ |
245 | 249 | protected function isValidDate($value) |
@@ -275,6 +279,7 @@ discard block |
||
275 | 279 | * Compare the string with a minimum and a maxiumum value. |
276 | 280 | * Uses strcmp for comparision. |
277 | 281 | * @param string value to compare with. |
282 | + * @param string $value |
|
278 | 283 | * @return boolean true if the string is within range. |
279 | 284 | */ |
280 | 285 | protected function isValidString($value) |
@@ -292,6 +297,7 @@ discard block |
||
292 | 297 | |
293 | 298 | /** |
294 | 299 | * @param string string for comparision |
300 | + * @param string $value |
|
295 | 301 | * @return boolean true if min and max string length are satisfied. |
296 | 302 | */ |
297 | 303 | protected function isValidStringLength($value) |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
132 | - * Sets the date format for a date validation |
|
133 | - * @param string the date format value |
|
134 | - */ |
|
132 | + * Sets the date format for a date validation |
|
133 | + * @param string the date format value |
|
134 | + */ |
|
135 | 135 | public function setDateFormat($value) |
136 | 136 | { |
137 | 137 | $this->setViewState('DateFormat', $value, ''); |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
192 | - * Determine if the value is within the integer range. |
|
193 | - * @param string value to validate true |
|
194 | - * @return boolean true if within integer range. |
|
195 | - */ |
|
192 | + * Determine if the value is within the integer range. |
|
193 | + * @param string value to validate true |
|
194 | + * @return boolean true if within integer range. |
|
195 | + */ |
|
196 | 196 | protected function isValidInteger($value) |
197 | 197 | { |
198 | 198 | $minValue=$this->getMinValue(); |
@@ -58,8 +58,7 @@ |
||
58 | 58 | if ($this->sourcepath === NULL) |
59 | 59 | { |
60 | 60 | $this->sourcepath = $sourcepath; |
61 | - } |
|
62 | - else |
|
61 | + } else |
|
63 | 62 | { |
64 | 63 | $this->sourcepath->append($sourcepath); |
65 | 64 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function getMinValue() |
67 | 67 | { |
68 | - return $this->getViewState('MinValue',''); |
|
68 | + return $this->getViewState('MinValue', ''); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function setMinValue($value) |
76 | 76 | { |
77 | - $this->setViewState('MinValue',TPropertyValue::ensureString($value),''); |
|
77 | + $this->setViewState('MinValue', TPropertyValue::ensureString($value), ''); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function getMaxValue() |
84 | 84 | { |
85 | - return $this->getViewState('MaxValue',''); |
|
85 | + return $this->getViewState('MaxValue', ''); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function setMaxValue($value) |
93 | 93 | { |
94 | - $this->setViewState('MaxValue',TPropertyValue::ensureString($value),''); |
|
94 | + $this->setViewState('MaxValue', TPropertyValue::ensureString($value), ''); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function setStrictComparison($value) |
101 | 101 | { |
102 | - $this->setViewState('StrictComparison', TPropertyValue::ensureBoolean($value),false); |
|
102 | + $this->setViewState('StrictComparison', TPropertyValue::ensureBoolean($value), false); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function getDataType() |
118 | 118 | { |
119 | - return $this->getViewState('DataType',TRangeValidationDataType::String); |
|
119 | + return $this->getViewState('DataType', TRangeValidationDataType::String); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function setDataType($value) |
127 | 127 | { |
128 | - $this->setViewState('DataType',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TRangeValidationDataType'),TRangeValidationDataType::String); |
|
128 | + $this->setViewState('DataType', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TRangeValidationDataType'), TRangeValidationDataType::String); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | $minValue=$this->getMinValue(); |
199 | 199 | $maxValue=$this->getMaxValue(); |
200 | 200 | |
201 | - $valid=preg_match('/^[-+]?[0-9]+$/',trim($value)); |
|
201 | + $valid=preg_match('/^[-+]?[0-9]+$/', trim($value)); |
|
202 | 202 | $value=intval($value); |
203 | 203 | if($minValue!=='') |
204 | 204 | $valid=$valid && $this->isGreaterThan($value, intval($minValue)); |
205 | 205 | if($maxValue!=='') |
206 | - $valid=$valid && $this->isLessThan($value,intval($maxValue)); |
|
206 | + $valid=$valid && $this->isLessThan($value, intval($maxValue)); |
|
207 | 207 | return $valid; |
208 | 208 | } |
209 | 209 | |
210 | - protected function isLessThan($left,$right) |
|
210 | + protected function isLessThan($left, $right) |
|
211 | 211 | { |
212 | 212 | return $this->getStrictComparison() ? $left < $right : $left <= $right; |
213 | 213 | } |
@@ -227,12 +227,12 @@ discard block |
||
227 | 227 | $minValue=$this->getMinValue(); |
228 | 228 | $maxValue=$this->getMaxValue(); |
229 | 229 | |
230 | - $valid=preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/',trim($value)); |
|
230 | + $valid=preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/', trim($value)); |
|
231 | 231 | $value=floatval($value); |
232 | 232 | if($minValue!=='') |
233 | - $valid=$valid && $this->isGreaterThan($value,floatval($minValue)); |
|
233 | + $valid=$valid && $this->isGreaterThan($value, floatval($minValue)); |
|
234 | 234 | if($maxValue!=='') |
235 | - $valid=$valid && $this->isLessThan($value,floatval($maxValue)); |
|
235 | + $valid=$valid && $this->isLessThan($value, floatval($maxValue)); |
|
236 | 236 | return $valid; |
237 | 237 | } |
238 | 238 | |
@@ -249,24 +249,24 @@ discard block |
||
249 | 249 | |
250 | 250 | $valid=true; |
251 | 251 | |
252 | - $dateFormat = $this->getDateFormat(); |
|
252 | + $dateFormat=$this->getDateFormat(); |
|
253 | 253 | if($dateFormat!=='') |
254 | 254 | { |
255 | - $formatter= new TSimpleDateFormatter($dateFormat); |
|
256 | - $value = $formatter->parse($value); |
|
255 | + $formatter=new TSimpleDateFormatter($dateFormat); |
|
256 | + $value=$formatter->parse($value); |
|
257 | 257 | if($minValue!=='') |
258 | - $valid=$valid && $this->isGreaterThan($value,$formatter->parse($minValue)); |
|
258 | + $valid=$valid && $this->isGreaterThan($value, $formatter->parse($minValue)); |
|
259 | 259 | if($maxValue!=='') |
260 | - $valid=$valid && $this->isLessThan($value,$formatter->parse($maxValue)); |
|
260 | + $valid=$valid && $this->isLessThan($value, $formatter->parse($maxValue)); |
|
261 | 261 | return $valid; |
262 | 262 | } |
263 | 263 | else |
264 | 264 | { |
265 | 265 | $value=strtotime($value); |
266 | 266 | if($minValue!=='') |
267 | - $valid=$valid && $this->isGreaterThan($value,strtotime($minValue)); |
|
267 | + $valid=$valid && $this->isGreaterThan($value, strtotime($minValue)); |
|
268 | 268 | if($maxValue!=='') |
269 | - $valid=$valid && $this->isLessThan($value,strtotime($maxValue)); |
|
269 | + $valid=$valid && $this->isLessThan($value, strtotime($maxValue)); |
|
270 | 270 | return $valid; |
271 | 271 | } |
272 | 272 | } |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | |
285 | 285 | $valid=true; |
286 | 286 | if($minValue!=='') |
287 | - $valid=$valid && $this->isGreaterThan(strcmp($value,$minValue),0); |
|
287 | + $valid=$valid && $this->isGreaterThan(strcmp($value, $minValue), 0); |
|
288 | 288 | if($maxValue!=='') |
289 | - $valid=$valid && $this->isLessThan(strcmp($value,$maxValue),0); |
|
289 | + $valid=$valid && $this->isLessThan(strcmp($value, $maxValue), 0); |
|
290 | 290 | return $valid; |
291 | 291 | } |
292 | 292 | |
@@ -300,20 +300,20 @@ discard block |
||
300 | 300 | $maxValue=$this->getMaxValue(); |
301 | 301 | |
302 | 302 | $valid=true; |
303 | - $charset = $this->getCharset(); |
|
303 | + $charset=$this->getCharset(); |
|
304 | 304 | if($charset==='') |
305 | 305 | { |
306 | - $app= $this->getApplication()->getGlobalization(); |
|
307 | - $charset = $app ? $app->getCharset() : null; |
|
306 | + $app=$this->getApplication()->getGlobalization(); |
|
307 | + $charset=$app ? $app->getCharset() : null; |
|
308 | 308 | if(!$charset) |
309 | - $charset = 'UTF-8'; |
|
309 | + $charset='UTF-8'; |
|
310 | 310 | } |
311 | 311 | |
312 | - $length = iconv_strlen($value, $charset); |
|
312 | + $length=iconv_strlen($value, $charset); |
|
313 | 313 | if($minValue!=='') |
314 | - $valid = $valid && $this->isGreaterThan($length,intval($minValue)); |
|
314 | + $valid=$valid && $this->isGreaterThan($length, intval($minValue)); |
|
315 | 315 | if($maxValue!=='') |
316 | - $valid = $valid && $this->isLessThan($length,intval($maxValue)); |
|
316 | + $valid=$valid && $this->isLessThan($length, intval($maxValue)); |
|
317 | 317 | return $valid; |
318 | 318 | } |
319 | 319 |