Changeset 19768 for branches/version-2_5-dev/data/class/pages/admin
- Timestamp:
- 2010/12/25 20:58:13 (16 years ago)
- Location:
- branches/version-2_5-dev/data/class/pages/admin/design
- Files:
-
- 3 edited
-
LC_Page_Admin_Design_Bloc.php (modified) (2 diffs)
-
LC_Page_Admin_Design_Header.php (modified) (2 diffs)
-
LC_Page_Admin_Design_MainEdit.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.
