@@ -92,13 +92,13 @@ discard block |
||
92 | 92 | */ |
93 | 93 | protected function collectForeignObjects(&$results) |
94 | 94 | { |
95 | - $fkeys = $this->getRelationForeignKeys(); |
|
96 | - $properties = array_values($fkeys); |
|
97 | - $fields = array_keys($fkeys); |
|
95 | + $fkeys=$this->getRelationForeignKeys(); |
|
96 | + $properties=array_values($fkeys); |
|
97 | + $fields=array_keys($fkeys); |
|
98 | 98 | |
99 | - $indexValues = $this->getIndexValues($properties, $results); |
|
100 | - $fkObjects = $this->findForeignObjects($fields,$indexValues); |
|
101 | - $this->populateResult($results,$properties,$fkObjects,$fields); |
|
99 | + $indexValues=$this->getIndexValues($properties, $results); |
|
100 | + $fkObjects=$this->findForeignObjects($fields, $indexValues); |
|
101 | + $this->populateResult($results, $properties, $fkObjects, $fields); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function getRelationForeignKeys() |
109 | 109 | { |
110 | - $fkObject = $this->getContext()->getForeignRecordFinder(); |
|
110 | + $fkObject=$this->getContext()->getForeignRecordFinder(); |
|
111 | 111 | return $this->findForeignKeys($fkObject, $this->getSourceRecord()); |
112 | 112 | } |
113 | 113 | |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | */ |
119 | 119 | protected function setObjectProperty($source, $properties, &$collections) |
120 | 120 | { |
121 | - $hash = $this->getObjectHash($source, $properties); |
|
122 | - $prop = $this->getContext()->getProperty(); |
|
121 | + $hash=$this->getObjectHash($source, $properties); |
|
122 | + $prop=$this->getContext()->getProperty(); |
|
123 | 123 | if(isset($collections[$hash]) && count($collections[$hash]) > 0) |
124 | 124 | { |
125 | 125 | if(count($collections[$hash]) > 1) |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function updateAssociatedRecords() |
136 | 136 | { |
137 | - $fkObject = $this->getContext()->getPropertyValue(); |
|
138 | - $source = $this->getSourceRecord(); |
|
139 | - $fkeys = $this->findForeignKeys($fkObject, $source); |
|
137 | + $fkObject=$this->getContext()->getPropertyValue(); |
|
138 | + $source=$this->getSourceRecord(); |
|
139 | + $fkeys=$this->findForeignKeys($fkObject, $source); |
|
140 | 140 | foreach($fkeys as $fKey => $srcKey) |
141 | 141 | $fkObject->setColumnValue($fKey, $source->getColumnValue($srcKey)); |
142 | 142 | return $fkObject->save(); |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | |
31 | 31 | public function __construct(TActiveRecordRelationContext $context, $criteria) |
32 | 32 | { |
33 | - $this->_context = $context; |
|
34 | - $this->_criteria = $criteria; |
|
33 | + $this->_context=$context; |
|
34 | + $this->_criteria=$criteria; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -71,22 +71,22 @@ discard block |
||
71 | 71 | * @param array method arguments |
72 | 72 | * @return mixed TActiveRecord or array of TActiveRecord results depending on the method called. |
73 | 73 | */ |
74 | - public function __call($method,$args) |
|
74 | + public function __call($method, $args) |
|
75 | 75 | { |
76 | 76 | static $stack=array(); |
77 | 77 | |
78 | - $results = call_user_func_array(array($this->getSourceRecord(),$method),$args); |
|
79 | - $validArray = is_array($results) && count($results) > 0; |
|
78 | + $results=call_user_func_array(array($this->getSourceRecord(), $method), $args); |
|
79 | + $validArray=is_array($results) && count($results) > 0; |
|
80 | 80 | if($validArray || $results instanceof ArrayAccess || $results instanceof TActiveRecord) |
81 | 81 | { |
82 | 82 | $this->collectForeignObjects($results); |
83 | - while($obj = array_pop($stack)) |
|
83 | + while($obj=array_pop($stack)) |
|
84 | 84 | $obj->collectForeignObjects($results); |
85 | 85 | } |
86 | 86 | else if($results instanceof TActiveRecordRelation) |
87 | - $stack[] = $this; //call it later |
|
88 | - else if($results === null || !$validArray) |
|
89 | - $stack = array(); |
|
87 | + $stack[]=$this; //call it later |
|
88 | + else if($results===null || !$validArray) |
|
89 | + $stack=array(); |
|
90 | 90 | return $results; |
91 | 91 | } |
92 | 92 | |
@@ -110,28 +110,28 @@ discard block |
||
110 | 110 | */ |
111 | 111 | protected function findForeignKeys($from, $matchesRecord, $loose=false) |
112 | 112 | { |
113 | - $gateway = $matchesRecord->getRecordGateway(); |
|
114 | - $recordTableInfo = $gateway->getRecordTableInfo($matchesRecord); |
|
115 | - $matchingTableName = strtolower($recordTableInfo->getTableName()); |
|
116 | - $matchingFullTableName = strtolower($recordTableInfo->getTableFullName()); |
|
113 | + $gateway=$matchesRecord->getRecordGateway(); |
|
114 | + $recordTableInfo=$gateway->getRecordTableInfo($matchesRecord); |
|
115 | + $matchingTableName=strtolower($recordTableInfo->getTableName()); |
|
116 | + $matchingFullTableName=strtolower($recordTableInfo->getTableFullName()); |
|
117 | 117 | $tableInfo=$from; |
118 | 118 | if($from instanceof TActiveRecord) |
119 | - $tableInfo = $gateway->getRecordTableInfo($from); |
|
119 | + $tableInfo=$gateway->getRecordTableInfo($from); |
|
120 | 120 | //find first non-empty FK |
121 | 121 | foreach($tableInfo->getForeignKeys() as $fkeys) |
122 | 122 | { |
123 | - $fkTable = strtolower($fkeys['table']); |
|
123 | + $fkTable=strtolower($fkeys['table']); |
|
124 | 124 | if($fkTable===$matchingTableName || $fkTable===$matchingFullTableName) |
125 | 125 | { |
126 | - $hasFkField = !$loose && $this->getContext()->hasFkField(); |
|
127 | - $key = $hasFkField ? $this->getFkFields($fkeys['keys']) : $fkeys['keys']; |
|
126 | + $hasFkField=!$loose && $this->getContext()->hasFkField(); |
|
127 | + $key=$hasFkField ? $this->getFkFields($fkeys['keys']) : $fkeys['keys']; |
|
128 | 128 | if(!empty($key)) |
129 | 129 | return $key; |
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | 133 | //none found |
134 | - $matching = $gateway->getRecordTableInfo($matchesRecord)->getTableFullName(); |
|
134 | + $matching=$gateway->getRecordTableInfo($matchesRecord)->getTableFullName(); |
|
135 | 135 | throw new TActiveRecordException('ar_relations_missing_fk', |
136 | 136 | $tableInfo->getTableFullName(), $matching); |
137 | 137 | } |
@@ -149,13 +149,13 @@ discard block |
||
149 | 149 | */ |
150 | 150 | private function getFkFields($fkeys) |
151 | 151 | { |
152 | - $matching = array(); |
|
152 | + $matching=array(); |
|
153 | 153 | preg_match_all('/\s*(\S+\.)?([\w-]+)\s*/', $this->getContext()->getFkField(), $matching); |
154 | - $fields = array(); |
|
154 | + $fields=array(); |
|
155 | 155 | foreach($fkeys as $fkName => $field) |
156 | 156 | { |
157 | 157 | if(in_array($fkName, $matching[2])) |
158 | - $fields[$fkName] = $field; |
|
158 | + $fields[$fkName]=$field; |
|
159 | 159 | } |
160 | 160 | return $fields; |
161 | 161 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | { |
170 | 170 | $ids=array(); |
171 | 171 | foreach($properties as $property) |
172 | - $ids[] = is_object($obj) ? (string)$obj->getColumnValue($property) : (string)$obj[$property]; |
|
172 | + $ids[]=is_object($obj) ? (string) $obj->getColumnValue($property) : (string) $obj[$property]; |
|
173 | 173 | return serialize($ids); |
174 | 174 | } |
175 | 175 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | protected function findForeignObjects($fields, $indexValues) |
183 | 183 | { |
184 | - $finder = $this->getContext()->getForeignRecordFinder(); |
|
184 | + $finder=$this->getContext()->getForeignRecordFinder(); |
|
185 | 185 | return $finder->findAllByIndex($this->_criteria, $fields, $indexValues); |
186 | 186 | } |
187 | 187 | |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | protected function getIndexValues($keys, $results) |
195 | 195 | { |
196 | 196 | if(!is_array($results) && !$results instanceof ArrayAccess) |
197 | - $results = array($results); |
|
197 | + $results=array($results); |
|
198 | 198 | $values=array(); |
199 | 199 | foreach($results as $result) |
200 | 200 | { |
201 | - $value = array(); |
|
201 | + $value=array(); |
|
202 | 202 | foreach($keys as $name) |
203 | - $value[] = $result->getColumnValue($name); |
|
204 | - $values[] = $value; |
|
203 | + $value[]=$result->getColumnValue($name); |
|
204 | + $values[]=$value; |
|
205 | 205 | } |
206 | 206 | return $values; |
207 | 207 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @param array foreign objects |
214 | 214 | * @param array foreign object field names. |
215 | 215 | */ |
216 | - protected function populateResult(&$results,$properties,&$fkObjects,$fields) |
|
216 | + protected function populateResult(&$results, $properties, &$fkObjects, $fields) |
|
217 | 217 | { |
218 | 218 | $collections=array(); |
219 | 219 | foreach($fkObjects as $fkObject) |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | { |
232 | 232 | if(is_array($results) || $results instanceof ArrayAccess) |
233 | 233 | { |
234 | - for($i=0,$k=count($results);$i<$k;$i++) |
|
234 | + for($i=0, $k=count($results); $i < $k; $i++) |
|
235 | 235 | $this->setObjectProperty($results[$i], $properties, $collections); |
236 | 236 | } |
237 | 237 | else |
@@ -246,8 +246,8 @@ discard block |
||
246 | 246 | */ |
247 | 247 | protected function setObjectProperty($source, $properties, &$collections) |
248 | 248 | { |
249 | - $hash = $this->getObjectHash($source, $properties); |
|
250 | - $prop = $this->getContext()->getProperty(); |
|
249 | + $hash=$this->getObjectHash($source, $properties); |
|
250 | + $prop=$this->getContext()->getProperty(); |
|
251 | 251 | $source->$prop=isset($collections[$hash]) ? $collections[$hash] : array(); |
252 | 252 | } |
253 | 253 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function setRecordPk($value) |
84 | 84 | { |
85 | 85 | $this->clearRecordObject(); |
86 | - $val = TPropertyValue::ensureArray($value); |
|
86 | + $val=TPropertyValue::ensureArray($value); |
|
87 | 87 | $this->setViewState('PK', count($val) > 0 ? $val : null); |
88 | 88 | } |
89 | 89 | |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function initializeEditForm() |
110 | 110 | { |
111 | - $record = $this->getCurrentRecord(); |
|
112 | - $classPath = $this->getEditRenderer(); |
|
113 | - if($classPath === '') |
|
111 | + $record=$this->getCurrentRecord(); |
|
112 | + $classPath=$this->getEditRenderer(); |
|
113 | + if($classPath==='') |
|
114 | 114 | { |
115 | - $columns = $this->getTableInfo()->getColumns(); |
|
115 | + $columns=$this->getTableInfo()->getColumns(); |
|
116 | 116 | $this->getInputRepeater()->setDataSource($columns); |
117 | 117 | $this->getInputRepeater()->dataBind(); |
118 | 118 | } |
@@ -134,11 +134,11 @@ discard block |
||
134 | 134 | */ |
135 | 135 | protected function createEditRenderer($record, $classPath) |
136 | 136 | { |
137 | - $this->_editRenderer = Prado::createComponent($classPath); |
|
137 | + $this->_editRenderer=Prado::createComponent($classPath); |
|
138 | 138 | if($this->_editRenderer instanceof IScaffoldEditRenderer) |
139 | 139 | { |
140 | - $index = $this->getControls()->remove($this->getInputRepeater()); |
|
141 | - $this->getControls()->insertAt($index,$this->_editRenderer); |
|
140 | + $index=$this->getControls()->remove($this->getInputRepeater()); |
|
141 | + $this->getControls()->insertAt($index, $this->_editRenderer); |
|
142 | 142 | $this->_editRenderer->setData($record); |
143 | 143 | } |
144 | 144 | else |
@@ -153,16 +153,16 @@ discard block |
||
153 | 153 | */ |
154 | 154 | protected function createRepeaterEditItem($sender, $param) |
155 | 155 | { |
156 | - $type = $param->getItem()->getItemType(); |
|
156 | + $type=$param->getItem()->getItemType(); |
|
157 | 157 | if($type==TListItemType::Item || $type==TListItemType::AlternatingItem) |
158 | 158 | { |
159 | - $item = $param->getItem(); |
|
160 | - $column = $item->getDataItem(); |
|
159 | + $item=$param->getItem(); |
|
160 | + $column=$item->getDataItem(); |
|
161 | 161 | if($column===null) |
162 | 162 | return; |
163 | 163 | |
164 | - $record = $this->getCurrentRecord(); |
|
165 | - $builder = $this->getScaffoldInputBuilder($record); |
|
164 | + $record=$this->getCurrentRecord(); |
|
165 | + $builder=$this->getScaffoldInputBuilder($record); |
|
166 | 166 | $builder->createScaffoldInput($this, $item, $column, $record); |
167 | 167 | } |
168 | 168 | } |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | { |
195 | 195 | if($this->getPage()->getIsValid()) |
196 | 196 | { |
197 | - $record = $this->getCurrentRecord(); |
|
197 | + $record=$this->getCurrentRecord(); |
|
198 | 198 | if($this->_editRenderer===null) |
199 | 199 | { |
200 | - $table = $this->getTableInfo(); |
|
201 | - $builder = $this->getScaffoldInputBuilder($record); |
|
200 | + $table=$this->getTableInfo(); |
|
201 | + $builder=$this->getScaffoldInputBuilder($record); |
|
202 | 202 | foreach($this->getInputRepeater()->getItems() as $item) |
203 | 203 | { |
204 | - $column = $table->getColumn($item->getCustomData()); |
|
204 | + $column=$table->getColumn($item->getCustomData()); |
|
205 | 205 | $builder->loadScaffoldInput($this, $item, $column, $record); |
206 | 206 | } |
207 | 207 | } |
@@ -265,11 +265,11 @@ discard block |
||
265 | 265 | protected function getScaffoldInputBuilder($record) |
266 | 266 | { |
267 | 267 | static $_builders=array(); |
268 | - $class = get_class($record); |
|
268 | + $class=get_class($record); |
|
269 | 269 | if(!isset($_builders[$class])) |
270 | 270 | { |
271 | 271 | Prado::using('System.Data.ActiveRecord.Scaffold.InputBuilder.TScaffoldInputBase'); |
272 | - $_builders[$class] = TScaffoldInputBase::createInputBuilder($record); |
|
272 | + $_builders[$class]=TScaffoldInputBase::createInputBuilder($record); |
|
273 | 273 | } |
274 | 274 | return $_builders[$class]; |
275 | 275 | } |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | */ |
41 | 41 | protected function getTableInfo() |
42 | 42 | { |
43 | - $finder = $this->getRecordFinder(); |
|
44 | - $gateway = $finder->getRecordManager()->getRecordGateWay(); |
|
43 | + $finder=$this->getRecordFinder(); |
|
44 | + $gateway=$finder->getRecordManager()->getRecordGateWay(); |
|
45 | 45 | return $gateway->getRecordTableInfo($finder); |
46 | 46 | } |
47 | 47 | |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | */ |
52 | 52 | protected function getRecordPropertyValues($record) |
53 | 53 | { |
54 | - $data = array(); |
|
54 | + $data=array(); |
|
55 | 55 | foreach($this->getTableInfo()->getColumns() as $name=>$column) |
56 | - $data[] = $record->getColumnValue($name); |
|
56 | + $data[]=$record->getColumnValue($name); |
|
57 | 57 | return $data; |
58 | 58 | } |
59 | 59 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | foreach($this->getTableInfo()->getColumns() as $name=>$column) |
68 | 68 | { |
69 | 69 | if($column->getIsPrimaryKey()) |
70 | - $data[] = $record->getColumnValue($name); |
|
70 | + $data[]=$record->getColumnValue($name); |
|
71 | 71 | } |
72 | 72 | return $data; |
73 | 73 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | protected function copyFrom(TScaffoldBase $obj) |
98 | 98 | { |
99 | - $this->_record = $obj->_record; |
|
99 | + $this->_record=$obj->_record; |
|
100 | 100 | $this->setRecordClass($obj->getRecordClass()); |
101 | 101 | $this->setEnableDefaultStyle($obj->getEnableDefaultStyle()); |
102 | 102 | } |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | } |
129 | 129 | else |
130 | 130 | { |
131 | - $class = $this->getRecordClass(); |
|
131 | + $class=$this->getRecordClass(); |
|
132 | 132 | if($class!==null) |
133 | 133 | $this->_record=Prado::createComponent($class); |
134 | 134 | else |
135 | 135 | { |
136 | 136 | throw new TConfigurationException('scaffold_invalid_record_class', |
137 | - $this->getRecordClass(),$this->getID()); |
|
137 | + $this->getRecordClass(), $this->getID()); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | } |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | parent::onPreRender($param); |
198 | 198 | if($this->getEnableDefaultStyle()) |
199 | 199 | { |
200 | - $url = $this->publishAsset($this->getDefaultStyle().'.css'); |
|
201 | - $this->getPage()->getClientScript()->registerStyleSheetFile($url,$url); |
|
200 | + $url=$this->publishAsset($this->getDefaultStyle().'.css'); |
|
201 | + $this->getPage()->getClientScript()->registerStyleSheetFile($url, $url); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | } |
@@ -53,15 +53,15 @@ discard block |
||
53 | 53 | */ |
54 | 54 | protected function initializeSort() |
55 | 55 | { |
56 | - $table = $this->getTableInfo(); |
|
57 | - $sorts = array('Sort By', str_repeat('-',15)); |
|
58 | - $headers = array(); |
|
56 | + $table=$this->getTableInfo(); |
|
57 | + $sorts=array('Sort By', str_repeat('-', 15)); |
|
58 | + $headers=array(); |
|
59 | 59 | foreach($table->getColumns() as $name=>$colum) |
60 | 60 | { |
61 | - $fname = ucwords(str_replace('_', ' ', $name)); |
|
62 | - $sorts[$name.' ASC'] = $fname .' Ascending'; |
|
63 | - $sorts[$name.' DESC'] = $fname .' Descending'; |
|
64 | - $headers[] = $fname ; |
|
61 | + $fname=ucwords(str_replace('_', ' ', $name)); |
|
62 | + $sorts[$name.' ASC']=$fname.' Ascending'; |
|
63 | + $sorts[$name.' DESC']=$fname.' Descending'; |
|
64 | + $headers[]=$fname; |
|
65 | 65 | } |
66 | 66 | $this->_sort->setDataSource($sorts); |
67 | 67 | $this->_sort->dataBind(); |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | */ |
89 | 89 | protected function loadRecordData() |
90 | 90 | { |
91 | - $search = new TActiveRecordCriteria($this->getSearchCondition(), $this->getSearchParameters()); |
|
91 | + $search=new TActiveRecordCriteria($this->getSearchCondition(), $this->getSearchParameters()); |
|
92 | 92 | $this->_list->setVirtualItemCount($this->getRecordFinder()->count($search)); |
93 | - $finder = $this->getRecordFinder(); |
|
94 | - $criteria = $this->getRecordCriteria(); |
|
93 | + $finder=$this->getRecordFinder(); |
|
94 | + $criteria=$this->getRecordCriteria(); |
|
95 | 95 | $this->_list->setDataSource($finder->findAll($criteria)); |
96 | 96 | $this->_list->dataBind(); |
97 | 97 | } |
@@ -101,21 +101,21 @@ discard block |
||
101 | 101 | */ |
102 | 102 | protected function getRecordCriteria() |
103 | 103 | { |
104 | - $total = $this->_list->getVirtualItemCount(); |
|
105 | - $limit = $this->_list->getPageSize(); |
|
106 | - $offset = $this->_list->getCurrentPageIndex()*$limit; |
|
104 | + $total=$this->_list->getVirtualItemCount(); |
|
105 | + $limit=$this->_list->getPageSize(); |
|
106 | + $offset=$this->_list->getCurrentPageIndex() * $limit; |
|
107 | 107 | if($offset + $limit > $total) |
108 | - $limit = $total - $offset; |
|
109 | - $criteria = new TActiveRecordCriteria($this->getSearchCondition(), $this->getSearchParameters()); |
|
108 | + $limit=$total - $offset; |
|
109 | + $criteria=new TActiveRecordCriteria($this->getSearchCondition(), $this->getSearchParameters()); |
|
110 | 110 | if($limit > 0) |
111 | 111 | { |
112 | 112 | $criteria->setLimit($limit); |
113 | 113 | if($offset <= $total) |
114 | 114 | $criteria->setOffset($offset); |
115 | 115 | } |
116 | - $order = explode(' ',$this->_sort->getSelectedValue(), 2); |
|
117 | - if(is_array($order) && count($order) === 2) |
|
118 | - $criteria->OrdersBy[$order[0]] = $order[1]; |
|
116 | + $order=explode(' ', $this->_sort->getSelectedValue(), 2); |
|
117 | + if(is_array($order) && count($order)===2) |
|
118 | + $criteria->OrdersBy[$order[0]]=$order[1]; |
|
119 | 119 | return $criteria; |
120 | 120 | } |
121 | 121 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function setSearchParameters($value) |
142 | 142 | { |
143 | - $this->setViewState('SearchParameters', TPropertyValue::ensureArray($value),array()); |
|
143 | + $this->setViewState('SearchParameters', TPropertyValue::ensureArray($value), array()); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | { |
177 | 177 | if($param instanceof TRepeaterCommandEventParameter) |
178 | 178 | { |
179 | - $pk = $param->getItem()->getCustomData(); |
|
179 | + $pk=$param->getItem()->getCustomData(); |
|
180 | 180 | $ctrl->setRecordPk($pk); |
181 | 181 | $ctrl->initializeEditForm(); |
182 | 182 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | { |
191 | 191 | if($param instanceof TRepeaterCommandEventParameter) |
192 | 192 | { |
193 | - $pk = $param->getItem()->getCustomData(); |
|
193 | + $pk=$param->getItem()->getCustomData(); |
|
194 | 194 | $this->getRecordFinder()->deleteByPk($pk); |
195 | 195 | } |
196 | 196 | } |
@@ -200,10 +200,10 @@ discard block |
||
200 | 200 | */ |
201 | 201 | protected function listItemCreated($sender, $param) |
202 | 202 | { |
203 | - $item = $param->getItem(); |
|
203 | + $item=$param->getItem(); |
|
204 | 204 | if($item instanceof IItemDataRenderer) |
205 | 205 | { |
206 | - $type = $item->getItemType(); |
|
206 | + $type=$item->getItemType(); |
|
207 | 207 | if($type==TListItemType::Item || $type==TListItemType::AlternatingItem) |
208 | 208 | $this->populateField($sender, $param); |
209 | 209 | } |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | */ |
216 | 216 | protected function populateField($sender, $param) |
217 | 217 | { |
218 | - $item = $param->getItem(); |
|
219 | - if(($data = $item->getData()) !== null) |
|
218 | + $item=$param->getItem(); |
|
219 | + if(($data=$item->getData())!==null) |
|
220 | 220 | { |
221 | 221 | $item->setCustomData($this->getRecordPkValues($data)); |
222 | - if(($prop = $item->findControl('_properties'))!==null) |
|
222 | + if(($prop=$item->findControl('_properties'))!==null) |
|
223 | 223 | { |
224 | 224 | $item->_properties->setDataSource($this->getRecordPropertyValues($data)); |
225 | 225 | $item->_properties->dataBind(); |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | { |
295 | 295 | if(($id=$this->getEditViewID())!==null) |
296 | 296 | { |
297 | - $ctrl = $this->getParent()->findControl($id); |
|
297 | + $ctrl=$this->getParent()->findControl($id); |
|
298 | 298 | if($ctrl===null) |
299 | 299 | throw new TConfigurationException('scaffold_unable_to_find_edit_view', $id); |
300 | 300 | return $ctrl; |
@@ -90,7 +90,7 @@ |
||
90 | 90 | * Handle the "edit" and "new" commands by displaying the edit view. |
91 | 91 | * Default command shows the list view. |
92 | 92 | */ |
93 | - public function bubbleEvent($sender,$param) |
|
93 | + public function bubbleEvent($sender, $param) |
|
94 | 94 | { |
95 | 95 | switch(strtolower($param->getCommandName())) |
96 | 96 | { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | case 'char': case 'varchar': |
30 | 30 | return $this->createMultiLineControl($container, $column, $record); |
31 | 31 | default: |
32 | - return $this->createDefaultControl($container,$column, $record); |
|
32 | + return $this->createDefaultControl($container, $column, $record); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | case 'timestamp': |
45 | 45 | return $this->getDateTimeValue($container, $column, $record); |
46 | 46 | default: |
47 | - return $this->getDefaultControlValue($container,$column, $record); |
|
47 | + return $this->getDefaultControlValue($container, $column, $record); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | case 'datetime': case 'smalldatetime': |
27 | 27 | return $this->createDateTimeControl($container, $column, $record); |
28 | 28 | default: |
29 | - $control = $this->createDefaultControl($container,$column, $record); |
|
29 | + $control=$this->createDefaultControl($container, $column, $record); |
|
30 | 30 | if($column->getIsExcluded()) |
31 | 31 | $control->setEnabled(false); |
32 | 32 | return $control; |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | case 'boolean': |
41 | 41 | return $container->findControl(self::DEFAULT_ID)->getChecked(); |
42 | 42 | case 'datetime': case 'smalldatetime': |
43 | - return $this->getDateTimeValue($container,$column, $record); |
|
43 | + return $this->getDateTimeValue($container, $column, $record); |
|
44 | 44 | default: |
45 | - $value = $this->getDefaultControlValue($container,$column, $record); |
|
45 | + $value=$this->getDefaultControlValue($container, $column, $record); |
|
46 | 46 | if(trim($value)==='' && $column->getAllowNull()) |
47 | 47 | return null; |
48 | 48 | else |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | case 'datetime': case 'timestamp': |
34 | 34 | return $this->createDateTimeControl($container, $column, $record); |
35 | 35 | default: |
36 | - return $this->createDefaultControl($container,$column, $record); |
|
36 | + return $this->createDefaultControl($container, $column, $record); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
@@ -50,16 +50,16 @@ discard block |
||
50 | 50 | case 'time': |
51 | 51 | return $this->getTimeValue($container, $column, $record); |
52 | 52 | case 'datetime': case 'timestamp': |
53 | - return $this->getDateTimeValue($container,$column, $record); |
|
53 | + return $this->getDateTimeValue($container, $column, $record); |
|
54 | 54 | default: |
55 | - return $this->getDefaultControlValue($container,$column, $record); |
|
55 | + return $this->getDefaultControlValue($container, $column, $record); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | 59 | protected function createDateControl($container, $column, $record) |
60 | 60 | { |
61 | - $control = parent::createDateControl($container, $column, $record); |
|
62 | - $value = $this->getRecordPropertyValue($column, $record); |
|
61 | + $control=parent::createDateControl($container, $column, $record); |
|
62 | + $value=$this->getRecordPropertyValue($column, $record); |
|
63 | 63 | if(!empty($value) && preg_match('/timestamp/i', $column->getDbType())) |
64 | 64 | $control->setTimestamp(intval($value)); |
65 | 65 | return $control; |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | |
68 | 68 | protected function createDateTimeControl($container, $column, $record) |
69 | 69 | { |
70 | - $value = $this->getRecordPropertyValue($column, $record); |
|
71 | - $time = parent::createDateTimeControl($container, $column, $record); |
|
70 | + $value=$this->getRecordPropertyValue($column, $record); |
|
71 | + $time=parent::createDateTimeControl($container, $column, $record); |
|
72 | 72 | if(!empty($value) && preg_match('/timestamp/i', $column->getDbType())) |
73 | 73 | { |
74 | - $s = Prado::createComponent('System.Util.TDateTimeStamp'); |
|
75 | - $date = $s->getDate(intval($value)); |
|
74 | + $s=Prado::createComponent('System.Util.TDateTimeStamp'); |
|
75 | + $date=$s->getDate(intval($value)); |
|
76 | 76 | $time[1]->setSelectedValue($date['hours']); |
77 | 77 | $time[2]->setSelectedValue($date['minutes']); |
78 | 78 | $time[3]->setSelectedValue($date['seconds']); |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | { |
85 | 85 | if(preg_match('/timestamp/i', $column->getDbType())) |
86 | 86 | { |
87 | - $time = $container->findControl(self::DEFAULT_ID)->getTimestamp(); |
|
88 | - $s = Prado::createComponent('System.Util.TDateTimeStamp'); |
|
89 | - $date = $s->getDate($time); |
|
90 | - $hour = $container->findControl('scaffold_time_hour')->getSelectedValue(); |
|
91 | - $mins = $container->findControl('scaffold_time_min')->getSelectedValue(); |
|
92 | - $secs = $container->findControl('scaffold_time_sec')->getSelectedValue(); |
|
93 | - return $s->getTimeStamp($hour,$mins,$secs,$date['mon'],$date['mday'],$date['year']); |
|
87 | + $time=$container->findControl(self::DEFAULT_ID)->getTimestamp(); |
|
88 | + $s=Prado::createComponent('System.Util.TDateTimeStamp'); |
|
89 | + $date=$s->getDate($time); |
|
90 | + $hour=$container->findControl('scaffold_time_hour')->getSelectedValue(); |
|
91 | + $mins=$container->findControl('scaffold_time_min')->getSelectedValue(); |
|
92 | + $secs=$container->findControl('scaffold_time_sec')->getSelectedValue(); |
|
93 | + return $s->getTimeStamp($hour, $mins, $secs, $date['mon'], $date['mday'], $date['year']); |
|
94 | 94 | } |
95 | 95 | else |
96 | 96 | return parent::getDateTimeValue($container, $column, $record); |