Changeset 19768
- Timestamp:
- 2010/12/25 20:58:13 (13 years ago)
- Location:
- branches/version-2_5-dev/data/class
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/SC_View.php
r19737 r19768 182 182 183 183 // ヘッダとフッタを割り当て 184 $templatePath = SC_Helper_PageLayout_Ex::getTemplatePath($device_type_id , true);184 $templatePath = SC_Helper_PageLayout_Ex::getTemplatePath($device_type_id); 185 185 $header_tpl = $templatePath . "header.tpl"; 186 186 $footer_tpl = $templatePath . "footer.tpl"; 187 188 // ユーザー作成のテンプレートが無ければ, 指定テンプレートを割り当て189 $templatePath = SC_Helper_PageLayout_Ex::getTemplatePath($device_type_id);190 if (!$this->_smarty->template_exists($header_tpl)) {191 $header_tpl = $templatePath . "header.tpl";192 }193 if (!$this->_smarty->template_exists($footer_tpl)) {194 $footer_tpl = $templatePath . "footer.tpl";195 }196 187 197 188 $this->assign("header_tpl", $header_tpl); -
branches/version-2_5-dev/data/class/helper/SC_Helper_PageLayout.php
r19737 r19768 58 58 // TODO 59 59 $arrPageData = $this->lfGetPageData("device_type_id = ? AND page_id = 0", array($device_type_id)); 60 $objPage->tpl_mainpage = $this->getTemplatePath($device_type_id , true)60 $objPage->tpl_mainpage = $this->getTemplatePath($device_type_id) 61 61 . "preview/" . $arrPageData[0]['filename'] . ".tpl"; 62 62 } … … 64 64 $arrPageLayout = $arrPageData[0]; 65 65 66 // ユーザテンプレートのパスを取得 67 $user_tpl = $this->getTemplatePath($device_type_id, true) 68 . $arrPageLayout['filename'] . ".tpl"; 69 70 // ユーザテンプレートの存在チェック 71 if (is_file($user_tpl)) { 72 $objPage->tpl_mainpage = $user_tpl; 73 } 74 // 存在しない場合は指定テンプレートを使用 75 else { 76 $objPage->tpl_mainpage = $this->getTemplatePath($device_type_id) 77 . $arrPageLayout['filename'] . ".tpl"; 78 } 66 $objPage->tpl_mainpage = $this->getTemplatePath($device_type_id) . $arrPageLayout['filename'] . ".tpl"; 79 67 80 68 // ページタイトルを設定 … … 151 139 $arrNavi[$key]['php_path'] = HTML_PATH . $val['php_path']; 152 140 } else { 153 $user_block_path = $this->getTemplatePath($device_type_id, true) . "/" . $val['tpl_path']; 154 if (is_file($user_block_path)) { 155 $arrNavi[$key]['tpl_path'] = $user_block_path; 156 } else { 157 $arrNavi[$key]['tpl_path'] = $this->getTemplatePath($device_type_id) . $val['tpl_path']; 158 } 141 $arrNavi[$key]['tpl_path'] = $this->getTemplatePath($device_type_id) . $val['tpl_path']; 159 142 } 160 143 // phpから呼び出されるか、tplファイルが存在する場合 -
branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Bloc.php
r19737 r19768 93 93 94 94 $this->objLayout = new SC_Helper_PageLayout_Ex(); 95 $package_path = $this->objLayout->getTemplatePath($device_type_id , true);95 $package_path = $this->objLayout->getTemplatePath($device_type_id); 96 96 97 97 // ブロック一覧を取得 … … 103 103 array($bloc_id, $device_type_id)); 104 104 105 // ユーザー作成ブロックが存在する場合 106 if (is_file($package_path . $arrBlocData[0]['tpl_path'])) { 107 $arrBlocData[0]['tpl_path'] = $package_path . $arrBlocData[0]['tpl_path']; 108 109 // 存在しない場合は指定テンプレートのブロックを取得 110 } else { 111 $arrBlocData[0]['tpl_path'] = $this->objLayout->getTemplatePath($device_type_id) . $arrBlocData[0]['tpl_path']; 112 } 105 $arrBlocData[0]['tpl_path'] = $this->objLayout->getTemplatePath($device_type_id) . $arrBlocData[0]['tpl_path']; 113 106 114 107 // テンプレートファイルの読み込み -
branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Header.php
r19737 r19768 97 97 // 登録時はプレビュー用テンプレートをコピーする 98 98 if ($_POST['mode'] == 'confirm'){ 99 copy($pre_DIR.$division.".tpl", $this->objLayout->getTemplatePath($device_type_id , true) . $division . ".tpl");99 copy($pre_DIR.$division.".tpl", $this->objLayout->getTemplatePath($device_type_id) . $division . ".tpl"); 100 100 // 完了メッセージ(プレビュー時は表示しない) 101 101 $this->tpl_onload="alert('登録が完了しました。');"; … … 122 122 // ユーザーパスにテンプレートが存在しなければ, 123 123 // 指定テンプレートから読み込む 124 $header_tpl = $this->objLayout->getTemplatePath($device_type_id, true) . "header.tpl"; 125 if (!is_file($header_tpl)) { 126 $header_tpl = $this->objLayout->getTemplatePath($device_type_id) . "header.tpl"; 127 } 128 $footer_tpl = $this->objLayout->getTemplatePath($device_type_id, true) . "footer.tpl"; 129 if (!is_file($footer_tpl)) { 130 $footer_tpl = $this->objLayout->getTemplatePath($device_type_id) . "footer.tpl"; 131 } 124 $header_tpl = $this->objLayout->getTemplatePath($device_type_id) . "header.tpl"; 125 $footer_tpl = $this->objLayout->getTemplatePath($device_type_id) . "footer.tpl"; 132 126 133 127 copy($header_tpl, $pre_DIR . "header.tpl"); -
branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_MainEdit.php
r19737 r19768 157 157 } 158 158 159 // FIXME 160 // テンプレートファイルが存在していれば読み込む 161 $templatePath = $this->objLayout->getTemplatePath($device_type_id, true); 162 $tpl_file = $templatePath . $arrPageData[0]['filename'] . ".tpl"; 163 164 if (file_exists($tpl_file)){ 165 $arrPageData[0]['tpl_data'] = file_get_contents($tpl_file); 166 // 存在してなければ, 指定されたテンプレートのファイルを読み込む 167 } else { 168 $templatePath = $this->objLayout->getTemplatePath($device_type_id); 169 $arrPageData[0]['tpl_data'] = file_get_contents($templatePath . $arrPageData[0]['filename'] . ".tpl"); 170 } 159 // テンプレートを読み込む 160 $templatePath = $this->objLayout->getTemplatePath($device_type_id); 161 $arrPageData[0]['tpl_data'] = file_get_contents($templatePath . $arrPageData[0]['filename'] . ".tpl"); 171 162 172 163 // チェックボックスの値変更 … … 183 174 * プレビュー画面を表示する. 184 175 * 185 * FIXME 186 * 187 * @param integer $page_id ページID 176 * @param integer $page_id_old 元のページID 188 177 * @param integer $device_type_id 端末種別ID 189 178 * @return void 190 179 */ 191 function lfPreviewPageData($page_id, $device_type_id) { 192 193 $page_id_old = $page_id; 180 function lfPreviewPageData($page_id_old, $device_type_id) { 181 194 182 // プレビューの場合ページIDを0にセットする。 195 $page_id = "0";196 $url = basename($_POST['url']);197 183 $page_id = '0'; 184 $url = 'preview'; 185 198 186 $tmpPost = $_POST; 199 187 $tmpPost['page_id'] = $page_id; 200 188 $tmpPost['url'] = $url; 201 189 $tmpPost['tpl_dir'] = USER_PATH . "templates/preview/"; 202 190 203 191 $arrPreData = $this->objLayout->lfGetPageData("page_id = ? AND device_type_id = ?", 204 192 array($page_id, $device_type_id)); 205 206 // tplファイルの削除 (XXX: 処理の意図が不明。存在していると都合が悪いファイル?)207 $del_tpl = USER_PATH . "templates/" . $arrPreData[0]['filename'] . '.tpl';208 if (file_exists($del_tpl)){209 unlink($del_tpl);210 }211 193 212 194 // DBへデータを更新する 213 $this->lfEntryPageData($tmpPost );195 $this->lfEntryPageData($tmpPost, $device_type_id); 214 196 215 197 // TPLファイル作成 216 $ preview_tpl = USER_PATH . "templates/preview/" . TEMPLATE_NAME . "/". $url . '.tpl';217 $this->lfCreateFile($ preview_tpl, $_POST['tpl_data']);198 $cre_tpl = $this->objLayout->getTemplatePath($device_type_id) . $url . '.tpl'; 199 $this->lfCreateFile($cre_tpl, $_POST['tpl_data']); 218 200 219 201 // blocposition を削除 220 202 $objQuery = new SC_Query(); // DB操作オブジェクト 221 $sql = 'delete from dtb_blocposition where page_id = 0'; 222 $ret = $objQuery->query($sql); 203 $ret = $objQuery->delete('dtb_blocposition', 'page_id = 0 AND device_type_id = ?', array($device_type_id)); 223 204 224 205 if ($page_id_old != "") { 225 206 // 登録データを取得 226 $sql = "SELECT 0, target_id, bloc_id, bloc_row FROM dtb_blocposition WHERE page_id = ?"; 227 $ret = $objQuery->getAll($sql,array($page_id_old)); 228 229 if (count($ret) > 0) { 230 231 // blocposition を複製 232 $sql = " insert into dtb_blocposition ("; 233 $sql .= " page_id,"; 234 $sql .= " target_id,"; 235 $sql .= " bloc_id,"; 236 $sql .= " bloc_row"; 237 $sql .= " )values(?, ?, ?, ?)"; 238 239 // 取得件数文INSERT実行 240 foreach($ret as $key => $val){ 241 $ret = $objQuery->query($sql,$val); 242 } 207 $sql = 'SELECT target_id, bloc_id, bloc_row FROM dtb_blocposition WHERE page_id = ? AND device_type_id = ?'; 208 $ret = $objQuery->getAll($sql, array($page_id_old, $device_type_id)); 209 210 // blocposition を複製 211 foreach($ret as $row){ 212 $row['page_id'] = $page_id; 213 $row['device_type_id'] = $device_type_id; 214 $objQuery->insert('dtb_blocposition', $row); 243 215 } 244 216 } 245 217 $_SESSION['preview'] = "ON"; 246 218 $this->objDisplay->redirect($this->getLocation(URL_DIR . "preview/" . DIR_INDEX_URL, array("filename" => $arrPageData[0]["filename"]))); 247 248 219 } 249 220 … … 271 242 272 243 // TPLファイル作成 273 $cre_tpl = $this->objLayout->getTemplatePath($device_type_id , true) . basename($_POST['url']) . '.tpl';244 $cre_tpl = $this->objLayout->getTemplatePath($device_type_id) . basename($_POST['url']) . '.tpl'; 274 245 $this->lfCreateFile($cre_tpl, $_POST['tpl_data']); 275 246 … … 351 322 $arrUpdData['php_dir'] .= '/'; 352 323 } 353 $arrUpdData['tpl_dir'] = substr($this->objLayout->getTemplatePath($devie_type_id , true), strlen(URL_DIR));324 $arrUpdData['tpl_dir'] = substr($this->objLayout->getTemplatePath($devie_type_id), strlen(URL_DIR)); 354 325 $arrUpdData['filename'] = basename($arrData['url']); // 拡張子を付加しない 355 326 } … … 436 407 // ファイル作成 437 408 $fp = fopen($path,"w"); 438 fwrite($fp, $data); // FIXME いきなり POST はちょっと... 409 if ($fp === false) { 410 SC_Utils_Ex::sfDispException(); 411 } 412 $ret = fwrite($fp, $data); 413 if ($ret === false) { 414 SC_Utils_Ex::sfDispException(); 415 } 439 416 fclose($fp); 440 417 } -
branches/version-2_5-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php
r19737 r19768 60 60 $this->tpl_mainpage = $bloc_file; 61 61 } else { 62 $user_bloc_path = SC_Helper_PageLayout_Ex::getTemplatePath($this->objDisplay->detectDevice(), true) . BLOC_DIR . $bloc_file; 63 if (is_file($user_bloc_path)) { 64 $this->tpl_mainpage = $user_bloc_path; 65 } else { 66 $this->tpl_mainpage = SC_Helper_PageLayout_Ex::getTemplatePath($this->objDisplay->detectDevice()) . BLOC_DIR . $bloc_file; 67 } 62 $this->tpl_mainpage = SC_Helper_PageLayout_Ex::getTemplatePath($this->objDisplay->detectDevice()) . BLOC_DIR . $bloc_file; 68 63 } 69 64
Note: See TracChangeset
for help on using the changeset viewer.