@@ -90,10 +90,10 @@ |
||
| 90 | 90 | { |
| 91 | 91 | return array('altField', 'altFormat', 'appendText', 'autoSize', 'buttonImage', 'buttonImageOnly', 'buttonText', 'calculateWeek', |
| 92 | 92 | 'changeMonth', 'changeYear', 'closeText', 'constrainInput', 'currentText', 'dateFormat', 'dayNames', 'dayNamesMin', |
| 93 | - 'dayNamesShort', 'defaultDate', 'duration', 'firstDay', 'gotoCurrent', 'hideIfNoPrevNext', 'isRTL', 'maxDate', |
|
| 93 | + 'dayNamesShort', 'defaultDate', 'duration', 'firstDay', 'gotoCurrent', 'hideIfNoPrevNext', 'isRTL', 'maxDate', |
|
| 94 | 94 | 'minDate', 'monthNames', 'monthNamesShort', 'navigationAsDateFormat', 'nextText', 'numberOfMonths', 'prevText', |
| 95 | 95 | 'selectOtherMonths', 'shortYearCutoff', 'showAnim', 'showButtonPanel', 'showCurrentAtPos', 'showMonthAfterYear', |
| 96 | - 'showOn', 'showOptions', 'showOtherMonths', 'showWeek', 'stepMonths', 'weekHeader', 'yearRange', 'yearSuffix', |
|
| 96 | + 'showOn', 'showOptions', 'showOtherMonths', 'showWeek', 'stepMonths', 'weekHeader', 'yearRange', 'yearSuffix', |
|
| 97 | 97 | 'beforeShow', 'beforeShowDay', 'onChangeMonthYear', 'onClose', 'onSelect'); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * it will register an additional clientscript to set the language specific global default settings. |
| 40 | 40 | * @var boolean true, if this is the first instance of TJuiDatePicker, false otherwise |
| 41 | 41 | */ |
| 42 | - private static $_first = true; |
|
| 42 | + private static $_first=true; |
|
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * Creates a new callback control, sets the adapter to |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function getOptions() |
| 76 | 76 | { |
| 77 | - if (($options=$this->getViewState('JuiOptions'))===null) |
|
| 77 | + if(($options=$this->getViewState('JuiOptions'))===null) |
|
| 78 | 78 | { |
| 79 | 79 | $options=new TJuiControlOptions($this); |
| 80 | 80 | $this->setViewState('JuiOptions', $options); |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | protected function getCurrentCulture() |
| 170 | 170 | { |
| 171 | - $app = $this->getApplication()->getGlobalization(false); |
|
| 172 | - return $this->getCulture() == '' ? |
|
| 171 | + $app=$this->getApplication()->getGlobalization(false); |
|
| 172 | + return $this->getCulture()=='' ? |
|
| 173 | 173 | ($app ? $app->getCulture() : 'en') : $this->getCulture(); |
| 174 | 174 | } |
| 175 | 175 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | */ |
| 179 | 179 | public function getDateFormat() |
| 180 | 180 | { |
| 181 | - return $this->getViewState('DateFormat','dd-MM-yyyy'); |
|
| 181 | + return $this->getViewState('DateFormat', 'dd-MM-yyyy'); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | /** |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | public function setDateFormat($value) |
| 189 | 189 | { |
| 190 | - $this->setViewState('DateFormat',$value,'dd-MM-yyyy'); |
|
| 190 | + $this->setViewState('DateFormat', $value, 'dd-MM-yyyy'); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /** |
@@ -253,8 +253,8 @@ discard block |
||
| 253 | 253 | $this->setText(''); |
| 254 | 254 | else |
| 255 | 255 | { |
| 256 | - $date = TPropertyValue::ensureFloat($value); |
|
| 257 | - $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter',$this->getDateFormat()); |
|
| 256 | + $date=TPropertyValue::ensureFloat($value); |
|
| 257 | + $formatter=Prado::createComponent('System.Util.TSimpleDateFormatter', $this->getDateFormat()); |
|
| 258 | 258 | $this->setText($formatter->format($date)); |
| 259 | 259 | } |
| 260 | 260 | } |
@@ -265,9 +265,9 @@ discard block |
||
| 265 | 265 | */ |
| 266 | 266 | protected function getTimeStampFromText() |
| 267 | 267 | { |
| 268 | - $pattern = $this->getDateFormat(); |
|
| 269 | - $pattern = str_replace(array('MMMM', 'MMM'), array('MM','MM'), $pattern); |
|
| 270 | - $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter',$pattern); |
|
| 268 | + $pattern=$this->getDateFormat(); |
|
| 269 | + $pattern=str_replace(array('MMMM', 'MMM'), array('MM', 'MM'), $pattern); |
|
| 270 | + $formatter=Prado::createComponent('System.Util.TSimpleDateFormatter', $pattern); |
|
| 271 | 271 | return $formatter->parse($this->getText()); |
| 272 | 272 | } |
| 273 | 273 | |
@@ -278,10 +278,10 @@ discard block |
||
| 278 | 278 | */ |
| 279 | 279 | public function getValidationPropertyValue() |
| 280 | 280 | { |
| 281 | - if(($text = $this->getText()) === '') |
|
| 281 | + if(($text=$this->getText())==='') |
|
| 282 | 282 | return ''; |
| 283 | - $date = $this->getTimeStamp(); |
|
| 284 | - return $date == null ? $text : $date; |
|
| 283 | + $date=$this->getTimeStamp(); |
|
| 284 | + return $date==null ? $text : $date; |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | } |
| 288 | 288 | \ No newline at end of file |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * TJuiDraggable class file. |
|
| 4 | - * |
|
| 5 | - * @author Fabio Bas <ctrlaltca[at]gmail[dot]com> |
|
| 6 | - * @link https://github.com/pradosoft/prado |
|
| 7 | - * @copyright Copyright © 2013-2015 PradoSoft |
|
| 8 | - * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
| 9 | - * @package System.Web.UI.JuiControls |
|
| 10 | - */ |
|
| 3 | + * TJuiDraggable class file. |
|
| 4 | + * |
|
| 5 | + * @author Fabio Bas <ctrlaltca[at]gmail[dot]com> |
|
| 6 | + * @link https://github.com/pradosoft/prado |
|
| 7 | + * @copyright Copyright © 2013-2015 PradoSoft |
|
| 8 | + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
| 9 | + * @package System.Web.UI.JuiControls |
|
| 10 | + */ |
|
| 11 | 11 | |
| 12 | 12 | Prado::using('System.Web.UI.JuiControls.TJuiControlAdapter'); |
| 13 | 13 | Prado::using('System.Web.UI.ActiveControls.TActivePanel'); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function getOptions() |
| 74 | 74 | { |
| 75 | - if (($options=$this->getViewState('JuiOptions'))===null) |
|
| 75 | + if(($options=$this->getViewState('JuiOptions'))===null) |
|
| 76 | 76 | { |
| 77 | 77 | $options=new TJuiControlOptions($this); |
| 78 | 78 | $this->setViewState('JuiOptions', $options); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | { |
| 115 | 115 | parent::addAttributesToRender($writer); |
| 116 | 116 | |
| 117 | - $writer->addAttribute('id',$this->getClientID()); |
|
| 117 | + $writer->addAttribute('id', $this->getClientID()); |
|
| 118 | 118 | $options=TJavascript::encode($this->getPostBackOptions()); |
| 119 | 119 | $cs=$this->getPage()->getClientScript(); |
| 120 | 120 | $code="jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * Raises the OnCreate event |
| 136 | 136 | * @param object $params event parameters |
| 137 | 137 | */ |
| 138 | - public function onCreate ($params) |
|
| 138 | + public function onCreate($params) |
|
| 139 | 139 | { |
| 140 | 140 | $this->raiseEvent('OnCreate', $this, $params); |
| 141 | 141 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * Raises the OnDrag event |
| 145 | 145 | * @param object $params event parameters |
| 146 | 146 | */ |
| 147 | - public function onDrag ($params) |
|
| 147 | + public function onDrag($params) |
|
| 148 | 148 | { |
| 149 | 149 | $this->raiseEvent('OnDrag', $this, $params); |
| 150 | 150 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * Raises the OnStart event |
| 154 | 154 | * @param object $params event parameters |
| 155 | 155 | */ |
| 156 | - public function onStart ($params) |
|
| 156 | + public function onStart($params) |
|
| 157 | 157 | { |
| 158 | 158 | $this->raiseEvent('OnStart', $this, $params); |
| 159 | 159 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | * Raises the OnStop event |
| 163 | 163 | * @param object $params event parameters |
| 164 | 164 | */ |
| 165 | - public function onStop ($params) |
|
| 165 | + public function onStop($params) |
|
| 166 | 166 | { |
| 167 | 167 | $this->raiseEvent('OnStop', $this, $params); |
| 168 | 168 | } |
@@ -1,12 +1,12 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * TActiveDataList class file |
|
| 4 | - * |
|
| 5 | - * @author Marcos Aurelio Nobre <[email protected]> |
|
| 6 | - * @copyright Copyright © 2008, PradoSoft |
|
| 7 | - * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
| 8 | - * @package System.Web.UI.ActiveControls |
|
| 9 | - */ |
|
| 3 | + * TActiveDataList class file |
|
| 4 | + * |
|
| 5 | + * @author Marcos Aurelio Nobre <[email protected]> |
|
| 6 | + * @copyright Copyright © 2008, PradoSoft |
|
| 7 | + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
| 8 | + * @package System.Web.UI.ActiveControls |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * TActiveDataList class |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function __construct() |
| 33 | 33 | { |
| 34 | - parent::__construct(); |
|
| 35 | - $this->setAdapter(new TActiveControlAdapter($this)); |
|
| 34 | + parent::__construct(); |
|
| 35 | + $this->setAdapter(new TActiveControlAdapter($this)); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function getActiveControl() |
| 42 | 42 | { |
| 43 | - return $this->getAdapter()->getBaseActiveControl(); |
|
| 43 | + return $this->getAdapter()->getBaseActiveControl(); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function setDataSource($value) |
| 54 | 54 | { |
| 55 | - parent::setDataSource($value); |
|
| 56 | - if($this->getActiveControl()->canUpdateClientSide()) { |
|
| 57 | - $this->renderPager(); |
|
| 58 | - $this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter()); |
|
| 59 | - } |
|
| 55 | + parent::setDataSource($value); |
|
| 56 | + if($this->getActiveControl()->canUpdateClientSide()) { |
|
| 57 | + $this->renderPager(); |
|
| 58 | + $this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter()); |
|
| 59 | + } |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | protected function getContainerID() |
| 67 | 67 | { |
| 68 | - return $this->ClientID.'_Container'; |
|
| 68 | + return $this->ClientID.'_Container'; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -76,13 +76,13 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function render($writer) |
| 78 | 78 | { |
| 79 | - if($this->getHasPreRendered()) { |
|
| 80 | - $this->renderDataList($writer); |
|
| 81 | - if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getContainerID(),$writer); |
|
| 82 | - } |
|
| 83 | - else { |
|
| 84 | - $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
|
| 85 | - } |
|
| 79 | + if($this->getHasPreRendered()) { |
|
| 80 | + $this->renderDataList($writer); |
|
| 81 | + if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getContainerID(),$writer); |
|
| 82 | + } |
|
| 83 | + else { |
|
| 84 | + $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
|
| 85 | + } |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -92,14 +92,14 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | private function renderPager() |
| 94 | 94 | { |
| 95 | - $pager=$this->getPage()->findControlsByType('TActivePager', false); |
|
| 96 | - foreach($pager as $item) |
|
| 97 | - { |
|
| 98 | - if($item->ControlToPaginate==$this->ID) { |
|
| 99 | - $writer=$this->getResponse()->createHtmlWriter(); |
|
| 100 | - $this->getPage()->getAdapter()->registerControlToRender($item,$writer); |
|
| 101 | - } |
|
| 102 | - } |
|
| 95 | + $pager=$this->getPage()->findControlsByType('TActivePager', false); |
|
| 96 | + foreach($pager as $item) |
|
| 97 | + { |
|
| 98 | + if($item->ControlToPaginate==$this->ID) { |
|
| 99 | + $writer=$this->getResponse()->createHtmlWriter(); |
|
| 100 | + $this->getPage()->getAdapter()->registerControlToRender($item,$writer); |
|
| 101 | + } |
|
| 102 | + } |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -109,8 +109,8 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | private function renderDataList($writer) |
| 111 | 111 | { |
| 112 | - $writer->write('<span id="'.$this->getContainerID().'">'); |
|
| 113 | - parent::render($writer); |
|
| 114 | - $writer->write('</span>'); |
|
| 112 | + $writer->write('<span id="'.$this->getContainerID().'">'); |
|
| 113 | + parent::render($writer); |
|
| 114 | + $writer->write('</span>'); |
|
| 115 | 115 | } |
| 116 | 116 | } |
@@ -79,8 +79,7 @@ |
||
| 79 | 79 | if($this->getHasPreRendered()) { |
| 80 | 80 | $this->renderDataList($writer); |
| 81 | 81 | if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getContainerID(),$writer); |
| 82 | - } |
|
| 83 | - else { |
|
| 82 | + } else { |
|
| 84 | 83 | $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
| 85 | 84 | } |
| 86 | 85 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | parent::setDataSource($value); |
| 56 | 56 | if($this->getActiveControl()->canUpdateClientSide()) { |
| 57 | 57 | $this->renderPager(); |
| 58 | - $this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter()); |
|
| 58 | + $this->getPage()->getAdapter()->registerControlToRender($this, $this->getResponse()->createHtmlWriter()); |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | { |
| 79 | 79 | if($this->getHasPreRendered()) { |
| 80 | 80 | $this->renderDataList($writer); |
| 81 | - if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getContainerID(),$writer); |
|
| 81 | + if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getContainerID(), $writer); |
|
| 82 | 82 | } |
| 83 | 83 | else { |
| 84 | - $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
|
| 84 | + $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | { |
| 98 | 98 | if($item->ControlToPaginate==$this->ID) { |
| 99 | 99 | $writer=$this->getResponse()->createHtmlWriter(); |
| 100 | - $this->getPage()->getAdapter()->registerControlToRender($item,$writer); |
|
| 100 | + $this->getPage()->getAdapter()->registerControlToRender($item, $writer); |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | class TActiveMultiView extends TMultiView implements IActiveControl |
| 31 | 31 | { |
| 32 | 32 | /** |
| 33 | - * Creates a new callback control, sets the adapter to |
|
| 34 | - * TActiveControlAdapter. |
|
| 35 | - */ |
|
| 33 | + * Creates a new callback control, sets the adapter to |
|
| 34 | + * TActiveControlAdapter. |
|
| 35 | + */ |
|
| 36 | 36 | public function __construct() |
| 37 | 37 | { |
| 38 | 38 | parent::__construct(); |
@@ -40,28 +40,28 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | - * @return TBaseActiveControl standard active control options. |
|
| 44 | - */ |
|
| 43 | + * @return TBaseActiveControl standard active control options. |
|
| 44 | + */ |
|
| 45 | 45 | public function getActiveControl() |
| 46 | 46 | { |
| 47 | 47 | return $this->getAdapter()->getBaseActiveControl(); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | - * Returns the id of the surrounding container (span). |
|
| 52 | - * @return string container id |
|
| 53 | - */ |
|
| 51 | + * Returns the id of the surrounding container (span). |
|
| 52 | + * @return string container id |
|
| 53 | + */ |
|
| 54 | 54 | protected function getContainerID() |
| 55 | 55 | { |
| 56 | 56 | return $this->ClientID.'_Container'; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | - * Renders the TActiveMultiView. |
|
| 61 | - * If the MutliView did not pass the prerender phase yet, it will register itself for rendering later. |
|
| 62 | - * Else it will call the {@link renderMultiView()} method which will do the rendering of the MultiView. |
|
| 63 | - * @param THtmlWriter writer for the rendering purpose |
|
| 64 | - */ |
|
| 60 | + * Renders the TActiveMultiView. |
|
| 61 | + * If the MutliView did not pass the prerender phase yet, it will register itself for rendering later. |
|
| 62 | + * Else it will call the {@link renderMultiView()} method which will do the rendering of the MultiView. |
|
| 63 | + * @param THtmlWriter writer for the rendering purpose |
|
| 64 | + */ |
|
| 65 | 65 | public function render($writer) |
| 66 | 66 | { |
| 67 | 67 | if($this->getHasPreRendered()) { |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | - * Renders the TActiveMultiView by writing a span tag with the container id obtained from {@link getContainerID()} |
|
| 78 | - * which will be called by the replacement method of the client script to update it's content. |
|
| 79 | - * @param $writer THtmlWriter writer for the rendering purpose |
|
| 80 | - */ |
|
| 77 | + * Renders the TActiveMultiView by writing a span tag with the container id obtained from {@link getContainerID()} |
|
| 78 | + * which will be called by the replacement method of the client script to update it's content. |
|
| 79 | + * @param $writer THtmlWriter writer for the rendering purpose |
|
| 80 | + */ |
|
| 81 | 81 | protected function renderMultiView($writer) |
| 82 | 82 | { |
| 83 | 83 | $writer->addAttribute('id', $this->getContainerID()); |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | - * @param integer the zero-based index of the current view in the view collection. -1 if no active view. |
|
| 91 | - * @throws TInvalidDataValueException if the view index is invalid |
|
| 92 | - */ |
|
| 90 | + * @param integer the zero-based index of the current view in the view collection. -1 if no active view. |
|
| 91 | + * @throws TInvalidDataValueException if the view index is invalid |
|
| 92 | + */ |
|
| 93 | 93 | public function setActiveViewIndex($value) |
| 94 | 94 | { |
| 95 | 95 | $old=parent::getActiveViewIndex(); |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | - * @param TView the view to be activated |
|
| 103 | - * @throws TInvalidOperationException if the view is not in the view collection |
|
| 104 | - */ |
|
| 102 | + * @param TView the view to be activated |
|
| 103 | + * @throws TInvalidOperationException if the view is not in the view collection |
|
| 104 | + */ |
|
| 105 | 105 | public function setActiveView($value) |
| 106 | 106 | { |
| 107 | 107 | $old=parent::getActiveView(); |
@@ -58,8 +58,7 @@ |
||
| 58 | 58 | if ($this->sourcepath === NULL) |
| 59 | 59 | { |
| 60 | 60 | $this->sourcepath = $sourcepath; |
| 61 | - } |
|
| 62 | - else |
|
| 61 | + } else |
|
| 63 | 62 | { |
| 64 | 63 | $this->sourcepath->append($sourcepath); |
| 65 | 64 | } |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | if($this->getHasPreRendered()) { |
| 68 | 68 | $this->renderMultiView($writer); |
| 69 | 69 | if($this->getActiveControl()->canUpdateClientSide()) |
| 70 | - $this->getPage()->getCallbackClient()->replaceContent($this->getContainerID(),$writer); |
|
| 70 | + $this->getPage()->getCallbackClient()->replaceContent($this->getContainerID(), $writer); |
|
| 71 | 71 | } |
| 72 | 72 | else |
| 73 | - $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
|
| 73 | + $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -92,12 +92,12 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function setActiveViewIndex($value) |
| 94 | 94 | { |
| 95 | - if(parent::getActiveViewIndex() === $value) |
|
| 95 | + if(parent::getActiveViewIndex()===$value) |
|
| 96 | 96 | return; |
| 97 | 97 | |
| 98 | 98 | parent::setActiveViewIndex($value); |
| 99 | 99 | if($this->getActiveControl()->canUpdateClientSide()) |
| 100 | - $this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter()); |
|
| 100 | + $this->getPage()->getAdapter()->registerControlToRender($this, $this->getResponse()->createHtmlWriter()); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function setActiveView($value) |
| 108 | 108 | { |
| 109 | - if(parent::getActiveView() === $value) |
|
| 109 | + if(parent::getActiveView()===$value) |
|
| 110 | 110 | return; |
| 111 | 111 | |
| 112 | 112 | parent::setActiveView($value); |
| 113 | 113 | if($this->getActiveControl()->canUpdateClientSide()) |
| 114 | - $this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter()); |
|
| 114 | + $this->getPage()->getAdapter()->registerControlToRender($this, $this->getResponse()->createHtmlWriter()); |
|
| 115 | 115 | } |
| 116 | 116 | } |
@@ -32,8 +32,8 @@ |
||
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * @return boolean a value indicating whether an automatic postback to the server |
| 35 | - * will occur whenever the user modifies the text in the TActiveDatePicker control and |
|
| 36 | - * then tabs out of the component. Defaults to true. |
|
| 35 | + * will occur whenever the user modifies the text in the TActiveDatePicker control and |
|
| 36 | + * then tabs out of the component. Defaults to true. |
|
| 37 | 37 | */ |
| 38 | 38 | public function getAutoPostBack() |
| 39 | 39 | { |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function getAutoPostBack() |
| 39 | 39 | { |
| 40 | - return $this->getViewState('AutoPostBack',true); |
|
| 40 | + return $this->getViewState('AutoPostBack', true); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function setAutoPostBack($value) |
| 50 | 50 | { |
| 51 | - $this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),true); |
|
| 51 | + $this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), true); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | protected function getDatePickerOptions() |
| 59 | 59 | { |
| 60 | - $options = parent::getDatePickerOptions(); |
|
| 60 | + $options=parent::getDatePickerOptions(); |
|
| 61 | 61 | $options['CausesValidation']=$this->getCausesValidation(); |
| 62 | 62 | $options['ValidationGroup']=$this->getValidationGroup(); |
| 63 | - $options['EventTarget'] = $this->getUniqueID(); |
|
| 64 | - $options['ShowCalendar'] = $this->getShowCalendar(); |
|
| 65 | - $options['AutoPostBack'] = $this->getAutoPostBack(); |
|
| 63 | + $options['EventTarget']=$this->getUniqueID(); |
|
| 64 | + $options['ShowCalendar']=$this->getShowCalendar(); |
|
| 65 | + $options['AutoPostBack']=$this->getAutoPostBack(); |
|
| 66 | 66 | return $options; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | /** |
| 81 | 81 | * @return TBaseActiveCallbackControl standard callback control options. |
| 82 | 82 | */ |
| 83 | - public function getActiveControl(){ |
|
| 83 | + public function getActiveControl() { |
|
| 84 | 84 | return $this->getAdapter()->getBaseActiveControl(); |
| 85 | 85 | } |
| 86 | 86 | |
@@ -88,21 +88,21 @@ discard block |
||
| 88 | 88 | * Client-side Text property can only be updated after the OnLoad stage. |
| 89 | 89 | * @param string text content for the textbox |
| 90 | 90 | */ |
| 91 | - public function setText($value){ |
|
| 92 | - if(parent::getText() === $value) |
|
| 91 | + public function setText($value) { |
|
| 92 | + if(parent::getText()===$value) |
|
| 93 | 93 | return; |
| 94 | 94 | |
| 95 | 95 | parent::setText($value); |
| 96 | - if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()){ |
|
| 96 | + if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()) { |
|
| 97 | 97 | $cb=$this->getPage()->getCallbackClient(); |
| 98 | 98 | $cb->setValue($this, $value); |
| 99 | - if ($this->getInputMode()==TDatePickerInputMode::DropDownList) |
|
| 99 | + if($this->getInputMode()==TDatePickerInputMode::DropDownList) |
|
| 100 | 100 | { |
| 101 | - $s = Prado::createComponent('System.Util.TDateTimeStamp'); |
|
| 102 | - $date = $s->getDate($this->getTimeStampFromText()); |
|
| 101 | + $s=Prado::createComponent('System.Util.TDateTimeStamp'); |
|
| 102 | + $date=$s->getDate($this->getTimeStampFromText()); |
|
| 103 | 103 | $id=$this->getClientID(); |
| 104 | 104 | $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'day', 'Value', $date['mday'], 'select'); |
| 105 | - $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'month', 'Value', $date['mon']-1, 'select'); |
|
| 105 | + $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'month', 'Value', $date['mon'] - 1, 'select'); |
|
| 106 | 106 | $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'year', 'Value', $date['year'], 'select'); |
| 107 | 107 | |
| 108 | 108 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * This method is mainly used by framework and control developers. |
| 116 | 116 | * @param TCallbackEventParameter the event parameter |
| 117 | 117 | */ |
| 118 | - public function raiseCallbackEvent($param){ |
|
| 118 | + public function raiseCallbackEvent($param) { |
|
| 119 | 119 | $this->onCallback($param); |
| 120 | 120 | } |
| 121 | 121 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * handler can be invoked. |
| 127 | 127 | * @param TCallbackEventParameter event parameter to be passed to the event handlers |
| 128 | 128 | */ |
| 129 | - public function onCallback($param){ |
|
| 129 | + public function onCallback($param) { |
|
| 130 | 130 | $this->raiseEvent('OnCallback', $this, $param); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -136,22 +136,22 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | protected function registerCalendarClientScriptPre() |
| 138 | 138 | { |
| 139 | - $cs = $this->getPage()->getClientScript(); |
|
| 139 | + $cs=$this->getPage()->getClientScript(); |
|
| 140 | 140 | $cs->registerPradoScript("activedatepicker"); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | protected function renderClientControlScript($writer) |
| 144 | 144 | { |
| 145 | - $cs = $this->getPage()->getClientScript(); |
|
| 145 | + $cs=$this->getPage()->getClientScript(); |
|
| 146 | 146 | if(!$cs->isEndScriptRegistered('TDatePicker.spacer')) |
| 147 | 147 | { |
| 148 | - $spacer = $this->getAssetUrl('spacer.gif'); |
|
| 149 | - $code = "Prado.WebUI.TDatePicker.spacer = '$spacer';"; |
|
| 148 | + $spacer=$this->getAssetUrl('spacer.gif'); |
|
| 149 | + $code="Prado.WebUI.TDatePicker.spacer = '$spacer';"; |
|
| 150 | 150 | $cs->registerEndScript('TDatePicker.spacer', $code); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - $options = TJavaScript::encode($this->getDatePickerOptions()); |
|
| 154 | - $code = "new Prado.WebUI.TActiveDatePicker($options);"; |
|
| 153 | + $options=TJavaScript::encode($this->getDatePickerOptions()); |
|
| 154 | + $code="new Prado.WebUI.TActiveDatePicker($options);"; |
|
| 155 | 155 | $cs->registerEndScript("prado:".$this->getClientID(), $code); |
| 156 | 156 | } |
| 157 | 157 | |
@@ -60,8 +60,8 @@ |
||
| 60 | 60 | * @param THtmlWriter the writer used for the rendering purpose |
| 61 | 61 | */ |
| 62 | 62 | protected function addAttributesToRender($writer) { |
| 63 | - $writer->addAttribute('id',$this->getClientID()); |
|
| 64 | - parent::addAttributesToRender($writer); |
|
| 63 | + $writer->addAttribute('id',$this->getClientID()); |
|
| 64 | + parent::addAttributesToRender($writer); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -58,8 +58,7 @@ |
||
| 58 | 58 | if ($this->sourcepath === NULL) |
| 59 | 59 | { |
| 60 | 60 | $this->sourcepath = $sourcepath; |
| 61 | - } |
|
| 62 | - else |
|
| 61 | + } else |
|
| 63 | 62 | { |
| 64 | 63 | $this->sourcepath->append($sourcepath); |
| 65 | 64 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @param THtmlWriter the writer used for the rendering purpose |
| 61 | 61 | */ |
| 62 | 62 | protected function addAttributesToRender($writer) { |
| 63 | - $writer->addAttribute('id',$this->getClientID()); |
|
| 63 | + $writer->addAttribute('id', $this->getClientID()); |
|
| 64 | 64 | parent::addAttributesToRender($writer); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -77,17 +77,17 @@ discard block |
||
| 77 | 77 | { |
| 78 | 78 | parent::render($writer); |
| 79 | 79 | if($this->getActiveControl()->canUpdateClientSide()) |
| 80 | - $this->getPage()->getCallbackClient()->replaceContent($this,$writer); |
|
| 80 | + $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
|
| 81 | 81 | } |
| 82 | 82 | else |
| 83 | 83 | { |
| 84 | - $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
|
| 85 | - if ($this->getHasControls()) |
|
| 84 | + $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
|
| 85 | + if($this->getHasControls()) |
|
| 86 | 86 | { |
| 87 | 87 | // If we update a TActivePanel on callback, |
| 88 | 88 | // We shouldn't update all childs, because the whole content will be replaced by |
| 89 | 89 | // the parent |
| 90 | - foreach ($this->findControlsByType('IActiveControl', false) as $control) |
|
| 90 | + foreach($this->findControlsByType('IActiveControl', false) as $control) |
|
| 91 | 91 | { |
| 92 | 92 | $control->getActiveControl()->setEnableUpdate(false); |
| 93 | 93 | } |
@@ -116,7 +116,7 @@ |
||
| 116 | 116 | && $this->getPage()->getClientSupportsJavaScript()) |
| 117 | 117 | { |
| 118 | 118 | $this->getActiveControl()->registerCallbackClientScript( |
| 119 | - $this->getClientClassName(), $this->getPostBackOptions()); |
|
| 119 | + $this->getClientClassName(), $this->getPostBackOptions()); |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * updated later. |
| 69 | 69 | *@return boolean always true |
| 70 | 70 | */ |
| 71 | - protected function getSpanNeeded () |
|
| 71 | + protected function getSpanNeeded() |
|
| 72 | 72 | { |
| 73 | 73 | return true; |
| 74 | 74 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | protected function createRepeatedControl() |
| 89 | 89 | { |
| 90 | - $control = new TActiveCheckBoxListItem; |
|
| 90 | + $control=new TActiveCheckBoxListItem; |
|
| 91 | 91 | $control->getAdapter()->setBaseActiveControl($this->getActiveControl()); |
| 92 | 92 | return $control; |
| 93 | 93 | } |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | * @param string checkbox id |
| 152 | 152 | * @param string onclick js |
| 153 | 153 | */ |
| 154 | - protected function renderInputTag($writer,$clientID,$onclick) |
|
| 154 | + protected function renderInputTag($writer, $clientID, $onclick) |
|
| 155 | 155 | { |
| 156 | - TCheckBox::renderInputTag($writer,$clientID,$onclick); |
|
| 156 | + TCheckBox::renderInputTag($writer, $clientID, $onclick); |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | * It reads the CacheModule property. |
| 51 | 51 | * @param TXmlElement module configuration |
| 52 | 52 | */ |
| 53 | - public function init($config) |
|
| 54 | - { |
|
| 53 | + public function init($config) |
|
| 54 | + { |
|
| 55 | 55 | if($this->_cacheModuleID==='') |
| 56 | 56 | throw new TConfigurationException('cachesession_cachemoduleid_required'); |
| 57 | 57 | else if(($cache=$this->getApplication()->getModule($this->_cacheModuleID))===null) |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | throw new TConfigurationException('cachesession_cachemodule_invalid',$this->_cacheModuleID); |
| 63 | 63 | $this->setUseCustomStorage(true); |
| 64 | 64 | parent::init($config); |
| 65 | - } |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * @return string the ID of the cache module. |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function _read($id) |
| 97 | 97 | { |
| 98 | - return $this->_cache->get($this->calculateKey($id)); |
|
| 98 | + return $this->_cache->get($this->calculateKey($id)); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function _destroy($id) |
| 119 | 119 | { |
| 120 | - return $this->_cache->delete($this->calculateKey($id)); |
|
| 120 | + return $this->_cache->delete($this->calculateKey($id)); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
@@ -125,15 +125,15 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function getKeyPrefix() |
| 127 | 127 | { |
| 128 | - return $this->_prefix; |
|
| 128 | + return $this->_prefix; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | - * @param string prefix of session variable name to avoid conflict with other cache data |
|
| 133 | - */ |
|
| 132 | + * @param string prefix of session variable name to avoid conflict with other cache data |
|
| 133 | + */ |
|
| 134 | 134 | public function setKeyPrefix($value) |
| 135 | 135 | { |
| 136 | - $this->_prefix=$value; |
|
| 136 | + $this->_prefix=$value; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | protected function calculateKey($id) |
| 144 | 144 | { |
| 145 | - return $this->_prefix.':'.$id; |
|
| 145 | + return $this->_prefix.':'.$id; |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | if($this->_cacheModuleID==='') |
| 56 | 56 | throw new TConfigurationException('cachesession_cachemoduleid_required'); |
| 57 | 57 | else if(($cache=$this->getApplication()->getModule($this->_cacheModuleID))===null) |
| 58 | - throw new TConfigurationException('cachesession_cachemodule_inexistent',$this->_cacheModuleID); |
|
| 58 | + throw new TConfigurationException('cachesession_cachemodule_inexistent', $this->_cacheModuleID); |
|
| 59 | 59 | else if($cache instanceof ICache) |
| 60 | 60 | $this->_cache=$cache; |
| 61 | 61 | else |
| 62 | - throw new TConfigurationException('cachesession_cachemodule_invalid',$this->_cacheModuleID); |
|
| 62 | + throw new TConfigurationException('cachesession_cachemodule_invalid', $this->_cacheModuleID); |
|
| 63 | 63 | $this->setUseCustomStorage(true); |
| 64 | 64 | parent::init($config); |
| 65 | 65 | } |
@@ -104,9 +104,9 @@ discard block |
||
| 104 | 104 | * @param string session data |
| 105 | 105 | * @return boolean whether session write is successful |
| 106 | 106 | */ |
| 107 | - public function _write($id,$data) |
|
| 107 | + public function _write($id, $data) |
|
| 108 | 108 | { |
| 109 | - return $this->_cache->set($this->calculateKey($id),$data,$this->getTimeout()); |
|
| 109 | + return $this->_cache->set($this->calculateKey($id), $data, $this->getTimeout()); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -1026,28 +1026,28 @@ |
||
| 1026 | 1026 | return isset(self::$_relations[get_class($this)][strtolower($property)]); |
| 1027 | 1027 | } |
| 1028 | 1028 | |
| 1029 | - /** |
|
| 1030 | - * Return record data as array |
|
| 1031 | - * @return array of column name and column values |
|
| 1032 | - * @since 3.2.4 |
|
| 1033 | - */ |
|
| 1034 | - public function toArray(){ |
|
| 1035 | - $result=array(); |
|
| 1036 | - foreach($this->getRecordTableInfo()->getLowerCaseColumnNames() as $columnName){ |
|
| 1037 | - $result[$columnName]=$this->getColumnValue($columnName); |
|
| 1038 | - } |
|
| 1029 | + /** |
|
| 1030 | + * Return record data as array |
|
| 1031 | + * @return array of column name and column values |
|
| 1032 | + * @since 3.2.4 |
|
| 1033 | + */ |
|
| 1034 | + public function toArray(){ |
|
| 1035 | + $result=array(); |
|
| 1036 | + foreach($this->getRecordTableInfo()->getLowerCaseColumnNames() as $columnName){ |
|
| 1037 | + $result[$columnName]=$this->getColumnValue($columnName); |
|
| 1038 | + } |
|
| 1039 | 1039 | |
| 1040 | - return $result; |
|
| 1041 | - } |
|
| 1040 | + return $result; |
|
| 1041 | + } |
|
| 1042 | 1042 | |
| 1043 | - /** |
|
| 1044 | - * Return record data as JSON |
|
| 1045 | - * @return JSON |
|
| 1046 | - * @since 3.2.4 |
|
| 1047 | - */ |
|
| 1048 | - public function toJSON(){ |
|
| 1049 | - return json_encode($this->toArray()); |
|
| 1050 | - } |
|
| 1043 | + /** |
|
| 1044 | + * Return record data as JSON |
|
| 1045 | + * @return JSON |
|
| 1046 | + * @since 3.2.4 |
|
| 1047 | + */ |
|
| 1048 | + public function toJSON(){ |
|
| 1049 | + return json_encode($this->toArray()); |
|
| 1050 | + } |
|
| 1051 | 1051 | } |
| 1052 | 1052 | |
| 1053 | 1053 | /** |
@@ -505,6 +505,7 @@ discard block |
||
| 505 | 505 | * Delete multiple records using a criteria. |
| 506 | 506 | * @param string|TActiveRecordCriteria SQL condition or criteria object. |
| 507 | 507 | * @param mixed parameter values. |
| 508 | + * @param TActiveRecordCriteria $criteria |
|
| 508 | 509 | * @return int number of records deleted. |
| 509 | 510 | */ |
| 510 | 511 | public function deleteAll($criteria=null, $parameters=array()) |
@@ -571,6 +572,7 @@ discard block |
||
| 571 | 572 | * |
| 572 | 573 | * @param string|TActiveRecordCriteria SQL condition or criteria object. |
| 573 | 574 | * @param mixed parameter values. |
| 575 | + * @param TActiveRecordCriteria $criteria |
|
| 574 | 576 | * @return TActiveRecord matching record object. Null if no result is found. |
| 575 | 577 | */ |
| 576 | 578 | public function find($criteria,$parameters=array()) |
@@ -587,6 +589,7 @@ discard block |
||
| 587 | 589 | * |
| 588 | 590 | * @param string|TActiveRecordCriteria SQL condition or criteria object. |
| 589 | 591 | * @param mixed parameter values. |
| 592 | + * @param TActiveRecordCriteria $criteria |
|
| 590 | 593 | * @return array matching record objects. Empty array if no result is found. |
| 591 | 594 | */ |
| 592 | 595 | public function findAll($criteria=null,$parameters=array()) |
@@ -700,6 +703,7 @@ discard block |
||
| 700 | 703 | * Find the number of records. |
| 701 | 704 | * @param string|TActiveRecordCriteria SQL condition or criteria object. |
| 702 | 705 | * @param mixed parameter values. |
| 706 | + * @param TActiveRecordCriteria $criteria |
|
| 703 | 707 | * @return int number of records. |
| 704 | 708 | */ |
| 705 | 709 | public function count($criteria=null,$parameters=array()) |
@@ -715,6 +719,7 @@ discard block |
||
| 715 | 719 | * value equal to the $property value. |
| 716 | 720 | * @param string relationship/property name corresponding to keys in $RELATION array. |
| 717 | 721 | * @param array method call arguments. |
| 722 | + * @param string $name |
|
| 718 | 723 | * @return TActiveRecordRelation, null if the context or the handler doesn't exist |
| 719 | 724 | */ |
| 720 | 725 | protected function getRelationHandler($name,$args=array()) |
@@ -939,6 +944,7 @@ discard block |
||
| 939 | 944 | * Raised before the record attempt to insert its data into the database. |
| 940 | 945 | * To prevent the insert operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false. |
| 941 | 946 | * @param TActiveRecordChangeEventParameter event parameter to be passed to the event handlers |
| 947 | + * @param TActiveRecordChangeEventParameter $param |
|
| 942 | 948 | */ |
| 943 | 949 | public function onInsert($param) |
| 944 | 950 | { |
@@ -949,6 +955,7 @@ discard block |
||
| 949 | 955 | * Raised before the record attempt to delete its data from the database. |
| 950 | 956 | * To prevent the delete operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false. |
| 951 | 957 | * @param TActiveRecordChangeEventParameter event parameter to be passed to the event handlers |
| 958 | + * @param TActiveRecordChangeEventParameter $param |
|
| 952 | 959 | */ |
| 953 | 960 | public function onDelete($param) |
| 954 | 961 | { |
@@ -959,6 +966,7 @@ discard block |
||
| 959 | 966 | * Raised before the record attempt to update its data in the database. |
| 960 | 967 | * To prevent the update operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false. |
| 961 | 968 | * @param TActiveRecordChangeEventParameter event parameter to be passed to the event handlers |
| 969 | + * @param TActiveRecordChangeEventParameter $param |
|
| 962 | 970 | */ |
| 963 | 971 | public function onUpdate($param) |
| 964 | 972 | { |
@@ -1042,7 +1050,7 @@ discard block |
||
| 1042 | 1050 | |
| 1043 | 1051 | /** |
| 1044 | 1052 | * Return record data as JSON |
| 1045 | - * @return JSON |
|
| 1053 | + * @return string |
|
| 1046 | 1054 | * @since 3.2.4 |
| 1047 | 1055 | */ |
| 1048 | 1056 | public function toJSON(){ |
@@ -194,14 +194,14 @@ discard block |
||
| 194 | 194 | * @var TActiveRecordInvalidFinderResult |
| 195 | 195 | * @since 3.1.5 |
| 196 | 196 | */ |
| 197 | - protected $_invalidFinderResult = null; // use protected so that serialization is fine |
|
| 197 | + protected $_invalidFinderResult=null; // use protected so that serialization is fine |
|
| 198 | 198 | |
| 199 | 199 | /** |
| 200 | 200 | * Prevent __call() method creating __sleep() when serializing. |
| 201 | 201 | */ |
| 202 | 202 | public function __sleep() |
| 203 | 203 | { |
| 204 | - return array_diff(parent::__sleep(),array("\0*\0_connection")); |
|
| 204 | + return array_diff(parent::__sleep(), array("\0*\0_connection")); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -256,12 +256,12 @@ discard block |
||
| 256 | 256 | * @param mixed property value. |
| 257 | 257 | * @since 3.1.2 |
| 258 | 258 | */ |
| 259 | - public function __set($name,$value) |
|
| 259 | + public function __set($name, $value) |
|
| 260 | 260 | { |
| 261 | 261 | if($this->hasRecordRelation($name) && !$this->canSetProperty($name)) |
| 262 | 262 | $this->$name=$value; |
| 263 | 263 | else |
| 264 | - parent::__set($name,$value); |
|
| 264 | + parent::__set($name, $value); |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | $class=new ReflectionClass($className); |
| 289 | 289 | $relations=array(); |
| 290 | 290 | foreach($class->getStaticPropertyValue('RELATIONS') as $key=>$value) |
| 291 | - $relations[strtolower($key)]=array($key,$value); |
|
| 291 | + $relations[strtolower($key)]=array($key, $value); |
|
| 292 | 292 | self::$_relations[$className]=$relations; |
| 293 | 293 | } |
| 294 | 294 | } |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | if(!is_array($data)) |
| 305 | 305 | throw new TActiveRecordException('ar_data_invalid', get_class($this)); |
| 306 | 306 | foreach($data as $name=>$value) |
| 307 | - $this->setColumnValue($name,$value); |
|
| 307 | + $this->setColumnValue($name, $value); |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | |
@@ -355,16 +355,16 @@ discard block |
||
| 355 | 355 | { |
| 356 | 356 | if($record===null || get_class($this)!==get_class($record)) |
| 357 | 357 | return false; |
| 358 | - $tableInfo = $this->getRecordTableInfo(); |
|
| 359 | - $pks = $tableInfo->getPrimaryKeys(); |
|
| 360 | - $properties = count($pks) > 0 ? $pks : $tableInfo->getColumns()->getKeys(); |
|
| 358 | + $tableInfo=$this->getRecordTableInfo(); |
|
| 359 | + $pks=$tableInfo->getPrimaryKeys(); |
|
| 360 | + $properties=count($pks) > 0 ? $pks : $tableInfo->getColumns()->getKeys(); |
|
| 361 | 361 | $equals=true; |
| 362 | 362 | foreach($properties as $prop) |
| 363 | 363 | { |
| 364 | 364 | if($strict) |
| 365 | - $equals = $equals && $this->getColumnValue($prop) === $record->getColumnValue($prop); |
|
| 365 | + $equals=$equals && $this->getColumnValue($prop)===$record->getColumnValue($prop); |
|
| 366 | 366 | else |
| 367 | - $equals = $equals && $this->getColumnValue($prop) == $record->getColumnValue($prop); |
|
| 367 | + $equals=$equals && $this->getColumnValue($prop)==$record->getColumnValue($prop); |
|
| 368 | 368 | if(!$equals) |
| 369 | 369 | return false; |
| 370 | 370 | } |
@@ -382,10 +382,10 @@ discard block |
||
| 382 | 382 | */ |
| 383 | 383 | public static function finder($className=__CLASS__) |
| 384 | 384 | { |
| 385 | - static $finders = array(); |
|
| 385 | + static $finders=array(); |
|
| 386 | 386 | if(!isset($finders[$className])) |
| 387 | 387 | { |
| 388 | - $f = Prado::createComponent($className); |
|
| 388 | + $f=Prado::createComponent($className); |
|
| 389 | 389 | $finders[$className]=$f; |
| 390 | 390 | } |
| 391 | 391 | return $finders[$className]; |
@@ -415,14 +415,14 @@ discard block |
||
| 415 | 415 | */ |
| 416 | 416 | public function save() |
| 417 | 417 | { |
| 418 | - $gateway = $this->getRecordGateway(); |
|
| 419 | - $param = new TActiveRecordChangeEventParameter(); |
|
| 418 | + $gateway=$this->getRecordGateway(); |
|
| 419 | + $param=new TActiveRecordChangeEventParameter(); |
|
| 420 | 420 | if($this->_recordState===self::STATE_NEW) |
| 421 | 421 | { |
| 422 | 422 | $this->onInsert($param); |
| 423 | 423 | if($param->getIsValid() && $gateway->insert($this)) |
| 424 | 424 | { |
| 425 | - $this->_recordState = self::STATE_LOADED; |
|
| 425 | + $this->_recordState=self::STATE_LOADED; |
|
| 426 | 426 | return true; |
| 427 | 427 | } |
| 428 | 428 | } |
@@ -447,8 +447,8 @@ discard block |
||
| 447 | 447 | { |
| 448 | 448 | if($this->_recordState===self::STATE_LOADED) |
| 449 | 449 | { |
| 450 | - $gateway = $this->getRecordGateway(); |
|
| 451 | - $param = new TActiveRecordChangeEventParameter(); |
|
| 450 | + $gateway=$this->getRecordGateway(); |
|
| 451 | + $param=new TActiveRecordChangeEventParameter(); |
|
| 452 | 452 | $this->onDelete($param); |
| 453 | 453 | if($param->getIsValid() && $gateway->delete($this)) |
| 454 | 454 | { |
@@ -488,8 +488,8 @@ discard block |
||
| 488 | 488 | public function deleteByPk($keys) |
| 489 | 489 | { |
| 490 | 490 | if(func_num_args() > 1) |
| 491 | - $keys = func_get_args(); |
|
| 492 | - return $this->getRecordGateway()->deleteRecordsByPk($this,(array)$keys); |
|
| 491 | + $keys=func_get_args(); |
|
| 492 | + return $this->getRecordGateway()->deleteRecordsByPk($this, (array) $keys); |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | /** |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | public function deleteAllByPks($keys) |
| 499 | 499 | { |
| 500 | 500 | if(func_num_args() > 1) |
| 501 | - $keys = func_get_args(); |
|
| 501 | + $keys=func_get_args(); |
|
| 502 | 502 | return $this->deleteByPk($keys); |
| 503 | 503 | } |
| 504 | 504 | /** |
@@ -509,8 +509,8 @@ discard block |
||
| 509 | 509 | */ |
| 510 | 510 | public function deleteAll($criteria=null, $parameters=array()) |
| 511 | 511 | { |
| 512 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
| 513 | - $criteria = $this->getRecordCriteria($criteria,$parameters, $args); |
|
| 512 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
| 513 | + $criteria=$this->getRecordCriteria($criteria, $parameters, $args); |
|
| 514 | 514 | return $this->getRecordGateway()->deleteRecordsByCriteria($this, $criteria); |
| 515 | 515 | } |
| 516 | 516 | |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | { |
| 535 | 535 | $result=array(); |
| 536 | 536 | foreach($reader as $data) |
| 537 | - $result[] = $this->populateObject($data); |
|
| 537 | + $result[]=$this->populateObject($data); |
|
| 538 | 538 | return $result; |
| 539 | 539 | } |
| 540 | 540 | |
@@ -573,12 +573,12 @@ discard block |
||
| 573 | 573 | * @param mixed parameter values. |
| 574 | 574 | * @return TActiveRecord matching record object. Null if no result is found. |
| 575 | 575 | */ |
| 576 | - public function find($criteria,$parameters=array()) |
|
| 576 | + public function find($criteria, $parameters=array()) |
|
| 577 | 577 | { |
| 578 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
| 579 | - $criteria = $this->getRecordCriteria($criteria,$parameters, $args); |
|
| 578 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
| 579 | + $criteria=$this->getRecordCriteria($criteria, $parameters, $args); |
|
| 580 | 580 | $criteria->setLimit(1); |
| 581 | - $data = $this->getRecordGateway()->findRecordsByCriteria($this,$criteria); |
|
| 581 | + $data=$this->getRecordGateway()->findRecordsByCriteria($this, $criteria); |
|
| 582 | 582 | return $this->populateObject($data); |
| 583 | 583 | } |
| 584 | 584 | |
@@ -589,12 +589,12 @@ discard block |
||
| 589 | 589 | * @param mixed parameter values. |
| 590 | 590 | * @return array matching record objects. Empty array if no result is found. |
| 591 | 591 | */ |
| 592 | - public function findAll($criteria=null,$parameters=array()) |
|
| 592 | + public function findAll($criteria=null, $parameters=array()) |
|
| 593 | 593 | { |
| 594 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
| 594 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
| 595 | 595 | if($criteria!==null) |
| 596 | - $criteria = $this->getRecordCriteria($criteria,$parameters, $args); |
|
| 597 | - $result = $this->getRecordGateway()->findRecordsByCriteria($this,$criteria,true); |
|
| 596 | + $criteria=$this->getRecordCriteria($criteria, $parameters, $args); |
|
| 597 | + $result=$this->getRecordGateway()->findRecordsByCriteria($this, $criteria, true); |
|
| 598 | 598 | return $this->populateObjects($result); |
| 599 | 599 | } |
| 600 | 600 | |
@@ -612,11 +612,11 @@ discard block |
||
| 612 | 612 | */ |
| 613 | 613 | public function findByPk($keys) |
| 614 | 614 | { |
| 615 | - if($keys === null) |
|
| 615 | + if($keys===null) |
|
| 616 | 616 | return null; |
| 617 | 617 | if(func_num_args() > 1) |
| 618 | - $keys = func_get_args(); |
|
| 619 | - $data = $this->getRecordGateway()->findRecordByPK($this,$keys); |
|
| 618 | + $keys=func_get_args(); |
|
| 619 | + $data=$this->getRecordGateway()->findRecordByPK($this, $keys); |
|
| 620 | 620 | return $this->populateObject($data); |
| 621 | 621 | } |
| 622 | 622 | |
@@ -640,8 +640,8 @@ discard block |
||
| 640 | 640 | public function findAllByPks($keys) |
| 641 | 641 | { |
| 642 | 642 | if(func_num_args() > 1) |
| 643 | - $keys = func_get_args(); |
|
| 644 | - $result = $this->getRecordGateway()->findRecordsByPks($this,(array)$keys); |
|
| 643 | + $keys=func_get_args(); |
|
| 644 | + $result=$this->getRecordGateway()->findRecordsByPks($this, (array) $keys); |
|
| 645 | 645 | return $this->populateObjects($result); |
| 646 | 646 | } |
| 647 | 647 | |
@@ -653,12 +653,12 @@ discard block |
||
| 653 | 653 | * @param array $parameters |
| 654 | 654 | * @return TActiveRecord, null if no result is returned. |
| 655 | 655 | */ |
| 656 | - public function findBySql($sql,$parameters=array()) |
|
| 656 | + public function findBySql($sql, $parameters=array()) |
|
| 657 | 657 | { |
| 658 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
| 659 | - $criteria = $this->getRecordCriteria($sql,$parameters, $args); |
|
| 658 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
| 659 | + $criteria=$this->getRecordCriteria($sql, $parameters, $args); |
|
| 660 | 660 | $criteria->setLimit(1); |
| 661 | - $data = $this->getRecordGateway()->findRecordBySql($this,$criteria); |
|
| 661 | + $data=$this->getRecordGateway()->findRecordBySql($this, $criteria); |
|
| 662 | 662 | return $this->populateObject($data); |
| 663 | 663 | } |
| 664 | 664 | |
@@ -670,11 +670,11 @@ discard block |
||
| 670 | 670 | * @param array $parameters |
| 671 | 671 | * @return array matching active records. Empty array is returned if no result is found. |
| 672 | 672 | */ |
| 673 | - public function findAllBySql($sql,$parameters=array()) |
|
| 673 | + public function findAllBySql($sql, $parameters=array()) |
|
| 674 | 674 | { |
| 675 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
| 676 | - $criteria = $this->getRecordCriteria($sql,$parameters, $args); |
|
| 677 | - $result = $this->getRecordGateway()->findRecordsBySql($this,$criteria); |
|
| 675 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
| 676 | + $criteria=$this->getRecordCriteria($sql, $parameters, $args); |
|
| 677 | + $result=$this->getRecordGateway()->findRecordsBySql($this, $criteria); |
|
| 678 | 678 | return $this->populateObjects($result); |
| 679 | 679 | } |
| 680 | 680 | |
@@ -690,9 +690,9 @@ discard block |
||
| 690 | 690 | * @param array matching field values. |
| 691 | 691 | * @return array matching active records. Empty array is returned if no result is found. |
| 692 | 692 | */ |
| 693 | - public function findAllByIndex($criteria,$fields,$values) |
|
| 693 | + public function findAllByIndex($criteria, $fields, $values) |
|
| 694 | 694 | { |
| 695 | - $result = $this->getRecordGateway()->findRecordsByIndex($this,$criteria,$fields,$values); |
|
| 695 | + $result=$this->getRecordGateway()->findRecordsByIndex($this, $criteria, $fields, $values); |
|
| 696 | 696 | return $this->populateObjects($result); |
| 697 | 697 | } |
| 698 | 698 | |
@@ -702,12 +702,12 @@ discard block |
||
| 702 | 702 | * @param mixed parameter values. |
| 703 | 703 | * @return int number of records. |
| 704 | 704 | */ |
| 705 | - public function count($criteria=null,$parameters=array()) |
|
| 705 | + public function count($criteria=null, $parameters=array()) |
|
| 706 | 706 | { |
| 707 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
| 707 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
| 708 | 708 | if($criteria!==null) |
| 709 | - $criteria = $this->getRecordCriteria($criteria,$parameters, $args); |
|
| 710 | - return $this->getRecordGateway()->countRecords($this,$criteria); |
|
| 709 | + $criteria=$this->getRecordCriteria($criteria, $parameters, $args); |
|
| 710 | + return $this->getRecordGateway()->countRecords($this, $criteria); |
|
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | /** |
@@ -717,11 +717,11 @@ discard block |
||
| 717 | 717 | * @param array method call arguments. |
| 718 | 718 | * @return TActiveRecordRelation, null if the context or the handler doesn't exist |
| 719 | 719 | */ |
| 720 | - protected function getRelationHandler($name,$args=array()) |
|
| 720 | + protected function getRelationHandler($name, $args=array()) |
|
| 721 | 721 | { |
| 722 | - if(($context=$this->createRelationContext($name)) !== null) |
|
| 722 | + if(($context=$this->createRelationContext($name))!==null) |
|
| 723 | 723 | { |
| 724 | - $criteria = $this->getRecordCriteria(count($args)>0 ? $args[0] : null, array_slice($args,1)); |
|
| 724 | + $criteria=$this->getRecordCriteria(count($args) > 0 ? $args[0] : null, array_slice($args, 1)); |
|
| 725 | 725 | return $context->getRelationHandler($criteria); |
| 726 | 726 | } |
| 727 | 727 | else |
@@ -741,8 +741,8 @@ discard block |
||
| 741 | 741 | { |
| 742 | 742 | if(($definition=$this->getRecordRelation($name))!==null) |
| 743 | 743 | { |
| 744 | - list($property, $relation) = $definition; |
|
| 745 | - return new TActiveRecordRelationContext($this,$property,$relation); |
|
| 744 | + list($property, $relation)=$definition; |
|
| 745 | + return new TActiveRecordRelationContext($this, $property, $relation); |
|
| 746 | 746 | } |
| 747 | 747 | else |
| 748 | 748 | return null; |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | */ |
| 786 | 786 | protected function fetchResultsFor($property) |
| 787 | 787 | { |
| 788 | - if( ($context=$this->createRelationContext($property)) !== null) |
|
| 788 | + if(($context=$this->createRelationContext($property))!==null) |
|
| 789 | 789 | return $context->getRelationHandler()->fetchResultsInto($this); |
| 790 | 790 | else |
| 791 | 791 | return false; |
@@ -820,31 +820,31 @@ discard block |
||
| 820 | 820 | * @return mixed single record if method name starts with "findBy", 0 or more records |
| 821 | 821 | * if method name starts with "findAllBy" |
| 822 | 822 | */ |
| 823 | - public function __call($method,$args) |
|
| 823 | + public function __call($method, $args) |
|
| 824 | 824 | { |
| 825 | - $delete =false; |
|
| 826 | - if(strncasecmp($method,'with',4)===0) |
|
| 825 | + $delete=false; |
|
| 826 | + if(strncasecmp($method, 'with', 4)===0) |
|
| 827 | 827 | { |
| 828 | - $property= $method[4]==='_' ? substr($method,5) : substr($method,4); |
|
| 828 | + $property=$method[4]==='_' ? substr($method, 5) : substr($method, 4); |
|
| 829 | 829 | return $this->getRelationHandler($property, $args); |
| 830 | 830 | } |
| 831 | - else if($findOne=strncasecmp($method,'findby',6)===0) |
|
| 832 | - $condition = $method[6]==='_' ? substr($method,7) : substr($method,6); |
|
| 833 | - else if(strncasecmp($method,'findallby',9)===0) |
|
| 834 | - $condition = $method[9]==='_' ? substr($method,10) : substr($method,9); |
|
| 835 | - else if($delete=strncasecmp($method,'deleteby',8)===0) |
|
| 836 | - $condition = $method[8]==='_' ? substr($method,9) : substr($method,8); |
|
| 837 | - else if($delete=strncasecmp($method,'deleteallby',11)===0) |
|
| 838 | - $condition = $method[11]==='_' ? substr($method,12) : substr($method,11); |
|
| 831 | + else if($findOne=strncasecmp($method, 'findby', 6)===0) |
|
| 832 | + $condition=$method[6]==='_' ? substr($method, 7) : substr($method, 6); |
|
| 833 | + else if(strncasecmp($method, 'findallby', 9)===0) |
|
| 834 | + $condition=$method[9]==='_' ? substr($method, 10) : substr($method, 9); |
|
| 835 | + else if($delete=strncasecmp($method, 'deleteby', 8)===0) |
|
| 836 | + $condition=$method[8]==='_' ? substr($method, 9) : substr($method, 8); |
|
| 837 | + else if($delete=strncasecmp($method, 'deleteallby', 11)===0) |
|
| 838 | + $condition=$method[11]==='_' ? substr($method, 12) : substr($method, 11); |
|
| 839 | 839 | else |
| 840 | 840 | { |
| 841 | - if($this->getInvalidFinderResult() == TActiveRecordInvalidFinderResult::Exception) |
|
| 842 | - throw new TActiveRecordException('ar_invalid_finder_method',$method); |
|
| 841 | + if($this->getInvalidFinderResult()==TActiveRecordInvalidFinderResult::Exception) |
|
| 842 | + throw new TActiveRecordException('ar_invalid_finder_method', $method); |
|
| 843 | 843 | else |
| 844 | 844 | return null; |
| 845 | 845 | } |
| 846 | 846 | |
| 847 | - $criteria = $this->getRecordGateway()->getCommand($this)->createCriteriaFromString($method, $condition, $args); |
|
| 847 | + $criteria=$this->getRecordGateway()->getCommand($this)->createCriteriaFromString($method, $condition, $args); |
|
| 848 | 848 | if($delete) |
| 849 | 849 | return $this->deleteAll($criteria); |
| 850 | 850 | else |
@@ -858,7 +858,7 @@ discard block |
||
| 858 | 858 | */ |
| 859 | 859 | public function getInvalidFinderResult() |
| 860 | 860 | { |
| 861 | - if($this->_invalidFinderResult !== null) |
|
| 861 | + if($this->_invalidFinderResult!==null) |
|
| 862 | 862 | return $this->_invalidFinderResult; |
| 863 | 863 | |
| 864 | 864 | return self::getRecordManager()->getInvalidFinderResult(); |
@@ -873,10 +873,10 @@ discard block |
||
| 873 | 873 | */ |
| 874 | 874 | public function setInvalidFinderResult($value) |
| 875 | 875 | { |
| 876 | - if($value === null) |
|
| 877 | - $this->_invalidFinderResult = null; |
|
| 876 | + if($value===null) |
|
| 877 | + $this->_invalidFinderResult=null; |
|
| 878 | 878 | else |
| 879 | - $this->_invalidFinderResult = TPropertyValue::ensureEnum($value, 'TActiveRecordInvalidFinderResult'); |
|
| 879 | + $this->_invalidFinderResult=TPropertyValue::ensureEnum($value, 'TActiveRecordInvalidFinderResult'); |
|
| 880 | 880 | } |
| 881 | 881 | |
| 882 | 882 | /** |
@@ -892,8 +892,8 @@ discard block |
||
| 892 | 892 | { |
| 893 | 893 | if(is_string($criteria)) |
| 894 | 894 | { |
| 895 | - $useArgs = !is_array($parameters) && is_array($args); |
|
| 896 | - return new TActiveRecordCriteria($criteria,$useArgs ? $args : $parameters); |
|
| 895 | + $useArgs=!is_array($parameters) && is_array($args); |
|
| 896 | + return new TActiveRecordCriteria($criteria, $useArgs ? $args : $parameters); |
|
| 897 | 897 | } |
| 898 | 898 | else if($criteria instanceof TSqlCriteria) |
| 899 | 899 | return $criteria; |
@@ -987,7 +987,7 @@ discard block |
||
| 987 | 987 | * @param mixed the corresponding column value |
| 988 | 988 | * @since 3.1.1 |
| 989 | 989 | */ |
| 990 | - public function setColumnValue($columnName,$value) |
|
| 990 | + public function setColumnValue($columnName, $value) |
|
| 991 | 991 | { |
| 992 | 992 | $className=get_class($this); |
| 993 | 993 | if(isset(self::$_columnMapping[$className][$columnName])) |
@@ -1004,7 +1004,7 @@ discard block |
||
| 1004 | 1004 | { |
| 1005 | 1005 | $className=get_class($this); |
| 1006 | 1006 | $property=strtolower($property); |
| 1007 | - return isset(self::$_relations[$className][$property])?self::$_relations[$className][$property]:null; |
|
| 1007 | + return isset(self::$_relations[$className][$property]) ? self::$_relations[$className][$property] : null; |
|
| 1008 | 1008 | } |
| 1009 | 1009 | |
| 1010 | 1010 | /** |
@@ -1031,9 +1031,9 @@ discard block |
||
| 1031 | 1031 | * @return array of column name and column values |
| 1032 | 1032 | * @since 3.2.4 |
| 1033 | 1033 | */ |
| 1034 | - public function toArray(){ |
|
| 1034 | + public function toArray() { |
|
| 1035 | 1035 | $result=array(); |
| 1036 | - foreach($this->getRecordTableInfo()->getLowerCaseColumnNames() as $columnName){ |
|
| 1036 | + foreach($this->getRecordTableInfo()->getLowerCaseColumnNames() as $columnName) { |
|
| 1037 | 1037 | $result[$columnName]=$this->getColumnValue($columnName); |
| 1038 | 1038 | } |
| 1039 | 1039 | |
@@ -1045,7 +1045,7 @@ discard block |
||
| 1045 | 1045 | * @return JSON |
| 1046 | 1046 | * @since 3.2.4 |
| 1047 | 1047 | */ |
| 1048 | - public function toJSON(){ |
|
| 1048 | + public function toJSON() { |
|
| 1049 | 1049 | return json_encode($this->toArray()); |
| 1050 | 1050 | } |
| 1051 | 1051 | } |
@@ -1080,7 +1080,7 @@ discard block |
||
| 1080 | 1080 | */ |
| 1081 | 1081 | public function setIsValid($value) |
| 1082 | 1082 | { |
| 1083 | - $this->_isValid = TPropertyValue::ensureBoolean($value); |
|
| 1083 | + $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
| 1084 | 1084 | } |
| 1085 | 1085 | } |
| 1086 | 1086 | |
@@ -1102,6 +1102,6 @@ discard block |
||
| 1102 | 1102 | */ |
| 1103 | 1103 | class TActiveRecordInvalidFinderResult extends TEnumerable |
| 1104 | 1104 | { |
| 1105 | - const Null = 'Null'; |
|
| 1106 | - const Exception = 'Exception'; |
|
| 1105 | + const Null='Null'; |
|
| 1106 | + const Exception='Exception'; |
|
| 1107 | 1107 | } |
@@ -425,14 +425,12 @@ discard block |
||
| 425 | 425 | $this->_recordState = self::STATE_LOADED; |
| 426 | 426 | return true; |
| 427 | 427 | } |
| 428 | - } |
|
| 429 | - else if($this->_recordState===self::STATE_LOADED) |
|
| 428 | + } else if($this->_recordState===self::STATE_LOADED) |
|
| 430 | 429 | { |
| 431 | 430 | $this->onUpdate($param); |
| 432 | 431 | if($param->getIsValid() && $gateway->update($this)) |
| 433 | 432 | return true; |
| 434 | - } |
|
| 435 | - else |
|
| 433 | + } else |
|
| 436 | 434 | throw new TActiveRecordException('ar_save_invalid', get_class($this)); |
| 437 | 435 | |
| 438 | 436 | return false; |
@@ -455,8 +453,7 @@ discard block |
||
| 455 | 453 | $this->_recordState=self::STATE_DELETED; |
| 456 | 454 | return true; |
| 457 | 455 | } |
| 458 | - } |
|
| 459 | - else |
|
| 456 | + } else |
|
| 460 | 457 | throw new TActiveRecordException('ar_delete_invalid', get_class($this)); |
| 461 | 458 | |
| 462 | 459 | return false; |
@@ -723,8 +720,7 @@ discard block |
||
| 723 | 720 | { |
| 724 | 721 | $criteria = $this->getRecordCriteria(count($args)>0 ? $args[0] : null, array_slice($args,1)); |
| 725 | 722 | return $context->getRelationHandler($criteria); |
| 726 | - } |
|
| 727 | - else |
|
| 723 | + } else |
|
| 728 | 724 | return null; |
| 729 | 725 | } |
| 730 | 726 | |
@@ -743,8 +739,7 @@ discard block |
||
| 743 | 739 | { |
| 744 | 740 | list($property, $relation) = $definition; |
| 745 | 741 | return new TActiveRecordRelationContext($this,$property,$relation); |
| 746 | - } |
|
| 747 | - else |
|
| 742 | + } else |
|
| 748 | 743 | return null; |
| 749 | 744 | } |
| 750 | 745 | |
@@ -827,8 +822,7 @@ discard block |
||
| 827 | 822 | { |
| 828 | 823 | $property= $method[4]==='_' ? substr($method,5) : substr($method,4); |
| 829 | 824 | return $this->getRelationHandler($property, $args); |
| 830 | - } |
|
| 831 | - else if($findOne=strncasecmp($method,'findby',6)===0) |
|
| 825 | + } else if($findOne=strncasecmp($method,'findby',6)===0) |
|
| 832 | 826 | $condition = $method[6]==='_' ? substr($method,7) : substr($method,6); |
| 833 | 827 | else if(strncasecmp($method,'findallby',9)===0) |
| 834 | 828 | $condition = $method[9]==='_' ? substr($method,10) : substr($method,9); |
@@ -894,8 +888,7 @@ discard block |
||
| 894 | 888 | { |
| 895 | 889 | $useArgs = !is_array($parameters) && is_array($args); |
| 896 | 890 | return new TActiveRecordCriteria($criteria,$useArgs ? $args : $parameters); |
| 897 | - } |
|
| 898 | - else if($criteria instanceof TSqlCriteria) |
|
| 891 | + } else if($criteria instanceof TSqlCriteria) |
|
| 899 | 892 | return $criteria; |
| 900 | 893 | else |
| 901 | 894 | return new TActiveRecordCriteria(); |