diff options
author | Daniel <darthdaniel85@gmail.com> | 2014-10-20 17:44:12 -0500 |
---|---|---|
committer | Daniel <darthdaniel85@gmail.com> | 2014-10-20 17:44:12 -0500 |
commit | 9643c3c7bb58d0339e577b33ac517354b21e3569 (patch) | |
tree | 47183ac1a5ff5f2f14dcd2da12712041eaa62857 /framework | |
parent | 290ccc3735eaee72819a2ad6d6a2f77a60a74dd8 (diff) |
Completed tryToUpdateView and tryToUpdateAR.
Diffstat (limited to 'framework')
-rw-r--r-- | framework/Web/UI/TPage.php | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php index 82e1f0ae..b1f59b3c 100644 --- a/framework/Web/UI/TPage.php +++ b/framework/Web/UI/TPage.php @@ -1277,9 +1277,39 @@ class TPage extends TTemplateControl * @param TActiveRecord $arObj
* @author Daniel Sampedro <darthdaniel85@gmail.com>
*/
- public function tryToUpdateAR($arObj)
+ 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};
+ switch (get_class($control))
+ {
+ default:
+ case "TTextBox":
+ $arObj->{$key} = $control->Text;
+ break;
+ case "TCheckBox":
+ $arObj->{$key} = $control->Checked;
+ break;
+ case "TDatePicker":
+ $arObj->{$key} = $control->Date;
+ break;
+ }
+ } catch (Exception $ex)
+ {
+ if ($throwExceptions)
+ {
+ throw $ex;
+ }
+ }
+ }
}
}
|