@@ -164,8 +164,7 @@ |
||
| 164 | 164 | return $handler->createNewInstance(); |
| 165 | 165 | else |
| 166 | 166 | return $registry->createInstanceOf($this->getClass()); |
| 167 | - } |
|
| 168 | - catch (TSqlMapException $e) |
|
| 167 | + } catch (TSqlMapException $e) |
|
| 169 | 168 | { |
| 170 | 169 | throw new TSqlMapException( |
| 171 | 170 | 'sqlmap_unable_to_create_new_instance', |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function setClass($value) |
| 83 | 83 | { |
| 84 | - $this->_class = $value; |
|
| 84 | + $this->_class=$value; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function setExtends($value) |
| 107 | 107 | { |
| 108 | - $this->_extends = $value; |
|
| 108 | + $this->_extends=$value; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public function setGroupBy($value) |
| 123 | 123 | { |
| 124 | - $this->_groupBy = $value; |
|
| 124 | + $this->_groupBy=$value; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public function setDiscriminator(TDiscriminator $value) |
| 139 | 139 | { |
| 140 | - $this->_discriminator = $value; |
|
| 140 | + $this->_discriminator=$value; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /** |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public function addResultProperty(TResultProperty $property) |
| 148 | 148 | { |
| 149 | - $this->_columns[$property->getProperty()] = $property; |
|
| 149 | + $this->_columns[$property->getProperty()]=$property; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function createInstanceOfResult($registry) |
| 159 | 159 | { |
| 160 | - $handler = $registry->getTypeHandler($this->getClass()); |
|
| 160 | + $handler=$registry->getTypeHandler($this->getClass()); |
|
| 161 | 161 | try |
| 162 | 162 | { |
| 163 | 163 | if($handler!==null) |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | else |
| 166 | 166 | return $registry->createInstanceOf($this->getClass()); |
| 167 | 167 | } |
| 168 | - catch (TSqlMapException $e) |
|
| 168 | + catch(TSqlMapException $e) |
|
| 169 | 169 | { |
| 170 | 170 | throw new TSqlMapException( |
| 171 | 171 | 'sqlmap_unable_to_create_new_instance', |
@@ -179,18 +179,18 @@ discard block |
||
| 179 | 179 | * @param array row data. |
| 180 | 180 | * @return TResultMap result sub-map. |
| 181 | 181 | */ |
| 182 | - public function resolveSubMap($registry,$row) |
|
| 182 | + public function resolveSubMap($registry, $row) |
|
| 183 | 183 | { |
| 184 | - $subMap = $this; |
|
| 185 | - if(($disc = $this->getDiscriminator())!==null) |
|
| 184 | + $subMap=$this; |
|
| 185 | + if(($disc=$this->getDiscriminator())!==null) |
|
| 186 | 186 | { |
| 187 | - $value = $disc->getMapping()->getPropertyValue($registry,$row); |
|
| 188 | - $subMap = $disc->getSubMap((string)$value); |
|
| 187 | + $value=$disc->getMapping()->getPropertyValue($registry, $row); |
|
| 188 | + $subMap=$disc->getSubMap((string) $value); |
|
| 189 | 189 | |
| 190 | 190 | if($subMap===null) |
| 191 | - $subMap = $this; |
|
| 192 | - else if($subMap !== $this) |
|
| 193 | - $subMap = $subMap->resolveSubMap($registry,$row); |
|
| 191 | + $subMap=$this; |
|
| 192 | + else if($subMap!==$this) |
|
| 193 | + $subMap=$subMap->resolveSubMap($registry, $row); |
|
| 194 | 194 | } |
| 195 | 195 | return $subMap; |
| 196 | 196 | } |
@@ -113,8 +113,7 @@ discard block |
||
| 113 | 113 | { |
| 114 | 114 | $userFile = include $this->_userFile; |
| 115 | 115 | $this->loadUserDataFromPhp($userFile); |
| 116 | - } |
|
| 117 | - else |
|
| 116 | + } else |
|
| 118 | 117 | { |
| 119 | 118 | $dom=new TXmlDocument; |
| 120 | 119 | $dom->loadFromFile($this->_userFile); |
@@ -310,8 +309,7 @@ discard block |
||
| 310 | 309 | $user=new TUser($this); |
| 311 | 310 | $user->setIsGuest(true); |
| 312 | 311 | return $user; |
| 313 | - } |
|
| 314 | - else |
|
| 312 | + } else |
|
| 315 | 313 | { |
| 316 | 314 | $username=strtolower($username); |
| 317 | 315 | if(isset($this->_users[$username])) |
@@ -322,8 +320,7 @@ discard block |
||
| 322 | 320 | if(isset($this->_roles[$username])) |
| 323 | 321 | $user->setRoles($this->_roles[$username]); |
| 324 | 322 | return $user; |
| 325 | - } |
|
| 326 | - else |
|
| 323 | + } else |
|
| 327 | 324 | return null; |
| 328 | 325 | } |
| 329 | 326 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | { |
| 115 | 115 | if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP) |
| 116 | 116 | { |
| 117 | - $userFile = include $this->_userFile; |
|
| 117 | + $userFile=include $this->_userFile; |
|
| 118 | 118 | $this->loadUserDataFromPhp($userFile); |
| 119 | 119 | } |
| 120 | 120 | else |
@@ -149,13 +149,13 @@ discard block |
||
| 149 | 149 | { |
| 150 | 150 | foreach($config['users'] as $user) |
| 151 | 151 | { |
| 152 | - $name = trim(strtolower(isset($user['name'])?$user['name']:'')); |
|
| 153 | - $password = isset($user['password'])?$user['password']:''; |
|
| 154 | - $this->_users[$name] = $password; |
|
| 155 | - $roles = isset($user['roles'])?$user['roles']:''; |
|
| 152 | + $name=trim(strtolower(isset($user['name']) ? $user['name'] : '')); |
|
| 153 | + $password=isset($user['password']) ? $user['password'] : ''; |
|
| 154 | + $this->_users[$name]=$password; |
|
| 155 | + $roles=isset($user['roles']) ? $user['roles'] : ''; |
|
| 156 | 156 | if($roles!=='') |
| 157 | 157 | { |
| 158 | - foreach(explode(',',$roles) as $role) |
|
| 158 | + foreach(explode(',', $roles) as $role) |
|
| 159 | 159 | { |
| 160 | 160 | if(($role=trim($role))!=='') |
| 161 | 161 | $this->_roles[$name][]=$role; |
@@ -167,9 +167,9 @@ discard block |
||
| 167 | 167 | { |
| 168 | 168 | foreach($config['roles'] as $role) |
| 169 | 169 | { |
| 170 | - $name = isset($role['name'])?$role['name']:''; |
|
| 171 | - $users = isset($role['users'])?$role['users']:''; |
|
| 172 | - foreach(explode(',',$users) as $user) |
|
| 170 | + $name=isset($role['name']) ? $role['name'] : ''; |
|
| 171 | + $users=isset($role['users']) ? $role['users'] : ''; |
|
| 172 | + foreach(explode(',', $users) as $user) |
|
| 173 | 173 | { |
| 174 | 174 | if(($user=trim($user))!=='') |
| 175 | 175 | $this->_roles[strtolower($user)][]=$name; |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $this->_users[$name]=$node->getAttribute('password'); |
| 191 | 191 | if(($roles=trim($node->getAttribute('roles')))!=='') |
| 192 | 192 | { |
| 193 | - foreach(explode(',',$roles) as $role) |
|
| 193 | + foreach(explode(',', $roles) as $role) |
|
| 194 | 194 | { |
| 195 | 195 | if(($role=trim($role))!=='') |
| 196 | 196 | $this->_roles[$name][]=$role; |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | foreach($xmlNode->getElementsByTagName('role') as $node) |
| 201 | 201 | { |
| 202 | - foreach(explode(',',$node->getAttribute('users')) as $user) |
|
| 202 | + foreach(explode(',', $node->getAttribute('users')) as $user) |
|
| 203 | 203 | { |
| 204 | 204 | if(($user=trim($user))!=='') |
| 205 | 205 | $this->_roles[strtolower($user)][]=$node->getAttribute('name'); |
@@ -249,8 +249,8 @@ discard block |
||
| 249 | 249 | { |
| 250 | 250 | if($this->_initialized) |
| 251 | 251 | throw new TInvalidOperationException('usermanager_userfile_unchangeable'); |
| 252 | - else if(($this->_userFile=Prado::getPathOfNamespace($value,self::USER_FILE_EXT))===null || !is_file($this->_userFile)) |
|
| 253 | - throw new TConfigurationException('usermanager_userfile_invalid',$value); |
|
| 252 | + else if(($this->_userFile=Prado::getPathOfNamespace($value, self::USER_FILE_EXT))===null || !is_file($this->_userFile)) |
|
| 253 | + throw new TConfigurationException('usermanager_userfile_invalid', $value); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | */ |
| 283 | 283 | public function setPasswordMode($value) |
| 284 | 284 | { |
| 285 | - $this->_passwordMode=TPropertyValue::ensureEnum($value,'Prado\\Security\\TUserManagerPasswordMode'); |
|
| 285 | + $this->_passwordMode=TPropertyValue::ensureEnum($value, 'Prado\\Security\\TUserManagerPasswordMode'); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | /** |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | * @param string password |
| 292 | 292 | * @return boolean true if validation is successful, false otherwise. |
| 293 | 293 | */ |
| 294 | - public function validateUser($username,$password) |
|
| 294 | + public function validateUser($username, $password) |
|
| 295 | 295 | { |
| 296 | 296 | if($this->_passwordMode===TUserManagerPasswordMode::MD5) |
| 297 | 297 | $password=md5($password); |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | $data=unserialize($data); |
| 345 | 345 | if(is_array($data) && count($data)===2) |
| 346 | 346 | { |
| 347 | - list($username,$token)=$data; |
|
| 347 | + list($username, $token)=$data; |
|
| 348 | 348 | if(isset($this->_users[$username]) && $token===md5($username.$this->_users[$username])) |
| 349 | 349 | return $this->getUser($username); |
| 350 | 350 | } |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | $username=strtolower($user->getName()); |
| 364 | 364 | if(isset($this->_users[$username])) |
| 365 | 365 | { |
| 366 | - $data=array($username,md5($username.$this->_users[$username])); |
|
| 366 | + $data=array($username, md5($username.$this->_users[$username])); |
|
| 367 | 367 | $cookie->setValue(serialize($data)); |
| 368 | 368 | } |
| 369 | 369 | } |
@@ -123,8 +123,7 @@ discard block |
||
| 123 | 123 | $user=Prado::createComponent($this->_userClass,$this); |
| 124 | 124 | $user->setIsGuest(true); |
| 125 | 125 | return $user; |
| 126 | - } |
|
| 127 | - else |
|
| 126 | + } else |
|
| 128 | 127 | return $this->_userFactory->createUser($username); |
| 129 | 128 | } |
| 130 | 129 | |
@@ -175,8 +174,7 @@ discard block |
||
| 175 | 174 | return $conn->getDbConnection(); |
| 176 | 175 | else |
| 177 | 176 | throw new TConfigurationException('dbusermanager_connectionid_invalid',$connectionID); |
| 178 | - } |
|
| 179 | - else |
|
| 177 | + } else |
|
| 180 | 178 | throw new TConfigurationException('dbusermanager_connectionid_required'); |
| 181 | 179 | } |
| 182 | 180 | |
@@ -162,7 +162,8 @@ |
||
| 162 | 162 | /** |
| 163 | 163 | * Creates the DB connection. |
| 164 | 164 | * @param string the module ID for TDataSourceConfig |
| 165 | - * @return TDbConnection the created DB connection |
|
| 165 | + * @param string $connectionID |
|
| 166 | + * @return \Prado\Data\TDbConnection the created DB connection |
|
| 166 | 167 | * @throws TConfigurationException if module ID is invalid or empty |
| 167 | 168 | */ |
| 168 | 169 | protected function createDbConnection($connectionID) |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | if($this->_userClass==='') |
| 64 | 64 | throw new TConfigurationException('dbusermanager_userclass_required'); |
| 65 | - $this->_userFactory=Prado::createComponent($this->_userClass,$this); |
|
| 65 | + $this->_userFactory=Prado::createComponent($this->_userClass, $this); |
|
| 66 | 66 | if(!($this->_userFactory instanceof TDbUser)) |
| 67 | - throw new TInvalidDataTypeException('dbusermanager_userclass_invalid',$this->_userClass); |
|
| 67 | + throw new TInvalidDataTypeException('dbusermanager_userclass_invalid', $this->_userClass); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | * @param string password |
| 106 | 106 | * @return boolean true if validation is successful, false otherwise. |
| 107 | 107 | */ |
| 108 | - public function validateUser($username,$password) |
|
| 108 | + public function validateUser($username, $password) |
|
| 109 | 109 | { |
| 110 | - return $this->_userFactory->validateUser($username,$password); |
|
| 110 | + return $this->_userFactory->validateUser($username, $password); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | { |
| 120 | 120 | if($username===null) |
| 121 | 121 | { |
| 122 | - $user=Prado::createComponent($this->_userClass,$this); |
|
| 122 | + $user=Prado::createComponent($this->_userClass, $this); |
|
| 123 | 123 | $user->setIsGuest(true); |
| 124 | 124 | return $user; |
| 125 | 125 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | if($conn instanceof TDataSourceConfig) |
| 174 | 174 | return $conn->getDbConnection(); |
| 175 | 175 | else |
| 176 | - throw new TConfigurationException('dbusermanager_connectionid_invalid',$connectionID); |
|
| 176 | + throw new TConfigurationException('dbusermanager_connectionid_invalid', $connectionID); |
|
| 177 | 177 | } |
| 178 | 178 | else |
| 179 | 179 | throw new TConfigurationException('dbusermanager_connectionid_required'); |
@@ -112,8 +112,7 @@ |
||
| 112 | 112 | && strlen($datetime[1]) == 1) |
| 113 | 113 | { |
| 114 | 114 | $pattern = $datetime; |
| 115 | - } |
|
| 116 | - else //no subpattern, try the presets |
|
| 115 | + } else //no subpattern, try the presets |
|
| 117 | 116 | $pattern = $this->getPreset($string); |
| 118 | 117 | |
| 119 | 118 | //no presets found, use the string as the pattern |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | * A set of pattern presets and their respective formatting shorthand. |
| 71 | 71 | * @var array |
| 72 | 72 | */ |
| 73 | - static private $_patternPresets = array( |
|
| 74 | - 'fulldate'=>'P','full'=>'P', |
|
| 75 | - 'longdate'=>'D','long'=>'d', |
|
| 76 | - 'mediumdate'=>'p','medium'=>'p', |
|
| 77 | - 'shortdate'=>'d','short'=>'d', |
|
| 73 | + static private $_patternPresets=array( |
|
| 74 | + 'fulldate'=>'P', 'full'=>'P', |
|
| 75 | + 'longdate'=>'D', 'long'=>'d', |
|
| 76 | + 'mediumdate'=>'p', 'medium'=>'p', |
|
| 77 | + 'shortdate'=>'d', 'short'=>'d', |
|
| 78 | 78 | 'fulltime'=>'Q', 'longtime'=>'T', |
| 79 | 79 | 'mediumtime'=>'q', 'shorttime'=>'t'); |
| 80 | 80 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function setPattern($value) |
| 86 | 86 | { |
| 87 | - $this->setViewState('Pattern',$value,''); |
|
| 87 | + $this->setViewState('Pattern', $value, ''); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -93,35 +93,35 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | public function getPattern() |
| 95 | 95 | { |
| 96 | - $string = $this->getViewState('Pattern',''); |
|
| 96 | + $string=$this->getViewState('Pattern', ''); |
|
| 97 | 97 | |
| 98 | - $pattern = null; |
|
| 98 | + $pattern=null; |
|
| 99 | 99 | |
| 100 | 100 | //try the subpattern of "date time" presets |
| 101 | - $subpatterns = explode(' ',$string,2); |
|
| 102 | - $datetime = array(); |
|
| 101 | + $subpatterns=explode(' ', $string, 2); |
|
| 102 | + $datetime=array(); |
|
| 103 | 103 | if(count($subpatterns)==2) |
| 104 | 104 | { |
| 105 | - $datetime[] = $this->getPreset($subpatterns[0]); |
|
| 106 | - $datetime[] = $this->getPreset($subpatterns[1]); |
|
| 105 | + $datetime[]=$this->getPreset($subpatterns[0]); |
|
| 106 | + $datetime[]=$this->getPreset($subpatterns[1]); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | //we have a good subpattern |
| 110 | - if(count($datetime) == 2 |
|
| 111 | - && strlen($datetime[0]) == 1 |
|
| 112 | - && strlen($datetime[1]) == 1) |
|
| 110 | + if(count($datetime)==2 |
|
| 111 | + && strlen($datetime[0])==1 |
|
| 112 | + && strlen($datetime[1])==1) |
|
| 113 | 113 | { |
| 114 | - $pattern = $datetime; |
|
| 114 | + $pattern=$datetime; |
|
| 115 | 115 | } |
| 116 | 116 | else //no subpattern, try the presets |
| 117 | - $pattern = $this->getPreset($string); |
|
| 117 | + $pattern=$this->getPreset($string); |
|
| 118 | 118 | |
| 119 | 119 | //no presets found, use the string as the pattern |
| 120 | 120 | //and let the DateFormat handle it. |
| 121 | 121 | if($pattern===null) |
| 122 | - $pattern = $string; |
|
| 123 | - if (!is_array($pattern) && strlen($pattern) == 0) |
|
| 124 | - $pattern = null; |
|
| 122 | + $pattern=$string; |
|
| 123 | + if(!is_array($pattern) && strlen($pattern)==0) |
|
| 124 | + $pattern=null; |
|
| 125 | 125 | return $pattern; |
| 126 | 126 | } |
| 127 | 127 | |
@@ -132,10 +132,10 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | protected function getPreset($string) |
| 134 | 134 | { |
| 135 | - $string = strtolower($string); |
|
| 135 | + $string=strtolower($string); |
|
| 136 | 136 | foreach(self::$_patternPresets as $pattern => $preset) |
| 137 | 137 | { |
| 138 | - if($string == $pattern) |
|
| 138 | + if($string==$pattern) |
|
| 139 | 139 | return $preset; |
| 140 | 140 | } |
| 141 | 141 | } |
@@ -146,10 +146,10 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public function getValue() |
| 148 | 148 | { |
| 149 | - $value = $this->getViewState('Value',''); |
|
| 149 | + $value=$this->getViewState('Value', ''); |
|
| 150 | 150 | if(empty($value)) |
| 151 | 151 | { |
| 152 | - $defaultText = $this->getDefaultText(); |
|
| 152 | + $defaultText=$this->getDefaultText(); |
|
| 153 | 153 | if(empty($defaultText)) |
| 154 | 154 | return time(); |
| 155 | 155 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | public function setValue($value) |
| 164 | 164 | { |
| 165 | - $this->setViewState('Value',$value,''); |
|
| 165 | + $this->setViewState('Value', $value, ''); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /** |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public function getDefaultText() |
| 173 | 173 | { |
| 174 | - return $this->getViewState('DefaultText',''); |
|
| 174 | + return $this->getViewState('DefaultText', ''); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public function setDefaultText($value) |
| 182 | 182 | { |
| 183 | - $this->setViewState('DefaultText',$value,''); |
|
| 183 | + $this->setViewState('DefaultText', $value, ''); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -217,29 +217,29 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | protected function getFormattedDate() |
| 219 | 219 | { |
| 220 | - $value = $this->getValue(); |
|
| 221 | - $defaultText = $this->getDefaultText(); |
|
| 220 | + $value=$this->getValue(); |
|
| 221 | + $defaultText=$this->getDefaultText(); |
|
| 222 | 222 | if(empty($value) && !empty($defaultText)) |
| 223 | 223 | return $this->getDefaultText(); |
| 224 | 224 | |
| 225 | - $app = $this->getApplication()->getGlobalization(); |
|
| 225 | + $app=$this->getApplication()->getGlobalization(); |
|
| 226 | 226 | |
| 227 | 227 | //initialized the default class wide formatter |
| 228 | 228 | if(self::$formatter===null) |
| 229 | - self::$formatter = new DateFormat($app->getCulture()); |
|
| 229 | + self::$formatter=new DateFormat($app->getCulture()); |
|
| 230 | 230 | |
| 231 | - $culture = $this->getCulture(); |
|
| 231 | + $culture=$this->getCulture(); |
|
| 232 | 232 | |
| 233 | 233 | //return the specific cultural formatted date time |
| 234 | - if(strlen($culture) && $app->getCulture() !== $culture) |
|
| 234 | + if(strlen($culture) && $app->getCulture()!==$culture) |
|
| 235 | 235 | { |
| 236 | - $formatter = new DateFormat($culture); |
|
| 236 | + $formatter=new DateFormat($culture); |
|
| 237 | 237 | return $formatter->format($value, |
| 238 | 238 | $this->getPattern(), |
| 239 | 239 | $this->getCharset()); |
| 240 | 240 | } |
| 241 | 241 | //return the application wide culture formatted date time. |
| 242 | - $result = self::$formatter->format($value, |
|
| 242 | + $result=self::$formatter->format($value, |
|
| 243 | 243 | $this->getPattern(), |
| 244 | 244 | $this->getCharset()); |
| 245 | 245 | return $result; |
@@ -120,11 +120,9 @@ |
||
| 120 | 120 | { |
| 121 | 121 | $this->setChecked(true); |
| 122 | 122 | return true; |
| 123 | - } |
|
| 124 | - else |
|
| 123 | + } else |
|
| 125 | 124 | return false; |
| 126 | - } |
|
| 127 | - else if($this->getChecked()) |
|
| 125 | + } else if($this->getChecked()) |
|
| 128 | 126 | $this->setChecked(false); |
| 129 | 127 | return false; |
| 130 | 128 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | public function __construct() |
| 77 | 77 | { |
| 78 | 78 | parent::__construct(); |
| 79 | - $this->_globalID = self::$_buttonCount++; |
|
| 79 | + $this->_globalID=self::$_buttonCount++; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -108,10 +108,10 @@ discard block |
||
| 108 | 108 | * @param array the input data collection |
| 109 | 109 | * @return boolean whether the data of the control has been changed |
| 110 | 110 | */ |
| 111 | - public function loadPostData($key,$values) |
|
| 111 | + public function loadPostData($key, $values) |
|
| 112 | 112 | { |
| 113 | 113 | $uniqueGroupName=$this->getUniqueGroupName(); |
| 114 | - $value=isset($values[$uniqueGroupName])?$values[$uniqueGroupName]:null; |
|
| 114 | + $value=isset($values[$uniqueGroupName]) ? $values[$uniqueGroupName] : null; |
|
| 115 | 115 | if($value!==null && $value===$this->getValueAttribute()) |
| 116 | 116 | { |
| 117 | 117 | if(!$this->getChecked()) |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function getGroupName() |
| 134 | 134 | { |
| 135 | - return $this->getViewState('GroupName',''); |
|
| 135 | + return $this->getViewState('GroupName', ''); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function setGroupName($value) |
| 145 | 145 | { |
| 146 | - $this->setViewState('GroupName',$value,''); |
|
| 146 | + $this->setViewState('GroupName', $value, ''); |
|
| 147 | 147 | $this->_uniqueGroupName=null; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public function getUniqueGroupName() |
| 154 | 154 | { |
| 155 | - if(($groupName=$this->getViewState('UniqueGroupName',''))!=='') |
|
| 155 | + if(($groupName=$this->getViewState('UniqueGroupName', ''))!=='') |
|
| 156 | 156 | return $groupName; |
| 157 | 157 | else if(($uniqueID=$this->getUniqueID())!==$this->_previousUniqueID || $this->_uniqueGroupName===null) |
| 158 | 158 | { |
@@ -160,12 +160,12 @@ discard block |
||
| 160 | 160 | $this->_previousUniqueID=$uniqueID; |
| 161 | 161 | if($uniqueID!=='') |
| 162 | 162 | { |
| 163 | - if(($pos=strrpos($uniqueID,\Prado\Web\UI\TControl::ID_SEPARATOR))!==false) |
|
| 163 | + if(($pos=strrpos($uniqueID, \Prado\Web\UI\TControl::ID_SEPARATOR))!==false) |
|
| 164 | 164 | { |
| 165 | 165 | if($groupName!=='') |
| 166 | - $groupName=substr($uniqueID,0,$pos+1).$groupName; |
|
| 166 | + $groupName=substr($uniqueID, 0, $pos + 1).$groupName; |
|
| 167 | 167 | else if($this->getNamingContainer() instanceof TRadioButtonList) |
| 168 | - $groupName=substr($uniqueID,0,$pos); |
|
| 168 | + $groupName=substr($uniqueID, 0, $pos); |
|
| 169 | 169 | } |
| 170 | 170 | if($groupName==='') |
| 171 | 171 | $groupName=$uniqueID; |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | public function setUniqueGroupName($value) |
| 195 | 195 | { |
| 196 | - $this->setViewState('UniqueGroupName',$value,''); |
|
| 196 | + $this->setViewState('UniqueGroupName', $value, ''); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /** |
@@ -204,12 +204,12 @@ discard block |
||
| 204 | 204 | */ |
| 205 | 205 | public function getRadioButtonsInGroup() |
| 206 | 206 | { |
| 207 | - $group = $this->getUniqueGroupName(); |
|
| 208 | - $buttons = array(); |
|
| 207 | + $group=$this->getUniqueGroupName(); |
|
| 208 | + $buttons=array(); |
|
| 209 | 209 | foreach(self::$_activeButtons as $control) |
| 210 | 210 | { |
| 211 | - if($control->getUniqueGroupName() === $group) |
|
| 212 | - $buttons[] = $control; |
|
| 211 | + if($control->getUniqueGroupName()===$group) |
|
| 212 | + $buttons[]=$control; |
|
| 213 | 213 | } |
| 214 | 214 | return $buttons; |
| 215 | 215 | } |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | public function getEnableClientScript() |
| 232 | 232 | { |
| 233 | - return $this->getViewState('EnableClientScript',true); |
|
| 233 | + return $this->getViewState('EnableClientScript', true); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | public function setEnableClientScript($value) |
| 240 | 240 | { |
| 241 | - $this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true); |
|
| 241 | + $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -247,19 +247,19 @@ discard block |
||
| 247 | 247 | * @param string checkbox id |
| 248 | 248 | * @param string onclick js |
| 249 | 249 | */ |
| 250 | - protected function renderInputTag($writer,$clientID,$onclick) |
|
| 250 | + protected function renderInputTag($writer, $clientID, $onclick) |
|
| 251 | 251 | { |
| 252 | 252 | if($clientID!=='') |
| 253 | - $writer->addAttribute('id',$clientID); |
|
| 254 | - $writer->addAttribute('type','radio'); |
|
| 255 | - $writer->addAttribute('name',$this->getUniqueGroupName()); |
|
| 256 | - $writer->addAttribute('value',$this->getValueAttribute()); |
|
| 253 | + $writer->addAttribute('id', $clientID); |
|
| 254 | + $writer->addAttribute('type', 'radio'); |
|
| 255 | + $writer->addAttribute('name', $this->getUniqueGroupName()); |
|
| 256 | + $writer->addAttribute('value', $this->getValueAttribute()); |
|
| 257 | 257 | if(!empty($onclick)) |
| 258 | - $writer->addAttribute('onclick',$onclick); |
|
| 258 | + $writer->addAttribute('onclick', $onclick); |
|
| 259 | 259 | if($this->getChecked()) |
| 260 | - $writer->addAttribute('checked','checked'); |
|
| 260 | + $writer->addAttribute('checked', 'checked'); |
|
| 261 | 261 | if(!$this->getEnabled(true)) |
| 262 | - $writer->addAttribute('disabled','disabled'); |
|
| 262 | + $writer->addAttribute('disabled', 'disabled'); |
|
| 263 | 263 | |
| 264 | 264 | $page=$this->getPage(); |
| 265 | 265 | if($this->getEnabled(true) |
@@ -271,10 +271,10 @@ discard block |
||
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | if(($accesskey=$this->getAccessKey())!=='') |
| 274 | - $writer->addAttribute('accesskey',$accesskey); |
|
| 275 | - if(($tabindex=$this->getTabIndex())>0) |
|
| 276 | - $writer->addAttribute('tabindex',"$tabindex"); |
|
| 277 | - if($attributes=$this->getViewState('InputAttributes',null)) |
|
| 274 | + $writer->addAttribute('accesskey', $accesskey); |
|
| 275 | + if(($tabindex=$this->getTabIndex()) > 0) |
|
| 276 | + $writer->addAttribute('tabindex', "$tabindex"); |
|
| 277 | + if($attributes=$this->getViewState('InputAttributes', null)) |
|
| 278 | 278 | $writer->addAttributes($attributes); |
| 279 | 279 | $writer->renderBeginTag('input'); |
| 280 | 280 | $writer->renderEndTag(); |
@@ -285,8 +285,8 @@ discard block |
||
| 285 | 285 | */ |
| 286 | 286 | protected function renderClientControlScript($writer) |
| 287 | 287 | { |
| 288 | - $cs = $this->getPage()->getClientScript(); |
|
| 289 | - $cs->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions()); |
|
| 288 | + $cs=$this->getPage()->getClientScript(); |
|
| 289 | + $cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | /** |
@@ -107,8 +107,7 @@ discard block |
||
| 107 | 107 | { |
| 108 | 108 | if($this->getEnableClientScript() && $this->needPostBackScript()) |
| 109 | 109 | $this->renderClientControlScript($writer); |
| 110 | - } |
|
| 111 | - else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
| 110 | + } else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
| 112 | 111 | $writer->addAttribute('disabled','disabled'); |
| 113 | 112 | |
| 114 | 113 | parent::addAttributesToRender($writer); |
@@ -142,8 +141,7 @@ discard block |
||
| 142 | 141 | { |
| 143 | 142 | $group=$this->getValidationGroup(); |
| 144 | 143 | return $this->getPage()->getValidators($group)->getCount()>0; |
| 145 | - } |
|
| 146 | - else |
|
| 144 | + } else |
|
| 147 | 145 | return false; |
| 148 | 146 | } |
| 149 | 147 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function getButtonTag() |
| 66 | 66 | { |
| 67 | - return $this->getViewState('ButtonTag',TButtonTag::Input); |
|
| 67 | + return $this->getViewState('ButtonTag', TButtonTag::Input); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function setButtonTag($value) |
| 74 | 74 | { |
| 75 | - $this->setViewState('ButtonTag',TPropertyValue::ensureEnum($value,'TButtonTag'),TButtonTag::Input); |
|
| 75 | + $this->setViewState('ButtonTag', TPropertyValue::ensureEnum($value, 'TButtonTag'), TButtonTag::Input); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function getEnableClientScript() |
| 82 | 82 | { |
| 83 | - return $this->getViewState('EnableClientScript',true); |
|
| 83 | + return $this->getViewState('EnableClientScript', true); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function setEnableClientScript($value) |
| 90 | 90 | { |
| 91 | - $this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true); |
|
| 91 | + $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -100,20 +100,20 @@ discard block |
||
| 100 | 100 | { |
| 101 | 101 | $page=$this->getPage(); |
| 102 | 102 | $page->ensureRenderInForm($this); |
| 103 | - $writer->addAttribute('type',strtolower($this->getButtonType())); |
|
| 103 | + $writer->addAttribute('type', strtolower($this->getButtonType())); |
|
| 104 | 104 | if(($uniqueID=$this->getUniqueID())!=='') |
| 105 | - $writer->addAttribute('name',$uniqueID); |
|
| 105 | + $writer->addAttribute('name', $uniqueID); |
|
| 106 | 106 | if($this->getButtonTag()===TButtonTag::Button) |
| 107 | 107 | $this->addParsedObject($this->getText()); |
| 108 | 108 | else |
| 109 | - $writer->addAttribute('value',$this->getText()); |
|
| 109 | + $writer->addAttribute('value', $this->getText()); |
|
| 110 | 110 | if($this->getEnabled(true)) |
| 111 | 111 | { |
| 112 | 112 | if($this->getEnableClientScript() && $this->needPostBackScript()) |
| 113 | 113 | $this->renderClientControlScript($writer); |
| 114 | 114 | } |
| 115 | 115 | else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
| 116 | - $writer->addAttribute('disabled','disabled'); |
|
| 116 | + $writer->addAttribute('disabled', 'disabled'); |
|
| 117 | 117 | |
| 118 | 118 | parent::addAttributesToRender($writer); |
| 119 | 119 | } |
@@ -123,8 +123,8 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | protected function renderClientControlScript($writer) |
| 125 | 125 | { |
| 126 | - $writer->addAttribute('id',$this->getClientID()); |
|
| 127 | - $this->getPage()->getClientScript()->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions()); |
|
| 126 | + $writer->addAttribute('id', $this->getClientID()); |
|
| 127 | + $this->getPage()->getClientScript()->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | if($this->getCausesValidation()) |
| 146 | 146 | { |
| 147 | 147 | $group=$this->getValidationGroup(); |
| 148 | - return $this->getPage()->getValidators($group)->getCount()>0; |
|
| 148 | + return $this->getPage()->getValidators($group)->getCount() > 0; |
|
| 149 | 149 | } |
| 150 | 150 | else |
| 151 | 151 | return false; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | public function setIsDefaultButton($value) |
| 158 | 158 | { |
| 159 | - $this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value),false); |
|
| 159 | + $this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value), false); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | { |
| 187 | 187 | $options['ID']=$this->getClientID(); |
| 188 | 188 | $options['CausesValidation']=$this->getCausesValidation(); |
| 189 | - $options['EventTarget'] = $this->getUniqueID(); |
|
| 189 | + $options['EventTarget']=$this->getUniqueID(); |
|
| 190 | 190 | $options['ValidationGroup']=$this->getValidationGroup(); |
| 191 | 191 | |
| 192 | 192 | return $options; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | public function onClick($param) |
| 215 | 215 | { |
| 216 | - $this->raiseEvent('OnClick',$this,$param); |
|
| 216 | + $this->raiseEvent('OnClick', $this, $param); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | /** |
@@ -225,8 +225,8 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | public function onCommand($param) |
| 227 | 227 | { |
| 228 | - $this->raiseEvent('OnCommand',$this,$param); |
|
| 229 | - $this->raiseBubbleEvent($this,$param); |
|
| 228 | + $this->raiseEvent('OnCommand', $this, $param); |
|
| 229 | + $this->raiseBubbleEvent($this, $param); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | if($this->getCausesValidation()) |
| 244 | 244 | $this->getPage()->validate($this->getValidationGroup()); |
| 245 | 245 | $this->onClick(null); |
| 246 | - $this->onCommand(new \Prado\Web\UI\TCommandEventParameter($this->getCommandName(),$this->getCommandParameter())); |
|
| 246 | + $this->onCommand(new \Prado\Web\UI\TCommandEventParameter($this->getCommandName(), $this->getCommandParameter())); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | */ |
| 252 | 252 | public function getText() |
| 253 | 253 | { |
| 254 | - return $this->getViewState('Text',''); |
|
| 254 | + return $this->getViewState('Text', ''); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | /** |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | public function setText($value) |
| 261 | 261 | { |
| 262 | - $this->setViewState('Text',$value,''); |
|
| 262 | + $this->setViewState('Text', $value, ''); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /** |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | */ |
| 294 | 294 | public function getCausesValidation() |
| 295 | 295 | { |
| 296 | - return $this->getViewState('CausesValidation',true); |
|
| 296 | + return $this->getViewState('CausesValidation', true); |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | /** |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | */ |
| 302 | 302 | public function setCausesValidation($value) |
| 303 | 303 | { |
| 304 | - $this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true); |
|
| 304 | + $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | /** |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | public function getCommandName() |
| 311 | 311 | { |
| 312 | - return $this->getViewState('CommandName',''); |
|
| 312 | + return $this->getViewState('CommandName', ''); |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | */ |
| 318 | 318 | public function setCommandName($value) |
| 319 | 319 | { |
| 320 | - $this->setViewState('CommandName',$value,''); |
|
| 320 | + $this->setViewState('CommandName', $value, ''); |
|
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | /** |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | */ |
| 326 | 326 | public function getCommandParameter() |
| 327 | 327 | { |
| 328 | - return $this->getViewState('CommandParameter',''); |
|
| 328 | + return $this->getViewState('CommandParameter', ''); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | /** |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | */ |
| 334 | 334 | public function setCommandParameter($value) |
| 335 | 335 | { |
| 336 | - $this->setViewState('CommandParameter',$value,''); |
|
| 336 | + $this->setViewState('CommandParameter', $value, ''); |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | /** |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | public function getValidationGroup() |
| 343 | 343 | { |
| 344 | - return $this->getViewState('ValidationGroup',''); |
|
| 344 | + return $this->getViewState('ValidationGroup', ''); |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | /** |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | */ |
| 350 | 350 | public function setValidationGroup($value) |
| 351 | 351 | { |
| 352 | - $this->setViewState('ValidationGroup',$value,''); |
|
| 352 | + $this->setViewState('ValidationGroup', $value, ''); |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | /** |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | */ |
| 358 | 358 | public function getButtonType() |
| 359 | 359 | { |
| 360 | - return $this->getViewState('ButtonType',TButtonType::Submit); |
|
| 360 | + return $this->getViewState('ButtonType', TButtonType::Submit); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /** |
@@ -365,6 +365,6 @@ discard block |
||
| 365 | 365 | */ |
| 366 | 366 | public function setButtonType($value) |
| 367 | 367 | { |
| 368 | - $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TButtonType'),TButtonType::Submit); |
|
| 368 | + $this->setViewState('ButtonType', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TButtonType'), TButtonType::Submit); |
|
| 369 | 369 | } |
| 370 | 370 | } |
@@ -222,6 +222,7 @@ |
||
| 222 | 222 | * If you override this method, be sure to call the parent implementation |
| 223 | 223 | * so that the event handlers can be invoked. |
| 224 | 224 | * @param \Prado\Web\UI\TCommandEventParameter event parameter to be passed to the event handlers |
| 225 | + * @param TCommandEventParameter $param |
|
| 225 | 226 | */ |
| 226 | 227 | public function onCommand($param) |
| 227 | 228 | { |
@@ -69,11 +69,9 @@ |
||
| 69 | 69 | $this->_forControl=$control->getClientID(); |
| 70 | 70 | parent::render($writer); |
| 71 | 71 | } |
| 72 | - } |
|
| 73 | - else |
|
| 72 | + } else |
|
| 74 | 73 | throw new TInvalidDataValueException('label_associatedcontrol_invalid',$aid); |
| 75 | - } |
|
| 76 | - else |
|
| 74 | + } else |
|
| 77 | 75 | parent::render($writer); |
| 78 | 76 | } |
| 79 | 77 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | protected function getTagName() |
| 39 | 39 | { |
| 40 | - return ($this->getForControl()==='')?'span':'label'; |
|
| 40 | + return ($this->getForControl()==='') ? 'span' : 'label'; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | protected function addAttributesToRender($writer) |
| 49 | 49 | { |
| 50 | 50 | if($this->_forControl!=='') |
| 51 | - $writer->addAttribute('for',$this->_forControl); |
|
| 51 | + $writer->addAttribute('for', $this->_forControl); |
|
| 52 | 52 | parent::addAttributesToRender($writer); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | else |
| 74 | - throw new TInvalidDataValueException('label_associatedcontrol_invalid',$aid); |
|
| 74 | + throw new TInvalidDataValueException('label_associatedcontrol_invalid', $aid); |
|
| 75 | 75 | } |
| 76 | 76 | else |
| 77 | 77 | parent::render($writer); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function getText() |
| 96 | 96 | { |
| 97 | - return $this->getViewState('Text',''); |
|
| 97 | + return $this->getViewState('Text', ''); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function setText($value) |
| 104 | 104 | { |
| 105 | - $this->setViewState('Text',TPropertyValue::ensureString($value),''); |
|
| 105 | + $this->setViewState('Text', TPropertyValue::ensureString($value), ''); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function getForControl() |
| 138 | 138 | { |
| 139 | - return $this->getViewState('ForControl',''); |
|
| 139 | + return $this->getViewState('ForControl', ''); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public function setForControl($value) |
| 148 | 148 | { |
| 149 | - $this->setViewState('ForControl',$value,''); |
|
| 149 | + $this->setViewState('ForControl', $value, ''); |
|
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
@@ -270,8 +270,7 @@ discard block |
||
| 270 | 270 | $cell->getControls()->add($listControl); |
| 271 | 271 | $cell->registerObject('DropDownList',$listControl); |
| 272 | 272 | $control=$listControl; |
| 273 | - } |
|
| 274 | - else |
|
| 273 | + } else |
|
| 275 | 274 | $control=$cell; |
| 276 | 275 | $control->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
| 277 | 276 | break; |
@@ -307,8 +306,7 @@ discard block |
||
| 307 | 306 | $value=$text; |
| 308 | 307 | $formatString=$this->getDataTextFormatString(); |
| 309 | 308 | $text=$this->formatDataValue($formatString,$text); |
| 310 | - } |
|
| 311 | - else |
|
| 309 | + } else |
|
| 312 | 310 | $text=$value; |
| 313 | 311 | if($sender instanceof TTableCell) |
| 314 | 312 | $sender->setText($text); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | parent::loadState($state); |
| 78 | 78 | $this->_stateLoaded=true; |
| 79 | 79 | if(!$this->_dataBound) |
| 80 | - $this->_listControl->getItems()->loadState($this->getViewState('Items',null)); |
|
| 80 | + $this->_listControl->getItems()->loadState($this->getViewState('Items', null)); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function saveState() |
| 88 | 88 | { |
| 89 | - $this->setViewState('Items',$this->_listControl->getItems()->saveState(),null); |
|
| 89 | + $this->setViewState('Items', $this->_listControl->getItems()->saveState(), null); |
|
| 90 | 90 | return parent::saveState(); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function getDataTextField() |
| 113 | 113 | { |
| 114 | - return $this->getViewState('DataTextField',''); |
|
| 114 | + return $this->getViewState('DataTextField', ''); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function setDataTextField($value) |
| 124 | 124 | { |
| 125 | - $this->setViewState('DataTextField',$value,''); |
|
| 125 | + $this->setViewState('DataTextField', $value, ''); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | public function getDataTextFormatString() |
| 132 | 132 | { |
| 133 | - return $this->getViewState('DataTextFormatString',''); |
|
| 133 | + return $this->getViewState('DataTextFormatString', ''); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public function setDataTextFormatString($value) |
| 140 | 140 | { |
| 141 | - $this->setViewState('DataTextFormatString',$value,''); |
|
| 141 | + $this->setViewState('DataTextFormatString', $value, ''); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public function getDataValueField() |
| 148 | 148 | { |
| 149 | - return $this->getViewState('DataValueField',''); |
|
| 149 | + return $this->getViewState('DataValueField', ''); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function setDataValueField($value) |
| 159 | 159 | { |
| 160 | - $this->setViewState('DataValueField',$value,''); |
|
| 160 | + $this->setViewState('DataValueField', $value, ''); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public function getReadOnly() |
| 167 | 167 | { |
| 168 | - return $this->getViewState('ReadOnly',false); |
|
| 168 | + return $this->getViewState('ReadOnly', false); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | public function setReadOnly($value) |
| 175 | 175 | { |
| 176 | - $this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false); |
|
| 176 | + $this->setViewState('ReadOnly', TPropertyValue::ensureBoolean($value), false); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | public function getListValueField() |
| 199 | 199 | { |
| 200 | - return $this->getViewState('ListValueField',''); |
|
| 200 | + return $this->getViewState('ListValueField', ''); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | public function setListValueField($value) |
| 207 | 207 | { |
| 208 | - $this->setViewState('ListValueField',$value,''); |
|
| 208 | + $this->setViewState('ListValueField', $value, ''); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | public function getListTextField() |
| 215 | 215 | { |
| 216 | - return $this->getViewState('ListTextField',''); |
|
| 216 | + return $this->getViewState('ListTextField', ''); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | /** |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | public function setListTextField($value) |
| 223 | 223 | { |
| 224 | - $this->setViewState('ListTextField',$value,''); |
|
| 224 | + $this->setViewState('ListTextField', $value, ''); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | public function getListTextFormatString() |
| 231 | 231 | { |
| 232 | - return $this->getViewState('ListTextFormatString',''); |
|
| 232 | + return $this->getViewState('ListTextFormatString', ''); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | /** |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | public function setListTextFormatString($value) |
| 239 | 239 | { |
| 240 | - $this->setViewState('ListTextFormatString',$value,''); |
|
| 240 | + $this->setViewState('ListTextFormatString', $value, ''); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /** |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | * @param integer the index to the Columns property that the cell resides in. |
| 252 | 252 | * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem) |
| 253 | 253 | */ |
| 254 | - public function initializeCell($cell,$columnIndex,$itemType) |
|
| 254 | + public function initializeCell($cell, $columnIndex, $itemType) |
|
| 255 | 255 | { |
| 256 | 256 | if(!$this->_dataBound && $this->_listControl->getDataSource()!==null) |
| 257 | 257 | { |
@@ -268,21 +268,21 @@ discard block |
||
| 268 | 268 | { |
| 269 | 269 | $listControl=clone $this->_listControl; |
| 270 | 270 | $cell->getControls()->add($listControl); |
| 271 | - $cell->registerObject('DropDownList',$listControl); |
|
| 271 | + $cell->registerObject('DropDownList', $listControl); |
|
| 272 | 272 | $control=$listControl; |
| 273 | 273 | } |
| 274 | 274 | else |
| 275 | 275 | $control=$cell; |
| 276 | - $control->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
|
| 276 | + $control->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn')); |
|
| 277 | 277 | break; |
| 278 | 278 | case TListItemType::Item: |
| 279 | 279 | case TListItemType::AlternatingItem: |
| 280 | 280 | case TListItemType::SelectedItem: |
| 281 | 281 | if($this->getDataTextField()!=='' || $this->getDataValueField()!=='') |
| 282 | - $cell->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
|
| 282 | + $cell->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn')); |
|
| 283 | 283 | break; |
| 284 | 284 | default: |
| 285 | - parent::initializeCell($cell,$columnIndex,$itemType); |
|
| 285 | + parent::initializeCell($cell, $columnIndex, $itemType); |
|
| 286 | 286 | break; |
| 287 | 287 | } |
| 288 | 288 | } |
@@ -292,21 +292,21 @@ discard block |
||
| 292 | 292 | * This method is invoked when datagrid performs databinding. |
| 293 | 293 | * It populates the content of the cell with the relevant data from data source. |
| 294 | 294 | */ |
| 295 | - public function dataBindColumn($sender,$param) |
|
| 295 | + public function dataBindColumn($sender, $param) |
|
| 296 | 296 | { |
| 297 | 297 | $item=$sender->getNamingContainer(); |
| 298 | 298 | $data=$item->getData(); |
| 299 | 299 | if(($valueField=$this->getDataValueField())!=='') |
| 300 | - $value=$this->getDataFieldValue($data,$valueField); |
|
| 300 | + $value=$this->getDataFieldValue($data, $valueField); |
|
| 301 | 301 | else |
| 302 | 302 | $value=''; |
| 303 | 303 | if(($textField=$this->getDataTextField())!=='') |
| 304 | 304 | { |
| 305 | - $text=$this->getDataFieldValue($data,$textField); |
|
| 305 | + $text=$this->getDataFieldValue($data, $textField); |
|
| 306 | 306 | if($valueField==='') |
| 307 | 307 | $value=$text; |
| 308 | 308 | $formatString=$this->getDataTextFormatString(); |
| 309 | - $text=$this->formatDataValue($formatString,$text); |
|
| 309 | + $text=$this->formatDataValue($formatString, $text); |
|
| 310 | 310 | } |
| 311 | 311 | else |
| 312 | 312 | $text=$value; |
@@ -98,8 +98,7 @@ |
||
| 98 | 98 | { |
| 99 | 99 | $this->renderLinkButtonHref($writer); |
| 100 | 100 | $this->renderClientControlScript($writer); |
| 101 | - } |
|
| 102 | - else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
| 101 | + } else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
| 103 | 102 | $writer->addAttribute('disabled','disabled'); |
| 104 | 103 | } |
| 105 | 104 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function getEnableClientScript() |
| 72 | 72 | { |
| 73 | - return $this->getViewState('EnableClientScript',true); |
|
| 73 | + return $this->getViewState('EnableClientScript', true); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function setEnableClientScript($value) |
| 80 | 80 | { |
| 81 | - $this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true); |
|
| 81 | + $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $page=$this->getPage(); |
| 92 | 92 | $page->ensureRenderInForm($this); |
| 93 | 93 | |
| 94 | - $writer->addAttribute('id',$this->getClientID()); |
|
| 94 | + $writer->addAttribute('id', $this->getClientID()); |
|
| 95 | 95 | |
| 96 | 96 | // We call parent implementation here because some attributes |
| 97 | 97 | // may be overwritten in the following |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $this->renderClientControlScript($writer); |
| 104 | 104 | } |
| 105 | 105 | else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
| 106 | - $writer->addAttribute('disabled','disabled'); |
|
| 106 | + $writer->addAttribute('disabled', 'disabled'); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | protected function renderClientControlScript($writer) |
| 114 | 114 | { |
| 115 | - $cs = $this->getPage()->getClientScript(); |
|
| 116 | - $cs->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions()); |
|
| 115 | + $cs=$this->getPage()->getClientScript(); |
|
| 116 | + $cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public function setIsDefaultButton($value) |
| 123 | 123 | { |
| 124 | - $this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value),false); |
|
| 124 | + $this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value), false); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | protected function renderLinkButtonHref($writer) |
| 140 | 140 | { |
| 141 | 141 | //create unique no-op url references |
| 142 | - $nop = "javascript:;//".$this->getClientID(); |
|
| 142 | + $nop="javascript:;//".$this->getClientID(); |
|
| 143 | 143 | $writer->addAttribute('href', $nop); |
| 144 | 144 | } |
| 145 | 145 | |
@@ -160,11 +160,11 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | protected function getPostBackOptions() |
| 162 | 162 | { |
| 163 | - $options['ID'] = $this->getClientID(); |
|
| 164 | - $options['EventTarget'] = $this->getUniqueID(); |
|
| 165 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
| 166 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
| 167 | - $options['StopEvent'] = true; |
|
| 163 | + $options['ID']=$this->getClientID(); |
|
| 164 | + $options['EventTarget']=$this->getUniqueID(); |
|
| 165 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
| 166 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
| 167 | + $options['StopEvent']=true; |
|
| 168 | 168 | |
| 169 | 169 | return $options; |
| 170 | 170 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public function getText() |
| 190 | 190 | { |
| 191 | - return $this->getViewState('Text',''); |
|
| 191 | + return $this->getViewState('Text', ''); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | public function setText($value) |
| 198 | 198 | { |
| 199 | - $this->setViewState('Text',$value,''); |
|
| 199 | + $this->setViewState('Text', $value, ''); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | public function getCommandName() |
| 232 | 232 | { |
| 233 | - return $this->getViewState('CommandName',''); |
|
| 233 | + return $this->getViewState('CommandName', ''); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | public function setCommandName($value) |
| 240 | 240 | { |
| 241 | - $this->setViewState('CommandName',$value,''); |
|
| 241 | + $this->setViewState('CommandName', $value, ''); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | public function getCommandParameter() |
| 248 | 248 | { |
| 249 | - return $this->getViewState('CommandParameter',''); |
|
| 249 | + return $this->getViewState('CommandParameter', ''); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | public function setCommandParameter($value) |
| 256 | 256 | { |
| 257 | - $this->setViewState('CommandParameter',$value,''); |
|
| 257 | + $this->setViewState('CommandParameter', $value, ''); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | /** |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | public function getCausesValidation() |
| 264 | 264 | { |
| 265 | - return $this->getViewState('CausesValidation',true); |
|
| 265 | + return $this->getViewState('CausesValidation', true); |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /** |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | */ |
| 272 | 272 | public function setCausesValidation($value) |
| 273 | 273 | { |
| 274 | - $this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true); |
|
| 274 | + $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | /** |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | */ |
| 280 | 280 | public function getValidationGroup() |
| 281 | 281 | { |
| 282 | - return $this->getViewState('ValidationGroup',''); |
|
| 282 | + return $this->getViewState('ValidationGroup', ''); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | /** |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | */ |
| 288 | 288 | public function setValidationGroup($value) |
| 289 | 289 | { |
| 290 | - $this->setViewState('ValidationGroup',$value,''); |
|
| 290 | + $this->setViewState('ValidationGroup', $value, ''); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | if($this->getCausesValidation()) |
| 305 | 305 | $this->getPage()->validate($this->getValidationGroup()); |
| 306 | 306 | $this->onClick(null); |
| 307 | - $this->onCommand(new \Prado\Web\UI\TCommandEventParameter($this->getCommandName(),$this->getCommandParameter())); |
|
| 307 | + $this->onCommand(new \Prado\Web\UI\TCommandEventParameter($this->getCommandName(), $this->getCommandParameter())); |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | /** |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | */ |
| 317 | 317 | public function onClick($param) |
| 318 | 318 | { |
| 319 | - $this->raiseEvent('OnClick',$this,$param); |
|
| 319 | + $this->raiseEvent('OnClick', $this, $param); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | /** |
@@ -328,8 +328,8 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | public function onCommand($param) |
| 330 | 330 | { |
| 331 | - $this->raiseEvent('OnCommand',$this,$param); |
|
| 332 | - $this->raiseBubbleEvent($this,$param); |
|
| 331 | + $this->raiseEvent('OnCommand', $this, $param); |
|
| 332 | + $this->raiseBubbleEvent($this, $param); |
|
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | 335 | |
@@ -325,6 +325,7 @@ |
||
| 325 | 325 | * If you override this method, be sure to call the parent implementation |
| 326 | 326 | * so that the event handlers can be invoked. |
| 327 | 327 | * @param \Prado\Web\UI\TCommandEventParameter event parameter to be passed to the event handlers |
| 328 | + * @param \Prado\Web\UI\TCommandEventParameter $param |
|
| 328 | 329 | */ |
| 329 | 330 | public function onCommand($param) |
| 330 | 331 | { |