Changes that follow per the inheritance and associated changes to Template.class.php
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 2 Oct 2006 09:38:49 +0000 (09:38 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 2 Oct 2006 09:38:49 +0000 (09:38 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11792 7612ce4b-ef26-0410-bec9-ea0150e637f0

class/template/PHP_Template.class.php
class/template/Smarty_Template.class.php

index 7bc8ad62dd7ec097da254d025fea39a6581aad2e..e09e53116337170b0cf972da99cef64950736638 100644 (file)
@@ -103,6 +103,48 @@ FIXME: Proposed idea to add a parameter here that turns variable
 
     }
 
+    /**
+      * Clears the values of all assigned varaiables.
+      *
+      */
+    function clear_all_assign() {
+
+        $this->values = array();
+
+    }
+
+    /**
+      * Returns assigned variable value(s).
+      *
+      * @param string $varname If given, the value of that variable
+      *                        is returned, assuming it has been
+      *                        previously assigned.  If not specified
+      *                        an array of all assigned variables is
+      *                        returned. (optional)
+      *
+      * @return mixed Desired single variable value or list of all
+      *               assigned variable values.
+      *
+      */
+    function get_template_vars($varname=NULL) {
+
+        // just looking for one value
+        // 
+        if (!empty($varname)) {
+            if (!empty($this->values[$varname]))
+                return $this->values[$varname];
+            else
+// FIXME: this OK?  What does Smarty do?
+                return NULL;
+        }
+
+
+        // return all variable values
+        //
+        return $this->values;
+
+    }
+
     /**
       * Appends values to template variables
       *
index 1e4dde88a7b50e97e9be6d15c5ac2fd57650f57a..e666eb002eb3c3735d2e1ec5cfb54c060114715d 100644 (file)
@@ -54,37 +54,26 @@ class Smarty_Template extends Template
         parent::Template($template_id);
 
 
-        // pull in the tempalte config file and load smarty settings
+        // load smarty settings
         //
-        $template_config_file = SM_PATH . $this->get_template_file_directory()
-                              . 'config.php';
-        if (!file_exists($template_config_file)) {
-
-            trigger_error('No template configuration file was found where expected: ("'
-                        . $template_config_file . '")', E_USER_ERROR);
-
-        } else {
-
-            require($template_config_file);
-
-
-            // instantiate and set up Smarty object
-            //
-//LEFT OFF HERE - check for this as empty or not
-            require($smarty_path);
-            $this->smarty_template = new Smarty();
-//LEFT OFF HERE - check for these as empty or not.... I think we at least need compile dir?
-            $this->smarty_template->compile_dir = $smarty_compile_dir;
-            $this->smarty_template->cache_dir = $smarty_cache_dir;
-            $this->smarty_template->config_dir = $smarty_config_dir;
-
-            // note that we do not use Smarty's template_dir 
-            // because SquirrelMail has its own method of 
-            // determining template file paths
-            //
-            //$this->smarty_template->template_dir = 
-
-        }
+        // instantiate and set up Smarty object
+        //
+        $smarty_path 
+            = Template::get_template_config($this->template_set_id, 'smarty_path');
+        require($smarty_path);
+        $this->smarty_template = new Smarty();
+        $this->smarty_template->compile_dir 
+            = Template::get_template_config($this->template_set_id, 'smarty_compile_dir');
+        $this->smarty_template->cache_dir 
+            = Template::get_template_config($this->template_set_id, 'smarty_cache_dir');
+        $this->smarty_template->config_dir 
+            = Template::get_template_config($this->template_set_id, 'smarty_config_dir');
+
+        // note that we do not use Smarty's template_dir 
+        // because SquirrelMail has its own method of 
+        // determining template file paths
+        //
+        //$this->smarty_template->template_dir = 
 
     }
 
@@ -120,6 +109,35 @@ FIXME: Proposed idea to add a parameter here that turns variable
 
     }
 
+    /**
+      * Clears the values of all assigned varaiables.
+      *
+      */
+    function clear_all_assign() {
+
+        $this->smarty_template->clear_all_assign();
+
+    }
+
+    /**
+      * Returns assigned variable value(s).
+      *
+      * @param string $varname If given, the value of that variable
+      *                        is returned, assuming it has been
+      *                        previously assigned.  If not specified
+      *                        an array of all assigned variables is
+      *                        returned. (optional)
+      *
+      * @return mixed Desired single variable value or list of all 
+      *               assigned variable values.
+      *
+      */
+    function get_template_vars($varname=NULL) {
+
+        return $this->smarty_template->get_template_vars($varname);
+
+    }
+
     /**
       * Appends values to template variables
       *