Adjusted header.tpl for Work plugin.
[timetracker.git] / WEB-INF / lib / form / ActionForm.class.php
index ece7ceb..8e2ad8a 100644 (file)
@@ -166,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"];
@@ -176,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->localize($GLOBALS["I18N"]);
+                        $el->localize();
                        $el->setValueSafe(@$_SESSION[$this->mSessionCell . "_" .$el->getName()]);
                        
                                if ($this->mForm && !isset($this->mForm->elements[$ref_el["name"]])) {