@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function insertAt($index, $item) |
62 | 62 | { |
63 | - if($item instanceof TControl) |
|
63 | + if ($item instanceof TControl) |
|
64 | 64 | { |
65 | 65 | parent::insertAt($index, $item); |
66 | 66 | $this->_o->addedControl($item); |
67 | 67 | } |
68 | - elseif(is_string($item) || ($item instanceof IRenderable)) |
|
68 | + elseif (is_string($item) || ($item instanceof IRenderable)) |
|
69 | 69 | parent::insertAt($index, $item); |
70 | 70 | else |
71 | 71 | throw new TInvalidDataTypeException('controlcollection_control_required'); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | public function removeAt($index) |
82 | 82 | { |
83 | 83 | $item = parent::removeAt($index); |
84 | - if($item instanceof TControl) |
|
84 | + if ($item instanceof TControl) |
|
85 | 85 | $this->_o->removedControl($item); |
86 | 86 | return $item; |
87 | 87 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | public function clear() |
93 | 93 | { |
94 | 94 | parent::clear(); |
95 | - if($this->_o instanceof INamingContainer) |
|
95 | + if ($this->_o instanceof INamingContainer) |
|
96 | 96 | $this->_o->clearNamingContainer(); |
97 | 97 | } |
98 | 98 | } |
99 | 99 | \ No newline at end of file |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | { |
65 | 65 | parent::insertAt($index, $item); |
66 | 66 | $this->_o->addedControl($item); |
67 | + } elseif(is_string($item) || ($item instanceof IRenderable)) { |
|
68 | + parent::insertAt($index, $item); |
|
69 | + } else { |
|
70 | + throw new TInvalidDataTypeException('controlcollection_control_required'); |
|
67 | 71 | } |
68 | - elseif(is_string($item) || ($item instanceof IRenderable)) |
|
69 | - parent::insertAt($index, $item); |
|
70 | - else |
|
71 | - throw new TInvalidDataTypeException('controlcollection_control_required'); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -81,8 +81,9 @@ discard block |
||
81 | 81 | public function removeAt($index) |
82 | 82 | { |
83 | 83 | $item = parent::removeAt($index); |
84 | - if($item instanceof TControl) |
|
85 | - $this->_o->removedControl($item); |
|
84 | + if($item instanceof TControl) { |
|
85 | + $this->_o->removedControl($item); |
|
86 | + } |
|
86 | 87 | return $item; |
87 | 88 | } |
88 | 89 | |
@@ -92,7 +93,8 @@ discard block |
||
92 | 93 | public function clear() |
93 | 94 | { |
94 | 95 | parent::clear(); |
95 | - if($this->_o instanceof INamingContainer) |
|
96 | - $this->_o->clearNamingContainer(); |
|
96 | + if($this->_o instanceof INamingContainer) { |
|
97 | + $this->_o->clearNamingContainer(); |
|
98 | + } |
|
97 | 99 | } |
98 | 100 | } |
99 | 101 | \ No newline at end of file |
@@ -89,33 +89,33 @@ discard block |
||
89 | 89 | $this->_name = basename($themePath); |
90 | 90 | $cacheValid = false; |
91 | 91 | // TODO: the following needs to be cleaned up (Qiang) |
92 | - if(($cache = $this->getApplication()->getCache()) !== null) |
|
92 | + if (($cache = $this->getApplication()->getCache()) !== null) |
|
93 | 93 | { |
94 | - $array = $cache->get(self::THEME_CACHE_PREFIX . $themePath); |
|
95 | - if(is_array($array)) |
|
94 | + $array = $cache->get(self::THEME_CACHE_PREFIX.$themePath); |
|
95 | + if (is_array($array)) |
|
96 | 96 | { |
97 | 97 | list($skins, $cssFiles, $jsFiles, $timestamp) = $array; |
98 | - if($this->getApplication()->getMode() !== TApplicationMode::Performance) |
|
98 | + if ($this->getApplication()->getMode() !== TApplicationMode::Performance) |
|
99 | 99 | { |
100 | - if(($dir = opendir($themePath)) === false) |
|
100 | + if (($dir = opendir($themePath)) === false) |
|
101 | 101 | throw new TIOException('theme_path_inexistent', $themePath); |
102 | 102 | $cacheValid = true; |
103 | - while(($file = readdir($dir)) !== false) |
|
103 | + while (($file = readdir($dir)) !== false) |
|
104 | 104 | { |
105 | - if($file === '.' || $file === '..') |
|
105 | + if ($file === '.' || $file === '..') |
|
106 | 106 | continue; |
107 | - elseif(basename($file, '.css') !== $file) |
|
108 | - $this->_cssFiles[] = $themeUrl . '/' . $file; |
|
109 | - elseif(basename($file, '.js') !== $file) |
|
110 | - $this->_jsFiles[] = $themeUrl . '/' . $file; |
|
111 | - elseif(basename($file, self::SKIN_FILE_EXT) !== $file && filemtime($themePath . DIRECTORY_SEPARATOR . $file) > $timestamp) |
|
107 | + elseif (basename($file, '.css') !== $file) |
|
108 | + $this->_cssFiles[] = $themeUrl.'/'.$file; |
|
109 | + elseif (basename($file, '.js') !== $file) |
|
110 | + $this->_jsFiles[] = $themeUrl.'/'.$file; |
|
111 | + elseif (basename($file, self::SKIN_FILE_EXT) !== $file && filemtime($themePath.DIRECTORY_SEPARATOR.$file) > $timestamp) |
|
112 | 112 | { |
113 | 113 | $cacheValid = false; |
114 | 114 | break; |
115 | 115 | } |
116 | 116 | } |
117 | 117 | closedir($dir); |
118 | - if($cacheValid) |
|
118 | + if ($cacheValid) |
|
119 | 119 | $this->_skins = $skins; |
120 | 120 | } |
121 | 121 | else |
@@ -127,34 +127,34 @@ discard block |
||
127 | 127 | } |
128 | 128 | } |
129 | 129 | } |
130 | - if(!$cacheValid) |
|
130 | + if (!$cacheValid) |
|
131 | 131 | { |
132 | 132 | $this->_cssFiles = []; |
133 | 133 | $this->_jsFiles = []; |
134 | 134 | $this->_skins = []; |
135 | - if(($dir = opendir($themePath)) === false) |
|
135 | + if (($dir = opendir($themePath)) === false) |
|
136 | 136 | throw new TIOException('theme_path_inexistent', $themePath); |
137 | - while(($file = readdir($dir)) !== false) |
|
137 | + while (($file = readdir($dir)) !== false) |
|
138 | 138 | { |
139 | - if($file === '.' || $file === '..') |
|
139 | + if ($file === '.' || $file === '..') |
|
140 | 140 | continue; |
141 | - elseif(basename($file, '.css') !== $file) |
|
142 | - $this->_cssFiles[] = $themeUrl . '/' . $file; |
|
143 | - elseif(basename($file, '.js') !== $file) |
|
144 | - $this->_jsFiles[] = $themeUrl . '/' . $file; |
|
145 | - elseif(basename($file, self::SKIN_FILE_EXT) !== $file) |
|
141 | + elseif (basename($file, '.css') !== $file) |
|
142 | + $this->_cssFiles[] = $themeUrl.'/'.$file; |
|
143 | + elseif (basename($file, '.js') !== $file) |
|
144 | + $this->_jsFiles[] = $themeUrl.'/'.$file; |
|
145 | + elseif (basename($file, self::SKIN_FILE_EXT) !== $file) |
|
146 | 146 | { |
147 | - $template = new TTemplate(file_get_contents($themePath . '/' . $file), $themePath, $themePath . '/' . $file); |
|
148 | - foreach($template->getItems() as $skin) |
|
147 | + $template = new TTemplate(file_get_contents($themePath.'/'.$file), $themePath, $themePath.'/'.$file); |
|
148 | + foreach ($template->getItems() as $skin) |
|
149 | 149 | { |
150 | - if(!isset($skin[2])) // a text string, ignored |
|
150 | + if (!isset($skin[2])) // a text string, ignored |
|
151 | 151 | continue; |
152 | - elseif($skin[0] !== -1) |
|
152 | + elseif ($skin[0] !== -1) |
|
153 | 153 | throw new TConfigurationException('theme_control_nested', $skin[1], dirname($themePath)); |
154 | 154 | $type = $skin[1]; |
155 | - $id = isset($skin[2]['skinid'])?$skin[2]['skinid']:0; |
|
155 | + $id = isset($skin[2]['skinid']) ? $skin[2]['skinid'] : 0; |
|
156 | 156 | unset($skin[2]['skinid']); |
157 | - if(isset($this->_skins[$type][$id])) |
|
157 | + if (isset($this->_skins[$type][$id])) |
|
158 | 158 | throw new TConfigurationException('theme_skinid_duplicated', $type, $id, dirname($themePath)); |
159 | 159 | /* |
160 | 160 | foreach($skin[2] as $name=>$value) |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | closedir($dir); |
171 | 171 | sort($this->_cssFiles); |
172 | 172 | sort($this->_jsFiles); |
173 | - if($cache !== null) |
|
174 | - $cache->set(self::THEME_CACHE_PREFIX . $themePath, [$this->_skins,$this->_cssFiles,$this->_jsFiles,time()]); |
|
173 | + if ($cache !== null) |
|
174 | + $cache->set(self::THEME_CACHE_PREFIX.$themePath, [$this->_skins, $this->_cssFiles, $this->_jsFiles, time()]); |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
@@ -251,22 +251,22 @@ discard block |
||
251 | 251 | public function applySkin($control) |
252 | 252 | { |
253 | 253 | $type = get_class($control); |
254 | - if(($id = $control->getSkinID()) === '') |
|
254 | + if (($id = $control->getSkinID()) === '') |
|
255 | 255 | $id = 0; |
256 | - if(isset($this->_skins[$type][$id])) |
|
256 | + if (isset($this->_skins[$type][$id])) |
|
257 | 257 | { |
258 | - foreach($this->_skins[$type][$id] as $name => $value) |
|
258 | + foreach ($this->_skins[$type][$id] as $name => $value) |
|
259 | 259 | { |
260 | 260 | Prado::trace("Applying skin $name to $type", 'Prado\Web\UI\TThemeManager'); |
261 | - if(is_array($value)) |
|
261 | + if (is_array($value)) |
|
262 | 262 | { |
263 | - switch($value[0]) |
|
263 | + switch ($value[0]) |
|
264 | 264 | { |
265 | 265 | case TTemplate::CONFIG_EXPRESSION: |
266 | 266 | $value = $this->evaluateExpression($value[1]); |
267 | 267 | break; |
268 | 268 | case TTemplate::CONFIG_ASSET: |
269 | - $value = $this->_themeUrl . '/' . ltrim($value[1], '/'); |
|
269 | + $value = $this->_themeUrl.'/'.ltrim($value[1], '/'); |
|
270 | 270 | break; |
271 | 271 | case TTemplate::CONFIG_DATABIND: |
272 | 272 | $control->bindProperty($name, $value[1]); |
@@ -285,15 +285,15 @@ discard block |
||
285 | 285 | break; |
286 | 286 | } |
287 | 287 | } |
288 | - if(!is_array($value)) |
|
288 | + if (!is_array($value)) |
|
289 | 289 | { |
290 | - if(strpos($name, '.') === false) // is simple property or custom attribute |
|
290 | + if (strpos($name, '.') === false) // is simple property or custom attribute |
|
291 | 291 | { |
292 | - if($control->hasProperty($name)) |
|
292 | + if ($control->hasProperty($name)) |
|
293 | 293 | { |
294 | - if($control->canSetProperty($name)) |
|
294 | + if ($control->canSetProperty($name)) |
|
295 | 295 | { |
296 | - $setter = 'set' . $name; |
|
296 | + $setter = 'set'.$name; |
|
297 | 297 | $control->$setter($value); |
298 | 298 | } |
299 | 299 | else |
@@ -97,28 +97,29 @@ discard block |
||
97 | 97 | list($skins, $cssFiles, $jsFiles, $timestamp) = $array; |
98 | 98 | if($this->getApplication()->getMode() !== TApplicationMode::Performance) |
99 | 99 | { |
100 | - if(($dir = opendir($themePath)) === false) |
|
101 | - throw new TIOException('theme_path_inexistent', $themePath); |
|
100 | + if(($dir = opendir($themePath)) === false) { |
|
101 | + throw new TIOException('theme_path_inexistent', $themePath); |
|
102 | + } |
|
102 | 103 | $cacheValid = true; |
103 | 104 | while(($file = readdir($dir)) !== false) |
104 | 105 | { |
105 | - if($file === '.' || $file === '..') |
|
106 | - continue; |
|
107 | - elseif(basename($file, '.css') !== $file) |
|
108 | - $this->_cssFiles[] = $themeUrl . '/' . $file; |
|
109 | - elseif(basename($file, '.js') !== $file) |
|
110 | - $this->_jsFiles[] = $themeUrl . '/' . $file; |
|
111 | - elseif(basename($file, self::SKIN_FILE_EXT) !== $file && filemtime($themePath . DIRECTORY_SEPARATOR . $file) > $timestamp) |
|
106 | + if($file === '.' || $file === '..') { |
|
107 | + continue; |
|
108 | + } elseif(basename($file, '.css') !== $file) { |
|
109 | + $this->_cssFiles[] = $themeUrl . '/' . $file; |
|
110 | + } elseif(basename($file, '.js') !== $file) { |
|
111 | + $this->_jsFiles[] = $themeUrl . '/' . $file; |
|
112 | + } elseif(basename($file, self::SKIN_FILE_EXT) !== $file && filemtime($themePath . DIRECTORY_SEPARATOR . $file) > $timestamp) |
|
112 | 113 | { |
113 | 114 | $cacheValid = false; |
114 | 115 | break; |
115 | 116 | } |
116 | 117 | } |
117 | 118 | closedir($dir); |
118 | - if($cacheValid) |
|
119 | - $this->_skins = $skins; |
|
120 | - } |
|
121 | - else |
|
119 | + if($cacheValid) { |
|
120 | + $this->_skins = $skins; |
|
121 | + } |
|
122 | + } else |
|
122 | 123 | { |
123 | 124 | $cacheValid = true; |
124 | 125 | $this->_cssFiles = $cssFiles; |
@@ -132,30 +133,34 @@ discard block |
||
132 | 133 | $this->_cssFiles = []; |
133 | 134 | $this->_jsFiles = []; |
134 | 135 | $this->_skins = []; |
135 | - if(($dir = opendir($themePath)) === false) |
|
136 | - throw new TIOException('theme_path_inexistent', $themePath); |
|
136 | + if(($dir = opendir($themePath)) === false) { |
|
137 | + throw new TIOException('theme_path_inexistent', $themePath); |
|
138 | + } |
|
137 | 139 | while(($file = readdir($dir)) !== false) |
138 | 140 | { |
139 | - if($file === '.' || $file === '..') |
|
140 | - continue; |
|
141 | - elseif(basename($file, '.css') !== $file) |
|
142 | - $this->_cssFiles[] = $themeUrl . '/' . $file; |
|
143 | - elseif(basename($file, '.js') !== $file) |
|
144 | - $this->_jsFiles[] = $themeUrl . '/' . $file; |
|
145 | - elseif(basename($file, self::SKIN_FILE_EXT) !== $file) |
|
141 | + if($file === '.' || $file === '..') { |
|
142 | + continue; |
|
143 | + } elseif(basename($file, '.css') !== $file) { |
|
144 | + $this->_cssFiles[] = $themeUrl . '/' . $file; |
|
145 | + } elseif(basename($file, '.js') !== $file) { |
|
146 | + $this->_jsFiles[] = $themeUrl . '/' . $file; |
|
147 | + } elseif(basename($file, self::SKIN_FILE_EXT) !== $file) |
|
146 | 148 | { |
147 | 149 | $template = new TTemplate(file_get_contents($themePath . '/' . $file), $themePath, $themePath . '/' . $file); |
148 | 150 | foreach($template->getItems() as $skin) |
149 | 151 | { |
150 | - if(!isset($skin[2])) // a text string, ignored |
|
152 | + if(!isset($skin[2])) { |
|
153 | + // a text string, ignored |
|
151 | 154 | continue; |
152 | - elseif($skin[0] !== -1) |
|
153 | - throw new TConfigurationException('theme_control_nested', $skin[1], dirname($themePath)); |
|
155 | + } elseif($skin[0] !== -1) { |
|
156 | + throw new TConfigurationException('theme_control_nested', $skin[1], dirname($themePath)); |
|
157 | + } |
|
154 | 158 | $type = $skin[1]; |
155 | 159 | $id = isset($skin[2]['skinid'])?$skin[2]['skinid']:0; |
156 | 160 | unset($skin[2]['skinid']); |
157 | - if(isset($this->_skins[$type][$id])) |
|
158 | - throw new TConfigurationException('theme_skinid_duplicated', $type, $id, dirname($themePath)); |
|
161 | + if(isset($this->_skins[$type][$id])) { |
|
162 | + throw new TConfigurationException('theme_skinid_duplicated', $type, $id, dirname($themePath)); |
|
163 | + } |
|
159 | 164 | /* |
160 | 165 | foreach($skin[2] as $name=>$value) |
161 | 166 | { |
@@ -170,8 +175,9 @@ discard block |
||
170 | 175 | closedir($dir); |
171 | 176 | sort($this->_cssFiles); |
172 | 177 | sort($this->_jsFiles); |
173 | - if($cache !== null) |
|
174 | - $cache->set(self::THEME_CACHE_PREFIX . $themePath, [$this->_skins,$this->_cssFiles,$this->_jsFiles,time()]); |
|
178 | + if($cache !== null) { |
|
179 | + $cache->set(self::THEME_CACHE_PREFIX . $themePath, [$this->_skins,$this->_cssFiles,$this->_jsFiles,time()]); |
|
180 | + } |
|
175 | 181 | } |
176 | 182 | } |
177 | 183 | |
@@ -251,8 +257,9 @@ discard block |
||
251 | 257 | public function applySkin($control) |
252 | 258 | { |
253 | 259 | $type = get_class($control); |
254 | - if(($id = $control->getSkinID()) === '') |
|
255 | - $id = 0; |
|
260 | + if(($id = $control->getSkinID()) === '') { |
|
261 | + $id = 0; |
|
262 | + } |
|
256 | 263 | if(isset($this->_skins[$type][$id])) |
257 | 264 | { |
258 | 265 | foreach($this->_skins[$type][$id] as $name => $value) |
@@ -287,29 +294,32 @@ discard block |
||
287 | 294 | } |
288 | 295 | if(!is_array($value)) |
289 | 296 | { |
290 | - if(strpos($name, '.') === false) // is simple property or custom attribute |
|
297 | + if(strpos($name, '.') === false) { |
|
298 | + // is simple property or custom attribute |
|
291 | 299 | { |
292 | 300 | if($control->hasProperty($name)) |
293 | 301 | { |
294 | 302 | if($control->canSetProperty($name)) |
295 | 303 | { |
296 | 304 | $setter = 'set' . $name; |
305 | + } |
|
297 | 306 | $control->$setter($value); |
307 | + } else { |
|
308 | + throw new TConfigurationException('theme_property_readonly', $type, $name); |
|
298 | 309 | } |
299 | - else |
|
300 | - throw new TConfigurationException('theme_property_readonly', $type, $name); |
|
310 | + } else { |
|
311 | + throw new TConfigurationException('theme_property_undefined', $type, $name); |
|
301 | 312 | } |
302 | - else |
|
303 | - throw new TConfigurationException('theme_property_undefined', $type, $name); |
|
304 | - } |
|
305 | - else // complex property |
|
313 | + } else { |
|
314 | + // complex property |
|
306 | 315 | $control->setSubProperty($name, $value); |
316 | + } |
|
307 | 317 | } |
308 | 318 | } |
309 | 319 | return true; |
320 | + } else { |
|
321 | + return false; |
|
310 | 322 | } |
311 | - else |
|
312 | - return false; |
|
313 | 323 | } |
314 | 324 | |
315 | 325 | /** |
@@ -121,8 +121,9 @@ discard block |
||
121 | 121 | { |
122 | 122 | $this->raiseCallbackEvent($param); |
123 | 123 | return true; |
124 | + } else { |
|
125 | + return false; |
|
124 | 126 | } |
125 | - else return false; |
|
126 | 127 | } |
127 | 128 | |
128 | 129 | /** |
@@ -147,8 +148,9 @@ discard block |
||
147 | 148 | { |
148 | 149 | parent::addAttributesToRender($writer); |
149 | 150 | $writer->addAttribute('id', $this->getClientID()); |
150 | - if ($this->hasEventHandler('OnRowSelected')) |
|
151 | - $this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getPostBackOptions()); |
|
151 | + if ($this->hasEventHandler('OnRowSelected')) { |
|
152 | + $this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getPostBackOptions()); |
|
153 | + } |
|
152 | 154 | } |
153 | 155 | |
154 | 156 | /** |
@@ -163,18 +165,19 @@ discard block |
||
163 | 165 | if ($this->getHasPreRendered()) |
164 | 166 | { |
165 | 167 | parent::render($writer); |
166 | - if ($this->getActiveControl()->canUpdateClientSide()) |
|
167 | - $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
|
168 | - } |
|
169 | - else |
|
168 | + if ($this->getActiveControl()->canUpdateClientSide()) { |
|
169 | + $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
|
170 | + } |
|
171 | + } else |
|
170 | 172 | { |
171 | 173 | $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
172 | 174 | // If we update a TActiveTableRow on callback, we shouldn't update all childs, |
173 | 175 | // because the whole content will be replaced by the parent. |
174 | 176 | if ($this->getHasControls()) |
175 | 177 | { |
176 | - foreach ($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control) |
|
177 | - $control->getActiveControl()->setEnableUpdate(false); |
|
178 | + foreach ($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control) { |
|
179 | + $control->getActiveControl()->setEnableUpdate(false); |
|
180 | + } |
|
178 | 181 | } |
179 | 182 | } |
180 | 183 | } |
@@ -199,8 +202,9 @@ discard block |
||
199 | 202 | */ |
200 | 203 | public function getRowIndex() |
201 | 204 | { |
202 | - foreach ($this->getTable()->getRows() as $key => $row) |
|
203 | - if ($row == $this) return $key; |
|
205 | + foreach ($this->getTable()->getRows() as $key => $row) { |
|
206 | + if ($row == $this) return $key; |
|
207 | + } |
|
204 | 208 | throw new TConfigurationException('tactivetablerow_control_notincollection', get_class($this), $this->getUniqueID()); |
205 | 209 | } |
206 | 210 | |
@@ -218,8 +222,11 @@ discard block |
||
218 | 222 | { |
219 | 223 | $table = $table->getParent(); |
220 | 224 | } |
221 | - if ($table instanceof TTable) $this->_table = $table; |
|
222 | - else throw new TConfigurationException('tactivetablerow_control_outoftable', get_class($this), $this->getUniqueID()); |
|
225 | + if ($table instanceof TTable) { |
|
226 | + $this->_table = $table; |
|
227 | + } else { |
|
228 | + throw new TConfigurationException('tactivetablerow_control_outoftable', get_class($this), $this->getUniqueID()); |
|
229 | + } |
|
223 | 230 | } |
224 | 231 | return $this->_table; |
225 | 232 | } |
@@ -36,17 +36,17 @@ |
||
36 | 36 | */ |
37 | 37 | class TActiveEditCommandColumn extends TEditCommandColumn { |
38 | 38 | protected function createButton($commandName, $text, $causesValidation, $validationGroup) { |
39 | - if($this->getButtonType() === TButtonColumnType::LinkButton) |
|
39 | + if ($this->getButtonType() === TButtonColumnType::LinkButton) |
|
40 | 40 | $button = new TActiveLinkButton; |
41 | - elseif($this->getButtonType() === TButtonColumnType::PushButton) |
|
41 | + elseif ($this->getButtonType() === TButtonColumnType::PushButton) |
|
42 | 42 | $button = new TActiveButton; |
43 | 43 | else // image buttons |
44 | 44 | { |
45 | 45 | $button = new TActiveImageButton; |
46 | 46 | $button->setToolTip($text); |
47 | - if(strcasecmp($commandName, 'Update') === 0) |
|
47 | + if (strcasecmp($commandName, 'Update') === 0) |
|
48 | 48 | $url = $this->getUpdateImageUrl(); |
49 | - elseif(strcasecmp($commandName, 'Cancel') === 0) |
|
49 | + elseif (strcasecmp($commandName, 'Cancel') === 0) |
|
50 | 50 | $url = $this->getCancelImageUrl(); |
51 | 51 | else |
52 | 52 | $url = $this->getEditImageUrl(); |
@@ -36,20 +36,21 @@ |
||
36 | 36 | */ |
37 | 37 | class TActiveEditCommandColumn extends TEditCommandColumn { |
38 | 38 | protected function createButton($commandName, $text, $causesValidation, $validationGroup) { |
39 | - if($this->getButtonType() === TButtonColumnType::LinkButton) |
|
40 | - $button = new TActiveLinkButton; |
|
41 | - elseif($this->getButtonType() === TButtonColumnType::PushButton) |
|
42 | - $button = new TActiveButton; |
|
43 | - else // image buttons |
|
39 | + if($this->getButtonType() === TButtonColumnType::LinkButton) { |
|
40 | + $button = new TActiveLinkButton; |
|
41 | + } elseif($this->getButtonType() === TButtonColumnType::PushButton) { |
|
42 | + $button = new TActiveButton; |
|
43 | + } else // image buttons |
|
44 | 44 | { |
45 | 45 | $button = new TActiveImageButton; |
46 | 46 | $button->setToolTip($text); |
47 | - if(strcasecmp($commandName, 'Update') === 0) |
|
48 | - $url = $this->getUpdateImageUrl(); |
|
49 | - elseif(strcasecmp($commandName, 'Cancel') === 0) |
|
50 | - $url = $this->getCancelImageUrl(); |
|
51 | - else |
|
52 | - $url = $this->getEditImageUrl(); |
|
47 | + if(strcasecmp($commandName, 'Update') === 0) { |
|
48 | + $url = $this->getUpdateImageUrl(); |
|
49 | + } elseif(strcasecmp($commandName, 'Cancel') === 0) { |
|
50 | + $url = $this->getCancelImageUrl(); |
|
51 | + } else { |
|
52 | + $url = $this->getEditImageUrl(); |
|
53 | + } |
|
53 | 54 | $button->setImageUrl($url); |
54 | 55 | } |
55 | 56 | $button->setText($text); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function flushContent() |
61 | 61 | { |
62 | - foreach($this->_writers as $writer) |
|
62 | + foreach ($this->_writers as $writer) |
|
63 | 63 | echo $writer->flush(); |
64 | 64 | parent::flushContent(); |
65 | 65 | } |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function httpRedirect($url) |
88 | 88 | { |
89 | - if($url[0] === '/') |
|
90 | - $url = $this->getRequest()->getBaseUrl() . $url; |
|
89 | + if ($url[0] === '/') |
|
90 | + $url = $this->getRequest()->getBaseUrl().$url; |
|
91 | 91 | $this->_redirectUrl = str_replace('&', '&', $url); |
92 | 92 | } |
93 | 93 |
@@ -59,8 +59,9 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function flushContent() |
61 | 61 | { |
62 | - foreach($this->_writers as $writer) |
|
63 | - echo $writer->flush(); |
|
62 | + foreach($this->_writers as $writer) { |
|
63 | + echo $writer->flush(); |
|
64 | + } |
|
64 | 65 | parent::flushContent(); |
65 | 66 | } |
66 | 67 | |
@@ -86,8 +87,9 @@ discard block |
||
86 | 87 | */ |
87 | 88 | public function httpRedirect($url) |
88 | 89 | { |
89 | - if($url[0] === '/') |
|
90 | - $url = $this->getRequest()->getBaseUrl() . $url; |
|
90 | + if($url[0] === '/') { |
|
91 | + $url = $this->getRequest()->getBaseUrl() . $url; |
|
92 | + } |
|
91 | 93 | $this->_redirectUrl = str_replace('&', '&', $url); |
92 | 94 | } |
93 | 95 |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | */ |
71 | 71 | protected function setBaseControlClass($type) |
72 | 72 | { |
73 | - if($type === null) |
|
73 | + if ($type === null) |
|
74 | 74 | { |
75 | - if($this->getControl() instanceof ICallbackEventHandler) |
|
75 | + if ($this->getControl() instanceof ICallbackEventHandler) |
|
76 | 76 | $this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveCallbackControl'; |
77 | 77 | else |
78 | 78 | $this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveControl'; |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | public function render($writer) |
96 | 96 | { |
97 | 97 | $this->getPage()->getClientScript()->registerPradoScript('ajax'); |
98 | - if($this->_control->getVisible(false)) |
|
98 | + if ($this->_control->getVisible(false)) |
|
99 | 99 | { |
100 | 100 | parent::render($writer); |
101 | 101 | } else { |
102 | - $writer->write("<span id=\"" . $this->_control->getClientID() . "\" style=\"display:none\"></span>"); |
|
102 | + $writer->write("<span id=\"".$this->_control->getClientID()."\" style=\"display:none\"></span>"); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function getBaseActiveControl() |
118 | 118 | { |
119 | - if($this->_baseActiveControl === null) |
|
119 | + if ($this->_baseActiveControl === null) |
|
120 | 120 | { |
121 | 121 | $type = $this->_activeControlType; |
122 | 122 | $this->_baseActiveControl = new $type($this->getControl()); |
@@ -129,10 +129,10 @@ discard block |
||
129 | 129 | */ |
130 | 130 | protected function getIsTrackingPageState() |
131 | 131 | { |
132 | - if($this->getPage()->getIsCallback()) |
|
132 | + if ($this->getPage()->getIsCallback()) |
|
133 | 133 | { |
134 | 134 | $target = $this->getPage()->getCallbackEventTarget(); |
135 | - if($target instanceof ICallbackEventHandler) |
|
135 | + if ($target instanceof ICallbackEventHandler) |
|
136 | 136 | { |
137 | 137 | $client = $target->getActiveControl()->getClientSide(); |
138 | 138 | return $client->getEnablePageStateUpdate(); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function onLoad($param) |
148 | 148 | { |
149 | - if($this->getIsTrackingPageState()) |
|
149 | + if ($this->getIsTrackingPageState()) |
|
150 | 150 | { |
151 | 151 | $stateTrackerClass = $this->_stateTrackerClass; |
152 | 152 | $this->_stateTracker = new $stateTrackerClass($this->getControl()); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function saveState() |
163 | 163 | { |
164 | - if(($this->_stateTracker !== null) |
|
164 | + if (($this->_stateTracker !== null) |
|
165 | 165 | && $this->getControl()->getActiveControl()->canUpdateClientSide(true)) |
166 | 166 | { |
167 | 167 | $this->_stateTracker->respondToChanges(); |
@@ -72,13 +72,14 @@ |
||
72 | 72 | { |
73 | 73 | if($type === null) |
74 | 74 | { |
75 | - if($this->getControl() instanceof ICallbackEventHandler) |
|
76 | - $this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveCallbackControl'; |
|
77 | - else |
|
78 | - $this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveControl'; |
|
75 | + if($this->getControl() instanceof ICallbackEventHandler) { |
|
76 | + $this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveCallbackControl'; |
|
77 | + } else { |
|
78 | + $this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveControl'; |
|
79 | + } |
|
80 | + } else { |
|
81 | + $this->_activeControlType = $type; |
|
79 | 82 | } |
80 | - else |
|
81 | - $this->_activeControlType = $type; |
|
82 | 83 | } |
83 | 84 | |
84 | 85 | /** |
@@ -89,13 +89,13 @@ |
||
89 | 89 | */ |
90 | 90 | public function setSelectionMode($value) |
91 | 91 | { |
92 | - if(parent::getSelectionMode() === $value) |
|
92 | + if (parent::getSelectionMode() === $value) |
|
93 | 93 | return; |
94 | 94 | |
95 | 95 | parent::setSelectionMode($value); |
96 | 96 | $multiple = $this->getIsMultiSelect(); |
97 | - $id = $this->getUniqueID(); $multi_id = $id . '[]'; |
|
98 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
97 | + $id = $this->getUniqueID(); $multi_id = $id.'[]'; |
|
98 | + if ($this->getActiveControl()->canUpdateClientSide()) |
|
99 | 99 | { |
100 | 100 | $client = $this->getPage()->getCallbackClient(); |
101 | 101 | $client->setAttribute($this, 'multiple', $multiple ? 'multiple' : false); |
@@ -89,8 +89,9 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function setSelectionMode($value) |
91 | 91 | { |
92 | - if(parent::getSelectionMode() === $value) |
|
93 | - return; |
|
92 | + if(parent::getSelectionMode() === $value) { |
|
93 | + return; |
|
94 | + } |
|
94 | 95 | |
95 | 96 | parent::setSelectionMode($value); |
96 | 97 | $multiple = $this->getIsMultiSelect(); |
@@ -151,9 +152,10 @@ discard block |
||
151 | 152 | { |
152 | 153 | parent::addAttributesToRender($writer); |
153 | 154 | $writer->addAttribute('id', $this->getClientID()); |
154 | - if ($this->getAutoPostBack()) |
|
155 | - $this->getActiveControl()->registerCallbackClientScript( |
|
155 | + if ($this->getAutoPostBack()) { |
|
156 | + $this->getActiveControl()->registerCallbackClientScript( |
|
156 | 157 | $this->getClientClassName(), $this->getPostBackOptions()); |
158 | + } |
|
157 | 159 | } |
158 | 160 | } |
159 | 161 |
@@ -273,7 +273,7 @@ |
||
273 | 273 | */ |
274 | 274 | public function setPostBackTarget($value) |
275 | 275 | { |
276 | - if($value instanceof TControl) |
|
276 | + if ($value instanceof TControl) |
|
277 | 277 | $value = $value->getUniqueID(); |
278 | 278 | $this->setOption('EventTarget', $value); |
279 | 279 | } |
@@ -273,8 +273,9 @@ |
||
273 | 273 | */ |
274 | 274 | public function setPostBackTarget($value) |
275 | 275 | { |
276 | - if($value instanceof TControl) |
|
277 | - $value = $value->getUniqueID(); |
|
276 | + if($value instanceof TControl) { |
|
277 | + $value = $value->getUniqueID(); |
|
278 | + } |
|
278 | 279 | $this->setOption('EventTarget', $value); |
279 | 280 | } |
280 | 281 |
@@ -64,9 +64,9 @@ |
||
64 | 64 | */ |
65 | 65 | public function setText($value) { |
66 | 66 | parent::setText($value); |
67 | - if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()) |
|
67 | + if ($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()) |
|
68 | 68 | { |
69 | - if($this->getEnableVisualEdit()) |
|
69 | + if ($this->getEnableVisualEdit()) |
|
70 | 70 | { |
71 | 71 | $value = str_ireplace(["\r\n", "\n"], "", $value); |
72 | 72 | $command = "tinymce.get('{$this->getClientID()}').setContent('{$value}')"; |
@@ -71,9 +71,9 @@ |
||
71 | 71 | $value = str_ireplace(["\r\n", "\n"], "", $value); |
72 | 72 | $command = "tinymce.get('{$this->getClientID()}').setContent('{$value}')"; |
73 | 73 | $this->getPage()->getCallbackClient()->evaluateScript($command); |
74 | + } else { |
|
75 | + $this->getPage()->getCallbackClient()->setValue($this, $value); |
|
74 | 76 | } |
75 | - else |
|
76 | - $this->getPage()->getCallbackClient()->setValue($this, $value); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 |