@@ -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) |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function getText() |
153 | 153 | { |
154 | - return $this->getViewState('Text',''); |
|
154 | + return $this->getViewState('Text', ''); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function setText($value) |
163 | 163 | { |
164 | - $this->setViewState('Text',$value,''); |
|
164 | + $this->setViewState('Text', $value, ''); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | protected function addAttributesToRender($writer) |
198 | 198 | { |
199 | 199 | parent::addAttributesToRender($writer); |
200 | - if(($colspan=$this->getColumnSpan())>0) |
|
201 | - $writer->addAttribute('colspan',"$colspan"); |
|
202 | - if(($rowspan=$this->getRowSpan())>0) |
|
203 | - $writer->addAttribute('rowspan',"$rowspan"); |
|
200 | + if(($colspan=$this->getColumnSpan()) > 0) |
|
201 | + $writer->addAttribute('colspan', "$colspan"); |
|
202 | + if(($rowspan=$this->getRowSpan()) > 0) |
|
203 | + $writer->addAttribute('rowspan', "$rowspan"); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -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() |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | { |
72 | 72 | parent::addAttributesToRender($writer); |
73 | 73 | if(($butt=$this->getDefaultButton())!=='') |
74 | - $writer->addAttribute('id',$this->getClientID()); |
|
74 | + $writer->addAttribute('id', $this->getClientID()); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | */ |
169 | 169 | public function getGroupingText() |
170 | 170 | { |
171 | - return $this->getViewState('GroupingText',''); |
|
171 | + return $this->getViewState('GroupingText', ''); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public function setGroupingText($value) |
178 | 178 | { |
179 | - $this->setViewState('GroupingText',$value,''); |
|
179 | + $this->setViewState('GroupingText', $value, ''); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | if(($butt=$this->getDefaultButton())!=='') |
231 | 231 | { |
232 | 232 | if(($button=$this->findControl($butt))===null) |
233 | - throw new TInvalidDataValueException('panel_defaultbutton_invalid',$butt); |
|
233 | + throw new TInvalidDataValueException('panel_defaultbutton_invalid', $butt); |
|
234 | 234 | else |
235 | 235 | $this->getPage()->getClientScript()->registerDefaultButton($this, $button); |
236 | 236 | } |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | public function onPreRender($param) |
106 | 106 | { |
107 | 107 | parent::onPreRender($param); |
108 | - $scripts = preg_split('/,|\s+/', $this->getPradoScripts()); |
|
109 | - $cs = $this->getPage()->getClientScript(); |
|
108 | + $scripts=preg_split('/,|\s+/', $this->getPradoScripts()); |
|
109 | + $cs=$this->getPage()->getClientScript(); |
|
110 | 110 | foreach($scripts as $script) |
111 | 111 | { |
112 | - if(($script = trim($script))!=='') |
|
112 | + if(($script=trim($script))!=='') |
|
113 | 113 | $cs->registerPradoScript($script); |
114 | 114 | } |
115 | 115 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function render($writer) |
124 | 124 | { |
125 | - if ($this->getFlushScriptFiles()) |
|
125 | + if($this->getFlushScriptFiles()) |
|
126 | 126 | $this->getPage()->getClientScript()->flushScriptFiles($writer, $this); |
127 | 127 | $this->renderCustomScriptFile($writer); |
128 | 128 | $this->renderCustomScript($writer); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | protected function renderCustomScriptFile($writer) |
136 | 136 | { |
137 | - if(($scriptUrl = $this->getScriptUrl())!=='') |
|
137 | + if(($scriptUrl=$this->getScriptUrl())!=='') |
|
138 | 138 | $writer->write("<script type=\"text/javascript\" src=\"$scriptUrl\"></script>\n"); |
139 | 139 | } |
140 | 140 |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function processText($text) |
53 | 53 | { |
54 | - $result = Parsedown::instance()->parse($text); |
|
54 | + $result=Parsedown::instance()->parse($text); |
|
55 | 55 | return preg_replace_callback( |
56 | 56 | '/<pre><code class="language-(\w+)">((.|\n)*?)<\\/code><\\/pre>/im', |
57 | 57 | array($this, 'highlightCode'), $result); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | protected function highlightCode($matches) |
66 | 66 | { |
67 | - $text = html_entity_decode($matches[2],ENT_QUOTES,'UTF-8'); |
|
67 | + $text=html_entity_decode($matches[2], ENT_QUOTES, 'UTF-8'); |
|
68 | 68 | $this->setLanguage($matches[1]); |
69 | 69 | return parent::processText($text); |
70 | 70 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | protected function getTagName() |
39 | 39 | { |
40 | - return ($this->getForControl()==='')?'span':'label'; |
|
40 | + return ($this->getForControl()==='') ? 'span' : 'label'; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | protected function addAttributesToRender($writer) |
49 | 49 | { |
50 | 50 | if($this->_forControl!=='') |
51 | - $writer->addAttribute('for',$this->_forControl); |
|
51 | + $writer->addAttribute('for', $this->_forControl); |
|
52 | 52 | parent::addAttributesToRender($writer); |
53 | 53 | } |
54 | 54 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | } |
73 | 73 | else |
74 | - throw new TInvalidDataValueException('label_associatedcontrol_invalid',$aid); |
|
74 | + throw new TInvalidDataValueException('label_associatedcontrol_invalid', $aid); |
|
75 | 75 | } |
76 | 76 | else |
77 | 77 | parent::render($writer); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function getText() |
96 | 96 | { |
97 | - return $this->getViewState('Text',''); |
|
97 | + return $this->getViewState('Text', ''); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function setText($value) |
104 | 104 | { |
105 | - $this->setViewState('Text',TPropertyValue::ensureString($value),''); |
|
105 | + $this->setViewState('Text', TPropertyValue::ensureString($value), ''); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public function getForControl() |
138 | 138 | { |
139 | - return $this->getViewState('ForControl',''); |
|
139 | + return $this->getViewState('ForControl', ''); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function setForControl($value) |
148 | 148 | { |
149 | - $this->setViewState('ForControl',$value,''); |
|
149 | + $this->setViewState('ForControl', $value, ''); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function getMinSelection() |
78 | 78 | { |
79 | - return $this->getViewState('MinSelection',-1); |
|
79 | + return $this->getViewState('MinSelection', -1); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function setMinSelection($value) |
86 | 86 | { |
87 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
87 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
88 | 88 | $value=-1; |
89 | - $this->setViewState('MinSelection',$value,-1); |
|
89 | + $this->setViewState('MinSelection', $value, -1); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function getMaxSelection() |
96 | 96 | { |
97 | - return $this->getViewState('MaxSelection',-1); |
|
97 | + return $this->getViewState('MaxSelection', -1); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function setMaxSelection($value) |
104 | 104 | { |
105 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
105 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
106 | 106 | $value=-1; |
107 | - $this->setViewState('MaxSelection',$value,-1); |
|
107 | + $this->setViewState('MaxSelection', $value, -1); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function getRequiredSelections() |
115 | 115 | { |
116 | - return $this->getViewState('RequiredSelections',''); |
|
116 | + return $this->getViewState('RequiredSelections', ''); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function setRequiredSelections($value) |
124 | 124 | { |
125 | - $this->setViewState('RequiredSelections',$value,''); |
|
125 | + $this->setViewState('RequiredSelections', $value, ''); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -135,28 +135,28 @@ discard block |
||
135 | 135 | { |
136 | 136 | $control=$this->getValidationTarget(); |
137 | 137 | |
138 | - $exists = true; |
|
139 | - $values = $this->getSelection($control); |
|
140 | - $count = count($values); |
|
141 | - $required = $this->getRequiredValues(); |
|
138 | + $exists=true; |
|
139 | + $values=$this->getSelection($control); |
|
140 | + $count=count($values); |
|
141 | + $required=$this->getRequiredValues(); |
|
142 | 142 | |
143 | 143 | //if required, check the values |
144 | 144 | if(!empty($required)) |
145 | 145 | { |
146 | - if($count < count($required) ) |
|
146 | + if($count < count($required)) |
|
147 | 147 | return false; |
148 | 148 | foreach($required as $require) |
149 | - $exists = $exists && in_array($require, $values); |
|
149 | + $exists=$exists && in_array($require, $values); |
|
150 | 150 | } |
151 | 151 | |
152 | - $min = $this->getMinSelection(); |
|
153 | - $max = $this->getMaxSelection(); |
|
152 | + $min=$this->getMinSelection(); |
|
153 | + $max=$this->getMaxSelection(); |
|
154 | 154 | |
155 | - if($min !== -1 && $max !== -1) |
|
155 | + if($min!==-1 && $max!==-1) |
|
156 | 156 | return $exists && $count >= $min && $count <= $max; |
157 | - else if($min === -1 && $max !== -1) |
|
157 | + else if($min===-1 && $max!==-1) |
|
158 | 158 | return $exists && $count <= $max; |
159 | - else if($min !== -1 && $max === -1) |
|
159 | + else if($min!==-1 && $max===-1) |
|
160 | 160 | return $exists && $count >= $min; |
161 | 161 | else |
162 | 162 | return $exists; |
@@ -168,13 +168,13 @@ discard block |
||
168 | 168 | */ |
169 | 169 | protected function getSelection($control) |
170 | 170 | { |
171 | - $values = array(); |
|
171 | + $values=array(); |
|
172 | 172 | |
173 | 173 | //get the data |
174 | 174 | foreach($control->getItems() as $item) |
175 | 175 | { |
176 | 176 | if($item->getSelected()) |
177 | - $values[] = $item->getValue(); |
|
177 | + $values[]=$item->getValue(); |
|
178 | 178 | } |
179 | 179 | return $values; |
180 | 180 | } |
@@ -184,10 +184,10 @@ discard block |
||
184 | 184 | */ |
185 | 185 | protected function getRequiredValues() |
186 | 186 | { |
187 | - $required = array(); |
|
188 | - $string = $this->getRequiredSelections(); |
|
187 | + $required=array(); |
|
188 | + $string=$this->getRequiredSelections(); |
|
189 | 189 | if(!empty($string)) |
190 | - $required = preg_split('/,\s*/', $string); |
|
190 | + $required=preg_split('/,\s*/', $string); |
|
191 | 191 | return $required; |
192 | 192 | } |
193 | 193 | |
@@ -197,26 +197,26 @@ discard block |
||
197 | 197 | */ |
198 | 198 | protected function getClientScriptOptions() |
199 | 199 | { |
200 | - $options = parent::getClientScriptOptions(); |
|
201 | - $control = $this->getValidationTarget(); |
|
200 | + $options=parent::getClientScriptOptions(); |
|
201 | + $control=$this->getValidationTarget(); |
|
202 | 202 | |
203 | 203 | if(!$control instanceof TListControl) |
204 | 204 | { |
205 | 205 | throw new TConfigurationException( |
206 | 206 | 'listcontrolvalidator_invalid_control', |
207 | - $this->getID(),$this->getControlToValidate(), get_class($control)); |
|
207 | + $this->getID(), $this->getControlToValidate(), get_class($control)); |
|
208 | 208 | } |
209 | 209 | |
210 | - $min = $this->getMinSelection(); |
|
211 | - $max = $this->getMaxSelection(); |
|
212 | - if($min !== -1) |
|
213 | - $options['Min']= $min; |
|
214 | - if($max !== -1) |
|
215 | - $options['Max']= $max; |
|
216 | - $required = $this->getRequiredSelections(); |
|
210 | + $min=$this->getMinSelection(); |
|
211 | + $max=$this->getMaxSelection(); |
|
212 | + if($min!==-1) |
|
213 | + $options['Min']=$min; |
|
214 | + if($max!==-1) |
|
215 | + $options['Max']=$max; |
|
216 | + $required=$this->getRequiredSelections(); |
|
217 | 217 | if(strlen($required) > 0) |
218 | - $options['Required']= $required; |
|
219 | - $options['TotalItems'] = $control->getItemCount(); |
|
218 | + $options['Required']=$required; |
|
219 | + $options['TotalItems']=$control->getItemCount(); |
|
220 | 220 | |
221 | 221 | return $options; |
222 | 222 | } |