/** * ブロックファイルに応じて tpl_mainpage を設定する * * @param string $bloc_file ブロックファイル名 * @return void */ function setTplMainpage($bloc_file) { $debug_message = ""; $user_bloc_path = USER_TEMPLATE_PATH . TEMPLATE_NAME . "/" . BLOC_DIR . $bloc_file; if (is_file($user_bloc_path)) { $this->tpl_mainpage = $user_bloc_path; } else { $this->tpl_mainpage = BLOC_PATH . $bloc_file; } $debug_message = "block:" . $this->tpl_mainpage . "\n"; GC_Utils::gfDebugLog($debug_message); }
/** * ユーザが作成したファイルをアーカイブしダウンロードさせる * TODO 要リファクタリング * @param void * @return void */ function downloadArchiveFiles($dir) { $debug_message = ""; // ダウンロードされるファイル名 $dlFileName = 'tpl_package_' . date('YmdHis') . '.tar.gz'; // ファイル一覧取得 $arrFileHash = SC_Utils::sfGetFileList($dir); foreach ($arrFileHash as $val) { $arrFileList[] = $val['file_name']; $debug_message .= "圧縮:" . $val['file_name'] . "\n"; } GC_Utils::gfDebugLog($debug_message); // ディレクトリを移動 chdir($dir); // 圧縮をおこなう $tar = new Archive_Tar($dlFileName, true); $tar->create($arrFileList); // ダウンロード用HTTPヘッダ出力 header("Content-disposition: attachment; filename={$dlFileName}"); header("Content-type: application/octet-stream; name={$dlFileName}"); header("Content-Length: " . filesize($dlFileName)); readfile($dlFileName); unlink($dir . "/" . $dlFileName); exit; }
/** * ページのレイアウト情報をセットする. * * LC_Page オブジェクトにページのレイアウト情報をセットする. * * @param LC_Page $objPage ページ情報 * @param boolean $preview プレビュー表示の場合 true * @param string $url ページのURL * @return void */ function sfGetPageLayout(&$objPage, $preview = false, $url = "") { $debug_message = ""; $arrPageLayout = array(); // 現在のURLの取得 if ($preview === false) { if ($url == "") { $url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; } // URLを元にページデザインを取得 $arrPageData = $this->lfgetPageData(" url = ? ", array($url)); } else { $arrPageData = $this->lfgetPageData(" page_id = ? ", array("0")); $objPage->tpl_mainpage = USER_PATH . "templates/preview/" . TEMPLATE_NAME . "/" . $arrPageData[0]['filename'] . ".tpl"; } reset($arrPageData[0]); while (list($key, $val) = each($arrPageData[0])) { $debug_message .= "arrPageData[{$key}]:" . $val . "\n"; } $debug_message .= "TEMPLATE_NAME:" . TEMPLATE_NAME . "\n"; // tpl_mainpageの設定なし、又はトップページの場合 if (!isset($objPage->tpl_mainpage) || $url == "index.php") { // ユーザテンプレートのパスを取得 $user_tpl = HTML_PATH . USER_DIR . USER_PACKAGE_DIR . TEMPLATE_NAME . "/" . $arrPageData[0]['filename'] . ".tpl"; $debug_message .= "ユーザテンプレートチェック:" . $user_tpl . "\n"; // ユーザテンプレートの存在チェック if (is_file($user_tpl)) { $objPage->tpl_mainpage = $user_tpl; $debug_message .= "tpl_mainpage:ユーザーテンプレート\n"; // 存在しない場合は指定テンプレートを使用 } else { $objPage->tpl_mainpage = TEMPLATE_DIR . $arrPageData[0]['filename'] . ".tpl"; $debug_message .= "tpl_mainpage:標準テンプレート\n"; } } else { $debug_message .= "tpl_mainpage:設定あり" . "\n"; } $debug_message .= "tpl_mainpage:" . $objPage->tpl_mainpage . "\n"; // ページタイトルを設定 if (!isset($objPage->tpl_title)) { $objPage->tpl_title = $arrPageData[0]['page_name']; } $arrPageLayout = $arrPageData[0]; // 全ナビデータを取得する $arrNavi = $this->lfGetNaviData($url, $preview); $arrPageLayout['LeftNavi'] = $this->lfGetNavi($arrNavi, 1); // LEFT NAVI $arrPageLayout['MainHead'] = $this->lfGetNavi($arrNavi, 2); // メイン上部 $arrPageLayout['RightNavi'] = $this->lfGetNavi($arrNavi, 3); // RIGHT NAVI $arrPageLayout['MainFoot'] = $this->lfGetNavi($arrNavi, 4); // メイン下部 GC_Utils::gfDebugLog($arrPageLayout); $objPage->arrPageLayout = $arrPageLayout; // カラム数を取得する $objPage->tpl_column_num = $this->lfGetColumnNum($arrPageLayout); GC_Utils::gfDebugLog($debug_message); }
public function lfAddBlankLine($arrResults, $type, $st, $ed) { $arrRet = parent::lfAddBlankLine($arrResults, $type, $st, $ed); $stoc_point = 0; $total_history_sum = 0; switch ($type) { case 'wday': $keys = array(); $keys[] = date("D", strtotime("next mon")); $keys[] = date("D", strtotime("next tue")); $keys[] = date("D", strtotime("next wed")); $keys[] = date("D", strtotime("next thu")); $keys[] = date("D", strtotime("next fri")); $keys[] = date("D", strtotime("next sat")); $keys[] = date("D", strtotime("next sun")); // 曜日は埋めた後に月曜日からソートする $_arrRet = $arrRet; $arrRet = array(); foreach ($keys as $key) { foreach ($_arrRet as $row) { switch ($row["str_date"]) { case $key: $arrRet[] = $row; } } } break; } foreach ($arrRet as $date => &$row) { $stoc_point += intval($row["total"]); $row["total_sum"] = $stoc_point; $total_history_sum += intval($row["total_history"]); $row["total_history_sum"] = $total_history_sum; GC_Utils::gfDebugLog(array($date, $row)); } return $arrRet; }