added use of openemr smarty functions in calendar
[openemr.git] / interface / main / calendar / modules / PostCalendar / pcSmarty.class.php
blob97c9ccbf55c1f2d9a1c67a7155303f50a0ba23b9
1 <?php
2 /**
3 * $Id$
5 * PostCalendar::PostNuke Events Calendar Module
6 * Copyright (C) 2002 The PostCalendar Team
7 * http://postcalendar.tv
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * To read the license please read the docs/license.txt or visit
24 * http://www.gnu.org/copyleft/gpl.html
27 class pcSmarty extends Smarty
29 function __construct()
31 $theme = pnUserGetTheme();
32 $osTheme = pnVarPrepForOS($theme);
33 pnThemeLoad($theme);
34 global $bgcolor1,$bgcolor2,$bgcolor3,$bgcolor4,$bgcolor5,$bgcolor6,$textcolor1,$textcolor2;
36 // call constructor
37 parent::__construct();
39 // gather module information
40 $pcModInfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__));
41 $pcDir = pnVarPrepForOS($pcModInfo['directory']);
42 $pcDisplayName = $pcModInfo['displayname'];
43 unset($pcModInfo);
45 // setup up pcSmarty configs
46 $this->compile_check = true;
47 $this->force_compile = false;
48 $this->debugging = false;
49 $this->template_dir = "modules/$pcDir/pntemplates";
50 array_push($this->plugins_dir, "modules/$pcDir/pnincludes/Smarty/plugins");
51 array_push($this->plugins_dir, "modules/$pcDir/plugins");
52 array_push($this->plugins_dir, "../../../../library/smarty/plugins");
53 $this->compile_dir = "modules/$pcDir/pntemplates/compiled";
54 $this->cache_dir = "modules/$pcDir/pntemplates/cache";
55 $this->caching = _SETTING_USE_CACHE;
56 $this->cache_lifetime = _SETTING_CACHE_LIFETIME;
57 $this->left_delimiter = '[-';
58 $this->right_delimiter = '-]';
60 //============================================================
61 // checks for safe mode
62 // i think it's safe to say we can do this automagically now
63 //============================================================
64 $safe_mode = ini_get('safe_mode');
65 $safe_mode_gid = ini_get('safe_mode_gid');
66 $open_basedir = ini_get('open_basedir');
68 $use_safe_mode = ((bool)$safe_mode || (bool)$safe_mode_gid || !empty($open_basedir));
69 if ($use_safe_mode) {
70 $this->use_sub_dirs = false;
71 } else {
72 $this->use_sub_dirs = true;
75 unset($use_safe_mode, $safe_mode, $safe_mode_gid, $open_basedir);
77 $this->autoload_filters = array('output' => array('trimwhitespace'));
79 $lang = pnUserGetLang();
80 $func = pnVarCleanFromInput('func');
81 $print = pnVarCleanFromInput('print');
82 // assign theme globals
83 $this->assign_by_ref('BGCOLOR1', $bgcolor1);
84 $this->assign_by_ref('BGCOLOR2', $bgcolor2);
85 $this->assign_by_ref('BGCOLOR3', $bgcolor3);
86 $this->assign_by_ref('BGCOLOR4', $bgcolor4);
87 $this->assign_by_ref('BGCOLOR5', $bgcolor5);
88 $this->assign_by_ref('BGCOLOR6', $bgcolor6);
89 $this->assign_by_ref('TEXTCOLOR1', $textcolor1);
90 $this->assign_by_ref('TEXTCOLOR2', $textcolor2);
91 $this->assign_by_ref('USER_LANG', $lang);
92 $this->assign_by_ref('FUNCTION', $func);
93 $this->assign('PRINT_VIEW', $print);
94 $this->assign('USE_POPUPS', _SETTING_USE_POPUPS);
95 $this->assign('USE_TOPICS', _SETTING_DISPLAY_TOPICS);
96 $this->assign('USE_INT_DATES', _SETTING_USE_INT_DATES);
97 $this->assign('OPEN_NEW_WINDOW', _SETTING_OPEN_NEW_WINDOW);
98 $this->assign('EVENT_DATE_FORMAT', _SETTING_DATE_FORMAT);
99 $this->assign('HIGHLIGHT_COLOR', _SETTING_DAY_HICOLOR);
100 $this->assign('24HOUR_TIME', _SETTING_TIME_24HOUR);
101 $this->assign_by_ref('MODULE_NAME', $pcDisplayName);
102 $this->assign_by_ref('MODULE_DIR', $pcDir);
103 $this->assign('ACCESS_NONE', PC_ACCESS_NONE);
104 $this->assign('ACCESS_OVERVIEW', PC_ACCESS_OVERVIEW);
105 $this->assign('ACCESS_READ', PC_ACCESS_READ);
106 $this->assign('ACCESS_COMMENT', PC_ACCESS_COMMENT);
107 $this->assign('ACCESS_MODERATE', PC_ACCESS_MODERATE);
108 $this->assign('ACCESS_EDIT', PC_ACCESS_EDIT);
109 $this->assign('ACCESS_ADD', PC_ACCESS_ADD);
110 $this->assign('ACCESS_DELETE', PC_ACCESS_DELETE);
111 $this->assign('ACCESS_ADMIN', PC_ACCESS_ADMIN);
112 //=================================================================
113 // Find out what Template we're using
114 //=================================================================
115 $template_name = _SETTING_TEMPLATE;
116 if (!isset($template_name)) {
117 $template_name = 'default';
120 //=================================================================
121 // Find out what Template View to use
122 //=================================================================
123 $template_view = pnVarCleanFromInput('tplview');
124 if (!isset($template_view)) {
125 $template_view = 'default';
128 $this->config_dir = "modules/$pcDir/pntemplates/$template_name/config/";
129 $this->assign_by_ref('TPL_NAME', $template_name);
130 $this->assign_by_ref('TPL_VIEW', $template_view);
131 $this->assign('TPL_IMAGE_PATH', $GLOBALS['rootdir']."/main/calendar/modules/$pcDir/pntemplates/$template_name/images");
132 $this->assign('TPL_ROOTDIR', $GLOBALS['rootdir']);
133 $this->assign('TPL_STYLE_PATH', "modules/$pcDir/pntemplates/$template_name/style");
134 $this->assign('THEME_PATH', "themes/$osTheme");