Changeset 15690


Ignore:
Timestamp:
2007/09/13 11:17:50 (17 years ago)
Author:
adachi
Message:

SC_View::init_path(), SC_AdminView::printr()を削除

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/beta/data/class/SC_View.php

    r15120 r15690  
    1111 
    1212class SC_View { 
    13      
     13 
    1414    var $_smarty; 
    15     var $objSiteInfo; // ¥µ¥¤¥È¾ðÊó 
    16      
     15    var $objSiteInfo; // ¥µ¥¤¥È¾ðÊó 
     16 
    1717    // ¥³¥ó¥¹¥È¥é¥¯¥¿ 
    1818    function SC_View($siteinfo = true) { 
    19         global $SC_VIEW_PHP_DIR; 
     19        global $SC_VIEW_PHP_DIR; 
    2020 
    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("sfConvSendDateToDisp","sfConvSendDateToDisp"); 
    26         $this->_smarty->register_modifier("sfConvSendWdayToDisp","sfConvSendWdayToDisp"); 
    27         $this->_smarty->register_modifier("sfGetVal", "sfGetVal"); 
    28         $this->_smarty->register_function("sfSetErrorStyle","sfSetErrorStyle"); 
    29         $this->_smarty->register_function("sfGetErrorColor","sfGetErrorColor"); 
    30         $this->_smarty->register_function("sfTrim", "sfTrim"); 
    31         $this->_smarty->register_function("sfPreTax", "sfPreTax"); 
    32         $this->_smarty->register_function("sfPrePoint", "sfPrePoint"); 
    33         $this->_smarty->register_function("sfGetChecked", "sfGetChecked"); 
    34         $this->_smarty->register_function("sfTrimURL", "sfTrimURL"); 
    35         $this->_smarty->register_function("sfMultiply", "sfMultiply"); 
    36         $this->_smarty->register_function("sfPutBR", "sfPutBR"); 
    37         $this->_smarty->register_function("sfRmDupSlash", "sfRmDupSlash"); 
    38         $this->_smarty->register_function("sfCutString", "sfCutString"); 
    39         $this->_smarty->plugins_dir=array("plugins", $SC_VIEW_PHP_DIR . "/../smarty_extends"); 
    40         $this->_smarty->register_function("sf_mb_convert_encoding","sf_mb_convert_encoding"); 
    41         $this->_smarty->register_function("sf_mktime","sf_mktime"); 
    42         $this->_smarty->register_function("sf_date","sf_date"); 
    43         $this->_smarty->register_function("str_replace","str_replace"); 
    44         $this->_smarty->register_function("sfPrintEbisTag","sfPrintEbisTag"); 
    45         $this->_smarty->register_function("sfPrintAffTag","sfPrintAffTag"); 
     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("sfConvSendDateToDisp","sfConvSendDateToDisp"); 
     26        $this->_smarty->register_modifier("sfConvSendWdayToDisp","sfConvSendWdayToDisp"); 
     27        $this->_smarty->register_modifier("sfGetVal", "sfGetVal"); 
     28        $this->_smarty->register_function("sfSetErrorStyle","sfSetErrorStyle"); 
     29        $this->_smarty->register_function("sfGetErrorColor","sfGetErrorColor"); 
     30        $this->_smarty->register_function("sfTrim", "sfTrim"); 
     31        $this->_smarty->register_function("sfPreTax", "sfPreTax"); 
     32        $this->_smarty->register_function("sfPrePoint", "sfPrePoint"); 
     33        $this->_smarty->register_function("sfGetChecked", "sfGetChecked"); 
     34        $this->_smarty->register_function("sfTrimURL", "sfTrimURL"); 
     35        $this->_smarty->register_function("sfMultiply", "sfMultiply"); 
     36        $this->_smarty->register_function("sfPutBR", "sfPutBR"); 
     37        $this->_smarty->register_function("sfRmDupSlash", "sfRmDupSlash"); 
     38        $this->_smarty->register_function("sfCutString", "sfCutString"); 
     39        $this->_smarty->plugins_dir=array("plugins", $SC_VIEW_PHP_DIR . "/../smarty_extends"); 
     40        $this->_smarty->register_function("sf_mb_convert_encoding","sf_mb_convert_encoding"); 
     41        $this->_smarty->register_function("sf_mktime","sf_mktime"); 
     42        $this->_smarty->register_function("sf_date","sf_date"); 
     43        $this->_smarty->register_function("str_replace","str_replace"); 
     44        $this->_smarty->register_function("sfPrintEbisTag","sfPrintEbisTag"); 
     45        $this->_smarty->register_function("sfPrintAffTag","sfPrintAffTag"); 
    4646        $this->_smarty->register_function("sfIsHTTPS","sfIsHTTPS"); 
    4747        $this->_smarty->default_modifiers = array('script_escape'); 
    48          
    49         if(ADMIN_MODE == '1') {      
    50             $this->time_start = time(); 
    51         } 
    5248 
    53         // ¥µ¥¤¥È¾ðÊó¤ò¼èÆÀ¤¹¤ë 
    54         if($siteinfo) { 
    55             if(!defined('LOAD_SITEINFO')) { 
    56                 $this->objSiteInfo = new SC_SiteInfo(); 
    57                 $arrInfo['arrSiteInfo'] = $this->objSiteInfo->data; 
    58                  
    59                 // ÅÔÆ»Éܸ©Ì¾¤òÊÑ´¹ 
    60                 global $arrPref; 
    61                 $arrInfo['arrSiteInfo']['pref'] = $arrPref[$arrInfo['arrSiteInfo']['pref']]; 
    62                  
    63                 // ¥µ¥¤¥È¾ðÊó¤ò³ä¤êÅö¤Æ¤ë 
    64                 foreach ($arrInfo as $key => $value){ 
    65                     $this->_smarty->assign($key, $value); 
    66                 } 
    67                  
    68                 define('LOAD_SITEINFO', 1); 
    69             } 
    70         } 
    71     } 
    72      
     49        if(ADMIN_MODE == '1') { 
     50            $this->time_start = time(); 
     51        } 
     52 
     53        // ¥µ¥¤¥È¾ðÊó¤ò¼èÆÀ¤¹¤ë 
     54        if($siteinfo) { 
     55            if(!defined('LOAD_SITEINFO')) { 
     56                $this->objSiteInfo = new SC_SiteInfo(); 
     57                $arrInfo['arrSiteInfo'] = $this->objSiteInfo->data; 
     58 
     59                // ÅÔÆ»Éܸ©Ì¾¤òÊÑ´¹ 
     60                global $arrPref; 
     61                $arrInfo['arrSiteInfo']['pref'] = $arrPref[$arrInfo['arrSiteInfo']['pref']]; 
     62 
     63                 // ¥µ¥¤¥È¾ðÊó¤ò³ä¤êÅö¤Æ¤ë 
     64                foreach ($arrInfo as $key => $value){ 
     65                    $this->_smarty->assign($key, $value); 
     66                } 
     67 
     68                define('LOAD_SITEINFO', 1); 
     69            } 
     70        } 
     71    } 
     72 
    7373    // ¥Æ¥ó¥×¥ì¡¼¥È¤ËÃͤò³ä¤êÅö¤Æ¤ë 
    7474    function assign($val1, $val2) { 
    7575        $this->_smarty->assign($val1, $val2); 
    7676    } 
    77      
     77 
    7878    // ¥Æ¥ó¥×¥ì¡¼¥È¤Î½èÍý·ë²Ì¤ò¼èÆÀ 
    7979    function fetch($template) { 
    8080        return $this->_smarty->fetch($template); 
    8181    } 
    82      
     82 
    8383    // ¥Æ¥ó¥×¥ì¡¼¥È¤Î½èÍý·ë²Ì¤òɽ¼¨ 
    8484    function display($template, $no_error = false) { 
    85         if(!$no_error) { 
    86             global $GLOBAL_ERR; 
    87             if(!defined('OUTPUT_ERR')) { 
    88                 print($GLOBAL_ERR); 
    89                 define('OUTPUT_ERR','ON'); 
    90             } 
    91         } 
    92          
    93         $this->_smarty->display($template); 
    94         if(ADMIN_MODE == '1') { 
    95             $time_end = time(); 
    96             $time = $time_end - $this->time_start; 
    97             print("½èÍý»þ´Ö:" . $time . "ÉÃ"); 
    98         } 
    99     } 
    100      
    101     // ¥ª¥Ö¥¸¥§¥¯¥ÈÆâ¤ÎÊÑ¿ô¤ò¤¹¤Ù¤Æ³ä¤êÅö¤Æ¤ë¡£ 
    102     function assignobj($obj) { 
    103         $data = get_object_vars($obj); 
    104          
    105         foreach ($data as $key => $value){ 
    106             $this->_smarty->assign($key, $value); 
    107         } 
    108     } 
    109      
    110     // Ï¢ÁÛÇÛÎóÆâ¤ÎÊÑ¿ô¤ò¤¹¤Ù¤Æ³ä¤êÅö¤Æ¤ë¡£ 
    111     function assignarray($array) { 
    112         foreach ($array as $key => $val) { 
    113             $this->_smarty->assign($key, $val); 
    114         } 
    115     } 
     85        if(!$no_error) { 
     86            global $GLOBAL_ERR; 
     87            if(!defined('OUTPUT_ERR')) { 
     88                print($GLOBAL_ERR); 
     89                define('OUTPUT_ERR','ON'); 
     90            } 
     91        } 
    11692 
    117     /* ¥µ¥¤¥È½é´üÀßÄê */ 
    118     function initpath() { 
    119         global $SC_VIEW_PHP_DIR; 
    120          
    121         $array['tpl_mainnavi'] = $SC_VIEW_PHP_DIR . '/../Smarty/templates/frontparts/mainnavi.tpl'; 
    122         $array['tpl_root_id'] = sfGetRootId(); 
    123         $this->assignarray($array); 
    124     } 
    125      
    126     // ¥Ç¥Ð¥Ã¥° 
    127     function debug($var = true){ 
    128         $this->_smarty->debugging = $var; 
    129     }    
     93        $this->_smarty->display($template); 
     94        if(ADMIN_MODE == '1') { 
     95            $time_end = time(); 
     96            $time = $time_end - $this->time_start; 
     97            print("½èÍý»þ´Ö:" . $time . "ÉÃ"); 
     98        } 
     99    } 
     100 
     101      // ¥ª¥Ö¥¸¥§¥¯¥ÈÆâ¤ÎÊÑ¿ô¤ò¤¹¤Ù¤Æ³ä¤êÅö¤Æ¤ë¡£ 
     102      function assignobj($obj) { 
     103        $data = get_object_vars($obj); 
     104 
     105        foreach ($data as $key => $value){ 
     106            $this->_smarty->assign($key, $value); 
     107        } 
     108      } 
     109 
     110      // Ï¢ÁÛÇÛÎóÆâ¤ÎÊÑ¿ô¤ò¤¹¤Ù¤Æ³ä¤êÅö¤Æ¤ë¡£ 
     111      function assignarray($array) { 
     112          foreach ($array as $key => $val) { 
     113              $this->_smarty->assign($key, $val); 
     114          } 
     115      } 
     116 
     117    // ¥Ç¥Ð¥Ã¥° 
     118    function debug($var = true){ 
     119        $this->_smarty->debugging = $var; 
     120    } 
    130121} 
    131122 
    132123class SC_AdminView extends SC_View{ 
    133124    function SC_AdminView() { 
    134         parent::SC_View(false); 
    135         $this->_smarty->template_dir = TEMPLATE_ADMIN_DIR; 
    136         $this->_smarty->compile_dir = COMPILE_ADMIN_DIR; 
    137         $this->initpath(); 
    138     } 
    139  
    140     function printr($data){ 
    141         print_r($data); 
    142     } 
     125        parent::SC_View(false); 
     126        $this->_smarty->template_dir = TEMPLATE_ADMIN_DIR; 
     127        $this->_smarty->compile_dir = COMPILE_ADMIN_DIR; 
     128    } 
    143129} 
    144130 
    145131class SC_SiteView extends SC_View{ 
    146132    function SC_SiteView($cart = true) { 
    147         parent::SC_View(); 
    148          
    149         $this->_smarty->template_dir = TEMPLATE_DIR; 
    150         $this->_smarty->compile_dir = COMPILE_DIR; 
    151         $this->initpath(); 
    152          
    153         // PHP5¤Ç¤Ïsession¤ò¥¹¥¿¡¼¥È¤¹¤ëÁ°¤Ë¥Ø¥Ã¥À¡¼¾ðÊó¤òÁ÷¿®¤·¤Æ¤¤¤ë¤È·Ù¹ð¤¬½Ð¤ë¤¿¤á¡¢Àè¤Ë¥»¥Ã¥·¥ç¥ó¤ò¥¹¥¿¡¼¥È¤¹¤ë¤è¤¦¤ËÊѹ¹ 
    154         sfDomainSessionStart(); 
    155          
    156         if($cart){ 
    157             $include_dir = realpath(dirname( __FILE__)); 
    158             require_once($include_dir . "/SC_CartSession.php"); 
    159             $objCartSess = new SC_CartSession(); 
    160             $objCartSess->setPrevURL($_SERVER['REQUEST_URI']); 
    161         } 
    162     } 
     133        parent::SC_View(); 
     134 
     135        $this->_smarty->template_dir = TEMPLATE_DIR; 
     136        $this->_smarty->compile_dir = COMPILE_DIR; 
     137 
     138        // PHP5¤Ç¤Ïsession¤ò¥¹¥¿¡¼¥È¤¹¤ëÁ°¤Ë¥Ø¥Ã¥À¡¼¾ðÊó¤òÁ÷¿®¤·¤Æ¤¤¤ë¤È·Ù¹ð¤¬½Ð¤ë¤¿¤á¡¢Àè¤Ë¥»¥Ã¥·¥ç¥ó¤ò¥¹¥¿¡¼¥È¤¹¤ë¤è¤¦¤ËÊѹ¹ 
     139        sfDomainSessionStart(); 
     140 
     141        if($cart){ 
     142            $include_dir = realpath(dirname( __FILE__)); 
     143            require_once($include_dir . "/SC_CartSession.php"); 
     144            $objCartSess = new SC_CartSession(); 
     145            $objCartSess->setPrevURL($_SERVER['REQUEST_URI']); 
     146        } 
     147    } 
    163148} 
    164149 
    165150class SC_UserView extends SC_SiteView{ 
    166151    function SC_UserView($template_dir, $compile_dir = COMPILE_DIR) { 
    167         parent::SC_SiteView(); 
    168         $this->_smarty->template_dir = $template_dir; 
    169         $this->_smarty->compile_dir = $compile_dir; 
    170     } 
     152        parent::SC_SiteView(); 
     153        $this->_smarty->template_dir = $template_dir; 
     154        $this->_smarty->compile_dir = $compile_dir; 
     155    } 
    171156} 
    172157 
    173158class SC_InstallView extends SC_View{ 
    174159    function SC_InstallView($template_dir, $compile_dir = COMPILE_DIR) { 
    175         parent::SC_View(false); 
    176         $this->_smarty->template_dir = $template_dir; 
    177         $this->_smarty->compile_dir = $compile_dir; 
    178     } 
     160        parent::SC_View(false); 
     161        $this->_smarty->template_dir = $template_dir; 
     162        $this->_smarty->compile_dir = $compile_dir; 
     163    } 
    179164} 
    180165 
    181166class SC_MobileView extends SC_SiteView { 
    182167    function SC_MobileView() { 
    183         parent::SC_SiteView(); 
    184         $this->_smarty->template_dir = MOBILE_TEMPLATE_DIR; 
    185         $this->_smarty->compile_dir = MOBILE_COMPILE_DIR; 
    186     }    
     168        parent::SC_SiteView(); 
     169        $this->_smarty->template_dir = MOBILE_TEMPLATE_DIR; 
     170        $this->_smarty->compile_dir = MOBILE_COMPILE_DIR; 
     171    } 
    187172} 
    188173?> 
Note: See TracChangeset for help on using the changeset viewer.