@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function getDataField() |
40 | 40 | { |
41 | - return $this->getViewState('DataField',''); |
|
41 | + return $this->getViewState('DataField', ''); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function setDataField($value) |
48 | 48 | { |
49 | - $this->setViewState('DataField',$value,''); |
|
49 | + $this->setViewState('DataField', $value, ''); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function getDataFormatString() |
56 | 56 | { |
57 | - return $this->getViewState('DataFormatString',''); |
|
57 | + return $this->getViewState('DataFormatString', ''); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function setDataFormatString($value) |
64 | 64 | { |
65 | - $this->setViewState('DataFormatString',$value,''); |
|
65 | + $this->setViewState('DataFormatString', $value, ''); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function getText() |
72 | 72 | { |
73 | - return $this->getViewState('Text',''); |
|
73 | + return $this->getViewState('Text', ''); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function setText($value) |
80 | 80 | { |
81 | - $this->setViewState('Text',$value,''); |
|
81 | + $this->setViewState('Text', $value, ''); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function getEncode() |
88 | 88 | { |
89 | - return $this->getViewState('Encode',false); |
|
89 | + return $this->getViewState('Encode', false); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function setEncode($value) |
96 | 96 | { |
97 | - $this->setViewState('Encode',TPropertyValue::ensureBoolean($value),false); |
|
97 | + $this->setViewState('Encode', TPropertyValue::ensureBoolean($value), false); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | * @param integer the index to the Columns property that the cell resides in. |
105 | 105 | * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem) |
106 | 106 | */ |
107 | - public function initializeCell($cell,$columnIndex,$itemType) |
|
107 | + public function initializeCell($cell, $columnIndex, $itemType) |
|
108 | 108 | { |
109 | 109 | if($itemType===TListItemType::Item || $itemType===TListItemType::AlternatingItem || $itemType===TListItemType::EditItem || $itemType===TListItemType::SelectedItem) |
110 | 110 | { |
111 | 111 | if($this->getDataField()!=='') |
112 | 112 | { |
113 | - $cell->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
|
113 | + $cell->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn')); |
|
114 | 114 | } else { |
115 | 115 | $text=$this->getText(); |
116 | 116 | if($this->getEncode()) |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | } |
120 | 120 | } |
121 | 121 | else |
122 | - parent::initializeCell($cell,$columnIndex,$itemType); |
|
122 | + parent::initializeCell($cell, $columnIndex, $itemType); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -127,15 +127,15 @@ discard block |
||
127 | 127 | * This method is invoked when datagrid performs databinding. |
128 | 128 | * It populates the content of the cell with the relevant data from data source. |
129 | 129 | */ |
130 | - public function dataBindColumn($sender,$param) |
|
130 | + public function dataBindColumn($sender, $param) |
|
131 | 131 | { |
132 | 132 | $item=$sender->getNamingContainer(); |
133 | 133 | $data=$item->getData(); |
134 | 134 | $formatString=$this->getDataFormatString(); |
135 | 135 | if(($field=$this->getDataField())!=='') |
136 | - $value=$this->formatDataValue($formatString,$this->getDataFieldValue($data,$field)); |
|
136 | + $value=$this->formatDataValue($formatString, $this->getDataFieldValue($data, $field)); |
|
137 | 137 | else |
138 | - $value=$this->formatDataValue($formatString,$data); |
|
138 | + $value=$this->formatDataValue($formatString, $data); |
|
139 | 139 | if($sender instanceof TTableCell) |
140 | 140 | { |
141 | 141 | if($this->getEncode()) |
@@ -116,8 +116,7 @@ |
||
116 | 116 | $text=THttpUtility::htmlEncode($text); |
117 | 117 | $cell->setText($text); |
118 | 118 | } |
119 | - } |
|
120 | - else |
|
119 | + } else |
|
121 | 120 | parent::initializeCell($cell,$columnIndex,$itemType); |
122 | 121 | } |
123 | 122 |
@@ -191,13 +191,11 @@ discard block |
||
191 | 191 | $control->setCaption($this->_caption); |
192 | 192 | $control->setCaptionAlign($this->_captionAlign); |
193 | 193 | } |
194 | - } |
|
195 | - else if($this->_repeatLayout===TRepeatLayout::Raw) |
|
194 | + } else if($this->_repeatLayout===TRepeatLayout::Raw) |
|
196 | 195 | { |
197 | 196 | $this->renderRawContents($writer,$user); |
198 | 197 | return; |
199 | - } |
|
200 | - else |
|
198 | + } else |
|
201 | 199 | $control=new TWebControl; |
202 | 200 | $control->setID($user->getClientID()); |
203 | 201 | $control->copyBaseAttributes($user); |
@@ -295,8 +293,7 @@ discard block |
||
295 | 293 | } |
296 | 294 | } |
297 | 295 | $writer->renderEndTag(); |
298 | - } |
|
299 | - else |
|
296 | + } else |
|
300 | 297 | { |
301 | 298 | $column=0; |
302 | 299 | for($i=0;$i<$itemCount;++$i) |
@@ -334,8 +331,7 @@ discard block |
||
334 | 331 | $rows=$itemCount; |
335 | 332 | $columns=1; |
336 | 333 | $lastColumns=1; |
337 | - } |
|
338 | - else |
|
334 | + } else |
|
339 | 335 | { |
340 | 336 | $columns=$this->_repeatColumns; |
341 | 337 | $rows=(int)(($itemCount+$columns-1)/$columns); |
@@ -391,8 +387,7 @@ discard block |
||
391 | 387 | $user->renderItem($writer,$this,'Separator',$index); |
392 | 388 | $writer->renderEndTag(); |
393 | 389 | $writer->writeLine(); |
394 | - } |
|
395 | - else if($columns>1) |
|
390 | + } else if($columns>1) |
|
396 | 391 | $writer->write("<td></td>\n"); |
397 | 392 | } |
398 | 393 | if($row==$rows-1) |
@@ -407,8 +402,7 @@ discard block |
||
407 | 402 | $writer->writeLine(); |
408 | 403 | } |
409 | 404 | $writer->renderEndTag(); |
410 | - } |
|
411 | - else |
|
405 | + } else |
|
412 | 406 | { |
413 | 407 | $renderedItems=0; |
414 | 408 | for($row=0;$row<$rows;++$row) |
@@ -473,8 +467,7 @@ discard block |
||
473 | 467 | $writer->renderEndTag(); |
474 | 468 | $writer->renderEndTag(); |
475 | 469 | $writer->renderEndTag(); |
476 | - } |
|
477 | - else |
|
470 | + } else |
|
478 | 471 | { |
479 | 472 | $user->renderItem($writer,$this,'Header',-1); |
480 | 473 | if($needBreak) |
@@ -505,8 +498,7 @@ discard block |
||
505 | 498 | $writer->renderEndTag(); |
506 | 499 | $writer->renderEndTag(); |
507 | 500 | $writer->renderEndTag(); |
508 | - } |
|
509 | - else |
|
501 | + } else |
|
510 | 502 | $user->renderItem($writer,$this,'Footer',-1); |
511 | 503 | $writer->writeLine(); |
512 | 504 | } |
@@ -178,6 +178,7 @@ discard block |
||
178 | 178 | * Renders contents in raw format. |
179 | 179 | * @param THtmlWriter writer for the rendering purpose |
180 | 180 | * @param IRepeatInfoUser repeat information user |
181 | + * @param IRepeatInfoUser $user |
|
181 | 182 | */ |
182 | 183 | protected function renderRawContents($writer,$user) |
183 | 184 | { |
@@ -201,6 +202,7 @@ discard block |
||
201 | 202 | * Renders contents in horizontal repeat direction. |
202 | 203 | * @param THtmlWriter writer for the rendering purpose |
203 | 204 | * @param IRepeatInfoUser repeat information user |
205 | + * @param IRepeatInfoUser $user |
|
204 | 206 | */ |
205 | 207 | protected function renderHorizontalContents($writer,$user) |
206 | 208 | { |
@@ -283,6 +285,7 @@ discard block |
||
283 | 285 | * Renders contents in veritcal repeat direction. |
284 | 286 | * @param THtmlWriter writer for the rendering purpose |
285 | 287 | * @param IRepeatInfoUser repeat information user |
288 | + * @param IRepeatInfoUser $user |
|
286 | 289 | */ |
287 | 290 | protected function renderVerticalContents($writer,$user) |
288 | 291 | { |
@@ -416,6 +419,8 @@ discard block |
||
416 | 419 | * @param boolean whether to render using table layout |
417 | 420 | * @param integer number of columns to be rendered |
418 | 421 | * @param boolean if a line break is needed at the end |
422 | + * @param boolean $tableLayout |
|
423 | + * @param boolean $needBreak |
|
419 | 424 | */ |
420 | 425 | protected function renderHeader($writer,$user,$tableLayout,$columns,$needBreak) |
421 | 426 | { |
@@ -449,6 +454,7 @@ discard block |
||
449 | 454 | * @param IRepeatInfoUser repeat information user |
450 | 455 | * @param boolean whether to render using table layout |
451 | 456 | * @param integer number of columns to be rendered |
457 | + * @param boolean $tableLayout |
|
452 | 458 | */ |
453 | 459 | protected function renderFooter($writer,$user,$tableLayout,$columns) |
454 | 460 | { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function setCaptionAlign($value) |
85 | 85 | { |
86 | - $this->_captionAlign=TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TTableCaptionAlign'); |
|
86 | + $this->_captionAlign=TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TTableCaptionAlign'); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function setRepeatColumns($value) |
101 | 101 | { |
102 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
102 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
103 | 103 | throw new TInvalidDataValueException('repeatinfo_repeatcolumns_invalid'); |
104 | 104 | $this->_repeatColumns=$value; |
105 | 105 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function setRepeatDirection($value) |
119 | 119 | { |
120 | - $this->_repeatDirection=TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TRepeatDirection'); |
|
120 | + $this->_repeatDirection=TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TRepeatDirection'); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function setRepeatLayout($value) |
135 | 135 | { |
136 | - $this->_repeatLayout=TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TRepeatLayout'); |
|
136 | + $this->_repeatLayout=TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TRepeatLayout'); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | } |
155 | 155 | else if($this->_repeatLayout===TRepeatLayout::Raw) |
156 | 156 | { |
157 | - $this->renderRawContents($writer,$user); |
|
157 | + $this->renderRawContents($writer, $user); |
|
158 | 158 | return; |
159 | 159 | } |
160 | 160 | else |
@@ -167,9 +167,9 @@ discard block |
||
167 | 167 | $writer->writeLine(); |
168 | 168 | |
169 | 169 | if($this->_repeatDirection===TRepeatDirection::Vertical) |
170 | - $this->renderVerticalContents($writer,$user); |
|
170 | + $this->renderVerticalContents($writer, $user); |
|
171 | 171 | else |
172 | - $this->renderHorizontalContents($writer,$user); |
|
172 | + $this->renderHorizontalContents($writer, $user); |
|
173 | 173 | |
174 | 174 | $control->renderEndTag($writer); |
175 | 175 | } |
@@ -179,22 +179,22 @@ discard block |
||
179 | 179 | * @param THtmlWriter writer for the rendering purpose |
180 | 180 | * @param IRepeatInfoUser repeat information user |
181 | 181 | */ |
182 | - protected function renderRawContents($writer,$user) |
|
182 | + protected function renderRawContents($writer, $user) |
|
183 | 183 | { |
184 | 184 | if($user->getHasHeader()) |
185 | - $user->renderItem($writer,$this,'Header',-1); |
|
185 | + $user->renderItem($writer, $this, 'Header', -1); |
|
186 | 186 | |
187 | 187 | // render items |
188 | 188 | $hasSeparators=$user->getHasSeparators(); |
189 | 189 | $itemCount=$user->getItemCount(); |
190 | - for($i=0;$i<$itemCount;++$i) |
|
190 | + for($i=0; $i < $itemCount; ++$i) |
|
191 | 191 | { |
192 | - $user->renderItem($writer,$this,'Item',$i); |
|
193 | - if($hasSeparators && $i!=$itemCount-1) |
|
194 | - $user->renderItem($writer,$this,'Separator',$i); |
|
192 | + $user->renderItem($writer, $this, 'Item', $i); |
|
193 | + if($hasSeparators && $i!=$itemCount - 1) |
|
194 | + $user->renderItem($writer, $this, 'Separator', $i); |
|
195 | 195 | } |
196 | 196 | if($user->getHasFooter()) |
197 | - $user->renderItem($writer,$this,'Footer',-1); |
|
197 | + $user->renderItem($writer, $this, 'Footer', -1); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | /** |
@@ -202,52 +202,52 @@ discard block |
||
202 | 202 | * @param THtmlWriter writer for the rendering purpose |
203 | 203 | * @param IRepeatInfoUser repeat information user |
204 | 204 | */ |
205 | - protected function renderHorizontalContents($writer,$user) |
|
205 | + protected function renderHorizontalContents($writer, $user) |
|
206 | 206 | { |
207 | 207 | $tableLayout=($this->_repeatLayout===TRepeatLayout::Table); |
208 | 208 | $hasSeparators=$user->getHasSeparators(); |
209 | 209 | $itemCount=$user->getItemCount(); |
210 | - $columns=$this->_repeatColumns===0?$itemCount:$this->_repeatColumns; |
|
211 | - $totalColumns=$hasSeparators?$columns+$columns:$columns; |
|
212 | - $needBreak=$columns<$itemCount; |
|
210 | + $columns=$this->_repeatColumns===0 ? $itemCount : $this->_repeatColumns; |
|
211 | + $totalColumns=$hasSeparators ? $columns + $columns : $columns; |
|
212 | + $needBreak=$columns < $itemCount; |
|
213 | 213 | |
214 | 214 | if($user->getHasHeader()) |
215 | - $this->renderHeader($writer,$user,$tableLayout,$totalColumns,$needBreak); |
|
215 | + $this->renderHeader($writer, $user, $tableLayout, $totalColumns, $needBreak); |
|
216 | 216 | |
217 | 217 | // render items |
218 | 218 | if($tableLayout) |
219 | 219 | { |
220 | 220 | $writer->renderBeginTag('tbody'); |
221 | 221 | $column=0; |
222 | - for($i=0;$i<$itemCount;++$i) |
|
222 | + for($i=0; $i < $itemCount; ++$i) |
|
223 | 223 | { |
224 | 224 | if($column==0) |
225 | 225 | $writer->renderBeginTag('tr'); |
226 | - if(($style=$user->generateItemStyle('Item',$i))!==null) |
|
226 | + if(($style=$user->generateItemStyle('Item', $i))!==null) |
|
227 | 227 | $style->addAttributesToRender($writer); |
228 | 228 | $writer->renderBeginTag('td'); |
229 | - $user->renderItem($writer,$this,'Item',$i); |
|
229 | + $user->renderItem($writer, $this, 'Item', $i); |
|
230 | 230 | $writer->renderEndTag(); |
231 | 231 | $writer->writeLine(); |
232 | - if($hasSeparators && $i!=$itemCount-1) |
|
232 | + if($hasSeparators && $i!=$itemCount - 1) |
|
233 | 233 | { |
234 | - if(($style=$user->generateItemStyle('Separator',$i))!==null) |
|
234 | + if(($style=$user->generateItemStyle('Separator', $i))!==null) |
|
235 | 235 | $style->addAttributesToRender($writer); |
236 | 236 | $writer->renderBeginTag('td'); |
237 | - $user->renderItem($writer,$this,'Separator',$i); |
|
237 | + $user->renderItem($writer, $this, 'Separator', $i); |
|
238 | 238 | $writer->renderEndTag(); |
239 | 239 | $writer->writeLine(); |
240 | 240 | } |
241 | 241 | $column++; |
242 | - if($i==$itemCount-1) |
|
242 | + if($i==$itemCount - 1) |
|
243 | 243 | { |
244 | - $restColumns=$columns-$column; |
|
244 | + $restColumns=$columns - $column; |
|
245 | 245 | if($hasSeparators) |
246 | - $restColumns=$restColumns?$restColumns+$restColumns+1:1; |
|
247 | - for($j=0;$j<$restColumns;++$j) |
|
246 | + $restColumns=$restColumns ? $restColumns + $restColumns + 1 : 1; |
|
247 | + for($j=0; $j < $restColumns; ++$j) |
|
248 | 248 | $writer->write("<td></td>\n"); |
249 | 249 | } |
250 | - if($column==$columns || $i==$itemCount-1) |
|
250 | + if($column==$columns || $i==$itemCount - 1) |
|
251 | 251 | { |
252 | 252 | $writer->renderEndTag(); |
253 | 253 | $writer->writeLine(); |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | else |
260 | 260 | { |
261 | 261 | $column=0; |
262 | - for($i=0;$i<$itemCount;++$i) |
|
262 | + for($i=0; $i < $itemCount; ++$i) |
|
263 | 263 | { |
264 | - $user->renderItem($writer,$this,'Item',$i); |
|
265 | - if($hasSeparators && $i!=$itemCount-1) |
|
266 | - $user->renderItem($writer,$this,'Separator',$i); |
|
264 | + $user->renderItem($writer, $this, 'Item', $i); |
|
265 | + if($hasSeparators && $i!=$itemCount - 1) |
|
266 | + $user->renderItem($writer, $this, 'Separator', $i); |
|
267 | 267 | $column++; |
268 | - if($column==$columns || $i==$itemCount-1) |
|
268 | + if($column==$columns || $i==$itemCount - 1) |
|
269 | 269 | { |
270 | 270 | if($needBreak) |
271 | 271 | $writer->writeBreak(); |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | } |
277 | 277 | |
278 | 278 | if($user->getHasFooter()) |
279 | - $this->renderFooter($writer,$user,$tableLayout,$totalColumns,$needBreak); |
|
279 | + $this->renderFooter($writer, $user, $tableLayout, $totalColumns, $needBreak); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
@@ -284,12 +284,12 @@ discard block |
||
284 | 284 | * @param THtmlWriter writer for the rendering purpose |
285 | 285 | * @param IRepeatInfoUser repeat information user |
286 | 286 | */ |
287 | - protected function renderVerticalContents($writer,$user) |
|
287 | + protected function renderVerticalContents($writer, $user) |
|
288 | 288 | { |
289 | 289 | $tableLayout=($this->_repeatLayout===TRepeatLayout::Table); |
290 | 290 | $hasSeparators=$user->getHasSeparators(); |
291 | 291 | $itemCount=$user->getItemCount(); |
292 | - if($this->_repeatColumns<=1) |
|
292 | + if($this->_repeatColumns <= 1) |
|
293 | 293 | { |
294 | 294 | $rows=$itemCount; |
295 | 295 | $columns=1; |
@@ -298,69 +298,69 @@ discard block |
||
298 | 298 | else |
299 | 299 | { |
300 | 300 | $columns=$this->_repeatColumns; |
301 | - $rows=(int)(($itemCount+$columns-1)/$columns); |
|
302 | - if($rows==0 && $itemCount>0) |
|
301 | + $rows=(int) (($itemCount + $columns - 1) / $columns); |
|
302 | + if($rows==0 && $itemCount > 0) |
|
303 | 303 | $rows=1; |
304 | - if(($lastColumns=$itemCount%$columns)==0) |
|
304 | + if(($lastColumns=$itemCount % $columns)==0) |
|
305 | 305 | $lastColumns=$columns; |
306 | 306 | } |
307 | - $totalColumns=$hasSeparators?$columns+$columns:$columns; |
|
307 | + $totalColumns=$hasSeparators ? $columns + $columns : $columns; |
|
308 | 308 | |
309 | 309 | if($user->getHasHeader()) |
310 | - $this->renderHeader($writer,$user,$tableLayout,$totalColumns,false); |
|
310 | + $this->renderHeader($writer, $user, $tableLayout, $totalColumns, false); |
|
311 | 311 | |
312 | 312 | if($tableLayout) |
313 | 313 | { |
314 | 314 | $writer->renderBeginTag('tbody'); |
315 | 315 | $renderedItems=0; |
316 | - for($row=0;$row<$rows;++$row) |
|
316 | + for($row=0; $row < $rows; ++$row) |
|
317 | 317 | { |
318 | 318 | $index=$row; |
319 | 319 | $writer->renderBeginTag('tr'); |
320 | - for($col=0;$col<$columns;++$col) |
|
320 | + for($col=0; $col < $columns; ++$col) |
|
321 | 321 | { |
322 | - if($renderedItems>=$itemCount) |
|
322 | + if($renderedItems >= $itemCount) |
|
323 | 323 | break; |
324 | - if($col>0) |
|
324 | + if($col > 0) |
|
325 | 325 | { |
326 | 326 | $index+=$rows; |
327 | - if($col-1>=$lastColumns) |
|
327 | + if($col - 1 >= $lastColumns) |
|
328 | 328 | $index--; |
329 | 329 | } |
330 | - if($index>=$itemCount) |
|
330 | + if($index >= $itemCount) |
|
331 | 331 | continue; |
332 | 332 | $renderedItems++; |
333 | - if(($style=$user->generateItemStyle('Item',$index))!==null) |
|
333 | + if(($style=$user->generateItemStyle('Item', $index))!==null) |
|
334 | 334 | $style->addAttributesToRender($writer); |
335 | 335 | $writer->renderBeginTag('td'); |
336 | - $user->renderItem($writer,$this,'Item',$index); |
|
336 | + $user->renderItem($writer, $this, 'Item', $index); |
|
337 | 337 | $writer->renderEndTag(); |
338 | 338 | $writer->writeLine(); |
339 | 339 | if(!$hasSeparators) |
340 | 340 | continue; |
341 | - if($renderedItems<$itemCount-1) |
|
341 | + if($renderedItems < $itemCount - 1) |
|
342 | 342 | { |
343 | 343 | if($columns==1) |
344 | 344 | { |
345 | 345 | $writer->renderEndTag(); |
346 | 346 | $writer->renderBeginTag('tr'); |
347 | 347 | } |
348 | - if(($style=$user->generateItemStyle('Separator',$index))!==null) |
|
348 | + if(($style=$user->generateItemStyle('Separator', $index))!==null) |
|
349 | 349 | $style->addAttributesToRender($writer); |
350 | 350 | $writer->renderBeginTag('td'); |
351 | - $user->renderItem($writer,$this,'Separator',$index); |
|
351 | + $user->renderItem($writer, $this, 'Separator', $index); |
|
352 | 352 | $writer->renderEndTag(); |
353 | 353 | $writer->writeLine(); |
354 | 354 | } |
355 | - else if($columns>1) |
|
355 | + else if($columns > 1) |
|
356 | 356 | $writer->write("<td></td>\n"); |
357 | 357 | } |
358 | - if($row==$rows-1) |
|
358 | + if($row==$rows - 1) |
|
359 | 359 | { |
360 | - $restColumns=$columns-$lastColumns; |
|
360 | + $restColumns=$columns - $lastColumns; |
|
361 | 361 | if($hasSeparators) |
362 | 362 | $restColumns+=$restColumns; |
363 | - for($col=0;$col<$restColumns;++$col) |
|
363 | + for($col=0; $col < $restColumns; ++$col) |
|
364 | 364 | $writer->write("<td></td>\n"); |
365 | 365 | } |
366 | 366 | $writer->renderEndTag(); |
@@ -371,41 +371,41 @@ discard block |
||
371 | 371 | else |
372 | 372 | { |
373 | 373 | $renderedItems=0; |
374 | - for($row=0;$row<$rows;++$row) |
|
374 | + for($row=0; $row < $rows; ++$row) |
|
375 | 375 | { |
376 | 376 | $index=$row; |
377 | - for($col=0;$col<$columns;++$col) |
|
377 | + for($col=0; $col < $columns; ++$col) |
|
378 | 378 | { |
379 | - if($renderedItems>=$itemCount) |
|
379 | + if($renderedItems >= $itemCount) |
|
380 | 380 | break; |
381 | - if($col>0) |
|
381 | + if($col > 0) |
|
382 | 382 | { |
383 | 383 | $index+=$rows; |
384 | - if($col-1>=$lastColumns) |
|
384 | + if($col - 1 >= $lastColumns) |
|
385 | 385 | $index--; |
386 | 386 | } |
387 | - if($index>=$itemCount) |
|
387 | + if($index >= $itemCount) |
|
388 | 388 | continue; |
389 | 389 | $renderedItems++; |
390 | - $user->renderItem($writer,$this,'Item',$index); |
|
390 | + $user->renderItem($writer, $this, 'Item', $index); |
|
391 | 391 | $writer->writeLine(); |
392 | 392 | if(!$hasSeparators) |
393 | 393 | continue; |
394 | - if($renderedItems<$itemCount-1) |
|
394 | + if($renderedItems < $itemCount - 1) |
|
395 | 395 | { |
396 | 396 | if($columns==1) |
397 | 397 | $writer->writeBreak(); |
398 | - $user->renderItem($writer,$this,'Separator',$index); |
|
398 | + $user->renderItem($writer, $this, 'Separator', $index); |
|
399 | 399 | } |
400 | 400 | $writer->writeLine(); |
401 | 401 | } |
402 | - if($row<$rows-1 || $user->getHasFooter()) |
|
402 | + if($row < $rows - 1 || $user->getHasFooter()) |
|
403 | 403 | $writer->writeBreak(); |
404 | 404 | } |
405 | 405 | } |
406 | 406 | |
407 | 407 | if($user->getHasFooter()) |
408 | - $this->renderFooter($writer,$user,$tableLayout,$totalColumns,false); |
|
408 | + $this->renderFooter($writer, $user, $tableLayout, $totalColumns, false); |
|
409 | 409 | |
410 | 410 | } |
411 | 411 | |
@@ -417,26 +417,26 @@ discard block |
||
417 | 417 | * @param integer number of columns to be rendered |
418 | 418 | * @param boolean if a line break is needed at the end |
419 | 419 | */ |
420 | - protected function renderHeader($writer,$user,$tableLayout,$columns,$needBreak) |
|
420 | + protected function renderHeader($writer, $user, $tableLayout, $columns, $needBreak) |
|
421 | 421 | { |
422 | 422 | if($tableLayout) |
423 | 423 | { |
424 | 424 | $writer->renderBeginTag('thead'); |
425 | 425 | $writer->renderBeginTag('tr'); |
426 | - if($columns>1) |
|
427 | - $writer->addAttribute('colspan',"$columns"); |
|
428 | - $writer->addAttribute('scope','col'); |
|
429 | - if(($style=$user->generateItemStyle('Header',-1))!==null) |
|
426 | + if($columns > 1) |
|
427 | + $writer->addAttribute('colspan', "$columns"); |
|
428 | + $writer->addAttribute('scope', 'col'); |
|
429 | + if(($style=$user->generateItemStyle('Header', -1))!==null) |
|
430 | 430 | $style->addAttributesToRender($writer); |
431 | 431 | $writer->renderBeginTag('th'); |
432 | - $user->renderItem($writer,$this,'Header',-1); |
|
432 | + $user->renderItem($writer, $this, 'Header', -1); |
|
433 | 433 | $writer->renderEndTag(); |
434 | 434 | $writer->renderEndTag(); |
435 | 435 | $writer->renderEndTag(); |
436 | 436 | } |
437 | 437 | else |
438 | 438 | { |
439 | - $user->renderItem($writer,$this,'Header',-1); |
|
439 | + $user->renderItem($writer, $this, 'Header', -1); |
|
440 | 440 | if($needBreak) |
441 | 441 | $writer->writeBreak(); |
442 | 442 | } |
@@ -450,24 +450,24 @@ discard block |
||
450 | 450 | * @param boolean whether to render using table layout |
451 | 451 | * @param integer number of columns to be rendered |
452 | 452 | */ |
453 | - protected function renderFooter($writer,$user,$tableLayout,$columns) |
|
453 | + protected function renderFooter($writer, $user, $tableLayout, $columns) |
|
454 | 454 | { |
455 | 455 | if($tableLayout) |
456 | 456 | { |
457 | 457 | $writer->renderBeginTag('tfoot'); |
458 | 458 | $writer->renderBeginTag('tr'); |
459 | - if($columns>1) |
|
460 | - $writer->addAttribute('colspan',"$columns"); |
|
461 | - if(($style=$user->generateItemStyle('Footer',-1))!==null) |
|
459 | + if($columns > 1) |
|
460 | + $writer->addAttribute('colspan', "$columns"); |
|
461 | + if(($style=$user->generateItemStyle('Footer', -1))!==null) |
|
462 | 462 | $style->addAttributesToRender($writer); |
463 | 463 | $writer->renderBeginTag('td'); |
464 | - $user->renderItem($writer,$this,'Footer',-1); |
|
464 | + $user->renderItem($writer, $this, 'Footer', -1); |
|
465 | 465 | $writer->renderEndTag(); |
466 | 466 | $writer->renderEndTag(); |
467 | 467 | $writer->renderEndTag(); |
468 | 468 | } |
469 | 469 | else |
470 | - $user->renderItem($writer,$this,'Footer',-1); |
|
470 | + $user->renderItem($writer, $this, 'Footer', -1); |
|
471 | 471 | $writer->writeLine(); |
472 | 472 | } |
473 | 473 | } |
474 | 474 | \ No newline at end of file |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function getInitialValue() |
53 | 53 | { |
54 | - return $this->getViewState('InitialValue',$this->getControlPromptValue()); |
|
54 | + return $this->getViewState('InitialValue', $this->getControlPromptValue()); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | protected function getControlPromptValue() |
63 | 63 | { |
64 | - $control = $this->getValidationTarget(); |
|
64 | + $control=$this->getValidationTarget(); |
|
65 | 65 | if($control instanceof TListControl) |
66 | 66 | return $control->getPromptValue(); |
67 | 67 | return ''; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function setInitialValue($value) |
75 | 75 | { |
76 | - $this->setViewState('InitialValue',TPropertyValue::ensureString($value),''); |
|
76 | + $this->setViewState('InitialValue', TPropertyValue::ensureString($value), ''); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected function evaluateIsValid() |
91 | 91 | { |
92 | - $control = $this->getValidationTarget(); |
|
92 | + $control=$this->getValidationTarget(); |
|
93 | 93 | if($control instanceof TListControl) |
94 | 94 | return $this->validateListControl($control); |
95 | 95 | else if($control instanceof TRadioButton && strlen($control->getGroupName()) > 0) |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | |
101 | 101 | private function validateListControl($control) |
102 | 102 | { |
103 | - $initial = trim($this->getInitialValue()); |
|
104 | - $count = 0; |
|
103 | + $initial=trim($this->getInitialValue()); |
|
104 | + $count=0; |
|
105 | 105 | foreach($control->getItems() as $item) |
106 | 106 | { |
107 | - if($item->getSelected() && $item->getValue() != $initial) |
|
107 | + if($item->getSelected() && $item->getValue()!=$initial) |
|
108 | 108 | $count++; |
109 | 109 | } |
110 | 110 | return $count > 0; |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | |
113 | 113 | private function validateRadioButtonGroup($control) |
114 | 114 | { |
115 | - $initial = trim($this->getInitialValue()); |
|
115 | + $initial=trim($this->getInitialValue()); |
|
116 | 116 | foreach($control->getRadioButtonsInGroup() as $radio) |
117 | 117 | { |
118 | 118 | if($radio->getChecked()) |
119 | 119 | { |
120 | - if(strlen($value = $radio->getValue()) > 0) |
|
121 | - return $value !== $initial; |
|
120 | + if(strlen($value=$radio->getValue()) > 0) |
|
121 | + return $value!==$initial; |
|
122 | 122 | else |
123 | 123 | return true; |
124 | 124 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | private function validateStandardControl($control) |
130 | 130 | { |
131 | - $initial = trim($this->getInitialValue()); |
|
131 | + $initial=trim($this->getInitialValue()); |
|
132 | 132 | $value=$this->getValidationValue($control); |
133 | 133 | return (is_bool($value) && $value) || trim($value)!==$initial; |
134 | 134 | } |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | */ |
140 | 140 | protected function getClientScriptOptions() |
141 | 141 | { |
142 | - $options = parent::getClientScriptOptions(); |
|
142 | + $options=parent::getClientScriptOptions(); |
|
143 | 143 | $options['InitialValue']=$this->getInitialValue(); |
144 | - $control = $this->getValidationTarget(); |
|
144 | + $control=$this->getValidationTarget(); |
|
145 | 145 | if($control instanceof TListControl) |
146 | - $options['TotalItems'] = $control->getItemCount(); |
|
146 | + $options['TotalItems']=$control->getItemCount(); |
|
147 | 147 | if($control instanceof TRadioButton && strlen($control->getGroupName()) > 0) |
148 | - $options['GroupName'] = $control->getGroupName(); |
|
148 | + $options['GroupName']=$control->getGroupName(); |
|
149 | 149 | return $options; |
150 | 150 | } |
151 | 151 | } |
@@ -96,6 +96,9 @@ discard block |
||
96 | 96 | return $this->validateStandardControl($control); |
97 | 97 | } |
98 | 98 | |
99 | + /** |
|
100 | + * @param TListControl $control |
|
101 | + */ |
|
99 | 102 | private function validateListControl($control) |
100 | 103 | { |
101 | 104 | $initial = trim($this->getInitialValue()); |
@@ -108,6 +111,9 @@ discard block |
||
108 | 111 | return $count > 0; |
109 | 112 | } |
110 | 113 | |
114 | + /** |
|
115 | + * @param TRadioButton $control |
|
116 | + */ |
|
111 | 117 | private function validateRadioButtonGroup($control) |
112 | 118 | { |
113 | 119 | $initial = trim($this->getInitialValue()); |
@@ -124,6 +130,9 @@ discard block |
||
124 | 130 | return false; |
125 | 131 | } |
126 | 132 | |
133 | + /** |
|
134 | + * @param \Prado\Web\UI\TControl $control |
|
135 | + */ |
|
127 | 136 | private function validateStandardControl($control) |
128 | 137 | { |
129 | 138 | $initial = trim($this->getInitialValue()); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class TReCaptchaValidator extends TBaseValidator |
32 | 32 | { |
33 | - protected $_isvalid = null; |
|
33 | + protected $_isvalid=null; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Gets the name of the javascript class responsible for performing validation for this control. |
@@ -49,18 +49,18 @@ discard block |
||
49 | 49 | |
50 | 50 | protected function getCaptchaControl() |
51 | 51 | { |
52 | - $control = $this->getValidationTarget(); |
|
53 | - if (!$control) |
|
52 | + $control=$this->getValidationTarget(); |
|
53 | + if(!$control) |
|
54 | 54 | throw new Exception('No target control specified for TReCaptchaValidator'); |
55 | - if (!($control instanceof TReCaptcha)) |
|
55 | + if(!($control instanceof TReCaptcha)) |
|
56 | 56 | throw new Exception('TReCaptchaValidator only works with TReCaptcha controls'); |
57 | 57 | return $control; |
58 | 58 | } |
59 | 59 | |
60 | 60 | public function getClientScriptOptions() |
61 | 61 | { |
62 | - $options = parent::getClientScriptOptions(); |
|
63 | - $options['ResponseFieldName'] = $this->getCaptchaControl()->getResponseFieldName(); |
|
62 | + $options=parent::getClientScriptOptions(); |
|
63 | + $options['ResponseFieldName']=$this->getCaptchaControl()->getResponseFieldName(); |
|
64 | 64 | return $options; |
65 | 65 | } |
66 | 66 | |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | protected function evaluateIsValid() |
75 | 75 | { |
76 | 76 | // check validity only once (if trying to evaulate multiple times, all redundant checks would fail) |
77 | - if (is_null($this->_isvalid)) |
|
77 | + if(is_null($this->_isvalid)) |
|
78 | 78 | { |
79 | - $control = $this->getCaptchaControl(); |
|
80 | - $this->_isvalid = $control->validate(); |
|
79 | + $control=$this->getCaptchaControl(); |
|
80 | + $this->_isvalid=$control->validate(); |
|
81 | 81 | } |
82 | 82 | return ($this->_isvalid==true); |
83 | 83 | } |
@@ -86,23 +86,23 @@ discard block |
||
86 | 86 | { |
87 | 87 | parent::onPreRender($param); |
88 | 88 | |
89 | - $cs = $this->Page->getClientScript(); |
|
89 | + $cs=$this->Page->getClientScript(); |
|
90 | 90 | $cs->registerPradoScript('validator'); |
91 | 91 | |
92 | 92 | // communicate validation status to the client side |
93 | - $value = $this->_isvalid===false ? '0' : '1'; |
|
94 | - $cs->registerHiddenField($this->getClientID().'_1',$value); |
|
93 | + $value=$this->_isvalid===false ? '0' : '1'; |
|
94 | + $cs->registerHiddenField($this->getClientID().'_1', $value); |
|
95 | 95 | |
96 | 96 | // update validator display |
97 | - if ($control = $this->getValidationTarget()) |
|
97 | + if($control=$this->getValidationTarget()) |
|
98 | 98 | { |
99 | - $fn = 'captchaUpdateValidatorStatus_'.$this->getClientID(); |
|
99 | + $fn='captchaUpdateValidatorStatus_'.$this->getClientID(); |
|
100 | 100 | |
101 | 101 | // check if we need to request a new captcha too |
102 | - if ($this->Page->IsCallback) |
|
102 | + if($this->Page->IsCallback) |
|
103 | 103 | { |
104 | - if ($control->getVisible(true)) |
|
105 | - if (!is_null($this->_isvalid)) |
|
104 | + if($control->getVisible(true)) |
|
105 | + if(!is_null($this->_isvalid)) |
|
106 | 106 | { |
107 | 107 | // if the response has been tested and we reach the pre-render phase |
108 | 108 | // then we need to regenerate the token, because it won't test positive |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | - $cs->registerEndScript($this->getClientID().'::validate', implode(' ',array( |
|
115 | + $cs->registerEndScript($this->getClientID().'::validate', implode(' ', array( |
|
116 | 116 | // this function will be used to update the validator |
117 | 117 | 'function '.$fn.'(valid)', |
118 | 118 | '{', |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function getDataField() |
49 | 49 | { |
50 | - return $this->getViewState('DataField',''); |
|
50 | + return $this->getViewState('DataField', ''); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function setDataField($value) |
57 | 57 | { |
58 | - $this->setViewState('DataField',$value,''); |
|
58 | + $this->setViewState('DataField', $value, ''); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function getReadOnly() |
65 | 65 | { |
66 | - return $this->getViewState('ReadOnly',false); |
|
66 | + return $this->getViewState('ReadOnly', false); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function setReadOnly($value) |
73 | 73 | { |
74 | - $this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false); |
|
74 | + $this->setViewState('ReadOnly', TPropertyValue::ensureBoolean($value), false); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @param integer the index to the Columns property that the cell resides in. |
85 | 85 | * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem) |
86 | 86 | */ |
87 | - public function initializeCell($cell,$columnIndex,$itemType) |
|
87 | + public function initializeCell($cell, $columnIndex, $itemType) |
|
88 | 88 | { |
89 | 89 | if($itemType===TListItemType::Item || $itemType===TListItemType::AlternatingItem || $itemType===TListItemType::SelectedItem || $itemType===TListItemType::EditItem) |
90 | 90 | { |
@@ -93,12 +93,12 @@ discard block |
||
93 | 93 | $checkBox->setEnabled(false); |
94 | 94 | $cell->setHorizontalAlign('Center'); |
95 | 95 | $cell->getControls()->add($checkBox); |
96 | - $cell->registerObject('CheckBox',$checkBox); |
|
96 | + $cell->registerObject('CheckBox', $checkBox); |
|
97 | 97 | if($this->getDataField()!=='') |
98 | - $checkBox->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
|
98 | + $checkBox->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn')); |
|
99 | 99 | } |
100 | 100 | else |
101 | - parent::initializeCell($cell,$columnIndex,$itemType); |
|
101 | + parent::initializeCell($cell, $columnIndex, $itemType); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -106,12 +106,12 @@ discard block |
||
106 | 106 | * This method is invoked when datagrid performs databinding. |
107 | 107 | * It populates the content of the cell with the relevant data from data source. |
108 | 108 | */ |
109 | - public function dataBindColumn($sender,$param) |
|
109 | + public function dataBindColumn($sender, $param) |
|
110 | 110 | { |
111 | 111 | $item=$sender->getNamingContainer(); |
112 | 112 | $data=$item->getData(); |
113 | 113 | if(($field=$this->getDataField())!=='') |
114 | - $value=TPropertyValue::ensureBoolean($this->getDataFieldValue($data,$field)); |
|
114 | + $value=TPropertyValue::ensureBoolean($this->getDataFieldValue($data, $field)); |
|
115 | 115 | else |
116 | 116 | $value=TPropertyValue::ensureBoolean($data); |
117 | 117 | if($sender instanceof TCheckBox) |
@@ -90,8 +90,7 @@ |
||
90 | 90 | $cell->registerObject('CheckBox',$checkBox); |
91 | 91 | if($this->getDataField()!=='') |
92 | 92 | $checkBox->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
93 | - } |
|
94 | - else |
|
93 | + } else |
|
95 | 94 | parent::initializeCell($cell,$columnIndex,$itemType); |
96 | 95 | } |
97 | 96 |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | */ |
40 | 40 | protected function addAttributesToRender($writer) |
41 | 41 | { |
42 | - $writer->addAttribute('src',$this->getImageUrl()); |
|
43 | - $writer->addAttribute('alt',$this->getAlternateText()); |
|
42 | + $writer->addAttribute('src', $this->getImageUrl()); |
|
43 | + $writer->addAttribute('alt', $this->getAlternateText()); |
|
44 | 44 | if(($desc=$this->getDescriptionUrl())!=='') |
45 | - $writer->addAttribute('longdesc',$desc); |
|
45 | + $writer->addAttribute('longdesc', $desc); |
|
46 | 46 | if(($align=$this->getImageAlign())!=='') |
47 | - $writer->addAttribute('align',$align); |
|
47 | + $writer->addAttribute('align', $align); |
|
48 | 48 | parent::addAttributesToRender($writer); |
49 | 49 | } |
50 | 50 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function getAlternateText() |
64 | 64 | { |
65 | - return $this->getViewState('AlternateText',''); |
|
65 | + return $this->getViewState('AlternateText', ''); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function setAlternateText($value) |
73 | 73 | { |
74 | - $this->setViewState('AlternateText',$value,''); |
|
74 | + $this->setViewState('AlternateText', $value, ''); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function getImageAlign() |
81 | 81 | { |
82 | - return $this->getViewState('ImageAlign',''); |
|
82 | + return $this->getViewState('ImageAlign', ''); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function setImageAlign($value) |
93 | 93 | { |
94 | - $this->setViewState('ImageAlign',$value,''); |
|
94 | + $this->setViewState('ImageAlign', $value, ''); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function getImageUrl() |
101 | 101 | { |
102 | - return $this->getViewState('ImageUrl',''); |
|
102 | + return $this->getViewState('ImageUrl', ''); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function setImageUrl($value) |
109 | 109 | { |
110 | - $this->setViewState('ImageUrl',$value,''); |
|
110 | + $this->setViewState('ImageUrl', $value, ''); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function getDescriptionUrl() |
143 | 143 | { |
144 | - return $this->getViewState('DescriptionUrl',''); |
|
144 | + return $this->getViewState('DescriptionUrl', ''); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function setDescriptionUrl($value) |
151 | 151 | { |
152 | - $this->setViewState('DescriptionUrl',$value,''); |
|
152 | + $this->setViewState('DescriptionUrl', $value, ''); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 |
@@ -39,7 +39,7 @@ |
||
39 | 39 | { |
40 | 40 | if(($id=$this->getID())==='') |
41 | 41 | throw new TConfigurationException('content_id_required'); |
42 | - $this->getTemplateControl()->registerContent($id,$this); |
|
42 | + $this->getTemplateControl()->registerContent($id, $this); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 |
@@ -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 | /** |
@@ -125,7 +125,7 @@ |
||
125 | 125 | /** |
126 | 126 | * Returns the value to be validated. |
127 | 127 | * This methid is required by \Prado\Web\UI\IValidatable interface. |
128 | - * @return mixed the value of the property to be validated. |
|
128 | + * @return string the value of the property to be validated. |
|
129 | 129 | */ |
130 | 130 | public function getValidationPropertyValue() |
131 | 131 | { |
@@ -57,9 +57,9 @@ |
||
57 | 57 | * @param array the input data collection |
58 | 58 | * @return boolean whether the data of the control has been changed |
59 | 59 | */ |
60 | - public function loadPostData($key,$values) |
|
60 | + public function loadPostData($key, $values) |
|
61 | 61 | { |
62 | - $value=isset($values[$key])?$values[$key]:''; |
|
62 | + $value=isset($values[$key]) ? $values[$key] : ''; |
|
63 | 63 | $oldSelection=$this->getSelectedIndex(); |
64 | 64 | $this->ensureDataBound(); |
65 | 65 | foreach($this->getItems() as $index=>$item) |
@@ -37,7 +37,7 @@ |
||
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Creates a control used for repetition (used as a template). |
40 | - * @return TControl the control to be repeated |
|
40 | + * @return TRadioButtonItem the control to be repeated |
|
41 | 41 | */ |
42 | 42 | protected function createRepeatedControl() |
43 | 43 | { |