@@ -281,6 +281,7 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | /** |
| 283 | 283 | * @param string the group of validators which the button causes validation upon postback |
| 284 | + * @param string $value |
|
| 284 | 285 | */ |
| 285 | 286 | public function setValidationGroup($value) |
| 286 | 287 | { |
@@ -322,6 +323,7 @@ discard block |
||
| 322 | 323 | * If you override this method, be sure to call the parent implementation |
| 323 | 324 | * so that the event handlers can be invoked. |
| 324 | 325 | * @param TCommandEventParameter event parameter to be passed to the event handlers |
| 326 | + * @param TCommandEventParameter $param |
|
| 325 | 327 | */ |
| 326 | 328 | public function onCommand($param) |
| 327 | 329 | { |
@@ -98,8 +98,7 @@ |
||
| 98 | 98 | { |
| 99 | 99 | $this->renderLinkButtonHref($writer); |
| 100 | 100 | $this->renderClientControlScript($writer); |
| 101 | - } |
|
| 102 | - else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
| 101 | + } else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
| 103 | 102 | $writer->addAttribute('disabled','disabled'); |
| 104 | 103 | } |
| 105 | 104 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function getEnableClientScript() |
| 69 | 69 | { |
| 70 | - return $this->getViewState('EnableClientScript',true); |
|
| 70 | + return $this->getViewState('EnableClientScript', true); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function setEnableClientScript($value) |
| 77 | 77 | { |
| 78 | - $this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true); |
|
| 78 | + $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $page=$this->getPage(); |
| 89 | 89 | $page->ensureRenderInForm($this); |
| 90 | 90 | |
| 91 | - $writer->addAttribute('id',$this->getClientID()); |
|
| 91 | + $writer->addAttribute('id', $this->getClientID()); |
|
| 92 | 92 | |
| 93 | 93 | // We call parent implementation here because some attributes |
| 94 | 94 | // may be overwritten in the following |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $this->renderClientControlScript($writer); |
| 101 | 101 | } |
| 102 | 102 | else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
| 103 | - $writer->addAttribute('disabled','disabled'); |
|
| 103 | + $writer->addAttribute('disabled', 'disabled'); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
@@ -109,8 +109,8 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | protected function renderClientControlScript($writer) |
| 111 | 111 | { |
| 112 | - $cs = $this->getPage()->getClientScript(); |
|
| 113 | - $cs->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions()); |
|
| 112 | + $cs=$this->getPage()->getClientScript(); |
|
| 113 | + $cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | public function setIsDefaultButton($value) |
| 120 | 120 | { |
| 121 | - $this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value),false); |
|
| 121 | + $this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value), false); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | protected function renderLinkButtonHref($writer) |
| 137 | 137 | { |
| 138 | 138 | //create unique no-op url references |
| 139 | - $nop = "javascript:;//".$this->getClientID(); |
|
| 139 | + $nop="javascript:;//".$this->getClientID(); |
|
| 140 | 140 | $writer->addAttribute('href', $nop); |
| 141 | 141 | } |
| 142 | 142 | |
@@ -157,11 +157,11 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | protected function getPostBackOptions() |
| 159 | 159 | { |
| 160 | - $options['ID'] = $this->getClientID(); |
|
| 161 | - $options['EventTarget'] = $this->getUniqueID(); |
|
| 162 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
| 163 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
| 164 | - $options['StopEvent'] = true; |
|
| 160 | + $options['ID']=$this->getClientID(); |
|
| 161 | + $options['EventTarget']=$this->getUniqueID(); |
|
| 162 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
| 163 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
| 164 | + $options['StopEvent']=true; |
|
| 165 | 165 | |
| 166 | 166 | return $options; |
| 167 | 167 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | public function getText() |
| 187 | 187 | { |
| 188 | - return $this->getViewState('Text',''); |
|
| 188 | + return $this->getViewState('Text', ''); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | public function setText($value) |
| 195 | 195 | { |
| 196 | - $this->setViewState('Text',$value,''); |
|
| 196 | + $this->setViewState('Text', $value, ''); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /** |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | */ |
| 228 | 228 | public function getCommandName() |
| 229 | 229 | { |
| 230 | - return $this->getViewState('CommandName',''); |
|
| 230 | + return $this->getViewState('CommandName', ''); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /** |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | public function setCommandName($value) |
| 237 | 237 | { |
| 238 | - $this->setViewState('CommandName',$value,''); |
|
| 238 | + $this->setViewState('CommandName', $value, ''); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | /** |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | */ |
| 244 | 244 | public function getCommandParameter() |
| 245 | 245 | { |
| 246 | - return $this->getViewState('CommandParameter',''); |
|
| 246 | + return $this->getViewState('CommandParameter', ''); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | */ |
| 252 | 252 | public function setCommandParameter($value) |
| 253 | 253 | { |
| 254 | - $this->setViewState('CommandParameter',$value,''); |
|
| 254 | + $this->setViewState('CommandParameter', $value, ''); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | /** |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | public function getCausesValidation() |
| 261 | 261 | { |
| 262 | - return $this->getViewState('CausesValidation',true); |
|
| 262 | + return $this->getViewState('CausesValidation', true); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /** |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | */ |
| 269 | 269 | public function setCausesValidation($value) |
| 270 | 270 | { |
| 271 | - $this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true); |
|
| 271 | + $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true); |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | /** |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | */ |
| 277 | 277 | public function getValidationGroup() |
| 278 | 278 | { |
| 279 | - return $this->getViewState('ValidationGroup',''); |
|
| 279 | + return $this->getViewState('ValidationGroup', ''); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | /** |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | public function setValidationGroup($value) |
| 286 | 286 | { |
| 287 | - $this->setViewState('ValidationGroup',$value,''); |
|
| 287 | + $this->setViewState('ValidationGroup', $value, ''); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | /** |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | if($this->getCausesValidation()) |
| 302 | 302 | $this->getPage()->validate($this->getValidationGroup()); |
| 303 | 303 | $this->onClick(null); |
| 304 | - $this->onCommand(new TCommandEventParameter($this->getCommandName(),$this->getCommandParameter())); |
|
| 304 | + $this->onCommand(new TCommandEventParameter($this->getCommandName(), $this->getCommandParameter())); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | /** |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | */ |
| 314 | 314 | public function onClick($param) |
| 315 | 315 | { |
| 316 | - $this->raiseEvent('OnClick',$this,$param); |
|
| 316 | + $this->raiseEvent('OnClick', $this, $param); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | /** |
@@ -325,8 +325,8 @@ discard block |
||
| 325 | 325 | */ |
| 326 | 326 | public function onCommand($param) |
| 327 | 327 | { |
| 328 | - $this->raiseEvent('OnCommand',$this,$param); |
|
| 329 | - $this->raiseBubbleEvent($this,$param); |
|
| 328 | + $this->raiseEvent('OnCommand', $this, $param); |
|
| 329 | + $this->raiseBubbleEvent($this, $param); |
|
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | |
@@ -213,7 +213,7 @@ |
||
| 213 | 213 | /** |
| 214 | 214 | * Returns the value to be validated. |
| 215 | 215 | * This methid is required by IValidatable interface. |
| 216 | - * @return mixed the value of the property to be validated. |
|
| 216 | + * @return string the value of the property to be validated. |
|
| 217 | 217 | */ |
| 218 | 218 | public function getValidationPropertyValue() |
| 219 | 219 | { |
@@ -463,14 +463,14 @@ |
||
| 463 | 463 | */ |
| 464 | 464 | public function getIsValid() |
| 465 | 465 | { |
| 466 | - return $this->_isValid; |
|
| 466 | + return $this->_isValid; |
|
| 467 | 467 | } |
| 468 | 468 | /** |
| 469 | 469 | * @param bool wether this control is valid. |
| 470 | 470 | */ |
| 471 | 471 | public function setIsValid($value) |
| 472 | 472 | { |
| 473 | - $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
| 473 | + $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | /** |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | protected function addAttributesToRender($writer) |
| 48 | 48 | { |
| 49 | 49 | $rows=$this->getRows(); |
| 50 | - $writer->addAttribute('size',"$rows"); |
|
| 50 | + $writer->addAttribute('size', "$rows"); |
|
| 51 | 51 | if($this->getSelectionMode()===TListSelectionMode::Multiple) |
| 52 | - $writer->addAttribute('name',$this->getUniqueID().'[]'); |
|
| 52 | + $writer->addAttribute('name', $this->getUniqueID().'[]'); |
|
| 53 | 53 | else |
| 54 | - $writer->addAttribute('name',$this->getUniqueID()); |
|
| 54 | + $writer->addAttribute('name', $this->getUniqueID()); |
|
| 55 | 55 | parent::addAttributesToRender($writer); |
| 56 | 56 | } |
| 57 | 57 | |
@@ -84,19 +84,19 @@ discard block |
||
| 84 | 84 | * @param array the input data collection |
| 85 | 85 | * @return boolean whether the data of the component has been changed |
| 86 | 86 | */ |
| 87 | - public function loadPostData($key,$values) |
|
| 87 | + public function loadPostData($key, $values) |
|
| 88 | 88 | { |
| 89 | 89 | if(!$this->getEnabled(true)) |
| 90 | 90 | return false; |
| 91 | 91 | $this->ensureDataBound(); |
| 92 | - $selections=isset($values[$key])?$values[$key]:null; |
|
| 92 | + $selections=isset($values[$key]) ? $values[$key] : null; |
|
| 93 | 93 | if($selections!==null) |
| 94 | 94 | { |
| 95 | 95 | $items=$this->getItems(); |
| 96 | 96 | if($this->getSelectionMode()===TListSelectionMode::Single) |
| 97 | 97 | { |
| 98 | - $selection=is_array($selections)?$selections[0]:$selections; |
|
| 99 | - $index=$items->findIndexByValue($selection,false); |
|
| 98 | + $selection=is_array($selections) ? $selections[0] : $selections; |
|
| 99 | + $index=$items->findIndexByValue($selection, false); |
|
| 100 | 100 | if($this->getSelectedIndex()!==$index) |
| 101 | 101 | { |
| 102 | 102 | $this->setSelectedIndex($index); |
@@ -109,14 +109,14 @@ discard block |
||
| 109 | 109 | $selections=array($selections); |
| 110 | 110 | $list=array(); |
| 111 | 111 | foreach($selections as $selection) |
| 112 | - $list[]=$items->findIndexByValue($selection,false); |
|
| 112 | + $list[]=$items->findIndexByValue($selection, false); |
|
| 113 | 113 | $list2=$this->getSelectedIndices(); |
| 114 | 114 | $n=count($list); |
| 115 | 115 | $flag=false; |
| 116 | 116 | if($n===count($list2)) |
| 117 | 117 | { |
| 118 | - sort($list,SORT_NUMERIC); |
|
| 119 | - for($i=0;$i<$n;++$i) |
|
| 118 | + sort($list, SORT_NUMERIC); |
|
| 119 | + for($i=0; $i < $n; ++$i) |
|
| 120 | 120 | { |
| 121 | 121 | if($list[$i]!==$list2[$i]) |
| 122 | 122 | { |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | public function setRows($value) |
| 190 | 190 | { |
| 191 | 191 | $value=TPropertyValue::ensureInteger($value); |
| 192 | - if($value<=0) |
|
| 192 | + if($value <= 0) |
|
| 193 | 193 | $value=4; |
| 194 | 194 | $this->setViewState('Rows', $value, 4); |
| 195 | 195 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | public function setSelectionMode($value) |
| 209 | 209 | { |
| 210 | - $this->setViewState('SelectionMode',TPropertyValue::ensureEnum($value,'TListSelectionMode'),TListSelectionMode::Single); |
|
| 210 | + $this->setViewState('SelectionMode', TPropertyValue::ensureEnum($value, 'TListSelectionMode'), TListSelectionMode::Single); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
@@ -101,8 +101,7 @@ discard block |
||
| 101 | 101 | { |
| 102 | 102 | $this->setSelectedIndex($index); |
| 103 | 103 | return $this->_dataChanged=true; |
| 104 | - } |
|
| 105 | - else |
|
| 104 | + } else |
|
| 106 | 105 | return false; |
| 107 | 106 | } |
| 108 | 107 | if(!is_array($selections)) |
@@ -124,8 +123,7 @@ discard block |
||
| 124 | 123 | break; |
| 125 | 124 | } |
| 126 | 125 | } |
| 127 | - } |
|
| 128 | - else |
|
| 126 | + } else |
|
| 129 | 127 | $flag=true; |
| 130 | 128 | if($flag) |
| 131 | 129 | { |
@@ -133,13 +131,11 @@ discard block |
||
| 133 | 131 | $this->_dataChanged=true; |
| 134 | 132 | } |
| 135 | 133 | return $flag; |
| 136 | - } |
|
| 137 | - else if($this->getSelectedIndex()!==-1) |
|
| 134 | + } else if($this->getSelectedIndex()!==-1) |
|
| 138 | 135 | { |
| 139 | 136 | $this->clearSelection(); |
| 140 | 137 | return $this->_dataChanged=true; |
| 141 | - } |
|
| 142 | - else |
|
| 138 | + } else |
|
| 143 | 139 | return false; |
| 144 | 140 | } |
| 145 | 141 | |
@@ -164,6 +164,7 @@ |
||
| 164 | 164 | |
| 165 | 165 | /** |
| 166 | 166 | * @param TListControl control to validate |
| 167 | + * @param TControl $control |
|
| 167 | 168 | * @return array number of selected values and its values. |
| 168 | 169 | */ |
| 169 | 170 | protected function getSelection($control) |
@@ -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 | } |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * TListControlValidator class file |
|
| 4 | - * |
|
| 5 | - * @author Wei Zhuo <weizhuo[at]gmail[dot]com> |
|
| 6 | - * @link https://github.com/pradosoft/prado |
|
| 7 | - * @copyright Copyright © 2005-2016 The PRADO Group |
|
| 8 | - * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
| 9 | - * @package System.Web.UI.WebControls |
|
| 10 | - */ |
|
| 3 | + * TListControlValidator class file |
|
| 4 | + * |
|
| 5 | + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> |
|
| 6 | + * @link https://github.com/pradosoft/prado |
|
| 7 | + * @copyright Copyright © 2005-2016 The PRADO Group |
|
| 8 | + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
| 9 | + * @package System.Web.UI.WebControls |
|
| 10 | + */ |
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * Using TBaseValidator class |
@@ -281,6 +281,7 @@ |
||
| 281 | 281 | * controls be added into the collection. |
| 282 | 282 | * @param integer the speicified position. |
| 283 | 283 | * @param mixed new item |
| 284 | + * @param TWizardStep $item |
|
| 284 | 285 | * @throws TInvalidDataTypeException if the item to be inserted is neither a string nor a TControl. |
| 285 | 286 | */ |
| 286 | 287 | public function insertAt($index,$item) |
@@ -97,8 +97,7 @@ discard block |
||
| 97 | 97 | $this->_cachedActiveViewIndex=-1; |
| 98 | 98 | if($index>=0) |
| 99 | 99 | $this->activateView($views->itemAt($index),true); |
| 100 | - } |
|
| 101 | - else |
|
| 100 | + } else |
|
| 102 | 101 | throw new TInvalidDataValueException('multiview_activeviewindex_invalid',$index); |
| 103 | 102 | } |
| 104 | 103 | |
@@ -153,8 +152,7 @@ discard block |
||
| 153 | 152 | $view->onActivate(null); |
| 154 | 153 | $this->onActiveViewChanged(null); |
| 155 | 154 | } |
| 156 | - } |
|
| 157 | - else if($v->getActive()) |
|
| 155 | + } else if($v->getActive()) |
|
| 158 | 156 | { |
| 159 | 157 | $v->setActive(false); |
| 160 | 158 | if($triggerEvent) |
@@ -232,8 +230,7 @@ discard block |
||
| 232 | 230 | { |
| 233 | 231 | $this->setActiveView($view); |
| 234 | 232 | return true; |
| 235 | - } |
|
| 236 | - else |
|
| 233 | + } else |
|
| 237 | 234 | throw new TInvalidDataValueException('multiview_viewid_invalid', $viewID); |
| 238 | 235 | case self::CMD_SWITCHVIEWINDEX: |
| 239 | 236 | $index=TPropertyValue::ensureInteger($param->getCommandParameter()); |
@@ -73,10 +73,10 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function getActiveViewIndex() |
| 75 | 75 | { |
| 76 | - if($this->_cachedActiveViewIndex>-1) |
|
| 76 | + if($this->_cachedActiveViewIndex > -1) |
|
| 77 | 77 | return $this->_cachedActiveViewIndex; |
| 78 | 78 | else |
| 79 | - return $this->getControlState('ActiveViewIndex',-1); |
|
| 79 | + return $this->getControlState('ActiveViewIndex', -1); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -85,21 +85,21 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function setActiveViewIndex($value) |
| 87 | 87 | { |
| 88 | - if(($index=TPropertyValue::ensureInteger($value))<0) |
|
| 88 | + if(($index=TPropertyValue::ensureInteger($value)) < 0) |
|
| 89 | 89 | $index=-1; |
| 90 | 90 | $views=$this->getViews(); |
| 91 | 91 | $count=$views->getCount(); |
| 92 | - if($count===0 && $this->getControlStage()<TControl::CS_CHILD_INITIALIZED) |
|
| 92 | + if($count===0 && $this->getControlStage() < TControl::CS_CHILD_INITIALIZED) |
|
| 93 | 93 | $this->_cachedActiveViewIndex=$index; |
| 94 | - else if($index<$count) |
|
| 94 | + else if($index < $count) |
|
| 95 | 95 | { |
| 96 | - $this->setControlState('ActiveViewIndex',$index,-1); |
|
| 96 | + $this->setControlState('ActiveViewIndex', $index, -1); |
|
| 97 | 97 | $this->_cachedActiveViewIndex=-1; |
| 98 | - if($index>=0) |
|
| 99 | - $this->activateView($views->itemAt($index),true); |
|
| 98 | + if($index >= 0) |
|
| 99 | + $this->activateView($views->itemAt($index), true); |
|
| 100 | 100 | } |
| 101 | 101 | else |
| 102 | - throw new TInvalidDataValueException('multiview_activeviewindex_invalid',$index); |
|
| 102 | + throw new TInvalidDataValueException('multiview_activeviewindex_invalid', $index); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -110,13 +110,13 @@ discard block |
||
| 110 | 110 | { |
| 111 | 111 | $index=$this->getActiveViewIndex(); |
| 112 | 112 | $views=$this->getViews(); |
| 113 | - if($index>=$views->getCount()) |
|
| 114 | - throw new TInvalidDataValueException('multiview_activeviewindex_invalid',$index); |
|
| 115 | - if($index<0) |
|
| 113 | + if($index >= $views->getCount()) |
|
| 114 | + throw new TInvalidDataValueException('multiview_activeviewindex_invalid', $index); |
|
| 115 | + if($index < 0) |
|
| 116 | 116 | return null; |
| 117 | 117 | $view=$views->itemAt($index); |
| 118 | 118 | if(!$view->getActive()) |
| 119 | - $this->activateView($view,false); |
|
| 119 | + $this->activateView($view, false); |
|
| 120 | 120 | return $view; |
| 121 | 121 | } |
| 122 | 122 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function setActiveView($view) |
| 128 | 128 | { |
| 129 | - if(($index=$this->getViews()->indexOf($view))>=0) |
|
| 129 | + if(($index=$this->getViews()->indexOf($view)) >= 0) |
|
| 130 | 130 | $this->setActiveViewIndex($index); |
| 131 | 131 | else |
| 132 | 132 | throw new TInvalidOperationException('multiview_view_inexistent'); |
@@ -138,11 +138,11 @@ discard block |
||
| 138 | 138 | * @param TView the view to be activated |
| 139 | 139 | * @param boolean whether to trigger OnActiveViewChanged event. |
| 140 | 140 | */ |
| 141 | - protected function activateView($view,$triggerViewChangedEvent=true) |
|
| 141 | + protected function activateView($view, $triggerViewChangedEvent=true) |
|
| 142 | 142 | { |
| 143 | 143 | if($view->getActive()) |
| 144 | 144 | return; |
| 145 | - $triggerEvent=$triggerViewChangedEvent && ($this->getControlStage()>=TControl::CS_STATE_LOADED || ($this->getPage() && !$this->getPage()->getIsPostBack())); |
|
| 145 | + $triggerEvent=$triggerViewChangedEvent && ($this->getControlStage() >= TControl::CS_STATE_LOADED || ($this->getPage() && !$this->getPage()->getIsPostBack())); |
|
| 146 | 146 | foreach($this->getViews() as $v) |
| 147 | 147 | { |
| 148 | 148 | if($v===$view) |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | public function onInit($param) |
| 190 | 190 | { |
| 191 | 191 | parent::onInit($param); |
| 192 | - if($this->_cachedActiveViewIndex>=0) |
|
| 192 | + if($this->_cachedActiveViewIndex >= 0) |
|
| 193 | 193 | $this->setActiveViewIndex($this->_cachedActiveViewIndex); |
| 194 | 194 | } |
| 195 | 195 | |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | public function onActiveViewChanged($param) |
| 202 | 202 | { |
| 203 | - $this->raiseEvent('OnActiveViewChanged',$this,$param); |
|
| 203 | + $this->raiseEvent('OnActiveViewChanged', $this, $param); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
@@ -210,21 +210,21 @@ discard block |
||
| 210 | 210 | * @param mixed event parameter |
| 211 | 211 | * @return boolean whether this event is handled |
| 212 | 212 | */ |
| 213 | - public function bubbleEvent($sender,$param) |
|
| 213 | + public function bubbleEvent($sender, $param) |
|
| 214 | 214 | { |
| 215 | 215 | if(!$this->_ignoreBubbleEvents && ($param instanceof TCommandEventParameter)) |
| 216 | 216 | { |
| 217 | 217 | switch($param->getCommandName()) |
| 218 | 218 | { |
| 219 | 219 | case self::CMD_NEXTVIEW: |
| 220 | - if(($index=$this->getActiveViewIndex())<$this->getViews()->getCount()-1) |
|
| 221 | - $this->setActiveViewIndex($index+1); |
|
| 220 | + if(($index=$this->getActiveViewIndex()) < $this->getViews()->getCount() - 1) |
|
| 221 | + $this->setActiveViewIndex($index + 1); |
|
| 222 | 222 | else |
| 223 | 223 | $this->setActiveViewIndex(-1); |
| 224 | 224 | return true; |
| 225 | 225 | case self::CMD_PREVIOUSVIEW: |
| 226 | - if(($index=$this->getActiveViewIndex())>=0) |
|
| 227 | - $this->setActiveViewIndex($index-1); |
|
| 226 | + if(($index=$this->getActiveViewIndex()) >= 0) |
|
| 227 | + $this->setActiveViewIndex($index - 1); |
|
| 228 | 228 | return true; |
| 229 | 229 | case self::CMD_SWITCHVIEWID: |
| 230 | 230 | $view=$this->findControl($viewID=$param->getCommandParameter()); |
@@ -283,10 +283,10 @@ discard block |
||
| 283 | 283 | * @param mixed new item |
| 284 | 284 | * @throws TInvalidDataTypeException if the item to be inserted is neither a string nor a TControl. |
| 285 | 285 | */ |
| 286 | - public function insertAt($index,$item) |
|
| 286 | + public function insertAt($index, $item) |
|
| 287 | 287 | { |
| 288 | 288 | if($item instanceof TView) |
| 289 | - parent::insertAt($index,$item); |
|
| 289 | + parent::insertAt($index, $item); |
|
| 290 | 290 | else |
| 291 | 291 | throw new TInvalidDataTypeException('viewcollection_view_required'); |
| 292 | 292 | } |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | */ |
| 318 | 318 | public function onActivate($param) |
| 319 | 319 | { |
| 320 | - $this->raiseEvent('OnActivate',$this,$param); |
|
| 320 | + $this->raiseEvent('OnActivate', $this, $param); |
|
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | /** |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | */ |
| 327 | 327 | public function onDeactivate($param) |
| 328 | 328 | { |
| 329 | - $this->raiseEvent('OnDeactivate',$this,$param); |
|
| 329 | + $this->raiseEvent('OnDeactivate', $this, $param); |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | /** |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | * into cache if needed. |
| 232 | 232 | * This method should only be used by framework developers. |
| 233 | 233 | * @param boolean whether the viewstate should be saved |
| 234 | - * @return array the collection of the control state (including its children's state). |
|
| 234 | + * @return string the collection of the control state (including its children's state). |
|
| 235 | 235 | */ |
| 236 | 236 | protected function &saveStateRecursive($needViewState=true) |
| 237 | 237 | { |
@@ -327,6 +327,7 @@ discard block |
||
| 327 | 327 | * Sets the prefix of the cache key. |
| 328 | 328 | * This method is used internally by {@link TTemplate}. |
| 329 | 329 | * @param string key prefix |
| 330 | + * @param string $value |
|
| 330 | 331 | */ |
| 331 | 332 | public function setCacheKeyPrefix($value) |
| 332 | 333 | { |
@@ -445,6 +446,7 @@ discard block |
||
| 445 | 446 | * The checking result should be saved by setting {@link TOutputCacheCheckDependencyEventParameter::setIsValid IsValid} |
| 446 | 447 | * property of the event parameter (which defaults to true). |
| 447 | 448 | * @param TOutputCacheCheckDependencyEventParameter event parameter |
| 449 | + * @param TOutputCacheCheckDependencyEventParameter $param |
|
| 448 | 450 | */ |
| 449 | 451 | public function onCheckDependency($param) |
| 450 | 452 | { |
@@ -458,6 +460,7 @@ discard block |
||
| 458 | 460 | * The value set in {@link TOutputCacheCalculateKeyEventParameter::setCacheKey CacheKey} of |
| 459 | 461 | * this event parameter will be appended to the default key calculation scheme. |
| 460 | 462 | * @param TOutputCacheCalculateKeyEventParameter event parameter |
| 463 | + * @param TOutputCacheCalculateKeyEventParameter $param |
|
| 461 | 464 | */ |
| 462 | 465 | public function onCalculateKey($param) |
| 463 | 466 | { |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | if(!$this->_cacheChecked) |
| 102 | 102 | { |
| 103 | 103 | $this->_cacheChecked=true; |
| 104 | - if($this->_duration>0 && ($this->_cachePostBack || !$this->getPage()->getIsPostBack())) |
|
| 104 | + if($this->_duration > 0 && ($this->_cachePostBack || !$this->getPage()->getIsPostBack())) |
|
| 105 | 105 | { |
| 106 | 106 | if($this->_cacheModuleID!=='') |
| 107 | 107 | { |
| 108 | 108 | $this->_cache=$this->getApplication()->getModule($this->_cacheModuleID); |
| 109 | 109 | if(!($this->_cache instanceof ICache)) |
| 110 | - throw new TConfigurationException('outputcache_cachemoduleid_invalid',$this->_cacheModuleID); |
|
| 110 | + throw new TConfigurationException('outputcache_cachemoduleid_invalid', $this->_cacheModuleID); |
|
| 111 | 111 | } |
| 112 | 112 | else |
| 113 | 113 | $this->_cache=$this->getApplication()->getCache(); |
@@ -118,14 +118,14 @@ discard block |
||
| 118 | 118 | if(is_array($data)) |
| 119 | 119 | { |
| 120 | 120 | $param=new TOutputCacheCheckDependencyEventParameter; |
| 121 | - $param->setCacheTime(isset($data[3])?$data[3]:0); |
|
| 121 | + $param->setCacheTime(isset($data[3]) ? $data[3] : 0); |
|
| 122 | 122 | $this->onCheckDependency($param); |
| 123 | 123 | $this->_dataCached=$param->getIsValid(); |
| 124 | 124 | } |
| 125 | 125 | else |
| 126 | 126 | $this->_dataCached=false; |
| 127 | 127 | if($this->_dataCached) |
| 128 | - list($this->_contents,$this->_state,$this->_actions,$this->_cacheTime)=$data; |
|
| 128 | + list($this->_contents, $this->_state, $this->_actions, $this->_cacheTime)=$data; |
|
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | } |
@@ -183,11 +183,11 @@ discard block |
||
| 183 | 183 | foreach($this->_actions as $action) |
| 184 | 184 | { |
| 185 | 185 | if($action[0]==='Page.ClientScript') |
| 186 | - call_user_func_array(array($cs,$action[1]),$action[2]); |
|
| 186 | + call_user_func_array(array($cs, $action[1]), $action[2]); |
|
| 187 | 187 | else if($action[0]==='Page') |
| 188 | - call_user_func_array(array($page,$action[1]),$action[2]); |
|
| 188 | + call_user_func_array(array($page, $action[1]), $action[2]); |
|
| 189 | 189 | else |
| 190 | - call_user_func_array(array($this->getSubProperty($action[0]),$action[1]),$action[2]); |
|
| 190 | + call_user_func_array(array($this->getSubProperty($action[0]), $action[1]), $action[2]); |
|
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | |
@@ -219,10 +219,10 @@ discard block |
||
| 219 | 219 | * @param array the collection of the state |
| 220 | 220 | * @param boolean whether the viewstate should be loaded |
| 221 | 221 | */ |
| 222 | - protected function loadStateRecursive(&$state,$needViewState=true) |
|
| 222 | + protected function loadStateRecursive(&$state, $needViewState=true) |
|
| 223 | 223 | { |
| 224 | 224 | $st=unserialize($state); |
| 225 | - parent::loadStateRecursive($st,$needViewState); |
|
| 225 | + parent::loadStateRecursive($st, $needViewState); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
@@ -255,9 +255,9 @@ discard block |
||
| 255 | 255 | * @param string method name of the context object |
| 256 | 256 | * @param array list of parameters to be passed to the action method |
| 257 | 257 | */ |
| 258 | - public function registerAction($context,$funcName,$funcParams) |
|
| 258 | + public function registerAction($context, $funcName, $funcParams) |
|
| 259 | 259 | { |
| 260 | - $this->_actions[]=array($context,$funcName,$funcParams); |
|
| 260 | + $this->_actions[]=array($context, $funcName, $funcParams); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | public function getCacheKey() |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | { |
| 287 | 287 | $params=array(); |
| 288 | 288 | $request=$this->getRequest(); |
| 289 | - foreach(explode(',',$this->_varyByParam) as $name) |
|
| 289 | + foreach(explode(',', $this->_varyByParam) as $name) |
|
| 290 | 290 | { |
| 291 | 291 | $name=trim($name); |
| 292 | 292 | $params[$name]=$request->itemAt($name); |
@@ -378,8 +378,8 @@ discard block |
||
| 378 | 378 | */ |
| 379 | 379 | public function setDuration($value) |
| 380 | 380 | { |
| 381 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
| 382 | - throw new TInvalidDataValueException('outputcache_duration_invalid',get_class($this)); |
|
| 381 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
| 382 | + throw new TInvalidDataValueException('outputcache_duration_invalid', get_class($this)); |
|
| 383 | 383 | $this->_duration=$value; |
| 384 | 384 | } |
| 385 | 385 | |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | */ |
| 449 | 449 | public function onCheckDependency($param) |
| 450 | 450 | { |
| 451 | - $this->raiseEvent('OnCheckDependency',$this,$param); |
|
| 451 | + $this->raiseEvent('OnCheckDependency', $this, $param); |
|
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | /** |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | */ |
| 462 | 462 | public function onCalculateKey($param) |
| 463 | 463 | { |
| 464 | - $this->raiseEvent('OnCalculateKey',$this,$param); |
|
| 464 | + $this->raiseEvent('OnCalculateKey', $this, $param); |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | /** |
@@ -476,9 +476,9 @@ discard block |
||
| 476 | 476 | $writer->write($this->_contents); |
| 477 | 477 | else if($this->_cacheAvailable) |
| 478 | 478 | { |
| 479 | - $textwriter = new TTextWriter(); |
|
| 480 | - $multiwriter = new TOutputCacheTextWriterMulti(array($writer->getWriter(),$textwriter)); |
|
| 481 | - $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), $multiwriter); |
|
| 479 | + $textwriter=new TTextWriter(); |
|
| 480 | + $multiwriter=new TOutputCacheTextWriterMulti(array($writer->getWriter(), $textwriter)); |
|
| 481 | + $htmlWriter=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), $multiwriter); |
|
| 482 | 482 | |
| 483 | 483 | $stack=$this->getPage()->getCachingStack(); |
| 484 | 484 | $stack->push($this); |
@@ -486,8 +486,8 @@ discard block |
||
| 486 | 486 | $stack->pop(); |
| 487 | 487 | |
| 488 | 488 | $content=$textwriter->flush(); |
| 489 | - $data=array($content,$this->_state,$this->_actions,time()); |
|
| 490 | - $this->_cache->set($this->getCacheKey(),$data,$this->getDuration(),$this->getCacheDependency()); |
|
| 489 | + $data=array($content, $this->_state, $this->_actions, time()); |
|
| 490 | + $this->_cache->set($this->getCacheKey(), $data, $this->getDuration(), $this->getCacheDependency()); |
|
| 491 | 491 | } |
| 492 | 492 | else |
| 493 | 493 | parent::render($writer); |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | public function __construct(Array $writers) |
| 598 | 598 | { |
| 599 | 599 | //parent::__construct(); |
| 600 | - $this->_writers = $writers; |
|
| 600 | + $this->_writers=$writers; |
|
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | public function write($s) |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | public function flush() |
| 610 | 610 | { |
| 611 | 611 | foreach($this->_writers as $writer) |
| 612 | - $s = $writer->flush(); |
|
| 612 | + $s=$writer->flush(); |
|
| 613 | 613 | return $s; |
| 614 | 614 | } |
| 615 | 615 | } |
@@ -108,8 +108,7 @@ discard block |
||
| 108 | 108 | $this->_cache=$this->getApplication()->getModule($this->_cacheModuleID); |
| 109 | 109 | if(!($this->_cache instanceof ICache)) |
| 110 | 110 | throw new TConfigurationException('outputcache_cachemoduleid_invalid',$this->_cacheModuleID); |
| 111 | - } |
|
| 112 | - else |
|
| 111 | + } else |
|
| 113 | 112 | $this->_cache=$this->getApplication()->getCache(); |
| 114 | 113 | if($this->_cache!==null) |
| 115 | 114 | { |
@@ -121,8 +120,7 @@ discard block |
||
| 121 | 120 | $param->setCacheTime(isset($data[3])?$data[3]:0); |
| 122 | 121 | $this->onCheckDependency($param); |
| 123 | 122 | $this->_dataCached=$param->getIsValid(); |
| 124 | - } |
|
| 125 | - else |
|
| 123 | + } else |
|
| 126 | 124 | $this->_dataCached=false; |
| 127 | 125 | if($this->_dataCached) |
| 128 | 126 | list($this->_contents,$this->_state,$this->_actions,$this->_cacheTime)=$data; |
@@ -146,8 +144,7 @@ discard block |
||
| 146 | 144 | $stack->push($this); |
| 147 | 145 | parent::initRecursive($namingContainer); |
| 148 | 146 | $stack->pop(); |
| 149 | - } |
|
| 150 | - else |
|
| 147 | + } else |
|
| 151 | 148 | parent::initRecursive($namingContainer); |
| 152 | 149 | } |
| 153 | 150 | |
@@ -167,8 +164,7 @@ discard block |
||
| 167 | 164 | $stack->push($this); |
| 168 | 165 | parent::loadRecursive(); |
| 169 | 166 | $stack->pop(); |
| 170 | - } |
|
| 171 | - else |
|
| 167 | + } else |
|
| 172 | 168 | { |
| 173 | 169 | if($this->_dataCached) |
| 174 | 170 | $this->performActions(); |
@@ -206,8 +202,7 @@ discard block |
||
| 206 | 202 | $stack->push($this); |
| 207 | 203 | parent::preRenderRecursive(); |
| 208 | 204 | $stack->pop(); |
| 209 | - } |
|
| 210 | - else |
|
| 205 | + } else |
|
| 211 | 206 | parent::preRenderRecursive(); |
| 212 | 207 | } |
| 213 | 208 | |
@@ -488,8 +483,7 @@ discard block |
||
| 488 | 483 | $content=$textwriter->flush(); |
| 489 | 484 | $data=array($content,$this->_state,$this->_actions,time()); |
| 490 | 485 | $this->_cache->set($this->getCacheKey(),$data,$this->getDuration(),$this->getCacheDependency()); |
| 491 | - } |
|
| 492 | - else |
|
| 486 | + } else |
|
| 493 | 487 | parent::render($writer); |
| 494 | 488 | } |
| 495 | 489 | } |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * TOutputCache class file |
|
| 4 | - * |
|
| 5 | - * @author Qiang Xue <[email protected]> |
|
| 6 | - * @link https://github.com/pradosoft/prado |
|
| 7 | - * @copyright Copyright © 2005-2016 The PRADO Group |
|
| 8 | - * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
| 9 | - * @package System.Web.UI.WebControls |
|
| 10 | - */ |
|
| 3 | + * TOutputCache class file |
|
| 4 | + * |
|
| 5 | + * @author Qiang Xue <[email protected]> |
|
| 6 | + * @link https://github.com/pradosoft/prado |
|
| 7 | + * @copyright Copyright © 2005-2016 The PRADO Group |
|
| 8 | + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
| 9 | + * @package System.Web.UI.WebControls |
|
| 10 | + */ |
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * TOutputCache class. |
@@ -333,6 +333,7 @@ discard block |
||
| 333 | 333 | |
| 334 | 334 | /** |
| 335 | 335 | * @param integer the zero-based index of the current page |
| 336 | + * @param integer $value |
|
| 336 | 337 | * @throws TInvalidDataValueException if the value is less than 0 |
| 337 | 338 | */ |
| 338 | 339 | protected function setCurrentPageIndex($value) |
@@ -352,6 +353,7 @@ discard block |
||
| 352 | 353 | |
| 353 | 354 | /** |
| 354 | 355 | * @param integer number of pages of data items available |
| 356 | + * @param integer $value |
|
| 355 | 357 | * @throws TInvalidDataValueException if the value is less than 0 |
| 356 | 358 | */ |
| 357 | 359 | protected function setPageCount($value) |
@@ -446,6 +448,9 @@ discard block |
||
| 446 | 448 | * @param string caption of the button. |
| 447 | 449 | * @param string CommandName corresponding to the OnCommand event of the button. |
| 448 | 450 | * @param string CommandParameter corresponding to the OnCommand event of the button |
| 451 | + * @param TPagerButtonType $buttonType |
|
| 452 | + * @param boolean $enabled |
|
| 453 | + * @param string $commandName |
|
| 449 | 454 | * @return mixed the button instance |
| 450 | 455 | */ |
| 451 | 456 | protected function createPagerButton($buttonType,$enabled,$text,$commandName,$commandParameter) |
@@ -660,6 +665,7 @@ discard block |
||
| 660 | 665 | /** |
| 661 | 666 | * This event is raised when page index is changed due to a page button click. |
| 662 | 667 | * @param TPagerPageChangedEventParameter event parameter |
| 668 | + * @param TPagerPageChangedEventParameter $param |
|
| 663 | 669 | */ |
| 664 | 670 | public function onPageIndexChanged($param) |
| 665 | 671 | { |
@@ -398,8 +398,7 @@ discard block |
||
| 398 | 398 | $this->setPageCount($targetControl->getPageCount()); |
| 399 | 399 | $this->setCurrentPageIndex($targetControl->getCurrentPageIndex()); |
| 400 | 400 | $this->buildPager(); |
| 401 | - } |
|
| 402 | - else |
|
| 401 | + } else |
|
| 403 | 402 | $this->_pageCount=0; |
| 404 | 403 | } |
| 405 | 404 | |
@@ -461,15 +460,13 @@ discard block |
||
| 461 | 460 | $button->setCssClass($this->getButtonCssClass()); |
| 462 | 461 | return $button; |
| 463 | 462 | } |
| 464 | - } |
|
| 465 | - else |
|
| 463 | + } else |
|
| 466 | 464 | { |
| 467 | 465 | if($buttonType===TPagerButtonType::ImageButton) |
| 468 | 466 | { |
| 469 | 467 | $button=new TImageButton; |
| 470 | 468 | $button->setImageUrl($this->getPageImageUrl($text,$commandName)); |
| 471 | - } |
|
| 472 | - else |
|
| 469 | + } else |
|
| 473 | 470 | $button=new TButton; |
| 474 | 471 | if(!$enabled) |
| 475 | 472 | $button->setEnabled(false); |
@@ -524,8 +521,7 @@ discard block |
||
| 524 | 521 | } |
| 525 | 522 | $label=$this->createPagerButton($buttonType,false,$this->getPrevPageText(),self::CMD_PAGE_PREV,''); |
| 526 | 523 | $controls->add($label); |
| 527 | - } |
|
| 528 | - else |
|
| 524 | + } else |
|
| 529 | 525 | { |
| 530 | 526 | if(($text=$this->getFirstPageText())!=='') |
| 531 | 527 | { |
@@ -547,8 +543,7 @@ discard block |
||
| 547 | 543 | $label=$this->createPagerButton($buttonType,false,$text,self::CMD_PAGE_LAST,''); |
| 548 | 544 | $controls->add($label); |
| 549 | 545 | } |
| 550 | - } |
|
| 551 | - else |
|
| 546 | + } else |
|
| 552 | 547 | { |
| 553 | 548 | $button=$this->createPagerButton($buttonType,true,$this->getNextPageText(),self::CMD_PAGE_NEXT,''); |
| 554 | 549 | $controls->add($button); |
@@ -606,8 +601,7 @@ discard block |
||
| 606 | 601 | { |
| 607 | 602 | $label=$this->createPagerButton($buttonType,false,"$i",self::CMD_PAGE,''); |
| 608 | 603 | $controls->add($label); |
| 609 | - } |
|
| 610 | - else |
|
| 604 | + } else |
|
| 611 | 605 | { |
| 612 | 606 | $button=$this->createPagerButton($buttonType,true,"$i",self::CMD_PAGE,"$i"); |
| 613 | 607 | $controls->add($button); |
@@ -684,32 +678,27 @@ discard block |
||
| 684 | 678 | $pageIndex=TPropertyValue::ensureInteger($param->getCommandParameter())-1; |
| 685 | 679 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex)); |
| 686 | 680 | return true; |
| 687 | - } |
|
| 688 | - else if(strcasecmp($command,self::CMD_PAGE_NEXT)===0) |
|
| 681 | + } else if(strcasecmp($command,self::CMD_PAGE_NEXT)===0) |
|
| 689 | 682 | { |
| 690 | 683 | $pageIndex=$this->getCurrentPageIndex()+1; |
| 691 | 684 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex)); |
| 692 | 685 | return true; |
| 693 | - } |
|
| 694 | - else if(strcasecmp($command,self::CMD_PAGE_PREV)===0) |
|
| 686 | + } else if(strcasecmp($command,self::CMD_PAGE_PREV)===0) |
|
| 695 | 687 | { |
| 696 | 688 | $pageIndex=$this->getCurrentPageIndex()-1; |
| 697 | 689 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex)); |
| 698 | 690 | return true; |
| 699 | - } |
|
| 700 | - else if(strcasecmp($command,self::CMD_PAGE_FIRST)===0) |
|
| 691 | + } else if(strcasecmp($command,self::CMD_PAGE_FIRST)===0) |
|
| 701 | 692 | { |
| 702 | 693 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,0)); |
| 703 | 694 | return true; |
| 704 | - } |
|
| 705 | - else if(strcasecmp($command,self::CMD_PAGE_LAST)===0) |
|
| 695 | + } else if(strcasecmp($command,self::CMD_PAGE_LAST)===0) |
|
| 706 | 696 | { |
| 707 | 697 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$this->getPageCount()-1)); |
| 708 | 698 | return true; |
| 709 | 699 | } |
| 710 | 700 | return false; |
| 711 | - } |
|
| 712 | - else |
|
| 701 | + } else |
|
| 713 | 702 | return false; |
| 714 | 703 | } |
| 715 | 704 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function getControlToPaginate() |
| 82 | 82 | { |
| 83 | - return $this->getViewState('ControlToPaginate',''); |
|
| 83 | + return $this->getViewState('ControlToPaginate', ''); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function setControlToPaginate($value) |
| 93 | 93 | { |
| 94 | - $this->setViewState('ControlToPaginate',$value,''); |
|
| 94 | + $this->setViewState('ControlToPaginate', $value, ''); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function getButtonCssClass() |
| 102 | 102 | { |
| 103 | - return $this->getViewState('ButtonCssClass',''); |
|
| 103 | + return $this->getViewState('ButtonCssClass', ''); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function setButtonCssClass($value) |
| 111 | 111 | { |
| 112 | - $this->setViewState('ButtonCssClass',TPropertyValue::ensureString($value,''),''); |
|
| 112 | + $this->setViewState('ButtonCssClass', TPropertyValue::ensureString($value, ''), ''); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function getMode() |
| 119 | 119 | { |
| 120 | - return $this->getViewState('Mode',TPagerMode::NextPrev); |
|
| 120 | + return $this->getViewState('Mode', TPagerMode::NextPrev); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function setMode($value) |
| 127 | 127 | { |
| 128 | - $this->setViewState('Mode',TPropertyValue::ensureEnum($value,'TPagerMode'),TPagerMode::NextPrev); |
|
| 128 | + $this->setViewState('Mode', TPropertyValue::ensureEnum($value, 'TPagerMode'), TPagerMode::NextPrev); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | public function getButtonType() |
| 135 | 135 | { |
| 136 | - return $this->getViewState('ButtonType',TPagerButtonType::LinkButton); |
|
| 136 | + return $this->getViewState('ButtonType', TPagerButtonType::LinkButton); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | public function setButtonType($value) |
| 143 | 143 | { |
| 144 | - $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'TPagerButtonType'),TPagerButtonType::LinkButton); |
|
| 144 | + $this->setViewState('ButtonType', TPropertyValue::ensureEnum($value, 'TPagerButtonType'), TPagerButtonType::LinkButton); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function getNextPageText() |
| 151 | 151 | { |
| 152 | - return $this->getViewState('NextPageText','>'); |
|
| 152 | + return $this->getViewState('NextPageText', '>'); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function setNextPageText($value) |
| 159 | 159 | { |
| 160 | - $this->setViewState('NextPageText',$value,'>'); |
|
| 160 | + $this->setViewState('NextPageText', $value, '>'); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public function getPrevPageText() |
| 167 | 167 | { |
| 168 | - return $this->getViewState('PrevPageText','<'); |
|
| 168 | + return $this->getViewState('PrevPageText', '<'); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | public function setPrevPageText($value) |
| 175 | 175 | { |
| 176 | - $this->setViewState('PrevPageText',$value,'<'); |
|
| 176 | + $this->setViewState('PrevPageText', $value, '<'); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | public function getFirstPageText() |
| 183 | 183 | { |
| 184 | - return $this->getViewState('FirstPageText','<<'); |
|
| 184 | + return $this->getViewState('FirstPageText', '<<'); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | /** |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function setFirstPageText($value) |
| 191 | 191 | { |
| 192 | - $this->setViewState('FirstPageText',$value,'<<'); |
|
| 192 | + $this->setViewState('FirstPageText', $value, '<<'); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | public function getLastPageText() |
| 199 | 199 | { |
| 200 | - return $this->getViewState('LastPageText','>>'); |
|
| 200 | + return $this->getViewState('LastPageText', '>>'); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | public function setLastPageText($value) |
| 207 | 207 | { |
| 208 | - $this->setViewState('LastPageText',$value,'>>'); |
|
| 208 | + $this->setViewState('LastPageText', $value, '>>'); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | public function getFirstPageImageUrl() |
| 216 | 216 | { |
| 217 | - return $this->getViewState('FirstPageImageUrl',''); |
|
| 217 | + return $this->getViewState('FirstPageImageUrl', ''); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | */ |
| 224 | 224 | public function setFirstPageImageUrl($value) |
| 225 | 225 | { |
| 226 | - $this->setViewState('FirstPageImageUrl',$value); |
|
| 226 | + $this->setViewState('FirstPageImageUrl', $value); |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /** |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | public function getLastPageImageUrl() |
| 234 | 234 | { |
| 235 | - return $this->getViewState('LastPageImageUrl',''); |
|
| 235 | + return $this->getViewState('LastPageImageUrl', ''); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | /** |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | */ |
| 242 | 242 | public function setLastPageImageUrl($value) |
| 243 | 243 | { |
| 244 | - $this->setViewState('LastPageImageUrl',$value); |
|
| 244 | + $this->setViewState('LastPageImageUrl', $value); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /** |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | */ |
| 251 | 251 | public function getNextPageImageUrl() |
| 252 | 252 | { |
| 253 | - return $this->getViewState('NextPageImageUrl',''); |
|
| 253 | + return $this->getViewState('NextPageImageUrl', ''); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | public function setNextPageImageUrl($value) |
| 261 | 261 | { |
| 262 | - $this->setViewState('NextPageImageUrl',$value); |
|
| 262 | + $this->setViewState('NextPageImageUrl', $value); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /** |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | */ |
| 269 | 269 | public function getPrevPageImageUrl() |
| 270 | 270 | { |
| 271 | - return $this->getViewState('PrevPageImageUrl',''); |
|
| 271 | + return $this->getViewState('PrevPageImageUrl', ''); |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | /** |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | public function setPrevPageImageUrl($value) |
| 279 | 279 | { |
| 280 | - $this->setViewState('PrevPageImageUrl',$value); |
|
| 280 | + $this->setViewState('PrevPageImageUrl', $value); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | */ |
| 288 | 288 | public function getNumericPageImageUrl() |
| 289 | 289 | { |
| 290 | - return $this->getViewState('NumericPageImageUrl',''); |
|
| 290 | + return $this->getViewState('NumericPageImageUrl', ''); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | */ |
| 302 | 302 | public function setNumericPageImageUrl($value) |
| 303 | 303 | { |
| 304 | - $this->setViewState('NumericPageImageUrl',$value); |
|
| 304 | + $this->setViewState('NumericPageImageUrl', $value); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | /** |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | public function getPageButtonCount() |
| 311 | 311 | { |
| 312 | - return $this->getViewState('PageButtonCount',10); |
|
| 312 | + return $this->getViewState('PageButtonCount', 10); |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
@@ -318,9 +318,9 @@ discard block |
||
| 318 | 318 | */ |
| 319 | 319 | public function setPageButtonCount($value) |
| 320 | 320 | { |
| 321 | - if(($value=TPropertyValue::ensureInteger($value))<1) |
|
| 321 | + if(($value=TPropertyValue::ensureInteger($value)) < 1) |
|
| 322 | 322 | throw new TInvalidDataValueException('pager_pagebuttoncount_invalid'); |
| 323 | - $this->setViewState('PageButtonCount',$value,10); |
|
| 323 | + $this->setViewState('PageButtonCount', $value, 10); |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | /** |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | public function getCurrentPageIndex() |
| 330 | 330 | { |
| 331 | - return $this->getViewState('CurrentPageIndex',0); |
|
| 331 | + return $this->getViewState('CurrentPageIndex', 0); |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | /** |
@@ -337,9 +337,9 @@ discard block |
||
| 337 | 337 | */ |
| 338 | 338 | protected function setCurrentPageIndex($value) |
| 339 | 339 | { |
| 340 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
| 340 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
| 341 | 341 | throw new TInvalidDataValueException('pager_currentpageindex_invalid'); |
| 342 | - $this->setViewState('CurrentPageIndex',$value,0); |
|
| 342 | + $this->setViewState('CurrentPageIndex', $value, 0); |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | /** |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | */ |
| 348 | 348 | public function getPageCount() |
| 349 | 349 | { |
| 350 | - return $this->getViewState('PageCount',0); |
|
| 350 | + return $this->getViewState('PageCount', 0); |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | /** |
@@ -356,9 +356,9 @@ discard block |
||
| 356 | 356 | */ |
| 357 | 357 | protected function setPageCount($value) |
| 358 | 358 | { |
| 359 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
| 359 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
| 360 | 360 | throw new TInvalidDataValueException('pager_pagecount_invalid'); |
| 361 | - $this->setViewState('PageCount',$value,0); |
|
| 361 | + $this->setViewState('PageCount', $value, 0); |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | /** |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | */ |
| 375 | 375 | public function getIsLastPage() |
| 376 | 376 | { |
| 377 | - return $this->getCurrentPageIndex()===$this->getPageCount()-1; |
|
| 377 | + return $this->getCurrentPageIndex()===$this->getPageCount() - 1; |
|
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | /** |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | |
| 390 | 390 | $controlID=$this->getControlToPaginate(); |
| 391 | 391 | if(($targetControl=$this->getNamingContainer()->findControl($controlID))===null || !($targetControl instanceof TDataBoundControl)) |
| 392 | - throw new TConfigurationException('pager_controltopaginate_invalid',$controlID); |
|
| 392 | + throw new TConfigurationException('pager_controltopaginate_invalid', $controlID); |
|
| 393 | 393 | |
| 394 | 394 | if($targetControl->getAllowPaging()) |
| 395 | 395 | { |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | */ |
| 412 | 412 | public function render($writer) |
| 413 | 413 | { |
| 414 | - if($this->_pageCount>1) |
|
| 414 | + if($this->_pageCount > 1) |
|
| 415 | 415 | parent::render($writer); |
| 416 | 416 | } |
| 417 | 417 | |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | * @param string CommandParameter corresponding to the OnCommand event of the button |
| 449 | 449 | * @return mixed the button instance |
| 450 | 450 | */ |
| 451 | - protected function createPagerButton($buttonType,$enabled,$text,$commandName,$commandParameter) |
|
| 451 | + protected function createPagerButton($buttonType, $enabled, $text, $commandName, $commandParameter) |
|
| 452 | 452 | { |
| 453 | 453 | if($buttonType===TPagerButtonType::LinkButton) |
| 454 | 454 | { |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | if($buttonType===TPagerButtonType::ImageButton) |
| 468 | 468 | { |
| 469 | 469 | $button=new TImageButton; |
| 470 | - $button->setImageUrl($this->getPageImageUrl($text,$commandName)); |
|
| 470 | + $button->setImageUrl($this->getPageImageUrl($text, $commandName)); |
|
| 471 | 471 | } |
| 472 | 472 | else |
| 473 | 473 | $button=new TButton; |
@@ -487,13 +487,13 @@ discard block |
||
| 487 | 487 | * @param string the command name associated with the image button |
| 488 | 488 | * @since 3.1.1 |
| 489 | 489 | */ |
| 490 | - protected function getPageImageUrl($text,$commandName) |
|
| 490 | + protected function getPageImageUrl($text, $commandName) |
|
| 491 | 491 | { |
| 492 | 492 | switch($commandName) |
| 493 | 493 | { |
| 494 | 494 | case self::CMD_PAGE: |
| 495 | 495 | $url=$this->getNumericPageImageUrl(); |
| 496 | - return str_replace('{0}',$text,$url); |
|
| 496 | + return str_replace('{0}', $text, $url); |
|
| 497 | 497 | case self::CMD_PAGE_NEXT: |
| 498 | 498 | return $this->getNextPageImageUrl(); |
| 499 | 499 | case self::CMD_PAGE_PREV: |
@@ -518,44 +518,44 @@ discard block |
||
| 518 | 518 | { |
| 519 | 519 | if(($text=$this->getFirstPageText())!=='') |
| 520 | 520 | { |
| 521 | - $label=$this->createPagerButton($buttonType,false,$text,self::CMD_PAGE_FIRST,''); |
|
| 521 | + $label=$this->createPagerButton($buttonType, false, $text, self::CMD_PAGE_FIRST, ''); |
|
| 522 | 522 | $controls->add($label); |
| 523 | 523 | $controls->add("\n"); |
| 524 | 524 | } |
| 525 | - $label=$this->createPagerButton($buttonType,false,$this->getPrevPageText(),self::CMD_PAGE_PREV,''); |
|
| 525 | + $label=$this->createPagerButton($buttonType, false, $this->getPrevPageText(), self::CMD_PAGE_PREV, ''); |
|
| 526 | 526 | $controls->add($label); |
| 527 | 527 | } |
| 528 | 528 | else |
| 529 | 529 | { |
| 530 | 530 | if(($text=$this->getFirstPageText())!=='') |
| 531 | 531 | { |
| 532 | - $button=$this->createPagerButton($buttonType,true,$text,self::CMD_PAGE_FIRST,''); |
|
| 532 | + $button=$this->createPagerButton($buttonType, true, $text, self::CMD_PAGE_FIRST, ''); |
|
| 533 | 533 | $controls->add($button); |
| 534 | 534 | $controls->add("\n"); |
| 535 | 535 | } |
| 536 | - $button=$this->createPagerButton($buttonType,true,$this->getPrevPageText(),self::CMD_PAGE_PREV,''); |
|
| 536 | + $button=$this->createPagerButton($buttonType, true, $this->getPrevPageText(), self::CMD_PAGE_PREV, ''); |
|
| 537 | 537 | $controls->add($button); |
| 538 | 538 | } |
| 539 | 539 | $controls->add("\n"); |
| 540 | 540 | if($this->getIsLastPage()) |
| 541 | 541 | { |
| 542 | - $label=$this->createPagerButton($buttonType,false,$this->getNextPageText(),self::CMD_PAGE_NEXT,''); |
|
| 542 | + $label=$this->createPagerButton($buttonType, false, $this->getNextPageText(), self::CMD_PAGE_NEXT, ''); |
|
| 543 | 543 | $controls->add($label); |
| 544 | 544 | if(($text=$this->getLastPageText())!=='') |
| 545 | 545 | { |
| 546 | 546 | $controls->add("\n"); |
| 547 | - $label=$this->createPagerButton($buttonType,false,$text,self::CMD_PAGE_LAST,''); |
|
| 547 | + $label=$this->createPagerButton($buttonType, false, $text, self::CMD_PAGE_LAST, ''); |
|
| 548 | 548 | $controls->add($label); |
| 549 | 549 | } |
| 550 | 550 | } |
| 551 | 551 | else |
| 552 | 552 | { |
| 553 | - $button=$this->createPagerButton($buttonType,true,$this->getNextPageText(),self::CMD_PAGE_NEXT,''); |
|
| 553 | + $button=$this->createPagerButton($buttonType, true, $this->getNextPageText(), self::CMD_PAGE_NEXT, ''); |
|
| 554 | 554 | $controls->add($button); |
| 555 | 555 | if(($text=$this->getLastPageText())!=='') |
| 556 | 556 | { |
| 557 | 557 | $controls->add("\n"); |
| 558 | - $button=$this->createPagerButton($buttonType,true,$text,self::CMD_PAGE_LAST,''); |
|
| 558 | + $button=$this->createPagerButton($buttonType, true, $text, self::CMD_PAGE_LAST, ''); |
|
| 559 | 559 | $controls->add($button); |
| 560 | 560 | } |
| 561 | 561 | } |
@@ -569,63 +569,63 @@ discard block |
||
| 569 | 569 | $buttonType=$this->getButtonType(); |
| 570 | 570 | $controls=$this->getControls(); |
| 571 | 571 | $pageCount=$this->getPageCount(); |
| 572 | - $pageIndex=$this->getCurrentPageIndex()+1; |
|
| 572 | + $pageIndex=$this->getCurrentPageIndex() + 1; |
|
| 573 | 573 | $maxButtonCount=$this->getPageButtonCount(); |
| 574 | - $buttonCount=$maxButtonCount>$pageCount?$pageCount:$maxButtonCount; |
|
| 574 | + $buttonCount=$maxButtonCount > $pageCount ? $pageCount : $maxButtonCount; |
|
| 575 | 575 | $startPageIndex=1; |
| 576 | 576 | $endPageIndex=$buttonCount; |
| 577 | - if($pageIndex>$endPageIndex) |
|
| 577 | + if($pageIndex > $endPageIndex) |
|
| 578 | 578 | { |
| 579 | - $startPageIndex=((int)(($pageIndex-1)/$maxButtonCount))*$maxButtonCount+1; |
|
| 580 | - if(($endPageIndex=$startPageIndex+$maxButtonCount-1)>$pageCount) |
|
| 579 | + $startPageIndex=((int) (($pageIndex - 1) / $maxButtonCount)) * $maxButtonCount + 1; |
|
| 580 | + if(($endPageIndex=$startPageIndex + $maxButtonCount - 1) > $pageCount) |
|
| 581 | 581 | $endPageIndex=$pageCount; |
| 582 | - if($endPageIndex-$startPageIndex+1<$maxButtonCount) |
|
| 582 | + if($endPageIndex - $startPageIndex + 1 < $maxButtonCount) |
|
| 583 | 583 | { |
| 584 | - if(($startPageIndex=$endPageIndex-$maxButtonCount+1)<1) |
|
| 584 | + if(($startPageIndex=$endPageIndex - $maxButtonCount + 1) < 1) |
|
| 585 | 585 | $startPageIndex=1; |
| 586 | 586 | } |
| 587 | 587 | } |
| 588 | 588 | |
| 589 | - if($startPageIndex>1) |
|
| 589 | + if($startPageIndex > 1) |
|
| 590 | 590 | { |
| 591 | 591 | if(($text=$this->getFirstPageText())!=='') |
| 592 | 592 | { |
| 593 | - $button=$this->createPagerButton($buttonType,true,$text,self::CMD_PAGE_FIRST,''); |
|
| 593 | + $button=$this->createPagerButton($buttonType, true, $text, self::CMD_PAGE_FIRST, ''); |
|
| 594 | 594 | $controls->add($button); |
| 595 | 595 | $controls->add("\n"); |
| 596 | 596 | } |
| 597 | - $prevPageIndex=$startPageIndex-1; |
|
| 598 | - $button=$this->createPagerButton($buttonType,true,$this->getPrevPageText(),self::CMD_PAGE,"$prevPageIndex"); |
|
| 597 | + $prevPageIndex=$startPageIndex - 1; |
|
| 598 | + $button=$this->createPagerButton($buttonType, true, $this->getPrevPageText(), self::CMD_PAGE, "$prevPageIndex"); |
|
| 599 | 599 | $controls->add($button); |
| 600 | 600 | $controls->add("\n"); |
| 601 | 601 | } |
| 602 | 602 | |
| 603 | - for($i=$startPageIndex;$i<=$endPageIndex;++$i) |
|
| 603 | + for($i=$startPageIndex; $i <= $endPageIndex; ++$i) |
|
| 604 | 604 | { |
| 605 | 605 | if($i===$pageIndex) |
| 606 | 606 | { |
| 607 | - $label=$this->createPagerButton($buttonType,false,"$i",self::CMD_PAGE,''); |
|
| 607 | + $label=$this->createPagerButton($buttonType, false, "$i", self::CMD_PAGE, ''); |
|
| 608 | 608 | $controls->add($label); |
| 609 | 609 | } |
| 610 | 610 | else |
| 611 | 611 | { |
| 612 | - $button=$this->createPagerButton($buttonType,true,"$i",self::CMD_PAGE,"$i"); |
|
| 612 | + $button=$this->createPagerButton($buttonType, true, "$i", self::CMD_PAGE, "$i"); |
|
| 613 | 613 | $controls->add($button); |
| 614 | 614 | } |
| 615 | - if($i<$endPageIndex) |
|
| 615 | + if($i < $endPageIndex) |
|
| 616 | 616 | $controls->add("\n"); |
| 617 | 617 | } |
| 618 | 618 | |
| 619 | - if($pageCount>$endPageIndex) |
|
| 619 | + if($pageCount > $endPageIndex) |
|
| 620 | 620 | { |
| 621 | 621 | $controls->add("\n"); |
| 622 | - $nextPageIndex=$endPageIndex+1; |
|
| 623 | - $button=$this->createPagerButton($buttonType,true,$this->getNextPageText(),self::CMD_PAGE,"$nextPageIndex"); |
|
| 622 | + $nextPageIndex=$endPageIndex + 1; |
|
| 623 | + $button=$this->createPagerButton($buttonType, true, $this->getNextPageText(), self::CMD_PAGE, "$nextPageIndex"); |
|
| 624 | 624 | $controls->add($button); |
| 625 | 625 | if(($text=$this->getLastPageText())!=='') |
| 626 | 626 | { |
| 627 | 627 | $controls->add("\n"); |
| 628 | - $button=$this->createPagerButton($buttonType,true,$text,self::CMD_PAGE_LAST,''); |
|
| 628 | + $button=$this->createPagerButton($buttonType, true, $text, self::CMD_PAGE_LAST, ''); |
|
| 629 | 629 | $controls->add($button); |
| 630 | 630 | } |
| 631 | 631 | } |
@@ -638,11 +638,11 @@ discard block |
||
| 638 | 638 | { |
| 639 | 639 | $list=new TDropDownList; |
| 640 | 640 | $this->getControls()->add($list); |
| 641 | - $list->setDataSource(range(1,$this->getPageCount())); |
|
| 641 | + $list->setDataSource(range(1, $this->getPageCount())); |
|
| 642 | 642 | $list->dataBind(); |
| 643 | 643 | $list->setSelectedIndex($this->getCurrentPageIndex()); |
| 644 | 644 | $list->setAutoPostBack(true); |
| 645 | - $list->attachEventHandler('OnSelectedIndexChanged',array($this,'listIndexChanged')); |
|
| 645 | + $list->attachEventHandler('OnSelectedIndexChanged', array($this, 'listIndexChanged')); |
|
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | /** |
@@ -651,10 +651,10 @@ discard block |
||
| 651 | 651 | * @param TDropDownList the dropdown list control raising the event |
| 652 | 652 | * @param TEventParameter event parameter |
| 653 | 653 | */ |
| 654 | - public function listIndexChanged($sender,$param) |
|
| 654 | + public function listIndexChanged($sender, $param) |
|
| 655 | 655 | { |
| 656 | 656 | $pageIndex=$sender->getSelectedIndex(); |
| 657 | - $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex)); |
|
| 657 | + $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex)); |
|
| 658 | 658 | } |
| 659 | 659 | |
| 660 | 660 | /** |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | */ |
| 664 | 664 | public function onPageIndexChanged($param) |
| 665 | 665 | { |
| 666 | - $this->raiseEvent('OnPageIndexChanged',$this,$param); |
|
| 666 | + $this->raiseEvent('OnPageIndexChanged', $this, $param); |
|
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | /** |
@@ -674,37 +674,37 @@ discard block |
||
| 674 | 674 | * @param TEventParameter event parameter |
| 675 | 675 | * @return boolean whether the event bubbling should stop here. |
| 676 | 676 | */ |
| 677 | - public function bubbleEvent($sender,$param) |
|
| 677 | + public function bubbleEvent($sender, $param) |
|
| 678 | 678 | { |
| 679 | 679 | if($param instanceof TCommandEventParameter) |
| 680 | 680 | { |
| 681 | 681 | $command=$param->getCommandName(); |
| 682 | - if(strcasecmp($command,self::CMD_PAGE)===0) |
|
| 682 | + if(strcasecmp($command, self::CMD_PAGE)===0) |
|
| 683 | 683 | { |
| 684 | - $pageIndex=TPropertyValue::ensureInteger($param->getCommandParameter())-1; |
|
| 685 | - $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex)); |
|
| 684 | + $pageIndex=TPropertyValue::ensureInteger($param->getCommandParameter()) - 1; |
|
| 685 | + $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex)); |
|
| 686 | 686 | return true; |
| 687 | 687 | } |
| 688 | - else if(strcasecmp($command,self::CMD_PAGE_NEXT)===0) |
|
| 688 | + else if(strcasecmp($command, self::CMD_PAGE_NEXT)===0) |
|
| 689 | 689 | { |
| 690 | - $pageIndex=$this->getCurrentPageIndex()+1; |
|
| 691 | - $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex)); |
|
| 690 | + $pageIndex=$this->getCurrentPageIndex() + 1; |
|
| 691 | + $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex)); |
|
| 692 | 692 | return true; |
| 693 | 693 | } |
| 694 | - else if(strcasecmp($command,self::CMD_PAGE_PREV)===0) |
|
| 694 | + else if(strcasecmp($command, self::CMD_PAGE_PREV)===0) |
|
| 695 | 695 | { |
| 696 | - $pageIndex=$this->getCurrentPageIndex()-1; |
|
| 697 | - $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex)); |
|
| 696 | + $pageIndex=$this->getCurrentPageIndex() - 1; |
|
| 697 | + $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex)); |
|
| 698 | 698 | return true; |
| 699 | 699 | } |
| 700 | - else if(strcasecmp($command,self::CMD_PAGE_FIRST)===0) |
|
| 700 | + else if(strcasecmp($command, self::CMD_PAGE_FIRST)===0) |
|
| 701 | 701 | { |
| 702 | - $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,0)); |
|
| 702 | + $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, 0)); |
|
| 703 | 703 | return true; |
| 704 | 704 | } |
| 705 | - else if(strcasecmp($command,self::CMD_PAGE_LAST)===0) |
|
| 705 | + else if(strcasecmp($command, self::CMD_PAGE_LAST)===0) |
|
| 706 | 706 | { |
| 707 | - $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$this->getPageCount()-1)); |
|
| 707 | + $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $this->getPageCount() - 1)); |
|
| 708 | 708 | return true; |
| 709 | 709 | } |
| 710 | 710 | return false; |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | * @param TControl the control originally raises the <b>OnCommand</b> event. |
| 745 | 745 | * @param integer new page index |
| 746 | 746 | */ |
| 747 | - public function __construct($source,$newPageIndex) |
|
| 747 | + public function __construct($source, $newPageIndex) |
|
| 748 | 748 | { |
| 749 | 749 | $this->_source=$source; |
| 750 | 750 | $this->_newIndex=$newPageIndex; |
@@ -96,6 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * @param boolean true to perform strict comparison (i.e. strictly less than max and/or strictly greater than min). |
| 99 | + * @param boolean $value |
|
| 99 | 100 | */ |
| 100 | 101 | public function setStrictComparison($value) |
| 101 | 102 | { |
@@ -191,6 +192,7 @@ discard block |
||
| 191 | 192 | /** |
| 192 | 193 | * Determine if the value is within the integer range. |
| 193 | 194 | * @param string value to validate true |
| 195 | + * @param string $value |
|
| 194 | 196 | * @return boolean true if within integer range. |
| 195 | 197 | */ |
| 196 | 198 | protected function isValidInteger($value) |
@@ -220,6 +222,7 @@ discard block |
||
| 220 | 222 | /** |
| 221 | 223 | * Determine if the value is within the specified float range. |
| 222 | 224 | * @param string value to validate |
| 225 | + * @param string $value |
|
| 223 | 226 | * @return boolean true if within range. |
| 224 | 227 | */ |
| 225 | 228 | protected function isValidFloat($value) |
@@ -240,6 +243,7 @@ discard block |
||
| 240 | 243 | * Determine if the date is within the specified range. |
| 241 | 244 | * Uses pradoParseDate and strtotime to get the date from string. |
| 242 | 245 | * @param string date as string to validate |
| 246 | + * @param string $value |
|
| 243 | 247 | * @return boolean true if within range. |
| 244 | 248 | */ |
| 245 | 249 | protected function isValidDate($value) |
@@ -275,6 +279,7 @@ discard block |
||
| 275 | 279 | * Compare the string with a minimum and a maxiumum value. |
| 276 | 280 | * Uses strcmp for comparision. |
| 277 | 281 | * @param string value to compare with. |
| 282 | + * @param string $value |
|
| 278 | 283 | * @return boolean true if the string is within range. |
| 279 | 284 | */ |
| 280 | 285 | protected function isValidString($value) |
@@ -292,6 +297,7 @@ discard block |
||
| 292 | 297 | |
| 293 | 298 | /** |
| 294 | 299 | * @param string string for comparision |
| 300 | + * @param string $value |
|
| 295 | 301 | * @return boolean true if min and max string length are satisfied. |
| 296 | 302 | */ |
| 297 | 303 | protected function isValidStringLength($value) |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | - * Sets the date format for a date validation |
|
| 133 | - * @param string the date format value |
|
| 134 | - */ |
|
| 132 | + * Sets the date format for a date validation |
|
| 133 | + * @param string the date format value |
|
| 134 | + */ |
|
| 135 | 135 | public function setDateFormat($value) |
| 136 | 136 | { |
| 137 | 137 | $this->setViewState('DateFormat', $value, ''); |
@@ -189,10 +189,10 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | - * Determine if the value is within the integer range. |
|
| 193 | - * @param string value to validate true |
|
| 194 | - * @return boolean true if within integer range. |
|
| 195 | - */ |
|
| 192 | + * Determine if the value is within the integer range. |
|
| 193 | + * @param string value to validate true |
|
| 194 | + * @return boolean true if within integer range. |
|
| 195 | + */ |
|
| 196 | 196 | protected function isValidInteger($value) |
| 197 | 197 | { |
| 198 | 198 | $minValue=$this->getMinValue(); |
@@ -58,8 +58,7 @@ |
||
| 58 | 58 | if ($this->sourcepath === NULL) |
| 59 | 59 | { |
| 60 | 60 | $this->sourcepath = $sourcepath; |
| 61 | - } |
|
| 62 | - else |
|
| 61 | + } else |
|
| 63 | 62 | { |
| 64 | 63 | $this->sourcepath->append($sourcepath); |
| 65 | 64 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function getMinValue() |
| 67 | 67 | { |
| 68 | - return $this->getViewState('MinValue',''); |
|
| 68 | + return $this->getViewState('MinValue', ''); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function setMinValue($value) |
| 76 | 76 | { |
| 77 | - $this->setViewState('MinValue',TPropertyValue::ensureString($value),''); |
|
| 77 | + $this->setViewState('MinValue', TPropertyValue::ensureString($value), ''); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function getMaxValue() |
| 84 | 84 | { |
| 85 | - return $this->getViewState('MaxValue',''); |
|
| 85 | + return $this->getViewState('MaxValue', ''); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function setMaxValue($value) |
| 93 | 93 | { |
| 94 | - $this->setViewState('MaxValue',TPropertyValue::ensureString($value),''); |
|
| 94 | + $this->setViewState('MaxValue', TPropertyValue::ensureString($value), ''); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function setStrictComparison($value) |
| 101 | 101 | { |
| 102 | - $this->setViewState('StrictComparison', TPropertyValue::ensureBoolean($value),false); |
|
| 102 | + $this->setViewState('StrictComparison', TPropertyValue::ensureBoolean($value), false); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function getDataType() |
| 118 | 118 | { |
| 119 | - return $this->getViewState('DataType',TRangeValidationDataType::String); |
|
| 119 | + return $this->getViewState('DataType', TRangeValidationDataType::String); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function setDataType($value) |
| 127 | 127 | { |
| 128 | - $this->setViewState('DataType',TPropertyValue::ensureEnum($value,'TRangeValidationDataType'),TRangeValidationDataType::String); |
|
| 128 | + $this->setViewState('DataType', TPropertyValue::ensureEnum($value, 'TRangeValidationDataType'), TRangeValidationDataType::String); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -198,16 +198,16 @@ discard block |
||
| 198 | 198 | $minValue=$this->getMinValue(); |
| 199 | 199 | $maxValue=$this->getMaxValue(); |
| 200 | 200 | |
| 201 | - $valid=preg_match('/^[-+]?[0-9]+$/',trim($value)); |
|
| 201 | + $valid=preg_match('/^[-+]?[0-9]+$/', trim($value)); |
|
| 202 | 202 | $value=intval($value); |
| 203 | 203 | if($minValue!=='') |
| 204 | 204 | $valid=$valid && $this->isGreaterThan($value, intval($minValue)); |
| 205 | 205 | if($maxValue!=='') |
| 206 | - $valid=$valid && $this->isLessThan($value,intval($maxValue)); |
|
| 206 | + $valid=$valid && $this->isLessThan($value, intval($maxValue)); |
|
| 207 | 207 | return $valid; |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - protected function isLessThan($left,$right) |
|
| 210 | + protected function isLessThan($left, $right) |
|
| 211 | 211 | { |
| 212 | 212 | return $this->getStrictComparison() ? $left < $right : $left <= $right; |
| 213 | 213 | } |
@@ -227,12 +227,12 @@ discard block |
||
| 227 | 227 | $minValue=$this->getMinValue(); |
| 228 | 228 | $maxValue=$this->getMaxValue(); |
| 229 | 229 | |
| 230 | - $valid=preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/',trim($value)); |
|
| 230 | + $valid=preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/', trim($value)); |
|
| 231 | 231 | $value=floatval($value); |
| 232 | 232 | if($minValue!=='') |
| 233 | - $valid=$valid && $this->isGreaterThan($value,floatval($minValue)); |
|
| 233 | + $valid=$valid && $this->isGreaterThan($value, floatval($minValue)); |
|
| 234 | 234 | if($maxValue!=='') |
| 235 | - $valid=$valid && $this->isLessThan($value,floatval($maxValue)); |
|
| 235 | + $valid=$valid && $this->isLessThan($value, floatval($maxValue)); |
|
| 236 | 236 | return $valid; |
| 237 | 237 | } |
| 238 | 238 | |
@@ -249,24 +249,24 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | $valid=true; |
| 251 | 251 | |
| 252 | - $dateFormat = $this->getDateFormat(); |
|
| 252 | + $dateFormat=$this->getDateFormat(); |
|
| 253 | 253 | if($dateFormat!=='') |
| 254 | 254 | { |
| 255 | 255 | $formatter=Prado::createComponent('System.Util.TSimpleDateFormatter', $dateFormat); |
| 256 | - $value = $formatter->parse($value); |
|
| 256 | + $value=$formatter->parse($value); |
|
| 257 | 257 | if($minValue!=='') |
| 258 | - $valid=$valid && $this->isGreaterThan($value,$formatter->parse($minValue)); |
|
| 258 | + $valid=$valid && $this->isGreaterThan($value, $formatter->parse($minValue)); |
|
| 259 | 259 | if($maxValue!=='') |
| 260 | - $valid=$valid && $this->isLessThan($value,$formatter->parse($maxValue)); |
|
| 260 | + $valid=$valid && $this->isLessThan($value, $formatter->parse($maxValue)); |
|
| 261 | 261 | return $valid; |
| 262 | 262 | } |
| 263 | 263 | else |
| 264 | 264 | { |
| 265 | 265 | $value=strtotime($value); |
| 266 | 266 | if($minValue!=='') |
| 267 | - $valid=$valid && $this->isGreaterThan($value,strtotime($minValue)); |
|
| 267 | + $valid=$valid && $this->isGreaterThan($value, strtotime($minValue)); |
|
| 268 | 268 | if($maxValue!=='') |
| 269 | - $valid=$valid && $this->isLessThan($value,strtotime($maxValue)); |
|
| 269 | + $valid=$valid && $this->isLessThan($value, strtotime($maxValue)); |
|
| 270 | 270 | return $valid; |
| 271 | 271 | } |
| 272 | 272 | } |
@@ -284,9 +284,9 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | $valid=true; |
| 286 | 286 | if($minValue!=='') |
| 287 | - $valid=$valid && $this->isGreaterThan(strcmp($value,$minValue),0); |
|
| 287 | + $valid=$valid && $this->isGreaterThan(strcmp($value, $minValue), 0); |
|
| 288 | 288 | if($maxValue!=='') |
| 289 | - $valid=$valid && $this->isLessThan(strcmp($value,$maxValue),0); |
|
| 289 | + $valid=$valid && $this->isLessThan(strcmp($value, $maxValue), 0); |
|
| 290 | 290 | return $valid; |
| 291 | 291 | } |
| 292 | 292 | |
@@ -300,20 +300,20 @@ discard block |
||
| 300 | 300 | $maxValue=$this->getMaxValue(); |
| 301 | 301 | |
| 302 | 302 | $valid=true; |
| 303 | - $charset = $this->getCharset(); |
|
| 303 | + $charset=$this->getCharset(); |
|
| 304 | 304 | if($charset==='') |
| 305 | 305 | { |
| 306 | - $app= $this->getApplication()->getGlobalization(); |
|
| 307 | - $charset = $app ? $app->getCharset() : null; |
|
| 306 | + $app=$this->getApplication()->getGlobalization(); |
|
| 307 | + $charset=$app ? $app->getCharset() : null; |
|
| 308 | 308 | if(!$charset) |
| 309 | - $charset = 'UTF-8'; |
|
| 309 | + $charset='UTF-8'; |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | - $length = iconv_strlen($value, $charset); |
|
| 312 | + $length=iconv_strlen($value, $charset); |
|
| 313 | 313 | if($minValue!=='') |
| 314 | - $valid = $valid && $this->isGreaterThan($length,intval($minValue)); |
|
| 314 | + $valid=$valid && $this->isGreaterThan($length, intval($minValue)); |
|
| 315 | 315 | if($maxValue!=='') |
| 316 | - $valid = $valid && $this->isLessThan($length,intval($maxValue)); |
|
| 316 | + $valid=$valid && $this->isLessThan($length, intval($maxValue)); |
|
| 317 | 317 | return $valid; |
| 318 | 318 | } |
| 319 | 319 | |
@@ -132,6 +132,7 @@ |
||
| 132 | 132 | |
| 133 | 133 | /** |
| 134 | 134 | * @param float rating value |
| 135 | + * @param double $rating |
|
| 135 | 136 | * @return int rating as integer |
| 136 | 137 | */ |
| 137 | 138 | protected function getRatingIndex($rating) |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /** |
| 218 | - * @return string rating style css class name. |
|
| 218 | + * @return string rating style css class name. |
|
| 219 | 219 | */ |
| 220 | 220 | protected function getRatingStyleCssClass() |
| 221 | 221 | { |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | /** |
| 261 | - * @return string find the client ID of the caption control. |
|
| 261 | + * @return string find the client ID of the caption control. |
|
| 262 | 262 | */ |
| 263 | 263 | protected function getCaptionControlID() |
| 264 | 264 | { |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | /** |
| 35 | 35 | * @var array list of published rating images. |
| 36 | 36 | */ |
| 37 | - private $_ratingImages = array(); |
|
| 37 | + private $_ratingImages=array(); |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * Sets the default repeat direction to horizontal. |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function getReadOnly() |
| 52 | 52 | { |
| 53 | - return $this->getViewState('ReadOnly',false); |
|
| 53 | + return $this->getViewState('ReadOnly', false); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function setReadOnly($value) |
| 60 | 60 | { |
| 61 | - $this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false); |
|
| 61 | + $this->setViewState('ReadOnly', TPropertyValue::ensureBoolean($value), false); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -106,9 +106,9 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function getRating() |
| 108 | 108 | { |
| 109 | - $rating = $this->getViewState('Rating', null); |
|
| 110 | - if ($rating === null) |
|
| 111 | - return $this->getSelectedIndex()+1; |
|
| 109 | + $rating=$this->getViewState('Rating', null); |
|
| 110 | + if($rating===null) |
|
| 111 | + return $this->getSelectedIndex() + 1; |
|
| 112 | 112 | else |
| 113 | 113 | return $rating; |
| 114 | 114 | } |
@@ -118,15 +118,15 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | public function setRating($value) |
| 120 | 120 | { |
| 121 | - $value = TPropertyValue::ensureFloat($value); |
|
| 121 | + $value=TPropertyValue::ensureFloat($value); |
|
| 122 | 122 | $this->setViewState('Rating', $value, null); |
| 123 | - $index = $this->getRatingIndex($value); |
|
| 123 | + $index=$this->getRatingIndex($value); |
|
| 124 | 124 | parent::setSelectedIndex($index); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | public function setSelectedIndex($value) |
| 128 | 128 | { |
| 129 | - $this->setRating($value+1); |
|
| 129 | + $this->setRating($value + 1); |
|
| 130 | 130 | parent::setSelectedIndex($value); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -136,10 +136,10 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | protected function getRatingIndex($rating) |
| 138 | 138 | { |
| 139 | - $interval = $this->getHalfRatingInterval(); |
|
| 140 | - $base = intval($rating)-1; |
|
| 141 | - $remainder = $rating-$base-1; |
|
| 142 | - return $remainder > $interval[1] ? $base+1 : $base; |
|
| 139 | + $interval=$this->getHalfRatingInterval(); |
|
| 140 | + $base=intval($rating) - 1; |
|
| 141 | + $remainder=$rating - $base - 1; |
|
| 142 | + return $remainder > $interval[1] ? $base + 1 : $base; |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public function onSelectedIndexChanged($param) |
| 149 | 149 | { |
| 150 | - $value = $this->getRating(); |
|
| 151 | - $value = TPropertyValue::ensureInteger($value); |
|
| 150 | + $value=$this->getRating(); |
|
| 151 | + $value=TPropertyValue::ensureInteger($value); |
|
| 152 | 152 | $this->setRating($value); |
| 153 | 153 | parent::onSelectedIndexChanged($param); |
| 154 | 154 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | return $control; |
| 180 | 180 | } |
| 181 | 181 | throw new TInvalidDataValueException( |
| 182 | - 'ratinglist_invalid_caption_id',$id,$this->getID()); |
|
| 182 | + 'ratinglist_invalid_caption_id', $id, $this->getID()); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -246,14 +246,14 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | protected function getPostBackOptions() |
| 248 | 248 | { |
| 249 | - $options = parent::getPostBackOptions(); |
|
| 250 | - $options['AutoPostBack'] = $this->getAutoPostBack(); |
|
| 251 | - $options['ReadOnly'] = $this->getReadOnly(); |
|
| 252 | - $options['Style'] = $this->getRatingStyleCssClass(); |
|
| 253 | - $options['CaptionID'] = $this->getCaptionControlID(); |
|
| 254 | - $options['SelectedIndex'] = $this->getSelectedIndex(); |
|
| 255 | - $options['Rating'] = $this->getRating(); |
|
| 256 | - $options['HalfRating'] = $this->getHalfRatingInterval(); |
|
| 249 | + $options=parent::getPostBackOptions(); |
|
| 250 | + $options['AutoPostBack']=$this->getAutoPostBack(); |
|
| 251 | + $options['ReadOnly']=$this->getReadOnly(); |
|
| 252 | + $options['Style']=$this->getRatingStyleCssClass(); |
|
| 253 | + $options['CaptionID']=$this->getCaptionControlID(); |
|
| 254 | + $options['SelectedIndex']=$this->getSelectedIndex(); |
|
| 255 | + $options['Rating']=$this->getRating(); |
|
| 256 | + $options['HalfRating']=$this->getHalfRatingInterval(); |
|
| 257 | 257 | return $options; |
| 258 | 258 | } |
| 259 | 259 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | { |
| 283 | 283 | parent::onPreRender($param); |
| 284 | 284 | $this->publishStyle($this->getRatingStyle()); |
| 285 | - $this->_ratingImages = $this->publishImages($this->getRatingStyle()); |
|
| 285 | + $this->_ratingImages=$this->publishImages($this->getRatingStyle()); |
|
| 286 | 286 | $this->registerClientScript(); |
| 287 | 287 | } |
| 288 | 288 | |
@@ -292,8 +292,8 @@ discard block |
||
| 292 | 292 | */ |
| 293 | 293 | protected function publishStyle($style) |
| 294 | 294 | { |
| 295 | - $cs = $this->getPage()->getClientScript(); |
|
| 296 | - $url = $this->getAssetUrl($style.'.css'); |
|
| 295 | + $cs=$this->getPage()->getClientScript(); |
|
| 296 | + $url=$this->getAssetUrl($style.'.css'); |
|
| 297 | 297 | if(!$cs->isStyleSheetFileRegistered($url)) |
| 298 | 298 | $cs->registerStyleSheetFile($url, $url); |
| 299 | 299 | return $url; |
@@ -306,10 +306,10 @@ discard block |
||
| 306 | 306 | */ |
| 307 | 307 | protected function publishImages($style, $fileExt='.gif') |
| 308 | 308 | { |
| 309 | - $types = array('blank', 'selected', 'half', 'combined'); |
|
| 310 | - $files = array(); |
|
| 309 | + $types=array('blank', 'selected', 'half', 'combined'); |
|
| 310 | + $files=array(); |
|
| 311 | 311 | foreach($types as $type) |
| 312 | - $files[$type] = $this->getAssetUrl("{$style}_{$type}{$fileExt}"); |
|
| 312 | + $files[$type]=$this->getAssetUrl("{$style}_{$type}{$fileExt}"); |
|
| 313 | 313 | return $files; |
| 314 | 314 | } |
| 315 | 315 | |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | protected function getAssetUrl($file='') |
| 330 | 330 | { |
| 331 | - $base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
|
| 331 | + $base=$this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
|
| 332 | 332 | return $base.'/'.self::SCRIPT_PATH.'/'.$file; |
| 333 | 333 | } |
| 334 | 334 | |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | */ |
| 341 | 341 | public function render($writer) |
| 342 | 342 | { |
| 343 | - $writer->addAttribute('id',$this->getClientID()); |
|
| 343 | + $writer->addAttribute('id', $this->getClientID()); |
|
| 344 | 344 | $this->getPage()->getClientScript()->registerPostBackControl( |
| 345 | 345 | $this->getClientClassName(), $this->getPostBackOptions()); |
| 346 | 346 | parent::render($writer); |
@@ -158,8 +158,7 @@ |
||
| 158 | 158 | $e->setAttribute('maxOccurs','unbounded'); |
| 159 | 159 | $sequence->appendChild($e); |
| 160 | 160 | $complexType->appendChild($sequence); |
| 161 | - } |
|
| 162 | - else |
|
| 161 | + } else |
|
| 163 | 162 | { |
| 164 | 163 | $all = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:all'); |
| 165 | 164 | foreach($elements as $elem) |
@@ -464,6 +464,7 @@ discard block |
||
| 464 | 464 | * This method invokes {@link createItem} to create a new repeater item. |
| 465 | 465 | * @param integer zero-based item index. |
| 466 | 466 | * @param TListItemType item type |
| 467 | + * @param integer $itemIndex |
|
| 467 | 468 | * @return TControl the created item, null if item is not created |
| 468 | 469 | */ |
| 469 | 470 | private function createItemInternal($itemIndex,$itemType) |
@@ -485,6 +486,7 @@ discard block |
||
| 485 | 486 | * @param integer zero-based item index. |
| 486 | 487 | * @param TListItemType item type |
| 487 | 488 | * @param mixed data to be associated with the item |
| 489 | + * @param integer $itemIndex |
|
| 488 | 490 | * @return TControl the created item, null if item is not created |
| 489 | 491 | */ |
| 490 | 492 | private function createItemWithDataInternal($itemIndex,$itemType,$dataItem) |
@@ -718,6 +720,7 @@ discard block |
||
| 718 | 720 | * If you override this method, be sure to call parent's implementation |
| 719 | 721 | * so that event handlers have chance to respond to the event. |
| 720 | 722 | * @param TRepeaterItemEventParameter event parameter |
| 723 | + * @param TRepeaterItemEventParameter $param |
|
| 721 | 724 | */ |
| 722 | 725 | public function onItemCreated($param) |
| 723 | 726 | { |
@@ -732,6 +735,7 @@ discard block |
||
| 732 | 735 | * If you override this method, be sure to call parent's implementation |
| 733 | 736 | * so that event handlers have chance to respond to the event. |
| 734 | 737 | * @param TRepeaterItemEventParameter event parameter |
| 738 | + * @param TRepeaterItemEventParameter $param |
|
| 735 | 739 | */ |
| 736 | 740 | public function onItemDataBound($param) |
| 737 | 741 | { |
@@ -751,6 +755,7 @@ discard block |
||
| 751 | 755 | * Be sure to call parent's implementation so that |
| 752 | 756 | * event handlers have chance to respond to the event. |
| 753 | 757 | * @param TRepeaterCommandEventParameter event parameter |
| 758 | + * @param TRepeaterCommandEventParameter $param |
|
| 754 | 759 | */ |
| 755 | 760 | public function onItemCommand($param) |
| 756 | 761 | { |
@@ -765,6 +770,7 @@ discard block |
||
| 765 | 770 | * Otherwise, an exception will be raised. |
| 766 | 771 | * @param mixed data item |
| 767 | 772 | * @param mixed field name |
| 773 | + * @param string $field |
|
| 768 | 774 | * @return mixed data value at the specified field |
| 769 | 775 | * @throws TInvalidDataValueException if the data is invalid |
| 770 | 776 | */ |
@@ -796,6 +802,7 @@ discard block |
||
| 796 | 802 | /** |
| 797 | 803 | * Constructor. |
| 798 | 804 | * @param TControl repeater item related with the corresponding event |
| 805 | + * @param TControl $item |
|
| 799 | 806 | */ |
| 800 | 807 | public function __construct($item) |
| 801 | 808 | { |
@@ -474,8 +474,7 @@ discard block |
||
| 474 | 474 | $this->onItemCreated($param); |
| 475 | 475 | $this->getControls()->add($item); |
| 476 | 476 | return $item; |
| 477 | - } |
|
| 478 | - else |
|
| 477 | + } else |
|
| 479 | 478 | return null; |
| 480 | 479 | } |
| 481 | 480 | |
@@ -499,8 +498,7 @@ discard block |
||
| 499 | 498 | $item->dataBind(); |
| 500 | 499 | $this->onItemDataBound($param); |
| 501 | 500 | return $item; |
| 502 | - } |
|
| 503 | - else |
|
| 501 | + } else |
|
| 504 | 502 | return null; |
| 505 | 503 | } |
| 506 | 504 | |
@@ -550,15 +548,13 @@ discard block |
||
| 550 | 548 | $item->setItemIndex($itemIndex); |
| 551 | 549 | $item->setItemType($itemType); |
| 552 | 550 | } |
| 553 | - } |
|
| 554 | - else if($template!==null) |
|
| 551 | + } else if($template!==null) |
|
| 555 | 552 | { |
| 556 | 553 | $item=new TRepeaterItem; |
| 557 | 554 | $item->setItemIndex($itemIndex); |
| 558 | 555 | $item->setItemType($itemType); |
| 559 | 556 | $template->instantiateIn($item); |
| 560 | - } |
|
| 561 | - else |
|
| 557 | + } else |
|
| 562 | 558 | $item=null; |
| 563 | 559 | |
| 564 | 560 | return $item; |
@@ -642,8 +638,7 @@ discard block |
||
| 642 | 638 | $items->add($this->createItemInternal($i,$itemType,false,null)); |
| 643 | 639 | } |
| 644 | 640 | $this->_footer=$this->createItemInternal(-1,TListItemType::Footer); |
| 645 | - } |
|
| 646 | - else |
|
| 641 | + } else |
|
| 647 | 642 | $this->createEmptyContent(); |
| 648 | 643 | $this->clearChildState(); |
| 649 | 644 | } |
@@ -704,8 +699,7 @@ discard block |
||
| 704 | 699 | { |
| 705 | 700 | $this->onItemCommand($param); |
| 706 | 701 | return true; |
| 707 | - } |
|
| 708 | - else |
|
| 702 | + } else |
|
| 709 | 703 | return false; |
| 710 | 704 | } |
| 711 | 705 | |
@@ -983,8 +977,7 @@ discard block |
||
| 983 | 977 | { |
| 984 | 978 | $this->raiseBubbleEvent($this,new TRepeaterCommandEventParameter($this,$sender,$param)); |
| 985 | 979 | return true; |
| 986 | - } |
|
| 987 | - else |
|
| 980 | + } else |
|
| 988 | 981 | return false; |
| 989 | 982 | } |
| 990 | 983 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | public function getItemRenderer() |
| 147 | 147 | { |
| 148 | - return $this->getViewState('ItemRenderer',''); |
|
| 148 | + return $this->getViewState('ItemRenderer', ''); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function setItemRenderer($value) |
| 162 | 162 | { |
| 163 | - $this->setViewState('ItemRenderer',$value,''); |
|
| 163 | + $this->setViewState('ItemRenderer', $value, ''); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | public function getAlternatingItemRenderer() |
| 171 | 171 | { |
| 172 | - return $this->getViewState('AlternatingItemRenderer',''); |
|
| 172 | + return $this->getViewState('AlternatingItemRenderer', ''); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | public function setAlternatingItemRenderer($value) |
| 186 | 186 | { |
| 187 | - $this->setViewState('AlternatingItemRenderer',$value,''); |
|
| 187 | + $this->setViewState('AlternatingItemRenderer', $value, ''); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | public function getSeparatorRenderer() |
| 195 | 195 | { |
| 196 | - return $this->getViewState('SeparatorRenderer',''); |
|
| 196 | + return $this->getViewState('SeparatorRenderer', ''); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /** |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | public function setSeparatorRenderer($value) |
| 210 | 210 | { |
| 211 | - $this->setViewState('SeparatorRenderer',$value,''); |
|
| 211 | + $this->setViewState('SeparatorRenderer', $value, ''); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | public function getHeaderRenderer() |
| 219 | 219 | { |
| 220 | - return $this->getViewState('HeaderRenderer',''); |
|
| 220 | + return $this->getViewState('HeaderRenderer', ''); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | /** |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | public function setHeaderRenderer($value) |
| 234 | 234 | { |
| 235 | - $this->setViewState('HeaderRenderer',$value,''); |
|
| 235 | + $this->setViewState('HeaderRenderer', $value, ''); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | /** |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | */ |
| 242 | 242 | public function getFooterRenderer() |
| 243 | 243 | { |
| 244 | - return $this->getViewState('FooterRenderer',''); |
|
| 244 | + return $this->getViewState('FooterRenderer', ''); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /** |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | public function setFooterRenderer($value) |
| 258 | 258 | { |
| 259 | - $this->setViewState('FooterRenderer',$value,''); |
|
| 259 | + $this->setViewState('FooterRenderer', $value, ''); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /** |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | */ |
| 266 | 266 | public function getEmptyRenderer() |
| 267 | 267 | { |
| 268 | - return $this->getViewState('EmptyRenderer',''); |
|
| 268 | + return $this->getViewState('EmptyRenderer', ''); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | */ |
| 282 | 282 | public function setEmptyRenderer($value) |
| 283 | 283 | { |
| 284 | - $this->setViewState('EmptyRenderer',$value,''); |
|
| 284 | + $this->setViewState('EmptyRenderer', $value, ''); |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | /** |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | if($value instanceof ITemplate || $value===null) |
| 302 | 302 | $this->_itemTemplate=$value; |
| 303 | 303 | else |
| 304 | - throw new TInvalidDataTypeException('repeater_template_required','ItemTemplate'); |
|
| 304 | + throw new TInvalidDataTypeException('repeater_template_required', 'ItemTemplate'); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | /** |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | if($value instanceof ITemplate || $value===null) |
| 322 | 322 | $this->_alternatingItemTemplate=$value; |
| 323 | 323 | else |
| 324 | - throw new TInvalidDataTypeException('repeater_template_required','AlternatingItemTemplate'); |
|
| 324 | + throw new TInvalidDataTypeException('repeater_template_required', 'AlternatingItemTemplate'); |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | /** |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | if($value instanceof ITemplate || $value===null) |
| 342 | 342 | $this->_headerTemplate=$value; |
| 343 | 343 | else |
| 344 | - throw new TInvalidDataTypeException('repeater_template_required','HeaderTemplate'); |
|
| 344 | + throw new TInvalidDataTypeException('repeater_template_required', 'HeaderTemplate'); |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | /** |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | if($value instanceof ITemplate || $value===null) |
| 362 | 362 | $this->_footerTemplate=$value; |
| 363 | 363 | else |
| 364 | - throw new TInvalidDataTypeException('repeater_template_required','FooterTemplate'); |
|
| 364 | + throw new TInvalidDataTypeException('repeater_template_required', 'FooterTemplate'); |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | /** |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | if($value instanceof ITemplate || $value===null) |
| 382 | 382 | $this->_emptyTemplate=$value; |
| 383 | 383 | else |
| 384 | - throw new TInvalidDataTypeException('repeater_template_required','EmptyTemplate'); |
|
| 384 | + throw new TInvalidDataTypeException('repeater_template_required', 'EmptyTemplate'); |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | /** |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | if($value instanceof ITemplate || $value===null) |
| 402 | 402 | $this->_separatorTemplate=$value; |
| 403 | 403 | else |
| 404 | - throw new TInvalidDataTypeException('repeater_template_required','SeparatorTemplate'); |
|
| 404 | + throw new TInvalidDataTypeException('repeater_template_required', 'SeparatorTemplate'); |
|
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | /** |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | */ |
| 436 | 436 | public function getDataKeyField() |
| 437 | 437 | { |
| 438 | - return $this->getViewState('DataKeyField',''); |
|
| 438 | + return $this->getViewState('DataKeyField', ''); |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | /** |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | */ |
| 444 | 444 | public function setDataKeyField($value) |
| 445 | 445 | { |
| 446 | - $this->setViewState('DataKeyField',$value,''); |
|
| 446 | + $this->setViewState('DataKeyField', $value, ''); |
|
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | /** |
@@ -451,10 +451,10 @@ discard block |
||
| 451 | 451 | */ |
| 452 | 452 | public function getDataKeys() |
| 453 | 453 | { |
| 454 | - if(($dataKeys=$this->getViewState('DataKeys',null))===null) |
|
| 454 | + if(($dataKeys=$this->getViewState('DataKeys', null))===null) |
|
| 455 | 455 | { |
| 456 | 456 | $dataKeys=new TList; |
| 457 | - $this->setViewState('DataKeys',$dataKeys,null); |
|
| 457 | + $this->setViewState('DataKeys', $dataKeys, null); |
|
| 458 | 458 | } |
| 459 | 459 | return $dataKeys; |
| 460 | 460 | } |
@@ -466,9 +466,9 @@ discard block |
||
| 466 | 466 | * @param TListItemType item type |
| 467 | 467 | * @return TControl the created item, null if item is not created |
| 468 | 468 | */ |
| 469 | - private function createItemInternal($itemIndex,$itemType) |
|
| 469 | + private function createItemInternal($itemIndex, $itemType) |
|
| 470 | 470 | { |
| 471 | - if(($item=$this->createItem($itemIndex,$itemType))!==null) |
|
| 471 | + if(($item=$this->createItem($itemIndex, $itemType))!==null) |
|
| 472 | 472 | { |
| 473 | 473 | $param=new TRepeaterItemEventParameter($item); |
| 474 | 474 | $this->onItemCreated($param); |
@@ -487,9 +487,9 @@ discard block |
||
| 487 | 487 | * @param mixed data to be associated with the item |
| 488 | 488 | * @return TControl the created item, null if item is not created |
| 489 | 489 | */ |
| 490 | - private function createItemWithDataInternal($itemIndex,$itemType,$dataItem) |
|
| 490 | + private function createItemWithDataInternal($itemIndex, $itemType, $dataItem) |
|
| 491 | 491 | { |
| 492 | - if(($item=$this->createItem($itemIndex,$itemType))!==null) |
|
| 492 | + if(($item=$this->createItem($itemIndex, $itemType))!==null) |
|
| 493 | 493 | { |
| 494 | 494 | $param=new TRepeaterItemEventParameter($item); |
| 495 | 495 | if($item instanceof IDataRenderer) |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | * @param TListItemType item type |
| 511 | 511 | * @return TControl created repeater item |
| 512 | 512 | */ |
| 513 | - protected function createItem($itemIndex,$itemType) |
|
| 513 | + protected function createItem($itemIndex, $itemType) |
|
| 514 | 514 | { |
| 515 | 515 | $template=null; |
| 516 | 516 | $classPath=null; |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | $template=$this->_separatorTemplate; |
| 541 | 541 | break; |
| 542 | 542 | default: |
| 543 | - throw new TInvalidDataValueException('repeater_itemtype_unknown',$itemType); |
|
| 543 | + throw new TInvalidDataValueException('repeater_itemtype_unknown', $itemType); |
|
| 544 | 544 | } |
| 545 | 545 | if($classPath!=='') |
| 546 | 546 | { |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | { |
| 596 | 596 | parent::saveState(); |
| 597 | 597 | if($this->_items) |
| 598 | - $this->setViewState('ItemCount',$this->_items->getCount(),0); |
|
| 598 | + $this->setViewState('ItemCount', $this->_items->getCount(), 0); |
|
| 599 | 599 | else |
| 600 | 600 | $this->clearViewState('ItemCount'); |
| 601 | 601 | } |
@@ -629,19 +629,19 @@ discard block |
||
| 629 | 629 | protected function restoreItemsFromViewState() |
| 630 | 630 | { |
| 631 | 631 | $this->reset(); |
| 632 | - if(($itemCount=$this->getViewState('ItemCount',0))>0) |
|
| 632 | + if(($itemCount=$this->getViewState('ItemCount', 0)) > 0) |
|
| 633 | 633 | { |
| 634 | 634 | $items=$this->getItems(); |
| 635 | 635 | $hasSeparator=$this->_separatorTemplate!==null || $this->getSeparatorRenderer()!==''; |
| 636 | - $this->_header=$this->createItemInternal(-1,TListItemType::Header); |
|
| 637 | - for($i=0;$i<$itemCount;++$i) |
|
| 636 | + $this->_header=$this->createItemInternal(-1, TListItemType::Header); |
|
| 637 | + for($i=0; $i < $itemCount; ++$i) |
|
| 638 | 638 | { |
| 639 | - if($hasSeparator && $i>0) |
|
| 640 | - $this->createItemInternal($i-1,TListItemType::Separator); |
|
| 641 | - $itemType=$i%2==0?TListItemType::Item : TListItemType::AlternatingItem; |
|
| 642 | - $items->add($this->createItemInternal($i,$itemType,false,null)); |
|
| 639 | + if($hasSeparator && $i > 0) |
|
| 640 | + $this->createItemInternal($i - 1, TListItemType::Separator); |
|
| 641 | + $itemType=$i % 2==0 ? TListItemType::Item : TListItemType::AlternatingItem; |
|
| 642 | + $items->add($this->createItemInternal($i, $itemType, false, null)); |
|
| 643 | 643 | } |
| 644 | - $this->_footer=$this->createItemInternal(-1,TListItemType::Footer); |
|
| 644 | + $this->_footer=$this->createItemInternal(-1, TListItemType::Footer); |
|
| 645 | 645 | } |
| 646 | 646 | else |
| 647 | 647 | $this->createEmptyContent(); |
@@ -668,25 +668,25 @@ discard block |
||
| 668 | 668 | foreach($data as $key=>$dataItem) |
| 669 | 669 | { |
| 670 | 670 | if($keyField!=='') |
| 671 | - $keys->add($this->getDataFieldValue($dataItem,$keyField)); |
|
| 671 | + $keys->add($this->getDataFieldValue($dataItem, $keyField)); |
|
| 672 | 672 | else |
| 673 | 673 | $keys->add($key); |
| 674 | 674 | if($itemIndex===0) |
| 675 | - $this->_header=$this->createItemWithDataInternal(-1,TListItemType::Header,null); |
|
| 676 | - if($hasSeparator && $itemIndex>0) |
|
| 677 | - $this->createItemWithDataInternal($itemIndex-1,TListItemType::Separator,null); |
|
| 678 | - $itemType=$itemIndex%2==0?TListItemType::Item : TListItemType::AlternatingItem; |
|
| 679 | - $items->add($this->createItemWithDataInternal($itemIndex,$itemType,$dataItem)); |
|
| 675 | + $this->_header=$this->createItemWithDataInternal(-1, TListItemType::Header, null); |
|
| 676 | + if($hasSeparator && $itemIndex > 0) |
|
| 677 | + $this->createItemWithDataInternal($itemIndex - 1, TListItemType::Separator, null); |
|
| 678 | + $itemType=$itemIndex % 2==0 ? TListItemType::Item : TListItemType::AlternatingItem; |
|
| 679 | + $items->add($this->createItemWithDataInternal($itemIndex, $itemType, $dataItem)); |
|
| 680 | 680 | $itemIndex++; |
| 681 | 681 | } |
| 682 | - if($itemIndex>0) |
|
| 683 | - $this->_footer=$this->createItemWithDataInternal(-1,TListItemType::Footer,null); |
|
| 682 | + if($itemIndex > 0) |
|
| 683 | + $this->_footer=$this->createItemWithDataInternal(-1, TListItemType::Footer, null); |
|
| 684 | 684 | else |
| 685 | 685 | { |
| 686 | 686 | $this->createEmptyContent(); |
| 687 | 687 | $this->dataBindChildren(); |
| 688 | 688 | } |
| 689 | - $this->setViewState('ItemCount',$itemIndex,0); |
|
| 689 | + $this->setViewState('ItemCount', $itemIndex, 0); |
|
| 690 | 690 | } |
| 691 | 691 | |
| 692 | 692 | /** |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | * @param TEventParameter event parameter |
| 699 | 699 | * @return boolean whether the event bubbling should stop here. |
| 700 | 700 | */ |
| 701 | - public function bubbleEvent($sender,$param) |
|
| 701 | + public function bubbleEvent($sender, $param) |
|
| 702 | 702 | { |
| 703 | 703 | if($param instanceof TRepeaterCommandEventParameter) |
| 704 | 704 | { |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | */ |
| 722 | 722 | public function onItemCreated($param) |
| 723 | 723 | { |
| 724 | - $this->raiseEvent('OnItemCreated',$this,$param); |
|
| 724 | + $this->raiseEvent('OnItemCreated', $this, $param); |
|
| 725 | 725 | } |
| 726 | 726 | |
| 727 | 727 | /** |
@@ -735,7 +735,7 @@ discard block |
||
| 735 | 735 | */ |
| 736 | 736 | public function onItemDataBound($param) |
| 737 | 737 | { |
| 738 | - $this->raiseEvent('OnItemDataBound',$this,$param); |
|
| 738 | + $this->raiseEvent('OnItemDataBound', $this, $param); |
|
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | /** |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | */ |
| 755 | 755 | public function onItemCommand($param) |
| 756 | 756 | { |
| 757 | - $this->raiseEvent('OnItemCommand',$this,$param); |
|
| 757 | + $this->raiseEvent('OnItemCommand', $this, $param); |
|
| 758 | 758 | } |
| 759 | 759 | |
| 760 | 760 | /** |
@@ -768,9 +768,9 @@ discard block |
||
| 768 | 768 | * @return mixed data value at the specified field |
| 769 | 769 | * @throws TInvalidDataValueException if the data is invalid |
| 770 | 770 | */ |
| 771 | - protected function getDataFieldValue($data,$field) |
|
| 771 | + protected function getDataFieldValue($data, $field) |
|
| 772 | 772 | { |
| 773 | - return TDataFieldAccessor::getDataFieldValue($data,$field); |
|
| 773 | + return TDataFieldAccessor::getDataFieldValue($data, $field); |
|
| 774 | 774 | } |
| 775 | 775 | } |
| 776 | 776 | |
@@ -842,11 +842,11 @@ discard block |
||
| 842 | 842 | * @param TControl original event sender |
| 843 | 843 | * @param TCommandEventParameter original event parameter |
| 844 | 844 | */ |
| 845 | - public function __construct($item,$source,TCommandEventParameter $param) |
|
| 845 | + public function __construct($item, $source, TCommandEventParameter $param) |
|
| 846 | 846 | { |
| 847 | 847 | $this->_item=$item; |
| 848 | 848 | $this->_source=$source; |
| 849 | - parent::__construct($param->getCommandName(),$param->getCommandParameter()); |
|
| 849 | + parent::__construct($param->getCommandName(), $param->getCommandParameter()); |
|
| 850 | 850 | } |
| 851 | 851 | |
| 852 | 852 | /** |
@@ -909,7 +909,7 @@ discard block |
||
| 909 | 909 | */ |
| 910 | 910 | public function setItemType($value) |
| 911 | 911 | { |
| 912 | - $this->_itemType=TPropertyValue::ensureEnum($value,'TListItemType'); |
|
| 912 | + $this->_itemType=TPropertyValue::ensureEnum($value, 'TListItemType'); |
|
| 913 | 913 | } |
| 914 | 914 | |
| 915 | 915 | /** |
@@ -977,11 +977,11 @@ discard block |
||
| 977 | 977 | * @param TEventParameter event parameter |
| 978 | 978 | * @return boolean whether the event bubbling should stop here. |
| 979 | 979 | */ |
| 980 | - public function bubbleEvent($sender,$param) |
|
| 980 | + public function bubbleEvent($sender, $param) |
|
| 981 | 981 | { |
| 982 | 982 | if($param instanceof TCommandEventParameter) |
| 983 | 983 | { |
| 984 | - $this->raiseBubbleEvent($this,new TRepeaterCommandEventParameter($this,$sender,$param)); |
|
| 984 | + $this->raiseBubbleEvent($this, new TRepeaterCommandEventParameter($this, $sender, $param)); |
|
| 985 | 985 | return true; |
| 986 | 986 | } |
| 987 | 987 | else |
@@ -1008,10 +1008,10 @@ discard block |
||
| 1008 | 1008 | * @param TControl new item |
| 1009 | 1009 | * @throws TInvalidDataTypeException if the item to be inserted is not a control. |
| 1010 | 1010 | */ |
| 1011 | - public function insertAt($index,$item) |
|
| 1011 | + public function insertAt($index, $item) |
|
| 1012 | 1012 | { |
| 1013 | 1013 | if($item instanceof TControl) |
| 1014 | - parent::insertAt($index,$item); |
|
| 1014 | + parent::insertAt($index, $item); |
|
| 1015 | 1015 | else |
| 1016 | 1016 | throw new TInvalidDataTypeException('repeateritemcollection_item_invalid'); |
| 1017 | 1017 | } |