@@ -136,6 +136,7 @@ |
||
| 136 | 136 | * @param mixed Name of the PHP variable to bind to the SQL statement parameter |
| 137 | 137 | * @param int SQL data type of the parameter |
| 138 | 138 | * @param int length of the data type |
| 139 | + * @param string $name |
|
| 139 | 140 | * @see http://www.php.net/manual/en/function.PDOStatement-bindParam.php |
| 140 | 141 | */ |
| 141 | 142 | public function bindParameter($name, &$value, $dataType=null, $length=null) |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * TDbTableColumn class file. |
|
| 4 | - * |
|
| 5 | - * @author Wei Zhuo <weizhuo[at]gmail[dot]com> |
|
| 6 | - * @link https://github.com/pradosoft/prado |
|
| 7 | - * @copyright Copyright © 2005-2015 The PRADO Group |
|
| 8 | - * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
| 9 | - * @package System.Data.Common |
|
| 10 | - */ |
|
| 3 | + * TDbTableColumn class file. |
|
| 4 | + * |
|
| 5 | + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> |
|
| 6 | + * @link https://github.com/pradosoft/prado |
|
| 7 | + * @copyright Copyright © 2005-2015 The PRADO Group |
|
| 8 | + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
| 9 | + * @package System.Data.Common |
|
| 10 | + */ |
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * TDbTableColumn class describes the column meta data of the schema for a database table. |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | class TDbTableColumn extends TComponent |
| 20 | 20 | { |
| 21 | - const UNDEFINED_VALUE= INF; //use infinity for undefined value |
|
| 21 | + const UNDEFINED_VALUE=INF; //use infinity for undefined value |
|
| 22 | 22 | |
| 23 | 23 | private $_info=array(); |
| 24 | 24 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @param mixed default value if information array value is null |
| 37 | 37 | * @return mixed information array value. |
| 38 | 38 | */ |
| 39 | - protected function getInfo($name,$default=null) |
|
| 39 | + protected function getInfo($name, $default=null) |
|
| 40 | 40 | { |
| 41 | 41 | return isset($this->_info[$name]) ? $this->_info[$name] : $default; |
| 42 | 42 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param string information array key name |
| 46 | 46 | * @param mixed new information array value. |
| 47 | 47 | */ |
| 48 | - protected function setInfo($name,$value) |
|
| 48 | + protected function setInfo($name, $value) |
|
| 49 | 49 | { |
| 50 | 50 | $this->_info[$name]=$value; |
| 51 | 51 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | public function getAllowNull() |
| 120 | 120 | { |
| 121 | - return $this->getInfo('AllowNull',false); |
|
| 121 | + return $this->getInfo('AllowNull', false); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | if(($precision=$this->getNumericPrecision())!==null) |
| 151 | 151 | { |
| 152 | 152 | $scale=$this->getNumericScale(); |
| 153 | - return $scale===null ? pow(10,$precision) : pow(10,$precision-$scale); |
|
| 153 | + return $scale===null ? pow(10, $precision) : pow(10, $precision - $scale); |
|
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | public function getIsPrimaryKey() |
| 161 | 161 | { |
| 162 | - return $this->getInfo('IsPrimaryKey',false); |
|
| 162 | + return $this->getInfo('IsPrimaryKey', false); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | public function getIsForeignKey() |
| 169 | 169 | { |
| 170 | - return $this->getInfo('IsForeignKey',false); |
|
| 170 | + return $this->getInfo('IsForeignKey', false); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -113,6 +113,7 @@ |
||
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * @param string button caption |
| 116 | + * @param string $value |
|
| 116 | 117 | */ |
| 117 | 118 | public function setButtonText($value) |
| 118 | 119 | { |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function setTypeHandler($value) |
| 51 | 51 | { |
| 52 | - $this->_typeHandler = $value; |
|
| 52 | + $this->_typeHandler=$value; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function setType($value) |
| 67 | 67 | { |
| 68 | - $this->_type = $value; |
|
| 68 | + $this->_type=$value; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function setColumn($value) |
| 83 | 83 | { |
| 84 | - $this->_column = $value; |
|
| 84 | + $this->_column=$value; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public function setDbType($value) |
| 99 | 99 | { |
| 100 | - $this->_dbType = $value; |
|
| 100 | + $this->_dbType=$value; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function setProperty($value) |
| 115 | 115 | { |
| 116 | - $this->_property = $value; |
|
| 116 | + $this->_property=$value; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -130,19 +130,19 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | public function setNullValue($value) |
| 132 | 132 | { |
| 133 | - $this->_nullValue = $value; |
|
| 133 | + $this->_nullValue=$value; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | public function __sleep() |
| 137 | 137 | { |
| 138 | - $exprops = array(); $cn = 'TParameterProperty'; |
|
| 139 | - if ($this->_typeHandler===null) $exprops[] = "\0$cn\0_typeHandler"; |
|
| 140 | - if ($this->_type===null) $exprops[] = "\0$cn\0_type"; |
|
| 141 | - if ($this->_column===null) $exprops[] = "\0$cn\0_column"; |
|
| 142 | - if ($this->_dbType===null) $exprops[] = "\0$cn\0_dbType"; |
|
| 143 | - if ($this->_property===null) $exprops[] = "\0$cn\0_property"; |
|
| 144 | - if ($this->_nullValue===null) $exprops[] = "\0$cn\0_nullValue"; |
|
| 145 | - return array_diff(parent::__sleep(),$exprops); |
|
| 138 | + $exprops=array(); $cn='TParameterProperty'; |
|
| 139 | + if($this->_typeHandler===null) $exprops[]="\0$cn\0_typeHandler"; |
|
| 140 | + if($this->_type===null) $exprops[]="\0$cn\0_type"; |
|
| 141 | + if($this->_column===null) $exprops[]="\0$cn\0_column"; |
|
| 142 | + if($this->_dbType===null) $exprops[]="\0$cn\0_dbType"; |
|
| 143 | + if($this->_property===null) $exprops[]="\0$cn\0_property"; |
|
| 144 | + if($this->_nullValue===null) $exprops[]="\0$cn\0_nullValue"; |
|
| 145 | + return array_diff(parent::__sleep(), $exprops); |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
@@ -113,6 +113,7 @@ |
||
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * @param string button caption |
| 116 | + * @param string $value |
|
| 116 | 117 | */ |
| 117 | 118 | public function setButtonText($value) |
| 118 | 119 | { |
@@ -78,8 +78,8 @@ |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | - * Publish the ajax script |
|
| 82 | - */ |
|
| 81 | + * Publish the ajax script |
|
| 82 | + */ |
|
| 83 | 83 | public function onPreRender($param) |
| 84 | 84 | { |
| 85 | 85 | parent::onPreRender($param); |
@@ -69,12 +69,12 @@ discard block |
||
| 69 | 69 | if($type===null) |
| 70 | 70 | { |
| 71 | 71 | if($this->getControl() instanceof ICallbackEventHandler) |
| 72 | - $this->_activeControlType = 'TBaseActiveCallbackControl'; |
|
| 72 | + $this->_activeControlType='TBaseActiveCallbackControl'; |
|
| 73 | 73 | else |
| 74 | - $this->_activeControlType = 'TBaseActiveControl'; |
|
| 74 | + $this->_activeControlType='TBaseActiveControl'; |
|
| 75 | 75 | } |
| 76 | 76 | else |
| 77 | - $this->_activeControlType = $type; |
|
| 77 | + $this->_activeControlType=$type; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | { |
| 115 | 115 | if($this->_baseActiveControl===null) |
| 116 | 116 | { |
| 117 | - $type = $this->_activeControlType; |
|
| 118 | - $this->_baseActiveControl = new $type($this->getControl()); |
|
| 117 | + $type=$this->_activeControlType; |
|
| 118 | + $this->_baseActiveControl=new $type($this->getControl()); |
|
| 119 | 119 | } |
| 120 | 120 | return $this->_baseActiveControl; |
| 121 | 121 | } |
@@ -127,10 +127,10 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | if($this->getPage()->getIsCallback()) |
| 129 | 129 | { |
| 130 | - $target = $this->getPage()->getCallbackEventTarget(); |
|
| 130 | + $target=$this->getPage()->getCallbackEventTarget(); |
|
| 131 | 131 | if($target instanceof ICallbackEventHandler) |
| 132 | 132 | { |
| 133 | - $client = $target->getActiveControl()->getClientSide(); |
|
| 133 | + $client=$target->getActiveControl()->getClientSide(); |
|
| 134 | 134 | return $client->getEnablePageStateUpdate(); |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | { |
| 145 | 145 | if($this->getIsTrackingPageState()) |
| 146 | 146 | { |
| 147 | - $stateTrackerClass = $this->_stateTrackerClass; |
|
| 148 | - $this->_stateTracker = new $stateTrackerClass($this->getControl()); |
|
| 147 | + $stateTrackerClass=$this->_stateTrackerClass; |
|
| 148 | + $this->_stateTracker=new $stateTrackerClass($this->getControl()); |
|
| 149 | 149 | $this->_stateTracker->trackChanges(); |
| 150 | 150 | } |
| 151 | 151 | parent::onLoad($param); |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | */ |
| 179 | 179 | public function setStateTracker($value) |
| 180 | 180 | { |
| 181 | - $this->_stateTrackerClass = TPropertyValue::ensureString($value); |
|
| 181 | + $this->_stateTrackerClass=TPropertyValue::ensureString($value); |
|
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | |
@@ -216,10 +216,10 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | public function __construct($control) |
| 218 | 218 | { |
| 219 | - $this->_control = $control; |
|
| 220 | - $this->_existingState = new TMap; |
|
| 221 | - $this->_nullObject = new stdClass; |
|
| 222 | - $this->_states = new TMap; |
|
| 219 | + $this->_control=$control; |
|
| 220 | + $this->_existingState=new TMap; |
|
| 221 | + $this->_nullObject=new stdClass; |
|
| 222 | + $this->_states=new TMap; |
|
| 223 | 223 | $this->addStatesToTrack(); |
| 224 | 224 | } |
| 225 | 225 | |
@@ -233,14 +233,14 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | protected function addStatesToTrack() |
| 235 | 235 | { |
| 236 | - $states = $this->getStatesToTrack(); |
|
| 237 | - $states['Visible'] = array('TScalarDiff', array($this, 'updateVisible')); |
|
| 238 | - $states['Enabled'] = array('TScalarDiff', array($this, 'updateEnabled')); |
|
| 239 | - $states['Attributes'] = array('TMapCollectionDiff', array($this, 'updateAttributes')); |
|
| 240 | - $states['Style'] = array('TStyleDiff', array($this, 'updateStyle')); |
|
| 241 | - $states['TabIndex'] = array('TScalarDiff', array($this, 'updateTabIndex')); |
|
| 242 | - $states['ToolTip'] = array('TScalarDiff', array($this, 'updateToolTip')); |
|
| 243 | - $states['AccessKey'] = array('TScalarDiff', array($this, 'updateAccessKey')); |
|
| 236 | + $states=$this->getStatesToTrack(); |
|
| 237 | + $states['Visible']=array('TScalarDiff', array($this, 'updateVisible')); |
|
| 238 | + $states['Enabled']=array('TScalarDiff', array($this, 'updateEnabled')); |
|
| 239 | + $states['Attributes']=array('TMapCollectionDiff', array($this, 'updateAttributes')); |
|
| 240 | + $states['Style']=array('TStyleDiff', array($this, 'updateStyle')); |
|
| 241 | + $states['TabIndex']=array('TScalarDiff', array($this, 'updateTabIndex')); |
|
| 242 | + $states['ToolTip']=array('TScalarDiff', array($this, 'updateToolTip')); |
|
| 243 | + $states['AccessKey']=array('TScalarDiff', array($this, 'updateAccessKey')); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
@@ -259,8 +259,8 @@ discard block |
||
| 259 | 259 | { |
| 260 | 260 | foreach($this->_states as $name => $value) |
| 261 | 261 | { |
| 262 | - $obj = $this->_control->getViewState($name); |
|
| 263 | - $this->_existingState[$name] = is_object($obj) ? clone($obj) : $obj; |
|
| 262 | + $obj=$this->_control->getViewState($name); |
|
| 263 | + $this->_existingState[$name]=is_object($obj) ? clone($obj) : $obj; |
|
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | |
@@ -269,16 +269,16 @@ discard block |
||
| 269 | 269 | */ |
| 270 | 270 | protected function getChanges() |
| 271 | 271 | { |
| 272 | - $changes = array(); |
|
| 272 | + $changes=array(); |
|
| 273 | 273 | foreach($this->_states as $name => $details) |
| 274 | 274 | { |
| 275 | - $new = $this->_control->getViewState($name); |
|
| 276 | - $old = $this->_existingState[$name]; |
|
| 277 | - if($new !== $old) |
|
| 275 | + $new=$this->_control->getViewState($name); |
|
| 276 | + $old=$this->_existingState[$name]; |
|
| 277 | + if($new!==$old) |
|
| 278 | 278 | { |
| 279 | - $diff = new $details[0]($new, $old, $this->_nullObject); |
|
| 280 | - if(($change = $diff->getDifference()) !== $this->_nullObject) |
|
| 281 | - $changes[] = array($details[1],array($change)); |
|
| 279 | + $diff=new $details[0]($new, $old, $this->_nullObject); |
|
| 280 | + if(($change=$diff->getDifference())!==$this->_nullObject) |
|
| 281 | + $changes[]=array($details[1], array($change)); |
|
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | return $changes; |
@@ -335,10 +335,10 @@ discard block |
||
| 335 | 335 | */ |
| 336 | 336 | protected function updateVisible($visible) |
| 337 | 337 | { |
| 338 | - if($visible === false) |
|
| 339 | - $this->client()->replaceContent($this->_control,"<span id=\"".$this->_control->getClientID()."\" style=\"display:none\" ></span>"); |
|
| 338 | + if($visible===false) |
|
| 339 | + $this->client()->replaceContent($this->_control, "<span id=\"".$this->_control->getClientID()."\" style=\"display:none\" ></span>"); |
|
| 340 | 340 | else |
| 341 | - $this->client()->replaceContent($this->_control,$this->_control); |
|
| 341 | + $this->client()->replaceContent($this->_control, $this->_control); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** |
@@ -403,9 +403,9 @@ discard block |
||
| 403 | 403 | */ |
| 404 | 404 | public function __construct($new, $old, $null) |
| 405 | 405 | { |
| 406 | - $this->_new = $new; |
|
| 407 | - $this->_old = $old; |
|
| 408 | - $this->_null = $null; |
|
| 406 | + $this->_new=$new; |
|
| 407 | + $this->_old=$old; |
|
| 408 | + $this->_null=$null; |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | /** |
@@ -430,8 +430,8 @@ discard block |
||
| 430 | 430 | */ |
| 431 | 431 | public function getDifference() |
| 432 | 432 | { |
| 433 | - if(gettype($this->_new) === gettype($this->_old) |
|
| 434 | - && $this->_new === $this->_old) |
|
| 433 | + if(gettype($this->_new)===gettype($this->_old) |
|
| 434 | + && $this->_new===$this->_old) |
|
| 435 | 435 | return $this->_null; |
| 436 | 436 | else |
| 437 | 437 | return $this->_new; |
@@ -457,10 +457,10 @@ discard block |
||
| 457 | 457 | { |
| 458 | 458 | if(!($obj instanceof TStyle)) |
| 459 | 459 | return array(); |
| 460 | - $style = $obj->getStyleFields(); |
|
| 461 | - $style = array_merge($style,$this->getStyleFromString($obj->getCustomStyle())); |
|
| 460 | + $style=$obj->getStyleFields(); |
|
| 461 | + $style=array_merge($style, $this->getStyleFromString($obj->getCustomStyle())); |
|
| 462 | 462 | if($obj->hasFont()) |
| 463 | - $style = array_merge($style, $this->getStyleFromString($obj->getFont()->toString())); |
|
| 463 | + $style=array_merge($style, $this->getStyleFromString($obj->getFont()->toString())); |
|
| 464 | 464 | return $style; |
| 465 | 465 | } |
| 466 | 466 | |
@@ -470,14 +470,14 @@ discard block |
||
| 470 | 470 | */ |
| 471 | 471 | protected function getStyleFromString($string) |
| 472 | 472 | { |
| 473 | - $style = array(); |
|
| 473 | + $style=array(); |
|
| 474 | 474 | if(!is_string($string)) return $style; |
| 475 | 475 | |
| 476 | - foreach(explode(';',$string) as $sub) |
|
| 476 | + foreach(explode(';', $string) as $sub) |
|
| 477 | 477 | { |
| 478 | - $arr=explode(':',$sub); |
|
| 478 | + $arr=explode(':', $sub); |
|
| 479 | 479 | if(isset($arr[1]) && trim($arr[0])!=='') |
| 480 | - $style[trim($arr[0])] = trim($arr[1]); |
|
| 480 | + $style[trim($arr[0])]=trim($arr[1]); |
|
| 481 | 481 | } |
| 482 | 482 | return $style; |
| 483 | 483 | } |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | } |
| 495 | 495 | else |
| 496 | 496 | { |
| 497 | - return $this->_old->getCssClass() !== $this->_new->getCssClass() ? |
|
| 497 | + return $this->_old->getCssClass()!==$this->_new->getCssClass() ? |
|
| 498 | 498 | $this->_new->getCssClass() : null; |
| 499 | 499 | } |
| 500 | 500 | } |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | */ |
| 505 | 505 | protected function getStyleDiff() |
| 506 | 506 | { |
| 507 | - $diff = array_diff_assoc( |
|
| 507 | + $diff=array_diff_assoc( |
|
| 508 | 508 | $this->getCombinedStyle($this->_new), |
| 509 | 509 | $this->getCombinedStyle($this->_old)); |
| 510 | 510 | return count($diff) > 0 ? $diff : null; |
@@ -519,8 +519,8 @@ discard block |
||
| 519 | 519 | return $this->_null; |
| 520 | 520 | else |
| 521 | 521 | { |
| 522 | - $css = $this->getCssClassDiff(); |
|
| 523 | - $style = $this->getStyleDiff(); |
|
| 522 | + $css=$this->getCssClassDiff(); |
|
| 523 | + $style=$this->getStyleDiff(); |
|
| 524 | 524 | if(($css!==null) || ($style!==null)) |
| 525 | 525 | return array('CssClass' => $css, 'Style' => $style); |
| 526 | 526 | else |
@@ -551,9 +551,9 @@ discard block |
||
| 551 | 551 | } |
| 552 | 552 | else |
| 553 | 553 | { |
| 554 | - $new = $this->_new->toArray(); |
|
| 555 | - $old = $this->_old->toArray(); |
|
| 556 | - $diff = array_diff_assoc($new, $old); |
|
| 554 | + $new=$this->_new->toArray(); |
|
| 555 | + $old=$this->_old->toArray(); |
|
| 556 | + $diff=array_diff_assoc($new, $old); |
|
| 557 | 557 | return count($diff) > 0 ? $diff : $this->_null; |
| 558 | 558 | } |
| 559 | 559 | } |
@@ -72,8 +72,7 @@ discard block |
||
| 72 | 72 | $this->_activeControlType = 'TBaseActiveCallbackControl'; |
| 73 | 73 | else |
| 74 | 74 | $this->_activeControlType = 'TBaseActiveControl'; |
| 75 | - } |
|
| 76 | - else |
|
| 75 | + } else |
|
| 77 | 76 | $this->_activeControlType = $type; |
| 78 | 77 | } |
| 79 | 78 | |
@@ -491,8 +490,7 @@ discard block |
||
| 491 | 490 | { |
| 492 | 491 | return ($this->_new!==null) && $this->_new->hasCssClass() |
| 493 | 492 | ? $this->_new->getCssClass() : null; |
| 494 | - } |
|
| 495 | - else |
|
| 493 | + } else |
|
| 496 | 494 | { |
| 497 | 495 | return $this->_old->getCssClass() !== $this->_new->getCssClass() ? |
| 498 | 496 | $this->_new->getCssClass() : null; |
@@ -548,8 +546,7 @@ discard block |
||
| 548 | 546 | if($this->_old===null) |
| 549 | 547 | { |
| 550 | 548 | return ($this->_new!==null) ? $this->_new->toArray() : $this->_null; |
| 551 | - } |
|
| 552 | - else |
|
| 549 | + } else |
|
| 553 | 550 | { |
| 554 | 551 | $new = $this->_new->toArray(); |
| 555 | 552 | $old = $this->_old->toArray(); |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | /** |
| 71 | 71 | * Javascript client class for this control. |
| 72 | 72 | * This method overrides the parent implementation. |
| 73 | - * @return null no javascript class name. |
|
| 73 | + * @return string no javascript class name. |
|
| 74 | 74 | */ |
| 75 | 75 | protected function getClientClassName() |
| 76 | 76 | { |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | protected function createListItemCollection() |
| 84 | 84 | { |
| 85 | - $collection = new TActiveListItemCollection; |
|
| 85 | + $collection=new TActiveListItemCollection; |
|
| 86 | 86 | $collection->setControl($this); |
| 87 | 87 | return $collection; |
| 88 | 88 | } |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | protected function addAttributesToRender($writer) |
| 103 | 103 | { |
| 104 | 104 | parent::addAttributesToRender($writer); |
| 105 | - $writer->addAttribute('id',$this->getClientID()); |
|
| 106 | - if ($this->getAutoPostBack()) |
|
| 105 | + $writer->addAttribute('id', $this->getClientID()); |
|
| 106 | + if($this->getAutoPostBack()) |
|
| 107 | 107 | $this->getActiveControl()->registerCallbackClientScript( |
| 108 | 108 | $this->getClientClassName(), $this->getPostBackOptions()); |
| 109 | 109 | } |
@@ -113,6 +113,7 @@ |
||
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * @param string button caption |
| 116 | + * @param string $value |
|
| 116 | 117 | */ |
| 117 | 118 | public function setButtonText($value) |
| 118 | 119 | { |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * TActiveImageButton class file. |
|
| 4 | - * |
|
| 5 | - * @author Wei Zhuo <weizhuo[at]gamil[dot]com> |
|
| 6 | - * @link https://github.com/pradosoft/prado |
|
| 7 | - * @copyright Copyright © 2005-2015 The PRADO Group |
|
| 8 | - * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
| 9 | - * @package System.Web.UI.ActiveControls |
|
| 10 | - */ |
|
| 3 | + * TActiveImageButton class file. |
|
| 4 | + * |
|
| 5 | + * @author Wei Zhuo <weizhuo[at]gamil[dot]com> |
|
| 6 | + * @link https://github.com/pradosoft/prado |
|
| 7 | + * @copyright Copyright © 2005-2015 The PRADO Group |
|
| 8 | + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
| 9 | + * @package System.Web.UI.ActiveControls |
|
| 10 | + */ |
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * TActiveImageButton class. |
@@ -139,7 +139,7 @@ |
||
| 139 | 139 | protected function addAttributesToRender($writer) |
| 140 | 140 | { |
| 141 | 141 | parent::addAttributesToRender($writer); |
| 142 | - $writer->addAttribute('id',$this->getClientID()); |
|
| 142 | + $writer->addAttribute('id', $this->getClientID()); |
|
| 143 | 143 | $this->getActiveControl()->registerCallbackClientScript( |
| 144 | 144 | $this->getClientClassName(), $this->getPostBackOptions()); |
| 145 | 145 | } |
@@ -317,6 +317,9 @@ |
||
| 317 | 317 | { |
| 318 | 318 | private $_template; |
| 319 | 319 | |
| 320 | + /** |
|
| 321 | + * @param string $template |
|
| 322 | + */ |
|
| 320 | 323 | public function __construct($template) |
| 321 | 324 | { |
| 322 | 325 | $this->_template = $template; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function getWidgetID() |
| 67 | 67 | { |
| 68 | - return $this->getClientID() . '_0'; |
|
| 68 | + return $this->getClientID().'_0'; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function getOptions() |
| 76 | 76 | { |
| 77 | - if (($options=$this->getViewState('JuiOptions'))===null) |
|
| 77 | + if(($options=$this->getViewState('JuiOptions'))===null) |
|
| 78 | 78 | { |
| 79 | 79 | $options=new TJuiControlOptions($this); |
| 80 | 80 | $this->setViewState('JuiOptions', $options); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | protected function getPostBackOptions() |
| 107 | 107 | { |
| 108 | - $options = $this->getOptions()->toArray(); |
|
| 108 | + $options=$this->getOptions()->toArray(); |
|
| 109 | 109 | // overload the "OnStop" event to add information about the current selected items |
| 110 | 110 | if(isset($options['stop'])) |
| 111 | 111 | { |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | protected function addAttributesToRender($writer) |
| 122 | 122 | { |
| 123 | 123 | parent::addAttributesToRender($writer); |
| 124 | - $writer->addAttribute('id',$this->getClientID()); |
|
| 124 | + $writer->addAttribute('id', $this->getClientID()); |
|
| 125 | 125 | $options=TJavascript::encode($this->getPostBackOptions()); |
| 126 | 126 | $cs=$this->getPage()->getClientScript(); |
| 127 | 127 | $code="jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * Raises the OnCreate event |
| 143 | 143 | * @param object $params event parameters |
| 144 | 144 | */ |
| 145 | - public function onCreate ($params) |
|
| 145 | + public function onCreate($params) |
|
| 146 | 146 | { |
| 147 | 147 | $this->raiseEvent('OnCreate', $this, $params); |
| 148 | 148 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * Raises the OnSelected event |
| 152 | 152 | * @param object $params event parameters |
| 153 | 153 | */ |
| 154 | - public function onSelected ($params) |
|
| 154 | + public function onSelected($params) |
|
| 155 | 155 | { |
| 156 | 156 | $this->raiseEvent('OnSelected', $this, $params); |
| 157 | 157 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * Raises the OnSelecting event |
| 161 | 161 | * @param object $params event parameters |
| 162 | 162 | */ |
| 163 | - public function onSelecting ($params) |
|
| 163 | + public function onSelecting($params) |
|
| 164 | 164 | { |
| 165 | 165 | $this->raiseEvent('OnSelecting', $this, $params); |
| 166 | 166 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * Raises the OnStart event |
| 170 | 170 | * @param object $params event parameters |
| 171 | 171 | */ |
| 172 | - public function onStart ($params) |
|
| 172 | + public function onStart($params) |
|
| 173 | 173 | { |
| 174 | 174 | $this->raiseEvent('OnStart', $this, $params); |
| 175 | 175 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * Raises the OnStop event |
| 179 | 179 | * @param object $params event parameters |
| 180 | 180 | */ |
| 181 | - public function onStop ($params) |
|
| 181 | + public function onStop($params) |
|
| 182 | 182 | { |
| 183 | 183 | $this->raiseEvent('OnStop', $this, $params); |
| 184 | 184 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * Raises the OnUnselected event |
| 188 | 188 | * @param object $params event parameters |
| 189 | 189 | */ |
| 190 | - public function onUnselected ($params) |
|
| 190 | + public function onUnselected($params) |
|
| 191 | 191 | { |
| 192 | 192 | $this->raiseEvent('OnUnselected', $this, $params); |
| 193 | 193 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * Raises the OnUnselecting event |
| 197 | 197 | * @param object $params event parameters |
| 198 | 198 | */ |
| 199 | - public function onUnselecting ($params) |
|
| 199 | + public function onUnselecting($params) |
|
| 200 | 200 | { |
| 201 | 201 | $this->raiseEvent('OnUnselecting', $this, $params); |
| 202 | 202 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | public function getSelectables() |
| 232 | 232 | { |
| 233 | 233 | if($this->_repeater===null) |
| 234 | - $this->_repeater = $this->createRepeater(); |
|
| 234 | + $this->_repeater=$this->createRepeater(); |
|
| 235 | 235 | return $this->_repeater; |
| 236 | 236 | } |
| 237 | 237 | |
@@ -240,10 +240,10 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | protected function createRepeater() |
| 242 | 242 | { |
| 243 | - $repeater = Prado::createComponent('System.Web.UI.WebControls.TRepeater'); |
|
| 243 | + $repeater=Prado::createComponent('System.Web.UI.WebControls.TRepeater'); |
|
| 244 | 244 | $repeater->setHeaderTemplate(new TJuiSelectableTemplate('<ul id="'.$this->getWidgetID().'">')); |
| 245 | 245 | $repeater->setFooterTemplate(new TJuiSelectableTemplate('</ul>')); |
| 246 | - $repeater->setItemTemplate(new TTemplate('<li id="<%# $this->ItemIndex %>"><%# $this->DataItem %></li>',null)); |
|
| 246 | + $repeater->setItemTemplate(new TTemplate('<li id="<%# $this->ItemIndex %>"><%# $this->DataItem %></li>', null)); |
|
| 247 | 247 | $repeater->setEmptyTemplate(new TJuiSelectableTemplate('<ul></ul>')); |
| 248 | 248 | $this->getControls()->add($repeater); |
| 249 | 249 | return $repeater; |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | |
| 267 | 267 | public function __construct($template) |
| 268 | 268 | { |
| 269 | - $this->_template = $template; |
|
| 269 | + $this->_template=$template; |
|
| 270 | 270 | } |
| 271 | 271 | /** |
| 272 | 272 | * Instantiates the template. |
@@ -113,6 +113,7 @@ |
||
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * @param string button caption |
| 116 | + * @param string $value |
|
| 116 | 117 | */ |
| 117 | 118 | public function setButtonText($value) |
| 118 | 119 | { |
@@ -58,8 +58,7 @@ |
||
| 58 | 58 | if ($this->sourcepath === NULL) |
| 59 | 59 | { |
| 60 | 60 | $this->sourcepath = $sourcepath; |
| 61 | - } |
|
| 62 | - else |
|
| 61 | + } else |
|
| 63 | 62 | { |
| 64 | 63 | $this->sourcepath->append($sourcepath); |
| 65 | 64 | } |
@@ -43,12 +43,12 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | protected function addAttributesToRender($writer) |
| 45 | 45 | { |
| 46 | - $writer->addAttribute('id',$this->getClientID()); |
|
| 47 | - $writer->addAttribute('method',$this->getMethod()); |
|
| 46 | + $writer->addAttribute('id', $this->getClientID()); |
|
| 47 | + $writer->addAttribute('method', $this->getMethod()); |
|
| 48 | 48 | $uri=$this->getRequest()->getRequestURI(); |
| 49 | - $writer->addAttribute('action',str_replace('&','&',str_replace('&','&',$uri))); |
|
| 49 | + $writer->addAttribute('action', str_replace('&', '&', str_replace('&', '&', $uri))); |
|
| 50 | 50 | if(($enctype=$this->getEnctype())!=='') |
| 51 | - $writer->addAttribute('enctype',$enctype); |
|
| 51 | + $writer->addAttribute('enctype', $enctype); |
|
| 52 | 52 | |
| 53 | 53 | $attributes=$this->getAttributes(); |
| 54 | 54 | $attributes->remove('action'); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | if(($button=$this->findControl($butt))!==null) |
| 60 | 60 | $this->getPage()->getClientScript()->registerDefaultButton($this, $button); |
| 61 | 61 | else |
| 62 | - throw new TInvalidDataValueException('form_defaultbutton_invalid',$butt); |
|
| 62 | + throw new TInvalidDataValueException('form_defaultbutton_invalid', $butt); |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function getDefaultButton() |
| 110 | 110 | { |
| 111 | - return $this->getViewState('DefaultButton',''); |
|
| 111 | + return $this->getViewState('DefaultButton', ''); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | public function setDefaultButton($value) |
| 121 | 121 | { |
| 122 | - $this->setViewState('DefaultButton',$value,''); |
|
| 122 | + $this->setViewState('DefaultButton', $value, ''); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function getMethod() |
| 129 | 129 | { |
| 130 | - return $this->getViewState('Method','post'); |
|
| 130 | + return $this->getViewState('Method', 'post'); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | public function setMethod($value) |
| 137 | 137 | { |
| 138 | - $this->setViewState('Method',TPropertyValue::ensureEnum($value,'post','get'),'post'); |
|
| 138 | + $this->setViewState('Method', TPropertyValue::ensureEnum($value, 'post', 'get'), 'post'); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function getEnctype() |
| 145 | 145 | { |
| 146 | - return $this->getViewState('Enctype',''); |
|
| 146 | + return $this->getViewState('Enctype', ''); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function setEnctype($value) |
| 157 | 157 | { |
| 158 | - $this->setViewState('Enctype',$value,''); |
|
| 158 | + $this->setViewState('Enctype', $value, ''); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /** |
@@ -113,6 +113,7 @@ |
||
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * @param string button caption |
| 116 | + * @param string $value |
|
| 116 | 117 | */ |
| 117 | 118 | public function setButtonText($value) |
| 118 | 119 | { |
@@ -124,9 +124,9 @@ |
||
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | - * Sets the date format for a date validation |
|
| 128 | - * @param string the date format value |
|
| 129 | - */ |
|
| 127 | + * Sets the date format for a date validation |
|
| 128 | + * @param string the date format value |
|
| 129 | + */ |
|
| 130 | 130 | public function setDateFormat($value) |
| 131 | 131 | { |
| 132 | 132 | $this->setViewState('DateFormat', $value, ''); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function getDataType() |
| 51 | 51 | { |
| 52 | - return $this->getViewState('DataType','String'); |
|
| 52 | + return $this->getViewState('DataType', 'String'); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function setDataType($value) |
| 60 | 60 | { |
| 61 | - $this->setViewState('DataType',TPropertyValue::ensureEnum($value,'TValidationDataType'),TValidationDataType::String); |
|
| 61 | + $this->setViewState('DataType', TPropertyValue::ensureEnum($value, 'TValidationDataType'), TValidationDataType::String); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -92,14 +92,14 @@ discard block |
||
| 92 | 92 | switch($this->getDataType()) |
| 93 | 93 | { |
| 94 | 94 | case TValidationDataType::Integer: |
| 95 | - return preg_match('/^[-+]?[0-9]+$/',trim($value)); |
|
| 95 | + return preg_match('/^[-+]?[0-9]+$/', trim($value)); |
|
| 96 | 96 | case TValidationDataType::Float: |
| 97 | - return preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/',trim($value)); |
|
| 97 | + return preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/', trim($value)); |
|
| 98 | 98 | case TValidationDataType::Date: |
| 99 | - $dateFormat = $this->getDateFormat(); |
|
| 99 | + $dateFormat=$this->getDateFormat(); |
|
| 100 | 100 | if(strlen($dateFormat)) |
| 101 | 101 | { |
| 102 | - $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter',$dateFormat); |
|
| 102 | + $formatter=Prado::createComponent('System.Util.TSimpleDateFormatter', $dateFormat); |
|
| 103 | 103 | return $formatter->isValidDate($value); |
| 104 | 104 | } |
| 105 | 105 | else |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | protected function getClientScriptOptions() |
| 116 | 116 | { |
| 117 | - $options = parent::getClientScriptOptions(); |
|
| 117 | + $options=parent::getClientScriptOptions(); |
|
| 118 | 118 | $options['DataType']=$this->getDataType(); |
| 119 | 119 | if(($dateFormat=$this->getDateFormat())!=='') |
| 120 | 120 | $options['DateFormat']=$dateFormat; |
@@ -70,8 +70,7 @@ |
||
| 70 | 70 | { |
| 71 | 71 | $domain=substr($value,$pos+1); |
| 72 | 72 | return $domain===''?false:checkdnsrr($domain,'MX'); |
| 73 | - } |
|
| 74 | - else |
|
| 73 | + } else |
|
| 75 | 74 | return false; |
| 76 | 75 | } |
| 77 | 76 | } |
@@ -213,7 +213,7 @@ |
||
| 213 | 213 | /** |
| 214 | 214 | * Returns the value to be validated. |
| 215 | 215 | * This methid is required by IValidatable interface. |
| 216 | - * @return mixed the value of the property to be validated. |
|
| 216 | + * @return string the value of the property to be validated. |
|
| 217 | 217 | */ |
| 218 | 218 | public function getValidationPropertyValue() |
| 219 | 219 | { |
@@ -463,14 +463,14 @@ |
||
| 463 | 463 | */ |
| 464 | 464 | public function getIsValid() |
| 465 | 465 | { |
| 466 | - return $this->_isValid; |
|
| 466 | + return $this->_isValid; |
|
| 467 | 467 | } |
| 468 | 468 | /** |
| 469 | 469 | * @param bool wether this control is valid. |
| 470 | 470 | */ |
| 471 | 471 | public function setIsValid($value) |
| 472 | 472 | { |
| 473 | - $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
| 473 | + $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | /** |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | protected function addAttributesToRender($writer) |
| 54 | 54 | { |
| 55 | - $writer->addAttribute('name',$this->getUniqueID()); |
|
| 55 | + $writer->addAttribute('name', $this->getUniqueID()); |
|
| 56 | 56 | parent::addAttributesToRender($writer); |
| 57 | 57 | } |
| 58 | 58 | |
@@ -73,15 +73,15 @@ discard block |
||
| 73 | 73 | * @param array the input data collection |
| 74 | 74 | * @return boolean whether the data of the component has been changed |
| 75 | 75 | */ |
| 76 | - public function loadPostData($key,$values) |
|
| 76 | + public function loadPostData($key, $values) |
|
| 77 | 77 | { |
| 78 | 78 | if(!$this->getEnabled(true)) |
| 79 | 79 | return false; |
| 80 | 80 | $this->ensureDataBound(); |
| 81 | - $selection=isset($values[$key])?$values[$key]:null; |
|
| 81 | + $selection=isset($values[$key]) ? $values[$key] : null; |
|
| 82 | 82 | if($selection!==null) |
| 83 | 83 | { |
| 84 | - $index=$this->getItems()->findIndexByValue($selection,false); |
|
| 84 | + $index=$this->getItems()->findIndexByValue($selection, false); |
|
| 85 | 85 | if($this->getSelectedIndex()!==$index) |
| 86 | 86 | { |
| 87 | 87 | $this->setSelectedIndex($index); |