Changeset 17136


Ignore:
Timestamp:
2008/03/12 20:12:49 (16 years ago)
Author:
adachi
Message:

merge r17117 (fixed template)

Location:
branches/comu-ver2
Files:
1 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/comu-ver2/data/class/pages/admin/design/LC_Page_Admin_Design_Template.php

    r16769 r17136  
    112112            $this->lfRegisterTemplate($template_code); 
    113113 
    114             // テンプレートの上書き 
    115             $this->lfChangeTemplate($template_code); 
    116  
    117114            // XXX コンパイルファイルのクリア処理を行う 
    118115            $objView->_smarty->clear_compiled_tpl(); 
     116 
     117            // ブロック位置を更新 
     118            $this->lfChangeBloc($template_code); 
    119119 
    120120            // 完了メッセージ 
     
    253253                                 array("id", "remarks", "rank")); 
    254254    } 
     255 
    255256    /** 
    256      * テンプレートを上書きコピーする. 
     257     * ブロック位置の更新 
    257258     */ 
    258     function lfChangeTemplate($template_code){ 
    259         $from = TPL_PKG_PATH . $template_code . '/user_edit/'; 
    260  
    261         if (!file_exists($from)) { 
    262             $mess = $from . 'は存在しません'; 
    263         } else { 
    264             $to = USER_PATH; 
    265             $mess = sfCopyDir($from, $to, '', true); 
     259    function lfChangeBloc($template_code) { 
     260        $objQuery = new SC_Query(); 
     261        $filepath = USER_TEMPLATE_PATH. $template_code. "/sql/update_bloc.sql"; 
     262         
     263        // ブロック位置更新SQLファイル有 
     264        if(file_exists($filepath)) { 
     265            if($fp = fopen($filepath, "r")) { 
     266                $sql = fread($fp, filesize($filepath)); 
     267                fclose($fp); 
     268            } 
     269            // 改行、タブを1スペースに変換 
     270            $sql = preg_replace("/[\r\n\t]/", " " ,$sql); 
     271            $sql_split = split(";", $sql); 
     272            foreach($sql_split as $key => $val){ 
     273                if (trim($val) != "") { 
     274                    $objQuery->query($val); 
     275                } 
     276            } 
    266277        } 
    267         return $mess; 
     278    } 
     279 
     280    /** 
     281     * テンプレートパッケージの削除 
     282     */ 
     283    function lfDeleteTemplate($template_code) { 
     284        // DB更新 
     285        $objQuery = new SC_Query(); 
     286        $objQuery->delete('dtb_templates', 'template_code = ?', array($template_code)); 
     287        // テンプレート削除 
     288        $templates_dir = SMARTY_TEMPLATES_DIR. $template_code. "/"; 
     289        SC_Utils_Ex::sfDelFile($templates_dir); 
     290        // ユーザーデータ削除 
     291        $user_dir = USER_TEMPLATE_PATH. $template_code. "/"; 
     292        SC_Utils_Ex::sfDelFile($user_dir); 
    268293    } 
    269294 
     
    275300        return $arrRet; 
    276301    } 
    277  
    278     function lfDeleteTemplate($template_code) { 
    279         $objQuery = new SC_Query(); 
    280         $objQuery->delete('dtb_templates', 'template_code = ?', array($template_code)); 
    281  
    282         SC_Utils_Ex::sfDelFile(TPL_PKG_PATH . $template_code); 
    283     } 
    284302} 
    285303?> 
Note: See TracChangeset for help on using the changeset viewer.