/** * ページデータを取得する. * * @param integer $device_type_id 端末種別ID * @param integer $page_id ページID * @param SC_Helper_PageLayout $objLayout SC_Helper_PageLayout インスタンス * @return array ページデータの配列 */ function getTplMainpage($device_type_id, $page_id, &$objLayout) { $arrPageData = $objLayout->getPageProperties($device_type_id, $page_id); $objBlob = new SC_Helper_Blob_Ex(); $containerName = $objBlob->getTemplateContainerName($device_type_id); $templatePath = $objLayout->getTemplatePath($device_type_id); $filename = $templatePath . $arrPageData[0]['filename'] . ".tpl"; if ($objBlob->blobExists($containerName, $arrPageData[0]['filename'] . ".tpl")) { $arrPageData[0]['tpl_data'] = $objBlob->getBlobData($containerName, $arrPageData[0]['filename'] . ".tpl"); } // ファイル名を画面表示用に加工しておく $arrPageData[0]['filename'] = preg_replace('|^' . preg_quote(USER_DIR) . '|', '', $arrPageData[0]['filename']); return $arrPageData[0]; }
/** * Page を初期化する. * * @return void */ public function init() { parent::init(); $this->tpl_title = 'MYページ'; if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) { $this->tpl_title .= '/退会手続き(完了ページ)'; } else { $this->tpl_subtitle = '退会手続き(完了ページ)'; } $this->tpl_navi = SC_Helper_PageLayout::getTemplatePath(SC_Display_Ex::detectDevice()) . 'mypage/navi.tpl'; $this->tpl_mypageno = 'refusal'; $this->point_disp = false; }
/** * Page を初期化する. * * @return void */ function init() { parent::init(); $this->tpl_title = t('c_MY page_01'); if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) { $this->tpl_title .= t('c_/Withdrawal procedure (completion page)_01'); } else { $this->tpl_subtitle = t('c_Withdrawal procedure (completion page)_01'); } $this->tpl_navi = SC_Helper_PageLayout::getTemplatePath(SC_Display_Ex::detectDevice()) . 'mypage/navi.tpl'; $this->tpl_mypageno = 'refusal'; $this->point_disp = false; }
public function getPageProperties($device_type_id = DEVICE_TYPE_PC, $page_id = null, $where = '', $arrParams = array()) { if (ADMIN_MODE) { // 管理モードの場合は通常表示 } else { // 管理モードの場合は不要な項目を非表示 if (is_null($where) || strlen($where) == 0) { $where = "status = 1"; } else { $where = "status = 1 AND {$where}"; } } return SC_Helper_PageLayout::getPageProperties($device_type_id, $page_id, $where, $arrParams); }
/** * 削除を実行する. * * @param SC_FormParam $objFormParam SC_FormParam インスタンス * @param SC_Helper_PageLayout $objLayout SC_Helper_PageLayout インスタンス * @return boolean 登録が成功した場合 true; 失敗した場合 false */ function doDelete(&$objFormParam, &$objLayout) { $arrParams = $objFormParam->getHashArray(); $objQuery =& SC_Query_Ex::getSingletonInstance(); $objQuery->begin(); $arrExists = $objLayout->getBlocs($arrParams['device_type_id'], 'bloc_id = ? AND deletable_flg = 1', array($arrParams['bloc_id'])); $is_error = false; if (!SC_Utils_Ex::isBlank($arrExists)) { $objQuery->delete('dtb_bloc', 'bloc_id = ? AND device_type_id = ?', array($arrExists[0]['bloc_id'], $arrExists[0]['device_type_id'])); $objQuery->delete('dtb_blocposition', 'bloc_id = ? AND device_type_id = ?', array($arrExists[0]['bloc_id'], $arrExists[0]['device_type_id'])); $bloc_dir = $objLayout->getTemplatePath($arrParams['device_type_id']) . BLOC_DIR; $exists_file = $bloc_dir . $arrExists[0]['filename'] . '.tpl'; // ファイルの削除 if (file_exists($exists_file)) { if (!unlink($exists_file)) { $is_error = true; } } } else { $is_error = true; } if ($is_error) { $this->arrErr['err'] = '※ ブロックの削除に失敗しました<br />'; $objQuery->rollback(); return false; } $objQuery->commit(); return true; }
/** * プレビューするデータを DB に保存する. * * @param integer $page_id プレビューを行うページID * @param SC_Helper_PageLayout $objLayout SC_Helper_PageLayout インスタンス * @return string プレビューを行う tpl_mainpage ファイル名 */ function savePreviewData($page_id, &$objLayout) { $arrPageData = $objLayout->getPageProperties(DEVICE_TYPE_PC, $page_id); $objQuery =& SC_Query_Ex::getSingletonInstance(); $arrPageData[0]['page_id'] = 0; $objQuery->update('dtb_pagelayout', $arrPageData[0], 'page_id = 0 AND device_type_id = ?', array(DEVICE_TYPE_PC)); return $arrPageData[0]['filename']; }
/** * 入力内容をデータベースに登録する. * * @param array $arrParams フォームパラメーターの配列 * @param SC_Helper_PageLayout $objLayout SC_Helper_PageLayout インスタンス * @return integer ページID */ function registerPage($arrParams, &$objLayout) { $objQuery =& SC_Query_Ex::getSingletonInstance(); // ページIDが空の場合は新規登録 $is_new = SC_Utils_Ex::isBlank($arrParams['page_id']); // 既存ページの存在チェック if (!$is_new) { $arrExists = $objLayout->getPageProperties($arrParams['device_type_id'], $arrParams['page_id']); } $table = 'dtb_pagelayout'; $arrValues = $objQuery->extractOnlyColsOf($table, $arrParams); $arrValues['update_url'] = $_SERVER['HTTP_REFERER']; $arrValues['update_date'] = 'CURRENT_TIMESTAMP'; // 新規登録 if ($is_new || SC_Utils_Ex::isBlank($arrExists)) { $objQuery->setOrder(''); $arrValues['page_id'] = 1 + $objQuery->max('page_id', $table, 'device_type_id = ?', array($arrValues['device_type_id'])); $arrValues['create_date'] = 'CURRENT_TIMESTAMP'; $objQuery->insert($table, $arrValues); } else { // 編集不可ページは更新しない if (!$objLayout->isEditablePage($arrValues['device_type_id'], $arrValues['page_id'])) { unset($arrValues['page_name']); unset($arrValues['filename']); unset($arrValues['url']); } $objQuery->update($table, $arrValues, 'page_id = ? AND device_type_id = ?', array($arrValues['page_id'], $arrValues['device_type_id'])); } return $arrValues['page_id']; }
/** * 登録を実行する. * * ファイルの作成に失敗した場合は, エラーメッセージを出力し, * データベースをロールバックする. * * @param SC_FormParam $objFormParam SC_FormParam インスタンス * @param SC_Helper_PageLayout $objLayout SC_Helper_PageLayout インスタンス * @return integer|boolean 登録が成功した場合, 登録したブロックID; * 失敗した場合 false */ function doRegister(&$objFormParam, &$objLayout) { $arrParams = $objFormParam->getHashArray(); $objQuery =& SC_Query_Ex::getSingletonInstance(); $objQuery->begin(); // blod_id が空の場合は新規登録 $is_new = SC_Utils_Ex::isBlank($arrParams['bloc_id']); $bloc_dir = $objLayout->getTemplatePath($arrParams['device_type_id']) . BLOC_DIR; // 既存データの重複チェック if (!$is_new) { $arrExists = $objLayout->getBlocs($arrParams['device_type_id'], 'bloc_id = ?', array($arrParams['bloc_id'])); // 既存のファイルが存在する場合は削除しておく $exists_file = $bloc_dir . $arrExists[0]['filename'] . '.tpl'; if (file_exists($exists_file)) { unlink($exists_file); } } $table = 'dtb_bloc'; $arrValues = $objQuery->extractOnlyColsOf($table, $arrParams); $arrValues['tpl_path'] = $arrParams['filename'] . '.tpl'; $arrValues['update_date'] = 'CURRENT_TIMESTAMP'; $objBlob = new SC_Helper_Blob_Ex(); $containerName = $objBlob->getTemplateContainerName($arrParams['device_type_id']); // 新規登録 if ($is_new || SC_Utils_Ex::isBlank($arrExists)) { $objQuery->setOrder(''); $arrValues['bloc_id'] = 1 + $objQuery->max('bloc_id', $table, 'device_type_id = ?', array($arrValues['device_type_id'])); $arrValues['create_date'] = 'CURRENT_TIMESTAMP'; $objQuery->insert($table, $arrValues); } else { $objQuery->update($table, $arrValues, 'bloc_id = ? AND device_type_id = ?', array($arrValues['bloc_id'], $arrValues['device_type_id'])); } $bloc_path = $bloc_dir . $arrValues['tpl_path']; if (!$objBlob->putBlobData($containerName, BLOC_DIR . $arrValues['tpl_path'], $arrParams['bloc_html'])) { $this->arrErr['err'] = '※ ブロックの書き込みに失敗しました<br />'; $objQuery->rollback(); return false; } $objQuery->commit(); return $arrValues['bloc_id']; }