function main() { global $isLogined; // チェック済みのパラメータを取得する。 $received = getReceivedParameter(); // 公演詳細画面表示内容 $display = (object) array(); $display->stage_date = isset($received->stage_date) ? $received->stage_date : getSqlNowDate(); //$stageDate = null; if (isset($received->stage_register) && $isLogined) { // 登録ボタン押下 if (!$received->stage_register) { // 入力チェックの結果NG。画面再表示 $display = $received; } else { // 公演を登録する $stageId = registerStage($received); if ($stageId > 0) { header("Location: /stage?stage_id=" . $stageId); return; } else { $display = $received; $display->error_message = "現在、登録ができません。"; // include_once('page-templates/page-stage-input.tpl'); // return; } } } else { if (isset($_GET["stage_id"]) && is_numeric($_GET["stage_id"])) { $display = (object) array(); $display->is_update = true; // 変更画面であることを示す $stageId = $_GET["stage_id"]; // リビジョンを指定する $revision = -1; if (isset($_GET['revision']) && is_numeric($_GET['revision'])) { $revision = intval($_GET['revision']); } // 公演情報取得 $stageInfos = getStageDetail($stageId, $revision); if ($stageInfos != null && count($stageInfos) > 0) { $stageInfo = $stageInfos[0]; $display->stage_id = $stageInfo->stage_id; $display->revision = $stageInfo->revision; // 公演日 $display->stage_date = $stageInfo->stage_date; // チーム $display->stage_team = $stageInfo->team_id; // その日の回数 $display->stage_time = array(0 => $stageInfo->stage_time); // 公演 $display->stage_program = $stageInfo->program_id; // シャッフル? $display->stage_shuffled = $stageInfo->is_shuffled == 1; // 非公式か? $display->stage_unofficial = $stageInfo->is_unofficial == 1; // 出演メンバー $display->memberNameList = array(); if (isset($stageInfo->memberList)) { foreach ($stageInfo->memberList as $member) { $display->memberNameList[] = $member->member_name; } } // 関連リンク $display->linkStringList = array(); if (isset($stageInfo->linkList)) { foreach ($stageInfo->linkList as $link) { $display->linkStringList[] = $link->link; } } // イベント $display->stage_events = array(); if (isset($stageInfo->eventMemberList) && count($stageInfo->eventMemberList) > 0) { $i = 1; foreach ($stageInfo->eventMemberList as $eventMember) { $display->stage_events[] = (object) array('event_id' => $eventMember->event_id, 'member_id' => $eventMember->member_id); } } // コメント // $display->stage_comment = array(); $display->stage_comment = ""; // foreach ($stageInfo->commentList as $comment) { // if ($comment != "") { // $display->stage_comment[] = $comment; // } // } if (count($stageInfo->commentList) > 0) { $display->stage_comment = $stageInfo->commentList[0]->comment; } } else { $display->stage_date = getSqlNowDate(); $display->revision = 0; $display->error_message = "該当する公演が見つかりません。"; } } else { // 入力画面初期表示 // // 日付が指定されていた場合は、その日の編集を行う // if (isset($_GET["stage_date"]) && $_GET["stage_date"] != "") // { // $display = (object) array(); // $display->stage_date = $_GET["stage_date"]; // } // デフォルトで、ダブルチェックが必要である旨のチェックをつけておく $display->stage_unofficial = true; $display->revision = 0; $display->stage_time[] = 1; if (!$isLogined) { $display->error_message = "現在、公演の登録・更新にはログインが必要です。"; } } } // 前後の公演 $display->previousStage = getPreviousStage(!empty($display->stage_id) ? $display->stage_id : 0, $display->stage_date); $display->nextStage = getNextStage(!empty($display->stage_id) ? $display->stage_id : 0, $display->stage_date); // イベントリスト $display->eventInfoList = getEvents(); // メンバーリスト $display->memberInfoList = getMembers($display->stage_date); return $display; }
include_once 'inc/meimei_libs.php'; include_once 'inc/stage_libs.php'; // ログインの確認 if (!is_user_logged_in()) { //header("Location: /message"); include_once "404.php"; exit; } $isUpdate = 1; // 変更画面であることを示す $rows = array(); if (isset($_GET["stage_id"]) && is_numeric($_GET["stage_id"])) { $stageId = $_GET["stage_id"]; // 公演情報取得 $stageInfo = getStageDetail($stageId); if ($stageInfo != null) { // 公演日 $stageDate = $stageInfo[0]->stage_date; // チーム eval("\$teamSelected" . $stageInfo[0]->team_id . " = \" selected\";"); // その日の回数 eval("\$timeSelected" . $stageInfo[0]->stage_time . " = \" selected\";"); // 公演 eval("\$programSelected" . $stageInfo[0]->program_id . " = \" selected\";"); // シャッフル? $shuffledChecked = ""; if ($stageInfo[0]->is_shuffled == 1) { $shuffledChecked = " checked"; } // 出演メンバー