/** * 登録実行処理 * POSTメソッドの場合、呼ばれる */ function execute() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); $params =& $request->getParameters(); $redirect_url = $this->getControllerPath('Community', 'Schedule') . "&community_id=" . $params['community_id']; $schedule_participant =& $this->getFormPostParticipant(&$params, unserialize($user->getAttribute('org_participant'))); if (!$this->get_execute_privilege()) { $controller->forward(SECURE_MODULE, SECURE_ACTION); return; } // 登録できないスケジュールの場合スルー // 最新スケジュール情報を取得して可否を確認 $schedule =& ACSSchedule::get_schedule_instance($params['community_id'], $schedule_participant->schedule_id); if ($schedule->is_fixed() || $schedule->is_close()) { $controller->redirect($redirect_url); } // 参加切替の場合再表示 if ($params['participate']) { $request->setAttributeByRef('schedule_participant', $schedule_participant); // DB更新(参加登録のみ) $schedule_participant->update_participant(TRUE); return $this->getDefaultView(); } else { // DB更新 $schedule_participant->update_participant(); } // リダイレクト(リロード対策) $controller->redirect($redirect_url); }
/** * 初期画面 * GETメソッドの場合、呼ばれる */ function getDefaultView() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); if (!$this->get_execute_privilege()) { $controller->forward(SECURE_MODULE, SECURE_ACTION); return; } // ログインユーザ情報の設定 $acs_user_info_row =& $user->getAttribute('acs_user_info_row'); $request->setAttributeByRef('acs_user_info_row', $acs_user_info_row); // コミュニティ情報の取得 $target_community_id = $request->getParameter('community_id'); $target_community_row = ACSCommunity::get_community_row($target_community_id); $request->setAttributeByRef('target_community_row', $target_community_row); // コミュニティ人数の取得 $request->setAttribute('member_count', ACSCommunity::get_community_member_count($target_community_id)); // スケジュールインスタンス配列の取得 $schedule_array =& ACSSchedule::get_community_schedule_instance_list($target_community_id); $request->setAttributeByRef('schedules', $schedule_array); // スケジュール人数情報配列の取得 $schedule_persons_array =& ACSSchedule::get_total_person_count($target_community_id); $request->setAttributeByRef('schedule_persons', $schedule_persons_array); return View::SUCCESS; }
/** * 初期画面 * * GETメソッドの場合、呼ばれる。 * "schedule_id"パラメータが無い場合は新規作成とする。 */ function getDefaultView() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); $params =& $request->getParameters(); if (!$this->get_execute_privilege()) { $controller->forward(SECURE_MODULE, SECURE_ACTION); return; } $target_community_id = $request->getParameter('community_id'); $target_schedule_id = $request->getParameter('schedule_id'); // コミュニティ情報の取得 $target_community_row = ACSCommunity::get_community_row($target_community_id); $request->setAttributeByRef('target_community_row', $target_community_row); $acs_user_info_row =& $user->getAttribute('acs_user_info_row'); // スケジュール情報の取得 if ($target_schedule_id != "") { $schedule =& ACSSchedule::get_schedule_instance($target_community_id, $target_schedule_id); // (不正対策) // 幹事以外の場合 if (!$schedule->is_organizer($acs_user_info_row)) { // このページへアクセスすることはできません。 $controller->forward(SECURE_MODULE, SECURE_ACTION); return; } } else { $schedule =& new ACSSchedule($target_community_id, $acs_user_info_row['user_community_id']); } // (不正対策) // 決定済みのスケジュールであった場合 if ($schedule->is_fixed()) { // このページへアクセスすることはできません。 $controller->forward(SECURE_MODULE, SECURE_ACTION); return; } // 変更前の元データをキャッシュ $user->setAttribute('org_schedule', serialize($schedule)); $request->setAttributeByRef('schedule', $schedule); // 締切日時の設定 $request->setAttribute('closing_datetime_array', $schedule->get_schedule_closing_datetime_array()); // お知らせメールの初期設定 $request->setAttribute('send_annouce_mail_checked', ' CHECKED'); return View::INPUT; }
/** * 入力チェックエラー時の対応 */ function handleError() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); $params =& $request->getParameters(); $schedule =& ACSSchedule::get_schedule_instance($params['community_id'], $params['schedule_id']); $request->setAttributeByRef('schedule', $schedule); return $this->getMailInputView($controller, $request, $user); }
/** * 締切日時指定スケジュール一覧インスタンス生成 * * @param string $datetime_from 範囲開始日時 * @param string $datetime_to 範囲終了日時 * @return array ACSScheduleインスタンスの配列 */ function &get_schedule_instance_list_by_closing_datetime($datetime_from, $datetime_to) { $where = "schedule_closing_datetime >= " . "'" . ACSLib::convert_timestamp_to_pg_date($datetime_from) . "'" . " AND schedule_closing_datetime <= " . "'" . ACSLib::convert_timestamp_to_pg_date($datetime_to) . "'"; return ACSSchedule::get_schedule_instance_list($where); }