/** * 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; }
/** * ページデータを取得する. * * @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]; }
/** * 削除を実行する. * * @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; }
/** * ページデータを取得する. * * @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); $templatePath = $objLayout->getTemplatePath($device_type_id); $filename = $templatePath . $arrPageData[0]['filename'] . '.tpl'; if (file_exists($filename)) { $arrPageData[0]['tpl_data'] = file_get_contents($filename); } // ファイル名を画面表示用に加工しておく $arrPageData[0]['filename'] = preg_replace('|^' . preg_quote(USER_DIR) . '|', '', $arrPageData[0]['filename']); return $arrPageData[0]; }
/** * 登録を実行する. * * ファイルの作成に失敗した場合は, エラーメッセージを出力し, * データベースをロールバックする. * * @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']; }