[ Index ]
 

Code source de CMS made simple 1.0.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/classes/ -> class.template.inc.php (source)

   1  <?php
   2  #CMS - CMS Made Simple
   3  #(c)2004-6 by Ted Kulp (ted@cmsmadesimple.org)
   4  #This project's homepage is: http://cmsmadesimple.org
   5  #
   6  #This program is free software; you can redistribute it and/or modify
   7  #it under the terms of the GNU General Public License as published by
   8  #the Free Software Foundation; either version 2 of the License, or
   9  #(at your option) any later version.
  10  #
  11  #This program is distributed in the hope that it will be useful,
  12  #BUT withOUT ANY WARRANTY; without even the implied warranty of
  13  #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14  #GNU General Public License for more details.
  15  #You should have received a copy of the GNU General Public License
  16  #along with this program; if not, write to the Free Software
  17  #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18  #
  19  #$Id: class.template.inc.php 3362 2006-08-22 09:55:33Z wishy $
  20  
  21  /**
  22   * Generic template class. This can be used for any template or template related function.
  23   *
  24   * @since        0.6
  25   * @package        CMS
  26   */
  27  class Template
  28  {
  29      var $id;
  30      var $name;
  31      var $content;
  32      var $stylesheet;
  33      var $encoding;
  34      var $active;
  35      var $default;
  36  
  37  	function Template()
  38      {
  39          $this->SetInitialValues();
  40      }
  41  
  42  	function SetInitialValues()
  43      {
  44          $this->id = -1;
  45          $this->name = '';
  46          $this->content = '';
  47          $this->stylesheet = '';
  48          $this->encoding = '';
  49          $this->active = false;
  50          $this->default = false;
  51      }
  52  
  53      function Id()
  54      {
  55          return $this->id;
  56      }
  57  
  58  	function Name()
  59      {
  60          return $this->name;
  61      }
  62  
  63  	function UsageCount()
  64      {
  65          global $gCms;
  66          $templateops =& $gCms->GetTemplateOperations();
  67          if ($this->id > -1)
  68              return $templateops->UsageCount($this->id);
  69          else
  70              return 0;
  71      }
  72  
  73  	function Save()
  74      {
  75          $result = false;
  76          
  77          global $gCms;
  78          $templateops =& $gCms->GetTemplateOperations();
  79          
  80          if ($this->id > -1)
  81          {
  82              $result = $templateops->UpdateTemplate($this);
  83          }
  84          else
  85          {
  86              $newid = $templateops->InsertTemplate($this);
  87              if ($newid > -1)
  88              {
  89                  $this->id = $newid;
  90                  $result = true;
  91              }
  92  
  93          }
  94  
  95          return $result;
  96      }
  97  
  98  	function Delete()
  99      {
 100          $result = false;
 101  
 102          if ($this->id > -1)
 103          {
 104              global $gCms;
 105              $templateops =& $gCms->GetTemplateOperations();
 106              $result = $templateops->DeleteTemplateByID($this->id);
 107              if ($result)
 108              {
 109                  $this->SetInitialValues();
 110              }
 111          }
 112  
 113          return $result;
 114      }
 115  }
 116  
 117  # vim:ts=4 sw=4 noet
 118  ?>


Généré le : Tue Apr 3 18:50:37 2007 par Balluche grâce à PHPXref 0.7