diff options
Diffstat (limited to 'framework/Web/UI/TPage.php')
-rw-r--r-- | framework/Web/UI/TPage.php | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php index 903711e4..41fd4454 100644 --- a/framework/Web/UI/TPage.php +++ b/framework/Web/UI/TPage.php @@ -1212,90 +1212,6 @@ class TPage extends TTemplateControl if ($this->_writer) $this->Response->write($this->_writer->flush()); } - - /** - * Function to update view controls with data in a given AR object. - * View controls and AR object need to have the same name in IDs and Attrs respectively. - * @param TActiveRecord $arObj - * @param Boolean $throwExceptions Wheter or not to throw exceptions - * @author Daniel Sampedro <darthdaniel85@gmail.com> - */ - public function tryToUpdateView($arObj, $throwExceptions = false) - { - $objAttrs = get_class_vars(get_class($arObj)); - foreach (array_keys($objAttrs) as $key) - { - try - { - if ($key != "RELATIONS") - { - $control = $this->{$key}; - if ($control instanceof TTextBox) - $control->Text = $arObj->{$key}; - elseif ($control instanceof TCheckBox) - $control->Checked = (boolean) $arObj->{$key}; - elseif ($control instanceof TDatePicker) - $control->Date = $arObj->{$key}; - } - else - { - foreach ($objAttrs["RELATIONS"] as $relKey => $relValues) - { - $relControl = $this->{$relKey}; - switch ($relValues[0]) - { - case TActiveRecord::BELONGS_TO: - case TActiveRecord::HAS_ONE: - $relControl->Text = $arObj->{$relKey}; - break; - case TActiveRecord::HAS_MANY: - if ($relControl instanceof TListControl) - { - $relControl->DataSource = $arObj->{$relKey}; - $relControl->dataBind(); - } - break; - } - } - break; - } - } catch (Exception $ex) - { - if ($throwExceptions) - throw $ex; - } - } - } - - /** - * Function to try to update an AR object with data in view controls. - * @param TActiveRecord $arObj - * @param Boolean $throwExceptions Wheter or not to throw exceptions - * @author Daniel Sampedro <darthdaniel85@gmail.com> - */ - public function tryToUpdateAR($arObj, $throwExceptions = false) - { - $objAttrs = get_class_vars(get_class($arObj)); - foreach (array_keys($objAttrs) as $key) - { - try - { - if ($key == "RELATIONS") - break; - $control = $this->{$key}; - if ($control instanceof TTextBox) - $arObj->{$key} = $control->Text; - elseif ($control instanceof TCheckBox) - $arObj->{$key} = $control->Checked; - elseif ($control instanceof TDatePicker) - $arObj->{$key} = $control->Date; - } catch (Exception $ex) - { - if ($throwExceptions) - throw $ex; - } - } - } } |