2 /*******************************************************************************
3 * Copyright (C) 2007 Easter-eggs
4 * http://ldapsaisie.labs.libre-entreprise.org
6 * Author: See AUTHORS file in top-level directory.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 ******************************************************************************/
24 * Smarty ressource for LdapSaisie template
26 * @author Benjamin Renard <brenard@easter-eggs.com>
28 class Smarty_Resource_LdapSaisie extends Smarty_Resource_Custom {
30 // prepared fetch() statement
32 // prepared fetchTimestamp() statement
36 * Fetch a template and its modification time from database
38 * @param string $name template name
39 * @param string $source template source
40 * @param integer $mtime template modification timestamp (epoch)
43 protected function fetch($name, &$source, &$mtime) {
44 $source = LStemplate :: getTemplateSource($name);
45 $mtime = LStemplate :: getTemplateTimestamp($name);
49 * Fetch a template's modification time from database
51 * @note implementing this method is optional. Only implement it if modification times can be accessed faster than loading the comple template source.
52 * @param string $name template name
53 * @return integer timestamp (epoch) the template was modified
55 protected function fetchTimestamp($name) {
56 return LStemplate :: getTemplateTimestamp($name);
60 // Register 'ls' template ressource
61 LStemplate :: $_smarty -> registerResource('ls', new Smarty_Resource_LdapSaisie());
63 // Register special template functions
64 LStemplate :: $_smarty -> registerPlugin("function","getFData", "LStemplate_smarty_getFData");
65 LStemplate :: $_smarty -> registerPlugin("function","tr", "LStemplate_smarty_tr");
66 LStemplate :: $_smarty -> registerPlugin("function","img", "LStemplate_smarty_img");