1 | <?php |
---|
2 | /* |
---|
3 | * This file is part of EC-CUBE |
---|
4 | * |
---|
5 | * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. |
---|
6 | * |
---|
7 | * http://www.lockon.co.jp/ |
---|
8 | * |
---|
9 | * This program is free software; you can redistribute it and/or |
---|
10 | * modify it under the terms of the GNU General Public License |
---|
11 | * as published by the Free Software Foundation; either version 2 |
---|
12 | * of the License, or (at your option) any later version. |
---|
13 | * |
---|
14 | * This program is distributed in the hope that it will be useful, |
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | * GNU General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU General Public License |
---|
20 | * along with this program; if not, write to the Free Software |
---|
21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
22 | */ |
---|
23 | |
---|
24 | // {{{ requires |
---|
25 | require_once(CLASS_PATH . "pages/LC_Page.php"); |
---|
26 | |
---|
27 | /** |
---|
28 | * デザイン管理 のページクラス. |
---|
29 | * |
---|
30 | * @package Page |
---|
31 | * @author LOCKON CO.,LTD. |
---|
32 | * @version $Id$ |
---|
33 | */ |
---|
34 | class LC_Page_Admin_Design extends LC_Page { |
---|
35 | |
---|
36 | // }}} |
---|
37 | // {{{ functions |
---|
38 | |
---|
39 | /** |
---|
40 | * Page を初期化する. |
---|
41 | * |
---|
42 | * @return void |
---|
43 | */ |
---|
44 | function init() { |
---|
45 | parent::init(); |
---|
46 | $this->tpl_mainpage = 'design/index.tpl'; |
---|
47 | $this->tpl_subnavi = 'design/subnavi.tpl'; |
---|
48 | $this->tpl_subno = "layout"; |
---|
49 | $this->tpl_mainno = "design"; |
---|
50 | $this->tpl_subtitle = 'レイアウト編集'; |
---|
51 | } |
---|
52 | |
---|
53 | /** |
---|
54 | * Page のプロセス. |
---|
55 | * |
---|
56 | * @return void |
---|
57 | */ |
---|
58 | function process() { |
---|
59 | |
---|
60 | $objView = new SC_AdminView(); |
---|
61 | $objSess = new SC_Session(); |
---|
62 | $objLayout = new SC_Helper_PageLayout_Ex(); |
---|
63 | |
---|
64 | // 認証可否の判定 |
---|
65 | $objSess = new SC_Session(); |
---|
66 | SC_Utils_Ex::sfIsSuccess($objSess); |
---|
67 | |
---|
68 | // ページIDを取得 |
---|
69 | if (isset($_GET['page_id'])) { |
---|
70 | $page_id = $_GET['page_id']; |
---|
71 | }else if (isset($_POST['page_id'])){ |
---|
72 | $page_id = $_POST['page_id']; |
---|
73 | }else{ |
---|
74 | $page_id = 1; |
---|
75 | } |
---|
76 | |
---|
77 | // 編集可能ページを取得 |
---|
78 | $this->arrEditPage = $objLayout->lfgetPageData(); |
---|
79 | |
---|
80 | // ブロック配置用データを取得 |
---|
81 | $sel = ", pos.target_id, pos.bloc_id, pos.bloc_row ,pos.anywhere"; |
---|
82 | $from = ", dtb_blocposition AS pos"; |
---|
83 | $where = " where "; |
---|
84 | $where .= "( pos.anywhere = 1 OR (lay.page_id = ? AND "; |
---|
85 | $where .= "lay.page_id = pos.page_id AND exists (select bloc_id from dtb_bloc as blc where pos.bloc_id = blc.bloc_id) )) ORDER BY lay.page_id,pos.target_id, pos.bloc_row, pos.bloc_id "; |
---|
86 | // $where .= "((lay.page_id = ? AND "; |
---|
87 | // $where .= "lay.page_id = pos.page_id AND exists (select bloc_id from dtb_bloc as blc where pos.bloc_id = blc.bloc_id) )) ORDER BY lay.page_id,pos.target_id, pos.bloc_row, pos.bloc_id "; |
---|
88 | |
---|
89 | $arrData = array($page_id); |
---|
90 | $arrBlocPos = $this->lfgetLayoutData($sel, $from, $where, $arrData ); |
---|
91 | |
---|
92 | // データの存在チェックを行う |
---|
93 | $arrPageData = $objLayout->lfgetPageData("page_id = ?", array($page_id)); |
---|
94 | if (count($arrPageData) <= 0) { |
---|
95 | $exists_page = 0; |
---|
96 | }else{ |
---|
97 | $exists_page = 1; |
---|
98 | } |
---|
99 | $this->exists_page = $exists_page; |
---|
100 | |
---|
101 | // メッセージ表示 |
---|
102 | if (isset($_GET['msg']) && $_GET['msg'] == "on") { |
---|
103 | $this->complate_msg="alert('登録が完了しました。');"; |
---|
104 | } |
---|
105 | |
---|
106 | // ブロックを取得 |
---|
107 | $arrBloc = $this->lfgetBlocData(); |
---|
108 | |
---|
109 | if (!isset($_POST['mode'])) $_POST['mode'] = ""; |
---|
110 | |
---|
111 | // 新規ブロック作成 |
---|
112 | if ($_POST['mode'] == 'new_bloc') { |
---|
113 | $this->sendRedirect($this->getLocation("./bloc.php")); |
---|
114 | exit; |
---|
115 | } |
---|
116 | |
---|
117 | // 新規ページ作成 |
---|
118 | if ($_POST['mode'] == 'new_page') { |
---|
119 | $this->sendRedirect($this->getLocation("./main_edit.php")); |
---|
120 | exit; |
---|
121 | } |
---|
122 | |
---|
123 | // データ登録処理 |
---|
124 | if ($_POST['mode'] == 'confirm' or $_POST['mode'] == 'preview') { |
---|
125 | $page_id = $_POST['page_id']; |
---|
126 | if ($_POST['mode'] == 'preview') { |
---|
127 | $page_id = '0'; |
---|
128 | } |
---|
129 | $masterData = new SC_DB_MasterData_Ex(); |
---|
130 | $arrTarget = $masterData->getMasterData("mtb_target"); |
---|
131 | |
---|
132 | // 更新用にデータを整える |
---|
133 | $arrUpdBlocData = array(); |
---|
134 | $arrTargetFlip = array_flip($arrTarget); |
---|
135 | |
---|
136 | $upd_cnt = 1; |
---|
137 | $arrUpdData[$upd_cnt]['page_id'] = $page_id; |
---|
138 | |
---|
139 | // POSTのデータを使いやすいように修正 |
---|
140 | for($upd_cnt = 1; $upd_cnt <= $_POST['bloc_cnt']; $upd_cnt++){ |
---|
141 | if (!isset($_POST['id_'.$upd_cnt])) { |
---|
142 | break; |
---|
143 | } |
---|
144 | $arrUpdBlocData[$upd_cnt]['name'] = $_POST['name_'.$upd_cnt]; // ブロック名称 |
---|
145 | $arrUpdBlocData[$upd_cnt]['id'] = $_POST['id_'.$upd_cnt]; // ブロックID |
---|
146 | $arrUpdBlocData[$upd_cnt]['target_id'] = $arrTargetFlip[$_POST['target_id_'.$upd_cnt]]; // ターゲットID |
---|
147 | $arrUpdBlocData[$upd_cnt]['top'] = $_POST['top_'.$upd_cnt]; // TOP座標 |
---|
148 | $arrUpdBlocData[$upd_cnt]['anywhere'] = $_POST['anywhere_'.$upd_cnt]; //全ページ適用か |
---|
149 | $arrUpdBlocData[$upd_cnt]['update_url'] = $_SERVER['HTTP_REFERER']; // 更新URL |
---|
150 | |
---|
151 | } |
---|
152 | |
---|
153 | // データの更新を行う |
---|
154 | $objDBConn = new SC_DbConn; // DB操作オブジェクト |
---|
155 | $arrRet = array(); // データ取得用 |
---|
156 | |
---|
157 | // delete実行 |
---|
158 | $del_sql = ""; |
---|
159 | $del_sql .= "DELETE FROM dtb_blocposition WHERE page_id = ? "; |
---|
160 | $arrRet = $objDBConn->query($del_sql,array($page_id)); |
---|
161 | |
---|
162 | // ブロックの順序を取得し、更新を行う |
---|
163 | foreach($arrUpdBlocData as $key => $val){ |
---|
164 | // ブロックの順序を取得 |
---|
165 | $bloc_row = $this->lfGetRowID($arrUpdBlocData, $val); |
---|
166 | $arrUpdBlocData[$key]['bloc_row'] = $bloc_row; |
---|
167 | $arrUpdBlocData[$key]['page_id'] = $page_id; // ページID |
---|
168 | |
---|
169 | /* |
---|
170 | ターゲットID 1:レフトナビ 2:ライトナビ 3:イン画面上部 4:メイン画面下部 5:画面上部 6:画面下部 7:ヘッダより上 8:フッタより下 9:HEADタグ内 10:欄外 |
---|
171 | */ |
---|
172 | if ($arrUpdBlocData[$key]['target_id'] == 10) { |
---|
173 | $arrUpdBlocData[$key]['bloc_row'] = "0"; |
---|
174 | } |
---|
175 | |
---|
176 | // insert文生成 |
---|
177 | $ins_sql = ""; |
---|
178 | $ins_sql .= "INSERT INTO dtb_blocposition "; |
---|
179 | $ins_sql .= " values ( "; |
---|
180 | $ins_sql .= " ? "; // ページID |
---|
181 | $ins_sql .= " ,? "; // ターゲットID |
---|
182 | $ins_sql .= " ,? "; // ブロックID |
---|
183 | $ins_sql .= " ,? "; // ブロックの並び順序 |
---|
184 | $ins_sql .= " ,(SELECT filename FROM dtb_bloc WHERE bloc_id = ?) "; // ファイル名称 |
---|
185 | $ins_sql .= " ,? "; // 全ページフラグ |
---|
186 | $ins_sql .= " ) "; |
---|
187 | |
---|
188 | // insertデータ生成 |
---|
189 | $arrInsData = array($page_id, |
---|
190 | $arrUpdBlocData[$key]['target_id'], |
---|
191 | $arrUpdBlocData[$key]['id'], |
---|
192 | $arrUpdBlocData[$key]['bloc_row'], |
---|
193 | $arrUpdBlocData[$key]['id'], |
---|
194 | $arrUpdBlocData[$key]['anywhere'] |
---|
195 | ); |
---|
196 | $count = $objDBConn->getOne("SELECT COUNT(*) FROM dtb_blocposition WHERE anywhere = 1 AND bloc_id = ?",array($arrUpdBlocData[$key]['id'])); |
---|
197 | |
---|
198 | if($arrUpdBlocData[$key]['anywhere'] == 1){ |
---|
199 | $count = $objDBConn->getOne("SELECT COUNT(*) FROM dtb_blocposition WHERE anywhere = 1 AND bloc_id = ?",array($arrUpdBlocData[$key]['id'])); |
---|
200 | $objDBConn->getLastQuery(); |
---|
201 | if($count != 0){ |
---|
202 | continue; |
---|
203 | }else{ |
---|
204 | } |
---|
205 | }else{ |
---|
206 | if($count > 0){ |
---|
207 | $objDBConn->query("DELETE FROM dtb_blocposition WHERE anywhere = 1 AND bloc_id = ?",array($arrUpdBlocData[$key]['id'])); |
---|
208 | } |
---|
209 | } |
---|
210 | // SQL実行 |
---|
211 | $arrRet = $objDBConn->query($ins_sql,$arrInsData); |
---|
212 | } |
---|
213 | |
---|
214 | // プレビュー処理 |
---|
215 | if ($_POST['mode'] == 'preview') { |
---|
216 | if ($page_id === "") { |
---|
217 | $this->sendRedirect($this->getLocation(DIR_INDEX_URL)); |
---|
218 | exit; |
---|
219 | } |
---|
220 | $this->lfSetPreData($arrPageData, $objLayout); |
---|
221 | |
---|
222 | $_SESSION['preview'] = "ON"; |
---|
223 | |
---|
224 | $this->sendRedirect($this->getLocation(URL_DIR . "preview/" . DIR_INDEX_URL, array("filename" => $arrPageData[0]["filename"]))); |
---|
225 | exit; |
---|
226 | |
---|
227 | }else{ |
---|
228 | $this->sendRedirect($this->getLocation(DIR_INDEX_URL, |
---|
229 | array("page_id" => $page_id, |
---|
230 | "msg" => "on"))); |
---|
231 | exit; |
---|
232 | |
---|
233 | } |
---|
234 | } |
---|
235 | |
---|
236 | // データ削除処理 ベースデータでなければファイルを削除 |
---|
237 | if ($_POST['mode'] == 'delete' and !$objLayout->lfCheckBaseData($page_id)) { |
---|
238 | $objLayout->lfDelPageData($page_id); |
---|
239 | $this->sendRedirect($this->getLocation(DIR_INDEX_URL)); |
---|
240 | exit; |
---|
241 | } |
---|
242 | |
---|
243 | // ブロック情報を画面配置用に編集 |
---|
244 | $tpl_arrBloc = array(); |
---|
245 | $cnt = 0; |
---|
246 | // 使用されているブロックデータを生成 |
---|
247 | foreach($arrBlocPos as $key => $val){ |
---|
248 | if ($val['page_id'] == $page_id) { |
---|
249 | $tpl_arrBloc = $this->lfSetBlocData($arrBloc, $val, $tpl_arrBloc, $cnt); |
---|
250 | $cnt++; |
---|
251 | }else{ |
---|
252 | } |
---|
253 | } |
---|
254 | |
---|
255 | |
---|
256 | // 未使用のブロックデータを追加 |
---|
257 | foreach($arrBloc as $key => $val){ |
---|
258 | if (!$this->lfChkBloc($val, $tpl_arrBloc)) { |
---|
259 | $val['target_id'] = 10; // 未使用に追加する |
---|
260 | $tpl_arrBloc = $this->lfSetBlocData($arrBloc, $val, $tpl_arrBloc, $cnt); |
---|
261 | $cnt++; |
---|
262 | }else{ |
---|
263 | } |
---|
264 | } |
---|
265 | |
---|
266 | $this->tpl_arrBloc = $tpl_arrBloc; |
---|
267 | $this->bloc_cnt = count($tpl_arrBloc); |
---|
268 | $this->page_id = $page_id; |
---|
269 | |
---|
270 | // ページ名称を取得 |
---|
271 | $arrPageData = $objLayout->lfgetPageData(' page_id = ?', array($page_id)); |
---|
272 | $this->arrPageData = $arrPageData[0]; |
---|
273 | |
---|
274 | global $GLOBAL_ERR; |
---|
275 | $errCnt = 0; |
---|
276 | if ($GLOBAL_ERR != "") { |
---|
277 | $arrGlobalErr = explode("\n",$GLOBAL_ERR); |
---|
278 | $errCnt = count($arrGlobalErr) - 8; |
---|
279 | if ($errCnt < 0 ) { |
---|
280 | $errCnt = 0; |
---|
281 | } |
---|
282 | } |
---|
283 | $this->errCnt = $errCnt; |
---|
284 | |
---|
285 | // 画面の表示 |
---|
286 | $objView->assignobj($this); |
---|
287 | $objView->display(MAIN_FRAME); |
---|
288 | |
---|
289 | } |
---|
290 | /** |
---|
291 | * デストラクタ. |
---|
292 | * |
---|
293 | * @return void |
---|
294 | */ |
---|
295 | function destroy() { |
---|
296 | parent::destroy(); |
---|
297 | } |
---|
298 | |
---|
299 | /** |
---|
300 | * 編集可能なページ情報を取得する. |
---|
301 | * |
---|
302 | * @param string $sel Select句文 |
---|
303 | * @param string $where Where句文 |
---|
304 | * @param array $arrVa Where句の絞込条件値 |
---|
305 | * @return array ページレイアウト情報の配列 |
---|
306 | */ |
---|
307 | function lfgetLayoutData($sel = '' , $from = '', $where = '', $arrVal = ''){ |
---|
308 | $objDBConn = new SC_DbConn; // DB操作オブジェクト |
---|
309 | $sql = ""; // データ取得SQL生成用 |
---|
310 | $arrRet = array(); // データ取得用 |
---|
311 | |
---|
312 | // SQL生成 |
---|
313 | |
---|
314 | $sql = ""; |
---|
315 | $sql .= " select "; |
---|
316 | $sql .= " lay.page_id "; |
---|
317 | $sql .= " ,lay.page_name "; |
---|
318 | $sql .= " ,lay.url "; |
---|
319 | $sql .= " ,lay.author "; |
---|
320 | $sql .= " ,lay.description "; |
---|
321 | $sql .= " ,lay.keyword "; |
---|
322 | $sql .= " ,lay.update_url "; |
---|
323 | $sql .= " ,lay.create_date "; |
---|
324 | $sql .= " ,lay.update_date "; |
---|
325 | |
---|
326 | // Select句の指定があれば追加 |
---|
327 | if ($sel != '') { |
---|
328 | $sql .= $sel; |
---|
329 | } |
---|
330 | |
---|
331 | $sql .= " from dtb_pagelayout AS lay "; |
---|
332 | // From句の指定があれば追加 |
---|
333 | if ($from != '') { |
---|
334 | $sql .= $from; |
---|
335 | } |
---|
336 | |
---|
337 | // where句の指定があれば追加 |
---|
338 | if ($where != '') { |
---|
339 | $sql .= $where; |
---|
340 | }else{ |
---|
341 | $sql .= " ORDER BY lay.page_id "; |
---|
342 | } |
---|
343 | |
---|
344 | $arrRet = $objDBConn->getAll($sql, $arrVal); |
---|
345 | |
---|
346 | return $arrRet; |
---|
347 | } |
---|
348 | |
---|
349 | /** |
---|
350 | * ブロック情報を取得する. |
---|
351 | * |
---|
352 | * @param string $where Where句文 |
---|
353 | * @param array $arrVal Where句の絞込条件値 |
---|
354 | * @return array ブロック情報の配列 |
---|
355 | */ |
---|
356 | function lfgetBlocData($where = '', $arrVal = ''){ |
---|
357 | $objDBConn = new SC_DbConn; // DB操作オブジェクト |
---|
358 | $sql = ""; // データ取得SQL生成用 |
---|
359 | $arrRet = array(); // データ取得用 |
---|
360 | |
---|
361 | // SQL生成 |
---|
362 | $sql = ""; |
---|
363 | $sql .= " SELECT "; |
---|
364 | $sql .= " bloc_id"; |
---|
365 | $sql .= " ,bloc_name"; |
---|
366 | $sql .= " ,tpl_path"; |
---|
367 | $sql .= " ,filename"; |
---|
368 | $sql .= " ,update_date"; |
---|
369 | $sql .= " FROM "; |
---|
370 | $sql .= " dtb_bloc"; |
---|
371 | |
---|
372 | // where句の指定があれば追加 |
---|
373 | if ($where != '') { |
---|
374 | $sql .= " WHERE " . $where; |
---|
375 | } |
---|
376 | |
---|
377 | $sql .= " ORDER BY bloc_id"; |
---|
378 | |
---|
379 | $arrRet = $objDBConn->getAll($sql, $arrVal); |
---|
380 | |
---|
381 | return $arrRet; |
---|
382 | } |
---|
383 | |
---|
384 | /** |
---|
385 | * ブロック情報の配列を生成する. |
---|
386 | * |
---|
387 | * @param array $arrBloc Bloc情報 |
---|
388 | * @param array $tpl_arrBloc データをセットする配列 |
---|
389 | * @param integer $cnt 配列番号 |
---|
390 | * @return array データをセットした配列 |
---|
391 | */ |
---|
392 | function lfSetBlocData($arrBloc, $val, $tpl_arrBloc, $cnt) { |
---|
393 | $masterData = new SC_DB_MasterData_Ex(); |
---|
394 | $arrTarget = $masterData->getMasterData("mtb_target"); |
---|
395 | |
---|
396 | $tpl_arrBloc[$cnt]['target_id'] = $arrTarget[$val['target_id']]; |
---|
397 | $tpl_arrBloc[$cnt]['bloc_id'] = $val['bloc_id']; |
---|
398 | $tpl_arrBloc[$cnt]['bloc_row'] = |
---|
399 | isset($val['bloc_row']) ? $val['bloc_row'] : ""; |
---|
400 | $tpl_arrBloc[$cnt]['anywhere'] = $val['anywhere']; |
---|
401 | if($val['anywhere'] == 1){ |
---|
402 | $tpl_arrBloc[$cnt]['anywhere_selected'] = 'checked="checked"'; |
---|
403 | } |
---|
404 | foreach($arrBloc as $bloc_key => $bloc_val){ |
---|
405 | if ($bloc_val['bloc_id'] == $val['bloc_id']) { |
---|
406 | $bloc_name = $bloc_val['bloc_name']; |
---|
407 | break; |
---|
408 | } |
---|
409 | } |
---|
410 | $tpl_arrBloc[$cnt]['name'] = $bloc_name; |
---|
411 | |
---|
412 | return $tpl_arrBloc; |
---|
413 | } |
---|
414 | |
---|
415 | /** |
---|
416 | * ブロックIDが配列に追加されているかのチェックを行う. |
---|
417 | * |
---|
418 | * @param array $arrBloc Bloc情報 |
---|
419 | * @param array $arrChkData チェックを行うデータ配列 |
---|
420 | * @return bool 存在する場合 true |
---|
421 | */ |
---|
422 | function lfChkBloc($arrBloc, $arrChkData) { |
---|
423 | foreach($arrChkData as $key => $val){ |
---|
424 | if ($val['bloc_id'] === $arrBloc['bloc_id'] ) { |
---|
425 | // 配列に存在すればTrueを返す |
---|
426 | return true; |
---|
427 | } |
---|
428 | } |
---|
429 | |
---|
430 | // 配列に存在しなければFlaseを返す |
---|
431 | return false; |
---|
432 | } |
---|
433 | |
---|
434 | /** |
---|
435 | * ブロックIDが何番目に配置されているかを調べる. |
---|
436 | * |
---|
437 | * @param array $arrUpdData 更新情報 |
---|
438 | * @param array $arrObj チェックを行うデータ配列 |
---|
439 | * @return integer 順番 |
---|
440 | */ |
---|
441 | function lfGetRowID($arrUpdData, $arrObj){ |
---|
442 | $no = 0; // カウント用(同じデータが必ず1件あるので、初期値は0) |
---|
443 | |
---|
444 | // 対象データが何番目に配置されているのかを取得する。 |
---|
445 | foreach ($arrUpdData as $key => $val) { |
---|
446 | if ($val['target_id'] === $arrObj['target_id'] and $val['top'] <= $arrObj['top']){ |
---|
447 | $no++; |
---|
448 | } |
---|
449 | } |
---|
450 | // 番号を返す |
---|
451 | return $no; |
---|
452 | } |
---|
453 | |
---|
454 | /** |
---|
455 | * プレビューするデータを DB に保存する. |
---|
456 | * |
---|
457 | * @param array $arrPageData ページ情報の配列 |
---|
458 | * @return void |
---|
459 | */ |
---|
460 | function lfSetPreData($arrPageData, &$objLayout){ |
---|
461 | $objDBConn = new SC_DbConn; // DB操作オブジェクト |
---|
462 | $sql = ""; // データ更新SQL生成用 |
---|
463 | $ret = ""; // データ更新結果格納用 |
---|
464 | $arrUpdData = array(); // 更新データ生成用 |
---|
465 | $filename = $arrPageData[0]['filename']; |
---|
466 | |
---|
467 | $arrPreData = $objLayout->lfgetPageData(" page_id = ? " , array("0")); |
---|
468 | |
---|
469 | // XXX tplファイルの削除 |
---|
470 | $del_tpl = USER_PATH . "templates/" . $filename . '.tpl'; |
---|
471 | |
---|
472 | if (file_exists($del_tpl)){ |
---|
473 | unlink($del_tpl); |
---|
474 | } |
---|
475 | |
---|
476 | // filename が空の場合にはMYページと判断 |
---|
477 | if($filename == ""){ |
---|
478 | $tplfile = TEMPLATE_DIR . "mypage/index"; |
---|
479 | $filename = 'mypage'; |
---|
480 | } else { |
---|
481 | if (file_exists(TEMPLATE_FTP_DIR . $filename . ".tpl")) { |
---|
482 | $tplfile = TEMPLATE_FTP_DIR . $filename; |
---|
483 | } else { |
---|
484 | $tplfile = TEMPLATE_DIR . $filename; |
---|
485 | } |
---|
486 | } |
---|
487 | |
---|
488 | // プレビュー用tplファイルのコピー |
---|
489 | $copyTo = USER_PATH . "templates/preview/" . TEMPLATE_NAME . "/" . $filename . ".tpl"; |
---|
490 | |
---|
491 | if (!is_dir(dirname($copyTo))) { |
---|
492 | mkdir(dirname($copyTo)); |
---|
493 | } |
---|
494 | |
---|
495 | copy($tplfile . ".tpl", $copyTo); |
---|
496 | |
---|
497 | // 更新データの取得 |
---|
498 | $sql = "select page_id,page_name, header_chk, footer_chk from dtb_pagelayout where page_id = ? OR page_id = (SELECT page_id FROM dtb_blocposition WHERE anywhere = 1)" ; |
---|
499 | |
---|
500 | $ret = $objDBConn->getAll($sql, array($arrPageData[0]['page_id'])); |
---|
501 | |
---|
502 | // dbデータのコピー |
---|
503 | $sql = " update dtb_pagelayout set "; |
---|
504 | $sql .= " page_name = ?"; |
---|
505 | $sql .= " ,header_chk = ?"; |
---|
506 | $sql .= " ,footer_chk = ?"; |
---|
507 | $sql .= " ,url = ?"; |
---|
508 | $sql .= " ,tpl_dir = ?"; |
---|
509 | $sql .= " ,filename = ?"; |
---|
510 | // $sql .= " ,anywhere = ?"; |
---|
511 | $sql .= " where page_id = 0"; |
---|
512 | var_dump($ret); |
---|
513 | echo("####<br/>\n\n".__LINE__ ." in file:".__FILE__."<br/>\n\n ####"); |
---|
514 | |
---|
515 | $arrUpdData = array($ret[0]['page_id'] |
---|
516 | ,$ret[0]['page_id'] |
---|
517 | ,$ret[0]['page_id'] |
---|
518 | ,USER_DIR . "templates/" . TEMPLATE_NAME . "/" |
---|
519 | ,USER_DIR . "templates/" . TEMPLATE_NAME . "/" |
---|
520 | ,$filename |
---|
521 | // ,$ret[0]['anywhere'] |
---|
522 | |
---|
523 | ); |
---|
524 | |
---|
525 | $objDBConn->query($sql,$arrUpdData); |
---|
526 | } |
---|
527 | } |
---|
528 | ?> |
---|