X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2Fform%2FActionForm.class.php;h=8e2ad8af4362522fe591e24c608b559011b800d3;hb=48ba99d8257be57e5e43a03e80ab5d8c782b5295;hp=fa70e15ff1e292aaa8c8fcc68e6a1b935ccabe32;hpb=199277a2fd7258bb60c37a291d0d62e04e9c31ca;p=timetracker.git diff --git a/WEB-INF/lib/form/ActionForm.class.php b/WEB-INF/lib/form/ActionForm.class.php index fa70e15f..8e2ad8af 100644 --- a/WEB-INF/lib/form/ActionForm.class.php +++ b/WEB-INF/lib/form/ActionForm.class.php @@ -62,8 +62,8 @@ class ActionForm { } function setName($name) { - $this->mName = $name; - $this->mSessionCell = "formbean_".$this->mName; + $this->name = $name; + $this->mSessionCell = "formbean_".$this->name; } /** @@ -99,17 +99,7 @@ class ActionForm { $this->mInitForm = true; } } - - /** - * Init custom variables - * - * @param unknown $request - * @param unknown $respons - */ - function initVariables(&$request, &$respons) { - - } - + function setVariablesNames($namelist) { $this->mVariables = $namelist; } @@ -120,7 +110,7 @@ class ActionForm { $this->mValues[$name] = $value; if ($this->mForm) { if (isset($this->mForm->elements[$name])) { - if ($this->mForm->elements[$name]->cClassName=="DateField") { + if ($this->mForm->elements[$name]->class=="DateField") { $dt = new DateAndTime($user->date_format, $value); $value = $dt->toString(DB_DATEFORMAT); } @@ -149,7 +139,7 @@ class ActionForm { foreach ($this->mValues as $name=>$value) { if ($this->mForm) { if (isset($this->mForm->elements[$name])) { - if ($this->mForm->elements[$name]->cClassName=="DateField") { + if ($this->mForm->elements[$name]->class=="DateField") { $dt = new DateAndTime($user->date_format, $value); $value = $dt->toString(DB_DATEFORMAT); } @@ -176,6 +166,20 @@ class ActionForm { } //print_r($_SESSION); } + + // saveDetachedAttribute saves a "detached" from form named attributed in session. + // There is no element in the form for it. + // Intended use is to add something to the session, when a form bean created on one page + // is used on other pages (ex.: reportForm). + // For example, to generate a timesheet we need a user_id, which is determined when a report + // is generated on report.php, using a bean created in reports.php. + function saveDetachedAttribute($name, $value) { + $_SESSION[$this->mSessionCell .'_'.$name] = $value; + } + + function getDetachedAttribute($name) { + return $_SESSION[$this->mSessionCell.'_'.$name]; + } function loadBean() { $el_list = @$_SESSION[$this->mSessionCell . "session_store_elements"]; @@ -186,7 +190,7 @@ class ActionForm { import('form.'.$ref_el["class"]); $class_name = $ref_el["class"]; $el = new $class_name($ref_el["name"]); - if (isset($GLOBALS["I18N"])) $el->setLocalization($GLOBALS["I18N"]); + $el->localize(); $el->setValueSafe(@$_SESSION[$this->mSessionCell . "_" .$el->getName()]); if ($this->mForm && !isset($this->mForm->elements[$ref_el["name"]])) {