@@ -238,90 +238,90 @@ |
||
| 238 | 238 | parent::initRecursive($namingContainer); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - /** |
|
| 242 | - * Function to update view controls with data in a given AR object. |
|
| 243 | - * View controls and AR object need to have the same name in IDs and Attrs respectively. |
|
| 244 | - * @param TActiveRecord $arObj |
|
| 245 | - * @param Boolean $throwExceptions Wheter or not to throw exceptions |
|
| 246 | - * @author Daniel Sampedro <[email protected]> |
|
| 247 | - */ |
|
| 248 | - public function tryToUpdateView($arObj, $throwExceptions = false) |
|
| 249 | - { |
|
| 250 | - $objAttrs = get_class_vars(get_class($arObj)); |
|
| 251 | - foreach (array_keys($objAttrs) as $key) |
|
| 252 | - { |
|
| 253 | - try |
|
| 254 | - { |
|
| 255 | - if ($key != "RELATIONS") |
|
| 256 | - { |
|
| 257 | - $control = $this->{$key}; |
|
| 258 | - if ($control instanceof TTextBox) |
|
| 259 | - $control->Text = $arObj->{$key}; |
|
| 260 | - elseif ($control instanceof TCheckBox) |
|
| 261 | - $control->Checked = (boolean) $arObj->{$key}; |
|
| 262 | - elseif ($control instanceof TDatePicker) |
|
| 263 | - $control->Date = $arObj->{$key}; |
|
| 264 | - } |
|
| 265 | - else |
|
| 266 | - { |
|
| 267 | - foreach ($objAttrs["RELATIONS"] as $relKey => $relValues) |
|
| 268 | - { |
|
| 269 | - $relControl = $this->{$relKey}; |
|
| 270 | - switch ($relValues[0]) |
|
| 271 | - { |
|
| 272 | - case TActiveRecord::BELONGS_TO: |
|
| 273 | - case TActiveRecord::HAS_ONE: |
|
| 274 | - $relControl->Text = $arObj->{$relKey}; |
|
| 275 | - break; |
|
| 276 | - case TActiveRecord::HAS_MANY: |
|
| 277 | - if ($relControl instanceof TListControl) |
|
| 278 | - { |
|
| 279 | - $relControl->DataSource = $arObj->{$relKey}; |
|
| 280 | - $relControl->dataBind(); |
|
| 281 | - } |
|
| 282 | - break; |
|
| 283 | - } |
|
| 284 | - } |
|
| 285 | - break; |
|
| 286 | - } |
|
| 287 | - } |
|
| 288 | - catch (Exception $ex) |
|
| 289 | - { |
|
| 290 | - if ($throwExceptions) |
|
| 291 | - throw $ex; |
|
| 292 | - } |
|
| 293 | - } |
|
| 294 | - } |
|
| 241 | + /** |
|
| 242 | + * Function to update view controls with data in a given AR object. |
|
| 243 | + * View controls and AR object need to have the same name in IDs and Attrs respectively. |
|
| 244 | + * @param TActiveRecord $arObj |
|
| 245 | + * @param Boolean $throwExceptions Wheter or not to throw exceptions |
|
| 246 | + * @author Daniel Sampedro <[email protected]> |
|
| 247 | + */ |
|
| 248 | + public function tryToUpdateView($arObj, $throwExceptions = false) |
|
| 249 | + { |
|
| 250 | + $objAttrs = get_class_vars(get_class($arObj)); |
|
| 251 | + foreach (array_keys($objAttrs) as $key) |
|
| 252 | + { |
|
| 253 | + try |
|
| 254 | + { |
|
| 255 | + if ($key != "RELATIONS") |
|
| 256 | + { |
|
| 257 | + $control = $this->{$key}; |
|
| 258 | + if ($control instanceof TTextBox) |
|
| 259 | + $control->Text = $arObj->{$key}; |
|
| 260 | + elseif ($control instanceof TCheckBox) |
|
| 261 | + $control->Checked = (boolean) $arObj->{$key}; |
|
| 262 | + elseif ($control instanceof TDatePicker) |
|
| 263 | + $control->Date = $arObj->{$key}; |
|
| 264 | + } |
|
| 265 | + else |
|
| 266 | + { |
|
| 267 | + foreach ($objAttrs["RELATIONS"] as $relKey => $relValues) |
|
| 268 | + { |
|
| 269 | + $relControl = $this->{$relKey}; |
|
| 270 | + switch ($relValues[0]) |
|
| 271 | + { |
|
| 272 | + case TActiveRecord::BELONGS_TO: |
|
| 273 | + case TActiveRecord::HAS_ONE: |
|
| 274 | + $relControl->Text = $arObj->{$relKey}; |
|
| 275 | + break; |
|
| 276 | + case TActiveRecord::HAS_MANY: |
|
| 277 | + if ($relControl instanceof TListControl) |
|
| 278 | + { |
|
| 279 | + $relControl->DataSource = $arObj->{$relKey}; |
|
| 280 | + $relControl->dataBind(); |
|
| 281 | + } |
|
| 282 | + break; |
|
| 283 | + } |
|
| 284 | + } |
|
| 285 | + break; |
|
| 286 | + } |
|
| 287 | + } |
|
| 288 | + catch (Exception $ex) |
|
| 289 | + { |
|
| 290 | + if ($throwExceptions) |
|
| 291 | + throw $ex; |
|
| 292 | + } |
|
| 293 | + } |
|
| 294 | + } |
|
| 295 | 295 | |
| 296 | - /** |
|
| 297 | - * Function to try to update an AR object with data in view controls. |
|
| 298 | - * @param TActiveRecord $arObj |
|
| 299 | - * @param Boolean $throwExceptions Wheter or not to throw exceptions |
|
| 300 | - * @author Daniel Sampedro <[email protected]> |
|
| 301 | - */ |
|
| 302 | - public function tryToUpdateAR($arObj, $throwExceptions = false) |
|
| 303 | - { |
|
| 304 | - $objAttrs = get_class_vars(get_class($arObj)); |
|
| 305 | - foreach (array_keys($objAttrs) as $key) |
|
| 306 | - { |
|
| 307 | - try |
|
| 308 | - { |
|
| 309 | - if ($key == "RELATIONS") |
|
| 310 | - break; |
|
| 311 | - $control = $this->{$key}; |
|
| 312 | - if ($control instanceof TTextBox) |
|
| 313 | - $arObj->{$key} = $control->Text; |
|
| 314 | - elseif ($control instanceof TCheckBox) |
|
| 315 | - $arObj->{$key} = $control->Checked; |
|
| 316 | - elseif ($control instanceof TDatePicker) |
|
| 317 | - $arObj->{$key} = $control->Date; |
|
| 318 | - } |
|
| 319 | - catch (Exception $ex) |
|
| 320 | - { |
|
| 321 | - if ($throwExceptions) |
|
| 322 | - throw $ex; |
|
| 323 | - } |
|
| 324 | - } |
|
| 325 | - } |
|
| 296 | + /** |
|
| 297 | + * Function to try to update an AR object with data in view controls. |
|
| 298 | + * @param TActiveRecord $arObj |
|
| 299 | + * @param Boolean $throwExceptions Wheter or not to throw exceptions |
|
| 300 | + * @author Daniel Sampedro <[email protected]> |
|
| 301 | + */ |
|
| 302 | + public function tryToUpdateAR($arObj, $throwExceptions = false) |
|
| 303 | + { |
|
| 304 | + $objAttrs = get_class_vars(get_class($arObj)); |
|
| 305 | + foreach (array_keys($objAttrs) as $key) |
|
| 306 | + { |
|
| 307 | + try |
|
| 308 | + { |
|
| 309 | + if ($key == "RELATIONS") |
|
| 310 | + break; |
|
| 311 | + $control = $this->{$key}; |
|
| 312 | + if ($control instanceof TTextBox) |
|
| 313 | + $arObj->{$key} = $control->Text; |
|
| 314 | + elseif ($control instanceof TCheckBox) |
|
| 315 | + $arObj->{$key} = $control->Checked; |
|
| 316 | + elseif ($control instanceof TDatePicker) |
|
| 317 | + $arObj->{$key} = $control->Date; |
|
| 318 | + } |
|
| 319 | + catch (Exception $ex) |
|
| 320 | + { |
|
| 321 | + if ($throwExceptions) |
|
| 322 | + throw $ex; |
|
| 323 | + } |
|
| 324 | + } |
|
| 325 | + } |
|
| 326 | 326 | } |
| 327 | 327 | |
@@ -602,7 +602,7 @@ |
||
| 602 | 602 | |
| 603 | 603 | /** |
| 604 | 604 | * @param string the application configuration type. 'xml' and 'php' are valid values |
| 605 | - */ |
|
| 605 | + */ |
|
| 606 | 606 | public function setConfigurationType($value) |
| 607 | 607 | { |
| 608 | 608 | $this->_configType = $value; |
@@ -90,10 +90,10 @@ |
||
| 90 | 90 | private $_association_columns=array(); |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | - * Get the foreign key index values from the results and make calls to the |
|
| 94 | - * database to find the corresponding foreign objects using association table. |
|
| 95 | - * @param array original results. |
|
| 96 | - */ |
|
| 93 | + * Get the foreign key index values from the results and make calls to the |
|
| 94 | + * database to find the corresponding foreign objects using association table. |
|
| 95 | + * @param array original results. |
|
| 96 | + */ |
|
| 97 | 97 | protected function collectForeignObjects(&$results) |
| 98 | 98 | { |
| 99 | 99 | list($sourceKeys, $foreignKeys) = $this->getRelationForeignKeys(); |
@@ -335,12 +335,12 @@ |
||
| 335 | 335 | return false; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - /** |
|
| 339 | - * Returns all table names in the database. |
|
| 340 | - * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema. |
|
| 341 | - * If not empty, the returned table names will be prefixed with the schema name. |
|
| 342 | - * @return array all table names in the database. |
|
| 343 | - */ |
|
| 338 | + /** |
|
| 339 | + * Returns all table names in the database. |
|
| 340 | + * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema. |
|
| 341 | + * If not empty, the returned table names will be prefixed with the schema name. |
|
| 342 | + * @return array all table names in the database. |
|
| 343 | + */ |
|
| 344 | 344 | public function findTableNames($schema='') |
| 345 | 345 | { |
| 346 | 346 | if($schema==='') |
@@ -259,15 +259,15 @@ |
||
| 259 | 259 | return false; |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - /** |
|
| 263 | - * Returns all table names in the database. |
|
| 264 | - * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema. |
|
| 265 | - * If not empty, the returned table names will be prefixed with the schema name. |
|
| 266 | - * @return array all table names in the database. |
|
| 267 | - */ |
|
| 262 | + /** |
|
| 263 | + * Returns all table names in the database. |
|
| 264 | + * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema. |
|
| 265 | + * If not empty, the returned table names will be prefixed with the schema name. |
|
| 266 | + * @return array all table names in the database. |
|
| 267 | + */ |
|
| 268 | 268 | public function findTableNames($schema='dbo') |
| 269 | 269 | { |
| 270 | - $condition="TABLE_TYPE='BASE TABLE'"; |
|
| 270 | + $condition="TABLE_TYPE='BASE TABLE'"; |
|
| 271 | 271 | $sql=<<<EOD |
| 272 | 272 | SELECT TABLE_NAME, TABLE_SCHEMA FROM [INFORMATION_SCHEMA].[TABLES] |
| 273 | 273 | WHERE TABLE_SCHEMA=:schema AND $condition |
@@ -417,12 +417,12 @@ |
||
| 417 | 417 | return false; |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | - /** |
|
| 421 | - * Returns all table names in the database. |
|
| 422 | - * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema. |
|
| 423 | - * If not empty, the returned table names will be prefixed with the schema name. |
|
| 424 | - * @return array all table names in the database. |
|
| 425 | - */ |
|
| 420 | + /** |
|
| 421 | + * Returns all table names in the database. |
|
| 422 | + * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema. |
|
| 423 | + * If not empty, the returned table names will be prefixed with the schema name. |
|
| 424 | + * @return array all table names in the database. |
|
| 425 | + */ |
|
| 426 | 426 | public function findTableNames($schema='public') |
| 427 | 427 | { |
| 428 | 428 | if($schema==='') |
@@ -189,11 +189,11 @@ |
||
| 189 | 189 | return false; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - /** |
|
| 193 | - * Returns all table names in the database. |
|
| 194 | - * @param string $schema the schema of the tables. This is not used for sqlite database. |
|
| 195 | - * @return array all table names in the database. |
|
| 196 | - */ |
|
| 192 | + /** |
|
| 193 | + * Returns all table names in the database. |
|
| 194 | + * @param string $schema the schema of the tables. This is not used for sqlite database. |
|
| 195 | + * @return array all table names in the database. |
|
| 196 | + */ |
|
| 197 | 197 | public function findTableNames($schema='') |
| 198 | 198 | { |
| 199 | 199 | $sql="SELECT DISTINCT tbl_name FROM sqlite_master WHERE tbl_name<>'sqlite_sequence'"; |
@@ -179,14 +179,14 @@ |
||
| 179 | 179 | return $lft . str_replace(self::$delimiterIdentifier, '', $name) . $rgt; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - /** |
|
| 183 | - * Returns all table names in the database. |
|
| 184 | - * This method should be overridden by child classes in order to support this feature |
|
| 185 | - * because the default implementation simply throws an exception. |
|
| 186 | - * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema. |
|
| 187 | - * If not empty, the returned table names will be prefixed with the schema name. |
|
| 188 | - * @return array all table names in the database. |
|
| 189 | - */ |
|
| 182 | + /** |
|
| 183 | + * Returns all table names in the database. |
|
| 184 | + * This method should be overridden by child classes in order to support this feature |
|
| 185 | + * because the default implementation simply throws an exception. |
|
| 186 | + * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema. |
|
| 187 | + * If not empty, the returned table names will be prefixed with the schema name. |
|
| 188 | + * @return array all table names in the database. |
|
| 189 | + */ |
|
| 190 | 190 | abstract public function findTableNames($schema=''); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -36,46 +36,46 @@ |
||
| 36 | 36 | class TWsatService extends TPageService |
| 37 | 37 | { |
| 38 | 38 | |
| 39 | - private $_pass = ''; |
|
| 39 | + private $_pass = ''; |
|
| 40 | 40 | |
| 41 | - public function init($config) |
|
| 42 | - { |
|
| 43 | - if ($this->getApplication()->getMode() === TApplicationMode::Performance || $this->getApplication()->getMode() === TApplicationMode::Normal) |
|
| 44 | - throw new TInvalidOperationException("You should not use Prado WSAT in any of the production modes."); |
|
| 41 | + public function init($config) |
|
| 42 | + { |
|
| 43 | + if ($this->getApplication()->getMode() === TApplicationMode::Performance || $this->getApplication()->getMode() === TApplicationMode::Normal) |
|
| 44 | + throw new TInvalidOperationException("You should not use Prado WSAT in any of the production modes."); |
|
| 45 | 45 | |
| 46 | - if (empty($this->_pass)) |
|
| 47 | - throw new TConfigurationException("You need to specify the Password attribute."); |
|
| 46 | + if (empty($this->_pass)) |
|
| 47 | + throw new TConfigurationException("You need to specify the Password attribute."); |
|
| 48 | 48 | |
| 49 | - $this->setDefaultPage("TWsatHome"); |
|
| 50 | - $this->_startThemeManager(); |
|
| 51 | - parent::init($config); |
|
| 52 | - } |
|
| 49 | + $this->setDefaultPage("TWsatHome"); |
|
| 50 | + $this->_startThemeManager(); |
|
| 51 | + parent::init($config); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - public function getBasePath() |
|
| 55 | - { |
|
| 56 | - $basePath = Prado::getPathOfNamespace("System.Wsat.pages"); |
|
| 57 | - return realpath($basePath); |
|
| 58 | - } |
|
| 54 | + public function getBasePath() |
|
| 55 | + { |
|
| 56 | + $basePath = Prado::getPathOfNamespace("System.Wsat.pages"); |
|
| 57 | + return realpath($basePath); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - private function _startThemeManager() |
|
| 61 | - { |
|
| 62 | - $themeManager = new TThemeManager; |
|
| 63 | - $themeManager->BasePath = "System.Wsat.themes"; |
|
| 64 | - $url = Prado::getApplication()->getAssetManager()->publishFilePath(Prado::getPathOfNamespace('System.Wsat')); |
|
| 65 | - $themeManager->BaseUrl = "$url/themes"; |
|
| 60 | + private function _startThemeManager() |
|
| 61 | + { |
|
| 62 | + $themeManager = new TThemeManager; |
|
| 63 | + $themeManager->BasePath = "System.Wsat.themes"; |
|
| 64 | + $url = Prado::getApplication()->getAssetManager()->publishFilePath(Prado::getPathOfNamespace('System.Wsat')); |
|
| 65 | + $themeManager->BaseUrl = "$url/themes"; |
|
| 66 | 66 | |
| 67 | - $themeManager->init(null); |
|
| 68 | - $this->setThemeManager($themeManager); |
|
| 69 | - } |
|
| 67 | + $themeManager->init(null); |
|
| 68 | + $this->setThemeManager($themeManager); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - public function getPassword() |
|
| 72 | - { |
|
| 73 | - return $this->_pass; |
|
| 74 | - } |
|
| 71 | + public function getPassword() |
|
| 72 | + { |
|
| 73 | + return $this->_pass; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - public function setPassword($_pass) |
|
| 77 | - { |
|
| 78 | - $this->_pass = $_pass; |
|
| 79 | - } |
|
| 76 | + public function setPassword($_pass) |
|
| 77 | + { |
|
| 78 | + $this->_pass = $_pass; |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | 81 | } |
| 82 | 82 | \ No newline at end of file |