/** * 初期画面 * GETメソッドの場合、呼ばれる */ function getDefaultView() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); $target_community_id = $request->getParameter('community_id'); $target_schedule_id = $request->getParameter('schedule_id'); if (!$this->get_execute_privilege()) { // 2010.03.24 未ログイン時の誘導 // ログインユーザでない場合はログイン画面へ if ($user->hasCredential('PUBLIC_USER')) { $controller->forward("User", "Login"); return; } $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_row = ACSCommunity::get_community_row($target_community_id); $request->setAttributeByRef('target_community_row', $target_community_row); // スケジュール情報の取得 $schedule =& ACSSchedule::get_schedule_instance($target_community_id, $target_schedule_id); $request->setAttributeByRef('schedule', $schedule); // スケジュール情報をセッションにキャッシュ $user->setAttribute('schedule', serialize($schedule)); // ログインユーザの参加情報の取得 if ($request->getAttribute('schedule_participant')) { $schedule_participant =& $request->getAttribute('schedule_participant'); } else { $schedule_participant =& ACSScheduleParticipant::get_schedule_participant_instance($schedule->schedule_id, $acs_user_info_row['user_community_id']); $request->setAttributeByRef('schedule_participant', $schedule_participant); } // ログインユーザの参加情報をセッションにキャッシュ $user->setAttribute('org_participant', serialize($schedule_participant)); // スケジュール参加者全員の情報を取得 $schedule_participant_list =& ACSScheduleParticipant::get_schedule_participant_instance_list($schedule->schedule_id, $schedule->is_target_all()); $request->setAttributeByRef('schedule_participant_list', $schedule_participant_list); return View::SUCCESS; }
/** * 登録実行処理 * POSTメソッドの場合、呼ばれる */ function execute() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); $params =& $request->getParameters(); // ログインユーザ情報の設定 $acs_user_info_row =& $user->getAttribute('acs_user_info_row'); $request->setAttributeByRef('acs_user_info_row', $acs_user_info_row); // 幹事でないスケジュールや決定済の場合セキュリティエラー // 最新スケジュール情報を取得して可否を確認 $schedule =& ACSSchedule::get_schedule_instance($params['community_id'], $params['schedule_id']); if ($schedule->is_fixed() || !$schedule->is_organizer($acs_user_info_row)) { // このページへアクセスすることはできません。 $controller->forward(SECURE_MODULE, SECURE_ACTION); return; } // 候補日時選択画面からのPOSTの場合 if ($params['post_from_answer'] == 't') { $request->setAttributeByRef('schedule', $schedule); $return_view = $this->getMailInputView($controller, $request, $user); // メール入力画面からのPOSTの場合 } else { // DB更新 $schedule->update_decide_schedule($params['mailentry_adjustment_id']); // システムのメールアドレスを取得 $system_mail_addr = ACSSystemConfig::get_keyword_value(ACSMsg::get_mst('system_config_group', 'D01'), 'SYSTEM_MAIL_ADDR'); // メール送信相手の設定 // 自由参加の場合対象となるメンバの取得 $target_mmb = ""; if ($schedule->is_target_all() === FALSE) { $p_array =& ACSScheduleParticipant::get_schedule_participant_instance_list($schedule->schedule_id, FALSE); foreach ($p_array as $user_community_id => $schedule_participant) { $target_mmb[] = $user_community_id; } $p_array = ""; } // メールの送信 ACSCommunityMail::send_community_mail($schedule->community_id, $system_mail_addr, $params['mail_subject'], $params['mail_message'], $target_mmb); // リダイレクト(リロード対策) $controller->redirect($this->getControllerPath('Community', 'Schedule') . "&community_id=" . $schedule->community_id); } return $return_view; }