[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php,1.16,1.1
From: |
Ralf Becker <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php,1.16,1.17 |
Date: |
Sun, 22 Sep 2002 04:05:20 -0400 |
Update of /cvsroot/phpgroupware/etemplate/inc
In directory subversions:/tmp/cvs-serv12722
Modified Files:
class.boetemplate.inc.php
Log Message:
reimplemented read+save in bo to implement caching of the etemplates via
$GLOBALS[phpgw_info][etemplate][cache]
Index: class.boetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.boetemplate.inc.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** class.boetemplate.inc.php 18 Sep 2002 14:15:04 -0000 1.16
--- class.boetemplate.inc.php 22 Sep 2002 08:05:17 -0000 1.17
***************
*** 408,410 ****
--- 408,460 ----
return $old;
}
+
+ /*!
+ @function read
+ @abstract Reads an eTemplate from the cache or database /
filesystem (and updates the cache)
+ @param as discripted in soetemplate::read
+ @result True if a fitting template is found, else False
+ */
+ function
read($name,$template='default',$lang='default',$group=0,$version='')
+ {
+ $cname = ($template == '' ? 'default' :
$template).'/'.$name.($lang == 'default' ? '' : '.'.$lang);
+
+ if
(isset($GLOBALS['phpgw_info']['etemplate']['cache'][$cname]))
+ {
+ reset($this->db_cols);
+ while (list($db_col,$col) =
each($this->db_cols))
+ {
+ $this->$col =
$GLOBALS['phpgw_info']['etemplate']['cache'][$cname][$col];
+ }
+ $this->rows = count($this->data) - 1;
+ $this->cols = count($this->data[1]); // 1 =
first row, not 0
+ echo "\n<!-- $cname read from cache -->\n";
+ return True;
+ }
+ if
(!soetemplate::read($name,$template,$lang,$group,$version))
+ return False;
+
+ echo "\n<!-- $cname read & cache updated -->\n";
+ $GLOBALS['phpgw_info']['etemplate']['cache'][$cname] =
$this->as_array(1);
+
+ return true;
+ }
+
+ /*!
+ @function save
+ @abstract saves eTemplate-object to db and update the cache
+ @params keys see soetemplate::save
+ @result the number of affected rows, 1 should be ok, 0
somethings wrong
+ */
+ function
save($name='',$template='.',$lang='.',$group='',$version='.')
+ {
+ $result =
soetemplate::save($name,$template,$lang,$group,$version);
+
+ if ($result)
+ {
+ $cname = ($template == '' ? 'default' :
$template).'/'.$name.($lang == 'default' ? '' : '.'.$lang);
+
+
$GLOBALS['phpgw_info']['etemplate']['cache'][$cname] = $this->as_array(1);
+ }
+ return $result;
+ }
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: etemplate/inc class.boetemplate.inc.php,1.16,1.17,
Ralf Becker <address@hidden> <=