@@ -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 |
@@ -106,8 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | if($this->getEnableClientScript() && $this->needPostBackScript()) |
108 | 108 | $this->renderClientControlScript($writer); |
109 | - } |
|
110 | - else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
109 | + } else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
111 | 110 | $writer->addAttribute('disabled','disabled'); |
112 | 111 | parent::addAttributesToRender($writer); |
113 | 112 | } |
@@ -141,8 +140,7 @@ discard block |
||
141 | 140 | { |
142 | 141 | $group=$this->getValidationGroup(); |
143 | 142 | return $this->getPage()->getValidators($group)->getCount()>0; |
144 | - } |
|
145 | - else |
|
143 | + } else |
|
146 | 144 | return false; |
147 | 145 | } |
148 | 146 |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function getButtonTag() |
66 | 66 | { |
67 | - return $this->getViewState('ButtonTag',TButtonTag::Input); |
|
67 | + return $this->getViewState('ButtonTag', TButtonTag::Input); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function setButtonTag($value) |
74 | 74 | { |
75 | - $this->setViewState('ButtonTag',TPropertyValue::ensureEnum($value,'TButtonTag'),TButtonTag::Input); |
|
75 | + $this->setViewState('ButtonTag', TPropertyValue::ensureEnum($value, 'TButtonTag'), TButtonTag::Input); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function getEnableClientScript() |
82 | 82 | { |
83 | - return $this->getViewState('EnableClientScript',true); |
|
83 | + return $this->getViewState('EnableClientScript', true); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function setEnableClientScript($value) |
90 | 90 | { |
91 | - $this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true); |
|
91 | + $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -100,20 +100,20 @@ discard block |
||
100 | 100 | { |
101 | 101 | $page=$this->getPage(); |
102 | 102 | $page->ensureRenderInForm($this); |
103 | - $writer->addAttribute('type',strtolower($this->getButtonType())); |
|
103 | + $writer->addAttribute('type', strtolower($this->getButtonType())); |
|
104 | 104 | if(($uniqueID=$this->getUniqueID())!=='') |
105 | - $writer->addAttribute('name',$uniqueID); |
|
105 | + $writer->addAttribute('name', $uniqueID); |
|
106 | 106 | if($this->getButtonTag()===TButtonTag::Button) |
107 | 107 | $this->addParsedObject($this->getText()); |
108 | 108 | else |
109 | - $writer->addAttribute('value',$this->getText()); |
|
109 | + $writer->addAttribute('value', $this->getText()); |
|
110 | 110 | if($this->getEnabled(true)) |
111 | 111 | { |
112 | 112 | if($this->getEnableClientScript() && $this->needPostBackScript()) |
113 | 113 | $this->renderClientControlScript($writer); |
114 | 114 | } |
115 | 115 | else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
116 | - $writer->addAttribute('disabled','disabled'); |
|
116 | + $writer->addAttribute('disabled', 'disabled'); |
|
117 | 117 | |
118 | 118 | parent::addAttributesToRender($writer); |
119 | 119 | } |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | */ |
124 | 124 | protected function renderClientControlScript($writer) |
125 | 125 | { |
126 | - $writer->addAttribute('id',$this->getClientID()); |
|
127 | - $this->getPage()->getClientScript()->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions()); |
|
126 | + $writer->addAttribute('id', $this->getClientID()); |
|
127 | + $this->getPage()->getClientScript()->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | if($this->getCausesValidation()) |
146 | 146 | { |
147 | 147 | $group=$this->getValidationGroup(); |
148 | - return $this->getPage()->getValidators($group)->getCount()>0; |
|
148 | + return $this->getPage()->getValidators($group)->getCount() > 0; |
|
149 | 149 | } |
150 | 150 | else |
151 | 151 | return false; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function setIsDefaultButton($value) |
158 | 158 | { |
159 | - $this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value),false); |
|
159 | + $this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value), false); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | { |
187 | 187 | $options['ID']=$this->getClientID(); |
188 | 188 | $options['CausesValidation']=$this->getCausesValidation(); |
189 | - $options['EventTarget'] = $this->getUniqueID(); |
|
189 | + $options['EventTarget']=$this->getUniqueID(); |
|
190 | 190 | $options['ValidationGroup']=$this->getValidationGroup(); |
191 | 191 | |
192 | 192 | return $options; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function onClick($param) |
215 | 215 | { |
216 | - $this->raiseEvent('OnClick',$this,$param); |
|
216 | + $this->raiseEvent('OnClick', $this, $param); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function onCommand($param) |
227 | 227 | { |
228 | - $this->raiseEvent('OnCommand',$this,$param); |
|
229 | - $this->raiseBubbleEvent($this,$param); |
|
228 | + $this->raiseEvent('OnCommand', $this, $param); |
|
229 | + $this->raiseBubbleEvent($this, $param); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | if($this->getCausesValidation()) |
244 | 244 | $this->getPage()->validate($this->getValidationGroup()); |
245 | 245 | $this->onClick(null); |
246 | - $this->onCommand(new \Prado\Web\UI\TCommandEventParameter($this->getCommandName(),$this->getCommandParameter())); |
|
246 | + $this->onCommand(new \Prado\Web\UI\TCommandEventParameter($this->getCommandName(), $this->getCommandParameter())); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | /** |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | */ |
252 | 252 | public function getText() |
253 | 253 | { |
254 | - return $this->getViewState('Text',''); |
|
254 | + return $this->getViewState('Text', ''); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | */ |
260 | 260 | public function setText($value) |
261 | 261 | { |
262 | - $this->setViewState('Text',$value,''); |
|
262 | + $this->setViewState('Text', $value, ''); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | */ |
294 | 294 | public function getCausesValidation() |
295 | 295 | { |
296 | - return $this->getViewState('CausesValidation',true); |
|
296 | + return $this->getViewState('CausesValidation', true); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | /** |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | */ |
302 | 302 | public function setCausesValidation($value) |
303 | 303 | { |
304 | - $this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true); |
|
304 | + $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | /** |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | */ |
310 | 310 | public function getCommandName() |
311 | 311 | { |
312 | - return $this->getViewState('CommandName',''); |
|
312 | + return $this->getViewState('CommandName', ''); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | /** |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | */ |
318 | 318 | public function setCommandName($value) |
319 | 319 | { |
320 | - $this->setViewState('CommandName',$value,''); |
|
320 | + $this->setViewState('CommandName', $value, ''); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | /** |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | */ |
326 | 326 | public function getCommandParameter() |
327 | 327 | { |
328 | - return $this->getViewState('CommandParameter',''); |
|
328 | + return $this->getViewState('CommandParameter', ''); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | */ |
334 | 334 | public function setCommandParameter($value) |
335 | 335 | { |
336 | - $this->setViewState('CommandParameter',$value,''); |
|
336 | + $this->setViewState('CommandParameter', $value, ''); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | */ |
342 | 342 | public function getValidationGroup() |
343 | 343 | { |
344 | - return $this->getViewState('ValidationGroup',''); |
|
344 | + return $this->getViewState('ValidationGroup', ''); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | */ |
350 | 350 | public function setValidationGroup($value) |
351 | 351 | { |
352 | - $this->setViewState('ValidationGroup',$value,''); |
|
352 | + $this->setViewState('ValidationGroup', $value, ''); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | /** |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | */ |
358 | 358 | public function getButtonType() |
359 | 359 | { |
360 | - return $this->getViewState('ButtonType',TButtonType::Submit); |
|
360 | + return $this->getViewState('ButtonType', TButtonType::Submit); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
@@ -365,6 +365,6 @@ discard block |
||
365 | 365 | */ |
366 | 366 | public function setButtonType($value) |
367 | 367 | { |
368 | - $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TButtonType'),TButtonType::Submit); |
|
368 | + $this->setViewState('ButtonType', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TButtonType'), TButtonType::Submit); |
|
369 | 369 | } |
370 | 370 | } |
@@ -222,6 +222,7 @@ |
||
222 | 222 | * If you override this method, be sure to call the parent implementation |
223 | 223 | * so that the event handlers can be invoked. |
224 | 224 | * @param \Prado\Web\UI\TCommandEventParameter event parameter to be passed to the event handlers |
225 | + * @param TCommandEventParameter $param |
|
225 | 226 | */ |
226 | 227 | public function onCommand($param) |
227 | 228 | { |
@@ -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 | '{', |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class TJavascriptLogger extends TWebControl |
32 | 32 | { |
33 | - private static $_keyCodes = array( |
|
33 | + private static $_keyCodes=array( |
|
34 | 34 | '0'=>48, '1'=>49, '2'=>50, '3'=>51, '4'=>52, '5'=>53, '6'=>54, '7'=>55, '8'=>56, '9'=>57, |
35 | 35 | 'a'=>65, 'b'=>66, 'c'=>67, 'd'=>68, 'e'=>69, 'f'=>70, 'g'=>71, 'h'=>72, |
36 | 36 | 'i'=>73, 'j'=>74, 'k'=>75, 'l'=>76, 'm'=>77, 'n'=>78, 'o'=>79, 'p'=>80, |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function onPreRender($param) |
68 | 68 | { |
69 | - $key = strtolower($this->getToggleKey()); |
|
70 | - $code = isset(self::$_keyCodes[$key]) ? self::$_keyCodes[$key] : 74; |
|
71 | - $js = "var logConsole; jQuery(function() { logConsole = new LogConsole($code)}); "; |
|
72 | - $cs = $this->getPage()->getClientScript(); |
|
73 | - $cs->registerBeginScript($this->getClientID(),$js); |
|
69 | + $key=strtolower($this->getToggleKey()); |
|
70 | + $code=isset(self::$_keyCodes[$key]) ? self::$_keyCodes[$key] : 74; |
|
71 | + $js="var logConsole; jQuery(function() { logConsole = new LogConsole($code)}); "; |
|
72 | + $cs=$this->getPage()->getClientScript(); |
|
73 | + $cs->registerBeginScript($this->getClientID(), $js); |
|
74 | 74 | $cs->registerPradoScript('logger'); |
75 | 75 | } |
76 | 76 | |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function renderContents($writer) |
83 | 83 | { |
84 | - $code = strtoupper($this->getToggleKey()); |
|
85 | - $info = '(<a href="http://web.archive.org/web/20060512041505/gleepglop.com/javascripts/logger/" target="_blank">more info</a>).'; |
|
86 | - $link = '<a href="javascript:if(logConsole)logConsole.toggle()">toggle the javascript log console.</a>'; |
|
87 | - $usage = 'Press ALT-'.$code.' (Or CTRL-'.$code.' on OS X) to'; |
|
84 | + $code=strtoupper($this->getToggleKey()); |
|
85 | + $info='(<a href="http://web.archive.org/web/20060512041505/gleepglop.com/javascripts/logger/" target="_blank">more info</a>).'; |
|
86 | + $link='<a href="javascript:if(logConsole)logConsole.toggle()">toggle the javascript log console.</a>'; |
|
87 | + $usage='Press ALT-'.$code.' (Or CTRL-'.$code.' on OS X) to'; |
|
88 | 88 | $writer->write("{$usage} {$link} {$info}"); |
89 | 89 | } |
90 | 90 | } |
@@ -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 |
@@ -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 | { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function getDataSourceID() |
84 | 84 | { |
85 | - return $this->getViewState('DataSourceID',''); |
|
85 | + return $this->getViewState('DataSourceID', ''); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function setDataSourceID($value) |
93 | 93 | { |
94 | - $dsid=$this->getViewState('DataSourceID',''); |
|
94 | + $dsid=$this->getViewState('DataSourceID', ''); |
|
95 | 95 | if($dsid!=='' && $value==='') |
96 | 96 | $this->_requiresBindToNull=true; |
97 | - $this->setViewState('DataSourceID',$value,''); |
|
97 | + $this->setViewState('DataSourceID', $value, ''); |
|
98 | 98 | $this->onDataSourceChanged(); |
99 | 99 | } |
100 | 100 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function getAllowPaging() |
172 | 172 | { |
173 | - return $this->getViewState('AllowPaging',false); |
|
173 | + return $this->getViewState('AllowPaging', false); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function setAllowPaging($value) |
180 | 180 | { |
181 | - $this->setViewState('AllowPaging',TPropertyValue::ensureBoolean($value),false); |
|
181 | + $this->setViewState('AllowPaging', TPropertyValue::ensureBoolean($value), false); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function getAllowCustomPaging() |
188 | 188 | { |
189 | - return $this->getViewState('AllowCustomPaging',false); |
|
189 | + return $this->getViewState('AllowCustomPaging', false); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function setAllowCustomPaging($value) |
200 | 200 | { |
201 | - $this->setViewState('AllowCustomPaging',TPropertyValue::ensureBoolean($value),false); |
|
201 | + $this->setViewState('AllowCustomPaging', TPropertyValue::ensureBoolean($value), false); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function getCurrentPageIndex() |
208 | 208 | { |
209 | - return $this->getViewState('CurrentPageIndex',0); |
|
209 | + return $this->getViewState('CurrentPageIndex', 0); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public function setCurrentPageIndex($value) |
217 | 217 | { |
218 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
218 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
219 | 219 | $value=0; |
220 | - $this->setViewState('CurrentPageIndex',$value,0); |
|
220 | + $this->setViewState('CurrentPageIndex', $value, 0); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function getPageSize() |
227 | 227 | { |
228 | - return $this->getViewState('PageSize',10); |
|
228 | + return $this->getViewState('PageSize', 10); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
@@ -234,9 +234,9 @@ discard block |
||
234 | 234 | */ |
235 | 235 | public function setPageSize($value) |
236 | 236 | { |
237 | - if(($value=TPropertyValue::ensureInteger($value))<1) |
|
238 | - throw new TInvalidDataValueException('databoundcontrol_pagesize_invalid',get_class($this)); |
|
239 | - $this->setViewState('PageSize',TPropertyValue::ensureInteger($value),10); |
|
237 | + if(($value=TPropertyValue::ensureInteger($value)) < 1) |
|
238 | + throw new TInvalidDataValueException('databoundcontrol_pagesize_invalid', get_class($this)); |
|
239 | + $this->setViewState('PageSize', TPropertyValue::ensureInteger($value), 10); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function getPageCount() |
246 | 246 | { |
247 | - return $this->getViewState('PageCount',1); |
|
247 | + return $this->getViewState('PageCount', 1); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | /** |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function getVirtualItemCount() |
255 | 255 | { |
256 | - return $this->getViewState('VirtualItemCount',0); |
|
256 | + return $this->getViewState('VirtualItemCount', 0); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | */ |
264 | 264 | public function setVirtualItemCount($value) |
265 | 265 | { |
266 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
267 | - throw new TInvalidDataValueException('databoundcontrol_virtualitemcount_invalid',get_class($this)); |
|
268 | - $this->setViewState('VirtualItemCount',$value,0); |
|
266 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
267 | + throw new TInvalidDataValueException('databoundcontrol_virtualitemcount_invalid', get_class($this)); |
|
268 | + $this->setViewState('VirtualItemCount', $value, 0); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -338,10 +338,10 @@ discard block |
||
338 | 338 | { |
339 | 339 | $ds=$this->createPagedDataSource(); |
340 | 340 | $ds->setDataSource($data); |
341 | - $this->setViewState('PageCount',$ds->getPageCount()); |
|
342 | - if($ds->getCurrentPageIndex()>=$ds->getPageCount()) |
|
341 | + $this->setViewState('PageCount', $ds->getPageCount()); |
|
342 | + if($ds->getCurrentPageIndex() >= $ds->getPageCount()) |
|
343 | 343 | { |
344 | - $ds->setCurrentPageIndex($ds->getPageCount()-1); |
|
344 | + $ds->setCurrentPageIndex($ds->getPageCount() - 1); |
|
345 | 345 | $this->setCurrentPageIndex($ds->getCurrentPageIndex()); |
346 | 346 | } |
347 | 347 | $this->performDataBinding($ds); |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | $this->onDataBound(null); |
357 | 357 | } |
358 | 358 | |
359 | - public function dataSourceViewChanged($sender,$param) |
|
359 | + public function dataSourceViewChanged($sender, $param) |
|
360 | 360 | { |
361 | 361 | if(!$this->_ignoreDataSourceViewChanged) |
362 | 362 | $this->setRequiresDataBinding(true); |
@@ -367,13 +367,13 @@ discard block |
||
367 | 367 | if(!$this->_currentViewValid) |
368 | 368 | { |
369 | 369 | if($this->_currentView && $this->_currentViewIsFromDataSourceID) |
370 | - $this->_currentView->detachEventHandler('DataSourceViewChanged',array($this,'dataSourceViewChanged')); |
|
370 | + $this->_currentView->detachEventHandler('DataSourceViewChanged', array($this, 'dataSourceViewChanged')); |
|
371 | 371 | if(($dataSource=$this->determineDataSource())!==null) |
372 | 372 | { |
373 | 373 | if(($view=$dataSource->getView($this->getDataMember()))===null) |
374 | - throw new TInvalidDataValueException('databoundcontrol_datamember_invalid',$this->getDataMember()); |
|
374 | + throw new TInvalidDataValueException('databoundcontrol_datamember_invalid', $this->getDataMember()); |
|
375 | 375 | if($this->_currentViewIsFromDataSourceID=$this->getUsingDataSourceID()) |
376 | - $view->attachEventHandler('OnDataSourceViewChanged',array($this,'dataSourceViewChanged')); |
|
376 | + $view->attachEventHandler('OnDataSourceViewChanged', array($this, 'dataSourceViewChanged')); |
|
377 | 377 | $this->_currentView=$view; |
378 | 378 | } |
379 | 379 | else |
@@ -390,14 +390,14 @@ discard block |
||
390 | 390 | if(($dsid=$this->getDataSourceID())!=='') |
391 | 391 | { |
392 | 392 | if(($dataSource=$this->getNamingContainer()->findControl($dsid))===null) |
393 | - throw new TInvalidDataValueException('databoundcontrol_datasourceid_inexistent',$dsid); |
|
393 | + throw new TInvalidDataValueException('databoundcontrol_datasourceid_inexistent', $dsid); |
|
394 | 394 | else if(!($dataSource instanceof IDataSource)) |
395 | - throw new TInvalidDataValueException('databoundcontrol_datasourceid_invalid',$dsid); |
|
395 | + throw new TInvalidDataValueException('databoundcontrol_datasourceid_invalid', $dsid); |
|
396 | 396 | else |
397 | 397 | $this->_currentDataSource=$dataSource; |
398 | 398 | } |
399 | 399 | else if(($dataSource=$this->getDataSource())!==null) |
400 | - $this->_currentDataSource=new TReadOnlyDataSource($dataSource,$this->getDataMember()); |
|
400 | + $this->_currentDataSource=new TReadOnlyDataSource($dataSource, $this->getDataMember()); |
|
401 | 401 | else |
402 | 402 | $this->_currentDataSource=null; |
403 | 403 | $this->_currentDataSourceValid=true; |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | */ |
415 | 415 | public function onDataBound($param) |
416 | 416 | { |
417 | - $this->raiseEvent('OnDataBound',$this,$param); |
|
417 | + $this->raiseEvent('OnDataBound', $this, $param); |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | /** |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | { |
429 | 429 | parent::onInit($param); |
430 | 430 | $page=$this->getPage(); |
431 | - $page->attachEventHandler('OnPreLoad',array($this,'pagePreLoad')); |
|
431 | + $page->attachEventHandler('OnPreLoad', array($this, 'pagePreLoad')); |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | /** |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * @param mixed event sender |
438 | 438 | * @param TEventParameter event parameter |
439 | 439 | */ |
440 | - public function pagePreLoad($sender,$param) |
|
440 | + public function pagePreLoad($sender, $param) |
|
441 | 441 | { |
442 | 442 | $this->_initialized=true; |
443 | 443 | $isPostBack=$this->getPage()->getIsPostBack(); |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | if(is_array($value)) |
475 | 475 | $list->add($value); |
476 | 476 | else |
477 | - $list->add(array($value,is_string($key)?$key:$value)); |
|
477 | + $list->add(array($value, is_string($key) ? $key : $value)); |
|
478 | 478 | } |
479 | 479 | return $list; |
480 | 480 | } |
@@ -487,17 +487,17 @@ discard block |
||
487 | 487 | else if(($value instanceof Traversable) || $value===null) |
488 | 488 | return $value; |
489 | 489 | else |
490 | - throw new TInvalidDataTypeException('databoundcontrol_datasource_invalid',get_class($this)); |
|
490 | + throw new TInvalidDataTypeException('databoundcontrol_datasource_invalid', get_class($this)); |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | public function getDataMember() |
494 | 494 | { |
495 | - return $this->getViewState('DataMember',''); |
|
495 | + return $this->getViewState('DataMember', ''); |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | public function setDataMember($value) |
499 | 499 | { |
500 | - $this->setViewState('DataMember',$value,''); |
|
500 | + $this->setViewState('DataMember', $value, ''); |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | public function getSelectParameters() |
@@ -156,6 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | /** |
158 | 158 | * @param boolean if databind has been invoked in this page request |
159 | + * @param boolean $value |
|
159 | 160 | */ |
160 | 161 | protected function setIsDataBound($value) |
161 | 162 | { |
@@ -216,6 +217,7 @@ discard block |
||
216 | 217 | |
217 | 218 | /** |
218 | 219 | * @param integer the zero-based index of the current page |
220 | + * @param integer $value |
|
219 | 221 | * @throws TInvalidDataValueException if the value is less than 0 |
220 | 222 | */ |
221 | 223 | public function setCurrentPageIndex($value) |
@@ -278,6 +280,7 @@ discard block |
||
278 | 280 | * If true and the control has been prerendered while it uses the data source |
279 | 281 | * specified by {@link setDataSourceID}, a databind call will be called by this method. |
280 | 282 | * @param boolean whether a databind call is required. |
283 | + * @param boolean $value |
|
281 | 284 | */ |
282 | 285 | protected function setRequiresDataBinding($value) |
283 | 286 | { |
@@ -410,6 +413,9 @@ discard block |
||
410 | 413 | return $this->_currentDataSource; |
411 | 414 | } |
412 | 415 | |
416 | + /** |
|
417 | + * @param \Traversable $data |
|
418 | + */ |
|
413 | 419 | abstract protected function performDataBinding($data); |
414 | 420 | |
415 | 421 | /** |
@@ -286,8 +286,7 @@ discard block |
||
286 | 286 | { |
287 | 287 | $this->_requiresDataBinding=true; |
288 | 288 | $this->ensureDataBound(); |
289 | - } |
|
290 | - else |
|
289 | + } else |
|
291 | 290 | $this->_requiresDataBinding=$value; |
292 | 291 | } |
293 | 292 | |
@@ -350,8 +349,7 @@ discard block |
||
350 | 349 | $this->setCurrentPageIndex($ds->getCurrentPageIndex()); |
351 | 350 | } |
352 | 351 | $this->performDataBinding($ds); |
353 | - } |
|
354 | - else |
|
352 | + } else |
|
355 | 353 | { |
356 | 354 | $this->clearViewState('PageCount'); |
357 | 355 | $this->performDataBinding($data); |
@@ -380,8 +378,7 @@ discard block |
||
380 | 378 | if($this->_currentViewIsFromDataSourceID=$this->getUsingDataSourceID()) |
381 | 379 | $view->attachEventHandler('OnDataSourceViewChanged',array($this,'dataSourceViewChanged')); |
382 | 380 | $this->_currentView=$view; |
383 | - } |
|
384 | - else |
|
381 | + } else |
|
385 | 382 | $this->_currentView=null; |
386 | 383 | $this->_currentViewValid=true; |
387 | 384 | } |
@@ -400,8 +397,7 @@ discard block |
||
400 | 397 | throw new TInvalidDataValueException('databoundcontrol_datasourceid_invalid',$dsid); |
401 | 398 | else |
402 | 399 | $this->_currentDataSource=$dataSource; |
403 | - } |
|
404 | - else if(($dataSource=$this->getDataSource())!==null) |
|
400 | + } else if(($dataSource=$this->getDataSource())!==null) |
|
405 | 401 | $this->_currentDataSource=new TReadOnlyDataSource($dataSource,$this->getDataMember()); |
406 | 402 | else |
407 | 403 | $this->_currentDataSource=null; |
@@ -482,14 +478,12 @@ discard block |
||
482 | 478 | $list->add(array($value,is_string($key)?$key:$value)); |
483 | 479 | } |
484 | 480 | return $list; |
485 | - } |
|
486 | - else if(is_array($value)) |
|
481 | + } else if(is_array($value)) |
|
487 | 482 | return new TMap($value); |
488 | 483 | else if($value instanceof TDbDataReader) { |
489 | 484 | // read array from TDbDataReader since it's forward-only stream and can only be traversed once |
490 | 485 | return $value->readAll(); |
491 | - } |
|
492 | - else if(($value instanceof \Traversable) || $value===null) |
|
486 | + } else if(($value instanceof \Traversable) || $value===null) |
|
493 | 487 | return $value; |
494 | 488 | else |
495 | 489 | throw new TInvalidDataTypeException('databoundcontrol_datasource_invalid',get_class($this)); |