phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: etemplate/inc class.soetemplate.inc.php,1.7,1.8


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: etemplate/inc class.soetemplate.inc.php,1.7,1.8
Date: Tue, 03 Sep 2002 18:59:28 -0400

Update of /cvsroot/phpgroupware/etemplate/inc
In directory subversions:/tmp/cvs-serv10326

Modified Files:
        class.soetemplate.inc.php 
Log Message:
new function to search for or list existing eTeamplates

Index: class.soetemplate.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/etemplate/inc/class.soetemplate.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.soetemplate.inc.php   2 Sep 2002 11:11:09 -0000       1.7
--- class.soetemplate.inc.php   3 Sep 2002 22:59:26 -0000       1.8
***************
*** 36,39 ****
--- 36,40 ----
                        'init'  => True,
                        'read'  => True,
+                       'search'        => True,
                        'save'  => True,
                        'delete'        => True,
***************
*** 205,208 ****
--- 206,263 ----
  
                        return True;
+               }
+ 
+               /*!
+               @function search
+               @syntax 
search($name,$template='default',$lang='default',$group=0,$version='')
+               @author ralfbecker
+               @abstract Lists the eTemplates matching the given criteria
+               @param as discripted with the class, with the following 
exeptions
+               @param $template as '' loads the prefered template 'default' 
loads the default one '' in the db
+               @param $lang as '' loads the pref. lang 'default' loads the 
default one '' in the db
+               @param $group is NOT used / implemented yet
+               @result array of arrays with the template-params
+               */
+               function 
search($name,$template='default',$lang='default',$group=0,$version='')
+               {
+                       if ($this->name)
+                       {
+                               $this->test_import($this->name);        // 
import updates in setup-dir
+                       }
+                       $pref_lang = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
+                       $pref_templ = 
$GLOBALS['phpgw_info']['server']['template_set'];
+ 
+                       if (is_array($name))
+                       {
+                               $template = $name['template'];
+                               $lang = $name['lang'];
+                               $group = $name['group'];
+                               $version = $name['version'];
+                               $name = $name['name'];
+                       }
+                       $sql = "SELECT 
et_name,et_template,et_lang,et_group,et_version FROM $this->db_name WHERE 
et_name LIKE '$name%'";
+ 
+                       if ($template != '' && $template != 'default')
+                       {
+                               $sql .= " AND et_template LIKE '$template%'";
+                       }
+                       if ($lang != '' && $lang != 'default')
+                       {
+                               $sql .= " AND et_lang LIKE '$lang%'";
+                       }
+                       if ($this->version != '')
+                       {
+                               $sql .= " AND et_version LIKE '$version%'";
+                       }
+                       $sql .= " ORDER BY et_name DESC,et_lang 
DESC,et_template DESC,et_version DESC";
+ 
+                       $this->db->query($sql,__LINE__,__FILE__);
+ 
+                       $result = array();
+                       while ($this->db->next_record())
+                       {
+                               $result[] = $this->db->Record;
+                       }
+                       return $result;
                }
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]