@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | if($this->getCausesValidation()) |
| 63 | 63 | $this->getPage()->validate($this->getValidationGroup()); |
| 64 | - $this->onClick(new TBulletedListEventParameter((int)$param)); |
|
| 64 | + $this->onClick(new TBulletedListEventParameter((int) $param)); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -102,45 +102,45 @@ discard block |
||
| 102 | 102 | switch($this->getBulletStyle()) |
| 103 | 103 | { |
| 104 | 104 | case TBulletStyle::None: |
| 105 | - $writer->addStyleAttribute('list-style-type','none'); |
|
| 105 | + $writer->addStyleAttribute('list-style-type', 'none'); |
|
| 106 | 106 | $needStart=true; |
| 107 | 107 | break; |
| 108 | 108 | case TBulletStyle::Numbered: |
| 109 | - $writer->addStyleAttribute('list-style-type','decimal'); |
|
| 109 | + $writer->addStyleAttribute('list-style-type', 'decimal'); |
|
| 110 | 110 | $needStart=true; |
| 111 | 111 | break; |
| 112 | 112 | case TBulletStyle::LowerAlpha: |
| 113 | - $writer->addStyleAttribute('list-style-type','lower-alpha'); |
|
| 113 | + $writer->addStyleAttribute('list-style-type', 'lower-alpha'); |
|
| 114 | 114 | $needStart=true; |
| 115 | 115 | break; |
| 116 | 116 | case TBulletStyle::UpperAlpha: |
| 117 | - $writer->addStyleAttribute('list-style-type','upper-alpha'); |
|
| 117 | + $writer->addStyleAttribute('list-style-type', 'upper-alpha'); |
|
| 118 | 118 | $needStart=true; |
| 119 | 119 | break; |
| 120 | 120 | case TBulletStyle::LowerRoman: |
| 121 | - $writer->addStyleAttribute('list-style-type','lower-roman'); |
|
| 121 | + $writer->addStyleAttribute('list-style-type', 'lower-roman'); |
|
| 122 | 122 | $needStart=true; |
| 123 | 123 | break; |
| 124 | 124 | case TBulletStyle::UpperRoman: |
| 125 | - $writer->addStyleAttribute('list-style-type','upper-roman'); |
|
| 125 | + $writer->addStyleAttribute('list-style-type', 'upper-roman'); |
|
| 126 | 126 | $needStart=true; |
| 127 | 127 | break; |
| 128 | 128 | case TBulletStyle::Disc: |
| 129 | - $writer->addStyleAttribute('list-style-type','disc'); |
|
| 129 | + $writer->addStyleAttribute('list-style-type', 'disc'); |
|
| 130 | 130 | break; |
| 131 | 131 | case TBulletStyle::Circle: |
| 132 | - $writer->addStyleAttribute('list-style-type','circle'); |
|
| 132 | + $writer->addStyleAttribute('list-style-type', 'circle'); |
|
| 133 | 133 | break; |
| 134 | 134 | case TBulletStyle::Square: |
| 135 | - $writer->addStyleAttribute('list-style-type','square'); |
|
| 135 | + $writer->addStyleAttribute('list-style-type', 'square'); |
|
| 136 | 136 | break; |
| 137 | 137 | case TBulletStyle::CustomImage: |
| 138 | 138 | $url=$this->getBulletImageUrl(); |
| 139 | - $writer->addStyleAttribute('list-style-image',"url($url)"); |
|
| 139 | + $writer->addStyleAttribute('list-style-image', "url($url)"); |
|
| 140 | 140 | break; |
| 141 | 141 | } |
| 142 | 142 | if($needStart && ($start=$this->getFirstBulletNumber())!=1) |
| 143 | - $writer->addAttribute('start',"$start"); |
|
| 143 | + $writer->addAttribute('start', "$start"); |
|
| 144 | 144 | parent::addAttributesToRender($writer); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function getBulletImageUrl() |
| 151 | 151 | { |
| 152 | - return $this->getViewState('BulletImageUrl',''); |
|
| 152 | + return $this->getViewState('BulletImageUrl', ''); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function setBulletImageUrl($value) |
| 159 | 159 | { |
| 160 | - $this->setViewState('BulletImageUrl',$value,''); |
|
| 160 | + $this->setViewState('BulletImageUrl', $value, ''); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public function getBulletStyle() |
| 167 | 167 | { |
| 168 | - return $this->getViewState('BulletStyle',TBulletStyle::NotSet); |
|
| 168 | + return $this->getViewState('BulletStyle', TBulletStyle::NotSet); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | public function setBulletStyle($value) |
| 175 | 175 | { |
| 176 | - $this->setViewState('BulletStyle',TPropertyValue::ensureEnum($value,'TBulletStyle'),TBulletStyle::NotSet); |
|
| 176 | + $this->setViewState('BulletStyle', TPropertyValue::ensureEnum($value, 'TBulletStyle'), TBulletStyle::NotSet); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | public function getDisplayMode() |
| 183 | 183 | { |
| 184 | - return $this->getViewState('DisplayMode',TBulletedListDisplayMode::Text); |
|
| 184 | + return $this->getViewState('DisplayMode', TBulletedListDisplayMode::Text); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | /** |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function setDisplayMode($value) |
| 191 | 191 | { |
| 192 | - $this->setViewState('DisplayMode',TPropertyValue::ensureEnum($value,'TBulletedListDisplayMode'),TBulletedListDisplayMode::Text); |
|
| 192 | + $this->setViewState('DisplayMode', TPropertyValue::ensureEnum($value, 'TBulletedListDisplayMode'), TBulletedListDisplayMode::Text); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | public function getFirstBulletNumber() |
| 201 | 201 | { |
| 202 | - return $this->getViewState('FirstBulletNumber',1); |
|
| 202 | + return $this->getViewState('FirstBulletNumber', 1); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | public function setFirstBulletNumber($value) |
| 210 | 210 | { |
| 211 | - $this->setViewState('FirstBulletNumber',TPropertyValue::ensureInteger($value),1); |
|
| 211 | + $this->setViewState('FirstBulletNumber', TPropertyValue::ensureInteger($value), 1); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | */ |
| 220 | 220 | public function onClick($param) |
| 221 | 221 | { |
| 222 | - $this->raiseEvent('OnClick',$this,$param); |
|
| 222 | + $this->raiseEvent('OnClick', $this, $param); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | /** |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | public function getTarget() |
| 231 | 231 | { |
| 232 | - return $this->getViewState('Target',''); |
|
| 232 | + return $this->getViewState('Target', ''); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | /** |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | public function setTarget($value) |
| 241 | 241 | { |
| 242 | - $this->setViewState('Target',$value,''); |
|
| 242 | + $this->setViewState('Target', $value, ''); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | if($item->getHasAttributes()) |
| 267 | 267 | $writer->addAttributes($item->getAttributes()); |
| 268 | 268 | $writer->renderBeginTag('li'); |
| 269 | - $this->renderBulletText($writer,$item,$index); |
|
| 269 | + $this->renderBulletText($writer, $item, $index); |
|
| 270 | 270 | $writer->renderEndTag(); |
| 271 | 271 | $writer->writeLine(); |
| 272 | 272 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * @param TListItem item to be rendered |
| 279 | 279 | * @param integer index of the item being rendered |
| 280 | 280 | */ |
| 281 | - protected function renderBulletText($writer,$item,$index) |
|
| 281 | + protected function renderBulletText($writer, $item, $index) |
|
| 282 | 282 | { |
| 283 | 283 | switch($this->getDisplayMode()) |
| 284 | 284 | { |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | $writer->write(THttpUtility::htmlEncode($item->getText())); |
| 301 | 301 | else |
| 302 | 302 | { |
| 303 | - $writer->addAttribute('disabled','disabled'); |
|
| 303 | + $writer->addAttribute('disabled', 'disabled'); |
|
| 304 | 304 | $writer->renderBeginTag('span'); |
| 305 | 305 | $writer->write(THttpUtility::htmlEncode($item->getText())); |
| 306 | 306 | $writer->renderEndTag(); |
@@ -310,15 +310,15 @@ discard block |
||
| 310 | 310 | protected function renderHyperLinkItem($writer, $item, $index) |
| 311 | 311 | { |
| 312 | 312 | if(!$this->_isEnabled || !$item->getEnabled()) |
| 313 | - $writer->addAttribute('disabled','disabled'); |
|
| 313 | + $writer->addAttribute('disabled', 'disabled'); |
|
| 314 | 314 | else |
| 315 | 315 | { |
| 316 | - $writer->addAttribute('href',$item->getValue()); |
|
| 316 | + $writer->addAttribute('href', $item->getValue()); |
|
| 317 | 317 | if(($target=$this->getTarget())!=='') |
| 318 | - $writer->addAttribute('target',$target); |
|
| 318 | + $writer->addAttribute('target', $target); |
|
| 319 | 319 | } |
| 320 | 320 | if(($accesskey=$this->getAccessKey())!=='') |
| 321 | - $writer->addAttribute('accesskey',$accesskey); |
|
| 321 | + $writer->addAttribute('accesskey', $accesskey); |
|
| 322 | 322 | $writer->renderBeginTag('a'); |
| 323 | 323 | $writer->write(THttpUtility::htmlEncode($item->getText())); |
| 324 | 324 | $writer->renderEndTag(); |
@@ -327,17 +327,17 @@ discard block |
||
| 327 | 327 | protected function renderLinkButtonItem($writer, $item, $index) |
| 328 | 328 | { |
| 329 | 329 | if(!$this->_isEnabled || !$item->getEnabled()) |
| 330 | - $writer->addAttribute('disabled','disabled'); |
|
| 330 | + $writer->addAttribute('disabled', 'disabled'); |
|
| 331 | 331 | else |
| 332 | 332 | { |
| 333 | - $this->_currentRenderItemIndex = $index; |
|
| 333 | + $this->_currentRenderItemIndex=$index; |
|
| 334 | 334 | $writer->addAttribute('id', $this->getClientID().$index); |
| 335 | 335 | $writer->addAttribute('href', "javascript:;//".$this->getClientID().$index); |
| 336 | - $cs = $this->getPage()->getClientScript(); |
|
| 337 | - $cs->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions()); |
|
| 336 | + $cs=$this->getPage()->getClientScript(); |
|
| 337 | + $cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
|
| 338 | 338 | } |
| 339 | 339 | if(($accesskey=$this->getAccessKey())!=='') |
| 340 | - $writer->addAttribute('accesskey',$accesskey); |
|
| 340 | + $writer->addAttribute('accesskey', $accesskey); |
|
| 341 | 341 | $writer->renderBeginTag('a'); |
| 342 | 342 | $writer->write(THttpUtility::htmlEncode($item->getText())); |
| 343 | 343 | $writer->renderEndTag(); |
@@ -348,19 +348,19 @@ discard block |
||
| 348 | 348 | */ |
| 349 | 349 | protected function getPostBackOptions() |
| 350 | 350 | { |
| 351 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
| 352 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
| 353 | - $options['EventTarget'] = $this->getUniqueID(); |
|
| 354 | - $options['EventParameter'] = $this->_currentRenderItemIndex; |
|
| 355 | - $options['ID'] = $this->getClientID().$this->_currentRenderItemIndex; |
|
| 356 | - $options['StopEvent'] = true; |
|
| 351 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
| 352 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
| 353 | + $options['EventTarget']=$this->getUniqueID(); |
|
| 354 | + $options['EventParameter']=$this->_currentRenderItemIndex; |
|
| 355 | + $options['ID']=$this->getClientID().$this->_currentRenderItemIndex; |
|
| 356 | + $options['StopEvent']=true; |
|
| 357 | 357 | return $options; |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | protected function canCauseValidation() |
| 361 | 361 | { |
| 362 | - $group = $this->getValidationGroup(); |
|
| 363 | - $hasValidators = $this->getPage()->getValidators($group)->getCount()>0; |
|
| 362 | + $group=$this->getValidationGroup(); |
|
| 363 | + $hasValidators=$this->getPage()->getValidators($group)->getCount() > 0; |
|
| 364 | 364 | return $this->getCausesValidation() && $hasValidators; |
| 365 | 365 | } |
| 366 | 366 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function getTitle() |
| 82 | 82 | { |
| 83 | - return $this->getViewState('Title',''); |
|
| 83 | + return $this->getViewState('Title', ''); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function setTitle($value) |
| 93 | 93 | { |
| 94 | - $this->setViewState('Title',$value,''); |
|
| 94 | + $this->setViewState('Title', $value, ''); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function getBaseUrl() |
| 101 | 101 | { |
| 102 | - return $this->getViewState('BaseUrl',''); |
|
| 102 | + return $this->getViewState('BaseUrl', ''); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function setBaseUrl($url) |
| 109 | 109 | { |
| 110 | - $this->setViewState('BaseUrl',$url,''); |
|
| 110 | + $this->setViewState('BaseUrl', $url, ''); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function getShortcutIcon() |
| 117 | 117 | { |
| 118 | - return $this->getViewState('ShortcutIcon',''); |
|
| 118 | + return $this->getViewState('ShortcutIcon', ''); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | public function setShortcutIcon($url) |
| 125 | 125 | { |
| 126 | - $this->setViewState('ShortcutIcon',$url,''); |
|
| 126 | + $this->setViewState('ShortcutIcon', $url, ''); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -131,10 +131,10 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function getMetaTags() |
| 133 | 133 | { |
| 134 | - if(($metaTags=$this->getViewState('MetaTags',null))===null) |
|
| 134 | + if(($metaTags=$this->getViewState('MetaTags', null))===null) |
|
| 135 | 135 | { |
| 136 | 136 | $metaTags=new TMetaTagCollection; |
| 137 | - $this->setViewState('MetaTags',$metaTags,null); |
|
| 137 | + $this->setViewState('MetaTags', $metaTags, null); |
|
| 138 | 138 | } |
| 139 | 139 | return $metaTags; |
| 140 | 140 | } |
@@ -297,14 +297,14 @@ discard block |
||
| 297 | 297 | public function render($writer) |
| 298 | 298 | { |
| 299 | 299 | if($this->_id!=='') |
| 300 | - $writer->addAttribute('id',$this->_id); |
|
| 300 | + $writer->addAttribute('id', $this->_id); |
|
| 301 | 301 | if($this->_name!=='') |
| 302 | - $writer->addAttribute('name',$this->_name); |
|
| 302 | + $writer->addAttribute('name', $this->_name); |
|
| 303 | 303 | if($this->_httpEquiv!=='') |
| 304 | - $writer->addAttribute('http-equiv',$this->_httpEquiv); |
|
| 304 | + $writer->addAttribute('http-equiv', $this->_httpEquiv); |
|
| 305 | 305 | if($this->_scheme!=='') |
| 306 | - $writer->addAttribute('scheme',$this->_scheme); |
|
| 307 | - $writer->addAttribute('content',$this->_content); |
|
| 306 | + $writer->addAttribute('scheme', $this->_scheme); |
|
| 307 | + $writer->addAttribute('content', $this->_content); |
|
| 308 | 308 | $writer->renderBeginTag('meta'); |
| 309 | 309 | $writer->renderEndTag(); |
| 310 | 310 | } |
@@ -331,10 +331,10 @@ discard block |
||
| 331 | 331 | * @param mixed new item |
| 332 | 332 | * @throws TInvalidDataTypeException if the item to be inserted is not a {@link TMetaTag} |
| 333 | 333 | */ |
| 334 | - public function insertAt($index,$item) |
|
| 334 | + public function insertAt($index, $item) |
|
| 335 | 335 | { |
| 336 | 336 | if($item instanceof TMetaTag) |
| 337 | - parent::insertAt($index,$item); |
|
| 337 | + parent::insertAt($index, $item); |
|
| 338 | 338 | else |
| 339 | 339 | throw new TInvalidDataTypeException('metatagcollection_metatag_invalid'); |
| 340 | 340 | } |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | */ |
| 364 | 364 | public function findMetaTagByID($id) |
| 365 | 365 | { |
| 366 | - if(($index=$this->findIndexByID($id))>=0) |
|
| 366 | + if(($index=$this->findIndexByID($id)) >= 0) |
|
| 367 | 367 | return $this->itemAt($index); |
| 368 | 368 | else |
| 369 | 369 | return null; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function getItemRenderer() |
| 54 | 54 | { |
| 55 | - return $this->getViewState('ItemRenderer',''); |
|
| 55 | + return $this->getViewState('ItemRenderer', ''); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function setItemRenderer($value) |
| 73 | 73 | { |
| 74 | - $this->setViewState('ItemRenderer',$value,''); |
|
| 74 | + $this->setViewState('ItemRenderer', $value, ''); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function getEditItemRenderer() |
| 82 | 82 | { |
| 83 | - return $this->getViewState('EditItemRenderer',''); |
|
| 83 | + return $this->getViewState('EditItemRenderer', ''); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function setEditItemRenderer($value) |
| 101 | 101 | { |
| 102 | - $this->setViewState('EditItemRenderer',$value,''); |
|
| 102 | + $this->setViewState('EditItemRenderer', $value, ''); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function getDataField() |
| 109 | 109 | { |
| 110 | - return $this->getViewState('DataField',''); |
|
| 110 | + return $this->getViewState('DataField', ''); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function setDataField($value) |
| 117 | 117 | { |
| 118 | - $this->setViewState('DataField',$value,''); |
|
| 118 | + $this->setViewState('DataField', $value, ''); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | public function getDataFormatString() |
| 125 | 125 | { |
| 126 | - return $this->getViewState('DataFormatString',''); |
|
| 126 | + return $this->getViewState('DataFormatString', ''); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function setDataFormatString($value) |
| 133 | 133 | { |
| 134 | - $this->setViewState('DataFormatString',$value,''); |
|
| 134 | + $this->setViewState('DataFormatString', $value, ''); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function getReadOnly() |
| 141 | 141 | { |
| 142 | - return $this->getViewState('ReadOnly',false); |
|
| 142 | + return $this->getViewState('ReadOnly', false); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public function setReadOnly($value) |
| 149 | 149 | { |
| 150 | - $this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false); |
|
| 150 | + $this->setViewState('ReadOnly', TPropertyValue::ensureBoolean($value), false); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * @param integer the index to the Columns property that the cell resides in. |
| 162 | 162 | * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem) |
| 163 | 163 | */ |
| 164 | - public function initializeCell($cell,$columnIndex,$itemType) |
|
| 164 | + public function initializeCell($cell, $columnIndex, $itemType) |
|
| 165 | 165 | { |
| 166 | 166 | $item=$cell->getParent(); |
| 167 | 167 | switch($itemType) |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | } |
| 182 | 182 | else |
| 183 | 183 | $control=$cell; |
| 184 | - $control->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
|
| 184 | + $control->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn')); |
|
| 185 | 185 | break; |
| 186 | 186 | case TListItemType::EditItem: |
| 187 | 187 | if(!$this->getReadOnly()) |
@@ -195,13 +195,13 @@ discard block |
||
| 195 | 195 | $control->setItemType($item->getItemType()); |
| 196 | 196 | } |
| 197 | 197 | $cell->getControls()->add($control); |
| 198 | - $cell->registerObject('EditControl',$control); |
|
| 198 | + $cell->registerObject('EditControl', $control); |
|
| 199 | 199 | } |
| 200 | 200 | else |
| 201 | 201 | { |
| 202 | 202 | $control=Prado::createComponent('System.Web.UI.WebControls.TTextBox'); |
| 203 | 203 | $cell->getControls()->add($control); |
| 204 | - $cell->registerObject('TextBox',$control); |
|
| 204 | + $cell->registerObject('TextBox', $control); |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | else |
@@ -219,10 +219,10 @@ discard block |
||
| 219 | 219 | else |
| 220 | 220 | $control=$cell; |
| 221 | 221 | } |
| 222 | - $control->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
|
| 222 | + $control->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn')); |
|
| 223 | 223 | break; |
| 224 | 224 | default: |
| 225 | - parent::initializeCell($cell,$columnIndex,$itemType); |
|
| 225 | + parent::initializeCell($cell, $columnIndex, $itemType); |
|
| 226 | 226 | break; |
| 227 | 227 | } |
| 228 | 228 | } |
@@ -232,15 +232,15 @@ discard block |
||
| 232 | 232 | * This method is invoked when datagrid performs databinding. |
| 233 | 233 | * It populates the content of the cell with the relevant data from data source. |
| 234 | 234 | */ |
| 235 | - public function dataBindColumn($sender,$param) |
|
| 235 | + public function dataBindColumn($sender, $param) |
|
| 236 | 236 | { |
| 237 | 237 | $item=$sender->getNamingContainer(); |
| 238 | 238 | $data=$item->getData(); |
| 239 | 239 | $formatString=$this->getDataFormatString(); |
| 240 | 240 | if(($field=$this->getDataField())!=='') |
| 241 | - $value=$this->formatDataValue($formatString,$this->getDataFieldValue($data,$field)); |
|
| 241 | + $value=$this->formatDataValue($formatString, $this->getDataFieldValue($data, $field)); |
|
| 242 | 242 | else |
| 243 | - $value=$this->formatDataValue($formatString,$data); |
|
| 243 | + $value=$this->formatDataValue($formatString, $data); |
|
| 244 | 244 | $sender->setData($value); |
| 245 | 245 | } |
| 246 | 246 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | */ |
| 199 | 199 | public function getItemCount() |
| 200 | 200 | { |
| 201 | - return $this->_items?$this->_items->getCount():0; |
|
| 201 | + return $this->_items ? $this->_items->getCount() : 0; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /** |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | public function getItemRenderer() |
| 209 | 209 | { |
| 210 | - return $this->getViewState('ItemRenderer',''); |
|
| 210 | + return $this->getViewState('ItemRenderer', ''); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | public function setItemRenderer($value) |
| 224 | 224 | { |
| 225 | - $this->setViewState('ItemRenderer',$value,''); |
|
| 225 | + $this->setViewState('ItemRenderer', $value, ''); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | */ |
| 232 | 232 | public function getAlternatingItemRenderer() |
| 233 | 233 | { |
| 234 | - return $this->getViewState('AlternatingItemRenderer',''); |
|
| 234 | + return $this->getViewState('AlternatingItemRenderer', ''); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /** |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | public function setAlternatingItemRenderer($value) |
| 248 | 248 | { |
| 249 | - $this->setViewState('AlternatingItemRenderer',$value,''); |
|
| 249 | + $this->setViewState('AlternatingItemRenderer', $value, ''); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | public function getEditItemRenderer() |
| 257 | 257 | { |
| 258 | - return $this->getViewState('EditItemRenderer',''); |
|
| 258 | + return $this->getViewState('EditItemRenderer', ''); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | */ |
| 271 | 271 | public function setEditItemRenderer($value) |
| 272 | 272 | { |
| 273 | - $this->setViewState('EditItemRenderer',$value,''); |
|
| 273 | + $this->setViewState('EditItemRenderer', $value, ''); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | /** |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | */ |
| 280 | 280 | public function getSelectedItemRenderer() |
| 281 | 281 | { |
| 282 | - return $this->getViewState('SelectedItemRenderer',''); |
|
| 282 | + return $this->getViewState('SelectedItemRenderer', ''); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | /** |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | public function setSelectedItemRenderer($value) |
| 296 | 296 | { |
| 297 | - $this->setViewState('SelectedItemRenderer',$value,''); |
|
| 297 | + $this->setViewState('SelectedItemRenderer', $value, ''); |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | /** |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | public function getSeparatorRenderer() |
| 305 | 305 | { |
| 306 | - return $this->getViewState('SeparatorRenderer',''); |
|
| 306 | + return $this->getViewState('SeparatorRenderer', ''); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | /** |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | */ |
| 319 | 319 | public function setSeparatorRenderer($value) |
| 320 | 320 | { |
| 321 | - $this->setViewState('SeparatorRenderer',$value,''); |
|
| 321 | + $this->setViewState('SeparatorRenderer', $value, ''); |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | /** |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | */ |
| 328 | 328 | public function getHeaderRenderer() |
| 329 | 329 | { |
| 330 | - return $this->getViewState('HeaderRenderer',''); |
|
| 330 | + return $this->getViewState('HeaderRenderer', ''); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | /** |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | */ |
| 343 | 343 | public function setHeaderRenderer($value) |
| 344 | 344 | { |
| 345 | - $this->setViewState('HeaderRenderer',$value,''); |
|
| 345 | + $this->setViewState('HeaderRenderer', $value, ''); |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | /** |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | */ |
| 352 | 352 | public function getFooterRenderer() |
| 353 | 353 | { |
| 354 | - return $this->getViewState('FooterRenderer',''); |
|
| 354 | + return $this->getViewState('FooterRenderer', ''); |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | /** |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | */ |
| 367 | 367 | public function setFooterRenderer($value) |
| 368 | 368 | { |
| 369 | - $this->setViewState('FooterRenderer',$value,''); |
|
| 369 | + $this->setViewState('FooterRenderer', $value, ''); |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | /** |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | */ |
| 376 | 376 | public function getEmptyRenderer() |
| 377 | 377 | { |
| 378 | - return $this->getViewState('EmptyRenderer',''); |
|
| 378 | + return $this->getViewState('EmptyRenderer', ''); |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | /** |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | */ |
| 392 | 392 | public function setEmptyRenderer($value) |
| 393 | 393 | { |
| 394 | - $this->setViewState('EmptyRenderer',$value,''); |
|
| 394 | + $this->setViewState('EmptyRenderer', $value, ''); |
|
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | /** |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | if($value instanceof ITemplate || $value===null) |
| 412 | 412 | $this->_itemTemplate=$value; |
| 413 | 413 | else |
| 414 | - throw new TInvalidDataTypeException('datalist_template_required','ItemTemplate'); |
|
| 414 | + throw new TInvalidDataTypeException('datalist_template_required', 'ItemTemplate'); |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | /** |
@@ -419,10 +419,10 @@ discard block |
||
| 419 | 419 | */ |
| 420 | 420 | public function getItemStyle() |
| 421 | 421 | { |
| 422 | - if(($style=$this->getViewState('ItemStyle',null))===null) |
|
| 422 | + if(($style=$this->getViewState('ItemStyle', null))===null) |
|
| 423 | 423 | { |
| 424 | 424 | $style=new TTableItemStyle; |
| 425 | - $this->setViewState('ItemStyle',$style,null); |
|
| 425 | + $this->setViewState('ItemStyle', $style, null); |
|
| 426 | 426 | } |
| 427 | 427 | return $style; |
| 428 | 428 | } |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | if($value instanceof ITemplate || $value===null) |
| 445 | 445 | $this->_alternatingItemTemplate=$value; |
| 446 | 446 | else |
| 447 | - throw new TInvalidDataTypeException('datalist_template_required','AlternatingItemType'); |
|
| 447 | + throw new TInvalidDataTypeException('datalist_template_required', 'AlternatingItemType'); |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | /** |
@@ -452,10 +452,10 @@ discard block |
||
| 452 | 452 | */ |
| 453 | 453 | public function getAlternatingItemStyle() |
| 454 | 454 | { |
| 455 | - if(($style=$this->getViewState('AlternatingItemStyle',null))===null) |
|
| 455 | + if(($style=$this->getViewState('AlternatingItemStyle', null))===null) |
|
| 456 | 456 | { |
| 457 | 457 | $style=new TTableItemStyle; |
| 458 | - $this->setViewState('AlternatingItemStyle',$style,null); |
|
| 458 | + $this->setViewState('AlternatingItemStyle', $style, null); |
|
| 459 | 459 | } |
| 460 | 460 | return $style; |
| 461 | 461 | } |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | if($value instanceof ITemplate || $value===null) |
| 478 | 478 | $this->_selectedItemTemplate=$value; |
| 479 | 479 | else |
| 480 | - throw new TInvalidDataTypeException('datalist_template_required','SelectedItemTemplate'); |
|
| 480 | + throw new TInvalidDataTypeException('datalist_template_required', 'SelectedItemTemplate'); |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | /** |
@@ -485,10 +485,10 @@ discard block |
||
| 485 | 485 | */ |
| 486 | 486 | public function getSelectedItemStyle() |
| 487 | 487 | { |
| 488 | - if(($style=$this->getViewState('SelectedItemStyle',null))===null) |
|
| 488 | + if(($style=$this->getViewState('SelectedItemStyle', null))===null) |
|
| 489 | 489 | { |
| 490 | 490 | $style=new TTableItemStyle; |
| 491 | - $this->setViewState('SelectedItemStyle',$style,null); |
|
| 491 | + $this->setViewState('SelectedItemStyle', $style, null); |
|
| 492 | 492 | } |
| 493 | 493 | return $style; |
| 494 | 494 | } |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | if($value instanceof ITemplate || $value===null) |
| 511 | 511 | $this->_editItemTemplate=$value; |
| 512 | 512 | else |
| 513 | - throw new TInvalidDataTypeException('datalist_template_required','EditItemTemplate'); |
|
| 513 | + throw new TInvalidDataTypeException('datalist_template_required', 'EditItemTemplate'); |
|
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | /** |
@@ -518,10 +518,10 @@ discard block |
||
| 518 | 518 | */ |
| 519 | 519 | public function getEditItemStyle() |
| 520 | 520 | { |
| 521 | - if(($style=$this->getViewState('EditItemStyle',null))===null) |
|
| 521 | + if(($style=$this->getViewState('EditItemStyle', null))===null) |
|
| 522 | 522 | { |
| 523 | 523 | $style=new TTableItemStyle; |
| 524 | - $this->setViewState('EditItemStyle',$style,null); |
|
| 524 | + $this->setViewState('EditItemStyle', $style, null); |
|
| 525 | 525 | } |
| 526 | 526 | return $style; |
| 527 | 527 | } |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | if($value instanceof ITemplate || $value===null) |
| 544 | 544 | $this->_headerTemplate=$value; |
| 545 | 545 | else |
| 546 | - throw new TInvalidDataTypeException('datalist_template_required','HeaderTemplate'); |
|
| 546 | + throw new TInvalidDataTypeException('datalist_template_required', 'HeaderTemplate'); |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | /** |
@@ -551,10 +551,10 @@ discard block |
||
| 551 | 551 | */ |
| 552 | 552 | public function getHeaderStyle() |
| 553 | 553 | { |
| 554 | - if(($style=$this->getViewState('HeaderStyle',null))===null) |
|
| 554 | + if(($style=$this->getViewState('HeaderStyle', null))===null) |
|
| 555 | 555 | { |
| 556 | 556 | $style=new TTableItemStyle; |
| 557 | - $this->setViewState('HeaderStyle',$style,null); |
|
| 557 | + $this->setViewState('HeaderStyle', $style, null); |
|
| 558 | 558 | } |
| 559 | 559 | return $style; |
| 560 | 560 | } |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | if($value instanceof ITemplate || $value===null) |
| 585 | 585 | $this->_footerTemplate=$value; |
| 586 | 586 | else |
| 587 | - throw new TInvalidDataTypeException('datalist_template_required','FooterTemplate'); |
|
| 587 | + throw new TInvalidDataTypeException('datalist_template_required', 'FooterTemplate'); |
|
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | /** |
@@ -592,10 +592,10 @@ discard block |
||
| 592 | 592 | */ |
| 593 | 593 | public function getFooterStyle() |
| 594 | 594 | { |
| 595 | - if(($style=$this->getViewState('FooterStyle',null))===null) |
|
| 595 | + if(($style=$this->getViewState('FooterStyle', null))===null) |
|
| 596 | 596 | { |
| 597 | 597 | $style=new TTableItemStyle; |
| 598 | - $this->setViewState('FooterStyle',$style,null); |
|
| 598 | + $this->setViewState('FooterStyle', $style, null); |
|
| 599 | 599 | } |
| 600 | 600 | return $style; |
| 601 | 601 | } |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | if($value instanceof ITemplate || $value===null) |
| 626 | 626 | $this->_emptyTemplate=$value; |
| 627 | 627 | else |
| 628 | - throw new TInvalidDataTypeException('datalist_template_required','EmptyTemplate'); |
|
| 628 | + throw new TInvalidDataTypeException('datalist_template_required', 'EmptyTemplate'); |
|
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | /** |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | if($value instanceof ITemplate || $value===null) |
| 646 | 646 | $this->_separatorTemplate=$value; |
| 647 | 647 | else |
| 648 | - throw new TInvalidDataTypeException('datalist_template_required','SeparatorTemplate'); |
|
| 648 | + throw new TInvalidDataTypeException('datalist_template_required', 'SeparatorTemplate'); |
|
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | /** |
@@ -653,10 +653,10 @@ discard block |
||
| 653 | 653 | */ |
| 654 | 654 | public function getSeparatorStyle() |
| 655 | 655 | { |
| 656 | - if(($style=$this->getViewState('SeparatorStyle',null))===null) |
|
| 656 | + if(($style=$this->getViewState('SeparatorStyle', null))===null) |
|
| 657 | 657 | { |
| 658 | 658 | $style=new TTableItemStyle; |
| 659 | - $this->setViewState('SeparatorStyle',$style,null); |
|
| 659 | + $this->setViewState('SeparatorStyle', $style, null); |
|
| 660 | 660 | } |
| 661 | 661 | return $style; |
| 662 | 662 | } |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | */ |
| 668 | 668 | public function getSelectedItemIndex() |
| 669 | 669 | { |
| 670 | - return $this->getViewState('SelectedItemIndex',-1); |
|
| 670 | + return $this->getViewState('SelectedItemIndex', -1); |
|
| 671 | 671 | } |
| 672 | 672 | |
| 673 | 673 | /** |
@@ -679,20 +679,20 @@ discard block |
||
| 679 | 679 | */ |
| 680 | 680 | public function setSelectedItemIndex($value) |
| 681 | 681 | { |
| 682 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
| 682 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
| 683 | 683 | $value=-1; |
| 684 | 684 | if(($current=$this->getSelectedItemIndex())!==$value) |
| 685 | 685 | { |
| 686 | - $this->setViewState('SelectedItemIndex',$value,-1); |
|
| 686 | + $this->setViewState('SelectedItemIndex', $value, -1); |
|
| 687 | 687 | $items=$this->getItems(); |
| 688 | 688 | $itemCount=$items->getCount(); |
| 689 | - if($current>=0 && $current<$itemCount) |
|
| 689 | + if($current >= 0 && $current < $itemCount) |
|
| 690 | 690 | { |
| 691 | 691 | $item=$items->itemAt($current); |
| 692 | 692 | if(($item instanceof IItemDataRenderer) && $item->getItemType()!==TListItemType::EditItem) |
| 693 | - $item->setItemType($current%2?TListItemType::AlternatingItem : TListItemType::Item); |
|
| 693 | + $item->setItemType($current % 2 ? TListItemType::AlternatingItem : TListItemType::Item); |
|
| 694 | 694 | } |
| 695 | - if($value>=0 && $value<$itemCount) |
|
| 695 | + if($value >= 0 && $value < $itemCount) |
|
| 696 | 696 | { |
| 697 | 697 | $item=$items->itemAt($value); |
| 698 | 698 | if(($item instanceof IItemDataRenderer) && $item->getItemType()!==TListItemType::EditItem) |
@@ -708,7 +708,7 @@ discard block |
||
| 708 | 708 | { |
| 709 | 709 | $index=$this->getSelectedItemIndex(); |
| 710 | 710 | $items=$this->getItems(); |
| 711 | - if($index>=0 && $index<$items->getCount()) |
|
| 711 | + if($index >= 0 && $index < $items->getCount()) |
|
| 712 | 712 | return $items->itemAt($index); |
| 713 | 713 | else |
| 714 | 714 | return null; |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | throw new TInvalidOperationException('datalist_datakeyfield_required'); |
| 725 | 725 | $index=$this->getSelectedItemIndex(); |
| 726 | 726 | $dataKeys=$this->getDataKeys(); |
| 727 | - if($index>=0 && $index<$dataKeys->getCount()) |
|
| 727 | + if($index >= 0 && $index < $dataKeys->getCount()) |
|
| 728 | 728 | return $dataKeys->itemAt($index); |
| 729 | 729 | else |
| 730 | 730 | return null; |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | */ |
| 737 | 737 | public function getEditItemIndex() |
| 738 | 738 | { |
| 739 | - return $this->getViewState('EditItemIndex',-1); |
|
| 739 | + return $this->getViewState('EditItemIndex', -1); |
|
| 740 | 740 | } |
| 741 | 741 | |
| 742 | 742 | /** |
@@ -747,16 +747,16 @@ discard block |
||
| 747 | 747 | */ |
| 748 | 748 | public function setEditItemIndex($value) |
| 749 | 749 | { |
| 750 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
| 750 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
| 751 | 751 | $value=-1; |
| 752 | 752 | if(($current=$this->getEditItemIndex())!==$value) |
| 753 | 753 | { |
| 754 | - $this->setViewState('EditItemIndex',$value,-1); |
|
| 754 | + $this->setViewState('EditItemIndex', $value, -1); |
|
| 755 | 755 | $items=$this->getItems(); |
| 756 | 756 | $itemCount=$items->getCount(); |
| 757 | - if($current>=0 && $current<$itemCount) |
|
| 758 | - $items->itemAt($current)->setItemType($current%2?TListItemType::AlternatingItem : TListItemType::Item); |
|
| 759 | - if($value>=0 && $value<$itemCount) |
|
| 757 | + if($current >= 0 && $current < $itemCount) |
|
| 758 | + $items->itemAt($current)->setItemType($current % 2 ? TListItemType::AlternatingItem : TListItemType::Item); |
|
| 759 | + if($value >= 0 && $value < $itemCount) |
|
| 760 | 760 | $items->itemAt($value)->setItemType(TListItemType::EditItem); |
| 761 | 761 | } |
| 762 | 762 | } |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | { |
| 769 | 769 | $index=$this->getEditItemIndex(); |
| 770 | 770 | $items=$this->getItems(); |
| 771 | - if($index>=0 && $index<$items->getCount()) |
|
| 771 | + if($index >= 0 && $index < $items->getCount()) |
|
| 772 | 772 | return $items->itemAt($index); |
| 773 | 773 | else |
| 774 | 774 | return null; |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | */ |
| 780 | 780 | public function getShowHeader() |
| 781 | 781 | { |
| 782 | - return $this->getViewState('ShowHeader',true); |
|
| 782 | + return $this->getViewState('ShowHeader', true); |
|
| 783 | 783 | } |
| 784 | 784 | |
| 785 | 785 | /** |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | */ |
| 788 | 788 | public function setShowHeader($value) |
| 789 | 789 | { |
| 790 | - $this->setViewState('ShowHeader',TPropertyValue::ensureBoolean($value),true); |
|
| 790 | + $this->setViewState('ShowHeader', TPropertyValue::ensureBoolean($value), true); |
|
| 791 | 791 | } |
| 792 | 792 | |
| 793 | 793 | /** |
@@ -795,7 +795,7 @@ discard block |
||
| 795 | 795 | */ |
| 796 | 796 | public function getShowFooter() |
| 797 | 797 | { |
| 798 | - return $this->getViewState('ShowFooter',true); |
|
| 798 | + return $this->getViewState('ShowFooter', true); |
|
| 799 | 799 | } |
| 800 | 800 | |
| 801 | 801 | /** |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | */ |
| 804 | 804 | public function setShowFooter($value) |
| 805 | 805 | { |
| 806 | - $this->setViewState('ShowFooter',TPropertyValue::ensureBoolean($value),true); |
|
| 806 | + $this->setViewState('ShowFooter', TPropertyValue::ensureBoolean($value), true); |
|
| 807 | 807 | } |
| 808 | 808 | |
| 809 | 809 | /** |
@@ -811,10 +811,10 @@ discard block |
||
| 811 | 811 | */ |
| 812 | 812 | protected function getRepeatInfo() |
| 813 | 813 | { |
| 814 | - if(($repeatInfo=$this->getViewState('RepeatInfo',null))===null) |
|
| 814 | + if(($repeatInfo=$this->getViewState('RepeatInfo', null))===null) |
|
| 815 | 815 | { |
| 816 | 816 | $repeatInfo=new TRepeatInfo; |
| 817 | - $this->setViewState('RepeatInfo',$repeatInfo,null); |
|
| 817 | + $this->setViewState('RepeatInfo', $repeatInfo, null); |
|
| 818 | 818 | } |
| 819 | 819 | return $repeatInfo; |
| 820 | 820 | } |
@@ -912,35 +912,35 @@ discard block |
||
| 912 | 912 | * @param TEventParameter event parameter |
| 913 | 913 | * @return boolean whether the event bubbling should stop here. |
| 914 | 914 | */ |
| 915 | - public function bubbleEvent($sender,$param) |
|
| 915 | + public function bubbleEvent($sender, $param) |
|
| 916 | 916 | { |
| 917 | 917 | if($param instanceof TDataListCommandEventParameter) |
| 918 | 918 | { |
| 919 | 919 | $this->onItemCommand($param); |
| 920 | 920 | $command=$param->getCommandName(); |
| 921 | - if(strcasecmp($command,self::CMD_SELECT)===0) |
|
| 921 | + if(strcasecmp($command, self::CMD_SELECT)===0) |
|
| 922 | 922 | { |
| 923 | 923 | if(($item=$param->getItem()) instanceof IItemDataRenderer) |
| 924 | 924 | $this->setSelectedItemIndex($item->getItemIndex()); |
| 925 | 925 | $this->onSelectedIndexChanged($param); |
| 926 | 926 | return true; |
| 927 | 927 | } |
| 928 | - else if(strcasecmp($command,self::CMD_EDIT)===0) |
|
| 928 | + else if(strcasecmp($command, self::CMD_EDIT)===0) |
|
| 929 | 929 | { |
| 930 | 930 | $this->onEditCommand($param); |
| 931 | 931 | return true; |
| 932 | 932 | } |
| 933 | - else if(strcasecmp($command,self::CMD_DELETE)===0) |
|
| 933 | + else if(strcasecmp($command, self::CMD_DELETE)===0) |
|
| 934 | 934 | { |
| 935 | 935 | $this->onDeleteCommand($param); |
| 936 | 936 | return true; |
| 937 | 937 | } |
| 938 | - else if(strcasecmp($command,self::CMD_UPDATE)===0) |
|
| 938 | + else if(strcasecmp($command, self::CMD_UPDATE)===0) |
|
| 939 | 939 | { |
| 940 | 940 | $this->onUpdateCommand($param); |
| 941 | 941 | return true; |
| 942 | 942 | } |
| 943 | - else if(strcasecmp($command,self::CMD_CANCEL)===0) |
|
| 943 | + else if(strcasecmp($command, self::CMD_CANCEL)===0) |
|
| 944 | 944 | { |
| 945 | 945 | $this->onCancelCommand($param); |
| 946 | 946 | return true; |
@@ -962,7 +962,7 @@ discard block |
||
| 962 | 962 | */ |
| 963 | 963 | public function onItemCreated($param) |
| 964 | 964 | { |
| 965 | - $this->raiseEvent('OnItemCreated',$this,$param); |
|
| 965 | + $this->raiseEvent('OnItemCreated', $this, $param); |
|
| 966 | 966 | } |
| 967 | 967 | |
| 968 | 968 | /** |
@@ -976,7 +976,7 @@ discard block |
||
| 976 | 976 | */ |
| 977 | 977 | public function onItemDataBound($param) |
| 978 | 978 | { |
| 979 | - $this->raiseEvent('OnItemDataBound',$this,$param); |
|
| 979 | + $this->raiseEvent('OnItemDataBound', $this, $param); |
|
| 980 | 980 | } |
| 981 | 981 | |
| 982 | 982 | /** |
@@ -987,7 +987,7 @@ discard block |
||
| 987 | 987 | */ |
| 988 | 988 | public function onItemCommand($param) |
| 989 | 989 | { |
| 990 | - $this->raiseEvent('OnItemCommand',$this,$param); |
|
| 990 | + $this->raiseEvent('OnItemCommand', $this, $param); |
|
| 991 | 991 | } |
| 992 | 992 | |
| 993 | 993 | /** |
@@ -998,7 +998,7 @@ discard block |
||
| 998 | 998 | */ |
| 999 | 999 | public function onEditCommand($param) |
| 1000 | 1000 | { |
| 1001 | - $this->raiseEvent('OnEditCommand',$this,$param); |
|
| 1001 | + $this->raiseEvent('OnEditCommand', $this, $param); |
|
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | /** |
@@ -1009,7 +1009,7 @@ discard block |
||
| 1009 | 1009 | */ |
| 1010 | 1010 | public function onDeleteCommand($param) |
| 1011 | 1011 | { |
| 1012 | - $this->raiseEvent('OnDeleteCommand',$this,$param); |
|
| 1012 | + $this->raiseEvent('OnDeleteCommand', $this, $param); |
|
| 1013 | 1013 | } |
| 1014 | 1014 | |
| 1015 | 1015 | /** |
@@ -1020,7 +1020,7 @@ discard block |
||
| 1020 | 1020 | */ |
| 1021 | 1021 | public function onUpdateCommand($param) |
| 1022 | 1022 | { |
| 1023 | - $this->raiseEvent('OnUpdateCommand',$this,$param); |
|
| 1023 | + $this->raiseEvent('OnUpdateCommand', $this, $param); |
|
| 1024 | 1024 | } |
| 1025 | 1025 | |
| 1026 | 1026 | /** |
@@ -1031,7 +1031,7 @@ discard block |
||
| 1031 | 1031 | */ |
| 1032 | 1032 | public function onCancelCommand($param) |
| 1033 | 1033 | { |
| 1034 | - $this->raiseEvent('OnCancelCommand',$this,$param); |
|
| 1034 | + $this->raiseEvent('OnCancelCommand', $this, $param); |
|
| 1035 | 1035 | } |
| 1036 | 1036 | |
| 1037 | 1037 | /** |
@@ -1071,9 +1071,9 @@ discard block |
||
| 1071 | 1071 | * @param integer index of the item being rendered |
| 1072 | 1072 | * @return TStyle item style |
| 1073 | 1073 | */ |
| 1074 | - public function generateItemStyle($itemType,$index) |
|
| 1074 | + public function generateItemStyle($itemType, $index) |
|
| 1075 | 1075 | { |
| 1076 | - if(($item=$this->getItem($itemType,$index))!==null && ($item instanceof IStyleable) && $item->getHasStyle()) |
|
| 1076 | + if(($item=$this->getItem($itemType, $index))!==null && ($item instanceof IStyleable) && $item->getHasStyle()) |
|
| 1077 | 1077 | { |
| 1078 | 1078 | $style=$item->getStyle(); |
| 1079 | 1079 | $item->clearStyle(); |
@@ -1091,9 +1091,9 @@ discard block |
||
| 1091 | 1091 | * @param string item type (Header,Footer,Item,AlternatingItem,SelectedItem,EditItem,Separator,Pager) |
| 1092 | 1092 | * @param integer zero-based index of the item in the item list |
| 1093 | 1093 | */ |
| 1094 | - public function renderItem($writer,$repeatInfo,$itemType,$index) |
|
| 1094 | + public function renderItem($writer, $repeatInfo, $itemType, $index) |
|
| 1095 | 1095 | { |
| 1096 | - $item=$this->getItem($itemType,$index); |
|
| 1096 | + $item=$this->getItem($itemType, $index); |
|
| 1097 | 1097 | if($repeatInfo->getRepeatLayout()===TRepeatLayout::Raw && get_class($item)==='TDataListItem') |
| 1098 | 1098 | $item->setTagName('div'); |
| 1099 | 1099 | $item->renderControl($writer); |
@@ -1104,7 +1104,7 @@ discard block |
||
| 1104 | 1104 | * @param integer item index |
| 1105 | 1105 | * @return TControl data list item with the specified item type and index |
| 1106 | 1106 | */ |
| 1107 | - private function getItem($itemType,$index) |
|
| 1107 | + private function getItem($itemType, $index) |
|
| 1108 | 1108 | { |
| 1109 | 1109 | switch($itemType) |
| 1110 | 1110 | { |
@@ -1116,9 +1116,9 @@ discard block |
||
| 1116 | 1116 | case TListItemType::Header: |
| 1117 | 1117 | return $this->getControls()->itemAt(0); |
| 1118 | 1118 | case TListItemType::Footer: |
| 1119 | - return $this->getControls()->itemAt($this->getControls()->getCount()-1); |
|
| 1119 | + return $this->getControls()->itemAt($this->getControls()->getCount() - 1); |
|
| 1120 | 1120 | case TListItemType::Separator: |
| 1121 | - $i=$index+$index+1; |
|
| 1121 | + $i=$index + $index + 1; |
|
| 1122 | 1122 | if($this->_headerTemplate!==null || $this->getHeaderRenderer()!=='') |
| 1123 | 1123 | $i++; |
| 1124 | 1124 | return $this->getControls()->itemAt($i); |
@@ -1133,9 +1133,9 @@ discard block |
||
| 1133 | 1133 | * @param TListItemType item type |
| 1134 | 1134 | * @return TControl the created item, null if item is not created |
| 1135 | 1135 | */ |
| 1136 | - private function createItemInternal($itemIndex,$itemType) |
|
| 1136 | + private function createItemInternal($itemIndex, $itemType) |
|
| 1137 | 1137 | { |
| 1138 | - if(($item=$this->createItem($itemIndex,$itemType))!==null) |
|
| 1138 | + if(($item=$this->createItem($itemIndex, $itemType))!==null) |
|
| 1139 | 1139 | { |
| 1140 | 1140 | $param=new TDataListItemEventParameter($item); |
| 1141 | 1141 | $this->onItemCreated($param); |
@@ -1154,9 +1154,9 @@ discard block |
||
| 1154 | 1154 | * @param mixed data to be associated with the item |
| 1155 | 1155 | * @return TControl the created item, null if item is not created |
| 1156 | 1156 | */ |
| 1157 | - private function createItemWithDataInternal($itemIndex,$itemType,$dataItem) |
|
| 1157 | + private function createItemWithDataInternal($itemIndex, $itemType, $dataItem) |
|
| 1158 | 1158 | { |
| 1159 | - if(($item=$this->createItem($itemIndex,$itemType))!==null) |
|
| 1159 | + if(($item=$this->createItem($itemIndex, $itemType))!==null) |
|
| 1160 | 1160 | { |
| 1161 | 1161 | $param=new TDataListItemEventParameter($item); |
| 1162 | 1162 | if($item instanceof IDataRenderer) |
@@ -1174,22 +1174,22 @@ discard block |
||
| 1174 | 1174 | private function getAlternatingItemDisplay() |
| 1175 | 1175 | { |
| 1176 | 1176 | if(($classPath=$this->getAlternatingItemRenderer())==='' && $this->_alternatingItemTemplate===null) |
| 1177 | - return array($this->getItemRenderer(),$this->_itemTemplate); |
|
| 1177 | + return array($this->getItemRenderer(), $this->_itemTemplate); |
|
| 1178 | 1178 | else |
| 1179 | - return array($classPath,$this->_alternatingItemTemplate); |
|
| 1179 | + return array($classPath, $this->_alternatingItemTemplate); |
|
| 1180 | 1180 | } |
| 1181 | 1181 | |
| 1182 | 1182 | private function getSelectedItemDisplay($itemIndex) |
| 1183 | 1183 | { |
| 1184 | 1184 | if(($classPath=$this->getSelectedItemRenderer())==='' && $this->_selectedItemTemplate===null) |
| 1185 | 1185 | { |
| 1186 | - if($itemIndex%2===0) |
|
| 1187 | - return array($this->getItemRenderer(),$this->_itemTemplate); |
|
| 1186 | + if($itemIndex % 2===0) |
|
| 1187 | + return array($this->getItemRenderer(), $this->_itemTemplate); |
|
| 1188 | 1188 | else |
| 1189 | 1189 | return $this->getAlternatingItemDisplay(); |
| 1190 | 1190 | } |
| 1191 | 1191 | else |
| 1192 | - return array($classPath,$this->_selectedItemTemplate); |
|
| 1192 | + return array($classPath, $this->_selectedItemTemplate); |
|
| 1193 | 1193 | } |
| 1194 | 1194 | |
| 1195 | 1195 | private function getEditItemDisplay($itemIndex) |
@@ -1197,7 +1197,7 @@ discard block |
||
| 1197 | 1197 | if(($classPath=$this->getEditItemRenderer())==='' && $this->_editItemTemplate===null) |
| 1198 | 1198 | return $this->getSelectedItemDisplay($itemIndex); |
| 1199 | 1199 | else |
| 1200 | - return array($classPath,$this->_editItemTemplate); |
|
| 1200 | + return array($classPath, $this->_editItemTemplate); |
|
| 1201 | 1201 | } |
| 1202 | 1202 | |
| 1203 | 1203 | /** |
@@ -1206,7 +1206,7 @@ discard block |
||
| 1206 | 1206 | * @param TListItemType item type |
| 1207 | 1207 | * @return TControl created datalist item |
| 1208 | 1208 | */ |
| 1209 | - protected function createItem($itemIndex,$itemType) |
|
| 1209 | + protected function createItem($itemIndex, $itemType) |
|
| 1210 | 1210 | { |
| 1211 | 1211 | $template=null; |
| 1212 | 1212 | $classPath=null; |
@@ -1217,13 +1217,13 @@ discard block |
||
| 1217 | 1217 | $template=$this->_itemTemplate; |
| 1218 | 1218 | break; |
| 1219 | 1219 | case TListItemType::AlternatingItem : |
| 1220 | - list($classPath,$template)=$this->getAlternatingItemDisplay(); |
|
| 1220 | + list($classPath, $template)=$this->getAlternatingItemDisplay(); |
|
| 1221 | 1221 | break; |
| 1222 | 1222 | case TListItemType::SelectedItem: |
| 1223 | - list($classPath,$template)=$this->getSelectedItemDisplay($itemIndex); |
|
| 1223 | + list($classPath, $template)=$this->getSelectedItemDisplay($itemIndex); |
|
| 1224 | 1224 | break; |
| 1225 | 1225 | case TListItemType::EditItem: |
| 1226 | - list($classPath,$template)=$this->getEditItemDisplay($itemIndex); |
|
| 1226 | + list($classPath, $template)=$this->getEditItemDisplay($itemIndex); |
|
| 1227 | 1227 | break; |
| 1228 | 1228 | case TListItemType::Header : |
| 1229 | 1229 | $classPath=$this->getHeaderRenderer(); |
@@ -1238,7 +1238,7 @@ discard block |
||
| 1238 | 1238 | $template=$this->_separatorTemplate; |
| 1239 | 1239 | break; |
| 1240 | 1240 | default: |
| 1241 | - throw new TInvalidDataValueException('datalist_itemtype_unknown',$itemType); |
|
| 1241 | + throw new TInvalidDataValueException('datalist_itemtype_unknown', $itemType); |
|
| 1242 | 1242 | } |
| 1243 | 1243 | if($classPath!=='') |
| 1244 | 1244 | { |
@@ -1286,9 +1286,9 @@ discard block |
||
| 1286 | 1286 | */ |
| 1287 | 1287 | protected function applyItemStyles() |
| 1288 | 1288 | { |
| 1289 | - $itemStyle=$this->getViewState('ItemStyle',null); |
|
| 1289 | + $itemStyle=$this->getViewState('ItemStyle', null); |
|
| 1290 | 1290 | |
| 1291 | - $alternatingItemStyle=$this->getViewState('AlternatingItemStyle',null); |
|
| 1291 | + $alternatingItemStyle=$this->getViewState('AlternatingItemStyle', null); |
|
| 1292 | 1292 | if($itemStyle!==null) |
| 1293 | 1293 | { |
| 1294 | 1294 | if($alternatingItemStyle===null) |
@@ -1297,9 +1297,9 @@ discard block |
||
| 1297 | 1297 | $alternatingItemStyle->mergeWith($itemStyle); |
| 1298 | 1298 | } |
| 1299 | 1299 | |
| 1300 | - $selectedItemStyle=$this->getViewState('SelectedItemStyle',null); |
|
| 1300 | + $selectedItemStyle=$this->getViewState('SelectedItemStyle', null); |
|
| 1301 | 1301 | |
| 1302 | - $editItemStyle=$this->getViewState('EditItemStyle',null); |
|
| 1302 | + $editItemStyle=$this->getViewState('EditItemStyle', null); |
|
| 1303 | 1303 | if($selectedItemStyle!==null) |
| 1304 | 1304 | { |
| 1305 | 1305 | if($editItemStyle===null) |
@@ -1311,14 +1311,14 @@ discard block |
||
| 1311 | 1311 | // apply header style if any |
| 1312 | 1312 | if($this->_header!==null && $this->_header instanceof IStyleable) |
| 1313 | 1313 | { |
| 1314 | - if($headerStyle=$this->getViewState('HeaderStyle',null)) |
|
| 1314 | + if($headerStyle=$this->getViewState('HeaderStyle', null)) |
|
| 1315 | 1315 | $this->_header->getStyle()->mergeWith($headerStyle); |
| 1316 | 1316 | } |
| 1317 | 1317 | |
| 1318 | 1318 | // apply footer style if any |
| 1319 | 1319 | if($this->_footer!==null && $this->_footer instanceof IStyleable) |
| 1320 | 1320 | { |
| 1321 | - if($footerStyle=$this->getViewState('FooterStyle',null)) |
|
| 1321 | + if($footerStyle=$this->getViewState('FooterStyle', null)) |
|
| 1322 | 1322 | $this->_footer->getStyle()->mergeWith($footerStyle); |
| 1323 | 1323 | } |
| 1324 | 1324 | |
@@ -1332,7 +1332,7 @@ discard block |
||
| 1332 | 1332 | $style=$editItemStyle; |
| 1333 | 1333 | else if($index===$selectedIndex) |
| 1334 | 1334 | $style=$selectedItemStyle; |
| 1335 | - else if($index%2===0) |
|
| 1335 | + else if($index % 2===0) |
|
| 1336 | 1336 | $style=$itemStyle; |
| 1337 | 1337 | else |
| 1338 | 1338 | $style=$alternatingItemStyle; |
@@ -1341,11 +1341,11 @@ discard block |
||
| 1341 | 1341 | } |
| 1342 | 1342 | |
| 1343 | 1343 | // apply separator style if any |
| 1344 | - if(($separatorStyle=$this->getViewState('SeparatorStyle',null))!==null && $this->getHasSeparators()) |
|
| 1344 | + if(($separatorStyle=$this->getViewState('SeparatorStyle', null))!==null && $this->getHasSeparators()) |
|
| 1345 | 1345 | { |
| 1346 | 1346 | $controls=$this->getControls(); |
| 1347 | 1347 | $count=$controls->getCount(); |
| 1348 | - for($i=$this->_header?2:1;$i<$count;$i+=2) |
|
| 1348 | + for($i=$this->_header ? 2 : 1; $i < $count; $i+=2) |
|
| 1349 | 1349 | { |
| 1350 | 1350 | if(($separator=$controls->itemAt($i)) instanceof IStyleable) |
| 1351 | 1351 | $separator->getStyle()->mergeWith($separatorStyle); |
@@ -1361,7 +1361,7 @@ discard block |
||
| 1361 | 1361 | { |
| 1362 | 1362 | parent::saveState(); |
| 1363 | 1363 | if($this->_items) |
| 1364 | - $this->setViewState('ItemCount',$this->_items->getCount(),0); |
|
| 1364 | + $this->setViewState('ItemCount', $this->_items->getCount(), 0); |
|
| 1365 | 1365 | else |
| 1366 | 1366 | $this->clearViewState('ItemCount'); |
| 1367 | 1367 | } |
@@ -1395,26 +1395,26 @@ discard block |
||
| 1395 | 1395 | protected function restoreItemsFromViewState() |
| 1396 | 1396 | { |
| 1397 | 1397 | $this->reset(); |
| 1398 | - if(($itemCount=$this->getViewState('ItemCount',0))>0) |
|
| 1398 | + if(($itemCount=$this->getViewState('ItemCount', 0)) > 0) |
|
| 1399 | 1399 | { |
| 1400 | 1400 | $items=$this->getItems(); |
| 1401 | 1401 | $selectedIndex=$this->getSelectedItemIndex(); |
| 1402 | 1402 | $editIndex=$this->getEditItemIndex(); |
| 1403 | 1403 | $hasSeparator=$this->_separatorTemplate!==null || $this->getSeparatorRenderer()!==''; |
| 1404 | - $this->_header=$this->createItemInternal(-1,TListItemType::Header); |
|
| 1405 | - for($i=0;$i<$itemCount;++$i) |
|
| 1404 | + $this->_header=$this->createItemInternal(-1, TListItemType::Header); |
|
| 1405 | + for($i=0; $i < $itemCount; ++$i) |
|
| 1406 | 1406 | { |
| 1407 | - if($hasSeparator && $i>0) |
|
| 1408 | - $this->createItemInternal($i-1,TListItemType::Separator); |
|
| 1407 | + if($hasSeparator && $i > 0) |
|
| 1408 | + $this->createItemInternal($i - 1, TListItemType::Separator); |
|
| 1409 | 1409 | if($i===$editIndex) |
| 1410 | 1410 | $itemType=TListItemType::EditItem; |
| 1411 | 1411 | else if($i===$selectedIndex) |
| 1412 | 1412 | $itemType=TListItemType::SelectedItem; |
| 1413 | 1413 | else |
| 1414 | - $itemType=$i%2?TListItemType::AlternatingItem : TListItemType::Item; |
|
| 1415 | - $items->add($this->createItemInternal($i,$itemType)); |
|
| 1414 | + $itemType=$i % 2 ? TListItemType::AlternatingItem : TListItemType::Item; |
|
| 1415 | + $items->add($this->createItemInternal($i, $itemType)); |
|
| 1416 | 1416 | } |
| 1417 | - $this->_footer=$this->createItemInternal(-1,TListItemType::Footer); |
|
| 1417 | + $this->_footer=$this->createItemInternal(-1, TListItemType::Footer); |
|
| 1418 | 1418 | } |
| 1419 | 1419 | else |
| 1420 | 1420 | $this->createEmptyContent(); |
@@ -1441,30 +1441,30 @@ discard block |
||
| 1441 | 1441 | foreach($data as $key=>$dataItem) |
| 1442 | 1442 | { |
| 1443 | 1443 | if($keyField!=='') |
| 1444 | - $keys->add($this->getDataFieldValue($dataItem,$keyField)); |
|
| 1444 | + $keys->add($this->getDataFieldValue($dataItem, $keyField)); |
|
| 1445 | 1445 | else |
| 1446 | 1446 | $keys->add($key); |
| 1447 | 1447 | if($itemIndex===0) |
| 1448 | - $this->_header=$this->createItemWithDataInternal(-1,TListItemType::Header,null); |
|
| 1449 | - if($hasSeparator && $itemIndex>0) |
|
| 1450 | - $this->createItemWithDataInternal($itemIndex-1,TListItemType::Separator,null); |
|
| 1448 | + $this->_header=$this->createItemWithDataInternal(-1, TListItemType::Header, null); |
|
| 1449 | + if($hasSeparator && $itemIndex > 0) |
|
| 1450 | + $this->createItemWithDataInternal($itemIndex - 1, TListItemType::Separator, null); |
|
| 1451 | 1451 | if($itemIndex===$editIndex) |
| 1452 | 1452 | $itemType=TListItemType::EditItem; |
| 1453 | 1453 | else if($itemIndex===$selectedIndex) |
| 1454 | 1454 | $itemType=TListItemType::SelectedItem; |
| 1455 | 1455 | else |
| 1456 | - $itemType=$itemIndex%2?TListItemType::AlternatingItem : TListItemType::Item; |
|
| 1457 | - $items->add($this->createItemWithDataInternal($itemIndex,$itemType,$dataItem)); |
|
| 1456 | + $itemType=$itemIndex % 2 ? TListItemType::AlternatingItem : TListItemType::Item; |
|
| 1457 | + $items->add($this->createItemWithDataInternal($itemIndex, $itemType, $dataItem)); |
|
| 1458 | 1458 | $itemIndex++; |
| 1459 | 1459 | } |
| 1460 | - if($itemIndex>0) |
|
| 1461 | - $this->_footer=$this->createItemWithDataInternal(-1,TListItemType::Footer,null); |
|
| 1460 | + if($itemIndex > 0) |
|
| 1461 | + $this->_footer=$this->createItemWithDataInternal(-1, TListItemType::Footer, null); |
|
| 1462 | 1462 | else |
| 1463 | 1463 | { |
| 1464 | 1464 | $this->createEmptyContent(); |
| 1465 | 1465 | $this->dataBindChildren(); |
| 1466 | 1466 | } |
| 1467 | - $this->setViewState('ItemCount',$itemIndex,0); |
|
| 1467 | + $this->setViewState('ItemCount', $itemIndex, 0); |
|
| 1468 | 1468 | } |
| 1469 | 1469 | |
| 1470 | 1470 | /** |
@@ -1476,11 +1476,11 @@ discard block |
||
| 1476 | 1476 | { |
| 1477 | 1477 | if($this->getHasControls()) |
| 1478 | 1478 | { |
| 1479 | - if($this->getItemCount()>0) |
|
| 1479 | + if($this->getItemCount() > 0) |
|
| 1480 | 1480 | { |
| 1481 | 1481 | $this->applyItemStyles(); |
| 1482 | 1482 | $repeatInfo=$this->getRepeatInfo(); |
| 1483 | - $repeatInfo->renderRepeater($writer,$this); |
|
| 1483 | + $repeatInfo->renderRepeater($writer, $this); |
|
| 1484 | 1484 | } |
| 1485 | 1485 | else if($this->_emptyTemplate!==null || $this->getEmptyRenderer()!=='') |
| 1486 | 1486 | parent::render($writer); |
@@ -1557,11 +1557,11 @@ discard block |
||
| 1557 | 1557 | * @param TControl original event sender |
| 1558 | 1558 | * @param TCommandEventParameter original event parameter |
| 1559 | 1559 | */ |
| 1560 | - public function __construct($item,$source,TCommandEventParameter $param) |
|
| 1560 | + public function __construct($item, $source, TCommandEventParameter $param) |
|
| 1561 | 1561 | { |
| 1562 | 1562 | $this->_item=$item; |
| 1563 | 1563 | $this->_source=$source; |
| 1564 | - parent::__construct($param->getCommandName(),$param->getCommandParameter()); |
|
| 1564 | + parent::__construct($param->getCommandName(), $param->getCommandParameter()); |
|
| 1565 | 1565 | } |
| 1566 | 1566 | |
| 1567 | 1567 | /** |
@@ -1653,7 +1653,7 @@ discard block |
||
| 1653 | 1653 | */ |
| 1654 | 1654 | public function setItemType($value) |
| 1655 | 1655 | { |
| 1656 | - $this->_itemType=TPropertyValue::ensureEnum($value,'TListItemType'); |
|
| 1656 | + $this->_itemType=TPropertyValue::ensureEnum($value, 'TListItemType'); |
|
| 1657 | 1657 | } |
| 1658 | 1658 | |
| 1659 | 1659 | /** |
@@ -1719,11 +1719,11 @@ discard block |
||
| 1719 | 1719 | * @param TEventParameter event parameter |
| 1720 | 1720 | * @return boolean whether the event bubbling should stop here. |
| 1721 | 1721 | */ |
| 1722 | - public function bubbleEvent($sender,$param) |
|
| 1722 | + public function bubbleEvent($sender, $param) |
|
| 1723 | 1723 | { |
| 1724 | 1724 | if($param instanceof TCommandEventParameter) |
| 1725 | 1725 | { |
| 1726 | - $this->raiseBubbleEvent($this,new TDataListCommandEventParameter($this,$sender,$param)); |
|
| 1726 | + $this->raiseBubbleEvent($this, new TDataListCommandEventParameter($this, $sender, $param)); |
|
| 1727 | 1727 | return true; |
| 1728 | 1728 | } |
| 1729 | 1729 | else |
@@ -1749,10 +1749,10 @@ discard block |
||
| 1749 | 1749 | * @param mixed new item |
| 1750 | 1750 | * @throws TInvalidDataTypeException if the item to be inserted is not a TControl descendant. |
| 1751 | 1751 | */ |
| 1752 | - public function insertAt($index,$item) |
|
| 1752 | + public function insertAt($index, $item) |
|
| 1753 | 1753 | { |
| 1754 | 1754 | if($item instanceof TControl) |
| 1755 | - parent::insertAt($index,$item); |
|
| 1755 | + parent::insertAt($index, $item); |
|
| 1756 | 1756 | else |
| 1757 | 1757 | throw new TInvalidDataTypeException('datalistitemcollection_datalistitem_required'); |
| 1758 | 1758 | } |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | if($object instanceof TDataGridColumn) |
| 243 | 243 | $this->getColumns()->add($object); |
| 244 | 244 | else |
| 245 | - parent::addParsedObject($object); // this is needed by EmptyTemplate |
|
| 245 | + parent::addParsedObject($object); // this is needed by EmptyTemplate |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | /** |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | */ |
| 281 | 281 | public function getItemCount() |
| 282 | 282 | { |
| 283 | - return $this->_items?$this->_items->getCount():0; |
|
| 283 | + return $this->_items ? $this->_items->getCount() : 0; |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | /** |
@@ -314,10 +314,10 @@ discard block |
||
| 314 | 314 | */ |
| 315 | 315 | public function getItemStyle() |
| 316 | 316 | { |
| 317 | - if(($style=$this->getViewState('ItemStyle',null))===null) |
|
| 317 | + if(($style=$this->getViewState('ItemStyle', null))===null) |
|
| 318 | 318 | { |
| 319 | 319 | $style=new TTableItemStyle; |
| 320 | - $this->setViewState('ItemStyle',$style,null); |
|
| 320 | + $this->setViewState('ItemStyle', $style, null); |
|
| 321 | 321 | } |
| 322 | 322 | return $style; |
| 323 | 323 | } |
@@ -327,10 +327,10 @@ discard block |
||
| 327 | 327 | */ |
| 328 | 328 | public function getAlternatingItemStyle() |
| 329 | 329 | { |
| 330 | - if(($style=$this->getViewState('AlternatingItemStyle',null))===null) |
|
| 330 | + if(($style=$this->getViewState('AlternatingItemStyle', null))===null) |
|
| 331 | 331 | { |
| 332 | 332 | $style=new TTableItemStyle; |
| 333 | - $this->setViewState('AlternatingItemStyle',$style,null); |
|
| 333 | + $this->setViewState('AlternatingItemStyle', $style, null); |
|
| 334 | 334 | } |
| 335 | 335 | return $style; |
| 336 | 336 | } |
@@ -340,10 +340,10 @@ discard block |
||
| 340 | 340 | */ |
| 341 | 341 | public function getSelectedItemStyle() |
| 342 | 342 | { |
| 343 | - if(($style=$this->getViewState('SelectedItemStyle',null))===null) |
|
| 343 | + if(($style=$this->getViewState('SelectedItemStyle', null))===null) |
|
| 344 | 344 | { |
| 345 | 345 | $style=new TTableItemStyle; |
| 346 | - $this->setViewState('SelectedItemStyle',$style,null); |
|
| 346 | + $this->setViewState('SelectedItemStyle', $style, null); |
|
| 347 | 347 | } |
| 348 | 348 | return $style; |
| 349 | 349 | } |
@@ -353,10 +353,10 @@ discard block |
||
| 353 | 353 | */ |
| 354 | 354 | public function getEditItemStyle() |
| 355 | 355 | { |
| 356 | - if(($style=$this->getViewState('EditItemStyle',null))===null) |
|
| 356 | + if(($style=$this->getViewState('EditItemStyle', null))===null) |
|
| 357 | 357 | { |
| 358 | 358 | $style=new TTableItemStyle; |
| 359 | - $this->setViewState('EditItemStyle',$style,null); |
|
| 359 | + $this->setViewState('EditItemStyle', $style, null); |
|
| 360 | 360 | } |
| 361 | 361 | return $style; |
| 362 | 362 | } |
@@ -366,10 +366,10 @@ discard block |
||
| 366 | 366 | */ |
| 367 | 367 | public function getHeaderStyle() |
| 368 | 368 | { |
| 369 | - if(($style=$this->getViewState('HeaderStyle',null))===null) |
|
| 369 | + if(($style=$this->getViewState('HeaderStyle', null))===null) |
|
| 370 | 370 | { |
| 371 | 371 | $style=new TTableItemStyle; |
| 372 | - $this->setViewState('HeaderStyle',$style,null); |
|
| 372 | + $this->setViewState('HeaderStyle', $style, null); |
|
| 373 | 373 | } |
| 374 | 374 | return $style; |
| 375 | 375 | } |
@@ -379,10 +379,10 @@ discard block |
||
| 379 | 379 | */ |
| 380 | 380 | public function getFooterStyle() |
| 381 | 381 | { |
| 382 | - if(($style=$this->getViewState('FooterStyle',null))===null) |
|
| 382 | + if(($style=$this->getViewState('FooterStyle', null))===null) |
|
| 383 | 383 | { |
| 384 | 384 | $style=new TTableItemStyle; |
| 385 | - $this->setViewState('FooterStyle',$style,null); |
|
| 385 | + $this->setViewState('FooterStyle', $style, null); |
|
| 386 | 386 | } |
| 387 | 387 | return $style; |
| 388 | 388 | } |
@@ -392,10 +392,10 @@ discard block |
||
| 392 | 392 | */ |
| 393 | 393 | public function getPagerStyle() |
| 394 | 394 | { |
| 395 | - if(($style=$this->getViewState('PagerStyle',null))===null) |
|
| 395 | + if(($style=$this->getViewState('PagerStyle', null))===null) |
|
| 396 | 396 | { |
| 397 | 397 | $style=new TDataGridPagerStyle; |
| 398 | - $this->setViewState('PagerStyle',$style,null); |
|
| 398 | + $this->setViewState('PagerStyle', $style, null); |
|
| 399 | 399 | } |
| 400 | 400 | return $style; |
| 401 | 401 | } |
@@ -406,10 +406,10 @@ discard block |
||
| 406 | 406 | */ |
| 407 | 407 | public function getTableHeadStyle() |
| 408 | 408 | { |
| 409 | - if(($style=$this->getViewState('TableHeadStyle',null))===null) |
|
| 409 | + if(($style=$this->getViewState('TableHeadStyle', null))===null) |
|
| 410 | 410 | { |
| 411 | 411 | $style=new TStyle; |
| 412 | - $this->setViewState('TableHeadStyle',$style,null); |
|
| 412 | + $this->setViewState('TableHeadStyle', $style, null); |
|
| 413 | 413 | } |
| 414 | 414 | return $style; |
| 415 | 415 | } |
@@ -420,10 +420,10 @@ discard block |
||
| 420 | 420 | */ |
| 421 | 421 | public function getTableBodyStyle() |
| 422 | 422 | { |
| 423 | - if(($style=$this->getViewState('TableBodyStyle',null))===null) |
|
| 423 | + if(($style=$this->getViewState('TableBodyStyle', null))===null) |
|
| 424 | 424 | { |
| 425 | 425 | $style=new TStyle; |
| 426 | - $this->setViewState('TableBodyStyle',$style,null); |
|
| 426 | + $this->setViewState('TableBodyStyle', $style, null); |
|
| 427 | 427 | } |
| 428 | 428 | return $style; |
| 429 | 429 | } |
@@ -434,10 +434,10 @@ discard block |
||
| 434 | 434 | */ |
| 435 | 435 | public function getTableFootStyle() |
| 436 | 436 | { |
| 437 | - if(($style=$this->getViewState('TableFootStyle',null))===null) |
|
| 437 | + if(($style=$this->getViewState('TableFootStyle', null))===null) |
|
| 438 | 438 | { |
| 439 | 439 | $style=new TStyle; |
| 440 | - $this->setViewState('TableFootStyle',$style,null); |
|
| 440 | + $this->setViewState('TableFootStyle', $style, null); |
|
| 441 | 441 | } |
| 442 | 442 | return $style; |
| 443 | 443 | } |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | */ |
| 448 | 448 | public function getCaption() |
| 449 | 449 | { |
| 450 | - return $this->getViewState('Caption',''); |
|
| 450 | + return $this->getViewState('Caption', ''); |
|
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | /** |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | */ |
| 456 | 456 | public function setCaption($value) |
| 457 | 457 | { |
| 458 | - $this->setViewState('Caption',$value,''); |
|
| 458 | + $this->setViewState('Caption', $value, ''); |
|
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | /** |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | */ |
| 464 | 464 | public function getCaptionAlign() |
| 465 | 465 | { |
| 466 | - return $this->getViewState('CaptionAlign',TTableCaptionAlign::NotSet); |
|
| 466 | + return $this->getViewState('CaptionAlign', TTableCaptionAlign::NotSet); |
|
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | /** |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | */ |
| 472 | 472 | public function setCaptionAlign($value) |
| 473 | 473 | { |
| 474 | - $this->setViewState('CaptionAlign',TPropertyValue::ensureEnum($value,'TTableCaptionAlign'),TTableCaptionAlign::NotSet); |
|
| 474 | + $this->setViewState('CaptionAlign', TPropertyValue::ensureEnum($value, 'TTableCaptionAlign'), TTableCaptionAlign::NotSet); |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | /** |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | { |
| 514 | 514 | $index=$this->getSelectedItemIndex(); |
| 515 | 515 | $items=$this->getItems(); |
| 516 | - if($index>=0 && $index<$items->getCount()) |
|
| 516 | + if($index >= 0 && $index < $items->getCount()) |
|
| 517 | 517 | return $items->itemAt($index); |
| 518 | 518 | else |
| 519 | 519 | return null; |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | */ |
| 526 | 526 | public function getSelectedItemIndex() |
| 527 | 527 | { |
| 528 | - return $this->getViewState('SelectedItemIndex',-1); |
|
| 528 | + return $this->getViewState('SelectedItemIndex', -1); |
|
| 529 | 529 | } |
| 530 | 530 | |
| 531 | 531 | /** |
@@ -537,20 +537,20 @@ discard block |
||
| 537 | 537 | */ |
| 538 | 538 | public function setSelectedItemIndex($value) |
| 539 | 539 | { |
| 540 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
| 540 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
| 541 | 541 | $value=-1; |
| 542 | 542 | if(($current=$this->getSelectedItemIndex())!==$value) |
| 543 | 543 | { |
| 544 | - $this->setViewState('SelectedItemIndex',$value,-1); |
|
| 544 | + $this->setViewState('SelectedItemIndex', $value, -1); |
|
| 545 | 545 | $items=$this->getItems(); |
| 546 | 546 | $itemCount=$items->getCount(); |
| 547 | - if($current>=0 && $current<$itemCount) |
|
| 547 | + if($current >= 0 && $current < $itemCount) |
|
| 548 | 548 | { |
| 549 | 549 | $item=$items->itemAt($current); |
| 550 | 550 | if($item->getItemType()!==TListItemType::EditItem) |
| 551 | - $item->setItemType($current%2?TListItemType::AlternatingItem:TListItemType::Item); |
|
| 551 | + $item->setItemType($current % 2 ? TListItemType::AlternatingItem : TListItemType::Item); |
|
| 552 | 552 | } |
| 553 | - if($value>=0 && $value<$itemCount) |
|
| 553 | + if($value >= 0 && $value < $itemCount) |
|
| 554 | 554 | { |
| 555 | 555 | $item=$items->itemAt($value); |
| 556 | 556 | if($item->getItemType()!==TListItemType::EditItem) |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | { |
| 567 | 567 | $index=$this->getEditItemIndex(); |
| 568 | 568 | $items=$this->getItems(); |
| 569 | - if($index>=0 && $index<$items->getCount()) |
|
| 569 | + if($index >= 0 && $index < $items->getCount()) |
|
| 570 | 570 | return $items->itemAt($index); |
| 571 | 571 | else |
| 572 | 572 | return null; |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | */ |
| 579 | 579 | public function getEditItemIndex() |
| 580 | 580 | { |
| 581 | - return $this->getViewState('EditItemIndex',-1); |
|
| 581 | + return $this->getViewState('EditItemIndex', -1); |
|
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | /** |
@@ -589,16 +589,16 @@ discard block |
||
| 589 | 589 | */ |
| 590 | 590 | public function setEditItemIndex($value) |
| 591 | 591 | { |
| 592 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
| 592 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
| 593 | 593 | $value=-1; |
| 594 | 594 | if(($current=$this->getEditItemIndex())!==$value) |
| 595 | 595 | { |
| 596 | - $this->setViewState('EditItemIndex',$value,-1); |
|
| 596 | + $this->setViewState('EditItemIndex', $value, -1); |
|
| 597 | 597 | $items=$this->getItems(); |
| 598 | 598 | $itemCount=$items->getCount(); |
| 599 | - if($current>=0 && $current<$itemCount) |
|
| 600 | - $items->itemAt($current)->setItemType($current%2?TListItemType::AlternatingItem:TListItemType::Item); |
|
| 601 | - if($value>=0 && $value<$itemCount) |
|
| 599 | + if($current >= 0 && $current < $itemCount) |
|
| 600 | + $items->itemAt($current)->setItemType($current % 2 ? TListItemType::AlternatingItem : TListItemType::Item); |
|
| 601 | + if($value >= 0 && $value < $itemCount) |
|
| 602 | 602 | $items->itemAt($value)->setItemType(TListItemType::EditItem); |
| 603 | 603 | } |
| 604 | 604 | } |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | */ |
| 609 | 609 | public function getAllowSorting() |
| 610 | 610 | { |
| 611 | - return $this->getViewState('AllowSorting',false); |
|
| 611 | + return $this->getViewState('AllowSorting', false); |
|
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | /** |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | */ |
| 617 | 617 | public function setAllowSorting($value) |
| 618 | 618 | { |
| 619 | - $this->setViewState('AllowSorting',TPropertyValue::ensureBoolean($value),false); |
|
| 619 | + $this->setViewState('AllowSorting', TPropertyValue::ensureBoolean($value), false); |
|
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | /** |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | */ |
| 625 | 625 | public function getAutoGenerateColumns() |
| 626 | 626 | { |
| 627 | - return $this->getViewState('AutoGenerateColumns',true); |
|
| 627 | + return $this->getViewState('AutoGenerateColumns', true); |
|
| 628 | 628 | } |
| 629 | 629 | |
| 630 | 630 | /** |
@@ -632,7 +632,7 @@ discard block |
||
| 632 | 632 | */ |
| 633 | 633 | public function setAutoGenerateColumns($value) |
| 634 | 634 | { |
| 635 | - $this->setViewState('AutoGenerateColumns',TPropertyValue::ensureBoolean($value),true); |
|
| 635 | + $this->setViewState('AutoGenerateColumns', TPropertyValue::ensureBoolean($value), true); |
|
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | /** |
@@ -640,7 +640,7 @@ discard block |
||
| 640 | 640 | */ |
| 641 | 641 | public function getShowHeader() |
| 642 | 642 | { |
| 643 | - return $this->getViewState('ShowHeader',true); |
|
| 643 | + return $this->getViewState('ShowHeader', true); |
|
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | /** |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | */ |
| 649 | 649 | public function setShowHeader($value) |
| 650 | 650 | { |
| 651 | - $this->setViewState('ShowHeader',TPropertyValue::ensureBoolean($value),true); |
|
| 651 | + $this->setViewState('ShowHeader', TPropertyValue::ensureBoolean($value), true); |
|
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | /** |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | */ |
| 657 | 657 | public function getShowFooter() |
| 658 | 658 | { |
| 659 | - return $this->getViewState('ShowFooter',false); |
|
| 659 | + return $this->getViewState('ShowFooter', false); |
|
| 660 | 660 | } |
| 661 | 661 | |
| 662 | 662 | /** |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | */ |
| 665 | 665 | public function setShowFooter($value) |
| 666 | 666 | { |
| 667 | - $this->setViewState('ShowFooter',TPropertyValue::ensureBoolean($value),false); |
|
| 667 | + $this->setViewState('ShowFooter', TPropertyValue::ensureBoolean($value), false); |
|
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | /** |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | if($value instanceof ITemplate || $value===null) |
| 685 | 685 | $this->_emptyTemplate=$value; |
| 686 | 686 | else |
| 687 | - throw new TInvalidDataTypeException('datagrid_template_required','EmptyTemplate'); |
|
| 687 | + throw new TInvalidDataTypeException('datagrid_template_required', 'EmptyTemplate'); |
|
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | /** |
@@ -700,57 +700,57 @@ discard block |
||
| 700 | 700 | * @param TEventParameter event parameter |
| 701 | 701 | * @return boolean whether the event bubbling should stop here. |
| 702 | 702 | */ |
| 703 | - public function bubbleEvent($sender,$param) |
|
| 703 | + public function bubbleEvent($sender, $param) |
|
| 704 | 704 | { |
| 705 | 705 | if($param instanceof TDataGridCommandEventParameter) |
| 706 | 706 | { |
| 707 | 707 | $this->onItemCommand($param); |
| 708 | 708 | $command=$param->getCommandName(); |
| 709 | - if(strcasecmp($command,self::CMD_SELECT)===0) |
|
| 709 | + if(strcasecmp($command, self::CMD_SELECT)===0) |
|
| 710 | 710 | { |
| 711 | 711 | $this->setSelectedItemIndex($param->getItem()->getItemIndex()); |
| 712 | 712 | $this->onSelectedIndexChanged($param); |
| 713 | 713 | return true; |
| 714 | 714 | } |
| 715 | - else if(strcasecmp($command,self::CMD_EDIT)===0) |
|
| 715 | + else if(strcasecmp($command, self::CMD_EDIT)===0) |
|
| 716 | 716 | { |
| 717 | 717 | $this->onEditCommand($param); |
| 718 | 718 | return true; |
| 719 | 719 | } |
| 720 | - else if(strcasecmp($command,self::CMD_DELETE)===0) |
|
| 720 | + else if(strcasecmp($command, self::CMD_DELETE)===0) |
|
| 721 | 721 | { |
| 722 | 722 | $this->onDeleteCommand($param); |
| 723 | 723 | return true; |
| 724 | 724 | } |
| 725 | - else if(strcasecmp($command,self::CMD_UPDATE)===0) |
|
| 725 | + else if(strcasecmp($command, self::CMD_UPDATE)===0) |
|
| 726 | 726 | { |
| 727 | 727 | $this->onUpdateCommand($param); |
| 728 | 728 | return true; |
| 729 | 729 | } |
| 730 | - else if(strcasecmp($command,self::CMD_CANCEL)===0) |
|
| 730 | + else if(strcasecmp($command, self::CMD_CANCEL)===0) |
|
| 731 | 731 | { |
| 732 | 732 | $this->onCancelCommand($param); |
| 733 | 733 | return true; |
| 734 | 734 | } |
| 735 | - else if(strcasecmp($command,self::CMD_SORT)===0) |
|
| 735 | + else if(strcasecmp($command, self::CMD_SORT)===0) |
|
| 736 | 736 | { |
| 737 | - $this->onSortCommand(new TDataGridSortCommandEventParameter($sender,$param)); |
|
| 737 | + $this->onSortCommand(new TDataGridSortCommandEventParameter($sender, $param)); |
|
| 738 | 738 | return true; |
| 739 | 739 | } |
| 740 | - else if(strcasecmp($command,self::CMD_PAGE)===0) |
|
| 740 | + else if(strcasecmp($command, self::CMD_PAGE)===0) |
|
| 741 | 741 | { |
| 742 | 742 | $p=$param->getCommandParameter(); |
| 743 | - if(strcasecmp($p,self::CMD_PAGE_NEXT)===0) |
|
| 744 | - $pageIndex=$this->getCurrentPageIndex()+1; |
|
| 745 | - else if(strcasecmp($p,self::CMD_PAGE_PREV)===0) |
|
| 746 | - $pageIndex=$this->getCurrentPageIndex()-1; |
|
| 747 | - else if(strcasecmp($p,self::CMD_PAGE_FIRST)===0) |
|
| 743 | + if(strcasecmp($p, self::CMD_PAGE_NEXT)===0) |
|
| 744 | + $pageIndex=$this->getCurrentPageIndex() + 1; |
|
| 745 | + else if(strcasecmp($p, self::CMD_PAGE_PREV)===0) |
|
| 746 | + $pageIndex=$this->getCurrentPageIndex() - 1; |
|
| 747 | + else if(strcasecmp($p, self::CMD_PAGE_FIRST)===0) |
|
| 748 | 748 | $pageIndex=0; |
| 749 | - else if(strcasecmp($p,self::CMD_PAGE_LAST)===0) |
|
| 750 | - $pageIndex=$this->getPageCount()-1; |
|
| 749 | + else if(strcasecmp($p, self::CMD_PAGE_LAST)===0) |
|
| 750 | + $pageIndex=$this->getPageCount() - 1; |
|
| 751 | 751 | else |
| 752 | - $pageIndex=TPropertyValue::ensureInteger($p)-1; |
|
| 753 | - $this->onPageIndexChanged(new TDataGridPageChangedEventParameter($sender,$pageIndex)); |
|
| 752 | + $pageIndex=TPropertyValue::ensureInteger($p) - 1; |
|
| 753 | + $this->onPageIndexChanged(new TDataGridPageChangedEventParameter($sender, $pageIndex)); |
|
| 754 | 754 | return true; |
| 755 | 755 | } |
| 756 | 756 | } |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | */ |
| 766 | 766 | public function onCancelCommand($param) |
| 767 | 767 | { |
| 768 | - $this->raiseEvent('OnCancelCommand',$this,$param); |
|
| 768 | + $this->raiseEvent('OnCancelCommand', $this, $param); |
|
| 769 | 769 | } |
| 770 | 770 | |
| 771 | 771 | /** |
@@ -776,7 +776,7 @@ discard block |
||
| 776 | 776 | */ |
| 777 | 777 | public function onDeleteCommand($param) |
| 778 | 778 | { |
| 779 | - $this->raiseEvent('OnDeleteCommand',$this,$param); |
|
| 779 | + $this->raiseEvent('OnDeleteCommand', $this, $param); |
|
| 780 | 780 | } |
| 781 | 781 | |
| 782 | 782 | /** |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | */ |
| 788 | 788 | public function onEditCommand($param) |
| 789 | 789 | { |
| 790 | - $this->raiseEvent('OnEditCommand',$this,$param); |
|
| 790 | + $this->raiseEvent('OnEditCommand', $this, $param); |
|
| 791 | 791 | } |
| 792 | 792 | |
| 793 | 793 | /** |
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | */ |
| 798 | 798 | public function onItemCommand($param) |
| 799 | 799 | { |
| 800 | - $this->raiseEvent('OnItemCommand',$this,$param); |
|
| 800 | + $this->raiseEvent('OnItemCommand', $this, $param); |
|
| 801 | 801 | } |
| 802 | 802 | |
| 803 | 803 | /** |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | */ |
| 809 | 809 | public function onSortCommand($param) |
| 810 | 810 | { |
| 811 | - $this->raiseEvent('OnSortCommand',$this,$param); |
|
| 811 | + $this->raiseEvent('OnSortCommand', $this, $param); |
|
| 812 | 812 | } |
| 813 | 813 | |
| 814 | 814 | /** |
@@ -819,7 +819,7 @@ discard block |
||
| 819 | 819 | */ |
| 820 | 820 | public function onUpdateCommand($param) |
| 821 | 821 | { |
| 822 | - $this->raiseEvent('OnUpdateCommand',$this,$param); |
|
| 822 | + $this->raiseEvent('OnUpdateCommand', $this, $param); |
|
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 | /** |
@@ -830,7 +830,7 @@ discard block |
||
| 830 | 830 | */ |
| 831 | 831 | public function onItemCreated($param) |
| 832 | 832 | { |
| 833 | - $this->raiseEvent('OnItemCreated',$this,$param); |
|
| 833 | + $this->raiseEvent('OnItemCreated', $this, $param); |
|
| 834 | 834 | } |
| 835 | 835 | |
| 836 | 836 | /** |
@@ -841,7 +841,7 @@ discard block |
||
| 841 | 841 | */ |
| 842 | 842 | public function onPagerCreated($param) |
| 843 | 843 | { |
| 844 | - $this->raiseEvent('OnPagerCreated',$this,$param); |
|
| 844 | + $this->raiseEvent('OnPagerCreated', $this, $param); |
|
| 845 | 845 | } |
| 846 | 846 | |
| 847 | 847 | /** |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | */ |
| 853 | 853 | public function onItemDataBound($param) |
| 854 | 854 | { |
| 855 | - $this->raiseEvent('OnItemDataBound',$this,$param); |
|
| 855 | + $this->raiseEvent('OnItemDataBound', $this, $param); |
|
| 856 | 856 | } |
| 857 | 857 | |
| 858 | 858 | /** |
@@ -862,7 +862,7 @@ discard block |
||
| 862 | 862 | */ |
| 863 | 863 | public function onPageIndexChanged($param) |
| 864 | 864 | { |
| 865 | - $this->raiseEvent('OnPageIndexChanged',$this,$param); |
|
| 865 | + $this->raiseEvent('OnPageIndexChanged', $this, $param); |
|
| 866 | 866 | } |
| 867 | 867 | |
| 868 | 868 | /** |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | if(!$this->getEnableViewState(true)) |
| 876 | 876 | return; |
| 877 | 877 | if($this->_items) |
| 878 | - $this->setViewState('ItemCount',$this->_items->getCount(),0); |
|
| 878 | + $this->setViewState('ItemCount', $this->_items->getCount(), 0); |
|
| 879 | 879 | else |
| 880 | 880 | $this->clearViewState('ItemCount'); |
| 881 | 881 | if($this->_autoColumns) |
@@ -883,7 +883,7 @@ discard block |
||
| 883 | 883 | $state=array(); |
| 884 | 884 | foreach($this->_autoColumns as $column) |
| 885 | 885 | $state[]=$column->saveState(); |
| 886 | - $this->setViewState('AutoColumns',$state,array()); |
|
| 886 | + $this->setViewState('AutoColumns', $state, array()); |
|
| 887 | 887 | } |
| 888 | 888 | else |
| 889 | 889 | $this->clearViewState('AutoColumns'); |
@@ -892,7 +892,7 @@ discard block |
||
| 892 | 892 | $state=array(); |
| 893 | 893 | foreach($this->_columns as $column) |
| 894 | 894 | $state[]=$column->saveState(); |
| 895 | - $this->setViewState('Columns',$state,array()); |
|
| 895 | + $this->setViewState('Columns', $state, array()); |
|
| 896 | 896 | } |
| 897 | 897 | else |
| 898 | 898 | $this->clearViewState('Columns'); |
@@ -909,7 +909,7 @@ discard block |
||
| 909 | 909 | return; |
| 910 | 910 | if(!$this->getIsDataBound()) |
| 911 | 911 | { |
| 912 | - $state=$this->getViewState('AutoColumns',array()); |
|
| 912 | + $state=$this->getViewState('AutoColumns', array()); |
|
| 913 | 913 | if(!empty($state)) |
| 914 | 914 | { |
| 915 | 915 | $this->_autoColumns=new TDataGridColumnCollection($this); |
@@ -922,7 +922,7 @@ discard block |
||
| 922 | 922 | } |
| 923 | 923 | else |
| 924 | 924 | $this->_autoColumns=null; |
| 925 | - $state=$this->getViewState('Columns',array()); |
|
| 925 | + $state=$this->getViewState('Columns', array()); |
|
| 926 | 926 | if($this->_columns && $this->_columns->getCount()===count($state)) |
| 927 | 927 | { |
| 928 | 928 | $i=0; |
@@ -959,8 +959,8 @@ discard block |
||
| 959 | 959 | |
| 960 | 960 | $allowPaging=$this->getAllowPaging(); |
| 961 | 961 | |
| 962 | - $itemCount=$this->getViewState('ItemCount',0); |
|
| 963 | - $dsIndex=$this->getViewState('DataSourceIndex',0); |
|
| 962 | + $itemCount=$this->getViewState('ItemCount', 0); |
|
| 963 | + $dsIndex=$this->getViewState('DataSourceIndex', 0); |
|
| 964 | 964 | |
| 965 | 965 | $columns=new TList($this->getColumns()); |
| 966 | 966 | $columns->mergeWith($this->_autoColumns); |
@@ -974,13 +974,13 @@ discard block |
||
| 974 | 974 | $column->initialize(); |
| 975 | 975 | $selectedIndex=$this->getSelectedItemIndex(); |
| 976 | 976 | $editIndex=$this->getEditItemIndex(); |
| 977 | - for($index=0;$index<$itemCount;++$index) |
|
| 977 | + for($index=0; $index < $itemCount; ++$index) |
|
| 978 | 978 | { |
| 979 | 979 | if($index===0) |
| 980 | 980 | { |
| 981 | 981 | if($allowPaging) |
| 982 | 982 | $this->_topPager=$this->createPager(); |
| 983 | - $this->_header=$this->createItemInternal(-1,-1,TListItemType::Header,false,null,$columns); |
|
| 983 | + $this->_header=$this->createItemInternal(-1, -1, TListItemType::Header, false, null, $columns); |
|
| 984 | 984 | } |
| 985 | 985 | if($index===$editIndex) |
| 986 | 986 | $itemType=TListItemType::EditItem; |
@@ -990,12 +990,12 @@ discard block |
||
| 990 | 990 | $itemType=TListItemType::AlternatingItem; |
| 991 | 991 | else |
| 992 | 992 | $itemType=TListItemType::Item; |
| 993 | - $items->add($this->createItemInternal($index,$dsIndex,$itemType,false,null,$columns)); |
|
| 993 | + $items->add($this->createItemInternal($index, $dsIndex, $itemType, false, null, $columns)); |
|
| 994 | 994 | $dsIndex++; |
| 995 | 995 | } |
| 996 | - if($index>0) |
|
| 996 | + if($index > 0) |
|
| 997 | 997 | { |
| 998 | - $this->_footer=$this->createItemInternal(-1,-1,TListItemType::Footer,false,null,$columns); |
|
| 998 | + $this->_footer=$this->createItemInternal(-1, -1, TListItemType::Footer, false, null, $columns); |
|
| 999 | 999 | if($allowPaging) |
| 1000 | 1000 | $this->_bottomPager=$this->createPager(); |
| 1001 | 1001 | } |
@@ -1035,8 +1035,8 @@ discard block |
||
| 1035 | 1035 | |
| 1036 | 1036 | $index=0; |
| 1037 | 1037 | $allowPaging=$this->getAllowPaging() && ($data instanceof TPagedDataSource); |
| 1038 | - $dsIndex=$allowPaging?$data->getFirstIndexInPage():0; |
|
| 1039 | - $this->setViewState('DataSourceIndex',$dsIndex,0); |
|
| 1038 | + $dsIndex=$allowPaging ? $data->getFirstIndexInPage() : 0; |
|
| 1039 | + $this->setViewState('DataSourceIndex', $dsIndex, 0); |
|
| 1040 | 1040 | if($columns->getCount()) |
| 1041 | 1041 | { |
| 1042 | 1042 | foreach($columns as $column) |
@@ -1047,14 +1047,14 @@ discard block |
||
| 1047 | 1047 | foreach($data as $key=>$row) |
| 1048 | 1048 | { |
| 1049 | 1049 | if($keyField!=='') |
| 1050 | - $keys->add($this->getDataFieldValue($row,$keyField)); |
|
| 1050 | + $keys->add($this->getDataFieldValue($row, $keyField)); |
|
| 1051 | 1051 | else |
| 1052 | 1052 | $keys->add($key); |
| 1053 | 1053 | if($index===0) |
| 1054 | 1054 | { |
| 1055 | 1055 | if($allowPaging) |
| 1056 | 1056 | $this->_topPager=$this->createPager(); |
| 1057 | - $this->_header=$this->createItemInternal(-1,-1,TListItemType::Header,true,null,$columns); |
|
| 1057 | + $this->_header=$this->createItemInternal(-1, -1, TListItemType::Header, true, null, $columns); |
|
| 1058 | 1058 | } |
| 1059 | 1059 | if($index===$editIndex) |
| 1060 | 1060 | $itemType=TListItemType::EditItem; |
@@ -1064,18 +1064,18 @@ discard block |
||
| 1064 | 1064 | $itemType=TListItemType::AlternatingItem; |
| 1065 | 1065 | else |
| 1066 | 1066 | $itemType=TListItemType::Item; |
| 1067 | - $items->add($this->createItemInternal($index,$dsIndex,$itemType,true,$row,$columns)); |
|
| 1067 | + $items->add($this->createItemInternal($index, $dsIndex, $itemType, true, $row, $columns)); |
|
| 1068 | 1068 | $index++; |
| 1069 | 1069 | $dsIndex++; |
| 1070 | 1070 | } |
| 1071 | - if($index>0) |
|
| 1071 | + if($index > 0) |
|
| 1072 | 1072 | { |
| 1073 | - $this->_footer=$this->createItemInternal(-1,-1,TListItemType::Footer,true,null,$columns); |
|
| 1073 | + $this->_footer=$this->createItemInternal(-1, -1, TListItemType::Footer, true, null, $columns); |
|
| 1074 | 1074 | if($allowPaging) |
| 1075 | 1075 | $this->_bottomPager=$this->createPager(); |
| 1076 | 1076 | } |
| 1077 | 1077 | } |
| 1078 | - $this->setViewState('ItemCount',$index,0); |
|
| 1078 | + $this->setViewState('ItemCount', $index, 0); |
|
| 1079 | 1079 | if(!$dsIndex && $this->_emptyTemplate!==null) |
| 1080 | 1080 | { |
| 1081 | 1081 | $this->_useEmptyTemplate=true; |
@@ -1122,7 +1122,7 @@ discard block |
||
| 1122 | 1122 | { |
| 1123 | 1123 | if(($rowSpan=$prevCell->getRowSpan())===0) |
| 1124 | 1124 | $rowSpan=1; |
| 1125 | - $prevCell->setRowSpan($rowSpan+1); |
|
| 1125 | + $prevCell->setRowSpan($rowSpan + 1); |
|
| 1126 | 1126 | $cell->setVisible(false); |
| 1127 | 1127 | } |
| 1128 | 1128 | } |
@@ -1150,15 +1150,15 @@ discard block |
||
| 1150 | 1150 | * @param TListItemType item type |
| 1151 | 1151 | * @return TDataGridItem created data list item |
| 1152 | 1152 | */ |
| 1153 | - protected function createItem($itemIndex,$dataSourceIndex,$itemType) |
|
| 1153 | + protected function createItem($itemIndex, $dataSourceIndex, $itemType) |
|
| 1154 | 1154 | { |
| 1155 | - return new TDataGridItem($itemIndex,$dataSourceIndex,$itemType); |
|
| 1155 | + return new TDataGridItem($itemIndex, $dataSourceIndex, $itemType); |
|
| 1156 | 1156 | } |
| 1157 | 1157 | |
| 1158 | - private function createItemInternal($itemIndex,$dataSourceIndex,$itemType,$dataBind,$dataItem,$columns) |
|
| 1158 | + private function createItemInternal($itemIndex, $dataSourceIndex, $itemType, $dataBind, $dataItem, $columns) |
|
| 1159 | 1159 | { |
| 1160 | - $item=$this->createItem($itemIndex,$dataSourceIndex,$itemType); |
|
| 1161 | - $this->initializeItem($item,$columns); |
|
| 1160 | + $item=$this->createItem($itemIndex, $dataSourceIndex, $itemType); |
|
| 1161 | + $this->initializeItem($item, $columns); |
|
| 1162 | 1162 | $param=new TDataGridItemEventParameter($item); |
| 1163 | 1163 | if($dataBind) |
| 1164 | 1164 | { |
@@ -1181,7 +1181,7 @@ discard block |
||
| 1181 | 1181 | * @param TDataGrid datagrid item to be initialized |
| 1182 | 1182 | * @param TDataGridColumnCollection datagrid columns to be used to initialize the cells in the item |
| 1183 | 1183 | */ |
| 1184 | - protected function initializeItem($item,$columns) |
|
| 1184 | + protected function initializeItem($item, $columns) |
|
| 1185 | 1185 | { |
| 1186 | 1186 | $cells=$item->getCells(); |
| 1187 | 1187 | $itemType=$item->getItemType(); |
@@ -1193,9 +1193,9 @@ discard block |
||
| 1193 | 1193 | else |
| 1194 | 1194 | $cell=new TTableCell; |
| 1195 | 1195 | if(($id=$column->getID())!=='') |
| 1196 | - $item->registerObject($id,$cell); |
|
| 1196 | + $item->registerObject($id, $cell); |
|
| 1197 | 1197 | $cells->add($cell); |
| 1198 | - $column->initializeCell($cell,$index,$itemType); |
|
| 1198 | + $column->initializeCell($cell, $index, $itemType); |
|
| 1199 | 1199 | $index++; |
| 1200 | 1200 | } |
| 1201 | 1201 | } |
@@ -1239,7 +1239,7 @@ discard block |
||
| 1239 | 1239 | * @param string CommandParameter corresponding to the OnCommand event of the button |
| 1240 | 1240 | * @return mixed the button instance |
| 1241 | 1241 | */ |
| 1242 | - protected function createPagerButton($pager,$buttonType,$enabled,$text,$commandName,$commandParameter) |
|
| 1242 | + protected function createPagerButton($pager, $buttonType, $enabled, $text, $commandName, $commandParameter) |
|
| 1243 | 1243 | { |
| 1244 | 1244 | if($buttonType===TDataGridPagerButtonType::LinkButton) |
| 1245 | 1245 | { |
@@ -1279,46 +1279,46 @@ discard block |
||
| 1279 | 1279 | { |
| 1280 | 1280 | if(($text=$style->getFirstPageText())!=='') |
| 1281 | 1281 | { |
| 1282 | - $label=$this->createPagerButton($pager,$buttonType,false,$text,'',''); |
|
| 1282 | + $label=$this->createPagerButton($pager, $buttonType, false, $text, '', ''); |
|
| 1283 | 1283 | $controls->add($label); |
| 1284 | 1284 | $controls->add("\n"); |
| 1285 | 1285 | } |
| 1286 | 1286 | |
| 1287 | - $label=$this->createPagerButton($pager,$buttonType,false,$style->getPrevPageText(),'',''); |
|
| 1287 | + $label=$this->createPagerButton($pager, $buttonType, false, $style->getPrevPageText(), '', ''); |
|
| 1288 | 1288 | $controls->add($label); |
| 1289 | 1289 | } |
| 1290 | 1290 | else |
| 1291 | 1291 | { |
| 1292 | 1292 | if(($text=$style->getFirstPageText())!=='') |
| 1293 | 1293 | { |
| 1294 | - $button=$this->createPagerButton($pager,$buttonType,true,$text,self::CMD_PAGE,self::CMD_PAGE_FIRST); |
|
| 1294 | + $button=$this->createPagerButton($pager, $buttonType, true, $text, self::CMD_PAGE, self::CMD_PAGE_FIRST); |
|
| 1295 | 1295 | $controls->add($button); |
| 1296 | 1296 | $controls->add("\n"); |
| 1297 | 1297 | } |
| 1298 | 1298 | |
| 1299 | - $button=$this->createPagerButton($pager,$buttonType,true,$style->getPrevPageText(),self::CMD_PAGE,self::CMD_PAGE_PREV); |
|
| 1299 | + $button=$this->createPagerButton($pager, $buttonType, true, $style->getPrevPageText(), self::CMD_PAGE, self::CMD_PAGE_PREV); |
|
| 1300 | 1300 | $controls->add($button); |
| 1301 | 1301 | } |
| 1302 | 1302 | $controls->add("\n"); |
| 1303 | - if($currentPageIndex===$this->getPageCount()-1) |
|
| 1303 | + if($currentPageIndex===$this->getPageCount() - 1) |
|
| 1304 | 1304 | { |
| 1305 | - $label=$this->createPagerButton($pager,$buttonType,false,$style->getNextPageText(),'',''); |
|
| 1305 | + $label=$this->createPagerButton($pager, $buttonType, false, $style->getNextPageText(), '', ''); |
|
| 1306 | 1306 | $controls->add($label); |
| 1307 | 1307 | if(($text=$style->getLastPageText())!=='') |
| 1308 | 1308 | { |
| 1309 | 1309 | $controls->add("\n"); |
| 1310 | - $label=$this->createPagerButton($pager,$buttonType,false,$text,'',''); |
|
| 1310 | + $label=$this->createPagerButton($pager, $buttonType, false, $text, '', ''); |
|
| 1311 | 1311 | $controls->add($label); |
| 1312 | 1312 | } |
| 1313 | 1313 | } |
| 1314 | 1314 | else |
| 1315 | 1315 | { |
| 1316 | - $button=$this->createPagerButton($pager,$buttonType,true,$style->getNextPageText(),self::CMD_PAGE,self::CMD_PAGE_NEXT); |
|
| 1316 | + $button=$this->createPagerButton($pager, $buttonType, true, $style->getNextPageText(), self::CMD_PAGE, self::CMD_PAGE_NEXT); |
|
| 1317 | 1317 | $controls->add($button); |
| 1318 | 1318 | if(($text=$style->getLastPageText())!=='') |
| 1319 | 1319 | { |
| 1320 | 1320 | $controls->add("\n"); |
| 1321 | - $button=$this->createPagerButton($pager,$buttonType,true,$text,self::CMD_PAGE,self::CMD_PAGE_LAST); |
|
| 1321 | + $button=$this->createPagerButton($pager, $buttonType, true, $text, self::CMD_PAGE, self::CMD_PAGE_LAST); |
|
| 1322 | 1322 | $controls->add($button); |
| 1323 | 1323 | } |
| 1324 | 1324 | } |
@@ -1334,63 +1334,63 @@ discard block |
||
| 1334 | 1334 | $buttonType=$style->getButtonType(); |
| 1335 | 1335 | $controls=$pager->getControls(); |
| 1336 | 1336 | $pageCount=$this->getPageCount(); |
| 1337 | - $pageIndex=$this->getCurrentPageIndex()+1; |
|
| 1337 | + $pageIndex=$this->getCurrentPageIndex() + 1; |
|
| 1338 | 1338 | $maxButtonCount=$style->getPageButtonCount(); |
| 1339 | - $buttonCount=$maxButtonCount>$pageCount?$pageCount:$maxButtonCount; |
|
| 1339 | + $buttonCount=$maxButtonCount > $pageCount ? $pageCount : $maxButtonCount; |
|
| 1340 | 1340 | $startPageIndex=1; |
| 1341 | 1341 | $endPageIndex=$buttonCount; |
| 1342 | - if($pageIndex>$endPageIndex) |
|
| 1342 | + if($pageIndex > $endPageIndex) |
|
| 1343 | 1343 | { |
| 1344 | - $startPageIndex=((int)(($pageIndex-1)/$maxButtonCount))*$maxButtonCount+1; |
|
| 1345 | - if(($endPageIndex=$startPageIndex+$maxButtonCount-1)>$pageCount) |
|
| 1344 | + $startPageIndex=((int) (($pageIndex - 1) / $maxButtonCount)) * $maxButtonCount + 1; |
|
| 1345 | + if(($endPageIndex=$startPageIndex + $maxButtonCount - 1) > $pageCount) |
|
| 1346 | 1346 | $endPageIndex=$pageCount; |
| 1347 | - if($endPageIndex-$startPageIndex+1<$maxButtonCount) |
|
| 1347 | + if($endPageIndex - $startPageIndex + 1 < $maxButtonCount) |
|
| 1348 | 1348 | { |
| 1349 | - if(($startPageIndex=$endPageIndex-$maxButtonCount+1)<1) |
|
| 1349 | + if(($startPageIndex=$endPageIndex - $maxButtonCount + 1) < 1) |
|
| 1350 | 1350 | $startPageIndex=1; |
| 1351 | 1351 | } |
| 1352 | 1352 | } |
| 1353 | 1353 | |
| 1354 | - if($startPageIndex>1) |
|
| 1354 | + if($startPageIndex > 1) |
|
| 1355 | 1355 | { |
| 1356 | 1356 | if(($text=$style->getFirstPageText())!=='') |
| 1357 | 1357 | { |
| 1358 | - $button=$this->createPagerButton($pager,$buttonType,true,$text,self::CMD_PAGE,self::CMD_PAGE_FIRST); |
|
| 1358 | + $button=$this->createPagerButton($pager, $buttonType, true, $text, self::CMD_PAGE, self::CMD_PAGE_FIRST); |
|
| 1359 | 1359 | $controls->add($button); |
| 1360 | 1360 | $controls->add("\n"); |
| 1361 | 1361 | } |
| 1362 | - $prevPageIndex=$startPageIndex-1; |
|
| 1363 | - $button=$this->createPagerButton($pager,$buttonType,true,$style->getPrevPageText(),self::CMD_PAGE,"$prevPageIndex"); |
|
| 1362 | + $prevPageIndex=$startPageIndex - 1; |
|
| 1363 | + $button=$this->createPagerButton($pager, $buttonType, true, $style->getPrevPageText(), self::CMD_PAGE, "$prevPageIndex"); |
|
| 1364 | 1364 | $controls->add($button); |
| 1365 | 1365 | $controls->add("\n"); |
| 1366 | 1366 | } |
| 1367 | 1367 | |
| 1368 | - for($i=$startPageIndex;$i<=$endPageIndex;++$i) |
|
| 1368 | + for($i=$startPageIndex; $i <= $endPageIndex; ++$i) |
|
| 1369 | 1369 | { |
| 1370 | 1370 | if($i===$pageIndex) |
| 1371 | 1371 | { |
| 1372 | - $label=$this->createPagerButton($pager,$buttonType,false,"$i",'',''); |
|
| 1372 | + $label=$this->createPagerButton($pager, $buttonType, false, "$i", '', ''); |
|
| 1373 | 1373 | $controls->add($label); |
| 1374 | 1374 | } |
| 1375 | 1375 | else |
| 1376 | 1376 | { |
| 1377 | - $button=$this->createPagerButton($pager,$buttonType,true,"$i",self::CMD_PAGE,"$i"); |
|
| 1377 | + $button=$this->createPagerButton($pager, $buttonType, true, "$i", self::CMD_PAGE, "$i"); |
|
| 1378 | 1378 | $controls->add($button); |
| 1379 | 1379 | } |
| 1380 | - if($i<$endPageIndex) |
|
| 1380 | + if($i < $endPageIndex) |
|
| 1381 | 1381 | $controls->add("\n"); |
| 1382 | 1382 | } |
| 1383 | 1383 | |
| 1384 | - if($pageCount>$endPageIndex) |
|
| 1384 | + if($pageCount > $endPageIndex) |
|
| 1385 | 1385 | { |
| 1386 | 1386 | $controls->add("\n"); |
| 1387 | - $nextPageIndex=$endPageIndex+1; |
|
| 1388 | - $button=$this->createPagerButton($pager,$buttonType,true,$style->getNextPageText(),self::CMD_PAGE,"$nextPageIndex"); |
|
| 1387 | + $nextPageIndex=$endPageIndex + 1; |
|
| 1388 | + $button=$this->createPagerButton($pager, $buttonType, true, $style->getNextPageText(), self::CMD_PAGE, "$nextPageIndex"); |
|
| 1389 | 1389 | $controls->add($button); |
| 1390 | 1390 | if(($text=$style->getLastPageText())!=='') |
| 1391 | 1391 | { |
| 1392 | 1392 | $controls->add("\n"); |
| 1393 | - $button=$this->createPagerButton($pager,$buttonType,true,$text,self::CMD_PAGE,self::CMD_PAGE_LAST); |
|
| 1393 | + $button=$this->createPagerButton($pager, $buttonType, true, $text, self::CMD_PAGE, self::CMD_PAGE_LAST); |
|
| 1394 | 1394 | $controls->add($button); |
| 1395 | 1395 | } |
| 1396 | 1396 | } |
@@ -1445,9 +1445,9 @@ discard block |
||
| 1445 | 1445 | */ |
| 1446 | 1446 | protected function applyItemStyles() |
| 1447 | 1447 | { |
| 1448 | - $itemStyle=$this->getViewState('ItemStyle',null); |
|
| 1448 | + $itemStyle=$this->getViewState('ItemStyle', null); |
|
| 1449 | 1449 | |
| 1450 | - $alternatingItemStyle=$this->getViewState('AlternatingItemStyle',null); |
|
| 1450 | + $alternatingItemStyle=$this->getViewState('AlternatingItemStyle', null); |
|
| 1451 | 1451 | if($itemStyle!==null) |
| 1452 | 1452 | { |
| 1453 | 1453 | if($alternatingItemStyle===null) |
@@ -1456,9 +1456,9 @@ discard block |
||
| 1456 | 1456 | $alternatingItemStyle->mergeWith($itemStyle); |
| 1457 | 1457 | } |
| 1458 | 1458 | |
| 1459 | - $selectedItemStyle=$this->getViewState('SelectedItemStyle',null); |
|
| 1459 | + $selectedItemStyle=$this->getViewState('SelectedItemStyle', null); |
|
| 1460 | 1460 | |
| 1461 | - $editItemStyle=$this->getViewState('EditItemStyle',null); |
|
| 1461 | + $editItemStyle=$this->getViewState('EditItemStyle', null); |
|
| 1462 | 1462 | if($selectedItemStyle!==null) |
| 1463 | 1463 | { |
| 1464 | 1464 | if($editItemStyle===null) |
@@ -1467,10 +1467,10 @@ discard block |
||
| 1467 | 1467 | $editItemStyle->mergeWith($selectedItemStyle); |
| 1468 | 1468 | } |
| 1469 | 1469 | |
| 1470 | - $headerStyle=$this->getViewState('HeaderStyle',null); |
|
| 1471 | - $footerStyle=$this->getViewState('FooterStyle',null); |
|
| 1472 | - $pagerStyle=$this->getViewState('PagerStyle',null); |
|
| 1473 | - $separatorStyle=$this->getViewState('SeparatorStyle',null); |
|
| 1470 | + $headerStyle=$this->getViewState('HeaderStyle', null); |
|
| 1471 | + $footerStyle=$this->getViewState('FooterStyle', null); |
|
| 1472 | + $pagerStyle=$this->getViewState('PagerStyle', null); |
|
| 1473 | + $separatorStyle=$this->getViewState('SeparatorStyle', null); |
|
| 1474 | 1474 | |
| 1475 | 1475 | foreach($this->getControls() as $index=>$item) |
| 1476 | 1476 | { |
@@ -1554,7 +1554,7 @@ discard block |
||
| 1554 | 1554 | { |
| 1555 | 1555 | $n=$this->_columns->getCount(); |
| 1556 | 1556 | $cells=$item->getCells(); |
| 1557 | - for($i=0;$i<$n;++$i) |
|
| 1557 | + for($i=0; $i < $n; ++$i) |
|
| 1558 | 1558 | { |
| 1559 | 1559 | $cell=$cells->itemAt($i); |
| 1560 | 1560 | $column=$this->_columns->itemAt($i); |
@@ -1586,7 +1586,7 @@ discard block |
||
| 1586 | 1586 | if(($caption=$this->getCaption())!=='') |
| 1587 | 1587 | { |
| 1588 | 1588 | if(($align=$this->getCaptionAlign())!==TTableCaptionAlign::NotSet) |
| 1589 | - $writer->addAttribute('align',strtolower($align)); |
|
| 1589 | + $writer->addAttribute('align', strtolower($align)); |
|
| 1590 | 1590 | $writer->renderBeginTag('caption'); |
| 1591 | 1591 | $writer->write($caption); |
| 1592 | 1592 | $writer->renderEndTag(); |
@@ -1613,7 +1613,7 @@ discard block |
||
| 1613 | 1613 | $this->renderContents($writer); |
| 1614 | 1614 | $control->renderEndTag($writer); |
| 1615 | 1615 | } |
| 1616 | - else if($this->getViewState('ItemCount',0)>0) |
|
| 1616 | + else if($this->getViewState('ItemCount', 0) > 0) |
|
| 1617 | 1617 | { |
| 1618 | 1618 | $this->applyItemStyles(); |
| 1619 | 1619 | if($this->_topPager) |
@@ -1641,14 +1641,14 @@ discard block |
||
| 1641 | 1641 | if($this->_header && $this->_header->getVisible()) |
| 1642 | 1642 | { |
| 1643 | 1643 | $writer->writeLine(); |
| 1644 | - if($style=$this->getViewState('TableHeadStyle',null)) |
|
| 1644 | + if($style=$this->getViewState('TableHeadStyle', null)) |
|
| 1645 | 1645 | $style->addAttributesToRender($writer); |
| 1646 | 1646 | $writer->renderBeginTag('thead'); |
| 1647 | 1647 | $this->_header->render($writer); |
| 1648 | 1648 | $writer->renderEndTag(); |
| 1649 | 1649 | } |
| 1650 | 1650 | $writer->writeLine(); |
| 1651 | - if($style=$this->getViewState('TableBodyStyle',null)) |
|
| 1651 | + if($style=$this->getViewState('TableBodyStyle', null)) |
|
| 1652 | 1652 | $style->addAttributesToRender($writer); |
| 1653 | 1653 | $writer->renderBeginTag('tbody'); |
| 1654 | 1654 | foreach($this->getItems() as $item) |
@@ -1658,7 +1658,7 @@ discard block |
||
| 1658 | 1658 | if($this->_footer && $this->_footer->getVisible()) |
| 1659 | 1659 | { |
| 1660 | 1660 | $writer->writeLine(); |
| 1661 | - if($style=$this->getViewState('TableFootStyle',null)) |
|
| 1661 | + if($style=$this->getViewState('TableFootStyle', null)) |
|
| 1662 | 1662 | $style->addAttributesToRender($writer); |
| 1663 | 1663 | $writer->renderBeginTag('tfoot'); |
| 1664 | 1664 | $this->_footer->render($writer); |
@@ -1775,11 +1775,11 @@ discard block |
||
| 1775 | 1775 | * @param TControl original event sender |
| 1776 | 1776 | * @param TCommandEventParameter original event parameter |
| 1777 | 1777 | */ |
| 1778 | - public function __construct($item,$source,TCommandEventParameter $param) |
|
| 1778 | + public function __construct($item, $source, TCommandEventParameter $param) |
|
| 1779 | 1779 | { |
| 1780 | 1780 | $this->_item=$item; |
| 1781 | 1781 | $this->_source=$source; |
| 1782 | - parent::__construct($param->getCommandName(),$param->getCommandParameter()); |
|
| 1782 | + parent::__construct($param->getCommandName(), $param->getCommandParameter()); |
|
| 1783 | 1783 | } |
| 1784 | 1784 | |
| 1785 | 1785 | /** |
@@ -1829,7 +1829,7 @@ discard block |
||
| 1829 | 1829 | * @param TControl the control originally raises the <b>OnCommand</b> event. |
| 1830 | 1830 | * @param TDataGridCommandEventParameter command event parameter |
| 1831 | 1831 | */ |
| 1832 | - public function __construct($source,TDataGridCommandEventParameter $param) |
|
| 1832 | + public function __construct($source, TDataGridCommandEventParameter $param) |
|
| 1833 | 1833 | { |
| 1834 | 1834 | $this->_source=$source; |
| 1835 | 1835 | $this->_sortExpression=$param->getCommandParameter(); |
@@ -1882,7 +1882,7 @@ discard block |
||
| 1882 | 1882 | * @param TControl the control originally raises the <b>OnCommand</b> event. |
| 1883 | 1883 | * @param integer new page index |
| 1884 | 1884 | */ |
| 1885 | - public function __construct($source,$newPageIndex) |
|
| 1885 | + public function __construct($source, $newPageIndex) |
|
| 1886 | 1886 | { |
| 1887 | 1887 | $this->_source=$source; |
| 1888 | 1888 | $this->_newIndex=$newPageIndex; |
@@ -1945,7 +1945,7 @@ discard block |
||
| 1945 | 1945 | * @param integer zero-based index of the item in the item collection of datagrid |
| 1946 | 1946 | * @param TListItemType item type |
| 1947 | 1947 | */ |
| 1948 | - public function __construct($itemIndex,$dataSourceIndex,$itemType) |
|
| 1948 | + public function __construct($itemIndex, $dataSourceIndex, $itemType) |
|
| 1949 | 1949 | { |
| 1950 | 1950 | $this->_itemIndex=$itemIndex; |
| 1951 | 1951 | $this->_dataSourceIndex=$dataSourceIndex; |
@@ -1969,7 +1969,7 @@ discard block |
||
| 1969 | 1969 | */ |
| 1970 | 1970 | public function setItemType($value) |
| 1971 | 1971 | { |
| 1972 | - $this->_itemType=TPropertyValue::ensureEnum($value,'TListItemType'); |
|
| 1972 | + $this->_itemType=TPropertyValue::ensureEnum($value, 'TListItemType'); |
|
| 1973 | 1973 | } |
| 1974 | 1974 | |
| 1975 | 1975 | /** |
@@ -2033,11 +2033,11 @@ discard block |
||
| 2033 | 2033 | * @param TEventParameter event parameter |
| 2034 | 2034 | * @return boolean whether the event bubbling should stop here. |
| 2035 | 2035 | */ |
| 2036 | - public function bubbleEvent($sender,$param) |
|
| 2036 | + public function bubbleEvent($sender, $param) |
|
| 2037 | 2037 | { |
| 2038 | 2038 | if($param instanceof TCommandEventParameter) |
| 2039 | 2039 | { |
| 2040 | - $this->raiseBubbleEvent($this,new TDataGridCommandEventParameter($this,$sender,$param)); |
|
| 2040 | + $this->raiseBubbleEvent($this, new TDataGridCommandEventParameter($this, $sender, $param)); |
|
| 2041 | 2041 | return true; |
| 2042 | 2042 | } |
| 2043 | 2043 | else |
@@ -2075,11 +2075,11 @@ discard block |
||
| 2075 | 2075 | * @param TEventParameter event parameter |
| 2076 | 2076 | * @return boolean whether the event bubbling should stop here. |
| 2077 | 2077 | */ |
| 2078 | - public function bubbleEvent($sender,$param) |
|
| 2078 | + public function bubbleEvent($sender, $param) |
|
| 2079 | 2079 | { |
| 2080 | 2080 | if($param instanceof TCommandEventParameter) |
| 2081 | 2081 | { |
| 2082 | - $this->raiseBubbleEvent($this,new TDataGridCommandEventParameter($this,$sender,$param)); |
|
| 2082 | + $this->raiseBubbleEvent($this, new TDataGridCommandEventParameter($this, $sender, $param)); |
|
| 2083 | 2083 | return true; |
| 2084 | 2084 | } |
| 2085 | 2085 | else |
@@ -2122,10 +2122,10 @@ discard block |
||
| 2122 | 2122 | * @param mixed new item |
| 2123 | 2123 | * @throws TInvalidDataTypeException if the item to be inserted is not a TDataGridItem. |
| 2124 | 2124 | */ |
| 2125 | - public function insertAt($index,$item) |
|
| 2125 | + public function insertAt($index, $item) |
|
| 2126 | 2126 | { |
| 2127 | 2127 | if($item instanceof TDataGridItem) |
| 2128 | - parent::insertAt($index,$item); |
|
| 2128 | + parent::insertAt($index, $item); |
|
| 2129 | 2129 | else |
| 2130 | 2130 | throw new TInvalidDataTypeException('datagriditemcollection_datagriditem_required'); |
| 2131 | 2131 | } |
@@ -2172,12 +2172,12 @@ discard block |
||
| 2172 | 2172 | * @param mixed new item |
| 2173 | 2173 | * @throws TInvalidDataTypeException if the item to be inserted is not a TDataGridColumn. |
| 2174 | 2174 | */ |
| 2175 | - public function insertAt($index,$item) |
|
| 2175 | + public function insertAt($index, $item) |
|
| 2176 | 2176 | { |
| 2177 | 2177 | if($item instanceof TDataGridColumn) |
| 2178 | 2178 | { |
| 2179 | 2179 | $item->setOwner($this->_o); |
| 2180 | - parent::insertAt($index,$item); |
|
| 2180 | + parent::insertAt($index, $item); |
|
| 2181 | 2181 | } |
| 2182 | 2182 | else |
| 2183 | 2183 | throw new TInvalidDataTypeException('datagridcolumncollection_datagridcolumn_required'); |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | { |
| 40 | 40 | if(($id=$this->getID())==='') |
| 41 | 41 | throw new TConfigurationException('contentplaceholder_id_required'); |
| 42 | - $this->getTemplateControl()->registerContentPlaceHolder($id,$this); |
|
| 42 | + $this->getTemplateControl()->registerContentPlaceHolder($id, $this); |
|
| 43 | 43 | $parent->getControls()->add($this); |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | public function addParsedObject($object) |
| 44 | 44 | { |
| 45 | 45 | if(is_string($object)) |
| 46 | - $object=html_entity_decode($object,ENT_QUOTES,'UTF-8'); |
|
| 46 | + $object=html_entity_decode($object, ENT_QUOTES, 'UTF-8'); |
|
| 47 | 47 | parent::addParsedObject($object); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function getText() |
| 54 | 54 | { |
| 55 | - return $this->getViewState('Text',''); |
|
| 55 | + return $this->getViewState('Text', ''); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public function setText($value) |
| 62 | 62 | { |
| 63 | - $this->setViewState('Text',$value); |
|
| 63 | + $this->setViewState('Text', $value); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | if(($text=$this->getText())==='' && $this->getHasControls()) |
| 75 | 75 | { |
| 76 | - $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
| 76 | + $htmlWriter=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
| 77 | 77 | parent::renderContents($htmlWriter); |
| 78 | 78 | $text=$htmlWriter->flush(); |
| 79 | 79 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function getDataField() |
| 40 | 40 | { |
| 41 | - return $this->getViewState('DataField',''); |
|
| 41 | + return $this->getViewState('DataField', ''); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function setDataField($value) |
| 48 | 48 | { |
| 49 | - $this->setViewState('DataField',$value,''); |
|
| 49 | + $this->setViewState('DataField', $value, ''); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function getDataFormatString() |
| 56 | 56 | { |
| 57 | - return $this->getViewState('DataFormatString',''); |
|
| 57 | + return $this->getViewState('DataFormatString', ''); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function setDataFormatString($value) |
| 64 | 64 | { |
| 65 | - $this->setViewState('DataFormatString',$value,''); |
|
| 65 | + $this->setViewState('DataFormatString', $value, ''); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function getText() |
| 72 | 72 | { |
| 73 | - return $this->getViewState('Text',''); |
|
| 73 | + return $this->getViewState('Text', ''); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function setText($value) |
| 80 | 80 | { |
| 81 | - $this->setViewState('Text',$value,''); |
|
| 81 | + $this->setViewState('Text', $value, ''); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function getEncode() |
| 88 | 88 | { |
| 89 | - return $this->getViewState('Encode',false); |
|
| 89 | + return $this->getViewState('Encode', false); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function setEncode($value) |
| 96 | 96 | { |
| 97 | - $this->setViewState('Encode',TPropertyValue::ensureBoolean($value),false); |
|
| 97 | + $this->setViewState('Encode', TPropertyValue::ensureBoolean($value), false); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -104,13 +104,13 @@ discard block |
||
| 104 | 104 | * @param integer the index to the Columns property that the cell resides in. |
| 105 | 105 | * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem) |
| 106 | 106 | */ |
| 107 | - public function initializeCell($cell,$columnIndex,$itemType) |
|
| 107 | + public function initializeCell($cell, $columnIndex, $itemType) |
|
| 108 | 108 | { |
| 109 | 109 | if($itemType===TListItemType::Item || $itemType===TListItemType::AlternatingItem || $itemType===TListItemType::EditItem || $itemType===TListItemType::SelectedItem) |
| 110 | 110 | { |
| 111 | 111 | if($this->getDataField()!=='') |
| 112 | 112 | { |
| 113 | - $cell->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
|
| 113 | + $cell->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn')); |
|
| 114 | 114 | } else { |
| 115 | 115 | $text=$this->getText(); |
| 116 | 116 | if($this->getEncode()) |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | else |
| 122 | - parent::initializeCell($cell,$columnIndex,$itemType); |
|
| 122 | + parent::initializeCell($cell, $columnIndex, $itemType); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -127,15 +127,15 @@ discard block |
||
| 127 | 127 | * This method is invoked when datagrid performs databinding. |
| 128 | 128 | * It populates the content of the cell with the relevant data from data source. |
| 129 | 129 | */ |
| 130 | - public function dataBindColumn($sender,$param) |
|
| 130 | + public function dataBindColumn($sender, $param) |
|
| 131 | 131 | { |
| 132 | 132 | $item=$sender->getNamingContainer(); |
| 133 | 133 | $data=$item->getData(); |
| 134 | 134 | $formatString=$this->getDataFormatString(); |
| 135 | 135 | if(($field=$this->getDataField())!=='') |
| 136 | - $value=$this->formatDataValue($formatString,$this->getDataFieldValue($data,$field)); |
|
| 136 | + $value=$this->formatDataValue($formatString, $this->getDataFieldValue($data, $field)); |
|
| 137 | 137 | else |
| 138 | - $value=$this->formatDataValue($formatString,$data); |
|
| 138 | + $value=$this->formatDataValue($formatString, $data); |
|
| 139 | 139 | if($sender instanceof TTableCell) |
| 140 | 140 | { |
| 141 | 141 | if($this->getEncode()) |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function getTokenImageTheme() |
| 73 | 73 | { |
| 74 | - return $this->getViewState('TokenImageTheme',0); |
|
| 74 | + return $this->getViewState('TokenImageTheme', 0); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | public function setTokenImageTheme($value) |
| 91 | 91 | { |
| 92 | 92 | $value=TPropertyValue::ensureInteger($value); |
| 93 | - if($value>=0 && $value<=63) |
|
| 94 | - $this->setViewState('TokenImageTheme',$value,0); |
|
| 93 | + if($value >= 0 && $value <= 63) |
|
| 94 | + $this->setViewState('TokenImageTheme', $value, 0); |
|
| 95 | 95 | else |
| 96 | - throw new TConfigurationException('captcha_tokenimagetheme_invalid',0,63); |
|
| 96 | + throw new TConfigurationException('captcha_tokenimagetheme_invalid', 0, 63); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public function getTokenFontSize() |
| 103 | 103 | { |
| 104 | - return $this->getViewState('TokenFontSize',30); |
|
| 104 | + return $this->getViewState('TokenFontSize', 30); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
@@ -113,10 +113,10 @@ discard block |
||
| 113 | 113 | public function setTokenFontSize($value) |
| 114 | 114 | { |
| 115 | 115 | $value=TPropertyValue::ensureInteger($value); |
| 116 | - if($value>=20 && $value<=100) |
|
| 117 | - $this->setViewState('TokenFontSize',$value,30); |
|
| 116 | + if($value >= 20 && $value <= 100) |
|
| 117 | + $this->setViewState('TokenFontSize', $value, 30); |
|
| 118 | 118 | else |
| 119 | - throw new TConfigurationException('captcha_tokenfontsize_invalid',20,100); |
|
| 119 | + throw new TConfigurationException('captcha_tokenfontsize_invalid', 20, 100); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | public function getMinTokenLength() |
| 126 | 126 | { |
| 127 | - return $this->getViewState('MinTokenLength',4); |
|
| 127 | + return $this->getViewState('MinTokenLength', 4); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | public function setMinTokenLength($value) |
| 134 | 134 | { |
| 135 | 135 | $length=TPropertyValue::ensureInteger($value); |
| 136 | - if($length>=self::MIN_TOKEN_LENGTH && $length<=self::MAX_TOKEN_LENGTH) |
|
| 137 | - $this->setViewState('MinTokenLength',$length,4); |
|
| 136 | + if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH) |
|
| 137 | + $this->setViewState('MinTokenLength', $length, 4); |
|
| 138 | 138 | else |
| 139 | - throw new TConfigurationException('captcha_mintokenlength_invalid',self::MIN_TOKEN_LENGTH,self::MAX_TOKEN_LENGTH); |
|
| 139 | + throw new TConfigurationException('captcha_mintokenlength_invalid', self::MIN_TOKEN_LENGTH, self::MAX_TOKEN_LENGTH); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function getMaxTokenLength() |
| 146 | 146 | { |
| 147 | - return $this->getViewState('MaxTokenLength',6); |
|
| 147 | + return $this->getViewState('MaxTokenLength', 6); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -153,10 +153,10 @@ discard block |
||
| 153 | 153 | public function setMaxTokenLength($value) |
| 154 | 154 | { |
| 155 | 155 | $length=TPropertyValue::ensureInteger($value); |
| 156 | - if($length>=self::MIN_TOKEN_LENGTH && $length<=self::MAX_TOKEN_LENGTH) |
|
| 157 | - $this->setViewState('MaxTokenLength',$length,6); |
|
| 156 | + if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH) |
|
| 157 | + $this->setViewState('MaxTokenLength', $length, 6); |
|
| 158 | 158 | else |
| 159 | - throw new TConfigurationException('captcha_maxtokenlength_invalid',self::MIN_TOKEN_LENGTH,self::MAX_TOKEN_LENGTH); |
|
| 159 | + throw new TConfigurationException('captcha_maxtokenlength_invalid', self::MIN_TOKEN_LENGTH, self::MAX_TOKEN_LENGTH); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | public function getCaseSensitive() |
| 166 | 166 | { |
| 167 | - return $this->getViewState('CaseSensitive',true); |
|
| 167 | + return $this->getViewState('CaseSensitive', true); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | public function setCaseSensitive($value) |
| 174 | 174 | { |
| 175 | - $this->setViewState('CaseSensitive',TPropertyValue::ensureBoolean($value),true); |
|
| 175 | + $this->setViewState('CaseSensitive', TPropertyValue::ensureBoolean($value), true); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public function getTokenAlphabet() |
| 182 | 182 | { |
| 183 | - return $this->getViewState('TokenAlphabet','234578adefhijmnrtABDEFGHJLMNRT'); |
|
| 183 | + return $this->getViewState('TokenAlphabet', '234578adefhijmnrtABDEFGHJLMNRT'); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -188,9 +188,9 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public function setTokenAlphabet($value) |
| 190 | 190 | { |
| 191 | - if(strlen($value)<2) |
|
| 191 | + if(strlen($value) < 2) |
|
| 192 | 192 | throw new TConfigurationException('captcha_tokenalphabet_invalid'); |
| 193 | - $this->setViewState('TokenAlphabet',$value,'234578adefhijmnrtABDEFGHJLMNRT'); |
|
| 193 | + $this->setViewState('TokenAlphabet', $value, '234578adefhijmnrtABDEFGHJLMNRT'); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | */ |
| 199 | 199 | public function getTokenExpiry() |
| 200 | 200 | { |
| 201 | - return $this->getViewState('TokenExpiry',600); |
|
| 201 | + return $this->getViewState('TokenExpiry', 600); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /** |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function setTokenExpiry($value) |
| 208 | 208 | { |
| 209 | - $this->setViewState('TokenExpiry',TPropertyValue::ensureInteger($value),600); |
|
| 209 | + $this->setViewState('TokenExpiry', TPropertyValue::ensureInteger($value), 600); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | public function getChangingTokenBackground() |
| 216 | 216 | { |
| 217 | - return $this->getViewState('ChangingTokenBackground',false); |
|
| 217 | + return $this->getViewState('ChangingTokenBackground', false); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | public function setChangingTokenBackground($value) |
| 224 | 224 | { |
| 225 | - $this->setViewState('ChangingTokenBackground',TPropertyValue::ensureBoolean($value),false); |
|
| 225 | + $this->setViewState('ChangingTokenBackground', TPropertyValue::ensureBoolean($value), false); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | public function getTestLimit() |
| 232 | 232 | { |
| 233 | - return $this->getViewState('TestLimit',5); |
|
| 233 | + return $this->getViewState('TestLimit', 5); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | public function setTestLimit($value) |
| 240 | 240 | { |
| 241 | - $this->setViewState('TestLimit',TPropertyValue::ensureInteger($value),5); |
|
| 241 | + $this->setViewState('TestLimit', TPropertyValue::ensureInteger($value), 5); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -246,8 +246,8 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | public function getIsTokenExpired() |
| 248 | 248 | { |
| 249 | - if(($expiry=$this->getTokenExpiry())>0 && ($start=$this->getViewState('TokenGenerated',0))>0) |
|
| 250 | - return $expiry+$start<time(); |
|
| 249 | + if(($expiry=$this->getTokenExpiry()) > 0 && ($start=$this->getViewState('TokenGenerated', 0)) > 0) |
|
| 250 | + return $expiry + $start < time(); |
|
| 251 | 251 | else |
| 252 | 252 | return false; |
| 253 | 253 | } |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | public function getPublicKey() |
| 259 | 259 | { |
| 260 | - if(($publicKey=$this->getViewState('PublicKey',''))==='') |
|
| 260 | + if(($publicKey=$this->getViewState('PublicKey', ''))==='') |
|
| 261 | 261 | { |
| 262 | 262 | $publicKey=$this->generateRandomKey(); |
| 263 | 263 | $this->setPublicKey($publicKey); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | */ |
| 271 | 271 | public function setPublicKey($value) |
| 272 | 272 | { |
| 273 | - $this->setViewState('PublicKey',$value,''); |
|
| 273 | + $this->setViewState('PublicKey', $value, ''); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | /** |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | */ |
| 279 | 279 | public function getToken() |
| 280 | 280 | { |
| 281 | - return $this->generateToken($this->getPublicKey(),$this->getPrivateKey(),$this->getTokenAlphabet(),$this->getTokenLength(),$this->getCaseSensitive()); |
|
| 281 | + return $this->generateToken($this->getPublicKey(), $this->getPrivateKey(), $this->getTokenAlphabet(), $this->getTokenLength(), $this->getCaseSensitive()); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | /** |
@@ -290,13 +290,13 @@ discard block |
||
| 290 | 290 | { |
| 291 | 291 | $minLength=$this->getMinTokenLength(); |
| 292 | 292 | $maxLength=$this->getMaxTokenLength(); |
| 293 | - if($minLength>$maxLength) |
|
| 294 | - $tokenLength=rand($maxLength,$minLength); |
|
| 295 | - else if($minLength<$maxLength) |
|
| 296 | - $tokenLength=rand($minLength,$maxLength); |
|
| 293 | + if($minLength > $maxLength) |
|
| 294 | + $tokenLength=rand($maxLength, $minLength); |
|
| 295 | + else if($minLength < $maxLength) |
|
| 296 | + $tokenLength=rand($minLength, $maxLength); |
|
| 297 | 297 | else |
| 298 | 298 | $tokenLength=$minLength; |
| 299 | - $this->setViewState('TokenLength',$tokenLength); |
|
| 299 | + $this->setViewState('TokenLength', $tokenLength); |
|
| 300 | 300 | } |
| 301 | 301 | return $tokenLength; |
| 302 | 302 | } |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | $fileName=$this->generatePrivateKeyFile(); |
| 312 | 312 | $content=file_get_contents($fileName); |
| 313 | 313 | $matches=array(); |
| 314 | - if(preg_match("/privateKey='(.*?)'/ms",$content,$matches)>0) |
|
| 314 | + if(preg_match("/privateKey='(.*?)'/ms", $content, $matches) > 0) |
|
| 315 | 315 | $this->_privateKey=$matches[1]; |
| 316 | 316 | else |
| 317 | 317 | throw new TConfigurationException('captcha_privatekey_unknown'); |
@@ -326,18 +326,18 @@ discard block |
||
| 326 | 326 | */ |
| 327 | 327 | public function validate($input) |
| 328 | 328 | { |
| 329 | - $number=$this->getViewState('TestNumber',0); |
|
| 329 | + $number=$this->getViewState('TestNumber', 0); |
|
| 330 | 330 | if(!$this->_validated) |
| 331 | 331 | { |
| 332 | - $this->setViewState('TestNumber',++$number); |
|
| 332 | + $this->setViewState('TestNumber', ++$number); |
|
| 333 | 333 | $this->_validated=true; |
| 334 | 334 | } |
| 335 | - if($this->getIsTokenExpired() || (($limit=$this->getTestLimit())>0 && $number>$limit)) |
|
| 335 | + if($this->getIsTokenExpired() || (($limit=$this->getTestLimit()) > 0 && $number > $limit)) |
|
| 336 | 336 | { |
| 337 | 337 | $this->regenerateToken(); |
| 338 | 338 | return false; |
| 339 | 339 | } |
| 340 | - return ($this->getToken()===($this->getCaseSensitive()?$input:strtoupper($input))); |
|
| 340 | + return ($this->getToken()===($this->getCaseSensitive() ? $input : strtoupper($input))); |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | /** |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | $this->setPublicKey(''); |
| 352 | 352 | $this->clearViewState('TokenGenerated'); |
| 353 | 353 | $this->clearViewState('RandomSeed'); |
| 354 | - $this->clearViewState('TestNumber',0); |
|
| 354 | + $this->clearViewState('TestNumber', 0); |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | /** |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | parent::onPreRender($param); |
| 364 | 364 | if(!self::checkRequirements()) |
| 365 | 365 | throw new TConfigurationException('captcha_imagettftext_required'); |
| 366 | - if(!$this->getViewState('TokenGenerated',0)) |
|
| 366 | + if(!$this->getViewState('TokenGenerated', 0)) |
|
| 367 | 367 | { |
| 368 | 368 | $manager=$this->getApplication()->getAssetManager(); |
| 369 | 369 | $manager->publishFilePath($this->getFontFile()); |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | $url.='?options='.urlencode($this->getTokenImageOptions()); |
| 372 | 372 | $this->setImageUrl($url); |
| 373 | 373 | |
| 374 | - $this->setViewState('TokenGenerated',time()); |
|
| 374 | + $this->setViewState('TokenGenerated', time()); |
|
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | */ |
| 381 | 381 | protected function getTokenImageOptions() |
| 382 | 382 | { |
| 383 | - $privateKey=$this->getPrivateKey(); // call this method to ensure private key is generated |
|
| 383 | + $privateKey=$this->getPrivateKey(); // call this method to ensure private key is generated |
|
| 384 | 384 | $token=$this->getToken(); |
| 385 | 385 | $options=array(); |
| 386 | 386 | $options['publicKey']=$this->getPublicKey(); |
@@ -389,12 +389,12 @@ discard block |
||
| 389 | 389 | $options['alphabet']=$this->getTokenAlphabet(); |
| 390 | 390 | $options['fontSize']=$this->getTokenFontSize(); |
| 391 | 391 | $options['theme']=$this->getTokenImageTheme(); |
| 392 | - if(($randomSeed=$this->getViewState('RandomSeed',0))===0) |
|
| 392 | + if(($randomSeed=$this->getViewState('RandomSeed', 0))===0) |
|
| 393 | 393 | { |
| 394 | - $randomSeed=(int)(microtime()*1000000); |
|
| 395 | - $this->setViewState('RandomSeed',$randomSeed); |
|
| 394 | + $randomSeed=(int) (microtime() * 1000000); |
|
| 395 | + $this->setViewState('RandomSeed', $randomSeed); |
|
| 396 | 396 | } |
| 397 | - $options['randomSeed']=$this->getChangingTokenBackground()?0:$randomSeed; |
|
| 397 | + $options['randomSeed']=$this->getChangingTokenBackground() ? 0 : $randomSeed; |
|
| 398 | 398 | $str=serialize($options); |
| 399 | 399 | return base64_encode(md5($privateKey.$str).$str); |
| 400 | 400 | } |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | $content="<?php |
| 429 | 429 | \$privateKey='$key'; |
| 430 | 430 | ?>"; |
| 431 | - file_put_contents($fileName,$content); |
|
| 431 | + file_put_contents($fileName, $content); |
|
| 432 | 432 | } |
| 433 | 433 | return $fileName; |
| 434 | 434 | } |
@@ -449,10 +449,10 @@ discard block |
||
| 449 | 449 | * @param boolean whether the token is case sensitive |
| 450 | 450 | * @return string the token generated. |
| 451 | 451 | */ |
| 452 | - protected function generateToken($publicKey,$privateKey,$alphabet,$tokenLength,$caseSensitive) |
|
| 452 | + protected function generateToken($publicKey, $privateKey, $alphabet, $tokenLength, $caseSensitive) |
|
| 453 | 453 | { |
| 454 | - $token=substr($this->hash2string(md5($publicKey.$privateKey),$alphabet).$this->hash2string(md5($privateKey.$publicKey),$alphabet),0,$tokenLength); |
|
| 455 | - return $caseSensitive?$token:strtoupper($token); |
|
| 454 | + $token=substr($this->hash2string(md5($publicKey.$privateKey), $alphabet).$this->hash2string(md5($privateKey.$publicKey), $alphabet), 0, $tokenLength); |
|
| 455 | + return $caseSensitive ? $token : strtoupper($token); |
|
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | /** |
@@ -461,20 +461,20 @@ discard block |
||
| 461 | 461 | * @param string the alphabet used to represent the converted string. If empty, it means '234578adefhijmnrtwyABDEFGHIJLMNQRTWY', which excludes those confusing characters. |
| 462 | 462 | * @return string the converted string |
| 463 | 463 | */ |
| 464 | - protected function hash2string($hex,$alphabet='') |
|
| 464 | + protected function hash2string($hex, $alphabet='') |
|
| 465 | 465 | { |
| 466 | - if(strlen($alphabet)<2) |
|
| 466 | + if(strlen($alphabet) < 2) |
|
| 467 | 467 | $alphabet='234578adefhijmnrtABDEFGHJLMNQRT'; |
| 468 | 468 | $hexLength=strlen($hex); |
| 469 | 469 | $base=strlen($alphabet); |
| 470 | 470 | $result=''; |
| 471 | - for($i=0;$i<$hexLength;$i+=6) |
|
| 471 | + for($i=0; $i < $hexLength; $i+=6) |
|
| 472 | 472 | { |
| 473 | - $number=hexdec(substr($hex,$i,6)); |
|
| 473 | + $number=hexdec(substr($hex, $i, 6)); |
|
| 474 | 474 | while($number) |
| 475 | 475 | { |
| 476 | - $result.=$alphabet[$number%$base]; |
|
| 477 | - $number=floor($number/$base); |
|
| 476 | + $result.=$alphabet[$number % $base]; |
|
| 477 | + $number=floor($number / $base); |
|
| 478 | 478 | } |
| 479 | 479 | } |
| 480 | 480 | return $result; |