source: temp/trunk/data/class/SC_View.php @ 1328

Revision 1328, 4.5 KB checked in by naka, 20 years ago (diff)

* empty log message *

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?php
2$current_dir = realpath(dirname(__FILE__));
3require_once($current_dir . "/../module/Smarty/libs/Smarty.class.php");
4
5class SC_View {
6   
7    var $_smarty;
8   
9    // ¥³¥ó¥¹¥È¥é¥¯¥¿
10    function SC_View() {
11        $this->_smarty = new Smarty;
12        $this->_smarty->left_delimiter = '<!--{';
13        $this->_smarty->right_delimiter = '}-->';
14        $this->_smarty->register_modifier("sfDispDBDate","sfDispDBDate");
15        $this->_smarty->register_modifier("sfConvSendDateToDisp","sfConvSendDateToDisp");
16        $this->_smarty->register_modifier("sfConvSendWdayToDisp","sfConvSendWdayToDisp");
17        $this->_smarty->register_modifier("sfGetVal", "sfGetVal");
18        $this->_smarty->register_function("sfSetErrorStyle","sfSetErrorStyle");
19        $this->_smarty->register_function("sfGetErrorColor","sfGetErrorColor");
20        $this->_smarty->register_function("srTrim", "sfTrim");
21        $this->_smarty->register_function("sfPreTax", "sfPreTax");
22        $this->_smarty->register_function("sfPrePoint", "sfPrePoint");
23        $this->_smarty->register_function("sfGetChecked", "sfGetChecked");
24        $this->_smarty->register_function("sfTrimURL", "sfTrimURL");
25        $this->_smarty->register_function("sfMultiply", "sfMultiply");
26        $this->_smarty->register_function("sfPutBR", "sfPutBR");
27        $this->_smarty->register_function("sfRmDupSlash", "sfRmDupSlash");
28        $this->_smarty->register_function("sfCutString", "sfCutString");
29        $this->_smarty->plugins_dir=array("plugins", ROOT_DIR . "data/smarty_extends");
30        $this->_smarty->register_function("sf_mb_convert_encoding","sf_mb_convert_encoding");
31        $this->_smarty->register_function("sf_mktime","sf_mktime");
32        $this->_smarty->register_function("sf_date","sf_date");     
33       
34        if(ADMIN_MODE == '1') {     
35            $this->time_start = time();
36        }
37    }
38   
39    // ¥Æ¥ó¥×¥ì¡¼¥È¤ËÃͤò³ä¤êÅö¤Æ¤ë
40    function assign($val1, $val2) {
41        $this->_smarty->assign($val1, $val2);
42    }
43   
44    // ¥Æ¥ó¥×¥ì¡¼¥È¤Î½èÍý·ë²Ì¤ò¼èÆÀ
45    function fetch($template) {
46        return $this->_smarty->fetch($template);
47    }
48   
49    // ¥Æ¥ó¥×¥ì¡¼¥È¤Î½èÍý·ë²Ì¤òɽ¼¨
50    function display($template) {
51        $this->_smarty->display($template);
52        if(ADMIN_MODE == '1') {
53            $time_end = time();
54            $time = $time_end - $this->time_start;
55            print("½èÍý»þ´Ö:" . $time . "ÉÃ");
56        }
57    }
58   
59    // ¥ª¥Ö¥¸¥§¥¯¥ÈÆâ¤ÎÊÑ¿ô¤ò¤¹¤Ù¤Æ³ä¤êÅö¤Æ¤ë¡£
60    function assignobj($obj) {
61        $data = get_object_vars($obj);
62        foreach ($data as $key => $value){
63            $this->_smarty->assign($key, $value);
64        }
65    }
66   
67    // Ï¢ÁÛÇÛÎóÆâ¤ÎÊÑ¿ô¤ò¤¹¤Ù¤Æ³ä¤êÅö¤Æ¤ë¡£
68    function assignarray($array) {
69        foreach ($array as $key => $val) {
70            $this->_smarty->assign($key, $val);
71        }
72    }
73
74    /* ¥µ¥¤¥È½é´üÀßÄê */
75    function initpath() {
76        $array['tpl_mainnavi'] = ROOT_DIR . 'data/Smarty/templates/frontparts/mainnavi.tpl';
77//      $array['tpl_search_products_php'] = ROOT_DIR . 'html/frontparts/search_products.php';           // ¾¦Éʸ¡º÷
78//      $array['tpl_leftnavi'] = 'frontparts/leftnavi.tpl';                         // º¸¥Ê¥Ó
79        $array['tpl_search_products_php'] = ROOT_DIR . 'html/frontparts/bloc/search_products.php';      // ¾¦Éʸ¡º÷
80        $array['tpl_leftnavi'] = ROOT_DIR . 'html/frontparts/bloc/leftnavi.tpl';                        // º¸¥Ê¥Ó
81        $array['tpl_category_php'] = ROOT_DIR . 'html/frontparts/category.php';     // ¥«¥Æ¥´¥ê
82        $array['tpl_pankuzu_php'] = ROOT_DIR . 'html/frontparts/pankuzu.php';       // ¥Ñ¥ó¥¯¥º
83        $array['tpl_tv_products'] = 'frontparts/tv_products.tpl';                   // TV¾Ò²ð¾¦ÉÊ
84        $array['tpl_maintitle'] = 'frontparts/maintitle.tpl';                       // ¾®¸«½Ð¤·
85        $array['tpl_login_php'] = ROOT_DIR . 'html/frontparts/login.php';           
86        $array['tpl_banner'] = 'frontparts/banner.tpl';                             // ¥Ð¥Ê¡¼
87        $array['tpl_root_id'] = sfGetRootId();
88        $array['tpl_mypage_list'] = 'mypage/list.tpl';                              //¥Þ¥¤¥Ú¡¼¥¸¤ÎÊÔ½¸¥ê¥¹¥È
89        $this->assignarray($array);
90    }
91}
92
93class SC_AdminView extends SC_View{
94    function SC_AdminView() {
95        parent::SC_View();
96        $this->_smarty->template_dir = TEMPLATE_ADMIN_DIR;
97        $this->_smarty->compile_dir = COMPILE_ADMIN_DIR;
98        $this->initpath();
99    }
100   
101    function printr($data){
102        print_r($data);
103    }
104}
105
106class SC_SiteView extends SC_View{
107    function SC_SiteView() {
108        parent::SC_View();
109        $this->_smarty->template_dir = TEMPLATE_DIR;
110        $this->_smarty->compile_dir = COMPILE_DIR;
111        $this->initpath();
112       
113        // PHP5¤Ç¤Ïsession¤ò¥¹¥¿¡¼¥È¤¹¤ëÁ°¤Ë¥Ø¥Ã¥À¡¼¾ðÊó¤òÁ÷¿®¤·¤Æ¤¤¤ë¤È·Ù¹ð¤¬½Ð¤ë¤¿¤á¡¢Àè¤Ë¥»¥Ã¥·¥ç¥ó¤ò¥¹¥¿¡¼¥È¤¹¤ë¤è¤¦¤ËÊѹ¹
114        sfDomainSessionStart();
115    }
116}
117
118class SC_UserView extends SC_SiteView{
119    function SC_UserView($template_dir, $compile_dir = COMPILE_DIR) {
120        parent::SC_SiteView();
121        $this->_smarty->template_dir = $template_dir;
122        $this->_smarty->compile_dir = $compile_dir;
123    }
124}
125?>
Note: See TracBrowser for help on using the repository browser.