@@ -55,7 +55,7 @@ |
||
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Returns an array of javascript validator options. |
58 | - * @return array javascript validator options. |
|
58 | + * @return boolean javascript validator options. |
|
59 | 59 | */ |
60 | 60 | public function evaluateIsValid() |
61 | 61 | { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * Regular expression used to validate the email address |
33 | 33 | * @see http://www.regular-expressions.info/email.html |
34 | 34 | */ |
35 | - const EMAIL_REGEXP='[a-zA-Z0-9!#$%&\'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&\'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?'; |
|
35 | + const EMAIL_REGEXP = '[a-zA-Z0-9!#$%&\'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&\'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?'; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * Gets the name of the javascript class responsible for performing validation for this control. |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function getRegularExpression() |
51 | 51 | { |
52 | - $regex=parent::getRegularExpression(); |
|
53 | - return $regex===''?self::EMAIL_REGEXP:$regex; |
|
52 | + $regex = parent::getRegularExpression(); |
|
53 | + return $regex === '' ? self::EMAIL_REGEXP : $regex; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -59,17 +59,17 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function evaluateIsValid() |
61 | 61 | { |
62 | - $value=$this->getValidationValue($this->getValidationTarget()); |
|
63 | - $valid=$valid=is_string($value) && strlen($value)<=254 && parent::evaluateIsValid(); |
|
62 | + $value = $this->getValidationValue($this->getValidationTarget()); |
|
63 | + $valid = $valid = is_string($value) && strlen($value) <= 254 && parent::evaluateIsValid(); |
|
64 | 64 | |
65 | - if($valid && $this->getCheckMXRecord() && function_exists('checkdnsrr')) |
|
65 | + if ($valid && $this->getCheckMXRecord() && function_exists('checkdnsrr')) |
|
66 | 66 | { |
67 | - if($value!=='') |
|
67 | + if ($value !== '') |
|
68 | 68 | { |
69 | - if(($pos=strpos($value,'@'))!==false) |
|
69 | + if (($pos = strpos($value, '@')) !== false) |
|
70 | 70 | { |
71 | - $domain=substr($value,$pos+1); |
|
72 | - return $domain===''?false:checkdnsrr($domain,'MX'); |
|
71 | + $domain = substr($value, $pos + 1); |
|
72 | + return $domain === '' ? false : checkdnsrr($domain, 'MX'); |
|
73 | 73 | } |
74 | 74 | else |
75 | 75 | return false; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function getCheckMXRecord() |
85 | 85 | { |
86 | - return $this->getViewState('CheckMXRecord',false); |
|
86 | + return $this->getViewState('CheckMXRecord', false); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function setCheckMXRecord($value) |
94 | 94 | { |
95 | - $this->setViewState('CheckMXRecord',TPropertyValue::ensureBoolean($value),false); |
|
95 | + $this->setViewState('CheckMXRecord', TPropertyValue::ensureBoolean($value), false); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 |
@@ -70,9 +70,9 @@ |
||
70 | 70 | { |
71 | 71 | $domain=substr($value,$pos+1); |
72 | 72 | return $domain===''?false:checkdnsrr($domain,'MX'); |
73 | + } else { |
|
74 | + return false; |
|
73 | 75 | } |
74 | - else |
|
75 | - return false; |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | return $valid; |
@@ -177,6 +177,7 @@ discard block |
||
177 | 177 | * @param string the file name used to save the uploaded file |
178 | 178 | * @param boolean whether to delete the temporary file after saving. |
179 | 179 | * If true, you will not be able to save the uploaded file again. |
180 | + * @param string $fileName |
|
180 | 181 | * @return boolean true if the file saving is successful |
181 | 182 | */ |
182 | 183 | public function saveAs($fileName,$deleteTempFile=true) |
@@ -199,6 +200,7 @@ discard block |
||
199 | 200 | * This method is primarly used by framework developers. |
200 | 201 | * @param string the key that can be used to retrieve data from the input data collection |
201 | 202 | * @param array the input data collection |
203 | + * @param boolean $key |
|
202 | 204 | * @return boolean whether the data of the control has been changed |
203 | 205 | */ |
204 | 206 | public function loadPostData($key,$values) |
@@ -251,7 +253,7 @@ discard block |
||
251 | 253 | /** |
252 | 254 | * Returns the original file name as the property value to be validated. |
253 | 255 | * This method is required by IValidatable property. |
254 | - * @return mixed the property value to be validated |
|
256 | + * @return string the property value to be validated |
|
255 | 257 | */ |
256 | 258 | public function getValidationPropertyValue() |
257 | 259 | { |
@@ -35,29 +35,29 @@ discard block |
||
35 | 35 | /** |
36 | 36 | * Maximum file size (in bytes) allowed to be uploaded, defaults to 1MB. |
37 | 37 | */ |
38 | - const MAX_FILE_SIZE=1048576; |
|
38 | + const MAX_FILE_SIZE = 1048576; |
|
39 | 39 | /** |
40 | 40 | * @var integer the size of the uploaded file (in bytes) |
41 | 41 | */ |
42 | - private $_fileSize=0; |
|
42 | + private $_fileSize = 0; |
|
43 | 43 | /** |
44 | 44 | * @var string The original name of the file on the client machine |
45 | 45 | */ |
46 | - private $_fileName=''; |
|
46 | + private $_fileName = ''; |
|
47 | 47 | /** |
48 | 48 | * @var string the name of the temporary file storing the uploaded file |
49 | 49 | */ |
50 | - private $_localName=''; |
|
50 | + private $_localName = ''; |
|
51 | 51 | /** |
52 | 52 | * @var string the uploaded file mime type |
53 | 53 | */ |
54 | - private $_fileType=''; |
|
54 | + private $_fileType = ''; |
|
55 | 55 | /** |
56 | 56 | * @var integer error code of the current file upload |
57 | 57 | */ |
58 | - protected $_errorCode=UPLOAD_ERR_NO_FILE; |
|
59 | - private $_dataChanged=false; |
|
60 | - private $_isValid=true; |
|
58 | + protected $_errorCode = UPLOAD_ERR_NO_FILE; |
|
59 | + private $_dataChanged = false; |
|
60 | + private $_isValid = true; |
|
61 | 61 | |
62 | 62 | /** |
63 | 63 | * @return string tag name of the file upload control |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | { |
77 | 77 | $this->getPage()->ensureRenderInForm($this); |
78 | 78 | parent::addAttributesToRender($writer); |
79 | - $writer->addAttribute('type','file'); |
|
80 | - $writer->addAttribute('name',$this->getUniqueID()); |
|
81 | - $isEnabled=$this->getEnabled(true); |
|
82 | - if(!$isEnabled && $this->getEnabled()) // in this case parent will not render 'disabled' |
|
83 | - $writer->addAttribute('disabled','disabled'); |
|
79 | + $writer->addAttribute('type', 'file'); |
|
80 | + $writer->addAttribute('name', $this->getUniqueID()); |
|
81 | + $isEnabled = $this->getEnabled(true); |
|
82 | + if (!$isEnabled && $this->getEnabled()) // in this case parent will not render 'disabled' |
|
83 | + $writer->addAttribute('disabled', 'disabled'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | public function onPreRender($param) |
92 | 92 | { |
93 | 93 | parent::onPreRender($param); |
94 | - if(($form=$this->getPage()->getForm())!==null) |
|
94 | + if (($form = $this->getPage()->getForm()) !== null) |
|
95 | 95 | $form->setEnctype('multipart/form-data'); |
96 | - $this->getPage()->getClientScript()->registerHiddenField('MAX_FILE_SIZE',$this->getMaxFileSize()); |
|
97 | - if($this->getEnabled(true)) |
|
96 | + $this->getPage()->getClientScript()->registerHiddenField('MAX_FILE_SIZE', $this->getMaxFileSize()); |
|
97 | + if ($this->getEnabled(true)) |
|
98 | 98 | $this->getPage()->registerRequiresPostData($this); |
99 | 99 | } |
100 | 100 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function getMaxFileSize() |
106 | 106 | { |
107 | - return $this->getViewState('MaxFileSize',self::MAX_FILE_SIZE); |
|
107 | + return $this->getViewState('MaxFileSize', self::MAX_FILE_SIZE); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function setMaxFileSize($size) |
119 | 119 | { |
120 | - $this->setViewState('MaxFileSize',TPropertyValue::ensureInteger($size),self::MAX_FILE_SIZE); |
|
120 | + $this->setViewState('MaxFileSize', TPropertyValue::ensureInteger($size), self::MAX_FILE_SIZE); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function getHasFile() |
171 | 171 | { |
172 | - return $this->_errorCode===UPLOAD_ERR_OK; |
|
172 | + return $this->_errorCode === UPLOAD_ERR_OK; |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
@@ -179,14 +179,14 @@ discard block |
||
179 | 179 | * If true, you will not be able to save the uploaded file again. |
180 | 180 | * @return boolean true if the file saving is successful |
181 | 181 | */ |
182 | - public function saveAs($fileName,$deleteTempFile=true) |
|
182 | + public function saveAs($fileName, $deleteTempFile = true) |
|
183 | 183 | { |
184 | - if($this->_errorCode===UPLOAD_ERR_OK) |
|
184 | + if ($this->_errorCode === UPLOAD_ERR_OK) |
|
185 | 185 | { |
186 | - if($deleteTempFile) |
|
187 | - return move_uploaded_file($this->_localName,$fileName); |
|
188 | - else if(is_uploaded_file($this->_localName)) |
|
189 | - return file_put_contents($fileName,file_get_contents($this->_localName))!==false; |
|
186 | + if ($deleteTempFile) |
|
187 | + return move_uploaded_file($this->_localName, $fileName); |
|
188 | + else if (is_uploaded_file($this->_localName)) |
|
189 | + return file_put_contents($fileName, file_get_contents($this->_localName)) !== false; |
|
190 | 190 | else |
191 | 191 | return false; |
192 | 192 | } |
@@ -201,16 +201,16 @@ discard block |
||
201 | 201 | * @param array the input data collection |
202 | 202 | * @return boolean whether the data of the control has been changed |
203 | 203 | */ |
204 | - public function loadPostData($key,$values) |
|
204 | + public function loadPostData($key, $values) |
|
205 | 205 | { |
206 | - if(isset($_FILES[$key])) |
|
206 | + if (isset($_FILES[$key])) |
|
207 | 207 | { |
208 | - $this->_fileName=$_FILES[$key]['name']; |
|
209 | - $this->_fileSize=$_FILES[$key]['size']; |
|
210 | - $this->_fileType=$_FILES[$key]['type']; |
|
211 | - $this->_errorCode=$_FILES[$key]['error']; |
|
212 | - $this->_localName=$_FILES[$key]['tmp_name']; |
|
213 | - return $this->_dataChanged=true; |
|
208 | + $this->_fileName = $_FILES[$key]['name']; |
|
209 | + $this->_fileSize = $_FILES[$key]['size']; |
|
210 | + $this->_fileType = $_FILES[$key]['type']; |
|
211 | + $this->_errorCode = $_FILES[$key]['error']; |
|
212 | + $this->_localName = $_FILES[$key]['tmp_name']; |
|
213 | + return $this->_dataChanged = true; |
|
214 | 214 | } |
215 | 215 | else |
216 | 216 | return false; |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public function onFileUpload($param) |
237 | 237 | { |
238 | - $this->raiseEvent('OnFileUpload',$this,$param); |
|
238 | + $this->raiseEvent('OnFileUpload', $this, $param); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | public function setIsValid($value) |
274 | 274 | { |
275 | - $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
275 | + $this->_isValid = TPropertyValue::ensureBoolean($value); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | } |
@@ -79,8 +79,10 @@ discard block |
||
79 | 79 | $writer->addAttribute('type','file'); |
80 | 80 | $writer->addAttribute('name',$this->getUniqueID()); |
81 | 81 | $isEnabled=$this->getEnabled(true); |
82 | - if(!$isEnabled && $this->getEnabled()) // in this case parent will not render 'disabled' |
|
82 | + if(!$isEnabled && $this->getEnabled()) { |
|
83 | + // in this case parent will not render 'disabled' |
|
83 | 84 | $writer->addAttribute('disabled','disabled'); |
85 | + } |
|
84 | 86 | } |
85 | 87 | |
86 | 88 | /** |
@@ -91,11 +93,13 @@ discard block |
||
91 | 93 | public function onPreRender($param) |
92 | 94 | { |
93 | 95 | parent::onPreRender($param); |
94 | - if(($form=$this->getPage()->getForm())!==null) |
|
95 | - $form->setEnctype('multipart/form-data'); |
|
96 | + if(($form=$this->getPage()->getForm())!==null) { |
|
97 | + $form->setEnctype('multipart/form-data'); |
|
98 | + } |
|
96 | 99 | $this->getPage()->getClientScript()->registerHiddenField('MAX_FILE_SIZE',$this->getMaxFileSize()); |
97 | - if($this->getEnabled(true)) |
|
98 | - $this->getPage()->registerRequiresPostData($this); |
|
100 | + if($this->getEnabled(true)) { |
|
101 | + $this->getPage()->registerRequiresPostData($this); |
|
102 | + } |
|
99 | 103 | } |
100 | 104 | |
101 | 105 | /** |
@@ -183,15 +187,16 @@ discard block |
||
183 | 187 | { |
184 | 188 | if($this->_errorCode===UPLOAD_ERR_OK) |
185 | 189 | { |
186 | - if($deleteTempFile) |
|
187 | - return move_uploaded_file($this->_localName,$fileName); |
|
188 | - else if(is_uploaded_file($this->_localName)) |
|
189 | - return file_put_contents($fileName,file_get_contents($this->_localName))!==false; |
|
190 | - else |
|
191 | - return false; |
|
190 | + if($deleteTempFile) { |
|
191 | + return move_uploaded_file($this->_localName,$fileName); |
|
192 | + } else if(is_uploaded_file($this->_localName)) { |
|
193 | + return file_put_contents($fileName,file_get_contents($this->_localName))!==false; |
|
194 | + } else { |
|
195 | + return false; |
|
196 | + } |
|
197 | + } else { |
|
198 | + return false; |
|
192 | 199 | } |
193 | - else |
|
194 | - return false; |
|
195 | 200 | } |
196 | 201 | |
197 | 202 | /** |
@@ -211,9 +216,9 @@ discard block |
||
211 | 216 | $this->_errorCode=$_FILES[$key]['error']; |
212 | 217 | $this->_localName=$_FILES[$key]['tmp_name']; |
213 | 218 | return $this->_dataChanged=true; |
219 | + } else { |
|
220 | + return false; |
|
214 | 221 | } |
215 | - else |
|
216 | - return false; |
|
217 | 222 | } |
218 | 223 | |
219 | 224 | /** |
@@ -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 | /** |
@@ -49,7 +49,7 @@ |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
52 | - * @return Tells whether buffering of output can continue after this point |
|
52 | + * @return boolean whether buffering of output can continue after this point |
|
53 | 53 | */ |
54 | 54 | public function getContinueBuffering() |
55 | 55 | { |
@@ -36,7 +36,7 @@ |
||
36 | 36 | /** |
37 | 37 | * @var boolean whether to continue buffering of output |
38 | 38 | */ |
39 | - private $_continueBuffering=true; |
|
39 | + private $_continueBuffering = true; |
|
40 | 40 | |
41 | 41 | |
42 | 42 | /** |
@@ -422,6 +422,7 @@ discard block |
||
422 | 422 | |
423 | 423 | /** |
424 | 424 | * Parse additional options set in the Options property. |
425 | + * @param string $string |
|
425 | 426 | * @return array additional custom options |
426 | 427 | */ |
427 | 428 | protected function parseEditorOptions($string) |
@@ -446,6 +447,7 @@ discard block |
||
446 | 447 | } |
447 | 448 | |
448 | 449 | /** |
450 | + * @param string $culture |
|
449 | 451 | * @return string localized editor interface language extension. |
450 | 452 | */ |
451 | 453 | protected function getLanguageSuffix($culture) |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function getEnableVisualEdit() |
211 | 211 | { |
212 | - return $this->getViewState('EnableVisualEdit',true); |
|
212 | + return $this->getViewState('EnableVisualEdit', true); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public function setEnableVisualEdit($value) |
220 | 220 | { |
221 | - $this->setViewState('EnableVisualEdit',TPropertyValue::ensureBoolean($value),true); |
|
221 | + $this->setViewState('EnableVisualEdit', TPropertyValue::ensureBoolean($value), true); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | /** |
@@ -301,9 +301,9 @@ discard block |
||
301 | 301 | */ |
302 | 302 | protected function addAttributesToRender($writer) |
303 | 303 | { |
304 | - if($this->getEnableVisualEdit() && $this->getEnabled(true)) |
|
304 | + if ($this->getEnableVisualEdit() && $this->getEnabled(true)) |
|
305 | 305 | { |
306 | - $writer->addAttribute('id',$this->getClientID()); |
|
306 | + $writer->addAttribute('id', $this->getClientID()); |
|
307 | 307 | $this->registerEditorClientScript($writer); |
308 | 308 | } |
309 | 309 | |
@@ -354,9 +354,9 @@ discard block |
||
354 | 354 | 'EditorOptions' => $this->getEditorOptions() |
355 | 355 | ); |
356 | 356 | |
357 | - $options = TJavaScript::encode($options,true,true); |
|
357 | + $options = TJavaScript::encode($options, true, true); |
|
358 | 358 | $script = "new {$this->getClientClassName()}($options)"; |
359 | - $scripts->registerEndScript('prado:THtmlArea4'.$this->ClientID,$script); |
|
359 | + $scripts->registerEndScript('prado:THtmlArea4' . $this->ClientID, $script); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | /** |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | */ |
365 | 365 | protected function getScriptUrl() |
366 | 366 | { |
367 | - return $this->getScriptDeploymentPath().'/tinymce.min.js'; |
|
367 | + return $this->getScriptDeploymentPath() . '/tinymce.min.js'; |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
@@ -381,12 +381,12 @@ discard block |
||
381 | 381 | |
382 | 382 | protected function copyCustomPlugins($url) |
383 | 383 | { |
384 | - if($plugins = $this->getCustomPluginPath()) |
|
384 | + if ($plugins = $this->getCustomPluginPath()) |
|
385 | 385 | { |
386 | 386 | $assets = $this->getApplication()->getAssetManager(); |
387 | 387 | $path = is_dir($plugins) ? $plugins : Prado::getPathOfNameSpace($plugins); |
388 | - $dest = $assets->getBasePath().'/'.basename($url).'/plugins/'; |
|
389 | - if(!is_dir($dest) || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
|
388 | + $dest = $assets->getBasePath() . '/' . basename($url) . '/plugins/'; |
|
389 | + if (!is_dir($dest) || $this->getApplication()->getMode() !== TApplicationMode::Performance) |
|
390 | 390 | $assets->copyDirectory($path, $dest); |
391 | 391 | } |
392 | 392 | } |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | $options['height'] = $this->getHeight(); |
407 | 407 | $options['resize'] = 'both'; |
408 | 408 | $options['menubar'] = false; |
409 | - if($this->getReadOnly()) |
|
409 | + if ($this->getReadOnly()) |
|
410 | 410 | { |
411 | 411 | $options['readonly'] = true; |
412 | 412 | $options['toolbar'] = false; |
@@ -428,17 +428,17 @@ discard block |
||
428 | 428 | { |
429 | 429 | $options = array(); |
430 | 430 | $substrings = preg_split('/,\s*\n|\n/', trim($string)); |
431 | - foreach($substrings as $bits) |
|
431 | + foreach ($substrings as $bits) |
|
432 | 432 | { |
433 | - $option = explode(":",$bits,2); |
|
433 | + $option = explode(":", $bits, 2); |
|
434 | 434 | |
435 | - if(count($option) == 2) |
|
435 | + if (count($option) == 2) |
|
436 | 436 | { |
437 | - $value=trim(trim($option[1]),"'\""); |
|
438 | - if (($s=strtolower($value))==='false') |
|
439 | - $value=false; |
|
440 | - elseif ($s==='true') |
|
441 | - $value=true; |
|
437 | + $value = trim(trim($option[1]), "'\""); |
|
438 | + if (($s = strtolower($value)) === 'false') |
|
439 | + $value = false; |
|
440 | + elseif ($s === 'true') |
|
441 | + $value = true; |
|
442 | 442 | $options[trim($option[0])] = $value; |
443 | 443 | } |
444 | 444 | } |
@@ -451,15 +451,15 @@ discard block |
||
451 | 451 | protected function getLanguageSuffix($culture) |
452 | 452 | { |
453 | 453 | $app = $this->getApplication()->getGlobalization(); |
454 | - if(empty($culture) && ($app!==null)) |
|
454 | + if (empty($culture) && ($app !== null)) |
|
455 | 455 | $culture = $app->getCulture(); |
456 | 456 | $variants = array(); |
457 | - if($app!==null) |
|
457 | + if ($app !== null) |
|
458 | 458 | $variants = $app->getCultureVariants($culture); |
459 | 459 | |
460 | - foreach($variants as $variant) |
|
460 | + foreach ($variants as $variant) |
|
461 | 461 | { |
462 | - if(isset(self::$_langs[$variant])) |
|
462 | + if (isset(self::$_langs[$variant])) |
|
463 | 463 | return self::$_langs[$variant]; |
464 | 464 | } |
465 | 465 |
@@ -386,8 +386,9 @@ discard block |
||
386 | 386 | $assets = $this->getApplication()->getAssetManager(); |
387 | 387 | $path = is_dir($plugins) ? $plugins : Prado::getPathOfNameSpace($plugins); |
388 | 388 | $dest = $assets->getBasePath().'/'.basename($url).'/plugins/'; |
389 | - if(!is_dir($dest) || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
|
390 | - $assets->copyDirectory($path, $dest); |
|
389 | + if(!is_dir($dest) || $this->getApplication()->getMode()!==TApplicationMode::Performance) { |
|
390 | + $assets->copyDirectory($path, $dest); |
|
391 | + } |
|
391 | 392 | } |
392 | 393 | } |
393 | 394 | |
@@ -435,10 +436,11 @@ discard block |
||
435 | 436 | if(count($option) == 2) |
436 | 437 | { |
437 | 438 | $value=trim(trim($option[1]),"'\""); |
438 | - if (($s=strtolower($value))==='false') |
|
439 | - $value=false; |
|
440 | - elseif ($s==='true') |
|
441 | - $value=true; |
|
439 | + if (($s=strtolower($value))==='false') { |
|
440 | + $value=false; |
|
441 | + } elseif ($s==='true') { |
|
442 | + $value=true; |
|
443 | + } |
|
442 | 444 | $options[trim($option[0])] = $value; |
443 | 445 | } |
444 | 446 | } |
@@ -451,16 +453,19 @@ discard block |
||
451 | 453 | protected function getLanguageSuffix($culture) |
452 | 454 | { |
453 | 455 | $app = $this->getApplication()->getGlobalization(); |
454 | - if(empty($culture) && ($app!==null)) |
|
455 | - $culture = $app->getCulture(); |
|
456 | + if(empty($culture) && ($app!==null)) { |
|
457 | + $culture = $app->getCulture(); |
|
458 | + } |
|
456 | 459 | $variants = array(); |
457 | - if($app!==null) |
|
458 | - $variants = $app->getCultureVariants($culture); |
|
460 | + if($app!==null) { |
|
461 | + $variants = $app->getCultureVariants($culture); |
|
462 | + } |
|
459 | 463 | |
460 | 464 | foreach($variants as $variant) |
461 | 465 | { |
462 | - if(isset(self::$_langs[$variant])) |
|
463 | - return self::$_langs[$variant]; |
|
466 | + if(isset(self::$_langs[$variant])) { |
|
467 | + return self::$_langs[$variant]; |
|
468 | + } |
|
464 | 469 | } |
465 | 470 | |
466 | 471 | return 'en'; |
@@ -147,6 +147,7 @@ discard block |
||
147 | 147 | /** |
148 | 148 | * Sets the height of the image in the THyperLink |
149 | 149 | * @param string height of the image in the THyperLink |
150 | + * @param string $value |
|
150 | 151 | */ |
151 | 152 | public function setImageHeight($value) |
152 | 153 | { |
@@ -181,6 +182,7 @@ discard block |
||
181 | 182 | /** |
182 | 183 | * Sets the width of the image in the THyperLink |
183 | 184 | * @param string width of the image |
185 | + * @param string $value |
|
184 | 186 | */ |
185 | 187 | public function setImageWidth($value) |
186 | 188 | { |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | */ |
45 | 45 | protected function addAttributesToRender($writer) |
46 | 46 | { |
47 | - $isEnabled=$this->getEnabled(true); |
|
48 | - if($this->getEnabled() && !$isEnabled) |
|
49 | - $writer->addAttribute('disabled','disabled'); |
|
47 | + $isEnabled = $this->getEnabled(true); |
|
48 | + if ($this->getEnabled() && !$isEnabled) |
|
49 | + $writer->addAttribute('disabled', 'disabled'); |
|
50 | 50 | parent::addAttributesToRender($writer); |
51 | - if(($url=$this->getNavigateUrl())!=='' && $isEnabled) |
|
52 | - $writer->addAttribute('href',$url); |
|
53 | - if(($target=$this->getTarget())!=='') |
|
54 | - $writer->addAttribute('target',$target); |
|
51 | + if (($url = $this->getNavigateUrl()) !== '' && $isEnabled) |
|
52 | + $writer->addAttribute('href', $url); |
|
53 | + if (($target = $this->getTarget()) !== '') |
|
54 | + $writer->addAttribute('target', $target); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function renderContents($writer) |
62 | 62 | { |
63 | - if(($imageUrl=$this->getImageUrl())==='') |
|
63 | + if (($imageUrl = $this->getImageUrl()) === '') |
|
64 | 64 | { |
65 | - if(($text=$this->getText())!=='') |
|
65 | + if (($text = $this->getText()) !== '') |
|
66 | 66 | $writer->write(THttpUtility::htmlEncode($text)); |
67 | - else if($this->getHasControls()) |
|
67 | + else if ($this->getHasControls()) |
|
68 | 68 | parent::renderContents($writer); |
69 | 69 | else |
70 | 70 | $writer->write(THttpUtility::htmlEncode($this->getNavigateUrl())); |
@@ -83,17 +83,17 @@ discard block |
||
83 | 83 | */ |
84 | 84 | protected function createImage($imageUrl) |
85 | 85 | { |
86 | - $image=Prado::createComponent('System.Web.UI.WebControls.TImage'); |
|
86 | + $image = Prado::createComponent('System.Web.UI.WebControls.TImage'); |
|
87 | 87 | $image->setImageUrl($imageUrl); |
88 | - if(($width=$this->getImageWidth())!=='') |
|
88 | + if (($width = $this->getImageWidth()) !== '') |
|
89 | 89 | $image->setWidth($width); |
90 | - if(($height=$this->getImageHeight())!=='') |
|
90 | + if (($height = $this->getImageHeight()) !== '') |
|
91 | 91 | $image->setHeight($height); |
92 | - if(($toolTip=$this->getToolTip())!=='') |
|
92 | + if (($toolTip = $this->getToolTip()) !== '') |
|
93 | 93 | $image->setToolTip($toolTip); |
94 | - if(($text=$this->getText())!=='') |
|
94 | + if (($text = $this->getText()) !== '') |
|
95 | 95 | $image->setAlternateText($text); |
96 | - if(($align=$this->getImageAlign())!=='') |
|
96 | + if (($align = $this->getImageAlign()) !== '') |
|
97 | 97 | $image->setImageAlign($align); |
98 | 98 | $image->setBorderWidth('0'); |
99 | 99 | return $image; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function getText() |
106 | 106 | { |
107 | - return $this->getViewState('Text',''); |
|
107 | + return $this->getViewState('Text', ''); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function setText($value) |
115 | 115 | { |
116 | - $this->setViewState('Text',$value,''); |
|
116 | + $this->setViewState('Text', $value, ''); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function getImageAlign() |
123 | 123 | { |
124 | - return $this->getViewState('ImageAlign',''); |
|
124 | + return $this->getViewState('ImageAlign', ''); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function setImageAlign($value) |
135 | 135 | { |
136 | - $this->setViewState('ImageAlign',$value,''); |
|
136 | + $this->setViewState('ImageAlign', $value, ''); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function getImageHeight() |
143 | 143 | { |
144 | - return $this->getViewState('ImageHeight',''); |
|
144 | + return $this->getViewState('ImageHeight', ''); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function setImageHeight($value) |
152 | 152 | { |
153 | - $this->setViewSTate('ImageHeight',$value,''); |
|
153 | + $this->setViewSTate('ImageHeight', $value, ''); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public function getImageUrl() |
160 | 160 | { |
161 | - return $this->getViewState('ImageUrl',''); |
|
161 | + return $this->getViewState('ImageUrl', ''); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function setImageUrl($value) |
169 | 169 | { |
170 | - $this->setViewState('ImageUrl',$value,''); |
|
170 | + $this->setViewState('ImageUrl', $value, ''); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function getImageWidth() |
177 | 177 | { |
178 | - return $this->getViewState('ImageWidth',''); |
|
178 | + return $this->getViewState('ImageWidth', ''); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function setImageWidth($value) |
186 | 186 | { |
187 | - $this->setViewState('ImageWidth',$value,''); |
|
187 | + $this->setViewState('ImageWidth', $value, ''); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | */ |
193 | 193 | public function getNavigateUrl() |
194 | 194 | { |
195 | - return $this->getViewState('NavigateUrl',''); |
|
195 | + return $this->getViewState('NavigateUrl', ''); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function setNavigateUrl($value) |
203 | 203 | { |
204 | - $this->setViewState('NavigateUrl',$value,''); |
|
204 | + $this->setViewState('NavigateUrl', $value, ''); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public function getTarget() |
237 | 237 | { |
238 | - return $this->getViewState('Target',''); |
|
238 | + return $this->getViewState('Target', ''); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function setTarget($value) |
246 | 246 | { |
247 | - $this->setViewState('Target',$value,''); |
|
247 | + $this->setViewState('Target', $value, ''); |
|
248 | 248 | } |
249 | 249 | } |
250 | 250 |
@@ -45,13 +45,16 @@ discard block |
||
45 | 45 | protected function addAttributesToRender($writer) |
46 | 46 | { |
47 | 47 | $isEnabled=$this->getEnabled(true); |
48 | - if($this->getEnabled() && !$isEnabled) |
|
49 | - $writer->addAttribute('disabled','disabled'); |
|
48 | + if($this->getEnabled() && !$isEnabled) { |
|
49 | + $writer->addAttribute('disabled','disabled'); |
|
50 | + } |
|
50 | 51 | parent::addAttributesToRender($writer); |
51 | - if(($url=$this->getNavigateUrl())!=='' && $isEnabled) |
|
52 | - $writer->addAttribute('href',$url); |
|
53 | - if(($target=$this->getTarget())!=='') |
|
54 | - $writer->addAttribute('target',$target); |
|
52 | + if(($url=$this->getNavigateUrl())!=='' && $isEnabled) { |
|
53 | + $writer->addAttribute('href',$url); |
|
54 | + } |
|
55 | + if(($target=$this->getTarget())!=='') { |
|
56 | + $writer->addAttribute('target',$target); |
|
57 | + } |
|
55 | 58 | } |
56 | 59 | |
57 | 60 | /** |
@@ -62,14 +65,14 @@ discard block |
||
62 | 65 | { |
63 | 66 | if(($imageUrl=$this->getImageUrl())==='') |
64 | 67 | { |
65 | - if(($text=$this->getText())!=='') |
|
66 | - $writer->write(THttpUtility::htmlEncode($text)); |
|
67 | - else if($this->getHasControls()) |
|
68 | - parent::renderContents($writer); |
|
69 | - else |
|
70 | - $writer->write(THttpUtility::htmlEncode($this->getNavigateUrl())); |
|
71 | - } |
|
72 | - else |
|
68 | + if(($text=$this->getText())!=='') { |
|
69 | + $writer->write(THttpUtility::htmlEncode($text)); |
|
70 | + } else if($this->getHasControls()) { |
|
71 | + parent::renderContents($writer); |
|
72 | + } else { |
|
73 | + $writer->write(THttpUtility::htmlEncode($this->getNavigateUrl())); |
|
74 | + } |
|
75 | + } else |
|
73 | 76 | { |
74 | 77 | $this->createImage($imageUrl)->renderControl($writer); |
75 | 78 | } |
@@ -85,16 +88,21 @@ discard block |
||
85 | 88 | { |
86 | 89 | $image=Prado::createComponent('System.Web.UI.WebControls.TImage'); |
87 | 90 | $image->setImageUrl($imageUrl); |
88 | - if(($width=$this->getImageWidth())!=='') |
|
89 | - $image->setWidth($width); |
|
90 | - if(($height=$this->getImageHeight())!=='') |
|
91 | - $image->setHeight($height); |
|
92 | - if(($toolTip=$this->getToolTip())!=='') |
|
93 | - $image->setToolTip($toolTip); |
|
94 | - if(($text=$this->getText())!=='') |
|
95 | - $image->setAlternateText($text); |
|
96 | - if(($align=$this->getImageAlign())!=='') |
|
97 | - $image->setImageAlign($align); |
|
91 | + if(($width=$this->getImageWidth())!=='') { |
|
92 | + $image->setWidth($width); |
|
93 | + } |
|
94 | + if(($height=$this->getImageHeight())!=='') { |
|
95 | + $image->setHeight($height); |
|
96 | + } |
|
97 | + if(($toolTip=$this->getToolTip())!=='') { |
|
98 | + $image->setToolTip($toolTip); |
|
99 | + } |
|
100 | + if(($text=$this->getText())!=='') { |
|
101 | + $image->setAlternateText($text); |
|
102 | + } |
|
103 | + if(($align=$this->getImageAlign())!=='') { |
|
104 | + $image->setImageAlign($align); |
|
105 | + } |
|
98 | 106 | $image->setBorderWidth('0'); |
99 | 107 | return $image; |
100 | 108 | } |
@@ -232,6 +232,7 @@ discard block |
||
232 | 232 | * If you override this method, be sure to call the parent implementation |
233 | 233 | * so that the event handlers can be invoked. |
234 | 234 | * @param TCommandEventParameter event parameter to be passed to the event handlers |
235 | + * @param TCommandEventParameter $param |
|
235 | 236 | */ |
236 | 237 | public function onCommand($param) |
237 | 238 | { |
@@ -324,6 +325,7 @@ discard block |
||
324 | 325 | |
325 | 326 | /** |
326 | 327 | * @param string the group of validators which the button causes validation upon postback |
328 | + * @param string $value |
|
327 | 329 | */ |
328 | 330 | public function setValidationGroup($value) |
329 | 331 | { |
@@ -396,6 +398,8 @@ discard block |
||
396 | 398 | * Constructor. |
397 | 399 | * @param integer X coordinate of the clicking point |
398 | 400 | * @param integer Y coordinate of the clicking point |
401 | + * @param integer $x |
|
402 | + * @param integer $y |
|
399 | 403 | */ |
400 | 404 | public function __construct($x,$y) |
401 | 405 | { |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | /** |
60 | 60 | * @var integer x coordinate that the image is being clicked at |
61 | 61 | */ |
62 | - private $_x=0; |
|
62 | + private $_x = 0; |
|
63 | 63 | /** |
64 | 64 | * @var integer y coordinate that the image is being clicked at |
65 | 65 | */ |
66 | - private $_y=0; |
|
67 | - private $_dataChanged=false; |
|
66 | + private $_y = 0; |
|
67 | + private $_dataChanged = false; |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * @return string tag name of the button |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function getEnableClientScript() |
81 | 81 | { |
82 | - return $this->getViewState('EnableClientScript',true); |
|
82 | + return $this->getViewState('EnableClientScript', true); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function setEnableClientScript($value) |
89 | 89 | { |
90 | - $this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true); |
|
90 | + $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -97,18 +97,18 @@ discard block |
||
97 | 97 | */ |
98 | 98 | protected function addAttributesToRender($writer) |
99 | 99 | { |
100 | - $page=$this->getPage(); |
|
100 | + $page = $this->getPage(); |
|
101 | 101 | $page->ensureRenderInForm($this); |
102 | - $writer->addAttribute('type','image'); |
|
103 | - if(($uniqueID=$this->getUniqueID())!=='') |
|
104 | - $writer->addAttribute('name',$uniqueID); |
|
105 | - if($this->getEnabled(true)) |
|
102 | + $writer->addAttribute('type', 'image'); |
|
103 | + if (($uniqueID = $this->getUniqueID()) !== '') |
|
104 | + $writer->addAttribute('name', $uniqueID); |
|
105 | + if ($this->getEnabled(true)) |
|
106 | 106 | { |
107 | - if($this->getEnableClientScript() && $this->needPostBackScript()) |
|
107 | + if ($this->getEnableClientScript() && $this->needPostBackScript()) |
|
108 | 108 | $this->renderClientControlScript($writer); |
109 | 109 | } |
110 | - else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
111 | - $writer->addAttribute('disabled','disabled'); |
|
110 | + else if ($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
111 | + $writer->addAttribute('disabled', 'disabled'); |
|
112 | 112 | parent::addAttributesToRender($writer); |
113 | 113 | } |
114 | 114 | |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | */ |
118 | 118 | protected function renderClientControlScript($writer) |
119 | 119 | { |
120 | - $writer->addAttribute('id',$this->getClientID()); |
|
120 | + $writer->addAttribute('id', $this->getClientID()); |
|
121 | 121 | $cs = $this->getPage()->getClientScript(); |
122 | - $cs->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions()); |
|
122 | + $cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | */ |
138 | 138 | protected function canCauseValidation() |
139 | 139 | { |
140 | - if($this->getCausesValidation()) |
|
140 | + if ($this->getCausesValidation()) |
|
141 | 141 | { |
142 | - $group=$this->getValidationGroup(); |
|
143 | - return $this->getPage()->getValidators($group)->getCount()>0; |
|
142 | + $group = $this->getValidationGroup(); |
|
143 | + return $this->getPage()->getValidators($group)->getCount() > 0; |
|
144 | 144 | } |
145 | 145 | else |
146 | 146 | return false; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function setIsDefaultButton($value) |
153 | 153 | { |
154 | - $this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value),false); |
|
154 | + $this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value), false); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -192,16 +192,16 @@ discard block |
||
192 | 192 | * @param array the input data collection |
193 | 193 | * @return boolean whether the data of the component has been changed |
194 | 194 | */ |
195 | - public function loadPostData($key,$values) |
|
195 | + public function loadPostData($key, $values) |
|
196 | 196 | { |
197 | - $uid=$this->getUniqueID(); |
|
198 | - if(isset($values["{$uid}_x"]) && isset($values["{$uid}_y"])) |
|
197 | + $uid = $this->getUniqueID(); |
|
198 | + if (isset($values["{$uid}_x"]) && isset($values["{$uid}_y"])) |
|
199 | 199 | { |
200 | - $this->_x=intval($values["{$uid}_x"]); |
|
201 | - $this->_y=intval($values["{$uid}_y"]); |
|
202 | - if($this->getPage()->getPostBackEventTarget()===null) |
|
200 | + $this->_x = intval($values["{$uid}_x"]); |
|
201 | + $this->_y = intval($values["{$uid}_y"]); |
|
202 | + if ($this->getPage()->getPostBackEventTarget() === null) |
|
203 | 203 | $this->getPage()->setPostBackEventTarget($this); |
204 | - $this->_dataChanged=true; |
|
204 | + $this->_dataChanged = true; |
|
205 | 205 | } |
206 | 206 | return false; |
207 | 207 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public function onClick($param) |
225 | 225 | { |
226 | - $this->raiseEvent('OnClick',$this,$param); |
|
226 | + $this->raiseEvent('OnClick', $this, $param); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public function onCommand($param) |
237 | 237 | { |
238 | - $this->raiseEvent('OnCommand',$this,$param); |
|
239 | - $this->raiseBubbleEvent($this,$param); |
|
238 | + $this->raiseEvent('OnCommand', $this, $param); |
|
239 | + $this->raiseBubbleEvent($this, $param); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -250,10 +250,10 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public function raisePostBackEvent($param) |
252 | 252 | { |
253 | - if($this->getCausesValidation()) |
|
253 | + if ($this->getCausesValidation()) |
|
254 | 254 | $this->getPage()->validate($this->getValidationGroup()); |
255 | - $this->onClick(new TImageClickEventParameter($this->_x,$this->_y)); |
|
256 | - $this->onCommand(new TCommandEventParameter($this->getCommandName(),$this->getCommandParameter())); |
|
255 | + $this->onClick(new TImageClickEventParameter($this->_x, $this->_y)); |
|
256 | + $this->onCommand(new TCommandEventParameter($this->getCommandName(), $this->getCommandParameter())); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | */ |
272 | 272 | public function getCausesValidation() |
273 | 273 | { |
274 | - return $this->getViewState('CausesValidation',true); |
|
274 | + return $this->getViewState('CausesValidation', true); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | */ |
280 | 280 | public function setCausesValidation($value) |
281 | 281 | { |
282 | - $this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true); |
|
282 | + $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | */ |
288 | 288 | public function getCommandName() |
289 | 289 | { |
290 | - return $this->getViewState('CommandName',''); |
|
290 | + return $this->getViewState('CommandName', ''); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | */ |
296 | 296 | public function setCommandName($value) |
297 | 297 | { |
298 | - $this->setViewState('CommandName',$value,''); |
|
298 | + $this->setViewState('CommandName', $value, ''); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | */ |
304 | 304 | public function getCommandParameter() |
305 | 305 | { |
306 | - return $this->getViewState('CommandParameter',''); |
|
306 | + return $this->getViewState('CommandParameter', ''); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | /** |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | */ |
312 | 312 | public function setCommandParameter($value) |
313 | 313 | { |
314 | - $this->setViewState('CommandParameter',$value,''); |
|
314 | + $this->setViewState('CommandParameter', $value, ''); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | public function getValidationGroup() |
321 | 321 | { |
322 | - return $this->getViewState('ValidationGroup',''); |
|
322 | + return $this->getViewState('ValidationGroup', ''); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | /** |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | */ |
328 | 328 | public function setValidationGroup($value) |
329 | 329 | { |
330 | - $this->setViewState('ValidationGroup',$value,''); |
|
330 | + $this->setViewState('ValidationGroup', $value, ''); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | /** |
@@ -385,22 +385,22 @@ discard block |
||
385 | 385 | * the X coordinate of the clicking point |
386 | 386 | * @var integer |
387 | 387 | */ |
388 | - private $_x=0; |
|
388 | + private $_x = 0; |
|
389 | 389 | /** |
390 | 390 | * the Y coordinate of the clicking point |
391 | 391 | * @var integer |
392 | 392 | */ |
393 | - private $_y=0; |
|
393 | + private $_y = 0; |
|
394 | 394 | |
395 | 395 | /** |
396 | 396 | * Constructor. |
397 | 397 | * @param integer X coordinate of the clicking point |
398 | 398 | * @param integer Y coordinate of the clicking point |
399 | 399 | */ |
400 | - public function __construct($x,$y) |
|
400 | + public function __construct($x, $y) |
|
401 | 401 | { |
402 | - $this->_x=$x; |
|
403 | - $this->_y=$y; |
|
402 | + $this->_x = $x; |
|
403 | + $this->_y = $y; |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | /** |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | */ |
417 | 417 | public function setX($value) |
418 | 418 | { |
419 | - $this->_x=TPropertyValue::ensureInteger($value); |
|
419 | + $this->_x = TPropertyValue::ensureInteger($value); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | /** |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | */ |
433 | 433 | public function setY($value) |
434 | 434 | { |
435 | - $this->_y=TPropertyValue::ensureInteger($value); |
|
435 | + $this->_y = TPropertyValue::ensureInteger($value); |
|
436 | 436 | } |
437 | 437 | } |
438 | 438 |
@@ -100,15 +100,18 @@ discard block |
||
100 | 100 | $page=$this->getPage(); |
101 | 101 | $page->ensureRenderInForm($this); |
102 | 102 | $writer->addAttribute('type','image'); |
103 | - if(($uniqueID=$this->getUniqueID())!=='') |
|
104 | - $writer->addAttribute('name',$uniqueID); |
|
103 | + if(($uniqueID=$this->getUniqueID())!=='') { |
|
104 | + $writer->addAttribute('name',$uniqueID); |
|
105 | + } |
|
105 | 106 | if($this->getEnabled(true)) |
106 | 107 | { |
107 | - if($this->getEnableClientScript() && $this->needPostBackScript()) |
|
108 | - $this->renderClientControlScript($writer); |
|
109 | - } |
|
110 | - else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
108 | + if($this->getEnableClientScript() && $this->needPostBackScript()) { |
|
109 | + $this->renderClientControlScript($writer); |
|
110 | + } |
|
111 | + } else if($this->getEnabled()) { |
|
112 | + // in this case, parent will not render 'disabled' |
|
111 | 113 | $writer->addAttribute('disabled','disabled'); |
114 | + } |
|
112 | 115 | parent::addAttributesToRender($writer); |
113 | 116 | } |
114 | 117 | |
@@ -141,9 +144,9 @@ discard block |
||
141 | 144 | { |
142 | 145 | $group=$this->getValidationGroup(); |
143 | 146 | return $this->getPage()->getValidators($group)->getCount()>0; |
147 | + } else { |
|
148 | + return false; |
|
144 | 149 | } |
145 | - else |
|
146 | - return false; |
|
147 | 150 | } |
148 | 151 | |
149 | 152 | /** |
@@ -199,8 +202,9 @@ discard block |
||
199 | 202 | { |
200 | 203 | $this->_x=intval($values["{$uid}_x"]); |
201 | 204 | $this->_y=intval($values["{$uid}_y"]); |
202 | - if($this->getPage()->getPostBackEventTarget()===null) |
|
203 | - $this->getPage()->setPostBackEventTarget($this); |
|
205 | + if($this->getPage()->getPostBackEventTarget()===null) { |
|
206 | + $this->getPage()->setPostBackEventTarget($this); |
|
207 | + } |
|
204 | 208 | $this->_dataChanged=true; |
205 | 209 | } |
206 | 210 | return false; |
@@ -250,8 +254,9 @@ discard block |
||
250 | 254 | */ |
251 | 255 | public function raisePostBackEvent($param) |
252 | 256 | { |
253 | - if($this->getCausesValidation()) |
|
254 | - $this->getPage()->validate($this->getValidationGroup()); |
|
257 | + if($this->getCausesValidation()) { |
|
258 | + $this->getPage()->validate($this->getValidationGroup()); |
|
259 | + } |
|
255 | 260 | $this->onClick(new TImageClickEventParameter($this->_x,$this->_y)); |
256 | 261 | $this->onCommand(new TCommandEventParameter($this->getCommandName(),$this->getCommandParameter())); |
257 | 262 | } |
@@ -212,6 +212,7 @@ discard block |
||
212 | 212 | * If you override this method, be sure to call the parent implementation |
213 | 213 | * so that the event handler can be invoked. |
214 | 214 | * @param TImageMapEventParameter event parameter to be passed to the event handlers |
215 | + * @param TImageMapEventParameter $param |
|
215 | 216 | */ |
216 | 217 | public function onClick($param) |
217 | 218 | { |
@@ -303,6 +304,7 @@ discard block |
||
303 | 304 | * that must be kept in viewstate. |
304 | 305 | * @param string the name of the viewstate value to be returned |
305 | 306 | * @param mixed the default value. If $key is not found in viewstate, $defaultValue will be returned |
307 | + * @param string $key |
|
306 | 308 | * @return mixed the viewstate value corresponding to $key |
307 | 309 | */ |
308 | 310 | protected function getViewState($key,$defaultValue=null) |
@@ -319,6 +321,7 @@ discard block |
||
319 | 321 | * @param string the name of the viewstate value |
320 | 322 | * @param mixed the viewstate value to be set |
321 | 323 | * @param mixed default value. If $value===$defaultValue, the item will be cleared from the viewstate. |
324 | + * @param string $key |
|
322 | 325 | */ |
323 | 326 | protected function setViewState($key,$value,$defaultValue=null) |
324 | 327 | { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | class TImageMap extends TImage implements IPostBackEventHandler |
39 | 39 | { |
40 | - const MAP_NAME_PREFIX='ImageMap'; |
|
40 | + const MAP_NAME_PREFIX = 'ImageMap'; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Processes an object that is created during parsing template. |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function addParsedObject($object) |
49 | 49 | { |
50 | - if($object instanceof THotSpot) |
|
50 | + if ($object instanceof THotSpot) |
|
51 | 51 | $this->getHotSpots()->add($object); |
52 | 52 | } |
53 | 53 | |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | protected function addAttributesToRender($writer) |
60 | 60 | { |
61 | 61 | parent::addAttributesToRender($writer); |
62 | - if($this->getHotSpots()->getCount()>0) |
|
62 | + if ($this->getHotSpots()->getCount() > 0) |
|
63 | 63 | { |
64 | - $writer->addAttribute('usemap','#'.self::MAP_NAME_PREFIX.$this->getClientID()); |
|
65 | - $writer->addAttribute('id',$this->getUniqueID()); |
|
64 | + $writer->addAttribute('usemap', '#' . self::MAP_NAME_PREFIX . $this->getClientID()); |
|
65 | + $writer->addAttribute('id', $this->getUniqueID()); |
|
66 | 66 | } |
67 | - if($this->getEnabled() && !$this->getEnabled(true)) |
|
68 | - $writer->addAttribute('disabled','disabled'); |
|
67 | + if ($this->getEnabled() && !$this->getEnabled(true)) |
|
68 | + $writer->addAttribute('disabled', 'disabled'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -76,39 +76,39 @@ discard block |
||
76 | 76 | { |
77 | 77 | parent::render($writer); |
78 | 78 | |
79 | - $hotspots=$this->getHotSpots(); |
|
79 | + $hotspots = $this->getHotSpots(); |
|
80 | 80 | |
81 | - if($hotspots->getCount()>0) |
|
81 | + if ($hotspots->getCount() > 0) |
|
82 | 82 | { |
83 | - $clientID=$this->getClientID(); |
|
84 | - $cs=$this->getPage()->getClientScript(); |
|
83 | + $clientID = $this->getClientID(); |
|
84 | + $cs = $this->getPage()->getClientScript(); |
|
85 | 85 | $writer->writeLine(); |
86 | - $writer->addAttribute('name',self::MAP_NAME_PREFIX.$clientID); |
|
86 | + $writer->addAttribute('name', self::MAP_NAME_PREFIX . $clientID); |
|
87 | 87 | $writer->renderBeginTag('map'); |
88 | 88 | $writer->writeLine(); |
89 | - if(($mode=$this->getHotSpotMode())===THotSpotMode::NotSet) |
|
90 | - $mode=THotSpotMode::Navigate; |
|
91 | - $target=$this->getTarget(); |
|
92 | - $i=0; |
|
89 | + if (($mode = $this->getHotSpotMode()) === THotSpotMode::NotSet) |
|
90 | + $mode = THotSpotMode::Navigate; |
|
91 | + $target = $this->getTarget(); |
|
92 | + $i = 0; |
|
93 | 93 | $options['EventTarget'] = $this->getUniqueID(); |
94 | 94 | $options['StopEvent'] = true; |
95 | - $cs=$this->getPage()->getClientScript(); |
|
96 | - foreach($hotspots as $hotspot) |
|
95 | + $cs = $this->getPage()->getClientScript(); |
|
96 | + foreach ($hotspots as $hotspot) |
|
97 | 97 | { |
98 | - if($hotspot->getHotSpotMode()===THotSpotMode::NotSet) |
|
98 | + if ($hotspot->getHotSpotMode() === THotSpotMode::NotSet) |
|
99 | 99 | $hotspot->setHotSpotMode($mode); |
100 | - if($target!=='' && $hotspot->getTarget()==='') |
|
100 | + if ($target !== '' && $hotspot->getTarget() === '') |
|
101 | 101 | $hotspot->setTarget($target); |
102 | - if($hotspot->getHotSpotMode()===THotSpotMode::PostBack) |
|
102 | + if ($hotspot->getHotSpotMode() === THotSpotMode::PostBack) |
|
103 | 103 | { |
104 | - $id=$clientID.'_'.$i; |
|
105 | - $writer->addAttribute('id',$id); |
|
106 | - $writer->addAttribute('href','#'.$id); //create unique no-op url references |
|
107 | - $options['ID']=$id; |
|
108 | - $options['EventParameter']="$i"; |
|
109 | - $options['CausesValidation']=$hotspot->getCausesValidation(); |
|
110 | - $options['ValidationGroup']=$hotspot->getValidationGroup(); |
|
111 | - $cs->registerPostBackControl($this->getClientClassName(),$options); |
|
104 | + $id = $clientID . '_' . $i; |
|
105 | + $writer->addAttribute('id', $id); |
|
106 | + $writer->addAttribute('href', '#' . $id); //create unique no-op url references |
|
107 | + $options['ID'] = $id; |
|
108 | + $options['EventParameter'] = "$i"; |
|
109 | + $options['CausesValidation'] = $hotspot->getCausesValidation(); |
|
110 | + $options['ValidationGroup'] = $hotspot->getValidationGroup(); |
|
111 | + $cs->registerPostBackControl($this->getClientClassName(), $options); |
|
112 | 112 | } |
113 | 113 | $hotspot->render($writer); |
114 | 114 | $writer->writeLine(); |
@@ -136,25 +136,25 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public function raisePostBackEvent($param) |
138 | 138 | { |
139 | - $postBackValue=null; |
|
140 | - if($param!=='') |
|
139 | + $postBackValue = null; |
|
140 | + if ($param !== '') |
|
141 | 141 | { |
142 | - $index=TPropertyValue::ensureInteger($param); |
|
143 | - $hotspots=$this->getHotSpots(); |
|
144 | - if($index>=0 && $index<$hotspots->getCount()) |
|
142 | + $index = TPropertyValue::ensureInteger($param); |
|
143 | + $hotspots = $this->getHotSpots(); |
|
144 | + if ($index >= 0 && $index < $hotspots->getCount()) |
|
145 | 145 | { |
146 | - $hotspot=$hotspots->itemAt($index); |
|
147 | - if(($mode=$hotspot->getHotSpotMode())===THotSpotMode::NotSet) |
|
148 | - $mode=$this->getHotSpotMode(); |
|
149 | - if($mode===THotSpotMode::PostBack) |
|
146 | + $hotspot = $hotspots->itemAt($index); |
|
147 | + if (($mode = $hotspot->getHotSpotMode()) === THotSpotMode::NotSet) |
|
148 | + $mode = $this->getHotSpotMode(); |
|
149 | + if ($mode === THotSpotMode::PostBack) |
|
150 | 150 | { |
151 | - $postBackValue=$hotspot->getPostBackValue(); |
|
152 | - if($hotspot->getCausesValidation()) |
|
151 | + $postBackValue = $hotspot->getPostBackValue(); |
|
152 | + if ($hotspot->getCausesValidation()) |
|
153 | 153 | $this->getPage()->validate($hotspot->getValidationGroup()); |
154 | 154 | } |
155 | 155 | } |
156 | 156 | } |
157 | - if($postBackValue!==null) |
|
157 | + if ($postBackValue !== null) |
|
158 | 158 | $this->onClick(new TImageMapEventParameter($postBackValue)); |
159 | 159 | } |
160 | 160 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function getHotSpotMode() |
165 | 165 | { |
166 | - return $this->getViewState('HotSpotMode',THotSpotMode::NotSet); |
|
166 | + return $this->getViewState('HotSpotMode', THotSpotMode::NotSet); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function setHotSpotMode($value) |
176 | 176 | { |
177 | - $this->setViewState('HotSpotMode',TPropertyValue::ensureEnum($value,'THotSpotMode'),THotSpotMode::NotSet); |
|
177 | + $this->setViewState('HotSpotMode', TPropertyValue::ensureEnum($value, 'THotSpotMode'), THotSpotMode::NotSet); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | */ |
183 | 183 | public function getHotSpots() |
184 | 184 | { |
185 | - if(($hotspots=$this->getViewState('HotSpots',null))===null) |
|
185 | + if (($hotspots = $this->getViewState('HotSpots', null)) === null) |
|
186 | 186 | { |
187 | - $hotspots=new THotSpotCollection; |
|
188 | - $this->setViewState('HotSpots',$hotspots); |
|
187 | + $hotspots = new THotSpotCollection; |
|
188 | + $this->setViewState('HotSpots', $hotspots); |
|
189 | 189 | } |
190 | 190 | return $hotspots; |
191 | 191 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function getTarget() |
197 | 197 | { |
198 | - return $this->getViewState('Target',''); |
|
198 | + return $this->getViewState('Target', ''); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public function setTarget($value) |
205 | 205 | { |
206 | - $this->setViewState('Target',TPropertyValue::ensureString($value),''); |
|
206 | + $this->setViewState('Target', TPropertyValue::ensureString($value), ''); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public function onClick($param) |
217 | 217 | { |
218 | - $this->raiseEvent('OnClick',$this,$param); |
|
218 | + $this->raiseEvent('OnClick', $this, $param); |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | */ |
242 | 242 | public function __construct($postBackValue) |
243 | 243 | { |
244 | - $this->_postBackValue=$postBackValue; |
|
244 | + $this->_postBackValue = $postBackValue; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | * @param mixed new item |
272 | 272 | * @throws TInvalidDataTypeException if the item to be inserted is not a THotSpot. |
273 | 273 | */ |
274 | - public function insertAt($index,$item) |
|
274 | + public function insertAt($index, $item) |
|
275 | 275 | { |
276 | - if($item instanceof THotSpot) |
|
277 | - parent::insertAt($index,$item); |
|
276 | + if ($item instanceof THotSpot) |
|
277 | + parent::insertAt($index, $item); |
|
278 | 278 | else |
279 | 279 | throw new TInvalidDataTypeException('hotspotcollection_hotspot_required'); |
280 | 280 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | */ |
295 | 295 | abstract class THotSpot extends TComponent |
296 | 296 | { |
297 | - private $_viewState=array(); |
|
297 | + private $_viewState = array(); |
|
298 | 298 | |
299 | 299 | /** |
300 | 300 | * Returns a viewstate value. |
@@ -305,9 +305,9 @@ discard block |
||
305 | 305 | * @param mixed the default value. If $key is not found in viewstate, $defaultValue will be returned |
306 | 306 | * @return mixed the viewstate value corresponding to $key |
307 | 307 | */ |
308 | - protected function getViewState($key,$defaultValue=null) |
|
308 | + protected function getViewState($key, $defaultValue = null) |
|
309 | 309 | { |
310 | - return isset($this->_viewState[$key])?$this->_viewState[$key]:$defaultValue; |
|
310 | + return isset($this->_viewState[$key]) ? $this->_viewState[$key] : $defaultValue; |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -320,12 +320,12 @@ discard block |
||
320 | 320 | * @param mixed the viewstate value to be set |
321 | 321 | * @param mixed default value. If $value===$defaultValue, the item will be cleared from the viewstate. |
322 | 322 | */ |
323 | - protected function setViewState($key,$value,$defaultValue=null) |
|
323 | + protected function setViewState($key, $value, $defaultValue = null) |
|
324 | 324 | { |
325 | - if($value===$defaultValue) |
|
325 | + if ($value === $defaultValue) |
|
326 | 326 | unset($this->_viewState[$key]); |
327 | 327 | else |
328 | - $this->_viewState[$key]=$value; |
|
328 | + $this->_viewState[$key] = $value; |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | */ |
343 | 343 | public function getAccessKey() |
344 | 344 | { |
345 | - return $this->getViewState('AccessKey',''); |
|
345 | + return $this->getViewState('AccessKey', ''); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | */ |
351 | 351 | public function setAccessKey($value) |
352 | 352 | { |
353 | - $this->setViewState('AccessKey',TPropertyValue::ensureString($value),''); |
|
353 | + $this->setViewState('AccessKey', TPropertyValue::ensureString($value), ''); |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | /** |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | */ |
359 | 359 | public function getAlternateText() |
360 | 360 | { |
361 | - return $this->getViewState('AlternateText',''); |
|
361 | + return $this->getViewState('AlternateText', ''); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | /** |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | */ |
367 | 367 | public function setAlternateText($value) |
368 | 368 | { |
369 | - $this->setViewState('AlternateText',TPropertyValue::ensureString($value),''); |
|
369 | + $this->setViewState('AlternateText', TPropertyValue::ensureString($value), ''); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | /** |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | */ |
375 | 375 | public function getHotSpotMode() |
376 | 376 | { |
377 | - return $this->getViewState('HotSpotMode',THotSpotMode::NotSet); |
|
377 | + return $this->getViewState('HotSpotMode', THotSpotMode::NotSet); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | /** |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | */ |
383 | 383 | public function setHotSpotMode($value) |
384 | 384 | { |
385 | - $this->setViewState('HotSpotMode',TPropertyValue::ensureEnum($value,'THotSpotMode'),THotSpotMode::NotSet); |
|
385 | + $this->setViewState('HotSpotMode', TPropertyValue::ensureEnum($value, 'THotSpotMode'), THotSpotMode::NotSet); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | /** |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | */ |
391 | 391 | public function getNavigateUrl() |
392 | 392 | { |
393 | - return $this->getViewState('NavigateUrl',''); |
|
393 | + return $this->getViewState('NavigateUrl', ''); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | /** |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | */ |
399 | 399 | public function setNavigateUrl($value) |
400 | 400 | { |
401 | - $this->setViewState('NavigateUrl',TPropertyValue::ensureString($value),''); |
|
401 | + $this->setViewState('NavigateUrl', TPropertyValue::ensureString($value), ''); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | /** |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | */ |
407 | 407 | public function getPostBackValue() |
408 | 408 | { |
409 | - return $this->getViewState('PostBackValue',''); |
|
409 | + return $this->getViewState('PostBackValue', ''); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | /** |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | */ |
415 | 415 | public function setPostBackValue($value) |
416 | 416 | { |
417 | - $this->setViewState('PostBackValue',TPropertyValue::ensureString($value),''); |
|
417 | + $this->setViewState('PostBackValue', TPropertyValue::ensureString($value), ''); |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | /** |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | */ |
423 | 423 | public function getTabIndex() |
424 | 424 | { |
425 | - return $this->getViewState('TabIndex',0); |
|
425 | + return $this->getViewState('TabIndex', 0); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | /** |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | */ |
431 | 431 | public function setTabIndex($value) |
432 | 432 | { |
433 | - $this->setViewState('TabIndex',TPropertyValue::ensureInteger($value),0); |
|
433 | + $this->setViewState('TabIndex', TPropertyValue::ensureInteger($value), 0); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | /** |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | */ |
439 | 439 | public function getCausesValidation() |
440 | 440 | { |
441 | - return $this->getViewState('CausesValidation',true); |
|
441 | + return $this->getViewState('CausesValidation', true); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | /** |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | */ |
447 | 447 | public function setCausesValidation($value) |
448 | 448 | { |
449 | - $this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true); |
|
449 | + $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true); |
|
450 | 450 | } |
451 | 451 | |
452 | 452 | /** |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | */ |
455 | 455 | public function getValidationGroup() |
456 | 456 | { |
457 | - return $this->getViewState('ValidationGroup',''); |
|
457 | + return $this->getViewState('ValidationGroup', ''); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | /** |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | */ |
463 | 463 | public function setValidationGroup($value) |
464 | 464 | { |
465 | - $this->setViewState('ValidationGroup',$value,''); |
|
465 | + $this->setViewState('ValidationGroup', $value, ''); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | /** |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | */ |
472 | 472 | public function getTarget() |
473 | 473 | { |
474 | - return $this->getViewState('Target',''); |
|
474 | + return $this->getViewState('Target', ''); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | /** |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | */ |
481 | 481 | public function setTarget($value) |
482 | 482 | { |
483 | - $this->setViewState('Target',TPropertyValue::ensureString($value),''); |
|
483 | + $this->setViewState('Target', TPropertyValue::ensureString($value), ''); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | /** |
@@ -488,8 +488,8 @@ discard block |
||
488 | 488 | */ |
489 | 489 | public function getHasAttributes() |
490 | 490 | { |
491 | - if($attributes=$this->getViewState('Attributes',null)) |
|
492 | - return $attributes->getCount()>0; |
|
491 | + if ($attributes = $this->getViewState('Attributes', null)) |
|
492 | + return $attributes->getCount() > 0; |
|
493 | 493 | else |
494 | 494 | return false; |
495 | 495 | } |
@@ -502,12 +502,12 @@ discard block |
||
502 | 502 | */ |
503 | 503 | public function getAttributes() |
504 | 504 | { |
505 | - if($attributes=$this->getViewState('Attributes',null)) |
|
505 | + if ($attributes = $this->getViewState('Attributes', null)) |
|
506 | 506 | return $attributes; |
507 | 507 | else |
508 | 508 | { |
509 | - $attributes=new TAttributeCollection; |
|
510 | - $this->setViewState('Attributes',$attributes,null); |
|
509 | + $attributes = new TAttributeCollection; |
|
510 | + $this->setViewState('Attributes', $attributes, null); |
|
511 | 511 | return $attributes; |
512 | 512 | } |
513 | 513 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | */ |
518 | 518 | public function hasAttribute($name) |
519 | 519 | { |
520 | - if($attributes=$this->getViewState('Attributes',null)) |
|
520 | + if ($attributes = $this->getViewState('Attributes', null)) |
|
521 | 521 | return $attributes->contains($name); |
522 | 522 | else |
523 | 523 | return false; |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | */ |
529 | 529 | public function getAttribute($name) |
530 | 530 | { |
531 | - if($attributes=$this->getViewState('Attributes',null)) |
|
531 | + if ($attributes = $this->getViewState('Attributes', null)) |
|
532 | 532 | return $attributes->itemAt($name); |
533 | 533 | else |
534 | 534 | return null; |
@@ -539,9 +539,9 @@ discard block |
||
539 | 539 | * @param string attribute name |
540 | 540 | * @param string value of the attribute |
541 | 541 | */ |
542 | - public function setAttribute($name,$value) |
|
542 | + public function setAttribute($name, $value) |
|
543 | 543 | { |
544 | - $this->getAttributes()->add($name,$value); |
|
544 | + $this->getAttributes()->add($name, $value); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | /** |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | */ |
552 | 552 | public function removeAttribute($name) |
553 | 553 | { |
554 | - if($attributes=$this->getViewState('Attributes',null)) |
|
554 | + if ($attributes = $this->getViewState('Attributes', null)) |
|
555 | 555 | return $attributes->remove($name); |
556 | 556 | else |
557 | 557 | return null; |
@@ -563,29 +563,29 @@ discard block |
||
563 | 563 | */ |
564 | 564 | public function render($writer) |
565 | 565 | { |
566 | - $writer->addAttribute('shape',$this->getShape()); |
|
567 | - $writer->addAttribute('coords',$this->getCoordinates()); |
|
568 | - if(($mode=$this->getHotSpotMode())===THotSpotMode::NotSet) |
|
569 | - $mode=THotSpotMode::Navigate; |
|
570 | - if($mode===THotSpotMode::Navigate) |
|
566 | + $writer->addAttribute('shape', $this->getShape()); |
|
567 | + $writer->addAttribute('coords', $this->getCoordinates()); |
|
568 | + if (($mode = $this->getHotSpotMode()) === THotSpotMode::NotSet) |
|
569 | + $mode = THotSpotMode::Navigate; |
|
570 | + if ($mode === THotSpotMode::Navigate) |
|
571 | 571 | { |
572 | - $writer->addAttribute('href',$this->getNavigateUrl()); |
|
573 | - if(($target=$this->getTarget())!=='') |
|
574 | - $writer->addAttribute('target',$target); |
|
572 | + $writer->addAttribute('href', $this->getNavigateUrl()); |
|
573 | + if (($target = $this->getTarget()) !== '') |
|
574 | + $writer->addAttribute('target', $target); |
|
575 | 575 | } |
576 | - else if($mode===THotSpotMode::Inactive) |
|
577 | - $writer->addAttribute('nohref','true'); |
|
578 | - $text=$this->getAlternateText(); |
|
579 | - $writer->addAttribute('title',$text); |
|
580 | - $writer->addAttribute('alt',$text); |
|
581 | - if(($accessKey=$this->getAccessKey())!=='') |
|
582 | - $writer->addAttribute('accesskey',$accessKey); |
|
583 | - if(($tabIndex=$this->getTabIndex())!==0) |
|
584 | - $writer->addAttribute('tabindex',"$tabIndex"); |
|
585 | - if($this->getHasAttributes()) |
|
576 | + else if ($mode === THotSpotMode::Inactive) |
|
577 | + $writer->addAttribute('nohref', 'true'); |
|
578 | + $text = $this->getAlternateText(); |
|
579 | + $writer->addAttribute('title', $text); |
|
580 | + $writer->addAttribute('alt', $text); |
|
581 | + if (($accessKey = $this->getAccessKey()) !== '') |
|
582 | + $writer->addAttribute('accesskey', $accessKey); |
|
583 | + if (($tabIndex = $this->getTabIndex()) !== 0) |
|
584 | + $writer->addAttribute('tabindex', "$tabIndex"); |
|
585 | + if ($this->getHasAttributes()) |
|
586 | 586 | { |
587 | - foreach($this->getAttributes() as $name=>$value) |
|
588 | - $writer->addAttribute($name,$value); |
|
587 | + foreach ($this->getAttributes() as $name=>$value) |
|
588 | + $writer->addAttribute($name, $value); |
|
589 | 589 | } |
590 | 590 | $writer->renderBeginTag('area'); |
591 | 591 | $writer->renderEndTag(); |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | */ |
618 | 618 | public function getCoordinates() |
619 | 619 | { |
620 | - return $this->getX().','.$this->getY().','.$this->getRadius(); |
|
620 | + return $this->getX() . ',' . $this->getY() . ',' . $this->getRadius(); |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | /** |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | */ |
626 | 626 | public function getRadius() |
627 | 627 | { |
628 | - return $this->getViewState('Radius',0); |
|
628 | + return $this->getViewState('Radius', 0); |
|
629 | 629 | } |
630 | 630 | |
631 | 631 | /** |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | */ |
634 | 634 | public function setRadius($value) |
635 | 635 | { |
636 | - $this->setViewState('Radius',TPropertyValue::ensureInteger($value),0); |
|
636 | + $this->setViewState('Radius', TPropertyValue::ensureInteger($value), 0); |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | /** |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | */ |
642 | 642 | public function getX() |
643 | 643 | { |
644 | - return $this->getViewState('X',0); |
|
644 | + return $this->getViewState('X', 0); |
|
645 | 645 | } |
646 | 646 | |
647 | 647 | /** |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | */ |
650 | 650 | public function setX($value) |
651 | 651 | { |
652 | - $this->setViewState('X',TPropertyValue::ensureInteger($value),0); |
|
652 | + $this->setViewState('X', TPropertyValue::ensureInteger($value), 0); |
|
653 | 653 | } |
654 | 654 | |
655 | 655 | /** |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | */ |
658 | 658 | public function getY() |
659 | 659 | { |
660 | - return $this->getViewState('Y',0); |
|
660 | + return $this->getViewState('Y', 0); |
|
661 | 661 | } |
662 | 662 | |
663 | 663 | /** |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | */ |
666 | 666 | public function setY($value) |
667 | 667 | { |
668 | - $this->setViewState('Y',TPropertyValue::ensureInteger($value),0); |
|
668 | + $this->setViewState('Y', TPropertyValue::ensureInteger($value), 0); |
|
669 | 669 | } |
670 | 670 | } |
671 | 671 | |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | */ |
695 | 695 | public function getCoordinates() |
696 | 696 | { |
697 | - return $this->getLeft().','.$this->getTop().','.$this->getRight().','.$this->getBottom(); |
|
697 | + return $this->getLeft() . ',' . $this->getTop() . ',' . $this->getRight() . ',' . $this->getBottom(); |
|
698 | 698 | } |
699 | 699 | |
700 | 700 | /** |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | */ |
703 | 703 | public function getBottom() |
704 | 704 | { |
705 | - return $this->getViewState('Bottom',0); |
|
705 | + return $this->getViewState('Bottom', 0); |
|
706 | 706 | } |
707 | 707 | |
708 | 708 | /** |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | */ |
711 | 711 | public function setBottom($value) |
712 | 712 | { |
713 | - $this->setViewState('Bottom',TPropertyValue::ensureInteger($value),0); |
|
713 | + $this->setViewState('Bottom', TPropertyValue::ensureInteger($value), 0); |
|
714 | 714 | } |
715 | 715 | |
716 | 716 | /** |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | */ |
719 | 719 | public function getLeft() |
720 | 720 | { |
721 | - return $this->getViewState('Left',0); |
|
721 | + return $this->getViewState('Left', 0); |
|
722 | 722 | } |
723 | 723 | |
724 | 724 | /** |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | */ |
727 | 727 | public function setLeft($value) |
728 | 728 | { |
729 | - $this->setViewState('Left',TPropertyValue::ensureInteger($value),0); |
|
729 | + $this->setViewState('Left', TPropertyValue::ensureInteger($value), 0); |
|
730 | 730 | } |
731 | 731 | |
732 | 732 | /** |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | */ |
735 | 735 | public function getRight() |
736 | 736 | { |
737 | - return $this->getViewState('Right',0); |
|
737 | + return $this->getViewState('Right', 0); |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | /** |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | */ |
743 | 743 | public function setRight($value) |
744 | 744 | { |
745 | - $this->setViewState('Right',TPropertyValue::ensureInteger($value),0); |
|
745 | + $this->setViewState('Right', TPropertyValue::ensureInteger($value), 0); |
|
746 | 746 | } |
747 | 747 | |
748 | 748 | /** |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | */ |
751 | 751 | public function getTop() |
752 | 752 | { |
753 | - return $this->getViewState('Top',0); |
|
753 | + return $this->getViewState('Top', 0); |
|
754 | 754 | } |
755 | 755 | |
756 | 756 | /** |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | */ |
759 | 759 | public function setTop($value) |
760 | 760 | { |
761 | - $this->setViewState('Top',TPropertyValue::ensureInteger($value),0); |
|
761 | + $this->setViewState('Top', TPropertyValue::ensureInteger($value), 0); |
|
762 | 762 | } |
763 | 763 | } |
764 | 764 | |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | */ |
790 | 790 | public function getCoordinates() |
791 | 791 | { |
792 | - return $this->getViewState('Coordinates',''); |
|
792 | + return $this->getViewState('Coordinates', ''); |
|
793 | 793 | } |
794 | 794 | |
795 | 795 | /** |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | */ |
800 | 800 | public function setCoordinates($value) |
801 | 801 | { |
802 | - $this->setViewState('Coordinates',$value,''); |
|
802 | + $this->setViewState('Coordinates', $value, ''); |
|
803 | 803 | } |
804 | 804 | } |
805 | 805 | |
@@ -820,9 +820,9 @@ discard block |
||
820 | 820 | */ |
821 | 821 | class THotSpotMode extends TEnumerable |
822 | 822 | { |
823 | - const NotSet='NotSet'; |
|
824 | - const Navigate='Navigate'; |
|
825 | - const PostBack='PostBack'; |
|
826 | - const Inactive='Inactive'; |
|
823 | + const NotSet = 'NotSet'; |
|
824 | + const Navigate = 'Navigate'; |
|
825 | + const PostBack = 'PostBack'; |
|
826 | + const Inactive = 'Inactive'; |
|
827 | 827 | } |
828 | 828 |
@@ -47,8 +47,9 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function addParsedObject($object) |
49 | 49 | { |
50 | - if($object instanceof THotSpot) |
|
51 | - $this->getHotSpots()->add($object); |
|
50 | + if($object instanceof THotSpot) { |
|
51 | + $this->getHotSpots()->add($object); |
|
52 | + } |
|
52 | 53 | } |
53 | 54 | |
54 | 55 | /** |
@@ -64,8 +65,9 @@ discard block |
||
64 | 65 | $writer->addAttribute('usemap','#'.self::MAP_NAME_PREFIX.$this->getClientID()); |
65 | 66 | $writer->addAttribute('id',$this->getUniqueID()); |
66 | 67 | } |
67 | - if($this->getEnabled() && !$this->getEnabled(true)) |
|
68 | - $writer->addAttribute('disabled','disabled'); |
|
68 | + if($this->getEnabled() && !$this->getEnabled(true)) { |
|
69 | + $writer->addAttribute('disabled','disabled'); |
|
70 | + } |
|
69 | 71 | } |
70 | 72 | |
71 | 73 | /** |
@@ -86,8 +88,9 @@ discard block |
||
86 | 88 | $writer->addAttribute('name',self::MAP_NAME_PREFIX.$clientID); |
87 | 89 | $writer->renderBeginTag('map'); |
88 | 90 | $writer->writeLine(); |
89 | - if(($mode=$this->getHotSpotMode())===THotSpotMode::NotSet) |
|
90 | - $mode=THotSpotMode::Navigate; |
|
91 | + if(($mode=$this->getHotSpotMode())===THotSpotMode::NotSet) { |
|
92 | + $mode=THotSpotMode::Navigate; |
|
93 | + } |
|
91 | 94 | $target=$this->getTarget(); |
92 | 95 | $i=0; |
93 | 96 | $options['EventTarget'] = $this->getUniqueID(); |
@@ -95,10 +98,12 @@ discard block |
||
95 | 98 | $cs=$this->getPage()->getClientScript(); |
96 | 99 | foreach($hotspots as $hotspot) |
97 | 100 | { |
98 | - if($hotspot->getHotSpotMode()===THotSpotMode::NotSet) |
|
99 | - $hotspot->setHotSpotMode($mode); |
|
100 | - if($target!=='' && $hotspot->getTarget()==='') |
|
101 | - $hotspot->setTarget($target); |
|
101 | + if($hotspot->getHotSpotMode()===THotSpotMode::NotSet) { |
|
102 | + $hotspot->setHotSpotMode($mode); |
|
103 | + } |
|
104 | + if($target!=='' && $hotspot->getTarget()==='') { |
|
105 | + $hotspot->setTarget($target); |
|
106 | + } |
|
102 | 107 | if($hotspot->getHotSpotMode()===THotSpotMode::PostBack) |
103 | 108 | { |
104 | 109 | $id=$clientID.'_'.$i; |
@@ -144,18 +149,21 @@ discard block |
||
144 | 149 | if($index>=0 && $index<$hotspots->getCount()) |
145 | 150 | { |
146 | 151 | $hotspot=$hotspots->itemAt($index); |
147 | - if(($mode=$hotspot->getHotSpotMode())===THotSpotMode::NotSet) |
|
148 | - $mode=$this->getHotSpotMode(); |
|
152 | + if(($mode=$hotspot->getHotSpotMode())===THotSpotMode::NotSet) { |
|
153 | + $mode=$this->getHotSpotMode(); |
|
154 | + } |
|
149 | 155 | if($mode===THotSpotMode::PostBack) |
150 | 156 | { |
151 | 157 | $postBackValue=$hotspot->getPostBackValue(); |
152 | - if($hotspot->getCausesValidation()) |
|
153 | - $this->getPage()->validate($hotspot->getValidationGroup()); |
|
158 | + if($hotspot->getCausesValidation()) { |
|
159 | + $this->getPage()->validate($hotspot->getValidationGroup()); |
|
160 | + } |
|
154 | 161 | } |
155 | 162 | } |
156 | 163 | } |
157 | - if($postBackValue!==null) |
|
158 | - $this->onClick(new TImageMapEventParameter($postBackValue)); |
|
164 | + if($postBackValue!==null) { |
|
165 | + $this->onClick(new TImageMapEventParameter($postBackValue)); |
|
166 | + } |
|
159 | 167 | } |
160 | 168 | |
161 | 169 | /** |
@@ -273,10 +281,11 @@ discard block |
||
273 | 281 | */ |
274 | 282 | public function insertAt($index,$item) |
275 | 283 | { |
276 | - if($item instanceof THotSpot) |
|
277 | - parent::insertAt($index,$item); |
|
278 | - else |
|
279 | - throw new TInvalidDataTypeException('hotspotcollection_hotspot_required'); |
|
284 | + if($item instanceof THotSpot) { |
|
285 | + parent::insertAt($index,$item); |
|
286 | + } else { |
|
287 | + throw new TInvalidDataTypeException('hotspotcollection_hotspot_required'); |
|
288 | + } |
|
280 | 289 | } |
281 | 290 | } |
282 | 291 | |
@@ -322,10 +331,11 @@ discard block |
||
322 | 331 | */ |
323 | 332 | protected function setViewState($key,$value,$defaultValue=null) |
324 | 333 | { |
325 | - if($value===$defaultValue) |
|
326 | - unset($this->_viewState[$key]); |
|
327 | - else |
|
328 | - $this->_viewState[$key]=$value; |
|
334 | + if($value===$defaultValue) { |
|
335 | + unset($this->_viewState[$key]); |
|
336 | + } else { |
|
337 | + $this->_viewState[$key]=$value; |
|
338 | + } |
|
329 | 339 | } |
330 | 340 | |
331 | 341 | /** |
@@ -488,10 +498,11 @@ discard block |
||
488 | 498 | */ |
489 | 499 | public function getHasAttributes() |
490 | 500 | { |
491 | - if($attributes=$this->getViewState('Attributes',null)) |
|
492 | - return $attributes->getCount()>0; |
|
493 | - else |
|
494 | - return false; |
|
501 | + if($attributes=$this->getViewState('Attributes',null)) { |
|
502 | + return $attributes->getCount()>0; |
|
503 | + } else { |
|
504 | + return false; |
|
505 | + } |
|
495 | 506 | } |
496 | 507 | |
497 | 508 | /** |
@@ -502,9 +513,9 @@ discard block |
||
502 | 513 | */ |
503 | 514 | public function getAttributes() |
504 | 515 | { |
505 | - if($attributes=$this->getViewState('Attributes',null)) |
|
506 | - return $attributes; |
|
507 | - else |
|
516 | + if($attributes=$this->getViewState('Attributes',null)) { |
|
517 | + return $attributes; |
|
518 | + } else |
|
508 | 519 | { |
509 | 520 | $attributes=new TAttributeCollection; |
510 | 521 | $this->setViewState('Attributes',$attributes,null); |
@@ -517,10 +528,11 @@ discard block |
||
517 | 528 | */ |
518 | 529 | public function hasAttribute($name) |
519 | 530 | { |
520 | - if($attributes=$this->getViewState('Attributes',null)) |
|
521 | - return $attributes->contains($name); |
|
522 | - else |
|
523 | - return false; |
|
531 | + if($attributes=$this->getViewState('Attributes',null)) { |
|
532 | + return $attributes->contains($name); |
|
533 | + } else { |
|
534 | + return false; |
|
535 | + } |
|
524 | 536 | } |
525 | 537 | |
526 | 538 | /** |
@@ -528,10 +540,11 @@ discard block |
||
528 | 540 | */ |
529 | 541 | public function getAttribute($name) |
530 | 542 | { |
531 | - if($attributes=$this->getViewState('Attributes',null)) |
|
532 | - return $attributes->itemAt($name); |
|
533 | - else |
|
534 | - return null; |
|
543 | + if($attributes=$this->getViewState('Attributes',null)) { |
|
544 | + return $attributes->itemAt($name); |
|
545 | + } else { |
|
546 | + return null; |
|
547 | + } |
|
535 | 548 | } |
536 | 549 | |
537 | 550 | /** |
@@ -551,10 +564,11 @@ discard block |
||
551 | 564 | */ |
552 | 565 | public function removeAttribute($name) |
553 | 566 | { |
554 | - if($attributes=$this->getViewState('Attributes',null)) |
|
555 | - return $attributes->remove($name); |
|
556 | - else |
|
557 | - return null; |
|
567 | + if($attributes=$this->getViewState('Attributes',null)) { |
|
568 | + return $attributes->remove($name); |
|
569 | + } else { |
|
570 | + return null; |
|
571 | + } |
|
558 | 572 | } |
559 | 573 | |
560 | 574 | /** |
@@ -565,27 +579,32 @@ discard block |
||
565 | 579 | { |
566 | 580 | $writer->addAttribute('shape',$this->getShape()); |
567 | 581 | $writer->addAttribute('coords',$this->getCoordinates()); |
568 | - if(($mode=$this->getHotSpotMode())===THotSpotMode::NotSet) |
|
569 | - $mode=THotSpotMode::Navigate; |
|
582 | + if(($mode=$this->getHotSpotMode())===THotSpotMode::NotSet) { |
|
583 | + $mode=THotSpotMode::Navigate; |
|
584 | + } |
|
570 | 585 | if($mode===THotSpotMode::Navigate) |
571 | 586 | { |
572 | 587 | $writer->addAttribute('href',$this->getNavigateUrl()); |
573 | - if(($target=$this->getTarget())!=='') |
|
574 | - $writer->addAttribute('target',$target); |
|
588 | + if(($target=$this->getTarget())!=='') { |
|
589 | + $writer->addAttribute('target',$target); |
|
590 | + } |
|
591 | + } else if($mode===THotSpotMode::Inactive) { |
|
592 | + $writer->addAttribute('nohref','true'); |
|
575 | 593 | } |
576 | - else if($mode===THotSpotMode::Inactive) |
|
577 | - $writer->addAttribute('nohref','true'); |
|
578 | 594 | $text=$this->getAlternateText(); |
579 | 595 | $writer->addAttribute('title',$text); |
580 | 596 | $writer->addAttribute('alt',$text); |
581 | - if(($accessKey=$this->getAccessKey())!=='') |
|
582 | - $writer->addAttribute('accesskey',$accessKey); |
|
583 | - if(($tabIndex=$this->getTabIndex())!==0) |
|
584 | - $writer->addAttribute('tabindex',"$tabIndex"); |
|
597 | + if(($accessKey=$this->getAccessKey())!=='') { |
|
598 | + $writer->addAttribute('accesskey',$accessKey); |
|
599 | + } |
|
600 | + if(($tabIndex=$this->getTabIndex())!==0) { |
|
601 | + $writer->addAttribute('tabindex',"$tabIndex"); |
|
602 | + } |
|
585 | 603 | if($this->getHasAttributes()) |
586 | 604 | { |
587 | - foreach($this->getAttributes() as $name=>$value) |
|
588 | - $writer->addAttribute($name,$value); |
|
605 | + foreach($this->getAttributes() as $name=>$value) { |
|
606 | + $writer->addAttribute($name,$value); |
|
607 | + } |
|
589 | 608 | } |
590 | 609 | $writer->renderBeginTag('area'); |
591 | 610 | $writer->renderEndTag(); |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * TImageMap and related class file. |
|
4 | - * |
|
5 | - * @author Qiang Xue <[email protected]> |
|
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.WebControls |
|
10 | - */ |
|
3 | + * TImageMap and related class file. |
|
4 | + * |
|
5 | + * @author Qiang Xue <[email protected]> |
|
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.WebControls |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Includes TImage class file |
@@ -281,6 +281,7 @@ discard block |
||
281 | 281 | |
282 | 282 | /** |
283 | 283 | * @param string the group of validators which the button causes validation upon postback |
284 | + * @param string $value |
|
284 | 285 | */ |
285 | 286 | public function setValidationGroup($value) |
286 | 287 | { |
@@ -322,6 +323,7 @@ discard block |
||
322 | 323 | * If you override this method, be sure to call the parent implementation |
323 | 324 | * so that the event handlers can be invoked. |
324 | 325 | * @param TCommandEventParameter event parameter to be passed to the event handlers |
326 | + * @param TCommandEventParameter $param |
|
325 | 327 | */ |
326 | 328 | public function onCommand($param) |
327 | 329 | { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function getEnableClientScript() |
69 | 69 | { |
70 | - return $this->getViewState('EnableClientScript',true); |
|
70 | + return $this->getViewState('EnableClientScript', true); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function setEnableClientScript($value) |
77 | 77 | { |
78 | - $this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true); |
|
78 | + $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -85,22 +85,22 @@ discard block |
||
85 | 85 | */ |
86 | 86 | protected function addAttributesToRender($writer) |
87 | 87 | { |
88 | - $page=$this->getPage(); |
|
88 | + $page = $this->getPage(); |
|
89 | 89 | $page->ensureRenderInForm($this); |
90 | 90 | |
91 | - $writer->addAttribute('id',$this->getClientID()); |
|
91 | + $writer->addAttribute('id', $this->getClientID()); |
|
92 | 92 | |
93 | 93 | // We call parent implementation here because some attributes |
94 | 94 | // may be overwritten in the following |
95 | 95 | parent::addAttributesToRender($writer); |
96 | 96 | |
97 | - if($this->getEnabled(true) && $this->getEnableClientScript()) |
|
97 | + if ($this->getEnabled(true) && $this->getEnableClientScript()) |
|
98 | 98 | { |
99 | 99 | $this->renderLinkButtonHref($writer); |
100 | 100 | $this->renderClientControlScript($writer); |
101 | 101 | } |
102 | - else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
103 | - $writer->addAttribute('disabled','disabled'); |
|
102 | + else if ($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
103 | + $writer->addAttribute('disabled', 'disabled'); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | protected function renderClientControlScript($writer) |
111 | 111 | { |
112 | 112 | $cs = $this->getPage()->getClientScript(); |
113 | - $cs->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions()); |
|
113 | + $cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function setIsDefaultButton($value) |
120 | 120 | { |
121 | - $this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value),false); |
|
121 | + $this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value), false); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | protected function renderLinkButtonHref($writer) |
137 | 137 | { |
138 | 138 | //create unique no-op url references |
139 | - $nop = "javascript:;//".$this->getClientID(); |
|
139 | + $nop = "javascript:;//" . $this->getClientID(); |
|
140 | 140 | $writer->addAttribute('href', $nop); |
141 | 141 | } |
142 | 142 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function renderContents($writer) |
176 | 176 | { |
177 | - if(($text=$this->getText())==='') |
|
177 | + if (($text = $this->getText()) === '') |
|
178 | 178 | parent::renderContents($writer); |
179 | 179 | else |
180 | 180 | $writer->write($text); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function getText() |
187 | 187 | { |
188 | - return $this->getViewState('Text',''); |
|
188 | + return $this->getViewState('Text', ''); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function setText($value) |
195 | 195 | { |
196 | - $this->setViewState('Text',$value,''); |
|
196 | + $this->setViewState('Text', $value, ''); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | /** |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function getCommandName() |
229 | 229 | { |
230 | - return $this->getViewState('CommandName',''); |
|
230 | + return $this->getViewState('CommandName', ''); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public function setCommandName($value) |
237 | 237 | { |
238 | - $this->setViewState('CommandName',$value,''); |
|
238 | + $this->setViewState('CommandName', $value, ''); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public function getCommandParameter() |
245 | 245 | { |
246 | - return $this->getViewState('CommandParameter',''); |
|
246 | + return $this->getViewState('CommandParameter', ''); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | /** |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | */ |
252 | 252 | public function setCommandParameter($value) |
253 | 253 | { |
254 | - $this->setViewState('CommandParameter',$value,''); |
|
254 | + $this->setViewState('CommandParameter', $value, ''); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | */ |
260 | 260 | public function getCausesValidation() |
261 | 261 | { |
262 | - return $this->getViewState('CausesValidation',true); |
|
262 | + return $this->getViewState('CausesValidation', true); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | */ |
269 | 269 | public function setCausesValidation($value) |
270 | 270 | { |
271 | - $this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true); |
|
271 | + $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public function getValidationGroup() |
278 | 278 | { |
279 | - return $this->getViewState('ValidationGroup',''); |
|
279 | + return $this->getViewState('ValidationGroup', ''); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public function setValidationGroup($value) |
286 | 286 | { |
287 | - $this->setViewState('ValidationGroup',$value,''); |
|
287 | + $this->setViewState('ValidationGroup', $value, ''); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | /** |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | */ |
299 | 299 | public function raisePostBackEvent($param) |
300 | 300 | { |
301 | - if($this->getCausesValidation()) |
|
301 | + if ($this->getCausesValidation()) |
|
302 | 302 | $this->getPage()->validate($this->getValidationGroup()); |
303 | 303 | $this->onClick(null); |
304 | - $this->onCommand(new TCommandEventParameter($this->getCommandName(),$this->getCommandParameter())); |
|
304 | + $this->onCommand(new TCommandEventParameter($this->getCommandName(), $this->getCommandParameter())); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | /** |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public function onClick($param) |
315 | 315 | { |
316 | - $this->raiseEvent('OnClick',$this,$param); |
|
316 | + $this->raiseEvent('OnClick', $this, $param); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | /** |
@@ -325,8 +325,8 @@ discard block |
||
325 | 325 | */ |
326 | 326 | public function onCommand($param) |
327 | 327 | { |
328 | - $this->raiseEvent('OnCommand',$this,$param); |
|
329 | - $this->raiseBubbleEvent($this,$param); |
|
328 | + $this->raiseEvent('OnCommand', $this, $param); |
|
329 | + $this->raiseBubbleEvent($this, $param); |
|
330 | 330 | } |
331 | 331 | } |
332 | 332 |
@@ -98,9 +98,10 @@ discard block |
||
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()) { |
|
102 | + // in this case, parent will not render 'disabled' |
|
103 | 103 | $writer->addAttribute('disabled','disabled'); |
104 | + } |
|
104 | 105 | } |
105 | 106 | |
106 | 107 | /** |
@@ -174,10 +175,11 @@ discard block |
||
174 | 175 | */ |
175 | 176 | public function renderContents($writer) |
176 | 177 | { |
177 | - if(($text=$this->getText())==='') |
|
178 | - parent::renderContents($writer); |
|
179 | - else |
|
180 | - $writer->write($text); |
|
178 | + if(($text=$this->getText())==='') { |
|
179 | + parent::renderContents($writer); |
|
180 | + } else { |
|
181 | + $writer->write($text); |
|
182 | + } |
|
181 | 183 | } |
182 | 184 | |
183 | 185 | /** |
@@ -298,8 +300,9 @@ discard block |
||
298 | 300 | */ |
299 | 301 | public function raisePostBackEvent($param) |
300 | 302 | { |
301 | - if($this->getCausesValidation()) |
|
302 | - $this->getPage()->validate($this->getValidationGroup()); |
|
303 | + if($this->getCausesValidation()) { |
|
304 | + $this->getPage()->validate($this->getValidationGroup()); |
|
305 | + } |
|
303 | 306 | $this->onClick(null); |
304 | 307 | $this->onCommand(new TCommandEventParameter($this->getCommandName(),$this->getCommandParameter())); |
305 | 308 | } |
@@ -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 | { |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | */ |
37 | 37 | class TListBox extends TListControl implements IPostBackDataHandler, IValidatable |
38 | 38 | { |
39 | - private $_dataChanged=false; |
|
40 | - private $_isValid=true; |
|
39 | + private $_dataChanged = false; |
|
40 | + private $_isValid = true; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Adds attribute name-value pairs to renderer. |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | */ |
47 | 47 | protected function addAttributesToRender($writer) |
48 | 48 | { |
49 | - $rows=$this->getRows(); |
|
50 | - $writer->addAttribute('size',"$rows"); |
|
51 | - if($this->getSelectionMode()===TListSelectionMode::Multiple) |
|
52 | - $writer->addAttribute('name',$this->getUniqueID().'[]'); |
|
49 | + $rows = $this->getRows(); |
|
50 | + $writer->addAttribute('size', "$rows"); |
|
51 | + if ($this->getSelectionMode() === TListSelectionMode::Multiple) |
|
52 | + $writer->addAttribute('name', $this->getUniqueID() . '[]'); |
|
53 | 53 | else |
54 | - $writer->addAttribute('name',$this->getUniqueID()); |
|
54 | + $writer->addAttribute('name', $this->getUniqueID()); |
|
55 | 55 | parent::addAttributesToRender($writer); |
56 | 56 | } |
57 | 57 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | public function onPreRender($param) |
74 | 74 | { |
75 | 75 | parent::onPreRender($param); |
76 | - if($this->getEnabled(true)) |
|
76 | + if ($this->getEnabled(true)) |
|
77 | 77 | $this->getPage()->registerRequiresPostData($this); |
78 | 78 | } |
79 | 79 | |
@@ -84,60 +84,60 @@ discard block |
||
84 | 84 | * @param array the input data collection |
85 | 85 | * @return boolean whether the data of the component has been changed |
86 | 86 | */ |
87 | - public function loadPostData($key,$values) |
|
87 | + public function loadPostData($key, $values) |
|
88 | 88 | { |
89 | - if(!$this->getEnabled(true)) |
|
89 | + if (!$this->getEnabled(true)) |
|
90 | 90 | return false; |
91 | 91 | $this->ensureDataBound(); |
92 | - $selections=isset($values[$key])?$values[$key]:null; |
|
93 | - if($selections!==null) |
|
92 | + $selections = isset($values[$key]) ? $values[$key] : null; |
|
93 | + if ($selections !== null) |
|
94 | 94 | { |
95 | - $items=$this->getItems(); |
|
96 | - if($this->getSelectionMode()===TListSelectionMode::Single) |
|
95 | + $items = $this->getItems(); |
|
96 | + if ($this->getSelectionMode() === TListSelectionMode::Single) |
|
97 | 97 | { |
98 | - $selection=is_array($selections)?$selections[0]:$selections; |
|
99 | - $index=$items->findIndexByValue($selection,false); |
|
100 | - if($this->getSelectedIndex()!==$index) |
|
98 | + $selection = is_array($selections) ? $selections[0] : $selections; |
|
99 | + $index = $items->findIndexByValue($selection, false); |
|
100 | + if ($this->getSelectedIndex() !== $index) |
|
101 | 101 | { |
102 | 102 | $this->setSelectedIndex($index); |
103 | - return $this->_dataChanged=true; |
|
103 | + return $this->_dataChanged = true; |
|
104 | 104 | } |
105 | 105 | else |
106 | 106 | return false; |
107 | 107 | } |
108 | - if(!is_array($selections)) |
|
109 | - $selections=array($selections); |
|
110 | - $list=array(); |
|
111 | - foreach($selections as $selection) |
|
112 | - $list[]=$items->findIndexByValue($selection,false); |
|
113 | - $list2=$this->getSelectedIndices(); |
|
114 | - $n=count($list); |
|
115 | - $flag=false; |
|
116 | - if($n===count($list2)) |
|
108 | + if (!is_array($selections)) |
|
109 | + $selections = array($selections); |
|
110 | + $list = array(); |
|
111 | + foreach ($selections as $selection) |
|
112 | + $list[] = $items->findIndexByValue($selection, false); |
|
113 | + $list2 = $this->getSelectedIndices(); |
|
114 | + $n = count($list); |
|
115 | + $flag = false; |
|
116 | + if ($n === count($list2)) |
|
117 | 117 | { |
118 | - sort($list,SORT_NUMERIC); |
|
119 | - for($i=0;$i<$n;++$i) |
|
118 | + sort($list, SORT_NUMERIC); |
|
119 | + for ($i = 0; $i < $n; ++$i) |
|
120 | 120 | { |
121 | - if($list[$i]!==$list2[$i]) |
|
121 | + if ($list[$i] !== $list2[$i]) |
|
122 | 122 | { |
123 | - $flag=true; |
|
123 | + $flag = true; |
|
124 | 124 | break; |
125 | 125 | } |
126 | 126 | } |
127 | 127 | } |
128 | 128 | else |
129 | - $flag=true; |
|
130 | - if($flag) |
|
129 | + $flag = true; |
|
130 | + if ($flag) |
|
131 | 131 | { |
132 | 132 | $this->setSelectedIndices($list); |
133 | - $this->_dataChanged=true; |
|
133 | + $this->_dataChanged = true; |
|
134 | 134 | } |
135 | 135 | return $flag; |
136 | 136 | } |
137 | - else if($this->getSelectedIndex()!==-1) |
|
137 | + else if ($this->getSelectedIndex() !== -1) |
|
138 | 138 | { |
139 | 139 | $this->clearSelection(); |
140 | - return $this->_dataChanged=true; |
|
140 | + return $this->_dataChanged = true; |
|
141 | 141 | } |
142 | 142 | else |
143 | 143 | return false; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function raisePostDataChangedEvent() |
154 | 154 | { |
155 | - if($this->getAutoPostBack() && $this->getCausesValidation()) |
|
155 | + if ($this->getAutoPostBack() && $this->getCausesValidation()) |
|
156 | 156 | $this->getPage()->validate($this->getValidationGroup()); |
157 | 157 | $this->onSelectedIndexChanged(null); |
158 | 158 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | protected function getIsMultiSelect() |
174 | 174 | { |
175 | - return $this->getSelectionMode()===TListSelectionMode::Multiple; |
|
175 | + return $this->getSelectionMode() === TListSelectionMode::Multiple; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -188,9 +188,9 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public function setRows($value) |
190 | 190 | { |
191 | - $value=TPropertyValue::ensureInteger($value); |
|
192 | - if($value<=0) |
|
193 | - $value=4; |
|
191 | + $value = TPropertyValue::ensureInteger($value); |
|
192 | + if ($value <= 0) |
|
193 | + $value = 4; |
|
194 | 194 | $this->setViewState('Rows', $value, 4); |
195 | 195 | } |
196 | 196 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public function setSelectionMode($value) |
209 | 209 | { |
210 | - $this->setViewState('SelectionMode',TPropertyValue::ensureEnum($value,'TListSelectionMode'),TListSelectionMode::Single); |
|
210 | + $this->setViewState('SelectionMode', TPropertyValue::ensureEnum($value, 'TListSelectionMode'), TListSelectionMode::Single); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | */ |
235 | 235 | public function setIsValid($value) |
236 | 236 | { |
237 | - $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
237 | + $this->_isValid = TPropertyValue::ensureBoolean($value); |
|
238 | 238 | } |
239 | 239 | } |
240 | 240 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | */ |
254 | 254 | class TListSelectionMode extends TEnumerable |
255 | 255 | { |
256 | - const Single='Single'; |
|
257 | - const Multiple='Multiple'; |
|
256 | + const Single = 'Single'; |
|
257 | + const Multiple = 'Multiple'; |
|
258 | 258 | } |
259 | 259 |
@@ -48,10 +48,11 @@ discard block |
||
48 | 48 | { |
49 | 49 | $rows=$this->getRows(); |
50 | 50 | $writer->addAttribute('size',"$rows"); |
51 | - if($this->getSelectionMode()===TListSelectionMode::Multiple) |
|
52 | - $writer->addAttribute('name',$this->getUniqueID().'[]'); |
|
53 | - else |
|
54 | - $writer->addAttribute('name',$this->getUniqueID()); |
|
51 | + if($this->getSelectionMode()===TListSelectionMode::Multiple) { |
|
52 | + $writer->addAttribute('name',$this->getUniqueID().'[]'); |
|
53 | + } else { |
|
54 | + $writer->addAttribute('name',$this->getUniqueID()); |
|
55 | + } |
|
55 | 56 | parent::addAttributesToRender($writer); |
56 | 57 | } |
57 | 58 | |
@@ -73,8 +74,9 @@ discard block |
||
73 | 74 | public function onPreRender($param) |
74 | 75 | { |
75 | 76 | parent::onPreRender($param); |
76 | - if($this->getEnabled(true)) |
|
77 | - $this->getPage()->registerRequiresPostData($this); |
|
77 | + if($this->getEnabled(true)) { |
|
78 | + $this->getPage()->registerRequiresPostData($this); |
|
79 | + } |
|
78 | 80 | } |
79 | 81 | |
80 | 82 | /** |
@@ -86,8 +88,9 @@ discard block |
||
86 | 88 | */ |
87 | 89 | public function loadPostData($key,$values) |
88 | 90 | { |
89 | - if(!$this->getEnabled(true)) |
|
90 | - return false; |
|
91 | + if(!$this->getEnabled(true)) { |
|
92 | + return false; |
|
93 | + } |
|
91 | 94 | $this->ensureDataBound(); |
92 | 95 | $selections=isset($values[$key])?$values[$key]:null; |
93 | 96 | if($selections!==null) |
@@ -101,15 +104,17 @@ discard block |
||
101 | 104 | { |
102 | 105 | $this->setSelectedIndex($index); |
103 | 106 | return $this->_dataChanged=true; |
107 | + } else { |
|
108 | + return false; |
|
104 | 109 | } |
105 | - else |
|
106 | - return false; |
|
107 | 110 | } |
108 | - if(!is_array($selections)) |
|
109 | - $selections=array($selections); |
|
111 | + if(!is_array($selections)) { |
|
112 | + $selections=array($selections); |
|
113 | + } |
|
110 | 114 | $list=array(); |
111 | - foreach($selections as $selection) |
|
112 | - $list[]=$items->findIndexByValue($selection,false); |
|
115 | + foreach($selections as $selection) { |
|
116 | + $list[]=$items->findIndexByValue($selection,false); |
|
117 | + } |
|
113 | 118 | $list2=$this->getSelectedIndices(); |
114 | 119 | $n=count($list); |
115 | 120 | $flag=false; |
@@ -124,23 +129,22 @@ discard block |
||
124 | 129 | break; |
125 | 130 | } |
126 | 131 | } |
132 | + } else { |
|
133 | + $flag=true; |
|
127 | 134 | } |
128 | - else |
|
129 | - $flag=true; |
|
130 | 135 | if($flag) |
131 | 136 | { |
132 | 137 | $this->setSelectedIndices($list); |
133 | 138 | $this->_dataChanged=true; |
134 | 139 | } |
135 | 140 | return $flag; |
136 | - } |
|
137 | - else if($this->getSelectedIndex()!==-1) |
|
141 | + } else if($this->getSelectedIndex()!==-1) |
|
138 | 142 | { |
139 | 143 | $this->clearSelection(); |
140 | 144 | return $this->_dataChanged=true; |
145 | + } else { |
|
146 | + return false; |
|
141 | 147 | } |
142 | - else |
|
143 | - return false; |
|
144 | 148 | } |
145 | 149 | |
146 | 150 | /** |
@@ -152,8 +156,9 @@ discard block |
||
152 | 156 | */ |
153 | 157 | public function raisePostDataChangedEvent() |
154 | 158 | { |
155 | - if($this->getAutoPostBack() && $this->getCausesValidation()) |
|
156 | - $this->getPage()->validate($this->getValidationGroup()); |
|
159 | + if($this->getAutoPostBack() && $this->getCausesValidation()) { |
|
160 | + $this->getPage()->validate($this->getValidationGroup()); |
|
161 | + } |
|
157 | 162 | $this->onSelectedIndexChanged(null); |
158 | 163 | } |
159 | 164 | |
@@ -189,8 +194,9 @@ discard block |
||
189 | 194 | public function setRows($value) |
190 | 195 | { |
191 | 196 | $value=TPropertyValue::ensureInteger($value); |
192 | - if($value<=0) |
|
193 | - $value=4; |
|
197 | + if($value<=0) { |
|
198 | + $value=4; |
|
199 | + } |
|
194 | 200 | $this->setViewState('Rows', $value, 4); |
195 | 201 | } |
196 | 202 |
@@ -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 | /** |