[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-smarty/www/includes/ -> se3-smarty.classe.php (source)

   1  <?php
   2  
   3  
   4  /**
   5     
   6     * 
   7     * @Version $Id: se3-smarty.classe.php 8599 2015-03-16 19:53:28Z plouf $ 
   8     
   9     * @Projet LCS / SambaEdu 
  10     
  11     * @auteurs Swirly
  12  
  13     * @Licence Distribue selon les termes de la licence GPL
  14     
  15     * @note 
  16     
  17     */
  18  
  19     /**
  20  
  21     * @Repertoire: includes/
  22     * file: se3-smarty.classe.php
  23  
  24    */    
  25  
  26  $DEBUG=false;
  27  
  28  define('SMARTY_DIR', '/usr/share/php/smarty/libs/');
  29  require_once(SMARTY_DIR . 'Smarty.class.php');
  30  
  31  class SmartySe3 extends Smarty {
  32  
  33    function __construct() {
  34      global $DEBUG;
  35      // Class Constructor.
  36      // These automatically get set with each new instance.
  37      $this->Smarty();
  38      
  39      $this->template_dir = '/usr/share/interfacedu/smarty/templates/';
  40      $this->config_dir   = '/usr/share/interfacedu/smarty/configs/';
  41      $this->compile_dir  = '/var/cache/interfacedu/templates_c/';
  42      $this->cache_dir    = '/var/cache/interfacedu/cache/';
  43      
  44      // think twice before enabling caching, is everything really
  45      // ready to be cached?
  46      $this->caching = false;
  47      
  48      $this->assign('app_name', 'SE3');
  49      $this->assign('app_version', '2');
  50      $this->assign('stylesheet', 'default');
  51      $this->assign('title', 'This is the default title, call ' .
  52            '$smarty->assign("title", "the title") to fix it');
  53      
  54      if ($DEBUG) {
  55        $this->info("<h3>POST</h3><pre>".print_r($_POST,1)."</pre>");
  56        $this->info("<h3>SESSION</h3><pre>".print_r($_SESSION,1)."</pre>");
  57        $this->info("<h3>GET</h3><pre>".print_r($_GET,1)."</pre>");
  58      }
  59  
  60      $this->register_block('help','block_help_icon');    
  61    }
  62    
  63    function info($msg) {
  64      if ($this->get_template_vars("infomsg")) {
  65        $this->append("infomsg", $msg);
  66      } else {
  67        $this->assign("infomsg", array($msg));
  68      }
  69    }
  70    
  71    function warning($msg) {
  72      if ($this->get_template_vars("warningmsg")) {
  73        $this->append("warningmsg", $msg);
  74      } else {
  75        $this->assign("warningmsg", array($msg));
  76      }
  77    }
  78    
  79    function error($msg) {
  80      if ($this->get_template_vars("errormsg")) {
  81        $this->append("errormsg", $msg);
  82      } else {
  83        $this->assign("errormsg", array($msg));
  84      }
  85    }
  86    
  87    function menutab($name,$page,$action='none',$options=array()) {
  88      $menutab=array("name" =>$name,
  89             "page" =>$page,
  90             "action" =>$action,
  91             "options"=>$options);
  92      if ($this->get_template_vars("menutabs")){
  93        $this->append("menutabs",$menutab);
  94      } else {
  95        $this->assign("menutabs",array($menutab));
  96      }
  97    }
  98  
  99    function tab_input($name,$value='') {
 100     if ($this->get_template_vars("tabinputs")){
 101       $this->append("tabinputs",array("name"=>$name,"value"=>$value));
 102      } else {
 103       $this->assign("tabinputs",array(array("name"=>$name,"value"=>$value)));
 104     }
 105    }
 106    
 107    function activetab($name){
 108      $this->assign("activetab",$name);
 109    }
 110  }  
 111  
 112  // Generic help block
 113  
 114  function block_help_icon($params, $content, &$smarty) {
 115    if (isset($content)) {
 116      $content = trim(str_replace('\'', '\\\'', stripslashes($content)));
 117      $help = "<img src=\"../images/default/icons/16x16/info.png\" \n";
 118      $help .= " onmouseover=\" Tip('".$content."')\" \n";
 119      $help .= " onmouseout=\"UnTip()\"/> \n";
 120      
 121      return $help;      
 122    }
 123  }
 124  
 125  // Global Smarty Object
 126  
 127  $SmartySe3 = new SmartySe3();
 128  
 129  ?> 


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1