/** * ブロックファイルに応じて tpl_mainpage を設定する * * @param string $bloc_file ブロックファイル名 * @return void */ public function setTplMainpage($bloc_file) { if (SC_Utils_Ex::isAbsoluteRealPath($bloc_file)) { $this->tpl_mainpage = $bloc_file; } else { $this->tpl_mainpage = SC_Helper_PageLayout_Ex::getTemplatePath($this->objDisplay->detectDevice()) . BLOC_DIR . $bloc_file; } $this->setTemplate($this->tpl_mainpage); }
/** * ブロックファイルに応じて tpl_mainpage を設定する * * @param string $bloc_file ブロックファイル名 * @return void */ function setTplMainpage($bloc_file) { if (SC_Utils_Ex::isAbsoluteRealPath($bloc_file)) { $this->tpl_mainpage = $bloc_file; } else { $this->tpl_mainpage = SC_Helper_PageLayout_Ex::getTemplatePath($this->objDisplay->detectDevice()) . BLOC_DIR . $bloc_file; } $this->setTemplate($this->tpl_mainpage); $debug_message = "block:" . $this->tpl_mainpage . "\n"; GC_Utils_Ex::gfDebugLog($debug_message); }
/** * ブロックのテンプレートを取得する. * * @param integer $device_type_id 端末種別ID * @param integer $bloc_id ブロックID * @param SC_Helper_PageLayout $objLayout SC_Helper_PageLayout インスタンス * @return array ブロック情報の配列 */ function getBlocTemplate($device_type_id, $bloc_id, &$objLayout) { $arrBloc = $objLayout->getBlocs($device_type_id, 'bloc_id = ?', array($bloc_id)); if (SC_Utils_Ex::isAbsoluteRealPath($arrBloc[0]['tpl_path'])) { $tpl_path = $arrBloc[0]['tpl_path']; } else { $tpl_path = SC_Helper_PageLayout_Ex::getTemplatePath($device_type_id) . BLOC_DIR . $arrBloc[0]['tpl_path']; } $objBlob = new SC_Helper_Blob_Ex(); $containerName = $objBlob->getTemplateContainerName($device_type_id); if ($objBlob->blobExists($containerName, $arrBloc[0]['filename'] . ".tpl")) { $arrBloc[0]['bloc_html'] = $objBlob->getBlobData($containerName, BLOC_DIR . $arrBloc[0]['filename'] . ".tpl"); } return $arrBloc[0]; }
/** * Page を初期化する. * * @return void */ function init() { parent::init(); $objPagelayout = new SC_Helper_PageLayout_Ex(); $php_path_dir = HTML_REALDIR; $tpl_path_dir = $objPagelayout->getTemplatePath(SC_Display_Ex::$device) . BLOC_DIR; $this->arrPageLayout["HeadNavi"] = array(); $this->arrPageLayout["HeadNavi"][] = array("bloc_name" => "【全ページ】CSS設定", "tpl_path" => "{$tpl_path_dir}settings_css.tpl", "filename" => "settings_css", "php_path" => false ? $php_path_dir : ""); $this->arrPageLayout["BottomNavi"] = array(); $this->arrPageLayout["BottomNavi"][] = array("bloc_name" => "【全ページ】フッターナビ共通", "tpl_path" => "{$tpl_path_dir}navi_footer_common.tpl", "filename" => "navi_footer_common", "php_path" => false ? $php_path_dir : ""); // $objCustomer = new SC_Customer_Ex(); // 画面更新毎に情報を更新する if ($objCustomer->isLoginSuccess()) { // 初回アクセス時に更新 $objCustomer->updateSession(); $this->tpl_login = true; // ポイントだけは抑止 $this->tpl_point = $_SESSION["customer"]["point"]; $this->tpl_customer_id = $objCustomer->getValue("customer_id"); $this->tpl_first_buy_date = $objCustomer->getValue("first_buy_date"); $this->tpl_carrier = $objCustomer->getValue("carrier"); } }
/** * テンプレートパスをアサインする. * * @param integer $device_type_id 端末種別ID */ function assignTemplatePath($device_type_id) { // テンプレート変数を割り当て $this->assign("TPL_URLPATH", SC_Helper_PageLayout_Ex::getUserDir($device_type_id, true)); // ヘッダとフッタを割り当て $templatePath = SC_Helper_PageLayout_Ex::getTemplatePath($device_type_id); $header_tpl = $templatePath . "header.tpl"; $footer_tpl = $templatePath . "footer.tpl"; $this->assign("header_tpl", $header_tpl); $this->assign("footer_tpl", $footer_tpl); }
/** * CSSディレクトリを取得する. * * @param integer $device_type_id 端末種別ID * @return string CSSディレクトリ */ public function getCSSDir($device_type_id) { return SC_Helper_PageLayout_Ex::getTemplatePath($device_type_id, true) . 'css/'; }
/** * ブロックのテンプレートを取得する. * * @param integer $device_type_id 端末種別ID * @param integer $bloc_id ブロックID * @param SC_Helper_PageLayout $objLayout SC_Helper_PageLayout インスタンス * @return array ブロック情報の配列 */ function getBlocTemplate($device_type_id, $bloc_id, &$objLayout) { $arrBloc = $objLayout->getBlocs($device_type_id, 'bloc_id = ?', array($bloc_id)); if (SC_Utils_Ex::isAbsoluteRealPath($arrBloc[0]['tpl_path'])) { $tpl_path = $arrBloc[0]['tpl_path']; } else { $tpl_path = SC_Helper_PageLayout_Ex::getTemplatePath($device_type_id) . BLOC_DIR . $arrBloc[0]['tpl_path']; } if (file_exists($tpl_path)) { $arrBloc[0]['bloc_html'] = file_get_contents($tpl_path); } return $arrBloc[0]; }
/** * テンプレートパスを取得する. * * @param integer $device_type_id 端末種別ID * @param string $division 'header' or 'footer' * @return string|false 成功した場合, テンプレートのパス; 失敗した場合 false */ public function getTemplatePath($device_type_id, $division) { $tpl_path = SC_Helper_PageLayout_Ex::getTemplatePath($device_type_id) . '/' . $division . '.tpl'; if (file_exists($tpl_path)) { return $tpl_path; } else { return false; } }
/** * ブロックの削除. * * @param integer $bloc_id * @return boolean */ public function delete($bloc_id) { $objQuery =& SC_Query_Ex::getSingletonInstance(); $objQuery->begin(); $arrExists = $this->getWhere('bloc_id = ? AND deletable_flg = 1', array($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 = SC_Helper_PageLayout_Ex::getTemplatePath($this->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) { $objQuery->rollback(); return false; } $objQuery->commit(); return true; }