@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function getText() |
56 | 56 | { |
57 | - return $this->getViewState('Text',''); |
|
57 | + return $this->getViewState('Text', ''); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function setText($value) |
65 | 65 | { |
66 | - $this->setViewState('Text',$value,''); |
|
66 | + $this->setViewState('Text', $value, ''); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function getDataTextField() |
73 | 73 | { |
74 | - return $this->getViewState('DataTextField',''); |
|
74 | + return $this->getViewState('DataTextField', ''); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function setDataTextField($value) |
81 | 81 | { |
82 | - $this->setViewState('DataTextField',$value,''); |
|
82 | + $this->setViewState('DataTextField', $value, ''); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function getDataTextFormatString() |
89 | 89 | { |
90 | - return $this->getViewState('DataTextFormatString',''); |
|
90 | + return $this->getViewState('DataTextFormatString', ''); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function setDataTextFormatString($value) |
97 | 97 | { |
98 | - $this->setViewState('DataTextFormatString',$value,''); |
|
98 | + $this->setViewState('DataTextFormatString', $value, ''); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function getImageHeight() |
105 | 105 | { |
106 | - return $this->getViewState('ImageHeight',''); |
|
106 | + return $this->getViewState('ImageHeight', ''); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function setImageHeight($value) |
113 | 113 | { |
114 | - $this->setViewState('ImageHeight',$value,''); |
|
114 | + $this->setViewState('ImageHeight', $value, ''); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function getImageUrl() |
121 | 121 | { |
122 | - return $this->getViewState('ImageUrl',''); |
|
122 | + return $this->getViewState('ImageUrl', ''); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function setImageUrl($value) |
129 | 129 | { |
130 | - $this->setViewState('ImageUrl',$value,''); |
|
130 | + $this->setViewState('ImageUrl', $value, ''); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function getImageWidth() |
137 | 137 | { |
138 | - return $this->getViewState('ImageWidth',''); |
|
138 | + return $this->getViewState('ImageWidth', ''); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function setImageWidth($value) |
145 | 145 | { |
146 | - $this->setViewState('ImageWidth',$value,''); |
|
146 | + $this->setViewState('ImageWidth', $value, ''); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function getNavigateUrl() |
153 | 153 | { |
154 | - return $this->getViewState('NavigateUrl',''); |
|
154 | + return $this->getViewState('NavigateUrl', ''); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function setNavigateUrl($value) |
162 | 162 | { |
163 | - $this->setViewState('NavigateUrl',$value,''); |
|
163 | + $this->setViewState('NavigateUrl', $value, ''); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | */ |
169 | 169 | public function getDataNavigateUrlField() |
170 | 170 | { |
171 | - return $this->getViewState('DataNavigateUrlField',''); |
|
171 | + return $this->getViewState('DataNavigateUrlField', ''); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public function setDataNavigateUrlField($value) |
178 | 178 | { |
179 | - $this->setViewState('DataNavigateUrlField',$value,''); |
|
179 | + $this->setViewState('DataNavigateUrlField', $value, ''); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function getDataNavigateUrlFormatString() |
186 | 186 | { |
187 | - return $this->getViewState('DataNavigateUrlFormatString',''); |
|
187 | + return $this->getViewState('DataNavigateUrlFormatString', ''); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | */ |
193 | 193 | public function setDataNavigateUrlFormatString($value) |
194 | 194 | { |
195 | - $this->setViewState('DataNavigateUrlFormatString',$value,''); |
|
195 | + $this->setViewState('DataNavigateUrlFormatString', $value, ''); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function getTarget() |
202 | 202 | { |
203 | - return $this->getViewState('Target',''); |
|
203 | + return $this->getViewState('Target', ''); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function setTarget($value) |
211 | 211 | { |
212 | - $this->setViewState('Target',$value,''); |
|
212 | + $this->setViewState('Target', $value, ''); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -220,12 +220,12 @@ discard block |
||
220 | 220 | * @param integer the index to the Columns property that the cell resides in. |
221 | 221 | * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem) |
222 | 222 | */ |
223 | - public function initializeCell($cell,$columnIndex,$itemType) |
|
223 | + public function initializeCell($cell, $columnIndex, $itemType) |
|
224 | 224 | { |
225 | 225 | if($itemType===TListItemType::Item || $itemType===TListItemType::AlternatingItem || $itemType===TListItemType::SelectedItem || $itemType===TListItemType::EditItem) |
226 | 226 | { |
227 | 227 | $link=new THyperLink; |
228 | - if(($url = $this->getImageUrl())!=='') |
|
228 | + if(($url=$this->getImageUrl())!=='') |
|
229 | 229 | { |
230 | 230 | $link->setImageUrl($url); |
231 | 231 | if(($width=$this->getImageWidth())!=='') |
@@ -237,12 +237,12 @@ discard block |
||
237 | 237 | $link->setNavigateUrl($this->getNavigateUrl()); |
238 | 238 | $link->setTarget($this->getTarget()); |
239 | 239 | if($this->getDataTextField()!=='' || $this->getDataNavigateUrlField()!=='') |
240 | - $link->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
|
240 | + $link->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn')); |
|
241 | 241 | $cell->getControls()->add($link); |
242 | - $cell->registerObject('HyperLink',$link); |
|
242 | + $cell->registerObject('HyperLink', $link); |
|
243 | 243 | } |
244 | 244 | else |
245 | - parent::initializeCell($cell,$columnIndex,$itemType); |
|
245 | + parent::initializeCell($cell, $columnIndex, $itemType); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | /** |
@@ -250,20 +250,20 @@ discard block |
||
250 | 250 | * This method is invoked when datagrid performs databinding. |
251 | 251 | * It populates the content of the cell with the relevant data from data source. |
252 | 252 | */ |
253 | - public function dataBindColumn($sender,$param) |
|
253 | + public function dataBindColumn($sender, $param) |
|
254 | 254 | { |
255 | 255 | $item=$sender->getNamingContainer(); |
256 | 256 | $data=$item->getData(); |
257 | 257 | if(($field=$this->getDataTextField())!=='') |
258 | 258 | { |
259 | - $value=$this->getDataFieldValue($data,$field); |
|
260 | - $text=$this->formatDataValue($this->getDataTextFormatString(),$value); |
|
259 | + $value=$this->getDataFieldValue($data, $field); |
|
260 | + $text=$this->formatDataValue($this->getDataTextFormatString(), $value); |
|
261 | 261 | $sender->setText($text); |
262 | 262 | } |
263 | 263 | if(($field=$this->getDataNavigateUrlField())!=='') |
264 | 264 | { |
265 | - $value=$this->getDataFieldValue($data,$field); |
|
266 | - $url=$this->formatDataValue($this->getDataNavigateUrlFormatString(),$value); |
|
265 | + $value=$this->getDataFieldValue($data, $field); |
|
266 | + $url=$this->formatDataValue($this->getDataNavigateUrlFormatString(), $value); |
|
267 | 267 | $sender->setNavigateUrl($url); |
268 | 268 | } |
269 | 269 | } |
@@ -233,8 +233,7 @@ |
||
233 | 233 | $link->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
234 | 234 | $cell->getControls()->add($link); |
235 | 235 | $cell->registerObject('HyperLink',$link); |
236 | - } |
|
237 | - else |
|
236 | + } else |
|
238 | 237 | parent::initializeCell($cell,$columnIndex,$itemType); |
239 | 238 | } |
240 | 239 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function getTagName() |
39 | 39 | { |
40 | - return ($this->_tagName !== null) ? $this->_tagName : ($this->_tagName = $this->getDefaultTagName()); |
|
40 | + return ($this->_tagName!==null) ? $this->_tagName : ($this->_tagName=$this->getDefaultTagName()); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -61,6 +61,6 @@ discard block |
||
61 | 61 | * @return boolean true if TagName has deviated from the default. |
62 | 62 | */ |
63 | 63 | public function getIsMutated() { |
64 | - return $this->_tagName !== null && $this->_tagName != $this->getDefaultTagName(); |
|
64 | + return $this->_tagName!==null && $this->_tagName!=$this->getDefaultTagName(); |
|
65 | 65 | } |
66 | 66 | } |
@@ -39,7 +39,7 @@ |
||
39 | 39 | { |
40 | 40 | if(($id=$this->getID())==='') |
41 | 41 | throw new TConfigurationException('contentplaceholder_id_required'); |
42 | - $this->getTemplateControl()->registerContentPlaceHolder($id,$this); |
|
42 | + $this->getTemplateControl()->registerContentPlaceHolder($id, $this); |
|
43 | 43 | $parent->getControls()->add($this); |
44 | 44 | } |
45 | 45 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | public function addParsedObject($object) |
44 | 44 | { |
45 | 45 | if(is_string($object)) |
46 | - $object=html_entity_decode($object,ENT_QUOTES,'UTF-8'); |
|
46 | + $object=html_entity_decode($object, ENT_QUOTES, 'UTF-8'); |
|
47 | 47 | parent::addParsedObject($object); |
48 | 48 | } |
49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function getText() |
54 | 54 | { |
55 | - return $this->getViewState('Text',''); |
|
55 | + return $this->getViewState('Text', ''); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function setText($value) |
62 | 62 | { |
63 | - $this->setViewState('Text',$value); |
|
63 | + $this->setViewState('Text', $value); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | if(($text=$this->getText())==='' && $this->getHasControls()) |
75 | 75 | { |
76 | - $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
76 | + $htmlWriter=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
77 | 77 | parent::renderContents($htmlWriter); |
78 | 78 | $text=$htmlWriter->flush(); |
79 | 79 | } |
@@ -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 |