@@ -101,7 +101,7 @@ |
||
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | 103 | * Sets the horizontal alignment of the contents within the panel. |
| 104 | - * Valid values include 'NotSet', 'Justify', 'Left', 'Right', 'Center' |
|
| 104 | + * Valid values include 'NotSet', 'Justify', 'Left', 'Right', 'Center' |
|
| 105 | 105 | * @param string the horizontal alignment |
| 106 | 106 | */ |
| 107 | 107 | public function setHorizontalAlign($value) |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | parent::addAttributesToRender($writer); |
| 73 | 73 | if(($butt=$this->getDefaultButton())!=='') |
| 74 | - $writer->addAttribute('id',$this->getClientID()); |
|
| 74 | + $writer->addAttribute('id', $this->getClientID()); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | public function getGroupingText() |
| 170 | 170 | { |
| 171 | - return $this->getViewState('GroupingText',''); |
|
| 171 | + return $this->getViewState('GroupingText', ''); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | public function setGroupingText($value) |
| 178 | 178 | { |
| 179 | - $this->setViewState('GroupingText',$value,''); |
|
| 179 | + $this->setViewState('GroupingText', $value, ''); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | /** |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | if(($butt=$this->getDefaultButton())!=='') |
| 231 | 231 | { |
| 232 | 232 | if(($button=$this->findControl($butt))===null) |
| 233 | - throw new TInvalidDataValueException('panel_defaultbutton_invalid',$butt); |
|
| 233 | + throw new TInvalidDataValueException('panel_defaultbutton_invalid', $butt); |
|
| 234 | 234 | else |
| 235 | 235 | $this->getPage()->getClientScript()->registerDefaultButton($this, $button); |
| 236 | 236 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
| 202 | - * @return boolean true to post the inputs of the form on callback, default |
|
| 202 | + * @return string true to post the inputs of the form on callback, default |
|
| 203 | 203 | * is post the inputs on callback. |
| 204 | 204 | */ |
| 205 | 205 | public function getPostState() |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | /** |
| 220 | - * @return integer callback request timeout. |
|
| 220 | + * @return string callback request timeout. |
|
| 221 | 221 | */ |
| 222 | 222 | public function getRequestTimeOut() |
| 223 | 223 | { |
@@ -261,6 +261,7 @@ discard block |
||
| 261 | 261 | * update. This will automatically set HasPrority to true. |
| 262 | 262 | * @param boolean true enables the callback response to update the |
| 263 | 263 | * viewstate. |
| 264 | + * @param boolean $value |
|
| 264 | 265 | */ |
| 265 | 266 | public function setEnablePageStateUpdate($value) |
| 266 | 267 | { |
@@ -269,7 +270,7 @@ discard block |
||
| 269 | 270 | } |
| 270 | 271 | |
| 271 | 272 | /** |
| 272 | - * @return boolean client-side viewstate will be updated on callback |
|
| 273 | + * @return boolean|string client-side viewstate will be updated on callback |
|
| 273 | 274 | * response if true. Default is true. |
| 274 | 275 | */ |
| 275 | 276 | public function getEnablePageStateUpdate() |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | */ |
| 265 | 265 | public function setEnablePageStateUpdate($value) |
| 266 | 266 | { |
| 267 | - $enabled = TPropertyValue::ensureBoolean($value); |
|
| 267 | + $enabled=TPropertyValue::ensureBoolean($value); |
|
| 268 | 268 | $this->setOption('EnablePageStateUpdate', $enabled); |
| 269 | 269 | } |
| 270 | 270 | |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | */ |
| 275 | 275 | public function getEnablePageStateUpdate() |
| 276 | 276 | { |
| 277 | - $option = $this->getOption('EnablePageStateUpdate'); |
|
| 277 | + $option=$this->getOption('EnablePageStateUpdate'); |
|
| 278 | 278 | return ($option===null) ? true : $option; |
| 279 | 279 | } |
| 280 | 280 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | public function setPostBackTarget($value) |
| 293 | 293 | { |
| 294 | 294 | if($value instanceof TControl) |
| 295 | - $value = $value->getUniqueID(); |
|
| 295 | + $value=$value->getUniqueID(); |
|
| 296 | 296 | $this->setOption('EventTarget', $value); |
| 297 | 297 | } |
| 298 | 298 | |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | - * Creates a new callback control, sets the adapter to |
|
| 72 | - * TActiveControlAdapter. |
|
| 73 | - */ |
|
| 71 | + * Creates a new callback control, sets the adapter to |
|
| 72 | + * TActiveControlAdapter. |
|
| 73 | + */ |
|
| 74 | 74 | public function __construct() { |
| 75 | 75 | parent::__construct(); |
| 76 | 76 | $this->setAdapter(new TActiveControlAdapter($this)); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @param string $value container tag |
| 112 | 112 | */ |
| 113 | 113 | public function setSurroundingTag($value) { |
| 114 | - $this->_surroundingTag=TPropertyValue::ensureString($value); |
|
| 114 | + $this->_surroundingTag=TPropertyValue::ensureString($value); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | parent::setDataSource($value); |
| 90 | 90 | if($this->getActiveControl()->canUpdateClientSide()) { |
| 91 | 91 | $this->renderPager(); |
| 92 | - $this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter()); |
|
| 92 | + $this->getPage()->getAdapter()->registerControlToRender($this, $this->getResponse()->createHtmlWriter()); |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * @param string CommandParameter corresponding to the OnCommand event of the button |
| 132 | 132 | * @return mixed the button instance |
| 133 | 133 | */ |
| 134 | - protected function createPagerButton($pager,$buttonType,$enabled,$text,$commandName,$commandParameter) { |
|
| 134 | + protected function createPagerButton($pager, $buttonType, $enabled, $text, $commandName, $commandParameter) { |
|
| 135 | 135 | if($buttonType===TDataGridPagerButtonType::LinkButton) { |
| 136 | 136 | if($enabled) |
| 137 | 137 | $button=new TActiveLinkButton; |
@@ -174,10 +174,10 @@ discard block |
||
| 174 | 174 | public function render($writer) { |
| 175 | 175 | if($this->getHasPreRendered()) { |
| 176 | 176 | $this->renderDataGrid($writer); |
| 177 | - if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(),$writer); |
|
| 177 | + if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(), $writer); |
|
| 178 | 178 | } |
| 179 | 179 | else { |
| 180 | - $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
|
| 180 | + $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | foreach($pager as $item) { |
| 192 | 192 | if($item->ControlToPaginate==$this->ID) { |
| 193 | 193 | $writer=$this->getResponse()->createHtmlWriter(); |
| 194 | - $this->getPage()->getAdapter()->registerControlToRender($item,$writer); |
|
| 194 | + $this->getPage()->getAdapter()->registerControlToRender($item, $writer); |
|
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | 197 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * @param THtmlWriter writer for the rendering purpose |
| 204 | 204 | */ |
| 205 | 205 | private function renderDataGrid($writer) { |
| 206 | - $writer->addAttribute('id',$this->getSurroundingTagID()); |
|
| 206 | + $writer->addAttribute('id', $this->getSurroundingTagID()); |
|
| 207 | 207 | $writer->renderBeginTag($this->getSurroundingTag()); |
| 208 | 208 | parent::render($writer); |
| 209 | 209 | $writer->renderEndTag(); |
@@ -140,8 +140,7 @@ discard block |
||
| 140 | 140 | $button->setText($text); |
| 141 | 141 | return $button; |
| 142 | 142 | } |
| 143 | - } |
|
| 144 | - else { |
|
| 143 | + } else { |
|
| 145 | 144 | $button=new TActiveButton; |
| 146 | 145 | if(!$enabled) |
| 147 | 146 | $button->setEnabled(false); |
@@ -175,8 +174,7 @@ discard block |
||
| 175 | 174 | if($this->getHasPreRendered()) { |
| 176 | 175 | $this->renderDataGrid($writer); |
| 177 | 176 | if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(),$writer); |
| 178 | - } |
|
| 179 | - else { |
|
| 177 | + } else { |
|
| 180 | 178 | $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
| 181 | 179 | } |
| 182 | 180 | } |
@@ -93,6 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | 95 | * @param boolean whether the keys are case-sensitive. |
| 96 | + * @param boolean $value |
|
| 96 | 97 | */ |
| 97 | 98 | public function setCaseSensitive($value) |
| 98 | 99 | { |
@@ -126,6 +127,7 @@ discard block |
||
| 126 | 127 | * Removes an item from the map by its key. |
| 127 | 128 | * This overrides the parent implementation by converting the key to lower case first if CaseSensitive is false. |
| 128 | 129 | * @param mixed the key of the item to be removed |
| 130 | + * @param string $key |
|
| 129 | 131 | * @return mixed the removed value, null if no such key exists. |
| 130 | 132 | */ |
| 131 | 133 | public function remove($key) |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | protected function _getZappableSleepProps(&$exprops) |
| 52 | 52 | { |
| 53 | 53 | parent::_getZappableSleepProps($exprops); |
| 54 | - if ($this->_caseSensitive===false) |
|
| 55 | - $exprops[] = "\0Prado\Collections\TAttributeCollection\0_caseSensitive"; |
|
| 54 | + if($this->_caseSensitive===false) |
|
| 55 | + $exprops[]="\0Prado\Collections\TAttributeCollection\0_caseSensitive"; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function __get($name) |
| 67 | 67 | { |
| 68 | - return $this->contains($name)?$this->itemAt($name):parent::__get($name); |
|
| 68 | + return $this->contains($name) ? $this->itemAt($name) : parent::__get($name); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -76,9 +76,9 @@ discard block |
||
| 76 | 76 | * @param mixed the property value or event handler |
| 77 | 77 | * @throws TInvalidOperationException If the property is not defined or read-only. |
| 78 | 78 | */ |
| 79 | - public function __set($name,$value) |
|
| 79 | + public function __set($name, $value) |
|
| 80 | 80 | { |
| 81 | - $this->add($name,$value); |
|
| 81 | + $this->add($name, $value); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function itemAt($key) |
| 107 | 107 | { |
| 108 | - return parent::itemAt($this->_caseSensitive?$key:strtolower($key)); |
|
| 108 | + return parent::itemAt($this->_caseSensitive ? $key : strtolower($key)); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | * @param mixed key |
| 116 | 116 | * @param mixed value |
| 117 | 117 | */ |
| 118 | - public function add($key,$value) |
|
| 118 | + public function add($key, $value) |
|
| 119 | 119 | { |
| 120 | - parent::add($this->_caseSensitive?$key:strtolower($key),$value); |
|
| 120 | + parent::add($this->_caseSensitive ? $key : strtolower($key), $value); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | public function remove($key) |
| 130 | 130 | { |
| 131 | - return parent::remove($this->_caseSensitive?$key:strtolower($key)); |
|
| 131 | + return parent::remove($this->_caseSensitive ? $key : strtolower($key)); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function contains($key) |
| 141 | 141 | { |
| 142 | - return parent::contains($this->_caseSensitive?$key:strtolower($key)); |
|
| 142 | + return parent::contains($this->_caseSensitive ? $key : strtolower($key)); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | - * @return string default culture |
|
| 93 | + * @return boolean default culture |
|
| 94 | 94 | */ |
| 95 | 95 | public function getTranslateDefaultCulture() |
| 96 | 96 | { |
@@ -212,8 +212,7 @@ discard block |
||
| 212 | 212 | $config['source']); |
| 213 | 213 | chmod($config['source'], PRADO_CHMOD); //make it deletable |
| 214 | 214 | } |
| 215 | - } |
|
| 216 | - else |
|
| 215 | + } else |
|
| 217 | 216 | { |
| 218 | 217 | throw new TConfigurationException("invalid source dir '{$config['source']}'"); |
| 219 | 218 | } |
@@ -228,8 +227,7 @@ discard block |
||
| 228 | 227 | $config['cache']); |
| 229 | 228 | chmod($config['cache'], PRADO_CHMOD); //make it deletable |
| 230 | 229 | } |
| 231 | - } |
|
| 232 | - else |
|
| 230 | + } else |
|
| 233 | 231 | { |
| 234 | 232 | unset($config['cache']); |
| 235 | 233 | } |
@@ -33,13 +33,13 @@ discard block |
||
| 33 | 33 | * Default character set is 'UTF-8'. |
| 34 | 34 | * @var string |
| 35 | 35 | */ |
| 36 | - private $_defaultCharset = 'UTF-8'; |
|
| 36 | + private $_defaultCharset='UTF-8'; |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * Default culture is 'en'. |
| 40 | 40 | * @var string |
| 41 | 41 | */ |
| 42 | - private $_defaultCulture = 'en'; |
|
| 42 | + private $_defaultCulture='en'; |
|
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * The current charset. |
@@ -81,11 +81,11 @@ discard block |
||
| 81 | 81 | if($config!==null) |
| 82 | 82 | { |
| 83 | 83 | if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP) |
| 84 | - $translation = isset($config['translate'])?$config['translate']:null; |
|
| 84 | + $translation=isset($config['translate']) ? $config['translate'] : null; |
|
| 85 | 85 | else |
| 86 | 86 | { |
| 87 | - $t = $config->getElementByTagName('translation'); |
|
| 88 | - $translation = ($t)?$t->getAttributes():null; |
|
| 87 | + $t=$config->getElementByTagName('translation'); |
|
| 88 | + $translation=($t) ? $t->getAttributes() : null; |
|
| 89 | 89 | } |
| 90 | 90 | if($translation) |
| 91 | 91 | $this->setTranslationConfiguration($translation); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function setTranslateDefaultCulture($value) |
| 108 | 108 | { |
| 109 | - $this->_translateDefaultCulture = TPropertyValue::ensureBoolean($value); |
|
| 109 | + $this->_translateDefaultCulture=TPropertyValue::ensureBoolean($value); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function setDefaultCulture($culture) |
| 124 | 124 | { |
| 125 | - $this->_defaultCulture = str_replace('-','_',$culture); |
|
| 125 | + $this->_defaultCulture=str_replace('-', '_', $culture); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public function setDefaultCharset($charset) |
| 140 | 140 | { |
| 141 | - $this->_defaultCharset = $charset; |
|
| 141 | + $this->_defaultCharset=$charset; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | public function setCulture($culture) |
| 156 | 156 | { |
| 157 | - $this->_culture = str_replace('-','_',$culture); |
|
| 157 | + $this->_culture=str_replace('-', '_', $culture); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /** |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | public function setCharset($charset) |
| 172 | 172 | { |
| 173 | - $this->_charset = $charset; |
|
| 173 | + $this->_charset=$charset; |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | */ |
| 179 | 179 | public function getTranslationConfiguration() |
| 180 | 180 | { |
| 181 | - return (!$this->_translateDefaultCulture && ($this->getDefaultCulture() == $this->getCulture())) |
|
| 181 | + return (!$this->_translateDefaultCulture && ($this->getDefaultCulture()==$this->getCulture())) |
|
| 182 | 182 | ? null |
| 183 | 183 | : $this->_translation; |
| 184 | 184 | } |
@@ -200,11 +200,11 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | protected function setTranslationConfiguration($config) |
| 202 | 202 | { |
| 203 | - if($config['type'] == 'XLIFF' || $config['type'] == 'gettext' || $config['type'] == 'PHP') |
|
| 203 | + if($config['type']=='XLIFF' || $config['type']=='gettext' || $config['type']=='PHP') |
|
| 204 | 204 | { |
| 205 | 205 | if($config['source']) |
| 206 | 206 | { |
| 207 | - $config['source'] = Prado::getPathOfNamespace($config['source']); |
|
| 207 | + $config['source']=Prado::getPathOfNamespace($config['source']); |
|
| 208 | 208 | if(!is_dir($config['source'])) |
| 209 | 209 | { |
| 210 | 210 | if(@mkdir($config['source'])===false) |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | } |
| 221 | 221 | if(isset($config['cache']) && TPropertyValue::ensureBoolean($config['cache'])) |
| 222 | 222 | { |
| 223 | - $config['cache'] = $this->getApplication()->getRunTimePath().'/i18n'; |
|
| 223 | + $config['cache']=$this->getApplication()->getRunTimePath().'/i18n'; |
|
| 224 | 224 | if(!is_dir($config['cache'])) |
| 225 | 225 | { |
| 226 | 226 | if(@mkdir($config['cache'])===false) |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | { |
| 234 | 234 | unset($config['cache']); |
| 235 | 235 | } |
| 236 | - $this->_translation = $config; |
|
| 236 | + $this->_translation=$config; |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | */ |
| 250 | 250 | public function setTranslationCatalogue($value) |
| 251 | 251 | { |
| 252 | - $this->_translation['catalogue'] = $value; |
|
| 252 | + $this->_translation['catalogue']=$value; |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | /** |
@@ -260,11 +260,11 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | public function getCultureVariants($culture=null) |
| 262 | 262 | { |
| 263 | - if($culture===null) $culture = $this->getCulture(); |
|
| 264 | - $variants = explode('_', $culture); |
|
| 265 | - $result = array(); |
|
| 263 | + if($culture===null) $culture=$this->getCulture(); |
|
| 264 | + $variants=explode('_', $culture); |
|
| 265 | + $result=array(); |
|
| 266 | 266 | for(; count($variants) > 0; array_pop($variants)) |
| 267 | - $result[] = implode('_', $variants); |
|
| 267 | + $result[]=implode('_', $variants); |
|
| 268 | 268 | return $result; |
| 269 | 269 | } |
| 270 | 270 | |
@@ -287,17 +287,17 @@ discard block |
||
| 287 | 287 | * @param string culture string, null to use current culture |
| 288 | 288 | * @return array list of possible localized resource files. |
| 289 | 289 | */ |
| 290 | - public function getLocalizedResource($file,$culture=null) |
|
| 290 | + public function getLocalizedResource($file, $culture=null) |
|
| 291 | 291 | { |
| 292 | - $files = array(); |
|
| 293 | - $variants = $this->getCultureVariants($culture); |
|
| 294 | - $path = pathinfo($file); |
|
| 292 | + $files=array(); |
|
| 293 | + $variants=$this->getCultureVariants($culture); |
|
| 294 | + $path=pathinfo($file); |
|
| 295 | 295 | foreach($variants as $variant) |
| 296 | - $files[] = $path['dirname'].DIRECTORY_SEPARATOR.$variant.DIRECTORY_SEPARATOR.$path['basename']; |
|
| 297 | - $filename = substr($path['basename'],0,strrpos($path['basename'],'.')); |
|
| 296 | + $files[]=$path['dirname'].DIRECTORY_SEPARATOR.$variant.DIRECTORY_SEPARATOR.$path['basename']; |
|
| 297 | + $filename=substr($path['basename'], 0, strrpos($path['basename'], '.')); |
|
| 298 | 298 | foreach($variants as $variant) |
| 299 | - $files[] = $path['dirname'].DIRECTORY_SEPARATOR.$filename.'.'.$variant.'.'.$path['extension']; |
|
| 300 | - $files[] = $file; |
|
| 299 | + $files[]=$path['dirname'].DIRECTORY_SEPARATOR.$filename.'.'.$variant.'.'.$path['extension']; |
|
| 300 | + $files[]=$file; |
|
| 301 | 301 | return $files; |
| 302 | 302 | } |
| 303 | 303 | |
@@ -73,6 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * @param string username |
| 76 | + * @param string $value |
|
| 76 | 77 | */ |
| 77 | 78 | public function setName($value) |
| 78 | 79 | { |
@@ -89,6 +90,7 @@ discard block |
||
| 89 | 90 | |
| 90 | 91 | /** |
| 91 | 92 | * @param boolean if the user is a guest |
| 93 | + * @param boolean $value |
|
| 92 | 94 | */ |
| 93 | 95 | public function setIsGuest($value) |
| 94 | 96 | { |
@@ -170,6 +172,7 @@ discard block |
||
| 170 | 172 | * |
| 171 | 173 | * @param string variable name |
| 172 | 174 | * @param mixed default value |
| 175 | + * @param string $key |
|
| 173 | 176 | * @return mixed the value of the variable. If it doesn't exist, the provided default value will be returned |
| 174 | 177 | * @see setState |
| 175 | 178 | */ |
@@ -190,6 +193,7 @@ discard block |
||
| 190 | 193 | * @param string variable name |
| 191 | 194 | * @param mixed variable value |
| 192 | 195 | * @param mixed default value. If $value===$defaultValue, the variable will be removed from persistent storage. |
| 196 | + * @param string $key |
|
| 193 | 197 | * @see getState |
| 194 | 198 | */ |
| 195 | 199 | protected function setState($key,$value,$defaultValue=null) |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function getName() |
| 70 | 70 | { |
| 71 | - return $this->getState('Name',''); |
|
| 71 | + return $this->getState('Name', ''); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function setName($value) |
| 78 | 78 | { |
| 79 | - $this->setState('Name',$value,''); |
|
| 79 | + $this->setState('Name', $value, ''); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function getIsGuest() |
| 86 | 86 | { |
| 87 | - return $this->getState('IsGuest',true); |
|
| 87 | + return $this->getState('IsGuest', true); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $this->setName($this->_manager->getGuestName()); |
| 98 | 98 | $this->setRoles(array()); |
| 99 | 99 | } |
| 100 | - $this->setState('IsGuest',$isGuest); |
|
| 100 | + $this->setState('IsGuest', $isGuest); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function getRoles() |
| 107 | 107 | { |
| 108 | - return $this->getState('Roles',array()); |
|
| 108 | + return $this->getState('Roles', array()); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
@@ -114,16 +114,16 @@ discard block |
||
| 114 | 114 | public function setRoles($value) |
| 115 | 115 | { |
| 116 | 116 | if(is_array($value)) |
| 117 | - $this->setState('Roles',$value,array()); |
|
| 117 | + $this->setState('Roles', $value, array()); |
|
| 118 | 118 | else |
| 119 | 119 | { |
| 120 | 120 | $roles=array(); |
| 121 | - foreach(explode(',',$value) as $role) |
|
| 121 | + foreach(explode(',', $value) as $role) |
|
| 122 | 122 | { |
| 123 | 123 | if(($role=trim($role))!=='') |
| 124 | 124 | $roles[]=$role; |
| 125 | 125 | } |
| 126 | - $this->setState('Roles',$roles,array()); |
|
| 126 | + $this->setState('Roles', $roles, array()); |
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | public function isInRole($role) |
| 135 | 135 | { |
| 136 | 136 | foreach($this->getRoles() as $r) |
| 137 | - if(strcasecmp($role,$r)===0) |
|
| 137 | + if(strcasecmp($role, $r)===0) |
|
| 138 | 138 | return true; |
| 139 | 139 | return false; |
| 140 | 140 | } |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | * @return mixed the value of the variable. If it doesn't exist, the provided default value will be returned |
| 174 | 174 | * @see setState |
| 175 | 175 | */ |
| 176 | - protected function getState($key,$defaultValue=null) |
|
| 176 | + protected function getState($key, $defaultValue=null) |
|
| 177 | 177 | { |
| 178 | - return isset($this->_state[$key])?$this->_state[$key]:$defaultValue; |
|
| 178 | + return isset($this->_state[$key]) ? $this->_state[$key] : $defaultValue; |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | /** |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | * @param mixed default value. If $value===$defaultValue, the variable will be removed from persistent storage. |
| 193 | 193 | * @see getState |
| 194 | 194 | */ |
| 195 | - protected function setState($key,$value,$defaultValue=null) |
|
| 195 | + protected function setState($key, $value, $defaultValue=null) |
|
| 196 | 196 | { |
| 197 | 197 | if($value===$defaultValue) |
| 198 | 198 | unset($this->_state[$key]); |
@@ -215,6 +215,7 @@ discard block |
||
| 215 | 215 | * This method does not perform any publishing. It merely tells you |
| 216 | 216 | * if the file path is published, what the URL will be to access it. |
| 217 | 217 | * @param string directory or file path being published |
| 218 | + * @param string $path |
|
| 218 | 219 | * @return string the published URL for the file path |
| 219 | 220 | */ |
| 220 | 221 | public function getPublishedUrl($path) |
@@ -230,6 +231,7 @@ discard block |
||
| 230 | 231 | * Generate a CRC32 hash for the directory path. Collisions are higher |
| 231 | 232 | * than MD5 but generates a much smaller hash string. |
| 232 | 233 | * @param string string to be hashed. |
| 234 | + * @param string $dir |
|
| 233 | 235 | * @return string hashed string. |
| 234 | 236 | */ |
| 235 | 237 | protected function hash($dir) |
@@ -243,6 +245,8 @@ discard block |
||
| 243 | 245 | * or has an older file modification time. |
| 244 | 246 | * @param string source file path |
| 245 | 247 | * @param string destination directory (if not exists, it will be created) |
| 248 | + * @param string $src |
|
| 249 | + * @param string $dst |
|
| 246 | 250 | */ |
| 247 | 251 | protected function copyFile($src,$dst) |
| 248 | 252 | { |
@@ -265,6 +269,8 @@ discard block |
||
| 265 | 269 | * File modification time is used to ensure the copied files are latest. |
| 266 | 270 | * @param string the source directory |
| 267 | 271 | * @param string the destination directory |
| 272 | + * @param string $src |
|
| 273 | + * @param string $dst |
|
| 268 | 274 | * @todo a generic solution to ignore certain directories and files |
| 269 | 275 | */ |
| 270 | 276 | public function copyDirectory($src,$dst) |
@@ -306,6 +312,8 @@ discard block |
||
| 306 | 312 | * @param string tar filename |
| 307 | 313 | * @param string MD5 checksum for the corresponding tar file. |
| 308 | 314 | * @param boolean Wether or not to check the time stamp of the file for publishing. Defaults to false. |
| 315 | + * @param string $tarfile |
|
| 316 | + * @param string $md5sum |
|
| 309 | 317 | * @return string URL path to the directory where the tar file was extracted. |
| 310 | 318 | */ |
| 311 | 319 | public function publishTarFile($tarfile, $md5sum, $checkTimestamp=false) |
@@ -336,6 +344,7 @@ discard block |
||
| 336 | 344 | * N.B Tar file must not be compressed. |
| 337 | 345 | * @param string tar file |
| 338 | 346 | * @param string path where the contents of tar file are to be extracted |
| 347 | + * @param string $destination |
|
| 339 | 348 | * @return boolean true if extract successful, false otherwise. |
| 340 | 349 | */ |
| 341 | 350 | protected function deployTarFile($path,$destination) |
@@ -163,8 +163,7 @@ discard block |
||
| 163 | 163 | if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
| 164 | 164 | $this->copyFile($fullpath,$dst); |
| 165 | 165 | return $this->_published[$path]=$this->_baseUrl.'/'.$dir.'/'.$fileName; |
| 166 | - } |
|
| 167 | - else |
|
| 166 | + } else |
|
| 168 | 167 | { |
| 169 | 168 | $dir=$this->hash($fullpath); |
| 170 | 169 | if(!is_dir($this->_basePath.DIRECTORY_SEPARATOR.$dir) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
@@ -287,8 +286,7 @@ discard block |
||
| 287 | 286 | @copy($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file); |
| 288 | 287 | @chmod($dst.DIRECTORY_SEPARATOR.$file, PRADO_CHMOD); |
| 289 | 288 | } |
| 290 | - } |
|
| 291 | - else |
|
| 289 | + } else |
|
| 292 | 290 | $this->copyDirectory($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file); |
| 293 | 291 | } |
| 294 | 292 | closedir($folder); |
@@ -91,9 +91,9 @@ discard block |
||
| 91 | 91 | if($this->_basePath===null) |
| 92 | 92 | $this->_basePath=dirname($application->getRequest()->getApplicationFilePath()).DIRECTORY_SEPARATOR.self::DEFAULT_BASEPATH; |
| 93 | 93 | if(!is_writable($this->_basePath) || !is_dir($this->_basePath)) |
| 94 | - throw new TConfigurationException('assetmanager_basepath_invalid',$this->_basePath); |
|
| 94 | + throw new TConfigurationException('assetmanager_basepath_invalid', $this->_basePath); |
|
| 95 | 95 | if($this->_baseUrl===null) |
| 96 | - $this->_baseUrl=rtrim(dirname($application->getRequest()->getApplicationUrl()),'/\\').'/'.self::DEFAULT_BASEPATH; |
|
| 96 | + $this->_baseUrl=rtrim(dirname($application->getRequest()->getApplicationUrl()), '/\\').'/'.self::DEFAULT_BASEPATH; |
|
| 97 | 97 | $application->setAssetManager($this); |
| 98 | 98 | $this->_initialized=true; |
| 99 | 99 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | $this->_basePath=Prado::getPathOfNamespace($value); |
| 122 | 122 | if($this->_basePath===null || !is_dir($this->_basePath) || !is_writable($this->_basePath)) |
| 123 | - throw new TInvalidDataValueException('assetmanager_basepath_invalid',$value); |
|
| 123 | + throw new TInvalidDataValueException('assetmanager_basepath_invalid', $value); |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | if($this->_initialized) |
| 142 | 142 | throw new TInvalidOperationException('assetmanager_baseurl_unchangeable'); |
| 143 | 143 | else |
| 144 | - $this->_baseUrl=rtrim($value,'/'); |
|
| 144 | + $this->_baseUrl=rtrim($value, '/'); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -158,19 +158,19 @@ discard block |
||
| 158 | 158 | * @throws TInvalidDataValueException if the file path to be published is |
| 159 | 159 | * invalid |
| 160 | 160 | */ |
| 161 | - public function publishFilePath($path,$checkTimestamp=false) |
|
| 161 | + public function publishFilePath($path, $checkTimestamp=false) |
|
| 162 | 162 | { |
| 163 | 163 | if(isset($this->_published[$path])) |
| 164 | 164 | return $this->_published[$path]; |
| 165 | 165 | else if(empty($path) || ($fullpath=realpath($path))===false) |
| 166 | - throw new TInvalidDataValueException('assetmanager_filepath_invalid',$path); |
|
| 166 | + throw new TInvalidDataValueException('assetmanager_filepath_invalid', $path); |
|
| 167 | 167 | else if(is_file($fullpath)) |
| 168 | 168 | { |
| 169 | 169 | $dir=$this->hash(dirname($fullpath)); |
| 170 | 170 | $fileName=basename($fullpath); |
| 171 | 171 | $dst=$this->_basePath.DIRECTORY_SEPARATOR.$dir; |
| 172 | 172 | if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
| 173 | - $this->copyFile($fullpath,$dst); |
|
| 173 | + $this->copyFile($fullpath, $dst); |
|
| 174 | 174 | return $this->_published[$path]=$this->_baseUrl.'/'.$dir.'/'.$fileName; |
| 175 | 175 | } |
| 176 | 176 | else |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | $dir=$this->hash($fullpath); |
| 179 | 179 | if(!is_dir($this->_basePath.DIRECTORY_SEPARATOR.$dir) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
| 180 | 180 | { |
| 181 | - Prado::trace("Publishing directory $fullpath",'Prado\Web\TAssetManager'); |
|
| 182 | - $this->copyDirectory($fullpath,$this->_basePath.DIRECTORY_SEPARATOR.$dir); |
|
| 181 | + Prado::trace("Publishing directory $fullpath", 'Prado\Web\TAssetManager'); |
|
| 182 | + $this->copyDirectory($fullpath, $this->_basePath.DIRECTORY_SEPARATOR.$dir); |
|
| 183 | 183 | } |
| 184 | 184 | return $this->_published[$path]=$this->_baseUrl.'/'.$dir; |
| 185 | 185 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | protected function setPublished($values=array()) |
| 202 | 202 | { |
| 203 | - $this->_published = $values; |
|
| 203 | + $this->_published=$values; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | */ |
| 244 | 244 | protected function hash($dir) |
| 245 | 245 | { |
| 246 | - return sprintf('%x',crc32($dir.Prado::getVersion())); |
|
| 246 | + return sprintf('%x', crc32($dir.Prado::getVersion())); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | * @param string source file path |
| 254 | 254 | * @param string destination directory (if not exists, it will be created) |
| 255 | 255 | */ |
| 256 | - protected function copyFile($src,$dst) |
|
| 256 | + protected function copyFile($src, $dst) |
|
| 257 | 257 | { |
| 258 | 258 | if(!is_dir($dst)) |
| 259 | 259 | { |
@@ -261,10 +261,10 @@ discard block |
||
| 261 | 261 | @chmod($dst, PRADO_CHMOD); |
| 262 | 262 | } |
| 263 | 263 | $dstFile=$dst.DIRECTORY_SEPARATOR.basename($src); |
| 264 | - if(@filemtime($dstFile)<@filemtime($src)) |
|
| 264 | + if(@filemtime($dstFile) < @filemtime($src)) |
|
| 265 | 265 | { |
| 266 | - Prado::trace("Publishing file $src to $dstFile",'Prado\Web\TAssetManager'); |
|
| 267 | - @copy($src,$dstFile); |
|
| 266 | + Prado::trace("Publishing file $src to $dstFile", 'Prado\Web\TAssetManager'); |
|
| 267 | + @copy($src, $dstFile); |
|
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | * @param string the destination directory |
| 277 | 277 | * @todo a generic solution to ignore certain directories and files |
| 278 | 278 | */ |
| 279 | - public function copyDirectory($src,$dst) |
|
| 279 | + public function copyDirectory($src, $dst) |
|
| 280 | 280 | { |
| 281 | 281 | if(!is_dir($dst)) |
| 282 | 282 | { |
@@ -291,14 +291,14 @@ discard block |
||
| 291 | 291 | continue; |
| 292 | 292 | else if(is_file($src.DIRECTORY_SEPARATOR.$file)) |
| 293 | 293 | { |
| 294 | - if(@filemtime($dst.DIRECTORY_SEPARATOR.$file)<@filemtime($src.DIRECTORY_SEPARATOR.$file)) |
|
| 294 | + if(@filemtime($dst.DIRECTORY_SEPARATOR.$file) < @filemtime($src.DIRECTORY_SEPARATOR.$file)) |
|
| 295 | 295 | { |
| 296 | - @copy($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file); |
|
| 296 | + @copy($src.DIRECTORY_SEPARATOR.$file, $dst.DIRECTORY_SEPARATOR.$file); |
|
| 297 | 297 | @chmod($dst.DIRECTORY_SEPARATOR.$file, PRADO_CHMOD); |
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | 300 | else |
| 301 | - $this->copyDirectory($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file); |
|
| 301 | + $this->copyDirectory($src.DIRECTORY_SEPARATOR.$file, $dst.DIRECTORY_SEPARATOR.$file); |
|
| 302 | 302 | } |
| 303 | 303 | closedir($folder); |
| 304 | 304 | } else { |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | if(isset($this->_published[$md5sum])) |
| 323 | 323 | return $this->_published[$md5sum]; |
| 324 | 324 | else if(($fullpath=realpath($md5sum))===false || !is_file($fullpath)) |
| 325 | - throw new TInvalidDataValueException('assetmanager_tarchecksum_invalid',$md5sum); |
|
| 325 | + throw new TInvalidDataValueException('assetmanager_tarchecksum_invalid', $md5sum); |
|
| 326 | 326 | else |
| 327 | 327 | { |
| 328 | 328 | $dir=$this->hash(dirname($fullpath)); |
@@ -330,10 +330,10 @@ discard block |
||
| 330 | 330 | $dst=$this->_basePath.DIRECTORY_SEPARATOR.$dir; |
| 331 | 331 | if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
| 332 | 332 | { |
| 333 | - if(@filemtime($dst.DIRECTORY_SEPARATOR.$fileName)<@filemtime($fullpath)) |
|
| 333 | + if(@filemtime($dst.DIRECTORY_SEPARATOR.$fileName) < @filemtime($fullpath)) |
|
| 334 | 334 | { |
| 335 | - $this->copyFile($fullpath,$dst); |
|
| 336 | - $this->deployTarFile($tarfile,$dst); |
|
| 335 | + $this->copyFile($fullpath, $dst); |
|
| 336 | + $this->deployTarFile($tarfile, $dst); |
|
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | return $this->_published[$md5sum]=$this->_baseUrl.'/'.$dir; |
@@ -347,13 +347,13 @@ discard block |
||
| 347 | 347 | * @param string path where the contents of tar file are to be extracted |
| 348 | 348 | * @return boolean true if extract successful, false otherwise. |
| 349 | 349 | */ |
| 350 | - protected function deployTarFile($path,$destination) |
|
| 350 | + protected function deployTarFile($path, $destination) |
|
| 351 | 351 | { |
| 352 | 352 | if(($fullpath=realpath($path))===false || !is_file($fullpath)) |
| 353 | - throw new TIOException('assetmanager_tarfile_invalid',$path); |
|
| 353 | + throw new TIOException('assetmanager_tarfile_invalid', $path); |
|
| 354 | 354 | else |
| 355 | 355 | { |
| 356 | - $tar = new TTarFileExtractor($fullpath); |
|
| 356 | + $tar=new TTarFileExtractor($fullpath); |
|
| 357 | 357 | return $tar->extract($destination); |
| 358 | 358 | } |
| 359 | 359 | } |
@@ -416,8 +416,7 @@ |
||
| 416 | 416 | { |
| 417 | 417 | $useArgs = !is_array($parameters) && is_array($args); |
| 418 | 418 | return new TSqlCriteria($criteria,$useArgs ? $args : $parameters); |
| 419 | - } |
|
| 420 | - else if($criteria instanceof TSqlCriteria) |
|
| 419 | + } else if($criteria instanceof TSqlCriteria) |
|
| 421 | 420 | return $criteria; |
| 422 | 421 | else |
| 423 | 422 | throw new TDbException('dbtablegateway_invalid_criteria'); |
@@ -103,6 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * @param TDbTableInfo table or view information. |
| 106 | + * @param TDbTableInfo $tableInfo |
|
| 106 | 107 | */ |
| 107 | 108 | protected function setTableInfo($tableInfo) |
| 108 | 109 | { |
@@ -113,6 +114,7 @@ discard block |
||
| 113 | 114 | /** |
| 114 | 115 | * Sets up the command builder for the given table. |
| 115 | 116 | * @param string table or view name. |
| 117 | + * @param string $tableName |
|
| 116 | 118 | */ |
| 117 | 119 | protected function setTableName($tableName) |
| 118 | 120 | { |
@@ -224,6 +226,7 @@ discard block |
||
| 224 | 226 | * |
| 225 | 227 | * @param string|TSqlCriteria SQL condition or criteria object. |
| 226 | 228 | * @param mixed parameter values. |
| 229 | + * @param TSqlCriteria $criteria |
|
| 227 | 230 | * @return array matching record object. |
| 228 | 231 | */ |
| 229 | 232 | public function find($criteria, $parameters=array()) |
@@ -237,6 +240,7 @@ discard block |
||
| 237 | 240 | * Accepts same parameters as find(), but returns TDbDataReader instead. |
| 238 | 241 | * @param string|TSqlCriteria SQL condition or criteria object. |
| 239 | 242 | * @param mixed parameter values. |
| 243 | + * @param TSqlCriteria $criteria |
|
| 240 | 244 | * @return TDbDataReader matching records. |
| 241 | 245 | */ |
| 242 | 246 | public function findAll($criteria=null, $parameters=array()) |
@@ -299,6 +303,7 @@ discard block |
||
| 299 | 303 | * </code> |
| 300 | 304 | * @param string delete condition. |
| 301 | 305 | * @param array condition parameters. |
| 306 | + * @param TSqlCriteria $criteria |
|
| 302 | 307 | * @return integer number of records deleted. |
| 303 | 308 | */ |
| 304 | 309 | public function deleteAll($criteria, $parameters=array()) |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @param string|TDbTableInfo table or view name or table information. |
| 91 | 91 | * @param TDbConnection database connection. |
| 92 | 92 | */ |
| 93 | - public function __construct($table,$connection) |
|
| 93 | + public function __construct($table, $connection) |
|
| 94 | 94 | { |
| 95 | 95 | $this->_connection=$connection; |
| 96 | 96 | if(is_string($table)) |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | protected function setTableInfo($tableInfo) |
| 108 | 108 | { |
| 109 | - $builder = $tableInfo->createCommandBuilder($this->getDbConnection()); |
|
| 109 | + $builder=$tableInfo->createCommandBuilder($this->getDbConnection()); |
|
| 110 | 110 | $this->initCommandBuilder($builder); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | protected function setTableName($tableName) |
| 118 | 118 | { |
| 119 | - $meta = TDbMetaData::getInstance($this->getDbConnection()); |
|
| 119 | + $meta=TDbMetaData::getInstance($this->getDbConnection()); |
|
| 120 | 120 | $this->initCommandBuilder($meta->createCommandBuilder($tableName)); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -135,9 +135,9 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | protected function initCommandBuilder($builder) |
| 137 | 137 | { |
| 138 | - $this->_command = new TDataGatewayCommand($builder); |
|
| 139 | - $this->_command->OnCreateCommand[] = array($this, 'onCreateCommand'); |
|
| 140 | - $this->_command->OnExecuteCommand[] = array($this, 'onExecuteCommand'); |
|
| 138 | + $this->_command=new TDataGatewayCommand($builder); |
|
| 139 | + $this->_command->OnCreateCommand[]=array($this, 'onCreateCommand'); |
|
| 140 | + $this->_command->OnExecuteCommand[]=array($this, 'onExecuteCommand'); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /** |
@@ -191,8 +191,8 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | public function findBySql($sql, $parameters=array()) |
| 193 | 193 | { |
| 194 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
| 195 | - $criteria = $this->getCriteria($sql,$parameters, $args); |
|
| 194 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
| 195 | + $criteria=$this->getCriteria($sql, $parameters, $args); |
|
| 196 | 196 | return $this->getCommand()->findBySql($criteria); |
| 197 | 197 | } |
| 198 | 198 | |
@@ -204,8 +204,8 @@ discard block |
||
| 204 | 204 | */ |
| 205 | 205 | public function findAllBySql($sql, $parameters=array()) |
| 206 | 206 | { |
| 207 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
| 208 | - $criteria = $this->getCriteria($sql,$parameters, $args); |
|
| 207 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
| 208 | + $criteria=$this->getCriteria($sql, $parameters, $args); |
|
| 209 | 209 | return $this->getCommand()->findAllBySql($criteria); |
| 210 | 210 | } |
| 211 | 211 | |
@@ -228,8 +228,8 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | public function find($criteria, $parameters=array()) |
| 230 | 230 | { |
| 231 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
| 232 | - $criteria = $this->getCriteria($criteria,$parameters, $args); |
|
| 231 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
| 232 | + $criteria=$this->getCriteria($criteria, $parameters, $args); |
|
| 233 | 233 | return $this->getCommand()->find($criteria); |
| 234 | 234 | } |
| 235 | 235 | |
@@ -241,9 +241,9 @@ discard block |
||
| 241 | 241 | */ |
| 242 | 242 | public function findAll($criteria=null, $parameters=array()) |
| 243 | 243 | { |
| 244 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
| 244 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
| 245 | 245 | if($criteria!==null) |
| 246 | - $criteria = $this->getCriteria($criteria,$parameters, $args); |
|
| 246 | + $criteria=$this->getCriteria($criteria, $parameters, $args); |
|
| 247 | 247 | return $this->getCommand()->findAll($criteria); |
| 248 | 248 | } |
| 249 | 249 | |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | public function findByPk($keys) |
| 263 | 263 | { |
| 264 | 264 | if(func_num_args() > 1) |
| 265 | - $keys = func_get_args(); |
|
| 265 | + $keys=func_get_args(); |
|
| 266 | 266 | return $this->getCommand()->findByPk($keys); |
| 267 | 267 | } |
| 268 | 268 | |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | public function findAllByPks($keys) |
| 287 | 287 | { |
| 288 | 288 | if(func_num_args() > 1) |
| 289 | - $keys = func_get_args(); |
|
| 289 | + $keys=func_get_args(); |
|
| 290 | 290 | return $this->getCommand()->findAllByPk($keys); |
| 291 | 291 | } |
| 292 | 292 | |
@@ -303,8 +303,8 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | public function deleteAll($criteria, $parameters=array()) |
| 305 | 305 | { |
| 306 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
| 307 | - $criteria = $this->getCriteria($criteria,$parameters, $args); |
|
| 306 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
| 307 | + $criteria=$this->getCriteria($criteria, $parameters, $args); |
|
| 308 | 308 | return $this->getCommand()->delete($criteria); |
| 309 | 309 | } |
| 310 | 310 | |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | public function deleteByPk($keys) |
| 335 | 335 | { |
| 336 | 336 | if(func_num_args() > 1) |
| 337 | - $keys = func_get_args(); |
|
| 337 | + $keys=func_get_args(); |
|
| 338 | 338 | return $this->getCommand()->deleteByPk($keys); |
| 339 | 339 | } |
| 340 | 340 | |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | public function deleteAllByPks($keys) |
| 345 | 345 | { |
| 346 | 346 | if(func_num_args() > 1) |
| 347 | - $keys = func_get_args(); |
|
| 347 | + $keys=func_get_args(); |
|
| 348 | 348 | return $this->deleteByPk($keys); |
| 349 | 349 | } |
| 350 | 350 | |
@@ -354,11 +354,11 @@ discard block |
||
| 354 | 354 | * @param mixed parameter values. |
| 355 | 355 | * @return int number of records. |
| 356 | 356 | */ |
| 357 | - public function count($criteria=null,$parameters=array()) |
|
| 357 | + public function count($criteria=null, $parameters=array()) |
|
| 358 | 358 | { |
| 359 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
| 359 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
| 360 | 360 | if($criteria!==null) |
| 361 | - $criteria = $this->getCriteria($criteria,$parameters, $args); |
|
| 361 | + $criteria=$this->getCriteria($criteria, $parameters, $args); |
|
| 362 | 362 | return $this->getCommand()->count($criteria); |
| 363 | 363 | } |
| 364 | 364 | |
@@ -378,8 +378,8 @@ discard block |
||
| 378 | 378 | */ |
| 379 | 379 | public function update($data, $criteria, $parameters=array()) |
| 380 | 380 | { |
| 381 | - $args = func_num_args() > 2 ? array_slice(func_get_args(),2) : null; |
|
| 382 | - $criteria = $this->getCriteria($criteria,$parameters, $args); |
|
| 381 | + $args=func_num_args() > 2 ? array_slice(func_get_args(), 2) : null; |
|
| 382 | + $criteria=$this->getCriteria($criteria, $parameters, $args); |
|
| 383 | 383 | return $this->getCommand()->update($data, $criteria); |
| 384 | 384 | } |
| 385 | 385 | |
@@ -416,8 +416,8 @@ discard block |
||
| 416 | 416 | { |
| 417 | 417 | if(is_string($criteria)) |
| 418 | 418 | { |
| 419 | - $useArgs = !is_array($parameters) && is_array($args); |
|
| 420 | - return new TSqlCriteria($criteria,$useArgs ? $args : $parameters); |
|
| 419 | + $useArgs=!is_array($parameters) && is_array($args); |
|
| 420 | + return new TSqlCriteria($criteria, $useArgs ? $args : $parameters); |
|
| 421 | 421 | } |
| 422 | 422 | else if($criteria instanceof TSqlCriteria) |
| 423 | 423 | return $criteria; |
@@ -454,21 +454,21 @@ discard block |
||
| 454 | 454 | * @return mixed single record if method name starts with "findBy", 0 or more records |
| 455 | 455 | * if method name starts with "findAllBy" |
| 456 | 456 | */ |
| 457 | - public function __call($method,$args) |
|
| 457 | + public function __call($method, $args) |
|
| 458 | 458 | { |
| 459 | - $delete =false; |
|
| 460 | - if($findOne = substr(strtolower($method),0,6)==='findby') |
|
| 461 | - $condition = $method[6]==='_' ? substr($method,7) : substr($method,6); |
|
| 462 | - else if(substr(strtolower($method),0,9)==='findallby') |
|
| 463 | - $condition = $method[9]==='_' ? substr($method,10) : substr($method,9); |
|
| 464 | - else if($delete = substr(strtolower($method),0,8)==='deleteby') |
|
| 465 | - $condition = $method[8]==='_' ? substr($method,9) : substr($method,8); |
|
| 466 | - else if($delete = substr(strtolower($method),0,11)==='deleteallby') |
|
| 467 | - $condition = $method[11]==='_' ? substr($method,12) : substr($method,11); |
|
| 459 | + $delete=false; |
|
| 460 | + if($findOne=substr(strtolower($method), 0, 6)==='findby') |
|
| 461 | + $condition=$method[6]==='_' ? substr($method, 7) : substr($method, 6); |
|
| 462 | + else if(substr(strtolower($method), 0, 9)==='findallby') |
|
| 463 | + $condition=$method[9]==='_' ? substr($method, 10) : substr($method, 9); |
|
| 464 | + else if($delete=substr(strtolower($method), 0, 8)==='deleteby') |
|
| 465 | + $condition=$method[8]==='_' ? substr($method, 9) : substr($method, 8); |
|
| 466 | + else if($delete=substr(strtolower($method), 0, 11)==='deleteallby') |
|
| 467 | + $condition=$method[11]==='_' ? substr($method, 12) : substr($method, 11); |
|
| 468 | 468 | else |
| 469 | 469 | return null; |
| 470 | 470 | |
| 471 | - $criteria = $this->getCommand()->createCriteriaFromString($method, $condition, $args); |
|
| 471 | + $criteria=$this->getCommand()->createCriteriaFromString($method, $condition, $args); |
|
| 472 | 472 | if($delete) |
| 473 | 473 | return $this->deleteAll($criteria); |
| 474 | 474 | else |
@@ -115,8 +115,7 @@ discard block |
||
| 115 | 115 | $columns = $this->getTableInfo()->getColumns(); |
| 116 | 116 | $this->getInputRepeater()->setDataSource($columns); |
| 117 | 117 | $this->getInputRepeater()->dataBind(); |
| 118 | - } |
|
| 119 | - else |
|
| 118 | + } else |
|
| 120 | 119 | { |
| 121 | 120 | if($this->_editRenderer===null) |
| 122 | 121 | $this->createEditRenderer($record, $classPath); |
@@ -140,8 +139,7 @@ discard block |
||
| 140 | 139 | $index = $this->getControls()->remove($this->getInputRepeater()); |
| 141 | 140 | $this->getControls()->insertAt($index,$this->_editRenderer); |
| 142 | 141 | $this->_editRenderer->setData($record); |
| 143 | - } |
|
| 144 | - else |
|
| 142 | + } else |
|
| 145 | 143 | { |
| 146 | 144 | throw new TConfigurationException( |
| 147 | 145 | 'scaffold_invalid_edit_renderer', $this->getID(), get_class($record)); |
@@ -204,15 +202,13 @@ discard block |
||
| 204 | 202 | $column = $table->getColumn($item->getCustomData()); |
| 205 | 203 | $builder->loadScaffoldInput($this, $item, $column, $record); |
| 206 | 204 | } |
| 207 | - } |
|
| 208 | - else |
|
| 205 | + } else |
|
| 209 | 206 | { |
| 210 | 207 | $this->_editRenderer->updateRecord($record); |
| 211 | 208 | } |
| 212 | 209 | $record->save(); |
| 213 | 210 | return true; |
| 214 | - } |
|
| 215 | - else if($this->_editRenderer!==null) |
|
| 211 | + } else if($this->_editRenderer!==null) |
|
| 216 | 212 | { |
| 217 | 213 | //preserve the form data. |
| 218 | 214 | $this->_editRenderer->updateRecord($this->getCurrentRecord()); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | - * @return TActiveRecord current Active Record instance |
|
| 106 | + * @return \Prado\Data\ActiveRecord\TActiveRecord current Active Record instance |
|
| 107 | 107 | */ |
| 108 | 108 | protected function getCurrentRecord() |
| 109 | 109 | { |
@@ -136,6 +136,8 @@ discard block |
||
| 136 | 136 | * Instantiate the external edit renderer. |
| 137 | 137 | * @param TActiveRecord record to be edited |
| 138 | 138 | * @param string external edit renderer class name. |
| 139 | + * @param \Prado\Data\ActiveRecord\TActiveRecord $record |
|
| 140 | + * @param string $classPath |
|
| 139 | 141 | * @throws TConfigurationException raised when renderer is not an |
| 140 | 142 | * instance of IScaffoldEditRenderer. |
| 141 | 143 | */ |
@@ -267,6 +269,7 @@ discard block |
||
| 267 | 269 | /** |
| 268 | 270 | * Create the default scaffold editor control factory. |
| 269 | 271 | * @param TActiveRecord record instance. |
| 272 | + * @param \Prado\Data\ActiveRecord\TActiveRecord $record |
|
| 270 | 273 | * @return TScaffoldInputBase scaffold editor control factory. |
| 271 | 274 | */ |
| 272 | 275 | protected function getScaffoldInputBuilder($record) |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | * xxx is the property name). |
| 50 | 50 | * |
| 51 | 51 | * @author Wei Zhuo <weizho[at]gmail[dot]com> |
| 52 | - * @package Prado\Data\ActiveRecord\Scaffold |
|
| 52 | + * @package Prado\Data\ActiveRecord\Scaffold |
|
| 53 | 53 | * @since 3.1 |
| 54 | 54 | */ |
| 55 | 55 | class TScaffoldEditView extends TScaffoldBase |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | public function setRecordPk($value) |
| 91 | 91 | { |
| 92 | 92 | $this->clearRecordObject(); |
| 93 | - $val = TPropertyValue::ensureArray($value); |
|
| 93 | + $val=TPropertyValue::ensureArray($value); |
|
| 94 | 94 | $this->setViewState('PK', count($val) > 0 ? $val : null); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -115,11 +115,11 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function initializeEditForm() |
| 117 | 117 | { |
| 118 | - $record = $this->getCurrentRecord(); |
|
| 119 | - $classPath = $this->getEditRenderer(); |
|
| 120 | - if($classPath === '') |
|
| 118 | + $record=$this->getCurrentRecord(); |
|
| 119 | + $classPath=$this->getEditRenderer(); |
|
| 120 | + if($classPath==='') |
|
| 121 | 121 | { |
| 122 | - $columns = $this->getTableInfo()->getColumns(); |
|
| 122 | + $columns=$this->getTableInfo()->getColumns(); |
|
| 123 | 123 | $this->getInputRepeater()->setDataSource($columns); |
| 124 | 124 | $this->getInputRepeater()->dataBind(); |
| 125 | 125 | } |
@@ -141,11 +141,11 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | protected function createEditRenderer($record, $classPath) |
| 143 | 143 | { |
| 144 | - $this->_editRenderer = Prado::createComponent($classPath); |
|
| 144 | + $this->_editRenderer=Prado::createComponent($classPath); |
|
| 145 | 145 | if($this->_editRenderer instanceof IScaffoldEditRenderer) |
| 146 | 146 | { |
| 147 | - $index = $this->getControls()->remove($this->getInputRepeater()); |
|
| 148 | - $this->getControls()->insertAt($index,$this->_editRenderer); |
|
| 147 | + $index=$this->getControls()->remove($this->getInputRepeater()); |
|
| 148 | + $this->getControls()->insertAt($index, $this->_editRenderer); |
|
| 149 | 149 | $this->_editRenderer->setData($record); |
| 150 | 150 | } |
| 151 | 151 | else |
@@ -160,16 +160,16 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | protected function createRepeaterEditItem($sender, $param) |
| 162 | 162 | { |
| 163 | - $type = $param->getItem()->getItemType(); |
|
| 163 | + $type=$param->getItem()->getItemType(); |
|
| 164 | 164 | if($type==TListItemType::Item || $type==TListItemType::AlternatingItem) |
| 165 | 165 | { |
| 166 | - $item = $param->getItem(); |
|
| 167 | - $column = $item->getDataItem(); |
|
| 166 | + $item=$param->getItem(); |
|
| 167 | + $column=$item->getDataItem(); |
|
| 168 | 168 | if($column===null) |
| 169 | 169 | return; |
| 170 | 170 | |
| 171 | - $record = $this->getCurrentRecord(); |
|
| 172 | - $builder = $this->getScaffoldInputBuilder($record); |
|
| 171 | + $record=$this->getCurrentRecord(); |
|
| 172 | + $builder=$this->getScaffoldInputBuilder($record); |
|
| 173 | 173 | $builder->createScaffoldInput($this, $item, $column, $record); |
| 174 | 174 | } |
| 175 | 175 | } |
@@ -201,14 +201,14 @@ discard block |
||
| 201 | 201 | { |
| 202 | 202 | if($this->getPage()->getIsValid()) |
| 203 | 203 | { |
| 204 | - $record = $this->getCurrentRecord(); |
|
| 204 | + $record=$this->getCurrentRecord(); |
|
| 205 | 205 | if($this->_editRenderer===null) |
| 206 | 206 | { |
| 207 | - $table = $this->getTableInfo(); |
|
| 208 | - $builder = $this->getScaffoldInputBuilder($record); |
|
| 207 | + $table=$this->getTableInfo(); |
|
| 208 | + $builder=$this->getScaffoldInputBuilder($record); |
|
| 209 | 209 | foreach($this->getInputRepeater()->getItems() as $item) |
| 210 | 210 | { |
| 211 | - $column = $table->getColumn($item->getCustomData()); |
|
| 211 | + $column=$table->getColumn($item->getCustomData()); |
|
| 212 | 212 | $builder->loadScaffoldInput($this, $item, $column, $record); |
| 213 | 213 | } |
| 214 | 214 | } |
@@ -272,10 +272,10 @@ discard block |
||
| 272 | 272 | protected function getScaffoldInputBuilder($record) |
| 273 | 273 | { |
| 274 | 274 | static $_builders=array(); |
| 275 | - $class = get_class($record); |
|
| 275 | + $class=get_class($record); |
|
| 276 | 276 | if(!isset($_builders[$class])) |
| 277 | 277 | { |
| 278 | - $_builders[$class] = TScaffoldInputBase::createInputBuilder($record); |
|
| 278 | + $_builders[$class]=TScaffoldInputBase::createInputBuilder($record); |
|
| 279 | 279 | } |
| 280 | 280 | return $_builders[$class]; |
| 281 | 281 | } |