@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | { |
| 16 | 16 | $control->setID(self::DEFAULT_ID); |
| 17 | 17 | $control->setEnabled($this->getIsEnabled($column, $record)); |
| 18 | - $container->Controls[] = $control; |
|
| 18 | + $container->Controls[]=$control; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | protected function setNotNullProperty($container, $control, $column, $record) |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | protected function createBooleanControl($container, $column, $record) |
| 29 | 29 | { |
| 30 | - $value = $this->getRecordPropertyValue($column, $record); |
|
| 31 | - $control = new TCheckBox(); |
|
| 30 | + $value=$this->getRecordPropertyValue($column, $record); |
|
| 31 | + $control=new TCheckBox(); |
|
| 32 | 32 | $control->setChecked(TPropertyValue::ensureBoolean($value)); |
| 33 | 33 | $control->setCssClass('boolean-checkbox'); |
| 34 | 34 | $this->setDefaultProperty($container, $control, $column, $record); |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | protected function createDefaultControl($container, $column, $record) |
| 39 | 39 | { |
| 40 | - $value = $this->getRecordPropertyValue($column, $record); |
|
| 41 | - $control = new TTextBox(); |
|
| 40 | + $value=$this->getRecordPropertyValue($column, $record); |
|
| 41 | + $control=new TTextBox(); |
|
| 42 | 42 | $control->setText($value); |
| 43 | 43 | $control->setCssClass('default-textbox scaffold_input'); |
| 44 | 44 | if(($len=$column->getColumnSize())!==null) |
@@ -47,9 +47,9 @@ discard block |
||
| 47 | 47 | return $control; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - protected function getDefaultControlValue($container,$column, $record) |
|
| 50 | + protected function getDefaultControlValue($container, $column, $record) |
|
| 51 | 51 | { |
| 52 | - $control = $container->findControl(self::DEFAULT_ID); |
|
| 52 | + $control=$container->findControl(self::DEFAULT_ID); |
|
| 53 | 53 | if($control instanceof TCheckBox) |
| 54 | 54 | return $control->getChecked(); |
| 55 | 55 | else if($control instanceof TControl) |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | protected function createMultiLineControl($container, $column, $record) |
| 60 | 60 | { |
| 61 | - $value = $this->getRecordPropertyValue($column, $record); |
|
| 62 | - $control = new TTextBox(); |
|
| 61 | + $value=$this->getRecordPropertyValue($column, $record); |
|
| 62 | + $control=new TTextBox(); |
|
| 63 | 63 | $control->setText($value); |
| 64 | 64 | $control->setTextMode(TTextBoxMode::MultiLine); |
| 65 | 65 | $control->setCssClass('multiline-textbox scaffold_input'); |
@@ -69,13 +69,13 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | protected function createYearControl($container, $column, $record) |
| 71 | 71 | { |
| 72 | - $value = $this->getRecordPropertyValue($column, $record); |
|
| 73 | - $control = new TDropDownList(); |
|
| 74 | - $years = array(); |
|
| 75 | - $current = intval(@date('Y')); |
|
| 76 | - $from = $current-10; $to=$current+10; |
|
| 77 | - for($i = $from; $i <= $to; $i++) |
|
| 78 | - $years[$i] = $i; |
|
| 72 | + $value=$this->getRecordPropertyValue($column, $record); |
|
| 73 | + $control=new TDropDownList(); |
|
| 74 | + $years=array(); |
|
| 75 | + $current=intval(@date('Y')); |
|
| 76 | + $from=$current - 10; $to=$current + 10; |
|
| 77 | + for($i=$from; $i <= $to; $i++) |
|
| 78 | + $years[$i]=$i; |
|
| 79 | 79 | $control->setDataSource($years); |
| 80 | 80 | $control->setSelectedValue(empty($value) ? $current : $value); |
| 81 | 81 | $control->setCssClass('year-dropdown'); |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | protected function createIntegerControl($container, $column, $record) |
| 87 | 87 | { |
| 88 | - $control = $this->createDefaultControl($container, $column, $record); |
|
| 89 | - $val = $this->createTypeValidator($container, $column, $record); |
|
| 88 | + $control=$this->createDefaultControl($container, $column, $record); |
|
| 89 | + $val=$this->createTypeValidator($container, $column, $record); |
|
| 90 | 90 | $val->setDataType(TValidationDataType::Integer); |
| 91 | 91 | $val->setErrorMessage('Please entery an integer.'); |
| 92 | 92 | return $control; |
@@ -94,13 +94,13 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | protected function createFloatControl($container, $column, $record) |
| 96 | 96 | { |
| 97 | - $control = $this->createDefaultControl($container, $column, $record); |
|
| 98 | - $val = $this->createTypeValidator($container, $column, $record); |
|
| 97 | + $control=$this->createDefaultControl($container, $column, $record); |
|
| 98 | + $val=$this->createTypeValidator($container, $column, $record); |
|
| 99 | 99 | $val->setDataType(TValidationDataType::Float); |
| 100 | 100 | $val->setErrorMessage('Please entery a decimal number.'); |
| 101 | - if(($max= $column->getMaxiumNumericConstraint())!==null) |
|
| 101 | + if(($max=$column->getMaxiumNumericConstraint())!==null) |
|
| 102 | 102 | { |
| 103 | - $val = $this->createRangeValidator($container,$column,$record); |
|
| 103 | + $val=$this->createRangeValidator($container, $column, $record); |
|
| 104 | 104 | $val->setDataType(TValidationDataType::Float); |
| 105 | 105 | $val->setMaxValue($max); |
| 106 | 106 | $val->setStrictComparison(true); |
@@ -111,99 +111,99 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | protected function createRequiredValidator($container, $column, $record) |
| 113 | 113 | { |
| 114 | - $val = new TRequiredFieldValidator(); |
|
| 114 | + $val=new TRequiredFieldValidator(); |
|
| 115 | 115 | $val->setErrorMessage('*'); |
| 116 | 116 | $val->setControlCssClass('required-input'); |
| 117 | 117 | $val->setCssClass('required'); |
| 118 | 118 | $val->setControlToValidate(self::DEFAULT_ID); |
| 119 | 119 | $val->setValidationGroup($this->getParent()->getValidationGroup()); |
| 120 | 120 | $val->setDisplay(TValidatorDisplayStyle::Dynamic); |
| 121 | - $container->Controls[] = $val; |
|
| 121 | + $container->Controls[]=$val; |
|
| 122 | 122 | return $val; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | protected function createTypeValidator($container, $column, $record) |
| 126 | 126 | { |
| 127 | - $val = new TDataTypeValidator(); |
|
| 127 | + $val=new TDataTypeValidator(); |
|
| 128 | 128 | $val->setControlCssClass('required-input2'); |
| 129 | 129 | $val->setCssClass('required'); |
| 130 | 130 | $val->setControlToValidate(self::DEFAULT_ID); |
| 131 | 131 | $val->setValidationGroup($this->getParent()->getValidationGroup()); |
| 132 | 132 | $val->setDisplay(TValidatorDisplayStyle::Dynamic); |
| 133 | - $container->Controls[] = $val; |
|
| 133 | + $container->Controls[]=$val; |
|
| 134 | 134 | return $val; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | protected function createRangeValidator($container, $column, $record) |
| 138 | 138 | { |
| 139 | - $val = new TRangeValidator(); |
|
| 139 | + $val=new TRangeValidator(); |
|
| 140 | 140 | $val->setControlCssClass('required-input3'); |
| 141 | 141 | $val->setCssClass('required'); |
| 142 | 142 | $val->setControlToValidate(self::DEFAULT_ID); |
| 143 | 143 | $val->setValidationGroup($this->getParent()->getValidationGroup()); |
| 144 | 144 | $val->setDisplay(TValidatorDisplayStyle::Dynamic); |
| 145 | - $container->Controls[] = $val; |
|
| 145 | + $container->Controls[]=$val; |
|
| 146 | 146 | return $val; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | protected function createTimeControl($container, $column, $record) |
| 150 | 150 | { |
| 151 | - $value = $this->getRecordPropertyValue($column, $record); |
|
| 151 | + $value=$this->getRecordPropertyValue($column, $record); |
|
| 152 | 152 | $hours=array(); |
| 153 | - for($i=0;$i<24;$i++) $hours[] = str_pad($i,2,'0',STR_PAD_LEFT); |
|
| 153 | + for($i=0; $i < 24; $i++) $hours[]=str_pad($i, 2, '0', STR_PAD_LEFT); |
|
| 154 | 154 | $mins=array(); |
| 155 | - for($i=0;$i<60;$i++) $mins[] = str_pad($i,2,'0',STR_PAD_LEFT); |
|
| 156 | - $hour = intval(@date('H')); |
|
| 157 | - $min = intval(@date('i')); |
|
| 158 | - $sec = intval(@date('s')); |
|
| 155 | + for($i=0; $i < 60; $i++) $mins[]=str_pad($i, 2, '0', STR_PAD_LEFT); |
|
| 156 | + $hour=intval(@date('H')); |
|
| 157 | + $min=intval(@date('i')); |
|
| 158 | + $sec=intval(@date('s')); |
|
| 159 | 159 | if(!empty($value)) |
| 160 | 160 | { |
| 161 | 161 | $match=array(); |
| 162 | 162 | if(preg_match('/(\d+):(\d+):?(\d+)?/', $value, $match)) |
| 163 | 163 | { |
| 164 | - $hour = $match[1]; |
|
| 165 | - $min = $match[2]; |
|
| 164 | + $hour=$match[1]; |
|
| 165 | + $min=$match[2]; |
|
| 166 | 166 | if(isset($match[3])) |
| 167 | 167 | $sec=$match[3]; |
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - $hcontrol = new TDropDownList(); |
|
| 171 | + $hcontrol=new TDropDownList(); |
|
| 172 | 172 | $hcontrol->setDataSource($hours); |
| 173 | 173 | $hcontrol->setID(self::DEFAULT_ID); |
| 174 | 174 | $hcontrol->dataBind(); |
| 175 | 175 | $hcontrol->setSelectedValue(intval($hour)); |
| 176 | - $container->Controls[] = $hcontrol; |
|
| 177 | - $container->Controls[] = ' : '; |
|
| 176 | + $container->Controls[]=$hcontrol; |
|
| 177 | + $container->Controls[]=' : '; |
|
| 178 | 178 | |
| 179 | - $mcontrol = new TDropDownList(); |
|
| 179 | + $mcontrol=new TDropDownList(); |
|
| 180 | 180 | $mcontrol->setDataSource($mins); |
| 181 | 181 | $mcontrol->dataBind(); |
| 182 | 182 | $mcontrol->setID('scaffold_time_min'); |
| 183 | 183 | $mcontrol->setSelectedValue(intval($min)); |
| 184 | - $container->Controls[] = $mcontrol; |
|
| 185 | - $container->Controls[] = ' : '; |
|
| 184 | + $container->Controls[]=$mcontrol; |
|
| 185 | + $container->Controls[]=' : '; |
|
| 186 | 186 | |
| 187 | - $scontrol = new TDropDownList(); |
|
| 187 | + $scontrol=new TDropDownList(); |
|
| 188 | 188 | $scontrol->setDataSource($mins); |
| 189 | 189 | $scontrol->dataBind(); |
| 190 | 190 | $scontrol->setID('scaffold_time_sec'); |
| 191 | 191 | $scontrol->setSelectedValue(intval($sec)); |
| 192 | - $container->Controls[] = $scontrol; |
|
| 192 | + $container->Controls[]=$scontrol; |
|
| 193 | 193 | |
| 194 | - return array($hcontrol,$mcontrol,$scontrol); |
|
| 194 | + return array($hcontrol, $mcontrol, $scontrol); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | |
| 198 | 198 | protected function createDateControl($container, $column, $record) |
| 199 | 199 | { |
| 200 | - $value = $this->getRecordPropertyValue($column, $record); |
|
| 201 | - $control = new TDatePicker(); |
|
| 200 | + $value=$this->getRecordPropertyValue($column, $record); |
|
| 201 | + $control=new TDatePicker(); |
|
| 202 | 202 | $control->setFromYear(1900); |
| 203 | 203 | $control->setInputMode(TDatePickerInputMode::DropDownList); |
| 204 | 204 | $control->setDateFormat('yyyy-MM-dd'); |
| 205 | 205 | if(!empty($value)) |
| 206 | - $control->setDate(substr($value,0,10)); |
|
| 206 | + $control->setDate(substr($value, 0, 10)); |
|
| 207 | 207 | $control->setCssClass('date-dropdown'); |
| 208 | 208 | $this->setNotNullProperty($container, $control, $column, $record); |
| 209 | 209 | return $control; |
@@ -211,10 +211,10 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | protected function createDateTimeControl($container, $column, $record) |
| 213 | 213 | { |
| 214 | - $value = $this->getRecordPropertyValue($column, $record); |
|
| 215 | - $control = $this->createDateControl($container, $column, $record); |
|
| 216 | - $container->Controls[] = ' @ '; |
|
| 217 | - $time = $this->createTimeControl($container, $column, $record); |
|
| 214 | + $value=$this->getRecordPropertyValue($column, $record); |
|
| 215 | + $control=$this->createDateControl($container, $column, $record); |
|
| 216 | + $container->Controls[]=' @ '; |
|
| 217 | + $time=$this->createTimeControl($container, $column, $record); |
|
| 218 | 218 | if(!empty($value)) |
| 219 | 219 | { |
| 220 | 220 | $match=array(); |
@@ -232,30 +232,30 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | protected function getDateTimeValue($container, $column, $record) |
| 234 | 234 | { |
| 235 | - $date = $container->findControl(self::DEFAULT_ID)->getDate(); |
|
| 236 | - $hour = $container->findControl('scaffold_time_hour')->getSelectedValue(); |
|
| 237 | - $mins = $container->findControl('scaffold_time_min')->getSelectedValue(); |
|
| 238 | - $secs = $container->findControl('scaffold_time_sec')->getSelectedValue(); |
|
| 235 | + $date=$container->findControl(self::DEFAULT_ID)->getDate(); |
|
| 236 | + $hour=$container->findControl('scaffold_time_hour')->getSelectedValue(); |
|
| 237 | + $mins=$container->findControl('scaffold_time_min')->getSelectedValue(); |
|
| 238 | + $secs=$container->findControl('scaffold_time_sec')->getSelectedValue(); |
|
| 239 | 239 | return "{$date} {$hour}:{$mins}:{$secs}"; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | protected function getTimeValue($container, $column, $record) |
| 243 | 243 | { |
| 244 | - $hour = $container->findControl(self::DEFAULT_ID)->getSelectedValue(); |
|
| 245 | - $mins = $container->findControl('scaffold_time_min')->getSelectedValue(); |
|
| 246 | - $secs = $container->findControl('scaffold_time_sec')->getSelectedValue(); |
|
| 244 | + $hour=$container->findControl(self::DEFAULT_ID)->getSelectedValue(); |
|
| 245 | + $mins=$container->findControl('scaffold_time_min')->getSelectedValue(); |
|
| 246 | + $secs=$container->findControl('scaffold_time_sec')->getSelectedValue(); |
|
| 247 | 247 | return "{$hour}:{$mins}:{$secs}"; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | protected function createSetControl($container, $column, $record) |
| 251 | 251 | { |
| 252 | - $value = $this->getRecordPropertyValue($column, $record); |
|
| 253 | - $selectedValues = preg_split('/\s*,\s*/', $value); |
|
| 254 | - $control = new TCheckBoxList(); |
|
| 255 | - $values = $column->getDbTypeValues(); |
|
| 252 | + $value=$this->getRecordPropertyValue($column, $record); |
|
| 253 | + $selectedValues=preg_split('/\s*,\s*/', $value); |
|
| 254 | + $control=new TCheckBoxList(); |
|
| 255 | + $values=$column->getDbTypeValues(); |
|
| 256 | 256 | $control->setDataSource($values); |
| 257 | 257 | $control->dataBind(); |
| 258 | - $control->setSelectedIndices($this->getMatchingIndices($values,$selectedValues)); |
|
| 258 | + $control->setSelectedIndices($this->getMatchingIndices($values, $selectedValues)); |
|
| 259 | 259 | $control->setID(self::DEFAULT_ID); |
| 260 | 260 | $control->setCssClass('set-checkboxes'); |
| 261 | 261 | $this->setNotNullProperty($container, $control, $column, $record); |
@@ -265,23 +265,23 @@ discard block |
||
| 265 | 265 | protected function getMatchingIndices($checks, $values) |
| 266 | 266 | { |
| 267 | 267 | $index=array(); |
| 268 | - for($i=0, $k=count($checks); $i<$k; $i++) |
|
| 268 | + for($i=0, $k=count($checks); $i < $k; $i++) |
|
| 269 | 269 | { |
| 270 | 270 | if(in_array($checks[$i], $values)) |
| 271 | - $index[] = $i; |
|
| 271 | + $index[]=$i; |
|
| 272 | 272 | } |
| 273 | 273 | return $index; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | protected function createEnumControl($container, $column, $record) |
| 277 | 277 | { |
| 278 | - $value = $this->getRecordPropertyValue($column, $record); |
|
| 279 | - $selectedValues = preg_split('/\s*,\s*/', $value); |
|
| 280 | - $control = new TRadioButtonList(); |
|
| 281 | - $values = $column->getDbTypeValues(); |
|
| 278 | + $value=$this->getRecordPropertyValue($column, $record); |
|
| 279 | + $selectedValues=preg_split('/\s*,\s*/', $value); |
|
| 280 | + $control=new TRadioButtonList(); |
|
| 281 | + $values=$column->getDbTypeValues(); |
|
| 282 | 282 | $control->setDataSource($values); |
| 283 | 283 | $control->dataBind(); |
| 284 | - $index = $this->getMatchingIndices($values,$selectedValues); |
|
| 284 | + $index=$this->getMatchingIndices($values, $selectedValues); |
|
| 285 | 285 | if(count($index) > 0) |
| 286 | 286 | $control->setSelectedIndex($index[0]); |
| 287 | 287 | $control->setID(self::DEFAULT_ID); |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | foreach($container->findControl(self::DEFAULT_ID)->getItems() as $item) |
| 297 | 297 | { |
| 298 | 298 | if($item->getSelected()) |
| 299 | - $value[] = $item->getText(); |
|
| 299 | + $value[]=$item->getText(); |
|
| 300 | 300 | } |
| 301 | 301 | return implode(',', $value); |
| 302 | 302 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | { |
| 14 | 14 | protected function createControl($container, $column, $record) |
| 15 | 15 | { |
| 16 | - $dbtype = trim(str_replace(array('unsigned', 'zerofill'),array('','',),strtolower($column->getDbType()))); |
|
| 16 | + $dbtype=trim(str_replace(array('unsigned', 'zerofill'), array('', '',), strtolower($column->getDbType()))); |
|
| 17 | 17 | switch($dbtype) |
| 18 | 18 | { |
| 19 | 19 | case 'date': |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | protected function getControlValue($container, $column, $record) |
| 44 | 44 | { |
| 45 | - $dbtype = trim(str_replace(array('unsigned', 'zerofill'),array('','',),strtolower($column->getDbType()))); |
|
| 45 | + $dbtype=trim(str_replace(array('unsigned', 'zerofill'), array('', '',), strtolower($column->getDbType()))); |
|
| 46 | 46 | switch($dbtype) |
| 47 | 47 | { |
| 48 | 48 | case 'date': |
@@ -52,15 +52,15 @@ discard block |
||
| 52 | 52 | case 'time': |
| 53 | 53 | return $this->getTimeValue($container, $column, $record); |
| 54 | 54 | case 'datetime': case 'timestamp': |
| 55 | - return $this->getDateTimeValue($container,$column, $record); |
|
| 55 | + return $this->getDateTimeValue($container, $column, $record); |
|
| 56 | 56 | case 'tinyint': |
| 57 | - return $this->getIntBooleanValue($container,$column, $record); |
|
| 57 | + return $this->getIntBooleanValue($container, $column, $record); |
|
| 58 | 58 | case 'set': |
| 59 | 59 | return $this->getSetValue($container, $column, $record); |
| 60 | 60 | case 'enum': |
| 61 | 61 | return $this->getEnumValue($container, $column, $record); |
| 62 | 62 | default: |
| 63 | - return $this->getDefaultControlValue($container,$column, $record); |
|
| 63 | + return $this->getDefaultControlValue($container, $column, $record); |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
@@ -72,12 +72,12 @@ discard block |
||
| 72 | 72 | parent::createIntegerControl($container, $column, $record); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - protected function getIntBooleanValue($container,$column, $record) |
|
| 75 | + protected function getIntBooleanValue($container, $column, $record) |
|
| 76 | 76 | { |
| 77 | 77 | if($column->getColumnSize()==1) |
| 78 | - return (int)$container->findControl(self::DEFAULT_ID)->getChecked(); |
|
| 78 | + return (int) $container->findControl(self::DEFAULT_ID)->getChecked(); |
|
| 79 | 79 | else |
| 80 | - return $this->getDefaultControlValue($container,$column, $record); |
|
| 80 | + return $this->getDefaultControlValue($container, $column, $record); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | protected function getListView() |
| 47 | 47 | { |
| 48 | - if($this->_list===null && ($id = $this->getListViewID()) !== null) |
|
| 48 | + if($this->_list===null && ($id=$this->getListViewID())!==null) |
|
| 49 | 49 | { |
| 50 | - $this->_list = $this->getParent()->findControl($id); |
|
| 51 | - if($this->_list ===null) |
|
| 50 | + $this->_list=$this->getParent()->findControl($id); |
|
| 51 | + if($this->_list===null) |
|
| 52 | 52 | throw new TConfigurationException('scaffold_unable_to_find_list_view', $id); |
| 53 | 53 | } |
| 54 | 54 | return $this->_list; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | { |
| 79 | 79 | if(strtolower($param->getCommandName())==='search') |
| 80 | 80 | { |
| 81 | - if(($list = $this->getListView()) !== null) |
|
| 81 | + if(($list=$this->getListView())!==null) |
|
| 82 | 82 | { |
| 83 | 83 | $list->setSearchCondition($this->createSearchCondition()); |
| 84 | 84 | return false; |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | protected function createSearchCondition() |
| 95 | 95 | { |
| 96 | - $table = $this->getTableInfo(); |
|
| 96 | + $table=$this->getTableInfo(); |
|
| 97 | 97 | if(strlen($str=$this->getSearchText()->getText()) > 0) |
| 98 | 98 | { |
| 99 | - $builder = $table->createCommandBuilder($this->getRecordFinder()->getDbConnection()); |
|
| 99 | + $builder=$table->createCommandBuilder($this->getRecordFinder()->getDbConnection()); |
|
| 100 | 100 | return $builder->getSearchExpression($this->getFields(), $str); |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -106,10 +106,10 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | protected function getFields() |
| 108 | 108 | { |
| 109 | - if(strlen(trim($str=$this->getSearchableFields()))>0) |
|
| 110 | - $fields = preg_split('/\s*,\s*/', $str); |
|
| 109 | + if(strlen(trim($str=$this->getSearchableFields())) > 0) |
|
| 110 | + $fields=preg_split('/\s*,\s*/', $str); |
|
| 111 | 111 | else |
| 112 | - $fields = $this->getTableInfo()->getColumns()->getKeys(); |
|
| 112 | + $fields=$this->getTableInfo()->getColumns()->getKeys(); |
|
| 113 | 113 | return $fields; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | public function getSearchableFields() |
| 120 | 120 | { |
| 121 | - return $this->getViewState('SearchableFields',''); |
|
| 121 | + return $this->getViewState('SearchableFields', ''); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | protected function getErrorMessageFile() |
| 25 | 25 | { |
| 26 | 26 | $lang=Prado::getPreferredLanguage(); |
| 27 | - $path = dirname(__FILE__); |
|
| 27 | + $path=dirname(__FILE__); |
|
| 28 | 28 | $msgFile=$path.'/messages-'.$lang.'.txt'; |
| 29 | 29 | if(!is_file($msgFile)) |
| 30 | 30 | $msgFile=$path.'/messages.txt'; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | public function getTypeHandlers() |
| 89 | 89 | { |
| 90 | 90 | if($this->_typeHandlers===null) |
| 91 | - $this->_typeHandlers= new TSqlMapTypeHandlerRegistry(); |
|
| 91 | + $this->_typeHandlers=new TSqlMapTypeHandlerRegistry(); |
|
| 92 | 92 | return $this->_typeHandlers; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function configureXml($file) |
| 110 | 110 | { |
| 111 | - $config = new TSqlMapXmlConfiguration($this); |
|
| 111 | + $config=new TSqlMapXmlConfiguration($this); |
|
| 112 | 112 | $config->configure($file); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | public function getCacheDependencies() |
| 120 | 120 | { |
| 121 | - if($this->_cacheDependencies === null) |
|
| 121 | + if($this->_cacheDependencies===null) |
|
| 122 | 122 | $this->_cacheDependencies=new TChainedCacheDependency(); |
| 123 | 123 | |
| 124 | 124 | return $this->_cacheDependencies; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function getMappedStatement($name) |
| 152 | 152 | { |
| 153 | - if($this->_mappedStatements->contains($name) == false) |
|
| 153 | + if($this->_mappedStatements->contains($name)==false) |
|
| 154 | 154 | throw new TSqlMapUndefinedException('sqlmap_contains_no_statement', $name); |
| 155 | 155 | return $this->_mappedStatements[$name]; |
| 156 | 156 | } |
@@ -163,8 +163,8 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | public function addMappedStatement(IMappedStatement $statement) |
| 165 | 165 | { |
| 166 | - $key = $statement->getID(); |
|
| 167 | - if($this->_mappedStatements->contains($key) == true) |
|
| 166 | + $key=$statement->getID(); |
|
| 167 | + if($this->_mappedStatements->contains($key)==true) |
|
| 168 | 168 | throw new TSqlMapDuplicateException('sqlmap_already_contains_statement', $key); |
| 169 | 169 | $this->_mappedStatements->add($key, $statement); |
| 170 | 170 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | public function getResultMap($name) |
| 187 | 187 | { |
| 188 | - if($this->_resultMaps->contains($name) == false) |
|
| 188 | + if($this->_resultMaps->contains($name)==false) |
|
| 189 | 189 | throw new TSqlMapUndefinedException('sqlmap_contains_no_result_map', $name); |
| 190 | 190 | return $this->_resultMaps[$name]; |
| 191 | 191 | } |
@@ -196,8 +196,8 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | public function addResultMap(TResultMap $result) |
| 198 | 198 | { |
| 199 | - $key = $result->getID(); |
|
| 200 | - if($this->_resultMaps->contains($key) == true) |
|
| 199 | + $key=$result->getID(); |
|
| 200 | + if($this->_resultMaps->contains($key)==true) |
|
| 201 | 201 | throw new TSqlMapDuplicateException('sqlmap_already_contains_result_map', $key); |
| 202 | 202 | $this->_resultMaps->add($key, $result); |
| 203 | 203 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | public function getParameterMap($name) |
| 219 | 219 | { |
| 220 | - if($this->_parameterMaps->contains($name) == false) |
|
| 220 | + if($this->_parameterMaps->contains($name)==false) |
|
| 221 | 221 | throw new TSqlMapUndefinedException('sqlmap_contains_no_parameter_map', $name); |
| 222 | 222 | return $this->_parameterMaps[$name]; |
| 223 | 223 | } |
@@ -228,8 +228,8 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | public function addParameterMap(TParameterMap $parameter) |
| 230 | 230 | { |
| 231 | - $key = $parameter->getID(); |
|
| 232 | - if($this->_parameterMaps->contains($key) == true) |
|
| 231 | + $key=$parameter->getID(); |
|
| 232 | + if($this->_parameterMaps->contains($key)==true) |
|
| 233 | 233 | throw new TSqlMapDuplicateException('sqlmap_already_contains_parameter_map', $key); |
| 234 | 234 | $this->_parameterMaps->add($key, $parameter); |
| 235 | 235 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function queryForObject($statementName, $parameter=null, $result=null) |
| 69 | 69 | { |
| 70 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
| 70 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
| 71 | 71 | return $statement->executeQueryForObject($this->getDbConnection(), $parameter, $result); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function queryForList($statementName, $parameter=null, $result=null, $skip=-1, $max=-1) |
| 90 | 90 | { |
| 91 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
| 92 | - return $statement->executeQueryForList($this->getDbConnection(),$parameter, $result, $skip, $max); |
|
| 91 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
| 92 | + return $statement->executeQueryForList($this->getDbConnection(), $parameter, $result, $skip, $max); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function queryWithRowDelegate($statementName, $delegate, $parameter=null, $result=null, $skip=-1, $max=-1) |
| 111 | 111 | { |
| 112 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
| 112 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
| 113 | 113 | return $statement->executeQueryForList($this->getDbConnection(), $parameter, $result, $skip, $max, $delegate); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function queryForPagedList($statementName, $parameter=null, $pageSize=10, $page=0) |
| 127 | 127 | { |
| 128 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
| 128 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
| 129 | 129 | return new TSqlMapPagedList($statement, $parameter, $pageSize, null, $page); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -144,10 +144,10 @@ discard block |
||
| 144 | 144 | * @param integer The number of the page to initially load into the list. |
| 145 | 145 | * @return TPagedList A PaginatedList of beans containing the rows. |
| 146 | 146 | */ |
| 147 | - public function queryForPagedListWithRowDelegate($statementName,$delegate, $parameter=null, $pageSize=10, $page=0) |
|
| 147 | + public function queryForPagedListWithRowDelegate($statementName, $delegate, $parameter=null, $pageSize=10, $page=0) |
|
| 148 | 148 | { |
| 149 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
| 150 | - return new TSqlMapPagedList($statement, $parameter, $pageSize, $delegate,$page); |
|
| 149 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
| 150 | + return new TSqlMapPagedList($statement, $parameter, $pageSize, $delegate, $page); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public function queryForMap($statementName, $parameter=null, $keyProperty=null, $valueProperty=null, $skip=-1, $max=-1) |
| 167 | 167 | { |
| 168 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
| 168 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
| 169 | 169 | return $statement->executeQueryForMap($this->getDbConnection(), $parameter, $keyProperty, $valueProperty, $skip, $max); |
| 170 | 170 | } |
| 171 | 171 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | public function queryForMapWithRowDelegate($statementName, $delegate, $parameter=null, $keyProperty=null, $valueProperty=null, $skip=-1, $max=-1) |
| 186 | 186 | { |
| 187 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
| 187 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
| 188 | 188 | return $statement->executeQueryForMap($this->getDbConnection(), $parameter, $keyProperty, $valueProperty, $skip, $max, $delegate); |
| 189 | 189 | } |
| 190 | 190 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function insert($statementName, $parameter=null) |
| 208 | 208 | { |
| 209 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
| 209 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
| 210 | 210 | return $statement->executeInsert($this->getDbConnection(), $parameter); |
| 211 | 211 | } |
| 212 | 212 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | public function update($statementName, $parameter=null) |
| 227 | 227 | { |
| 228 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
| 228 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
| 229 | 229 | return $statement->executeUpdate($this->getDbConnection(), $parameter); |
| 230 | 230 | } |
| 231 | 231 | |
@@ -75,6 +75,6 @@ |
||
| 75 | 75 | * @param object The result object. |
| 76 | 76 | * @return object result. |
| 77 | 77 | */ |
| 78 | - public function executeQueryForObject($connection,$parameter, $result=null); |
|
| 78 | + public function executeQueryForObject($connection, $parameter, $result=null); |
|
| 79 | 79 | } |
| 80 | 80 | |
@@ -22,15 +22,15 @@ |
||
| 22 | 22 | |
| 23 | 23 | public function __construct($mappings) |
| 24 | 24 | { |
| 25 | - $this->_mappings = $mappings; |
|
| 25 | + $this->_mappings=$mappings; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public function replaceDynamicParameter($sql, $parameter) |
| 29 | 29 | { |
| 30 | 30 | foreach($this->_mappings as $property) |
| 31 | 31 | { |
| 32 | - $value = TPropertyAccess::get($parameter, $property); |
|
| 33 | - $sql = preg_replace('/'.TSimpleDynamicParser::DYNAMIC_TOKEN.'/', str_replace('$', '\$', $value), $sql, 1); |
|
| 32 | + $value=TPropertyAccess::get($parameter, $property); |
|
| 33 | + $sql=preg_replace('/'.TSimpleDynamicParser::DYNAMIC_TOKEN.'/', str_replace('$', '\$', $value), $sql, 1); |
|
| 34 | 34 | } |
| 35 | 35 | return $sql; |
| 36 | 36 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | public function __construct(TMappedStatement $statement) |
| 24 | 24 | { |
| 25 | - $this->_mappedStatement = $statement; |
|
| 25 | + $this->_mappedStatement=$statement; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public function getID() |
@@ -40,15 +40,15 @@ discard block |
||
| 40 | 40 | return $this->_mappedStatement->getManager(); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function executeQueryForMap($connection, $parameter,$keyProperty, $valueProperty=null, $skip=-1, $max=-1,$delegate=null) |
|
| 43 | + public function executeQueryForMap($connection, $parameter, $keyProperty, $valueProperty=null, $skip=-1, $max=-1, $delegate=null) |
|
| 44 | 44 | { |
| 45 | - $sql = $this->createCommand($connection, $parameter, $skip, $max); |
|
| 46 | - $key = $this->getCacheKey(array(clone($sql), $keyProperty, $valueProperty,$skip, $max)); |
|
| 47 | - $map = $this->getStatement()->getCache()->get($key); |
|
| 45 | + $sql=$this->createCommand($connection, $parameter, $skip, $max); |
|
| 46 | + $key=$this->getCacheKey(array(clone($sql), $keyProperty, $valueProperty, $skip, $max)); |
|
| 47 | + $map=$this->getStatement()->getCache()->get($key); |
|
| 48 | 48 | if($map===null) |
| 49 | 49 | { |
| 50 | - $map = $this->_mappedStatement->runQueryForMap( |
|
| 51 | - $connection, $parameter, $sql, $keyProperty, $valueProperty, $delegate); |
|
| 50 | + $map=$this->_mappedStatement->runQueryForMap( |
|
| 51 | + $connection, $parameter, $sql, $keyProperty, $valueProperty, $delegate); |
|
| 52 | 52 | $this->getStatement()->getCache()->set($key, $map); |
| 53 | 53 | } |
| 54 | 54 | return $map; |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | public function executeQueryForList($connection, $parameter, $result=null, $skip=-1, $max=-1, $delegate=null) |
| 68 | 68 | { |
| 69 | - $sql = $this->createCommand($connection, $parameter, $skip, $max); |
|
| 70 | - $key = $this->getCacheKey(array(clone($sql), $parameter, $skip, $max)); |
|
| 71 | - $list = $this->getStatement()->getCache()->get($key); |
|
| 69 | + $sql=$this->createCommand($connection, $parameter, $skip, $max); |
|
| 70 | + $key=$this->getCacheKey(array(clone($sql), $parameter, $skip, $max)); |
|
| 71 | + $list=$this->getStatement()->getCache()->get($key); |
|
| 72 | 72 | if($list===null) |
| 73 | 73 | { |
| 74 | - $list = $this->_mappedStatement->runQueryForList( |
|
| 74 | + $list=$this->_mappedStatement->runQueryForList( |
|
| 75 | 75 | $connection, $parameter, $sql, $result, $delegate); |
| 76 | 76 | $this->getStatement()->getCache()->set($key, $list); |
| 77 | 77 | } |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | public function executeQueryForObject($connection, $parameter, $result=null) |
| 82 | 82 | { |
| 83 | - $sql = $this->createCommand($connection, $parameter); |
|
| 84 | - $key = $this->getCacheKey(array(clone($sql), $parameter)); |
|
| 85 | - $object = $this->getStatement()->getCache()->get($key); |
|
| 83 | + $sql=$this->createCommand($connection, $parameter); |
|
| 84 | + $key=$this->getCacheKey(array(clone($sql), $parameter)); |
|
| 85 | + $object=$this->getStatement()->getCache()->get($key); |
|
| 86 | 86 | if($object===null) |
| 87 | 87 | { |
| 88 | - $object = $this->_mappedStatement->runQueryForObject($connection, $sql, $result); |
|
| 88 | + $object=$this->_mappedStatement->runQueryForObject($connection, $sql, $result); |
|
| 89 | 89 | $this->getStatement()->getCache()->set($key, $object); |
| 90 | 90 | } |
| 91 | 91 | return $object; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | protected function getCacheKey($object) |
| 95 | 95 | { |
| 96 | - $cacheKey = new TSqlMapCacheKey($object); |
|
| 96 | + $cacheKey=new TSqlMapCacheKey($object); |
|
| 97 | 97 | return $cacheKey->getHash(); |
| 98 | 98 | } |
| 99 | 99 | |