Changeset 19725 for branches/version-2_5-dev/data/class
- Timestamp:
- 2010/12/15 18:06:23 (16 years ago)
- bzr:base-revision:
- svn-v4:1e3b908f-19a9-db11-a64c-001125224ba8:branches/version-2_5-dev:19724
- bzr:committer:
- Kentaro Ohkouchi <[email protected]>
- bzr:file-ids:
data/Smarty/templates/admin/design/bloc.tpl 15732@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2FSmarty%2Ftemplates%2Fdefault%2Fadmin%2Fdesign%2Fbloc.tpl
data/Smarty/templates/admin/design/css.tpl 15732@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2FSmarty%2Ftemplates%2Fdefault%2Fadmin%2Fdesign%2Fcss.tpl
data/class/SC_View.php 15078@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2FSC_View.php
data/class/helper/SC_Helper_PageLayout.php 15078@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fhelper%2FSC_Helper_PageLayout.php
data/class/pages/admin/design/LC_Page_Admin_Design_Bloc.php 15687@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fadmin%2Fdesign%2FLC_Page_Admin_Design_Bloc.php
data/class/pages/admin/design/LC_Page_Admin_Design_CSS.php 15689@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fadmin%2Fdesign%2FLC_Page_Admin_Design_CSS.php
data/class/pages/admin/design/LC_Page_Admin_Design_Header.php 15688@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fadmin%2Fdesign%2FLC_Page_Admin_Design_Header.php
data/class/pages/admin/design/LC_Page_Admin_Design_MainEdit.php 15682@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fadmin%2Fdesign%2FLC_Page_Admin_Design_MainEdit.php
data/class/pages/admin/design/LC_Page_Admin_Design_Template.php 16430@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fadmin%2Fdesign%2FLC_Page_Admin_Design_Template.php- bzr:mapping-version:
- v4
- bzr:repository-uuid:
- 1e3b908f-19a9-db11-a64c-001125224ba8
- bzr:revision-id:
- [email protected]
- bzr:revno:
- 2454
- bzr:revprop:branch-nick:
- branches/version-2_5-dev
- bzr:root:
- branches/version-2_5-dev
- bzr:timestamp:
- 2010-12-15 18:06:11.522000074 +0900
- bzr:user-agent:
- bzr2.2.1+bzr-svn1.0.4
- svn:original-date:
- 2010-12-15T09:06:11.522000Z
- Location:
- branches/version-2_5-dev/data/class
- Files:
-
- 7 edited
-
SC_View.php (modified) (5 diffs)
-
helper/SC_Helper_PageLayout.php (modified) (3 diffs)
-
pages/admin/design/LC_Page_Admin_Design_Bloc.php (modified) (7 diffs)
-
pages/admin/design/LC_Page_Admin_Design_CSS.php (modified) (3 diffs)
-
pages/admin/design/LC_Page_Admin_Design_Header.php (modified) (3 diffs)
-
pages/admin/design/LC_Page_Admin_Design_MainEdit.php (modified) (1 diff)
-
pages/admin/design/LC_Page_Admin_Design_Template.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/SC_View.php
r19720 r19725 173 173 } 174 174 175 /** 176 * テンプレートパスをアサインする. 177 * 178 * @param integer $device_type_id 端末種別ID 179 */ 180 function assignTemplatePath($device_type_id) { 181 182 // テンプレート変数を割り当て 183 $this->assign("TPL_DIR", SC_Helper_PageLayout_Ex::getUserDir($device_type_id, true)); 184 185 // ヘッダとフッタを割り当て 186 $templatePath = SC_Helper_PageLayout_Ex::getTemplatePath($device_type_id, true); 187 $header_tpl = $templatePath . "header.tpl"; 188 $footer_tpl = $templatePath . "footer.tpl"; 189 190 // ユーザー作成のテンプレートが無ければ, 指定テンプレートを割り当て 191 $templatePath = SC_Helper_PageLayout_Ex::getTemplatePath($device_type_id); 192 if (!$this->_smarty->template_exists($header_tpl)) { 193 $header_tpl = $templatePath . "header.tpl"; 194 } 195 if (!$this->_smarty->template_exists($footer_tpl)) { 196 $footer_tpl = $templatePath . "footer.tpl"; 197 } 198 199 $this->assign("header_tpl", $header_tpl); 200 $this->assign("footer_tpl", $footer_tpl); 201 } 202 175 203 // デバッグ 176 204 function debug($var = true){ … … 185 213 $this->_smarty->compile_dir = COMPILE_ADMIN_DIR; 186 214 $this->assign('TPL_DIR_DEFAULT', URL_DIR . USER_DIR . USER_PACKAGE_DIR . DEFAULT_TEMPLATE_NAME . '/'); 187 $this->assign('TPL_DIR', URL_DIR . USER_DIR . USER_PACKAGE_DIR . 'admin/');215 $this->assign('TPL_DIR', URL_DIR . USER_DIR . USER_PACKAGE_DIR . ADMIN_DIR); 188 216 $this->initpath(); 189 217 } … … 197 225 $this->_smarty->compile_dir = COMPILE_DIR; 198 226 199 // テンプレート変数を割り当て 200 $this->assign("TPL_DIR", URL_DIR . USER_DIR . USER_PACKAGE_DIR . TEMPLATE_NAME . "/"); 201 202 // ヘッダとフッタを割り当て 203 $header_tpl = USER_PATH . USER_PACKAGE_DIR . TEMPLATE_NAME . "/" . "header.tpl"; 204 $footer_tpl = USER_PATH . USER_PACKAGE_DIR . TEMPLATE_NAME . "/" . "footer.tpl"; 205 206 // ユーザー作成のテンプレートが無ければ, 指定テンプレートを割り当て 207 if (!$this->_smarty->template_exists($header_tpl)) { 208 $header_tpl = TEMPLATE_DIR . "header.tpl"; 209 } 210 if (!$this->_smarty->template_exists($footer_tpl)) { 211 $footer_tpl = TEMPLATE_DIR . "footer.tpl"; 212 } 213 214 $this->assign("header_tpl", $header_tpl); 215 $this->assign("footer_tpl", $footer_tpl); 216 227 $this->assignTemplatePath(DEVICE_TYPE_PC); 217 228 $this->initpath(); 218 229 … … 245 256 $this->_smarty->template_dir = MOBILE_TEMPLATE_DIR; 246 257 $this->_smarty->compile_dir = MOBILE_COMPILE_DIR; 247 // テンプレート変数を割り当て 248 $this->assign("TPL_DIR", URL_DIR . MOBILE_DIR . USER_DIR . USER_PACKAGE_DIR . MOBILE_TEMPLATE_NAME . "/"); 258 $this->assignTemplatePath(DEVICE_TYPE_MOBILE); 249 259 } 250 260 } … … 255 265 $this->_smarty->template_dir = SMARTPHONE_TEMPLATE_DIR; 256 266 $this->_smarty->compile_dir = SMARTPHONE_COMPILE_DIR; 257 // テンプレート変数を割り当て 258 $this->assign("TPL_DIR", URL_DIR . SMARTPHONE_DIR . USER_DIR . USER_PACKAGE_DIR . SMARTPHONE_TEMPLATE_NAME . "/"); 267 $this->assignTemplatePath(DEVICE_TYPE_SMARTPHONE); 259 268 } 260 269 } -
branches/version-2_5-dev/data/class/helper/SC_Helper_PageLayout.php
r19722 r19725 312 312 * DocumentRoot から user_data のパスを取得する. 313 313 * 314 * @param integer $device_type_id 端末種別ID 314 * 引数 $hasPackage を true にした場合は, user_data/packages/template_name 315 * を取得する. 316 * 317 * @param integer $device_type_id 端末種別ID 318 * @param boolean $hasPackage パッケージのパスも含める場合 true 315 319 * @return string 端末に応じた DocumentRoot から user_data までのパス 316 320 */ 317 function getUserDir($device_type_id = DEVICE_TYPE_PC ) {321 function getUserDir($device_type_id = DEVICE_TYPE_PC, $hasPackage = false) { 318 322 switch ($device_type_id) { 319 323 case DEVICE_TYPE_MOBILE: … … 324 328 case DEVICE_TYPE_SMARTPHONE: 325 329 $userDir = URL_DIR . SMARTPHONE_DIR . USER_DIR; 330 $templateName = SMARTPHONE_TEMPLATE_NAME; 326 331 break; 327 332 … … 329 334 default: 330 335 $userDir = URL_DIR . USER_DIR; 336 $templateName = TEMPLATE_NAME; 337 } 338 if ($hasPackage) { 339 return $userDir . USER_PACKAGE_DIR . $templateName . "/"; 331 340 } 332 341 return $userDir; -
branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Bloc.php
r19722 r19725 71 71 */ 72 72 function action() { 73 $this->objLayout = new SC_Helper_PageLayout_Ex();74 $package_path = USER_TEMPLATE_PATH . "/" . TEMPLATE_NAME . "/";75 73 76 74 // 認証可否の判定 … … 94 92 } 95 93 94 $this->objLayout = new SC_Helper_PageLayout_Ex(); 95 $package_path = $this->objLayout->getTemplatePath($device_type_id, true); 96 96 97 // ブロック一覧を取得 97 98 $this->arrBlocList = $this->lfgetBlocData("device_type_id = ?", array($device_type_id)); … … 108 109 // 存在しない場合は指定テンプレートのブロックを取得 109 110 } else { 110 $arrBlocData[0]['tpl_path'] = TEMPLATE_DIR. $arrBlocData[0]['tpl_path'];111 $arrBlocData[0]['tpl_path'] = $this->objLayout->getTemplatePath($device_type_id) . $arrBlocData[0]['tpl_path']; 111 112 } 112 113 … … 150 151 if (count($this->arrErr) == 0) { 151 152 // DBへデータを更新する 152 $this->lfEntryBlocData($_POST );153 $this->lfEntryBlocData($_POST, $device_type_id); 153 154 154 155 // 旧ファイルの削除 … … 248 249 * 249 250 * @param array $arrData 更新データ 251 * @param integer $device_type_id 端末種別ID 250 252 * @return integer 更新結果 251 253 */ 252 function lfEntryBlocData($arrData ){254 function lfEntryBlocData($arrData, $device_type_id){ 253 255 $objQuery = new SC_Query(); // DB操作オブジェクト 254 256 $sql = ""; // データ更新SQL生成用 … … 258 260 259 261 // 更新データ生成 260 $arrUpdData = array($arrData['bloc_name'], BLOC_DIR . $arrData['filename'] . '.tpl', $arrData['filename']); 262 $arrUpdData = array("bloc_name" => $arrData['bloc_name'], 263 "tpl_path" => BLOC_DIR . $arrData['filename'] . '.tpl', 264 "filename" => $arrData['filename']); 261 265 262 266 // データが存在しているかチェックを行う 263 267 if($arrData['bloc_id'] !== ''){ 264 268 $arrChk = $this->lfgetBlocData("bloc_id = ? AND device_type_id = ?", 265 array($arrData['bloc_id'], $ arrData['device_type_id']));269 array($arrData['bloc_id'], $device_type_id)); 266 270 } 267 271 … … 271 275 // FIXME device_type_id ごとの連番にする 272 276 $arrUpdData['bloc_id'] = $objQuery->nextVal('dtb_bloc_bloc_id'); 277 $arrUpdData['device_type_id'] = $device_type_id; 273 278 $arrUpdData['create_date'] = "now()"; 274 279 $ret = $objQuery->insert('dtb_bloc', $arrUpdData); 275 280 } else { 276 281 $ret = $objQuery->update('dtb_bloc', $arrUpdData, 'bloc_id = ? AND device_type_id = ?', 277 array($arrData['bloc_id'], $ arrData['device_type_id']));282 array($arrData['bloc_id'], $device_type_id)); 278 283 } 279 284 return $ret; -
branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_CSS.php
r19722 r19725 76 76 77 77 $objFileManager = new SC_Helper_FileManager_Ex(); 78 $this->objLayout = new SC_Helper_PageLayout_Ex(); 78 79 79 80 // CSSファイル名を取得 … … 96 97 $this->old_css_name = $old_css_name; 97 98 98 $css_dir = USER_TEMPLATE_PATH . TEMPLATE_NAME . "/css/"; 99 // 端末種別IDを取得 100 if (isset($_REQUEST['device_type_id']) 101 && is_numeric($_REQUEST['device_type_id'])) { 102 $device_type_id = $_REQUEST['device_type_id']; 103 } else { 104 $device_type_id = DEVICE_TYPE_PC; 105 } 106 107 $css_dir = $this->objLayout->getTemplatePath($device_type_id, true) . "css/"; 99 108 $css_path = $css_dir . $css_name . '.css'; 100 109 … … 112 121 case 'confirm': 113 122 $this->lfExecuteConfirm($css_dir, $css_name, $old_css_name, $css_path); 114 break;123 break; 115 124 case 'delete': 116 125 $this->lfExecuteDelete($css_path); 117 break;126 break; 118 127 default: 119 if(isset($_POST['mode'])) {120 GC_Utils::gfPrintLog("MODEエラー:".$_POST['mode']);121 }122 break;128 if(isset($_POST['mode'])) { 129 GC_Utils::gfPrintLog("MODEエラー:".$_POST['mode']); 130 } 131 break; 123 132 } 124 133 -
branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Header.php
r19722 r19725 75 75 SC_Utils_Ex::sfIsSuccess($objSess); 76 76 77 $this->objLayout = new SC_Helper_PageLayout_Ex(); 78 79 // 端末種別IDを取得 80 if (isset($_REQUEST['device_type_id']) 81 && is_numeric($_REQUEST['device_type_id'])) { 82 $device_type_id = $_REQUEST['device_type_id']; 83 } else { 84 $device_type_id = DEVICE_TYPE_PC; 85 } 86 77 87 $division = isset($_POST['division']) ? $_POST['division'] : ""; 78 88 $pre_DIR = USER_INC_PATH . 'preview/'; … … 87 97 // 登録時はプレビュー用テンプレートをコピーする 88 98 if ($_POST['mode'] == 'confirm'){ 89 copy($pre_DIR.$division.".tpl", USER_PATH . USER_PACKAGE_DIR . TEMPLATE_NAME . "/". $division . ".tpl");99 copy($pre_DIR.$division.".tpl", $this->objLayout->getTemplatePath($device_type_id, true) . $division . ".tpl"); 90 100 // 完了メッセージ(プレビュー時は表示しない) 91 101 $this->tpl_onload="alert('登録が完了しました。');"; … … 112 122 // ユーザーパスにテンプレートが存在しなければ, 113 123 // 指定テンプレートから読み込む 114 $header_tpl = USER_PATH . USER_PACKAGE_DIR . TEMPLATE_NAME . "/". "header.tpl";124 $header_tpl = $this->objLayout->getTemplatePath($device_type_id, true) . "header.tpl"; 115 125 if (!is_file($header_tpl)) { 116 $header_tpl = TEMPLATE_DIR. "header.tpl";126 $header_tpl = $this->objLayout->getTemplatePath($device_type_id) . "header.tpl"; 117 127 } 118 $footer_tpl = USER_PATH . USER_PACKAGE_DIR . TEMPLATE_NAME . "/". "footer.tpl";128 $footer_tpl = $this->objLayout->getTemplatePath($device_type_id, true) . "footer.tpl"; 119 129 if (!is_file($footer_tpl)) { 120 $footer_tpl = TEMPLATE_DIR. "footer.tpl";130 $footer_tpl = $this->objLayout->getTemplatePath($device_type_id) . "footer.tpl"; 121 131 } 122 132 -
branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_MainEdit.php
r19722 r19725 163 163 $templatePath = $this->objLayout->getTemplatePath($device_type_id, true); 164 164 $tpl_file = $templatePath . $arrPageData[0]['filename'] . ".tpl"; 165 $this->p($tpl_file); 165 166 166 if (file_exists($tpl_file)){ 167 167 $arrPageData[0]['tpl_data'] = file_get_contents($tpl_file); -
branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Template.php
r19722 r19725 39 39 // {{{ functions 40 40 41 /** テンプレートデータ種別 */42 var $arrSubnavi = array(43 'title' => array(44 1 => 'top',45 2 => 'product',46 3 => 'detail',47 4 => 'mypage'48 ),49 'name' =>array(50 1 => 'TOPページ',51 2 => '商品一覧ページ',52 3 => '商品詳細ページ',53 4 => 'MYページ'54 )55 );56 57 41 /** 58 42 * Page を初期化する. … … 62 46 function init() { 63 47 parent::init(); 64 $this->tpl_mainpage = 'design/template.tpl';65 $this->tpl_subnavi = 'design/subnavi.tpl';66 $this->tpl_subno = 'template';67 $this->tpl_mainno = "design";68 $this->tpl_subtitle = 'テンプレート設定';69 $this->arrErr = array();70 $this->arrForm = array();71 $this->tpl_select = TEMPLATE_NAME;72 ini_set("max_execution_time", 300);48 $this->tpl_mainpage = 'design/template.tpl'; 49 $this->tpl_subnavi = 'design/subnavi.tpl'; 50 $this->tpl_subno = 'template'; 51 $this->tpl_mainno = "design"; 52 $this->tpl_subtitle = 'テンプレート設定'; 53 $this->arrErr = array(); 54 $this->arrForm = array(); 55 $this->tpl_select = TEMPLATE_NAME; 56 ini_set("max_execution_time", 300); 73 57 } 74 58 … … 92 76 function action() { 93 77 // 認証可否の判定 94 $objSession = new SC_Session();95 SC_Utils::sfIsSuccess($objSession);96 97 // uniqidをテンプレートへ埋め込み98 $this->uniqid = $objSession->getUniqId();99 100 $objView = new SC_AdminView();101 102 switch($this->lfGetMode()) {103 104 // 登録ボタン押下時105 case 'register':106 // 画面遷移の正当性チェック107 if (!SC_Utils::sfIsValidTransition($objSession)) {108 sfDispError('');109 }110 // パラメータ検証111 $objForm = $this->lfInitRegister();112 if ($objForm->checkError()) {113 SC_Utils_Ex::sfDispError('');114 }115 116 $template_code = $objForm->getValue('template_code');78 $objSession = new SC_Session(); 79 SC_Utils::sfIsSuccess($objSession); 80 81 // uniqidをテンプレートへ埋め込み 82 $this->uniqid = $objSession->getUniqId(); 83 84 $objView = new SC_AdminView(); 85 86 switch($this->lfGetMode()) { 87 88 // 登録ボタン押下時 89 case 'register': 90 // 画面遷移の正当性チェック 91 if (!SC_Utils::sfIsValidTransition($objSession)) { 92 sfDispError(''); 93 } 94 // パラメータ検証 95 $objForm = $this->lfInitRegister(); 96 if ($objForm->checkError()) { 97 SC_Utils_Ex::sfDispError(''); 98 } 99 100 $template_code = $objForm->getValue('template_code'); 117 101 $this->tpl_select = $template_code; 118 102 119 if($template_code == "") {120 $template_code = "default";121 }122 123 // DBへ使用するテンプレートを登録124 $this->lfRegisterTemplate($template_code);125 126 // XXX コンパイルファイルのクリア処理を行う127 $objView->_smarty->clear_compiled_tpl();128 129 // common.cssの内容を更新130 $this->lfChangeCommonCss($template_code);131 132 // テンプレートのコピー133 $this->lfCopyTemplate($template_code);134 135 // ブロック位置を更新136 $this->lfChangeBloc($template_code);137 138 // 完了メッセージ139 $this->tpl_onload="alert('登録が完了しました。');";140 break;141 142 // 削除ボタン押下時143 case 'delete':144 // 画面遷移の正当性チェック145 if (!SC_Utils::sfIsValidTransition($objSession)) {146 SC_Utils::sfDispError('');147 }148 // パラメータ検証149 $objForm = $this->lfInitDelete();150 if ($objForm->checkError()) {151 SC_Utils::sfDispError('');152 }153 154 //現在使用中のテンプレートとデフォルトのテンプレートは削除できないようにする155 $template_code = $objForm->getValue('template_code_temp');156 if ($template_code == TEMPLATE_NAME || $template_code == DEFAULT_TEMPLATE_NAME) {157 $this->tpl_onload = "alert('選択中のテンプレートは削除出来ません');";158 break;159 }160 $this->lfDeleteTemplate($template_code);161 break;162 163 // downloadボタン押下時164 case 'download':165 // 画面遷移の正当性チェック166 if (!SC_Utils::sfIsValidTransition($objSession)) {167 SC_Utils::sfDispError('');168 }169 // パラメータ検証170 $objForm = $this->lfInitDownload();171 $template_code = $objForm->getValue('template_code_temp');172 // ユーザデータの下のファイルも保存する。173 $from_dir = USER_TEMPLATE_PATH . $template_code . "/";174 $to_dir = SMARTY_TEMPLATES_DIR . $template_code . "/_packages/";175 SC_Utils::sfMakeDir($to_dir);176 SC_Utils::sfCopyDir($from_dir, $to_dir);177 SC_Helper_FileManager::downloadArchiveFiles(SMARTY_TEMPLATES_DIR . $template_code);178 break;179 180 // プレビューボタン押下時181 case 'preview':182 break;183 184 default:185 break;186 }187 188 // defaultパラメータのセット189 $this->templates = $this->lfGetAllTemplates();190 $this->now_template = TEMPLATE_NAME;103 if($template_code == "") { 104 $template_code = "default"; 105 } 106 107 // DBへ使用するテンプレートを登録 108 $this->lfRegisterTemplate($template_code); 109 110 // XXX コンパイルファイルのクリア処理を行う 111 $objView->_smarty->clear_compiled_tpl(); 112 113 // common.cssの内容を更新 114 $this->lfChangeCommonCss($template_code); 115 116 // テンプレートのコピー 117 $this->lfCopyTemplate($template_code); 118 119 // ブロック位置を更新 120 $this->lfChangeBloc($template_code); 121 122 // 完了メッセージ 123 $this->tpl_onload="alert('登録が完了しました。');"; 124 break; 125 126 // 削除ボタン押下時 127 case 'delete': 128 // 画面遷移の正当性チェック 129 if (!SC_Utils::sfIsValidTransition($objSession)) { 130 SC_Utils::sfDispError(''); 131 } 132 // パラメータ検証 133 $objForm = $this->lfInitDelete(); 134 if ($objForm->checkError()) { 135 SC_Utils::sfDispError(''); 136 } 137 138 //現在使用中のテンプレートとデフォルトのテンプレートは削除できないようにする 139 $template_code = $objForm->getValue('template_code_temp'); 140 if ($template_code == TEMPLATE_NAME || $template_code == DEFAULT_TEMPLATE_NAME) { 141 $this->tpl_onload = "alert('選択中のテンプレートは削除出来ません');"; 142 break; 143 } 144 $this->lfDeleteTemplate($template_code); 145 break; 146 147 // downloadボタン押下時 148 case 'download': 149 // 画面遷移の正当性チェック 150 if (!SC_Utils::sfIsValidTransition($objSession)) { 151 SC_Utils::sfDispError(''); 152 } 153 // パラメータ検証 154 $objForm = $this->lfInitDownload(); 155 $template_code = $objForm->getValue('template_code_temp'); 156 // ユーザデータの下のファイルも保存する。 157 $from_dir = USER_TEMPLATE_PATH . $template_code . "/"; 158 $to_dir = SMARTY_TEMPLATES_DIR . $template_code . "/_packages/"; 159 SC_Utils::sfMakeDir($to_dir); 160 SC_Utils::sfCopyDir($from_dir, $to_dir); 161 SC_Helper_FileManager::downloadArchiveFiles(SMARTY_TEMPLATES_DIR . $template_code); 162 break; 163 164 // プレビューボタン押下時 165 case 'preview': 166 break; 167 168 default: 169 break; 170 } 171 172 // defaultパラメータのセット 173 $this->templates = $this->lfGetAllTemplates(); 174 $this->now_template = TEMPLATE_NAME; 191 175 $this->device_type_id = $device_type_id; 192 176 } … … 201 185 } 202 186 203 function lfGetMode(){204 if (isset($_POST['mode'])) return $_POST['mode'];205 }206 207 function lfInitRegister() {208 $objForm = new SC_FormParam();209 $objForm->addParam(210 'template_code', 'template_code', STEXT_LEN, '',211 array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "ALNUM_CHECK")212 );213 $objForm->setParam($_POST);214 215 return $objForm;216 }217 218 function lfInitDelete() {219 $objForm = new SC_FormParam();220 $objForm->addParam(221 'template_code_temp', 'template_code_temp', STEXT_LEN, '',222 array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "ALNUM_CHECK")223 );224 $objForm->setParam($_POST);225 226 return $objForm;227 }228 229 function lfInitDownload() {230 $objForm = new SC_FormParam();231 $objForm->addParam(232 'template_code_temp', 'template_code_temp', STEXT_LEN, '',233 array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "ALNUM_CHECK")234 );235 $objForm->setParam($_POST);236 237 return $objForm;238 }187 function lfGetMode(){ 188 if (isset($_POST['mode'])) return $_POST['mode']; 189 } 190 191 function lfInitRegister() { 192 $objForm = new SC_FormParam(); 193 $objForm->addParam( 194 'template_code', 'template_code', STEXT_LEN, '', 195 array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "ALNUM_CHECK") 196 ); 197 $objForm->setParam($_POST); 198 199 return $objForm; 200 } 201 202 function lfInitDelete() { 203 $objForm = new SC_FormParam(); 204 $objForm->addParam( 205 'template_code_temp', 'template_code_temp', STEXT_LEN, '', 206 array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "ALNUM_CHECK") 207 ); 208 $objForm->setParam($_POST); 209 210 return $objForm; 211 } 212 213 function lfInitDownload() { 214 $objForm = new SC_FormParam(); 215 $objForm->addParam( 216 'template_code_temp', 'template_code_temp', STEXT_LEN, '', 217 array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "ALNUM_CHECK") 218 ); 219 $objForm->setParam($_POST); 220 221 return $objForm; 222 } 239 223 240 224 /** … … 253 237 } 254 238 255 /**256 * common.cssの更新257 */239 /** 240 * common.cssの更新 241 */ 258 242 function lfChangeCommonCss($template_code) { 259 243 $css_path = USER_PATH . "css/common.css"; … … 272 256 fclose($fp); 273 257 } 274 275 /**276 * ブロック位置の更新277 */278 function lfChangeBloc($template_code) {279 $objQuery = new SC_Query();280 $filepath = USER_TEMPLATE_PATH. $template_code. "/sql/update_bloc.sql";281 282 // ブロック位置更新SQLファイル有283 if(file_exists($filepath)) {284 if($fp = fopen($filepath, "r")) {285 $sql = fread($fp, filesize($filepath));286 fclose($fp);287 }288 // 改行、タブを1スペースに変換289 $sql = preg_replace("/[\r\n\t]/", " " ,$sql);290 $sql_split = split(";", $sql);291 foreach($sql_split as $key => $val){292 if (trim($val) != "") {293 $objQuery->query($val);294 }295 }296 }297 }298 299 /**300 * テンプレートパッケージの削除301 */302 function lfDeleteTemplate($template_code) {303 // DB更新304 $objQuery = new SC_Query();305 $objQuery->delete('dtb_templates', 'template_code = ?', array($template_code));306 // テンプレート削除307 $templates_dir = SMARTY_TEMPLATES_DIR. $template_code. "/";308 SC_Utils_Ex::sfDelFile($templates_dir);309 // コンパイル削除310 $templates_c_dir = DATA_PATH. "Smarty/templates_c/". $template_code. "/";311 SC_Utils_Ex::sfDelFile($templates_c_dir);312 // ユーザーデータ削除313 $user_dir = USER_TEMPLATE_PATH. $template_code. "/";314 SC_Utils_Ex::sfDelFile($user_dir);315 }316 317 function lfGetAllTemplates() {318 $objQuery = new SC_Query();319 $arrRet = $objQuery->select('*', 'dtb_templates');320 if (empty($arrRet)) return array();321 322 return $arrRet;323 }258 259 /** 260 * ブロック位置の更新 261 */ 262 function lfChangeBloc($template_code) { 263 $objQuery = new SC_Query(); 264 $filepath = USER_TEMPLATE_PATH. $template_code. "/sql/update_bloc.sql"; 265 266 // ブロック位置更新SQLファイル有 267 if(file_exists($filepath)) { 268 if($fp = fopen($filepath, "r")) { 269 $sql = fread($fp, filesize($filepath)); 270 fclose($fp); 271 } 272 // 改行、タブを1スペースに変換 273 $sql = preg_replace("/[\r\n\t]/", " " ,$sql); 274 $sql_split = split(";", $sql); 275 foreach($sql_split as $key => $val){ 276 if (trim($val) != "") { 277 $objQuery->query($val); 278 } 279 } 280 } 281 } 282 283 /** 284 * テンプレートパッケージの削除 285 */ 286 function lfDeleteTemplate($template_code) { 287 // DB更新 288 $objQuery = new SC_Query(); 289 $objQuery->delete('dtb_templates', 'template_code = ?', array($template_code)); 290 // テンプレート削除 291 $templates_dir = SMARTY_TEMPLATES_DIR. $template_code. "/"; 292 SC_Utils_Ex::sfDelFile($templates_dir); 293 // コンパイル削除 294 $templates_c_dir = DATA_PATH. "Smarty/templates_c/". $template_code. "/"; 295 SC_Utils_Ex::sfDelFile($templates_c_dir); 296 // ユーザーデータ削除 297 $user_dir = USER_TEMPLATE_PATH. $template_code. "/"; 298 SC_Utils_Ex::sfDelFile($user_dir); 299 } 300 301 function lfGetAllTemplates() { 302 $objQuery = new SC_Query(); 303 $arrRet = $objQuery->select('*', 'dtb_templates'); 304 if (empty($arrRet)) return array(); 305 306 return $arrRet; 307 } 324 308 325 309 /* … … 331 315 */ 332 316 function lfCreateTemplate($dir, $file , $cart_flg) { 333 umask(0);317 umask(0); 334 318 $objFileManager = new SC_Helper_FileManager_Ex(); 335 319 336 320 // 作成ファイルディレクトリ 337 321 $create_dir = $dir . $file;
Note: See TracChangeset
for help on using the changeset viewer.
