@@ -132,6 +132,7 @@ |
||
132 | 132 | |
133 | 133 | /** |
134 | 134 | * @param float rating value |
135 | + * @param double $rating |
|
135 | 136 | * @return int rating as integer |
136 | 137 | */ |
137 | 138 | protected function getRatingIndex($rating) |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
218 | - * @return string rating style css class name. |
|
218 | + * @return string rating style css class name. |
|
219 | 219 | */ |
220 | 220 | protected function getRatingStyleCssClass() |
221 | 221 | { |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
261 | - * @return string find the client ID of the caption control. |
|
261 | + * @return string find the client ID of the caption control. |
|
262 | 262 | */ |
263 | 263 | protected function getCaptionControlID() |
264 | 264 | { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | /** |
35 | 35 | * @var array list of published rating images. |
36 | 36 | */ |
37 | - private $_ratingImages = array(); |
|
37 | + private $_ratingImages=array(); |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Sets the default repeat direction to horizontal. |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function getReadOnly() |
52 | 52 | { |
53 | - return $this->getViewState('ReadOnly',false); |
|
53 | + return $this->getViewState('ReadOnly', false); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function setReadOnly($value) |
60 | 60 | { |
61 | - $this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false); |
|
61 | + $this->setViewState('ReadOnly', TPropertyValue::ensureBoolean($value), false); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function getRating() |
108 | 108 | { |
109 | - $rating = $this->getViewState('Rating', null); |
|
110 | - if ($rating === null) |
|
111 | - return $this->getSelectedIndex()+1; |
|
109 | + $rating=$this->getViewState('Rating', null); |
|
110 | + if($rating===null) |
|
111 | + return $this->getSelectedIndex() + 1; |
|
112 | 112 | else |
113 | 113 | return $rating; |
114 | 114 | } |
@@ -118,15 +118,15 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function setRating($value) |
120 | 120 | { |
121 | - $value = TPropertyValue::ensureFloat($value); |
|
121 | + $value=TPropertyValue::ensureFloat($value); |
|
122 | 122 | $this->setViewState('Rating', $value, null); |
123 | - $index = $this->getRatingIndex($value); |
|
123 | + $index=$this->getRatingIndex($value); |
|
124 | 124 | parent::setSelectedIndex($index); |
125 | 125 | } |
126 | 126 | |
127 | 127 | public function setSelectedIndex($value) |
128 | 128 | { |
129 | - $this->setRating($value+1); |
|
129 | + $this->setRating($value + 1); |
|
130 | 130 | parent::setSelectedIndex($value); |
131 | 131 | } |
132 | 132 | |
@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | */ |
137 | 137 | protected function getRatingIndex($rating) |
138 | 138 | { |
139 | - $interval = $this->getHalfRatingInterval(); |
|
140 | - $base = intval($rating)-1; |
|
141 | - $remainder = $rating-$base-1; |
|
142 | - return $remainder > $interval[1] ? $base+1 : $base; |
|
139 | + $interval=$this->getHalfRatingInterval(); |
|
140 | + $base=intval($rating) - 1; |
|
141 | + $remainder=$rating - $base - 1; |
|
142 | + return $remainder > $interval[1] ? $base + 1 : $base; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function onSelectedIndexChanged($param) |
149 | 149 | { |
150 | - $value = $this->getRating(); |
|
151 | - $value = TPropertyValue::ensureInteger($value); |
|
150 | + $value=$this->getRating(); |
|
151 | + $value=TPropertyValue::ensureInteger($value); |
|
152 | 152 | $this->setRating($value); |
153 | 153 | parent::onSelectedIndexChanged($param); |
154 | 154 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | return $control; |
180 | 180 | } |
181 | 181 | throw new TInvalidDataValueException( |
182 | - 'ratinglist_invalid_caption_id',$id,$this->getID()); |
|
182 | + 'ratinglist_invalid_caption_id', $id, $this->getID()); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -246,14 +246,14 @@ discard block |
||
246 | 246 | */ |
247 | 247 | protected function getPostBackOptions() |
248 | 248 | { |
249 | - $options = parent::getPostBackOptions(); |
|
250 | - $options['AutoPostBack'] = $this->getAutoPostBack(); |
|
251 | - $options['ReadOnly'] = $this->getReadOnly(); |
|
252 | - $options['Style'] = $this->getRatingStyleCssClass(); |
|
253 | - $options['CaptionID'] = $this->getCaptionControlID(); |
|
254 | - $options['SelectedIndex'] = $this->getSelectedIndex(); |
|
255 | - $options['Rating'] = $this->getRating(); |
|
256 | - $options['HalfRating'] = $this->getHalfRatingInterval(); |
|
249 | + $options=parent::getPostBackOptions(); |
|
250 | + $options['AutoPostBack']=$this->getAutoPostBack(); |
|
251 | + $options['ReadOnly']=$this->getReadOnly(); |
|
252 | + $options['Style']=$this->getRatingStyleCssClass(); |
|
253 | + $options['CaptionID']=$this->getCaptionControlID(); |
|
254 | + $options['SelectedIndex']=$this->getSelectedIndex(); |
|
255 | + $options['Rating']=$this->getRating(); |
|
256 | + $options['HalfRating']=$this->getHalfRatingInterval(); |
|
257 | 257 | return $options; |
258 | 258 | } |
259 | 259 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | { |
283 | 283 | parent::onPreRender($param); |
284 | 284 | $this->publishStyle($this->getRatingStyle()); |
285 | - $this->_ratingImages = $this->publishImages($this->getRatingStyle()); |
|
285 | + $this->_ratingImages=$this->publishImages($this->getRatingStyle()); |
|
286 | 286 | $this->registerClientScript(); |
287 | 287 | } |
288 | 288 | |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | */ |
293 | 293 | protected function publishStyle($style) |
294 | 294 | { |
295 | - $cs = $this->getPage()->getClientScript(); |
|
296 | - $url = $this->getAssetUrl($style.'.css'); |
|
295 | + $cs=$this->getPage()->getClientScript(); |
|
296 | + $url=$this->getAssetUrl($style.'.css'); |
|
297 | 297 | if(!$cs->isStyleSheetFileRegistered($url)) |
298 | 298 | $cs->registerStyleSheetFile($url, $url); |
299 | 299 | return $url; |
@@ -306,10 +306,10 @@ discard block |
||
306 | 306 | */ |
307 | 307 | protected function publishImages($style, $fileExt='.gif') |
308 | 308 | { |
309 | - $types = array('blank', 'selected', 'half', 'combined'); |
|
310 | - $files = array(); |
|
309 | + $types=array('blank', 'selected', 'half', 'combined'); |
|
310 | + $files=array(); |
|
311 | 311 | foreach($types as $type) |
312 | - $files[$type] = $this->getAssetUrl("{$style}_{$type}{$fileExt}"); |
|
312 | + $files[$type]=$this->getAssetUrl("{$style}_{$type}{$fileExt}"); |
|
313 | 313 | return $files; |
314 | 314 | } |
315 | 315 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | */ |
329 | 329 | protected function getAssetUrl($file='') |
330 | 330 | { |
331 | - $base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
|
331 | + $base=$this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
|
332 | 332 | return $base.'/'.self::SCRIPT_PATH.'/'.$file; |
333 | 333 | } |
334 | 334 | |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | */ |
341 | 341 | public function render($writer) |
342 | 342 | { |
343 | - $writer->addAttribute('id',$this->getClientID()); |
|
343 | + $writer->addAttribute('id', $this->getClientID()); |
|
344 | 344 | $this->getPage()->getClientScript()->registerPostBackControl( |
345 | 345 | $this->getClientClassName(), $this->getPostBackOptions()); |
346 | 346 | parent::render($writer); |
@@ -158,8 +158,7 @@ |
||
158 | 158 | $e->setAttribute('maxOccurs','unbounded'); |
159 | 159 | $sequence->appendChild($e); |
160 | 160 | $complexType->appendChild($sequence); |
161 | - } |
|
162 | - else |
|
161 | + } else |
|
163 | 162 | { |
164 | 163 | $all = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:all'); |
165 | 164 | foreach($elements as $elem) |
@@ -179,7 +179,7 @@ |
||
179 | 179 | * Returns the value of the TSlider control. |
180 | 180 | * This method is required by {@link IDataRenderer}. |
181 | 181 | * It is the same as {@link getValue()}. |
182 | - * @return string the value of the TSlider control. |
|
182 | + * @return double the value of the TSlider control. |
|
183 | 183 | * @see getValue |
184 | 184 | */ |
185 | 185 | public function getData() |
@@ -189,8 +189,7 @@ discard block |
||
189 | 189 | return file_put_contents($fileName,file_get_contents($this->_localName))!==false; |
190 | 190 | else |
191 | 191 | return false; |
192 | - } |
|
193 | - else |
|
192 | + } else |
|
194 | 193 | return false; |
195 | 194 | } |
196 | 195 | |
@@ -211,8 +210,7 @@ discard block |
||
211 | 210 | $this->_errorCode=$_FILES[$key]['error']; |
212 | 211 | $this->_localName=$_FILES[$key]['tmp_name']; |
213 | 212 | return $this->_dataChanged=true; |
214 | - } |
|
215 | - else |
|
213 | + } else |
|
216 | 214 | return false; |
217 | 215 | } |
218 | 216 |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function setDirection($value) |
78 | 78 | { |
79 | - $this->setViewState('Direction', TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TSliderDirection'),TSliderDirection::Horizontal); |
|
79 | + $this->setViewState('Direction', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TSliderDirection'), TSliderDirection::Horizontal); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function getCssUrl() |
86 | 86 | { |
87 | - return $this->getViewState('CssUrl',''); |
|
87 | + return $this->getViewState('CssUrl', ''); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function setCssUrl($value) |
94 | 94 | { |
95 | - $this->setViewState('CssUrl',TPropertyValue::ensureString($value),''); |
|
95 | + $this->setViewState('CssUrl', TPropertyValue::ensureString($value), ''); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function getMaxValue() |
102 | 102 | { |
103 | - return $this->getViewState('MaxValue',100.0); |
|
103 | + return $this->getViewState('MaxValue', 100.0); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function setMaxValue($value) |
110 | 110 | { |
111 | - $this->setViewState('MaxValue', TPropertyValue::ensureFloat($value),100.0); |
|
111 | + $this->setViewState('MaxValue', TPropertyValue::ensureFloat($value), 100.0); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function getMinValue() |
118 | 118 | { |
119 | - return $this->getViewState('MinValue',0.0); |
|
119 | + return $this->getViewState('MinValue', 0.0); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function setMinValue($value) |
126 | 126 | { |
127 | - $this->setViewState('MinValue', TPropertyValue::ensureFloat($value),0.0); |
|
127 | + $this->setViewState('MinValue', TPropertyValue::ensureFloat($value), 0.0); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | /** |
151 | 151 | * @return boolean wether to display a progress indicator or not. Defaults to true. |
152 | 152 | */ |
153 | - public function getProgressIndicator () |
|
153 | + public function getProgressIndicator() |
|
154 | 154 | { |
155 | 155 | return $this->getViewState('ProgressIndicator', true); |
156 | 156 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | /** |
159 | 159 | * @param boolean wether to display a progress indicator or not. Defaults to true. |
160 | 160 | */ |
161 | - public function setProgressIndicator ($value) |
|
161 | + public function setProgressIndicator($value) |
|
162 | 162 | { |
163 | 163 | $this->setViewState('ProgressIndicator', TPropertyValue::ensureBoolean($value), true); |
164 | 164 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function getValue() |
169 | 169 | { |
170 | - return $this->getViewState('Value',0.0); |
|
170 | + return $this->getViewState('Value', 0.0); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function setValue($value) |
177 | 177 | { |
178 | - $this->setViewState('Value', TPropertyValue::ensureFloat($value),0.0); |
|
178 | + $this->setViewState('Value', TPropertyValue::ensureFloat($value), 0.0); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function getAutoPostBack() |
229 | 229 | { |
230 | - return $this->getViewState('AutoPostBack',false); |
|
230 | + return $this->getViewState('AutoPostBack', false); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public function setAutoPostBack($value) |
240 | 240 | { |
241 | - $this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),false); |
|
241 | + $this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), false); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | */ |
284 | 284 | public function onValueChanged($param) |
285 | 285 | { |
286 | - $this->raiseEvent('OnValueChanged',$this,$param); |
|
286 | + $this->raiseEvent('OnValueChanged', $this, $param); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | /** |
@@ -293,9 +293,9 @@ discard block |
||
293 | 293 | * @param array the input data collection |
294 | 294 | * @return boolean whether the data of the component has been changed |
295 | 295 | */ |
296 | - public function loadPostData($key,$values) |
|
296 | + public function loadPostData($key, $values) |
|
297 | 297 | { |
298 | - $value=(float)$values[$this->getClientID().'_1']; |
|
298 | + $value=(float) $values[$this->getClientID().'_1']; |
|
299 | 299 | if($this->getValue()!==$value) |
300 | 300 | { |
301 | 301 | $this->setValue($value); |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | public function getClientSide() |
320 | 320 | { |
321 | 321 | if($this->_clientScript===null) |
322 | - $this->_clientScript = $this->createClientScript(); |
|
322 | + $this->_clientScript=$this->createClientScript(); |
|
323 | 323 | return $this->_clientScript; |
324 | 324 | } |
325 | 325 | |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | /** |
335 | 335 | * @return string the HTML tag name for slider. Defaults to div. |
336 | 336 | */ |
337 | - public function getTagName () |
|
337 | + public function getTagName() |
|
338 | 338 | { |
339 | 339 | return "div"; |
340 | 340 | } |
@@ -346,10 +346,10 @@ discard block |
||
346 | 346 | protected function addAttributesToRender($writer) |
347 | 347 | { |
348 | 348 | parent::addAttributesToRender($writer); |
349 | - $writer->addAttribute('id',$this->getClientID()); |
|
350 | - if ($this->getCssClass()==='') |
|
349 | + $writer->addAttribute('id', $this->getClientID()); |
|
350 | + if($this->getCssClass()==='') |
|
351 | 351 | { |
352 | - $class=($this->getDirection()==TSliderDirection::Horizontal)?'HorizontalSlider':'VerticalSlider'; |
|
352 | + $class=($this->getDirection()==TSliderDirection::Horizontal) ? 'HorizontalSlider' : 'VerticalSlider'; |
|
353 | 353 | $writer->addAttribute('class', 'Slider '.$class); |
354 | 354 | } |
355 | 355 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | $writer->addAttribute('id', $this->getClientID().'_track'); |
366 | 366 | $writer->renderBeginTag('div'); |
367 | 367 | // Render the 'Progress Indicator' |
368 | - if ($this->getProgressIndicator()) |
|
368 | + if($this->getProgressIndicator()) |
|
369 | 369 | { |
370 | 370 | $writer->addAttribute('class', 'Progress'); |
371 | 371 | $writer->addAttribute('id', $this->getClientID().'_progress'); |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | * This method is invoked right before the control rendering, if the control is visible. |
403 | 403 | * @param mixed event parameter |
404 | 404 | */ |
405 | - public function onPreRender ($param) |
|
405 | + public function onPreRender($param) |
|
406 | 406 | { |
407 | 407 | parent::onPreRender($param); |
408 | 408 | $this->registerStyleSheet(); |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | $url=$manager->publishFilePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'TSlider'); |
425 | 425 | $url.='/TSlider.css'; |
426 | 426 | } |
427 | - $this->getPage()->getClientScript()->registerStyleSheetFile($url,$url); |
|
427 | + $this->getPage()->getClientScript()->registerStyleSheetFile($url, $url); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | /** |
@@ -433,12 +433,12 @@ discard block |
||
433 | 433 | protected function registerSliderClientScript() |
434 | 434 | { |
435 | 435 | $page=$this->getPage(); |
436 | - $cs = $page->getClientScript(); |
|
436 | + $cs=$page->getClientScript(); |
|
437 | 437 | $cs->registerPradoScript("slider"); |
438 | 438 | $id=$this->getClientID(); |
439 | - $cs->registerHiddenField($id.'_1',$this->getValue()); |
|
439 | + $cs->registerHiddenField($id.'_1', $this->getValue()); |
|
440 | 440 | $page->registerRequiresPostData($this); |
441 | - $cs->registerPostBackControl($this->getClientClassName(),$this->getSliderOptions()); |
|
441 | + $cs->registerPostBackControl($this->getClientClassName(), $this->getSliderOptions()); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | /** |
@@ -448,30 +448,30 @@ discard block |
||
448 | 448 | protected function getSliderOptions() |
449 | 449 | { |
450 | 450 | // PostBack Options : |
451 | - $options['ID'] = $this->getClientID(); |
|
452 | - $options['EventTarget'] = $this->getUniqueID(); |
|
453 | - $options['AutoPostBack'] = $this->getAutoPostBack(); |
|
451 | + $options['ID']=$this->getClientID(); |
|
452 | + $options['EventTarget']=$this->getUniqueID(); |
|
453 | + $options['AutoPostBack']=$this->getAutoPostBack(); |
|
454 | 454 | |
455 | 455 | // Slider Control options |
456 | 456 | $minValue=$this->getMinValue(); |
457 | 457 | $maxValue=$this->getMaxValue(); |
458 | - $options['axis'] = strtolower($this->getDirection()); |
|
459 | - $options['maximum'] = $maxValue; |
|
460 | - $options['minimum'] = $minValue; |
|
461 | - $options['range'] = array($minValue, $maxValue); |
|
462 | - $options['sliderValue'] = $this->getValue(); |
|
463 | - $options['disabled'] = !$this->getEnabled(); |
|
458 | + $options['axis']=strtolower($this->getDirection()); |
|
459 | + $options['maximum']=$maxValue; |
|
460 | + $options['minimum']=$minValue; |
|
461 | + $options['range']=array($minValue, $maxValue); |
|
462 | + $options['sliderValue']=$this->getValue(); |
|
463 | + $options['disabled']=!$this->getEnabled(); |
|
464 | 464 | $values=$this->getValues(); |
465 | - if (!empty($values)) |
|
465 | + if(!empty($values)) |
|
466 | 466 | { |
467 | 467 | // Values are provided. Check if min/max are present in them |
468 | - if (!in_array($minValue, $values)) $values[]=$minValue; |
|
469 | - if (!in_array($maxValue, $values)) $values[]=$maxValue; |
|
468 | + if(!in_array($minValue, $values)) $values[]=$minValue; |
|
469 | + if(!in_array($maxValue, $values)) $values[]=$maxValue; |
|
470 | 470 | // Remove all values outsize the range [min..max] |
471 | - foreach ($values as $idx=>$value) |
|
471 | + foreach($values as $idx=>$value) |
|
472 | 472 | { |
473 | - if ($value < $minValue) unset ($values[$idx]); |
|
474 | - if ($value > $maxValue) unset ($values[$idx]); |
|
473 | + if($value < $minValue) unset ($values[$idx]); |
|
474 | + if($value > $maxValue) unset ($values[$idx]); |
|
475 | 475 | } |
476 | 476 | } |
477 | 477 | else |
@@ -479,19 +479,19 @@ discard block |
||
479 | 479 | // Values are not provided, generate automatically using stepsize |
480 | 480 | $step=$this->getStepSize(); |
481 | 481 | // We want at most self::MAX_STEPS values, so, change the step if necessary |
482 | - if (($maxValue-$minValue)/$step > self::MAX_STEPS) |
|
482 | + if(($maxValue - $minValue) / $step > self::MAX_STEPS) |
|
483 | 483 | { |
484 | - $step=($maxValue-$minValue)/self::MAX_STEPS; |
|
484 | + $step=($maxValue - $minValue) / self::MAX_STEPS; |
|
485 | 485 | } |
486 | 486 | $values=array(); |
487 | - for ($i=$minValue;$i<=$maxValue;$i+=$step) |
|
487 | + for($i=$minValue; $i <= $maxValue; $i+=$step) |
|
488 | 488 | $values[]=$i; |
489 | 489 | // Add max if it's not in the array because of step |
490 | - if (!in_array($maxValue, $values)) $values[]=$maxValue; |
|
490 | + if(!in_array($maxValue, $values)) $values[]=$maxValue; |
|
491 | 491 | } |
492 | - $options['values'] = $values; |
|
492 | + $options['values']=$values; |
|
493 | 493 | if($this->_clientScript!==null) |
494 | - $options = array_merge($options,$this->_clientScript->getOptions()->toArray()); |
|
494 | + $options=array_merge($options, $this->_clientScript->getOptions()->toArray()); |
|
495 | 495 | return $options; |
496 | 496 | } |
497 | 497 | } |
498 | 498 | \ No newline at end of file |
@@ -144,6 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | /** |
146 | 146 | * @param string table caption |
147 | + * @param string $value |
|
147 | 148 | */ |
148 | 149 | public function setCaption($value) |
149 | 150 | { |
@@ -160,6 +161,7 @@ discard block |
||
160 | 161 | |
161 | 162 | /** |
162 | 163 | * @param TTableCaptionAlign table caption alignment. |
164 | + * @param TTableCaptionAlign $value |
|
163 | 165 | */ |
164 | 166 | public function setCaptionAlign($value) |
165 | 167 | { |
@@ -306,8 +306,7 @@ discard block |
||
306 | 306 | { |
307 | 307 | if($index===0 && $currentSection===TTableRowSection::Header) |
308 | 308 | $writer->renderBeginTag('thead'); |
309 | - } |
|
310 | - else |
|
309 | + } else |
|
311 | 310 | { |
312 | 311 | if($currentSection===TTableRowSection::Header) |
313 | 312 | { |
@@ -318,8 +317,7 @@ discard block |
||
318 | 317 | else |
319 | 318 | $writer->renderBeginTag('tfoot'); |
320 | 319 | $currentSection=$section; |
321 | - } |
|
322 | - else if($currentSection===TTableRowSection::Body) |
|
320 | + } else if($currentSection===TTableRowSection::Body) |
|
323 | 321 | { |
324 | 322 | $writer->renderEndTag(); |
325 | 323 | if($section===TTableRowSection::Footer) |
@@ -327,16 +325,14 @@ discard block |
||
327 | 325 | else |
328 | 326 | throw new TConfigurationException('table_tablesection_outoforder'); |
329 | 327 | $currentSection=$section; |
330 | - } |
|
331 | - else // Footer |
|
328 | + } else // Footer |
|
332 | 329 | throw new TConfigurationException('table_tablesection_outoforder'); |
333 | 330 | } |
334 | 331 | $row->renderControl($writer); |
335 | 332 | $writer->writeLine(); |
336 | 333 | } |
337 | 334 | $writer->renderEndTag(); |
338 | - } |
|
339 | - else |
|
335 | + } else |
|
340 | 336 | { |
341 | 337 | $writer->writeLine(); |
342 | 338 | foreach($this->getControls() as $row) |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | if(($border=$this->getBorderWidth())==='') |
110 | 110 | $border=1; |
111 | 111 | else |
112 | - $border=(int)$border; |
|
112 | + $border=(int) $border; |
|
113 | 113 | } |
114 | 114 | } |
115 | - $writer->addAttribute('border',"$border"); |
|
115 | + $writer->addAttribute('border', "$border"); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function getCaption() |
140 | 140 | { |
141 | - return $this->getViewState('Caption',''); |
|
141 | + return $this->getViewState('Caption', ''); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function setCaption($value) |
148 | 148 | { |
149 | - $this->setViewState('Caption',$value,''); |
|
149 | + $this->setViewState('Caption', $value, ''); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function getCaptionAlign() |
156 | 156 | { |
157 | - return $this->getViewState('CaptionAlign',TTableCaptionAlign::NotSet); |
|
157 | + return $this->getViewState('CaptionAlign', TTableCaptionAlign::NotSet); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function setCaptionAlign($value) |
164 | 164 | { |
165 | - $this->setViewState('CaptionAlign',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TTableCaptionAlign'),TTableCaptionAlign::NotSet); |
|
165 | + $this->setViewState('CaptionAlign', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TTableCaptionAlign'), TTableCaptionAlign::NotSet); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | if(($caption=$this->getCaption())!=='') |
272 | 272 | { |
273 | 273 | if(($align=$this->getCaptionAlign())!==TTableCaptionAlign::NotSet) |
274 | - $writer->addAttribute('align',strtolower($align)); |
|
274 | + $writer->addAttribute('align', strtolower($align)); |
|
275 | 275 | $writer->renderBeginTag('caption'); |
276 | 276 | $writer->write($caption); |
277 | 277 | $writer->renderEndTag(); |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | { |
311 | 311 | if($currentSection===TTableRowSection::Header) |
312 | 312 | { |
313 | - if($index>0) |
|
313 | + if($index > 0) |
|
314 | 314 | $writer->renderEndTag(); |
315 | 315 | if($section===TTableRowSection::Body) |
316 | 316 | $writer->renderBeginTag('tbody'); |
@@ -118,7 +118,7 @@ |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
121 | - * @return ITemplate the item template |
|
121 | + * @return string the item template |
|
122 | 122 | */ |
123 | 123 | public function getItemTemplate() |
124 | 124 | { |
@@ -197,8 +197,7 @@ discard block |
||
197 | 197 | $classPath=$this->getItemRenderer(); |
198 | 198 | $template=$this->_itemTemplate; |
199 | 199 | } |
200 | - } |
|
201 | - else |
|
200 | + } else |
|
202 | 201 | { |
203 | 202 | $template=$this->_itemTemplate; |
204 | 203 | $classPath=$this->getItemRenderer(); |
@@ -214,13 +213,11 @@ discard block |
||
214 | 213 | } |
215 | 214 | if($control instanceof IDataRenderer) |
216 | 215 | $control->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
217 | - } |
|
218 | - else if($template!==null) |
|
216 | + } else if($template!==null) |
|
219 | 217 | $template->instantiateIn($cell); |
220 | 218 | else if($itemType!==TListItemType::EditItem) |
221 | 219 | $cell->setText(' '); |
222 | - } |
|
223 | - else if($itemType===TListItemType::Header) |
|
220 | + } else if($itemType===TListItemType::Header) |
|
224 | 221 | { |
225 | 222 | if(($classPath=$this->getHeaderRenderer())!=='') |
226 | 223 | $this->initializeHeaderCell($cell,$columnIndex); |
@@ -228,8 +225,7 @@ discard block |
||
228 | 225 | $this->_headerTemplate->instantiateIn($cell); |
229 | 226 | else |
230 | 227 | $this->initializeHeaderCell($cell,$columnIndex); |
231 | - } |
|
232 | - else if($itemType===TListItemType::Footer) |
|
228 | + } else if($itemType===TListItemType::Footer) |
|
233 | 229 | { |
234 | 230 | if(($classPath=$this->getFooterRenderer())!=='') |
235 | 231 | $this->initializeFooterCell($cell,$columnIndex); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function getItemRenderer() |
55 | 55 | { |
56 | - return $this->getViewState('ItemRenderer',''); |
|
56 | + return $this->getViewState('ItemRenderer', ''); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function setItemRenderer($value) |
71 | 71 | { |
72 | - $this->setViewState('ItemRenderer',$value,''); |
|
72 | + $this->setViewState('ItemRenderer', $value, ''); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function getEditItemRenderer() |
80 | 80 | { |
81 | - return $this->getViewState('EditItemRenderer',''); |
|
81 | + return $this->getViewState('EditItemRenderer', ''); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function setEditItemRenderer($value) |
96 | 96 | { |
97 | - $this->setViewState('EditItemRenderer',$value,''); |
|
97 | + $this->setViewState('EditItemRenderer', $value, ''); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | if($value instanceof ITemplate || $value===null) |
115 | 115 | $this->_editItemTemplate=$value; |
116 | 116 | else |
117 | - throw new TInvalidDataTypeException('templatecolumn_template_required','EditItemTemplate'); |
|
117 | + throw new TInvalidDataTypeException('templatecolumn_template_required', 'EditItemTemplate'); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | if($value instanceof ITemplate || $value===null) |
135 | 135 | $this->_itemTemplate=$value; |
136 | 136 | else |
137 | - throw new TInvalidDataTypeException('templatecolumn_template_required','ItemTemplate'); |
|
137 | + throw new TInvalidDataTypeException('templatecolumn_template_required', 'ItemTemplate'); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | if($value instanceof ITemplate || $value===null) |
155 | 155 | $this->_headerTemplate=$value; |
156 | 156 | else |
157 | - throw new TInvalidDataTypeException('templatecolumn_template_required','HeaderTemplate'); |
|
157 | + throw new TInvalidDataTypeException('templatecolumn_template_required', 'HeaderTemplate'); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | if($value instanceof ITemplate || $value===null) |
175 | 175 | $this->_footerTemplate=$value; |
176 | 176 | else |
177 | - throw new TInvalidDataTypeException('templatecolumn_template_required','FooterTemplate'); |
|
177 | + throw new TInvalidDataTypeException('templatecolumn_template_required', 'FooterTemplate'); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @param integer the index to the Columns property that the cell resides in. |
187 | 187 | * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem) |
188 | 188 | */ |
189 | - public function initializeCell($cell,$columnIndex,$itemType) |
|
189 | + public function initializeCell($cell, $columnIndex, $itemType) |
|
190 | 190 | { |
191 | 191 | if($itemType===TListItemType::Item || $itemType===TListItemType::AlternatingItem || $itemType===TListItemType::SelectedItem || $itemType===TListItemType::EditItem) |
192 | 192 | { |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $control->setItemType($itemType); |
214 | 214 | } |
215 | 215 | if($control instanceof IDataRenderer) |
216 | - $control->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
|
216 | + $control->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn')); |
|
217 | 217 | } |
218 | 218 | else if($template!==null) |
219 | 219 | $template->instantiateIn($cell); |
@@ -223,20 +223,20 @@ discard block |
||
223 | 223 | else if($itemType===TListItemType::Header) |
224 | 224 | { |
225 | 225 | if(($classPath=$this->getHeaderRenderer())!=='') |
226 | - $this->initializeHeaderCell($cell,$columnIndex); |
|
226 | + $this->initializeHeaderCell($cell, $columnIndex); |
|
227 | 227 | else if($this->_headerTemplate!==null) |
228 | 228 | $this->_headerTemplate->instantiateIn($cell); |
229 | 229 | else |
230 | - $this->initializeHeaderCell($cell,$columnIndex); |
|
230 | + $this->initializeHeaderCell($cell, $columnIndex); |
|
231 | 231 | } |
232 | 232 | else if($itemType===TListItemType::Footer) |
233 | 233 | { |
234 | 234 | if(($classPath=$this->getFooterRenderer())!=='') |
235 | - $this->initializeFooterCell($cell,$columnIndex); |
|
235 | + $this->initializeFooterCell($cell, $columnIndex); |
|
236 | 236 | else if($this->_footerTemplate!==null) |
237 | 237 | $this->_footerTemplate->instantiateIn($cell); |
238 | 238 | else |
239 | - $this->initializeFooterCell($cell,$columnIndex); |
|
239 | + $this->initializeFooterCell($cell, $columnIndex); |
|
240 | 240 | } |
241 | 241 | } |
242 | 242 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * This method is invoked when datagrid performs databinding. |
246 | 246 | * It populates the content of the cell with the relevant data from data source. |
247 | 247 | */ |
248 | - public function dataBindColumn($sender,$param) |
|
248 | + public function dataBindColumn($sender, $param) |
|
249 | 249 | { |
250 | 250 | $item=$sender->getNamingContainer(); |
251 | 251 | $sender->setData($item->getData()); |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | /** |
238 | 238 | * Returns the value to be validated. |
239 | 239 | * This methid is required by IValidatable interface. |
240 | - * @return mixed the value of the property to be validated. |
|
240 | + * @return string the value of the property to be validated. |
|
241 | 241 | */ |
242 | 242 | public function getValidationPropertyValue() |
243 | 243 | { |
@@ -342,6 +342,7 @@ discard block |
||
342 | 342 | * An automatic postback to the server will occur whenever the user |
343 | 343 | * modifies the text in the TTextBox control and then tabs out of the component. |
344 | 344 | * @param boolean the value indicating if postback automatically |
345 | + * @param boolean $value |
|
345 | 346 | */ |
346 | 347 | public function setAutoPostBack($value) |
347 | 348 | { |
@@ -425,6 +426,7 @@ discard block |
||
425 | 426 | |
426 | 427 | /** |
427 | 428 | * @param boolean whether the textbox is read only |
429 | + * @param boolean $value |
|
428 | 430 | */ |
429 | 431 | public function setReadOnly($value) |
430 | 432 | { |
@@ -251,14 +251,14 @@ discard block |
||
251 | 251 | */ |
252 | 252 | public function getIsValid() |
253 | 253 | { |
254 | - return $this->_isValid; |
|
254 | + return $this->_isValid; |
|
255 | 255 | } |
256 | 256 | /** |
257 | 257 | * @param bool wether this control is valid. |
258 | 258 | */ |
259 | 259 | public function setIsValid($value) |
260 | 260 | { |
261 | - $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
261 | + $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | /** |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | |
330 | 330 | /** |
331 | 331 | * @return boolean a value indicating whether an automatic postback to the server |
332 | - * will occur whenever the user modifies the text in the TTextBox control and |
|
333 | - * then tabs out of the component. Defaults to false. |
|
332 | + * will occur whenever the user modifies the text in the TTextBox control and |
|
333 | + * then tabs out of the component. Defaults to false. |
|
334 | 334 | */ |
335 | 335 | public function getAutoPostBack() |
336 | 336 | { |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | protected function getTagName() |
76 | 76 | { |
77 | - return ($this->getTextMode()==='MultiLine')?'textarea':'input'; |
|
77 | + return ($this->getTextMode()==='MultiLine') ? 'textarea' : 'input'; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function getEnableClientScript() |
84 | 84 | { |
85 | - return $this->getViewState('EnableClientScript',true); |
|
85 | + return $this->getViewState('EnableClientScript', true); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function setEnableClientScript($value) |
92 | 92 | { |
93 | - $this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true); |
|
93 | + $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -103,106 +103,106 @@ discard block |
||
103 | 103 | $page=$this->getPage(); |
104 | 104 | $page->ensureRenderInForm($this); |
105 | 105 | if(($uid=$this->getUniqueID())!=='') |
106 | - $writer->addAttribute('name',$uid); |
|
106 | + $writer->addAttribute('name', $uid); |
|
107 | 107 | if(($textMode=$this->getTextMode())===TTextBoxMode::MultiLine) |
108 | 108 | { |
109 | - if(($rows=$this->getRows())<=0) |
|
109 | + if(($rows=$this->getRows()) <= 0) |
|
110 | 110 | $rows=self::DEFAULT_ROWS; |
111 | - if(($cols=$this->getColumns())<=0) |
|
111 | + if(($cols=$this->getColumns()) <= 0) |
|
112 | 112 | $cols=self::DEFAULT_COLUMNS; |
113 | - $writer->addAttribute('rows',"$rows"); |
|
114 | - $writer->addAttribute('cols',"$cols"); |
|
113 | + $writer->addAttribute('rows', "$rows"); |
|
114 | + $writer->addAttribute('cols', "$cols"); |
|
115 | 115 | if(!$this->getWrap()) |
116 | - $writer->addAttribute('wrap','off'); |
|
116 | + $writer->addAttribute('wrap', 'off'); |
|
117 | 117 | } |
118 | 118 | else |
119 | 119 | { |
120 | 120 | switch($textMode) |
121 | 121 | { |
122 | 122 | case TTextBoxMode::Password: |
123 | - $writer->addAttribute('type','password'); |
|
123 | + $writer->addAttribute('type', 'password'); |
|
124 | 124 | break; |
125 | 125 | case TTextBoxMode::Color: |
126 | - $writer->addAttribute('type','color'); |
|
126 | + $writer->addAttribute('type', 'color'); |
|
127 | 127 | break; |
128 | 128 | case TTextBoxMode::Date: |
129 | - $writer->addAttribute('type','date'); |
|
129 | + $writer->addAttribute('type', 'date'); |
|
130 | 130 | break; |
131 | 131 | case TTextBoxMode::Datetime: |
132 | - $writer->addAttribute('type','datetime'); |
|
132 | + $writer->addAttribute('type', 'datetime'); |
|
133 | 133 | break; |
134 | 134 | case TTextBoxMode::DatetimeLocal: |
135 | - $writer->addAttribute('type','datetime-local'); |
|
135 | + $writer->addAttribute('type', 'datetime-local'); |
|
136 | 136 | break; |
137 | 137 | case TTextBoxMode::Email: |
138 | - $writer->addAttribute('type','email'); |
|
138 | + $writer->addAttribute('type', 'email'); |
|
139 | 139 | break; |
140 | 140 | case TTextBoxMode::Month: |
141 | - $writer->addAttribute('type','month'); |
|
141 | + $writer->addAttribute('type', 'month'); |
|
142 | 142 | break; |
143 | 143 | case TTextBoxMode::Number: |
144 | - $writer->addAttribute('type','number'); |
|
144 | + $writer->addAttribute('type', 'number'); |
|
145 | 145 | break; |
146 | 146 | case TTextBoxMode::Range: |
147 | - $writer->addAttribute('type','range'); |
|
147 | + $writer->addAttribute('type', 'range'); |
|
148 | 148 | break; |
149 | 149 | case TTextBoxMode::Search: |
150 | - $writer->addAttribute('type','search'); |
|
150 | + $writer->addAttribute('type', 'search'); |
|
151 | 151 | break; |
152 | 152 | case TTextBoxMode::Tel: |
153 | - $writer->addAttribute('type','tel'); |
|
153 | + $writer->addAttribute('type', 'tel'); |
|
154 | 154 | break; |
155 | 155 | case TTextBoxMode::Time: |
156 | - $writer->addAttribute('type','time'); |
|
156 | + $writer->addAttribute('type', 'time'); |
|
157 | 157 | break; |
158 | 158 | case TTextBoxMode::Url: |
159 | - $writer->addAttribute('type','url'); |
|
159 | + $writer->addAttribute('type', 'url'); |
|
160 | 160 | break; |
161 | 161 | case TTextBoxMode::Week: |
162 | - $writer->addAttribute('type','week'); |
|
162 | + $writer->addAttribute('type', 'week'); |
|
163 | 163 | break; |
164 | 164 | case TTextBoxMode::SingleLine: |
165 | 165 | default: |
166 | - $writer->addAttribute('type','text'); |
|
166 | + $writer->addAttribute('type', 'text'); |
|
167 | 167 | break; |
168 | 168 | } |
169 | 169 | |
170 | - if(($text=$this->getText())!=='' && ($textMode !== TTextBoxMode::Password || $this->getPersistPassword())) |
|
171 | - $writer->addAttribute('value',$text); |
|
170 | + if(($text=$this->getText())!=='' && ($textMode!==TTextBoxMode::Password || $this->getPersistPassword())) |
|
171 | + $writer->addAttribute('value', $text); |
|
172 | 172 | |
173 | 173 | if(($act=$this->getAutoCompleteType())!=='None') |
174 | 174 | { |
175 | 175 | if($act==='Disabled') |
176 | - $writer->addAttribute('autocomplete','off'); |
|
176 | + $writer->addAttribute('autocomplete', 'off'); |
|
177 | 177 | else if($act==='Search') |
178 | - $writer->addAttribute('vcard_name','search'); |
|
178 | + $writer->addAttribute('vcard_name', 'search'); |
|
179 | 179 | else if($act==='HomeCountryRegion') |
180 | - $writer->addAttribute('vcard_name','HomeCountry'); |
|
180 | + $writer->addAttribute('vcard_name', 'HomeCountry'); |
|
181 | 181 | else if($act==='BusinessCountryRegion') |
182 | - $writer->addAttribute('vcard_name','BusinessCountry'); |
|
182 | + $writer->addAttribute('vcard_name', 'BusinessCountry'); |
|
183 | 183 | else |
184 | 184 | { |
185 | - if(strpos($act,'Business')===0) |
|
186 | - $act='Business'.'.'.substr($act,8); |
|
187 | - else if(strpos($act,'Home')===0) |
|
188 | - $act='Home'.'.'.substr($act,4); |
|
189 | - $writer->addAttribute('vcard_name','vCard.'.$act); |
|
185 | + if(strpos($act, 'Business')===0) |
|
186 | + $act='Business'.'.'.substr($act, 8); |
|
187 | + else if(strpos($act, 'Home')===0) |
|
188 | + $act='Home'.'.'.substr($act, 4); |
|
189 | + $writer->addAttribute('vcard_name', 'vCard.'.$act); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
193 | - if(($cols=$this->getColumns())>0) |
|
194 | - $writer->addAttribute('size',"$cols"); |
|
195 | - if(($maxLength=$this->getMaxLength())>0) |
|
196 | - $writer->addAttribute('maxlength',"$maxLength"); |
|
193 | + if(($cols=$this->getColumns()) > 0) |
|
194 | + $writer->addAttribute('size', "$cols"); |
|
195 | + if(($maxLength=$this->getMaxLength()) > 0) |
|
196 | + $writer->addAttribute('maxlength', "$maxLength"); |
|
197 | 197 | } |
198 | 198 | if($this->getReadOnly()) |
199 | - $writer->addAttribute('readonly','readonly'); |
|
199 | + $writer->addAttribute('readonly', 'readonly'); |
|
200 | 200 | $isEnabled=$this->getEnabled(true); |
201 | 201 | if(!$isEnabled && $this->getEnabled()) // in this case parent will not render 'disabled' |
202 | - $writer->addAttribute('disabled','disabled'); |
|
202 | + $writer->addAttribute('disabled', 'disabled'); |
|
203 | 203 | if($isEnabled |
204 | 204 | && $this->getEnableClientScript() |
205 | - && ( $this->getAutoPostBack() || $textMode===TTextBoxMode::SingleLine) |
|
205 | + && ($this->getAutoPostBack() || $textMode===TTextBoxMode::SingleLine) |
|
206 | 206 | && $page->getClientSupportsJavaScript()) |
207 | 207 | { |
208 | 208 | $this->renderClientControlScript($writer); |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | */ |
216 | 216 | protected function renderClientControlScript($writer) |
217 | 217 | { |
218 | - $writer->addAttribute('id',$this->getClientID()); |
|
219 | - $cs = $this->getPage()->getClientScript(); |
|
220 | - $cs->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions()); |
|
218 | + $writer->addAttribute('id', $this->getClientID()); |
|
219 | + $cs=$this->getPage()->getClientScript(); |
|
220 | + $cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -236,12 +236,12 @@ discard block |
||
236 | 236 | */ |
237 | 237 | protected function getPostBackOptions() |
238 | 238 | { |
239 | - $options['ID'] = $this->getClientID(); |
|
240 | - $options['EventTarget'] = $this->getUniqueID(); |
|
241 | - $options['AutoPostBack'] = $this->getAutoPostBack(); |
|
242 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
243 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
244 | - $options['TextMode'] = $this->getTextMode(); |
|
239 | + $options['ID']=$this->getClientID(); |
|
240 | + $options['EventTarget']=$this->getUniqueID(); |
|
241 | + $options['AutoPostBack']=$this->getAutoPostBack(); |
|
242 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
243 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
244 | + $options['TextMode']=$this->getTextMode(); |
|
245 | 245 | return $options; |
246 | 246 | } |
247 | 247 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @param array the input data collection |
253 | 253 | * @return boolean whether the data of the component has been changed |
254 | 254 | */ |
255 | - public function loadPostData($key,$values) |
|
255 | + public function loadPostData($key, $values) |
|
256 | 256 | { |
257 | 257 | $value=$values[$key]; |
258 | 258 | if($this->getAutoTrim()) |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public function onTextChanged($param) |
315 | 315 | { |
316 | - $this->raiseEvent('OnTextChanged',$this,$param); |
|
316 | + $this->raiseEvent('OnTextChanged', $this, $param); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | /** |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | */ |
358 | 358 | public function getAutoCompleteType() |
359 | 359 | { |
360 | - return $this->getViewState('AutoCompleteType',TTextBoxAutoCompleteType::None); |
|
360 | + return $this->getViewState('AutoCompleteType', TTextBoxAutoCompleteType::None); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | */ |
367 | 367 | public function setAutoCompleteType($value) |
368 | 368 | { |
369 | - $this->setViewState('AutoCompleteType',TPropertyValue::ensureEnum($value,'TTextBoxAutoCompleteType'),TTextBoxAutoCompleteType::None); |
|
369 | + $this->setViewState('AutoCompleteType', TPropertyValue::ensureEnum($value, 'TTextBoxAutoCompleteType'), TTextBoxAutoCompleteType::None); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | /** |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | */ |
377 | 377 | public function getAutoPostBack() |
378 | 378 | { |
379 | - return $this->getViewState('AutoPostBack',false); |
|
379 | + return $this->getViewState('AutoPostBack', false); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | /** |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | */ |
388 | 388 | public function setAutoPostBack($value) |
389 | 389 | { |
390 | - $this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),false); |
|
390 | + $this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), false); |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | /** |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | */ |
396 | 396 | public function getAutoTrim() |
397 | 397 | { |
398 | - return $this->getViewState('AutoTrim',false); |
|
398 | + return $this->getViewState('AutoTrim', false); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | /** |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | */ |
405 | 405 | public function setAutoTrim($value) |
406 | 406 | { |
407 | - $this->setViewState('AutoTrim',TPropertyValue::ensureBoolean($value),false); |
|
407 | + $this->setViewState('AutoTrim', TPropertyValue::ensureBoolean($value), false); |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | /** |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | */ |
413 | 413 | public function getCausesValidation() |
414 | 414 | { |
415 | - return $this->getViewState('CausesValidation',true); |
|
415 | + return $this->getViewState('CausesValidation', true); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | /** |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | */ |
421 | 421 | public function setCausesValidation($value) |
422 | 422 | { |
423 | - $this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true); |
|
423 | + $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | /** |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | */ |
429 | 429 | public function getColumns() |
430 | 430 | { |
431 | - return $this->getViewState('Columns',0); |
|
431 | + return $this->getViewState('Columns', 0); |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | /** |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | */ |
438 | 438 | public function setColumns($value) |
439 | 439 | { |
440 | - $this->setViewState('Columns',TPropertyValue::ensureInteger($value),0); |
|
440 | + $this->setViewState('Columns', TPropertyValue::ensureInteger($value), 0); |
|
441 | 441 | } |
442 | 442 | |
443 | 443 | /** |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | */ |
446 | 446 | public function getMaxLength() |
447 | 447 | { |
448 | - return $this->getViewState('MaxLength',0); |
|
448 | + return $this->getViewState('MaxLength', 0); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | /** |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | */ |
455 | 455 | public function setMaxLength($value) |
456 | 456 | { |
457 | - $this->setViewState('MaxLength',TPropertyValue::ensureInteger($value),0); |
|
457 | + $this->setViewState('MaxLength', TPropertyValue::ensureInteger($value), 0); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | /** |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | */ |
463 | 463 | public function getReadOnly() |
464 | 464 | { |
465 | - return $this->getViewState('ReadOnly',false); |
|
465 | + return $this->getViewState('ReadOnly', false); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | /** |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | */ |
471 | 471 | public function setReadOnly($value) |
472 | 472 | { |
473 | - $this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false); |
|
473 | + $this->setViewState('ReadOnly', TPropertyValue::ensureBoolean($value), false); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | /** |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | */ |
479 | 479 | public function getRows() |
480 | 480 | { |
481 | - return $this->getViewState('Rows',self::DEFAULT_ROWS); |
|
481 | + return $this->getViewState('Rows', self::DEFAULT_ROWS); |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | /** |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | */ |
488 | 488 | public function setRows($value) |
489 | 489 | { |
490 | - $this->setViewState('Rows',TPropertyValue::ensureInteger($value),self::DEFAULT_ROWS); |
|
490 | + $this->setViewState('Rows', TPropertyValue::ensureInteger($value), self::DEFAULT_ROWS); |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | /** |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | */ |
496 | 496 | public function getPersistPassword() |
497 | 497 | { |
498 | - return $this->getViewState('PersistPassword',false); |
|
498 | + return $this->getViewState('PersistPassword', false); |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | /** |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | */ |
504 | 504 | public function setPersistPassword($value) |
505 | 505 | { |
506 | - $this->setViewState('PersistPassword',TPropertyValue::ensureBoolean($value),false); |
|
506 | + $this->setViewState('PersistPassword', TPropertyValue::ensureBoolean($value), false); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | /** |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | */ |
512 | 512 | public function getText() |
513 | 513 | { |
514 | - return $this->getViewState('Text',''); |
|
514 | + return $this->getViewState('Text', ''); |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | /** |
@@ -520,8 +520,8 @@ discard block |
||
520 | 520 | */ |
521 | 521 | public function setText($value) |
522 | 522 | { |
523 | - $this->setViewState('Text',TPropertyValue::ensureString($value),''); |
|
524 | - $this->_safeText = null; |
|
523 | + $this->setViewState('Text', TPropertyValue::ensureString($value), ''); |
|
524 | + $this->_safeText=null; |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | /** |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | */ |
576 | 576 | public function getTextMode() |
577 | 577 | { |
578 | - return $this->getViewState('TextMode',TTextBoxMode::SingleLine); |
|
578 | + return $this->getViewState('TextMode', TTextBoxMode::SingleLine); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | /** |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | */ |
586 | 586 | public function setTextMode($value) |
587 | 587 | { |
588 | - $this->setViewState('TextMode',TPropertyValue::ensureEnum($value,'TTextBoxMode'),TTextBoxMode::SingleLine); |
|
588 | + $this->setViewState('TextMode', TPropertyValue::ensureEnum($value, 'TTextBoxMode'), TTextBoxMode::SingleLine); |
|
589 | 589 | } |
590 | 590 | |
591 | 591 | /** |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | */ |
594 | 594 | public function getValidationGroup() |
595 | 595 | { |
596 | - return $this->getViewState('ValidationGroup',''); |
|
596 | + return $this->getViewState('ValidationGroup', ''); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | /** |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | */ |
602 | 602 | public function setValidationGroup($value) |
603 | 603 | { |
604 | - $this->setViewState('ValidationGroup',$value,''); |
|
604 | + $this->setViewState('ValidationGroup', $value, ''); |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | /** |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | */ |
610 | 610 | public function getWrap() |
611 | 611 | { |
612 | - return $this->getViewState('Wrap',true); |
|
612 | + return $this->getViewState('Wrap', true); |
|
613 | 613 | } |
614 | 614 | |
615 | 615 | /** |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | */ |
619 | 619 | public function setWrap($value) |
620 | 620 | { |
621 | - $this->setViewState('Wrap',TPropertyValue::ensureBoolean($value),true); |
|
621 | + $this->setViewState('Wrap', TPropertyValue::ensureBoolean($value), true); |
|
622 | 622 | } |
623 | 623 | } |
624 | 624 |
@@ -189,8 +189,7 @@ discard block |
||
189 | 189 | return file_put_contents($fileName,file_get_contents($this->_localName))!==false; |
190 | 190 | else |
191 | 191 | return false; |
192 | - } |
|
193 | - else |
|
192 | + } else |
|
194 | 193 | return false; |
195 | 194 | } |
196 | 195 | |
@@ -211,8 +210,7 @@ discard block |
||
211 | 210 | $this->_errorCode=$_FILES[$key]['error']; |
212 | 211 | $this->_localName=$_FILES[$key]['tmp_name']; |
213 | 212 | return $this->_dataChanged=true; |
214 | - } |
|
215 | - else |
|
213 | + } else |
|
216 | 214 | return false; |
217 | 215 | } |
218 | 216 |
@@ -157,6 +157,7 @@ |
||
157 | 157 | * Processes a text string. |
158 | 158 | * This method is required by the parent class. |
159 | 159 | * @param string text string to be processed |
160 | + * @param string $text |
|
160 | 161 | * @return string the processed text result |
161 | 162 | */ |
162 | 163 | public function processText($text) |
@@ -19,19 +19,19 @@ |
||
19 | 19 | // BC trick : only define constants if Text/Highlighter.php |
20 | 20 | // is not yet included |
21 | 21 | if (!defined('HL_NUMBERS_LI')) { |
22 | - /**#@+ |
|
22 | + /**#@+ |
|
23 | 23 | * Constant for use with $options['numbers'] |
24 | 24 | */ |
25 | - /** |
|
26 | - * use numbered list, deprecated, use HL_NUMBERS_OL instaed |
|
27 | - * @deprecated |
|
28 | - */ |
|
29 | - define ('HL_NUMBERS_LI' , 1); |
|
30 | - /** |
|
31 | - * Use 2-column table with line numbers in left column and code in right column. |
|
32 | - */ |
|
33 | - define ('HL_NUMBERS_TABLE' , 2); |
|
34 | - /**#@-*/ |
|
25 | + /** |
|
26 | + * use numbered list, deprecated, use HL_NUMBERS_OL instaed |
|
27 | + * @deprecated |
|
28 | + */ |
|
29 | + define ('HL_NUMBERS_LI' , 1); |
|
30 | + /** |
|
31 | + * Use 2-column table with line numbers in left column and code in right column. |
|
32 | + */ |
|
33 | + define ('HL_NUMBERS_TABLE' , 2); |
|
34 | + /**#@-*/ |
|
35 | 35 | } |
36 | 36 | |
37 | 37 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | // BC trick : only define constants if Text/Highlighter.php |
20 | 20 | // is not yet included |
21 | -if (!defined('HL_NUMBERS_LI')) { |
|
21 | +if(!defined('HL_NUMBERS_LI')) { |
|
22 | 22 | /**#@+ |
23 | 23 | * Constant for use with $options['numbers'] |
24 | 24 | */ |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | * use numbered list, deprecated, use HL_NUMBERS_OL instaed |
27 | 27 | * @deprecated |
28 | 28 | */ |
29 | - define ('HL_NUMBERS_LI' , 1); |
|
29 | + define('HL_NUMBERS_LI', 1); |
|
30 | 30 | /** |
31 | 31 | * Use 2-column table with line numbers in left column and code in right column. |
32 | 32 | */ |
33 | - define ('HL_NUMBERS_TABLE' , 2); |
|
33 | + define('HL_NUMBERS_TABLE', 2); |
|
34 | 34 | /**#@-*/ |
35 | 35 | } |
36 | 36 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public function setLineNumberStyle($value) |
134 | 134 | { |
135 | - $this->setViewState('LineNumberStyle', TPropertyValue::ensureEnum($value,'TTextHighlighterLineNumberStyle')); |
|
135 | + $this->setViewState('LineNumberStyle', TPropertyValue::ensureEnum($value, 'TTextHighlighterLineNumberStyle')); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | protected function registerStyleSheet() |
169 | 169 | { |
170 | 170 | $cs=$this->getPage()->getClientScript(); |
171 | - $cssFile=Prado::getPathOfNamespace('Prado\\Vendor\\TextHighlighter\\highlight','.css'); |
|
171 | + $cssFile=Prado::getPathOfNamespace('Prado\\Vendor\\TextHighlighter\\highlight', '.css'); |
|
172 | 172 | $cssKey='prado:TTextHighlighter:'.$cssFile; |
173 | 173 | if(!$cs->isStyleSheetFileRegistered($cssKey)) |
174 | 174 | $cs->registerStyleSheetFile($cssKey, $this->publishFilePath($cssFile)); |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | return ('<pre>'.htmlentities(trim($text)).'</pre>'); |
195 | 195 | |
196 | 196 | $options["use_language"]=true; |
197 | - $options["tabsize"] = $this->getTabSize(); |
|
198 | - if ($this->getShowLineNumbers()) |
|
199 | - $options["numbers"] = self::$_lineNumberStyle[$this->getLineNumberStyle()]; |
|
197 | + $options["tabsize"]=$this->getTabSize(); |
|
198 | + if($this->getShowLineNumbers()) |
|
199 | + $options["numbers"]=self::$_lineNumberStyle[$this->getLineNumberStyle()]; |
|
200 | 200 | $highlighter->setRenderer(new Text_Highlighter_Renderer_Html($options)); |
201 | 201 | return $highlighter->highlight(trim($text)); |
202 | 202 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | protected function getHeaderTemplate() |
208 | 208 | { |
209 | - $id = $this->getClientID(); |
|
209 | + $id=$this->getClientID(); |
|
210 | 210 | return TJavaScript::renderScriptBlock("new Prado.WebUI.TTextHighlighter('{$id}');"); |
211 | 211 | } |
212 | 212 |
@@ -185,8 +185,7 @@ |
||
185 | 185 | try |
186 | 186 | { |
187 | 187 | $highlighter=Text_Highlighter::factory($this->getLanguage()); |
188 | - } |
|
189 | - catch(\Exception $e) |
|
188 | + } catch(\Exception $e) |
|
190 | 189 | { |
191 | 190 | $highlighter=false; |
192 | 191 | } |
@@ -113,6 +113,7 @@ |
||
113 | 113 | |
114 | 114 | /** |
115 | 115 | * @param string button caption |
116 | + * @param string $value |
|
116 | 117 | */ |
117 | 118 | public function setButtonText($value) |
118 | 119 | { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function getImageUrl() |
91 | 91 | { |
92 | - return $this->_imageUrl===null?'':$this->_imageUrl; |
|
92 | + return $this->_imageUrl===null ? '' : $this->_imageUrl; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function getButtonText() |
107 | 107 | { |
108 | - return $this->_buttonText===null?'':$this->_buttonText; |
|
108 | + return $this->_buttonText===null ? '' : $this->_buttonText; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function getButtonType() |
123 | 123 | { |
124 | - return $this->_buttonType===null? TWizardNavigationButtonType::Button :$this->_buttonType; |
|
124 | + return $this->_buttonType===null ? TWizardNavigationButtonType::Button : $this->_buttonType; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function setButtonType($value) |
131 | 131 | { |
132 | - $this->_buttonType=TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TWizardNavigationButtonType'); |
|
132 | + $this->_buttonType=TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TWizardNavigationButtonType'); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -207,6 +207,10 @@ |
||
207 | 207 | return $code; |
208 | 208 | } |
209 | 209 | |
210 | + /** |
|
211 | + * @param string $classname |
|
212 | + * @param string $toString |
|
213 | + */ |
|
210 | 214 | protected function generateClass($properties, $tablename, $classname, $toString) |
211 | 215 | { |
212 | 216 | $props = implode("\n", $properties); |
@@ -14,206 +14,206 @@ discard block |
||
14 | 14 | class TWsatARGenerator extends TWsatBaseGenerator |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * Class name prefix |
|
19 | - */ |
|
20 | - private $_clasPrefix; |
|
21 | - |
|
22 | - /** |
|
23 | - * Class name sufix |
|
24 | - */ |
|
25 | - private $_classSufix; |
|
26 | - |
|
27 | - /** |
|
28 | - * all table relations array |
|
29 | - */ |
|
30 | - private $_relations; |
|
31 | - |
|
32 | - /** |
|
33 | - * unquote chars |
|
34 | - * @var array |
|
35 | - */ |
|
36 | - private $uqChars = array('[', ']', '"', '`', "'"); |
|
37 | - |
|
38 | - function __construct() |
|
39 | - { |
|
40 | - parent::__construct(); |
|
41 | - } |
|
42 | - |
|
43 | - public function setClasPrefix($_clas_prefix) |
|
44 | - { |
|
45 | - $this->_clasPrefix = $_clas_prefix; |
|
46 | - } |
|
47 | - |
|
48 | - public function setClassSufix($_clas_sufix) |
|
49 | - { |
|
50 | - $this->_classSufix = $_clas_sufix; |
|
51 | - } |
|
17 | + /** |
|
18 | + * Class name prefix |
|
19 | + */ |
|
20 | + private $_clasPrefix; |
|
21 | + |
|
22 | + /** |
|
23 | + * Class name sufix |
|
24 | + */ |
|
25 | + private $_classSufix; |
|
26 | + |
|
27 | + /** |
|
28 | + * all table relations array |
|
29 | + */ |
|
30 | + private $_relations; |
|
31 | + |
|
32 | + /** |
|
33 | + * unquote chars |
|
34 | + * @var array |
|
35 | + */ |
|
36 | + private $uqChars = array('[', ']', '"', '`', "'"); |
|
37 | + |
|
38 | + function __construct() |
|
39 | + { |
|
40 | + parent::__construct(); |
|
41 | + } |
|
42 | + |
|
43 | + public function setClasPrefix($_clas_prefix) |
|
44 | + { |
|
45 | + $this->_clasPrefix = $_clas_prefix; |
|
46 | + } |
|
47 | + |
|
48 | + public function setClassSufix($_clas_sufix) |
|
49 | + { |
|
50 | + $this->_classSufix = $_clas_sufix; |
|
51 | + } |
|
52 | 52 | |
53 | 53 | //----------------------------------------------------------------------------- |
54 | - // <editor-fold defaultstate="collapsed" desc="Main APIs"> |
|
55 | - public function generate($tableName) |
|
56 | - { |
|
57 | - $tableInfo = $this->_dbMetaData->getTableInfo($tableName); |
|
58 | - $this->_commonGenerate($tableName, $tableInfo); |
|
59 | - } |
|
60 | - |
|
61 | - public function generateAll() |
|
62 | - { |
|
63 | - foreach ($this->getAllTableNames() as $tableName) |
|
64 | - { |
|
65 | - $tableInfo = $this->_dbMetaData->getTableInfo($tableName); |
|
66 | - if (!empty($this->_relations)) |
|
67 | - { |
|
68 | - // Cancel generation of M-M relationships middle table |
|
69 | - if (count($tableInfo->getPrimaryKeys()) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships |
|
70 | - continue; |
|
71 | - } |
|
72 | - $this->_commonGenerate($tableName, $tableInfo); |
|
73 | - } |
|
74 | - } |
|
75 | - |
|
76 | - public function buildRelations() |
|
77 | - { |
|
78 | - $this->_relations = array(); |
|
79 | - foreach ($this->getAllTableNames() as $table_name) |
|
80 | - { |
|
81 | - $tableInfo = $this->_dbMetaData->getTableInfo($table_name); |
|
82 | - $pks = $tableInfo->getPrimaryKeys(); |
|
83 | - $fks = $tableInfo->getForeignKeys(); |
|
84 | - |
|
85 | - if (count($pks) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships |
|
86 | - { |
|
87 | - $table_name_mm = $fks[0]["table"]; |
|
88 | - $table_name_mm2 = $fks[1]["table"]; |
|
89 | - |
|
90 | - $this->_relations[$table_name_mm][] = array( |
|
91 | - "prop_name" => strtolower($table_name_mm2), |
|
92 | - "rel_type" => "self::MANY_TO_MANY", |
|
93 | - "ref_class_name" => $this->_getProperClassName($table_name_mm2), |
|
94 | - "prop_ref" => $table_name |
|
95 | - ); |
|
96 | - |
|
97 | - $this->_relations[$table_name_mm2][] = array( |
|
98 | - "prop_name" => strtolower($table_name_mm), |
|
99 | - "rel_type" => "self::MANY_TO_MANY", |
|
100 | - "ref_class_name" => $this->_getProperClassName($table_name_mm), |
|
101 | - "prop_ref" => $table_name |
|
102 | - ); |
|
103 | - continue; |
|
104 | - } |
|
105 | - foreach ($fks as $fk_data)//1-M relationships |
|
106 | - { |
|
107 | - $owner_table = $fk_data["table"]; |
|
108 | - $slave_table = $table_name; |
|
109 | - $fk_prop = key($fk_data["keys"]); |
|
110 | - |
|
111 | - $this->_relations[$owner_table][] = array( |
|
112 | - "prop_name" => strtolower($slave_table), |
|
113 | - "rel_type" => "self::HAS_MANY", |
|
114 | - "ref_class_name" => $this->_getProperClassName($slave_table), |
|
115 | - "prop_ref" => $fk_prop |
|
116 | - ); |
|
117 | - |
|
118 | - $this->_relations[$slave_table][] = array( |
|
119 | - "prop_name" => strtolower($owner_table), |
|
120 | - "rel_type" => "self::BELONGS_TO", |
|
121 | - "ref_class_name" => $this->_getProperClassName($owner_table), |
|
122 | - "prop_ref" => $fk_prop |
|
123 | - ); |
|
124 | - } |
|
125 | - } |
|
126 | - } |
|
54 | + // <editor-fold defaultstate="collapsed" desc="Main APIs"> |
|
55 | + public function generate($tableName) |
|
56 | + { |
|
57 | + $tableInfo = $this->_dbMetaData->getTableInfo($tableName); |
|
58 | + $this->_commonGenerate($tableName, $tableInfo); |
|
59 | + } |
|
60 | + |
|
61 | + public function generateAll() |
|
62 | + { |
|
63 | + foreach ($this->getAllTableNames() as $tableName) |
|
64 | + { |
|
65 | + $tableInfo = $this->_dbMetaData->getTableInfo($tableName); |
|
66 | + if (!empty($this->_relations)) |
|
67 | + { |
|
68 | + // Cancel generation of M-M relationships middle table |
|
69 | + if (count($tableInfo->getPrimaryKeys()) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships |
|
70 | + continue; |
|
71 | + } |
|
72 | + $this->_commonGenerate($tableName, $tableInfo); |
|
73 | + } |
|
74 | + } |
|
75 | + |
|
76 | + public function buildRelations() |
|
77 | + { |
|
78 | + $this->_relations = array(); |
|
79 | + foreach ($this->getAllTableNames() as $table_name) |
|
80 | + { |
|
81 | + $tableInfo = $this->_dbMetaData->getTableInfo($table_name); |
|
82 | + $pks = $tableInfo->getPrimaryKeys(); |
|
83 | + $fks = $tableInfo->getForeignKeys(); |
|
84 | + |
|
85 | + if (count($pks) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships |
|
86 | + { |
|
87 | + $table_name_mm = $fks[0]["table"]; |
|
88 | + $table_name_mm2 = $fks[1]["table"]; |
|
89 | + |
|
90 | + $this->_relations[$table_name_mm][] = array( |
|
91 | + "prop_name" => strtolower($table_name_mm2), |
|
92 | + "rel_type" => "self::MANY_TO_MANY", |
|
93 | + "ref_class_name" => $this->_getProperClassName($table_name_mm2), |
|
94 | + "prop_ref" => $table_name |
|
95 | + ); |
|
96 | + |
|
97 | + $this->_relations[$table_name_mm2][] = array( |
|
98 | + "prop_name" => strtolower($table_name_mm), |
|
99 | + "rel_type" => "self::MANY_TO_MANY", |
|
100 | + "ref_class_name" => $this->_getProperClassName($table_name_mm), |
|
101 | + "prop_ref" => $table_name |
|
102 | + ); |
|
103 | + continue; |
|
104 | + } |
|
105 | + foreach ($fks as $fk_data)//1-M relationships |
|
106 | + { |
|
107 | + $owner_table = $fk_data["table"]; |
|
108 | + $slave_table = $table_name; |
|
109 | + $fk_prop = key($fk_data["keys"]); |
|
110 | + |
|
111 | + $this->_relations[$owner_table][] = array( |
|
112 | + "prop_name" => strtolower($slave_table), |
|
113 | + "rel_type" => "self::HAS_MANY", |
|
114 | + "ref_class_name" => $this->_getProperClassName($slave_table), |
|
115 | + "prop_ref" => $fk_prop |
|
116 | + ); |
|
117 | + |
|
118 | + $this->_relations[$slave_table][] = array( |
|
119 | + "prop_name" => strtolower($owner_table), |
|
120 | + "rel_type" => "self::BELONGS_TO", |
|
121 | + "ref_class_name" => $this->_getProperClassName($owner_table), |
|
122 | + "prop_ref" => $fk_prop |
|
123 | + ); |
|
124 | + } |
|
125 | + } |
|
126 | + } |
|
127 | 127 | |
128 | 128 | // </editor-fold> |
129 | 129 | //----------------------------------------------------------------------------- |
130 | - // <editor-fold defaultstate="collapsed" desc="Common Methods"> |
|
131 | - |
|
132 | - private function _commonGenerate($tableName, $tableInfo) |
|
133 | - { |
|
134 | - if (count($tableInfo->getColumns()) === 0) |
|
135 | - throw new Exception("Unable to find table or view $tableName in " . $this->_dbMetaData->getDbConnection()->getConnectionString() . "."); |
|
136 | - else |
|
137 | - { |
|
138 | - $properties = array(); |
|
139 | - foreach ($tableInfo->getColumns() as $field => $metadata) |
|
140 | - $properties[] = $this->generateProperty($field, $metadata); |
|
141 | - $toString = $this->_buildSmartToString($tableInfo); |
|
142 | - } |
|
143 | - |
|
144 | - $clasName = $this->_getProperClassName($tableName); |
|
145 | - $class = $this->generateClass($properties, $tableName, $clasName, $toString); |
|
146 | - $output = $this->_opFile . DIRECTORY_SEPARATOR . $clasName . ".php"; |
|
147 | - file_put_contents($output, $class); |
|
148 | - } |
|
149 | - |
|
150 | - private function _getProperClassName($tableName) |
|
151 | - { |
|
152 | - $table_name_words = str_replace("_", " ", strtolower($tableName)); |
|
153 | - $final_conversion = str_replace(" ", "", ucwords($table_name_words)); |
|
154 | - return $this->_clasPrefix . $final_conversion . $this->_classSufix; |
|
155 | - } |
|
130 | + // <editor-fold defaultstate="collapsed" desc="Common Methods"> |
|
131 | + |
|
132 | + private function _commonGenerate($tableName, $tableInfo) |
|
133 | + { |
|
134 | + if (count($tableInfo->getColumns()) === 0) |
|
135 | + throw new Exception("Unable to find table or view $tableName in " . $this->_dbMetaData->getDbConnection()->getConnectionString() . "."); |
|
136 | + else |
|
137 | + { |
|
138 | + $properties = array(); |
|
139 | + foreach ($tableInfo->getColumns() as $field => $metadata) |
|
140 | + $properties[] = $this->generateProperty($field, $metadata); |
|
141 | + $toString = $this->_buildSmartToString($tableInfo); |
|
142 | + } |
|
143 | + |
|
144 | + $clasName = $this->_getProperClassName($tableName); |
|
145 | + $class = $this->generateClass($properties, $tableName, $clasName, $toString); |
|
146 | + $output = $this->_opFile . DIRECTORY_SEPARATOR . $clasName . ".php"; |
|
147 | + file_put_contents($output, $class); |
|
148 | + } |
|
149 | + |
|
150 | + private function _getProperClassName($tableName) |
|
151 | + { |
|
152 | + $table_name_words = str_replace("_", " ", strtolower($tableName)); |
|
153 | + $final_conversion = str_replace(" ", "", ucwords($table_name_words)); |
|
154 | + return $this->_clasPrefix . $final_conversion . $this->_classSufix; |
|
155 | + } |
|
156 | 156 | |
157 | 157 | //----------------------------------------------------------------------------- |
158 | 158 | |
159 | - protected function generateProperty($field, $metadata) |
|
160 | - { |
|
161 | - $prop = ''; |
|
162 | - $name = '$' . $field; |
|
163 | - |
|
164 | - /* TODO use in version 2.0 */ |
|
165 | - // $type = $column->getPHPType(); |
|
166 | - |
|
167 | - $prop .= "\tpublic $name;"; |
|
168 | - return $prop; |
|
169 | - } |
|
170 | - |
|
171 | - private function _renderRelations($tablename) |
|
172 | - { |
|
173 | - if (!isset($this->_relations[$tablename])) |
|
174 | - return ""; |
|
175 | - |
|
176 | - $code = "\tpublic static \$RELATIONS = array ("; |
|
177 | - foreach ($this->_relations[$tablename] as $rel_data) |
|
178 | - $code .= "\n\t\t'" . $rel_data["prop_name"] . "' => array(" . $rel_data["rel_type"] . ", '" . $rel_data["ref_class_name"] . "', '" . $rel_data["prop_ref"] . "'),"; |
|
179 | - |
|
180 | - $code = substr($code, 0, -1); |
|
181 | - $code .= "\n\t);"; |
|
182 | - return $code; |
|
183 | - } |
|
184 | - |
|
185 | - private function _buildSmartToString($tableInfo) |
|
186 | - { |
|
187 | - $code = "\tpublic function __toString() {"; |
|
188 | - $property = "throw new THttpException(500, 'Not implemented yet.');"; |
|
189 | - try |
|
190 | - { |
|
191 | - foreach ($tableInfo->getColumns() as $column) |
|
192 | - { |
|
193 | - if (isset($column->IsPrimaryKey) && $column->IsPrimaryKey) |
|
194 | - $property = str_replace($this->uqChars, "", $column->ColumnName); |
|
195 | - elseif ($column->PdoType == PDO::PARAM_STR && $column->DBType != "date") |
|
196 | - { |
|
197 | - $property = str_replace($this->uqChars, "", $column->ColumnName); |
|
198 | - break; |
|
199 | - } |
|
200 | - } |
|
201 | - } catch (Exception $ex) |
|
202 | - { |
|
203 | - Prado::trace($ex->getMessage()); |
|
204 | - } |
|
205 | - $code .= "\n\t\treturn \$this->$property;"; |
|
206 | - $code .= "\n\t}"; |
|
207 | - return $code; |
|
208 | - } |
|
209 | - |
|
210 | - protected function generateClass($properties, $tablename, $classname, $toString) |
|
211 | - { |
|
212 | - $props = implode("\n", $properties); |
|
213 | - $relations = $this->_renderRelations($tablename); |
|
214 | - $date = date('Y-m-d h:i:s'); |
|
215 | - $env_user = getenv("username"); |
|
216 | - return <<<EOD |
|
159 | + protected function generateProperty($field, $metadata) |
|
160 | + { |
|
161 | + $prop = ''; |
|
162 | + $name = '$' . $field; |
|
163 | + |
|
164 | + /* TODO use in version 2.0 */ |
|
165 | + // $type = $column->getPHPType(); |
|
166 | + |
|
167 | + $prop .= "\tpublic $name;"; |
|
168 | + return $prop; |
|
169 | + } |
|
170 | + |
|
171 | + private function _renderRelations($tablename) |
|
172 | + { |
|
173 | + if (!isset($this->_relations[$tablename])) |
|
174 | + return ""; |
|
175 | + |
|
176 | + $code = "\tpublic static \$RELATIONS = array ("; |
|
177 | + foreach ($this->_relations[$tablename] as $rel_data) |
|
178 | + $code .= "\n\t\t'" . $rel_data["prop_name"] . "' => array(" . $rel_data["rel_type"] . ", '" . $rel_data["ref_class_name"] . "', '" . $rel_data["prop_ref"] . "'),"; |
|
179 | + |
|
180 | + $code = substr($code, 0, -1); |
|
181 | + $code .= "\n\t);"; |
|
182 | + return $code; |
|
183 | + } |
|
184 | + |
|
185 | + private function _buildSmartToString($tableInfo) |
|
186 | + { |
|
187 | + $code = "\tpublic function __toString() {"; |
|
188 | + $property = "throw new THttpException(500, 'Not implemented yet.');"; |
|
189 | + try |
|
190 | + { |
|
191 | + foreach ($tableInfo->getColumns() as $column) |
|
192 | + { |
|
193 | + if (isset($column->IsPrimaryKey) && $column->IsPrimaryKey) |
|
194 | + $property = str_replace($this->uqChars, "", $column->ColumnName); |
|
195 | + elseif ($column->PdoType == PDO::PARAM_STR && $column->DBType != "date") |
|
196 | + { |
|
197 | + $property = str_replace($this->uqChars, "", $column->ColumnName); |
|
198 | + break; |
|
199 | + } |
|
200 | + } |
|
201 | + } catch (Exception $ex) |
|
202 | + { |
|
203 | + Prado::trace($ex->getMessage()); |
|
204 | + } |
|
205 | + $code .= "\n\t\treturn \$this->$property;"; |
|
206 | + $code .= "\n\t}"; |
|
207 | + return $code; |
|
208 | + } |
|
209 | + |
|
210 | + protected function generateClass($properties, $tablename, $classname, $toString) |
|
211 | + { |
|
212 | + $props = implode("\n", $properties); |
|
213 | + $relations = $this->_renderRelations($tablename); |
|
214 | + $date = date('Y-m-d h:i:s'); |
|
215 | + $env_user = getenv("username"); |
|
216 | + return <<<EOD |
|
217 | 217 | <?php |
218 | 218 | /** |
219 | 219 | * Auto generated by PRADO - WSAT on $date. |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $toString |
235 | 235 | } |
236 | 236 | EOD; |
237 | - } |
|
237 | + } |
|
238 | 238 | |
239 | 239 | // </editor-fold> |
240 | 240 | } |
241 | 241 | \ No newline at end of file |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * unquote chars |
34 | 34 | * @var array |
35 | 35 | */ |
36 | - private $uqChars = array('[', ']', '"', '`', "'"); |
|
36 | + private $uqChars=array('[', ']', '"', '`', "'"); |
|
37 | 37 | |
38 | 38 | function __construct() |
39 | 39 | { |
@@ -42,31 +42,31 @@ discard block |
||
42 | 42 | |
43 | 43 | public function setClasPrefix($_clas_prefix) |
44 | 44 | { |
45 | - $this->_clasPrefix = $_clas_prefix; |
|
45 | + $this->_clasPrefix=$_clas_prefix; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | public function setClassSufix($_clas_sufix) |
49 | 49 | { |
50 | - $this->_classSufix = $_clas_sufix; |
|
50 | + $this->_classSufix=$_clas_sufix; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | //----------------------------------------------------------------------------- |
54 | 54 | // <editor-fold defaultstate="collapsed" desc="Main APIs"> |
55 | 55 | public function generate($tableName) |
56 | 56 | { |
57 | - $tableInfo = $this->_dbMetaData->getTableInfo($tableName); |
|
57 | + $tableInfo=$this->_dbMetaData->getTableInfo($tableName); |
|
58 | 58 | $this->_commonGenerate($tableName, $tableInfo); |
59 | 59 | } |
60 | 60 | |
61 | 61 | public function generateAll() |
62 | 62 | { |
63 | - foreach ($this->getAllTableNames() as $tableName) |
|
63 | + foreach($this->getAllTableNames() as $tableName) |
|
64 | 64 | { |
65 | - $tableInfo = $this->_dbMetaData->getTableInfo($tableName); |
|
66 | - if (!empty($this->_relations)) |
|
65 | + $tableInfo=$this->_dbMetaData->getTableInfo($tableName); |
|
66 | + if(!empty($this->_relations)) |
|
67 | 67 | { |
68 | 68 | // Cancel generation of M-M relationships middle table |
69 | - if (count($tableInfo->getPrimaryKeys()) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships |
|
69 | + if(count($tableInfo->getPrimaryKeys())===2 && count($tableInfo->getColumns())===2)//M-M relationships |
|
70 | 70 | continue; |
71 | 71 | } |
72 | 72 | $this->_commonGenerate($tableName, $tableInfo); |
@@ -75,26 +75,26 @@ discard block |
||
75 | 75 | |
76 | 76 | public function buildRelations() |
77 | 77 | { |
78 | - $this->_relations = array(); |
|
79 | - foreach ($this->getAllTableNames() as $table_name) |
|
78 | + $this->_relations=array(); |
|
79 | + foreach($this->getAllTableNames() as $table_name) |
|
80 | 80 | { |
81 | - $tableInfo = $this->_dbMetaData->getTableInfo($table_name); |
|
82 | - $pks = $tableInfo->getPrimaryKeys(); |
|
83 | - $fks = $tableInfo->getForeignKeys(); |
|
81 | + $tableInfo=$this->_dbMetaData->getTableInfo($table_name); |
|
82 | + $pks=$tableInfo->getPrimaryKeys(); |
|
83 | + $fks=$tableInfo->getForeignKeys(); |
|
84 | 84 | |
85 | - if (count($pks) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships |
|
85 | + if(count($pks)===2 && count($tableInfo->getColumns())===2)//M-M relationships |
|
86 | 86 | { |
87 | - $table_name_mm = $fks[0]["table"]; |
|
88 | - $table_name_mm2 = $fks[1]["table"]; |
|
87 | + $table_name_mm=$fks[0]["table"]; |
|
88 | + $table_name_mm2=$fks[1]["table"]; |
|
89 | 89 | |
90 | - $this->_relations[$table_name_mm][] = array( |
|
90 | + $this->_relations[$table_name_mm][]=array( |
|
91 | 91 | "prop_name" => strtolower($table_name_mm2), |
92 | 92 | "rel_type" => "self::MANY_TO_MANY", |
93 | 93 | "ref_class_name" => $this->_getProperClassName($table_name_mm2), |
94 | 94 | "prop_ref" => $table_name |
95 | 95 | ); |
96 | 96 | |
97 | - $this->_relations[$table_name_mm2][] = array( |
|
97 | + $this->_relations[$table_name_mm2][]=array( |
|
98 | 98 | "prop_name" => strtolower($table_name_mm), |
99 | 99 | "rel_type" => "self::MANY_TO_MANY", |
100 | 100 | "ref_class_name" => $this->_getProperClassName($table_name_mm), |
@@ -102,20 +102,20 @@ discard block |
||
102 | 102 | ); |
103 | 103 | continue; |
104 | 104 | } |
105 | - foreach ($fks as $fk_data)//1-M relationships |
|
105 | + foreach($fks as $fk_data)//1-M relationships |
|
106 | 106 | { |
107 | - $owner_table = $fk_data["table"]; |
|
108 | - $slave_table = $table_name; |
|
109 | - $fk_prop = key($fk_data["keys"]); |
|
107 | + $owner_table=$fk_data["table"]; |
|
108 | + $slave_table=$table_name; |
|
109 | + $fk_prop=key($fk_data["keys"]); |
|
110 | 110 | |
111 | - $this->_relations[$owner_table][] = array( |
|
111 | + $this->_relations[$owner_table][]=array( |
|
112 | 112 | "prop_name" => strtolower($slave_table), |
113 | 113 | "rel_type" => "self::HAS_MANY", |
114 | 114 | "ref_class_name" => $this->_getProperClassName($slave_table), |
115 | 115 | "prop_ref" => $fk_prop |
116 | 116 | ); |
117 | 117 | |
118 | - $this->_relations[$slave_table][] = array( |
|
118 | + $this->_relations[$slave_table][]=array( |
|
119 | 119 | "prop_name" => strtolower($owner_table), |
120 | 120 | "rel_type" => "self::BELONGS_TO", |
121 | 121 | "ref_class_name" => $this->_getProperClassName($owner_table), |
@@ -131,88 +131,88 @@ discard block |
||
131 | 131 | |
132 | 132 | private function _commonGenerate($tableName, $tableInfo) |
133 | 133 | { |
134 | - if (count($tableInfo->getColumns()) === 0) |
|
135 | - throw new Exception("Unable to find table or view $tableName in " . $this->_dbMetaData->getDbConnection()->getConnectionString() . "."); |
|
134 | + if(count($tableInfo->getColumns())===0) |
|
135 | + throw new Exception("Unable to find table or view $tableName in ".$this->_dbMetaData->getDbConnection()->getConnectionString()."."); |
|
136 | 136 | else |
137 | 137 | { |
138 | - $properties = array(); |
|
139 | - foreach ($tableInfo->getColumns() as $field => $metadata) |
|
140 | - $properties[] = $this->generateProperty($field, $metadata); |
|
141 | - $toString = $this->_buildSmartToString($tableInfo); |
|
138 | + $properties=array(); |
|
139 | + foreach($tableInfo->getColumns() as $field => $metadata) |
|
140 | + $properties[]=$this->generateProperty($field, $metadata); |
|
141 | + $toString=$this->_buildSmartToString($tableInfo); |
|
142 | 142 | } |
143 | 143 | |
144 | - $clasName = $this->_getProperClassName($tableName); |
|
145 | - $class = $this->generateClass($properties, $tableName, $clasName, $toString); |
|
146 | - $output = $this->_opFile . DIRECTORY_SEPARATOR . $clasName . ".php"; |
|
144 | + $clasName=$this->_getProperClassName($tableName); |
|
145 | + $class=$this->generateClass($properties, $tableName, $clasName, $toString); |
|
146 | + $output=$this->_opFile.DIRECTORY_SEPARATOR.$clasName.".php"; |
|
147 | 147 | file_put_contents($output, $class); |
148 | 148 | } |
149 | 149 | |
150 | 150 | private function _getProperClassName($tableName) |
151 | 151 | { |
152 | - $table_name_words = str_replace("_", " ", strtolower($tableName)); |
|
153 | - $final_conversion = str_replace(" ", "", ucwords($table_name_words)); |
|
154 | - return $this->_clasPrefix . $final_conversion . $this->_classSufix; |
|
152 | + $table_name_words=str_replace("_", " ", strtolower($tableName)); |
|
153 | + $final_conversion=str_replace(" ", "", ucwords($table_name_words)); |
|
154 | + return $this->_clasPrefix.$final_conversion.$this->_classSufix; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | //----------------------------------------------------------------------------- |
158 | 158 | |
159 | 159 | protected function generateProperty($field, $metadata) |
160 | 160 | { |
161 | - $prop = ''; |
|
162 | - $name = '$' . $field; |
|
161 | + $prop=''; |
|
162 | + $name='$'.$field; |
|
163 | 163 | |
164 | 164 | /* TODO use in version 2.0 */ |
165 | 165 | // $type = $column->getPHPType(); |
166 | 166 | |
167 | - $prop .= "\tpublic $name;"; |
|
167 | + $prop.="\tpublic $name;"; |
|
168 | 168 | return $prop; |
169 | 169 | } |
170 | 170 | |
171 | 171 | private function _renderRelations($tablename) |
172 | 172 | { |
173 | - if (!isset($this->_relations[$tablename])) |
|
173 | + if(!isset($this->_relations[$tablename])) |
|
174 | 174 | return ""; |
175 | 175 | |
176 | - $code = "\tpublic static \$RELATIONS = array ("; |
|
177 | - foreach ($this->_relations[$tablename] as $rel_data) |
|
178 | - $code .= "\n\t\t'" . $rel_data["prop_name"] . "' => array(" . $rel_data["rel_type"] . ", '" . $rel_data["ref_class_name"] . "', '" . $rel_data["prop_ref"] . "'),"; |
|
176 | + $code="\tpublic static \$RELATIONS = array ("; |
|
177 | + foreach($this->_relations[$tablename] as $rel_data) |
|
178 | + $code.="\n\t\t'".$rel_data["prop_name"]."' => array(".$rel_data["rel_type"].", '".$rel_data["ref_class_name"]."', '".$rel_data["prop_ref"]."'),"; |
|
179 | 179 | |
180 | - $code = substr($code, 0, -1); |
|
181 | - $code .= "\n\t);"; |
|
180 | + $code=substr($code, 0, -1); |
|
181 | + $code.="\n\t);"; |
|
182 | 182 | return $code; |
183 | 183 | } |
184 | 184 | |
185 | 185 | private function _buildSmartToString($tableInfo) |
186 | 186 | { |
187 | - $code = "\tpublic function __toString() {"; |
|
188 | - $property = "throw new THttpException(500, 'Not implemented yet.');"; |
|
187 | + $code="\tpublic function __toString() {"; |
|
188 | + $property="throw new THttpException(500, 'Not implemented yet.');"; |
|
189 | 189 | try |
190 | 190 | { |
191 | - foreach ($tableInfo->getColumns() as $column) |
|
191 | + foreach($tableInfo->getColumns() as $column) |
|
192 | 192 | { |
193 | - if (isset($column->IsPrimaryKey) && $column->IsPrimaryKey) |
|
194 | - $property = str_replace($this->uqChars, "", $column->ColumnName); |
|
195 | - elseif ($column->PdoType == PDO::PARAM_STR && $column->DBType != "date") |
|
193 | + if(isset($column->IsPrimaryKey) && $column->IsPrimaryKey) |
|
194 | + $property=str_replace($this->uqChars, "", $column->ColumnName); |
|
195 | + elseif($column->PdoType==PDO::PARAM_STR && $column->DBType!="date") |
|
196 | 196 | { |
197 | - $property = str_replace($this->uqChars, "", $column->ColumnName); |
|
197 | + $property=str_replace($this->uqChars, "", $column->ColumnName); |
|
198 | 198 | break; |
199 | 199 | } |
200 | 200 | } |
201 | - } catch (Exception $ex) |
|
201 | + } catch(Exception $ex) |
|
202 | 202 | { |
203 | 203 | Prado::trace($ex->getMessage()); |
204 | 204 | } |
205 | - $code .= "\n\t\treturn \$this->$property;"; |
|
206 | - $code .= "\n\t}"; |
|
205 | + $code.="\n\t\treturn \$this->$property;"; |
|
206 | + $code.="\n\t}"; |
|
207 | 207 | return $code; |
208 | 208 | } |
209 | 209 | |
210 | 210 | protected function generateClass($properties, $tablename, $classname, $toString) |
211 | 211 | { |
212 | - $props = implode("\n", $properties); |
|
213 | - $relations = $this->_renderRelations($tablename); |
|
214 | - $date = date('Y-m-d h:i:s'); |
|
215 | - $env_user = getenv("username"); |
|
212 | + $props=implode("\n", $properties); |
|
213 | + $relations=$this->_renderRelations($tablename); |
|
214 | + $date=date('Y-m-d h:i:s'); |
|
215 | + $env_user=getenv("username"); |
|
216 | 216 | return <<<EOD |
217 | 217 | <?php |
218 | 218 | /** |
@@ -44,6 +44,10 @@ discard block |
||
44 | 44 | |
45 | 45 | //--------------------------------------------------------------------- |
46 | 46 | // <editor-fold defaultstate="collapsed" desc="Page Generation"> |
47 | + |
|
48 | + /** |
|
49 | + * @param integer $viewType |
|
50 | + */ |
|
47 | 51 | public function generate($tableName, $viewType) |
48 | 52 | { |
49 | 53 | switch ($viewType) |
@@ -141,6 +145,10 @@ discard block |
||
141 | 145 | // </editor-fold> |
142 | 146 | //--------------------------------------------------------------------- |
143 | 147 | // <editor-fold defaultstate="collapsed" desc="Code Behind Generation"> |
148 | + |
|
149 | + /** |
|
150 | + * @param string $classname |
|
151 | + */ |
|
144 | 152 | private function generateClass($classname) |
145 | 153 | { |
146 | 154 | $date = date('Y-m-d h:i:s'); |
@@ -14,138 +14,138 @@ discard block |
||
14 | 14 | class TWsatScaffoldingGenerator extends TWsatBaseGenerator |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * Const View Types for generation |
|
19 | - */ |
|
20 | - const LIST_TYPE = 0; |
|
21 | - const ADD_TYPE = 1; |
|
22 | - const SHOW_TYPE = 2; |
|
23 | - |
|
24 | - /** |
|
25 | - * Bootstrap option |
|
26 | - */ |
|
27 | - private $_bootstrap; |
|
28 | - |
|
29 | - function __construct() |
|
30 | - { |
|
31 | - parent::__construct(); |
|
32 | - } |
|
33 | - |
|
34 | - /** |
|
35 | - * Generates CRUD Operations for a single DB table |
|
36 | - * @param type $tableName |
|
37 | - */ |
|
38 | - public function generateCRUD($tableName) |
|
39 | - { |
|
40 | - $this->generate($tableName, self::ADD_TYPE); |
|
41 | - $this->generate($tableName, self::LIST_TYPE); |
|
42 | - $this->generate($tableName, self::SHOW_TYPE); |
|
43 | - } |
|
44 | - |
|
45 | - //--------------------------------------------------------------------- |
|
46 | - // <editor-fold defaultstate="collapsed" desc="Page Generation"> |
|
47 | - public function generate($tableName, $viewType) |
|
48 | - { |
|
49 | - switch ($viewType) |
|
50 | - { |
|
51 | - default: |
|
52 | - case self::LIST_TYPE: |
|
53 | - $unitName = "list" . ucfirst($tableName); |
|
54 | - break; |
|
55 | - |
|
56 | - case self::ADD_TYPE: |
|
57 | - $unitName = "add" . ucfirst($tableName); |
|
58 | - break; |
|
59 | - |
|
60 | - case self::SHOW_TYPE: |
|
61 | - $unitName = "show" . ucfirst($tableName); |
|
62 | - break; |
|
63 | - } |
|
64 | - |
|
65 | - $class = $this->generateClass($unitName); |
|
66 | - $outputClass = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".php"; |
|
67 | - file_put_contents($outputClass, $class); |
|
68 | - |
|
69 | - $outputPage = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".page"; |
|
70 | - $page = $this->generatePage($tableName, $viewType); |
|
71 | - file_put_contents($outputPage, $page); |
|
72 | - } |
|
73 | - |
|
74 | - private function generatePage($tableName, $type, $tContentId = "Content") |
|
75 | - { |
|
76 | - $pageContent = $this->getPageContent($tableName, $type); |
|
77 | - return <<<EOD |
|
17 | + /** |
|
18 | + * Const View Types for generation |
|
19 | + */ |
|
20 | + const LIST_TYPE = 0; |
|
21 | + const ADD_TYPE = 1; |
|
22 | + const SHOW_TYPE = 2; |
|
23 | + |
|
24 | + /** |
|
25 | + * Bootstrap option |
|
26 | + */ |
|
27 | + private $_bootstrap; |
|
28 | + |
|
29 | + function __construct() |
|
30 | + { |
|
31 | + parent::__construct(); |
|
32 | + } |
|
33 | + |
|
34 | + /** |
|
35 | + * Generates CRUD Operations for a single DB table |
|
36 | + * @param type $tableName |
|
37 | + */ |
|
38 | + public function generateCRUD($tableName) |
|
39 | + { |
|
40 | + $this->generate($tableName, self::ADD_TYPE); |
|
41 | + $this->generate($tableName, self::LIST_TYPE); |
|
42 | + $this->generate($tableName, self::SHOW_TYPE); |
|
43 | + } |
|
44 | + |
|
45 | + //--------------------------------------------------------------------- |
|
46 | + // <editor-fold defaultstate="collapsed" desc="Page Generation"> |
|
47 | + public function generate($tableName, $viewType) |
|
48 | + { |
|
49 | + switch ($viewType) |
|
50 | + { |
|
51 | + default: |
|
52 | + case self::LIST_TYPE: |
|
53 | + $unitName = "list" . ucfirst($tableName); |
|
54 | + break; |
|
55 | + |
|
56 | + case self::ADD_TYPE: |
|
57 | + $unitName = "add" . ucfirst($tableName); |
|
58 | + break; |
|
59 | + |
|
60 | + case self::SHOW_TYPE: |
|
61 | + $unitName = "show" . ucfirst($tableName); |
|
62 | + break; |
|
63 | + } |
|
64 | + |
|
65 | + $class = $this->generateClass($unitName); |
|
66 | + $outputClass = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".php"; |
|
67 | + file_put_contents($outputClass, $class); |
|
68 | + |
|
69 | + $outputPage = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".page"; |
|
70 | + $page = $this->generatePage($tableName, $viewType); |
|
71 | + file_put_contents($outputPage, $page); |
|
72 | + } |
|
73 | + |
|
74 | + private function generatePage($tableName, $type, $tContentId = "Content") |
|
75 | + { |
|
76 | + $pageContent = $this->getPageContent($tableName, $type); |
|
77 | + return <<<EOD |
|
78 | 78 | <com:TContent ID="$tContentId"> |
79 | 79 | |
80 | 80 | $pageContent |
81 | 81 | |
82 | 82 | </com:TContent> |
83 | 83 | EOD; |
84 | - } |
|
85 | - |
|
86 | - private function getPageContent($tableName, $type) |
|
87 | - { |
|
88 | - $code = ""; |
|
89 | - $tableInfo = $this->_dbMetaData->getTableInfo($tableName); |
|
90 | - switch ($type) |
|
91 | - { |
|
92 | - case self::LIST_TYPE: |
|
93 | - break; |
|
94 | - case self::ADD_TYPE: |
|
95 | - foreach ($tableInfo->getColumns() as $colField => $colMetadata) |
|
96 | - { |
|
97 | - if (!$colMetadata->IsPrimaryKey && !$colMetadata->IsForeignKey) |
|
98 | - { |
|
99 | - $code .= $this->generateControl($colMetadata); |
|
100 | - $code .= $this->generateValidators($colMetadata); |
|
101 | - $code .= "\n"; |
|
102 | - } |
|
103 | - } |
|
104 | - foreach ($tableInfo->getForeignKeys() as $colField => $colMetadata) |
|
105 | - { |
|
106 | - $colField = $this->eq($colMetadata["table"]); |
|
107 | - $code .= "\t<com:TTextBox ID=$colField />\n"; |
|
108 | - $code .= "\n"; |
|
109 | - // TWsatBaseGenerator::pr($tableInfo); |
|
110 | - } |
|
111 | - $code .= "\t<com:TButton Text=\"Accept\" />\n"; |
|
112 | - |
|
113 | - case self::SHOW_TYPE: |
|
114 | - break; |
|
115 | - } |
|
116 | - return $code; |
|
117 | - } |
|
118 | - |
|
119 | - private function generateControl($colMetadata) |
|
120 | - { |
|
121 | - $controlType = "TTextBox"; |
|
122 | - switch ($colMetadata->DbType) |
|
123 | - { |
|
84 | + } |
|
85 | + |
|
86 | + private function getPageContent($tableName, $type) |
|
87 | + { |
|
88 | + $code = ""; |
|
89 | + $tableInfo = $this->_dbMetaData->getTableInfo($tableName); |
|
90 | + switch ($type) |
|
91 | + { |
|
92 | + case self::LIST_TYPE: |
|
93 | + break; |
|
94 | + case self::ADD_TYPE: |
|
95 | + foreach ($tableInfo->getColumns() as $colField => $colMetadata) |
|
96 | + { |
|
97 | + if (!$colMetadata->IsPrimaryKey && !$colMetadata->IsForeignKey) |
|
98 | + { |
|
99 | + $code .= $this->generateControl($colMetadata); |
|
100 | + $code .= $this->generateValidators($colMetadata); |
|
101 | + $code .= "\n"; |
|
102 | + } |
|
103 | + } |
|
104 | + foreach ($tableInfo->getForeignKeys() as $colField => $colMetadata) |
|
105 | + { |
|
106 | + $colField = $this->eq($colMetadata["table"]); |
|
107 | + $code .= "\t<com:TTextBox ID=$colField />\n"; |
|
108 | + $code .= "\n"; |
|
109 | + // TWsatBaseGenerator::pr($tableInfo); |
|
110 | + } |
|
111 | + $code .= "\t<com:TButton Text=\"Accept\" />\n"; |
|
112 | + |
|
113 | + case self::SHOW_TYPE: |
|
114 | + break; |
|
115 | + } |
|
116 | + return $code; |
|
117 | + } |
|
118 | + |
|
119 | + private function generateControl($colMetadata) |
|
120 | + { |
|
121 | + $controlType = "TTextBox"; |
|
122 | + switch ($colMetadata->DbType) |
|
123 | + { |
|
124 | 124 | |
125 | - } |
|
126 | - $controlId = $colMetadata->ColumnId; |
|
127 | - return "\t<com:$controlType ID=\"$controlId\" />\n"; |
|
128 | - } |
|
129 | - |
|
130 | - private function generateValidators($colMetadata) |
|
131 | - { |
|
132 | - $controlId = $colMetadata->ColumnId; |
|
133 | - $code = ""; |
|
134 | - if (!$colMetadata->AllowNull) |
|
135 | - { |
|
136 | - $code .= "\t<com:TRequiredFieldValidator ControlToValidate=$controlId ValidationGroup=\"addGroup\" Text=\"Field $controlId is required.\" Display=\"Dynamic\" />\n"; |
|
137 | - } |
|
138 | - return $code; |
|
139 | - } |
|
125 | + } |
|
126 | + $controlId = $colMetadata->ColumnId; |
|
127 | + return "\t<com:$controlType ID=\"$controlId\" />\n"; |
|
128 | + } |
|
129 | + |
|
130 | + private function generateValidators($colMetadata) |
|
131 | + { |
|
132 | + $controlId = $colMetadata->ColumnId; |
|
133 | + $code = ""; |
|
134 | + if (!$colMetadata->AllowNull) |
|
135 | + { |
|
136 | + $code .= "\t<com:TRequiredFieldValidator ControlToValidate=$controlId ValidationGroup=\"addGroup\" Text=\"Field $controlId is required.\" Display=\"Dynamic\" />\n"; |
|
137 | + } |
|
138 | + return $code; |
|
139 | + } |
|
140 | 140 | |
141 | 141 | // </editor-fold> |
142 | - //--------------------------------------------------------------------- |
|
143 | - // <editor-fold defaultstate="collapsed" desc="Code Behind Generation"> |
|
144 | - private function generateClass($classname) |
|
145 | - { |
|
146 | - $date = date('Y-m-d h:i:s'); |
|
147 | - $env_user = getenv("username"); |
|
148 | - return <<<EOD |
|
142 | + //--------------------------------------------------------------------- |
|
143 | + // <editor-fold defaultstate="collapsed" desc="Code Behind Generation"> |
|
144 | + private function generateClass($classname) |
|
145 | + { |
|
146 | + $date = date('Y-m-d h:i:s'); |
|
147 | + $env_user = getenv("username"); |
|
148 | + return <<<EOD |
|
149 | 149 | <?php |
150 | 150 | /** |
151 | 151 | * Auto generated by PRADO - WSAT on $date. |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | } |
158 | 158 | EOD; |
159 | - } |
|
159 | + } |
|
160 | 160 | |
161 | 161 | // </editor-fold> |
162 | 162 | } |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * Const View Types for generation |
19 | 19 | */ |
20 | - const LIST_TYPE = 0; |
|
21 | - const ADD_TYPE = 1; |
|
22 | - const SHOW_TYPE = 2; |
|
20 | + const LIST_TYPE=0; |
|
21 | + const ADD_TYPE=1; |
|
22 | + const SHOW_TYPE=2; |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * Bootstrap option |
@@ -46,34 +46,34 @@ discard block |
||
46 | 46 | // <editor-fold defaultstate="collapsed" desc="Page Generation"> |
47 | 47 | public function generate($tableName, $viewType) |
48 | 48 | { |
49 | - switch ($viewType) |
|
49 | + switch($viewType) |
|
50 | 50 | { |
51 | 51 | default: |
52 | 52 | case self::LIST_TYPE: |
53 | - $unitName = "list" . ucfirst($tableName); |
|
53 | + $unitName="list".ucfirst($tableName); |
|
54 | 54 | break; |
55 | 55 | |
56 | 56 | case self::ADD_TYPE: |
57 | - $unitName = "add" . ucfirst($tableName); |
|
57 | + $unitName="add".ucfirst($tableName); |
|
58 | 58 | break; |
59 | 59 | |
60 | 60 | case self::SHOW_TYPE: |
61 | - $unitName = "show" . ucfirst($tableName); |
|
61 | + $unitName="show".ucfirst($tableName); |
|
62 | 62 | break; |
63 | 63 | } |
64 | 64 | |
65 | - $class = $this->generateClass($unitName); |
|
66 | - $outputClass = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".php"; |
|
65 | + $class=$this->generateClass($unitName); |
|
66 | + $outputClass=$this->_opFile.DIRECTORY_SEPARATOR.$unitName.".php"; |
|
67 | 67 | file_put_contents($outputClass, $class); |
68 | 68 | |
69 | - $outputPage = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".page"; |
|
70 | - $page = $this->generatePage($tableName, $viewType); |
|
69 | + $outputPage=$this->_opFile.DIRECTORY_SEPARATOR.$unitName.".page"; |
|
70 | + $page=$this->generatePage($tableName, $viewType); |
|
71 | 71 | file_put_contents($outputPage, $page); |
72 | 72 | } |
73 | 73 | |
74 | - private function generatePage($tableName, $type, $tContentId = "Content") |
|
74 | + private function generatePage($tableName, $type, $tContentId="Content") |
|
75 | 75 | { |
76 | - $pageContent = $this->getPageContent($tableName, $type); |
|
76 | + $pageContent=$this->getPageContent($tableName, $type); |
|
77 | 77 | return <<<EOD |
78 | 78 | <com:TContent ID="$tContentId"> |
79 | 79 | |
@@ -85,30 +85,30 @@ discard block |
||
85 | 85 | |
86 | 86 | private function getPageContent($tableName, $type) |
87 | 87 | { |
88 | - $code = ""; |
|
89 | - $tableInfo = $this->_dbMetaData->getTableInfo($tableName); |
|
90 | - switch ($type) |
|
88 | + $code=""; |
|
89 | + $tableInfo=$this->_dbMetaData->getTableInfo($tableName); |
|
90 | + switch($type) |
|
91 | 91 | { |
92 | 92 | case self::LIST_TYPE: |
93 | 93 | break; |
94 | 94 | case self::ADD_TYPE: |
95 | - foreach ($tableInfo->getColumns() as $colField => $colMetadata) |
|
95 | + foreach($tableInfo->getColumns() as $colField => $colMetadata) |
|
96 | 96 | { |
97 | - if (!$colMetadata->IsPrimaryKey && !$colMetadata->IsForeignKey) |
|
97 | + if(!$colMetadata->IsPrimaryKey && !$colMetadata->IsForeignKey) |
|
98 | 98 | { |
99 | - $code .= $this->generateControl($colMetadata); |
|
100 | - $code .= $this->generateValidators($colMetadata); |
|
101 | - $code .= "\n"; |
|
99 | + $code.=$this->generateControl($colMetadata); |
|
100 | + $code.=$this->generateValidators($colMetadata); |
|
101 | + $code.="\n"; |
|
102 | 102 | } |
103 | 103 | } |
104 | - foreach ($tableInfo->getForeignKeys() as $colField => $colMetadata) |
|
104 | + foreach($tableInfo->getForeignKeys() as $colField => $colMetadata) |
|
105 | 105 | { |
106 | - $colField = $this->eq($colMetadata["table"]); |
|
107 | - $code .= "\t<com:TTextBox ID=$colField />\n"; |
|
108 | - $code .= "\n"; |
|
106 | + $colField=$this->eq($colMetadata["table"]); |
|
107 | + $code.="\t<com:TTextBox ID=$colField />\n"; |
|
108 | + $code.="\n"; |
|
109 | 109 | // TWsatBaseGenerator::pr($tableInfo); |
110 | 110 | } |
111 | - $code .= "\t<com:TButton Text=\"Accept\" />\n"; |
|
111 | + $code.="\t<com:TButton Text=\"Accept\" />\n"; |
|
112 | 112 | |
113 | 113 | case self::SHOW_TYPE: |
114 | 114 | break; |
@@ -118,22 +118,22 @@ discard block |
||
118 | 118 | |
119 | 119 | private function generateControl($colMetadata) |
120 | 120 | { |
121 | - $controlType = "TTextBox"; |
|
122 | - switch ($colMetadata->DbType) |
|
121 | + $controlType="TTextBox"; |
|
122 | + switch($colMetadata->DbType) |
|
123 | 123 | { |
124 | 124 | |
125 | 125 | } |
126 | - $controlId = $colMetadata->ColumnId; |
|
126 | + $controlId=$colMetadata->ColumnId; |
|
127 | 127 | return "\t<com:$controlType ID=\"$controlId\" />\n"; |
128 | 128 | } |
129 | 129 | |
130 | 130 | private function generateValidators($colMetadata) |
131 | 131 | { |
132 | - $controlId = $colMetadata->ColumnId; |
|
133 | - $code = ""; |
|
134 | - if (!$colMetadata->AllowNull) |
|
132 | + $controlId=$colMetadata->ColumnId; |
|
133 | + $code=""; |
|
134 | + if(!$colMetadata->AllowNull) |
|
135 | 135 | { |
136 | - $code .= "\t<com:TRequiredFieldValidator ControlToValidate=$controlId ValidationGroup=\"addGroup\" Text=\"Field $controlId is required.\" Display=\"Dynamic\" />\n"; |
|
136 | + $code.="\t<com:TRequiredFieldValidator ControlToValidate=$controlId ValidationGroup=\"addGroup\" Text=\"Field $controlId is required.\" Display=\"Dynamic\" />\n"; |
|
137 | 137 | } |
138 | 138 | return $code; |
139 | 139 | } |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | // <editor-fold defaultstate="collapsed" desc="Code Behind Generation"> |
144 | 144 | private function generateClass($classname) |
145 | 145 | { |
146 | - $date = date('Y-m-d h:i:s'); |
|
147 | - $env_user = getenv("username"); |
|
146 | + $date=date('Y-m-d h:i:s'); |
|
147 | + $env_user=getenv("username"); |
|
148 | 148 | return <<<EOD |
149 | 149 | <?php |
150 | 150 | /** |