Changeset 19725 for branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Template.php
- Timestamp:
- 2010/12/15 18:06:23 (13 years ago)
- bzr:base-revision:
- svn-v4:1e3b908f-19a9-db11-a64c-001125224ba8:branches/version-2_5-dev:19724
- bzr:committer:
- Kentaro Ohkouchi <ohkouchi@loop-az.jp>
- 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:
- ohkouchi@loop-az.jp-20101215090611-0mqtkfcbju06ba0c
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 65 66 67 68 69 70 71 72 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 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 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 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 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 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 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 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 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 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.