source: temp/test-xoops.ec-cube.net/data/class/SC_View.php @ 1179

Revision 1179, 4.9 KB checked in by kakinaka, 19 years ago (diff)
Line 
1<?php
2/*
3 * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7
8$SC_VIEW_PHP_DIR = realpath(dirname(__FILE__));
9require_once($SC_VIEW_PHP_DIR . "/../module/Smarty/libs/Smarty.class.php");
10require_once($SC_VIEW_PHP_DIR . "/../include/php_ini.inc");
11
12class SC_View {
13   
14    var $_smarty;
15    var $objSiteInfo; // ¥µ¥¤¥È¾ðÊó
16   
17    // ¥³¥ó¥¹¥È¥é¥¯¥¿
18    function SC_View($siteinfo = true) {
19        global $SC_VIEW_PHP_DIR;
20
21        $this->_smarty = new Smarty;
22        $this->_smarty->left_delimiter = '<!--{';
23        $this->_smarty->right_delimiter = '}-->';
24        $this->_smarty->register_modifier("sfDispDBDate","sfDispDBDate");
25        $this->_smarty->register_modifier("sfMBDispDBDate","sfMBDispDBDate");
26        $this->_smarty->register_modifier("sfConvSendDateToDisp","sfConvSendDateToDisp");
27        $this->_smarty->register_modifier("sfConvSendWdayToDisp","sfConvSendWdayToDisp");
28        $this->_smarty->register_modifier("sfGetVal", "sfGetVal");
29        $this->_smarty->register_function("sfSetErrorStyle","sfSetErrorStyle");
30        $this->_smarty->register_function("sfGetErrorColor","sfGetErrorColor");
31        $this->_smarty->register_function("sfTrim", "sfTrim");
32        $this->_smarty->register_function("sfPreTax", "sfPreTax");
33        $this->_smarty->register_function("sfPrePoint", "sfPrePoint");
34        $this->_smarty->register_function("sfGetChecked", "sfGetChecked");
35        $this->_smarty->register_function("sfGetCheckedArray", "sfGetCheckedArray");
36        $this->_smarty->register_function("sfTrimURL", "sfTrimURL");
37        $this->_smarty->register_function("sfMultiply", "sfMultiply");
38        $this->_smarty->register_function("sfPutBR", "sfPutBR");
39        $this->_smarty->register_function("sfRmDupSlash", "sfRmDupSlash");
40        $this->_smarty->register_function("sfCutString", "sfCutString");
41        $this->_smarty->plugins_dir=array("plugins", $SC_VIEW_PHP_DIR . "/../smarty_extends");
42        $this->_smarty->register_function("sf_mb_convert_encoding","sf_mb_convert_encoding");
43        $this->_smarty->register_function("sf_mktime","sf_mktime");
44        $this->_smarty->register_function("sf_date","sf_date");
45        $this->_smarty->register_function("str_replace","str_replace");
46        $this->_smarty->register_function("sfPrintEbisTag","sfPrintEbisTag");
47        $this->_smarty->register_function("sfPrintAffTag","sfPrintAffTag");
48        $this->_smarty->register_function("sfPresentDisp","sfPresentDisp");
49        $this->_smarty->register_function("sfPrintRegular","sfPrintRegular");
50       
51        if(ADMIN_MODE == '1') {     
52            $this->time_start = time();
53        }
54    }
55   
56    // ¥Æ¥ó¥×¥ì¡¼¥È¤ËÃͤò³ä¤êÅö¤Æ¤ë
57    function assign($val1, $val2) {
58        $this->_smarty->assign($val1, $val2);
59    }
60   
61    // ¥Æ¥ó¥×¥ì¡¼¥È¤Î½èÍý·ë²Ì¤ò¼èÆÀ
62    function fetch($template) {
63        return $this->_smarty->fetch($template);
64    }
65   
66    // ¥Æ¥ó¥×¥ì¡¼¥È¤Î½èÍý·ë²Ì¤òɽ¼¨
67    function display($template, $no_error = false) {
68        if(!$no_error) {
69            global $GLOBAL_ERR;
70            if(!defined('OUTPUT_ERR')) {
71                print($GLOBAL_ERR);
72                define('OUTPUT_ERR','ON');
73            }
74        }
75       
76        $this->_smarty->display($template);
77        if(ADMIN_MODE == '1') {
78            $time_end = time();
79            $time = $time_end - $this->time_start;
80            print("½èÍý»þ´Ö:" . $time . "ÉÃ");
81        }
82       
83        print($_SERVER['SERVER_ADDR']);
84    }
85   
86    // ¥ª¥Ö¥¸¥§¥¯¥ÈÆâ¤ÎÊÑ¿ô¤ò¤¹¤Ù¤Æ³ä¤êÅö¤Æ¤ë¡£
87    function assignobj($obj) {
88        $data = get_object_vars($obj);
89       
90        foreach ($data as $key => $value){
91            $this->_smarty->assign($key, $value);
92        }
93    }
94   
95    // Ï¢ÁÛÇÛÎóÆâ¤ÎÊÑ¿ô¤ò¤¹¤Ù¤Æ³ä¤êÅö¤Æ¤ë¡£
96    function assignarray($array) {
97        foreach ($array as $key => $val) {
98            $this->_smarty->assign($key, $val);
99        }
100    }
101
102    /* ¥µ¥¤¥È½é´üÀßÄê */
103    function initpath() {
104        global $SC_VIEW_PHP_DIR;
105       
106        $array['tpl_mainnavi'] = $SC_VIEW_PHP_DIR . '/../Smarty/templates/frontparts/mainnavi.tpl';
107        $array['tpl_root_id'] = sfGetRootId();
108        $this->assignarray($array);
109    }
110}
111
112class SC_AdminView extends SC_View{
113    function SC_AdminView() {
114        parent::SC_View(false);
115        $this->_smarty->template_dir = TEMPLATE_ADMIN_DIR;
116        $this->_smarty->compile_dir = COMPILE_ADMIN_DIR;
117        $this->initpath();
118    }
119
120    function printr($data){
121        print_r($data);
122    }
123}
124
125class SC_SiteView extends SC_View{
126    function SC_SiteView($cart = true) {
127        parent::SC_View();
128        $this->_smarty->template_dir = TEMPLATE_DIR;
129        $this->_smarty->compile_dir = COMPILE_DIR;
130        $this->initpath();
131       
132        // PHP5¤Ç¤Ïsession¤ò¥¹¥¿¡¼¥È¤¹¤ëÁ°¤Ë¥Ø¥Ã¥À¡¼¾ðÊó¤òÁ÷¿®¤·¤Æ¤¤¤ë¤È·Ù¹ð¤¬½Ð¤ë¤¿¤á¡¢Àè¤Ë¥»¥Ã¥·¥ç¥ó¤ò¥¹¥¿¡¼¥È¤¹¤ë¤è¤¦¤ËÊѹ¹
133        sfDomainSessionStart();
134    }
135}
136
137class SC_UserView extends SC_SiteView{
138    function SC_UserView($template_dir, $compile_dir = COMPILE_DIR) {
139        parent::SC_SiteView();
140        $this->_smarty->template_dir = $template_dir;
141        $this->_smarty->compile_dir = $compile_dir;
142    }
143}
144
145class SC_InstallView extends SC_View{
146    function SC_InstallView($template_dir, $compile_dir = COMPILE_DIR) {
147        parent::SC_View(false);
148        $this->_smarty->template_dir = $template_dir;
149        $this->_smarty->compile_dir = $compile_dir;
150    }
151}
152
153?>
Note: See TracBrowser for help on using the repository browser.