function getDefaultView() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); $acs_user_info_row = $user->getAttribute('acs_user_info_row'); // 表示対象となるユーザコミュニティIDを取得 $user_community_id = $request->ACSgetParameter('id'); // 他ユーザのデータが見えないようチェック if (!$this->get_execute_privilege() && $acs_user_info_row["user_community_id"] != $user_community_id) { // このページへアクセスすることはできません。 $controller->forward(SECURE_MODULE, SECURE_ACTION); return; } // ユーザ情報 $target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($user_community_id); //送信済画面の処理 $move_id = $request->getParameter('move_id'); if ($move_id == 2) { // 全ての送信済メッセージ $message_row_array = ACSMessage::get_send_message_row_array($user_community_id); } else { // 全ての受信メッセージ $message_row_array = ACSMessage::get_receive_message_row_array($user_community_id); } // set $request->setAttribute('target_user_info_row', $target_user_info_row); $request->setAttribute('message_row_array', $message_row_array); $request->setAttribute('move_id', $move_id); return View::INPUT; }
function execute() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); //mode 画面の遷移を取得する $move_id = $request->getParameter('move_id'); // ユーザー情報 $acs_user_info_row = $user->getAttribute('acs_user_info_row'); // 対象となるUserIDを取得 $user_community_id = $request->getParameter('id'); // ユーザ情報 $target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($user_community_id); /* 入力画面より */ if ($move_id == 1) { //☆☆ ここからほぼ同じ // 画面上のフォーム情報を取得する $form['subject'] = $request->getParameter('subject'); //件名:subject $form['body'] = $request->getParameter('body'); //内容:body $form['info_mail'] = $request->getParameter('info_mail'); //メール通知:info_mail $user->setAttribute('new_form_obj', $form); $request->setAttribute('target_user_info_row', $target_user_info_row); //☆☆ ここまでほぼ同じ return View::SUCCESS; /* 登録確定ボタン「はい」より */ } else { if ($move_id == 2) { $acs_user_info_row = $user->getAttribute('acs_user_info_row'); $user_community_id = $request->getParameter('id'); //☆☆ ここからほぼ同じ // 画面上のフォーム情報を取得する $form = $user->getAttribute('new_form_obj'); $new_file_obj = $form['file_obj']; $form['user_community_id'] = $user_community_id; $form['acs_user_info_id'] = $acs_user_info_row['user_community_id']; //☆☆ ここまでほぼ同じ // DBへの書き込み等 ACSDB::_do_query("BEGIN"); // Messageテーブル情報 $ret = ACSMessage::set_message($form); if ($ret) { ACSDB::_do_query("COMMIT"); } else { ACSDB::_do_query("ROLLBACK"); } // 通知メール送信処理 if ($form['info_mail'] == "on") { ACSMessage::send_info_mail($ret, $form['user_community_id'], $form['acs_user_info_id']); } // 書き込み後、GETの処理へ $action_url = $this->getControllerPath('User', 'MessageBox') . '&id=' . $acs_user_info_row['user_community_id'] . '&move_id=2'; header("Location: {$action_url}"); } } }
function getDefaultView() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); $acs_user_info_row = $user->getAttribute('acs_user_info_row'); // 対象のmessage_idを取得 $message_id = $request->ACSgetParameter('message_id'); // ユーザ情報 $user_community_id = $request->ACSgetParameter('id'); $target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($user_community_id); // 他ユーザのデータが見えないようチェック if ($this->get_execute_privilege() == 2 && $acs_user_info_row["user_community_id"] != $user_community_id) { // ログイン画面に遷移 $controller->forward("User", "Login"); return; } if ($this->get_execute_privilege() == 1 && $acs_user_info_row["user_community_id"] != $user_community_id) { // このページへアクセスすることはできません。 $controller->forward(SECURE_MODULE, SECURE_ACTION); return; } //送信済画面の処理 $move_id = $request->getParameter('move_id'); if ($move_id == 2) { // 送信済メッセージ詳細 $message_row = ACSMessage::get_send_message_row($message_id); } else { // 受信メッセージ詳細 $message_row = ACSMessage::get_receive_message_row($message_id); // 未読・既読判定 if ($message_row['read_flag'] == "f") { // 未読時、DBのフラグ変更 $message_receiver_id = $message_row['message_receiver_id']; ACSDB::_do_query("BEGIN"); // message_receiverテーブル情報変更 $ret = ACSMessage::read_message($message_receiver_id); if ($ret) { ACSDB::_do_query("COMMIT"); } else { ACSDB::_do_query("ROLLBACK"); } } } // set $request->setAttribute('target_user_info_row', $target_user_info_row); $request->setAttribute('message_row', $message_row); $request->setAttribute('move_id', $move_id); return View::INPUT; }
function get_execute_privilege() { $context = $this->getContext(); $request = $context->getRequest(); $user = $context->getUser(); // 非ログインユーザはNG if ($user->hasCredential('PUBLIC_USER')) { return false; } // ユーザ情報を取得 $acs_user_info_row = $user->getAttribute('acs_user_info_row'); if ($request->getParameter('move_id') == 4) { $message_id = $request->getParameter('message_id'); // 他ユーザの受信メッセージが見えないようチェック if (!ACSMessage::check_message_receiver($message_id, $acs_user_info_row["user_community_id"])) { return false; } } // 本人の場合はOK return true; }
function execute() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); $acs_user_info_row = $user->getAttribute('acs_user_info_row'); // get $target_user_info_row = $request->getAttribute('target_user_info_row'); //他人のトップページURL $link_page_url['else_user_Message_url'] = $this->getControllerPath(DEFAULT_MODULE, 'Index') . '&id=' . $target_user_info_row['community_id']; //確認画面ボタンで確認画面を表示 $action_url = $this->getControllerPath('User', 'MessagePre') . '&id=' . $target_user_info_row['user_community_id'] . "&move_id=1"; // set $this->setAttribute('target_user_info_row', $target_user_info_row); $this->setAttribute('acs_user_info_row', $acs_user_info_row); $this->setAttribute('action_url', $action_url); $this->setAttribute('link_page_url', $link_page_url); // テンプレート $this->setScreenId("0001"); $this->setTemplate('Message.tpl.php'); // 確認画面からキャンセルボタンで戻ってきたときのみの処理 if ($request->getParameter('move_id') == 3) { //ユーザ入力情報 $form = $user->getAttribute('new_form_obj'); $this->setAttribute('form', $form); $this->setAttribute('move_id', $request->getParameter('move_id')); } // メッセージ返信ボタン押下時の処理 if ($request->getParameter('move_id') == 4) { $message_id = $request->getParameter('message_id'); //引用メッセージ取得 $message_row = ACSMessage::get_message_row($message_id); $form['subject'] = $message_row['subject']; $form['body'] = $message_row['body']; $this->setAttribute('form', $form); $this->setAttribute('move_id', $request->getParameter('move_id')); } return parent::execute(); }
function execute() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); // 必須チェック // Validator でできないチェックはここで行う if (!$request->getParameter('selected_message')) { // エラーの場合、処理終了 return $this->setError($controller, $request, $user, 'selected_message', ACSMsg::get_msg('User', 'DeleteMessageAction.class.php', 'M001')); } $acs_user_info_row = $user->getAttribute('acs_user_info_row'); // 対象となるユーザコミュニティIDを取得 $target_user_community_id = $request->getParameter('id'); // 対象となるメッセージIDを取得 $target_message_id = $request->getParameter('selected_message'); // 表示するページの所有者情報取得 $target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($target_user_community_id); // set $request->setAttribute('target_user_info_row', $target_user_info_row); $request->setAttribute('target_message_id', $target_message_id); $request->setAttribute('move_id', $request->getParameter('move_id')); /* ------------ */ /* 確認画面表示 */ /* ------------ */ if ($request->getParameter('action_type') == 'confirm') { return View::SUCCESS; } elseif ($request->getParameter('action_type') == 'delete') { $move_id = $request->getParameter('move_id'); ACSDB::_do_query("BEGIN"); // フォルダ $folder_row_array = array(); $delete_message_id_array = $request->getParameter('selected_message'); if ($delete_message_id_array) { if ($move_id == 2) { foreach ($delete_message_id_array as $message_id) { // 削除処理 $ret = ACSMessage::delete_send_message($message_id); if (!$ret) { ACSDB::_do_query("ROLLBACK;"); print "ERROR: Delete message failed."; exit; } } } else { foreach ($delete_message_id_array as $message_id) { // 削除処理 $ret = ACSMessage::delete_receive_message($message_id); if (!$ret) { ACSDB::_do_query("ROLLBACK;"); print "ERROR: Delete message failed."; exit; } } } } ACSDB::_do_query("COMMIT;"); // フォルダ表示アクション呼び出し $message_action = $this->getControllerPath('User', 'MessageBox'); $message_action .= '&id=' . $target_user_community_id; if ($move_id == 2) { $message_action .= '&move_id=2'; } header("Location: {$message_action}"); } }
function execute() { $context =& $this->getContext(); $user = $context->getUser(); $request = $context->getRequest(); $acs_user_info_row = $user->getAttribute('acs_user_info_row'); // 表示対象となるユーザコミュニティIDを取得 $user_community_id = $request->ACSgetParameter('id'); if (empty($user_community_id)) { $user_community_id = $acs_user_info_row['user_community_id']; } // 表示対象のユーザが存在しない場合は、エラーを表示 if (!ACSUser::get_user_info_row_by_user_community_id($user_community_id)) { // 未ログインの時はPublic/Indexに遷移 header("Location: ./index.php?module=Public&action=Index"); // return View::ERROR; } // 自身のページか if ($acs_user_info_row['user_community_id'] == $user_community_id) { $is_self_page = 1; } else { $is_self_page = 0; } // プロフィール $target_user_info_row = ACSUser::get_user_profile_row($user_community_id); // マイフレンズ $friends_row_array = ACSUser::get_simple_friends_row_array($user_community_id); // マイコミュニティ $community_row_array = ACSUser::get_community_row_array($user_community_id); // 最終ログイン // ログイン済みの場合 if ($acs_user_info_row['is_login_user']) { $last_login_row = ACSCommunity::get_contents_row($user_community_id, ACSMsg::get_mst('contents_type_master', 'D52')); } // マイページデザインを取得する $selection_css_row = ACSCommunity::get_contents_row($user_community_id, ACSMsg::get_mst('contents_type_master', 'D53')); $selection_css = $selection_css_row['contents_value'] == '' ? ACS_DEFAULT_SELECTION_CSS_FILE : $selection_css_row['contents_value']; $waiting_for_join_community_row_array_array = array(); $waiting_for_parent_community_link_row_array_array = array(); $waiting_for_sub_community_link_row_array_array = array(); foreach ($community_row_array as $index => $community_row) { $community_row_array[$index]['contents_row_array']['self'] = ACSCommunity::get_contents_row($community_row['community_id'], ACSMsg::get_mst('contents_type_master', 'D00')); $community_row_array[$index]['is_community_admin'] = ACSCommunity::is_community_admin($acs_user_info_row['user_community_id'], $community_row['community_id']); $community_row_array[$index]['is_community_member'] = ACSCommunity::is_community_member($acs_user_info_row['user_community_id'], $community_row['community_id']); if ($is_self_page) { // 待機: コミュニティ参加 承認待ち (自分のマイコミュニティ) if ($community_row['is_community_admin'] && ($waiting_row_array = ACSWaiting::get_waiting_row_array($community_row['community_id'], ACSMsg::get_mst('waiting_type_master', 'D20'), ACSMsg::get_mst('waiting_status_master', 'D10')))) { $waiting_for_join_community_row_array['waiting_row_array'] = $waiting_row_array; $waiting_for_join_community_row_array['community_row'] = $community_row; array_push($waiting_for_join_community_row_array_array, $waiting_for_join_community_row_array); } // 待機: 親コミュニティ追加 承認待ち if ($community_row['is_community_admin'] && ($waiting_row_array = ACSWaiting::get_waiting_row_array($community_row['community_id'], ACSMsg::get_mst('waiting_type_master', 'D40'), ACSMsg::get_mst('waiting_status_master', 'D10')))) { $waiting_for_parent_community_link_row_array['waiting_row_array'] = $waiting_row_array; $waiting_for_parent_community_link_row_array['community_row'] = $community_row; array_push($waiting_for_parent_community_link_row_array_array, $waiting_for_parent_community_link_row_array); } // 待機: サブコミュニティ追加 承認待ち if ($community_row['is_community_admin'] && ($waiting_row_array = ACSWaiting::get_waiting_row_array($community_row['community_id'], ACSMsg::get_mst('waiting_type_master', 'D50'), ACSMsg::get_mst('waiting_status_master', 'D10')))) { $waiting_for_sub_community_link_row_array['waiting_row_array'] = $waiting_row_array; $waiting_for_sub_community_link_row_array['community_row'] = $community_row; array_push($waiting_for_sub_community_link_row_array_array, $waiting_for_sub_community_link_row_array); } } } if ($is_self_page) { // 待機: マイフレンズ追加 承認待ち $waiting_for_add_friends_row_array = ACSWaiting::get_waiting_row_array($user_community_id, ACSMsg::get_mst('waiting_type_master', 'D10'), ACSMsg::get_mst('waiting_status_master', 'D10')); // 待機: コミュニティ招待 承認待ち $waiting_for_invite_to_community_row_array = ACSWaiting::get_waiting_row_array($user_community_id, ACSMsg::get_mst('waiting_type_master', 'D30'), ACSMsg::get_mst('waiting_status_master', 'D10')); // マイダイアリーの新着コメント $new_comment_diary_row_array = ACSDiary::get_new_comment_diary_row_array($user_community_id); // 新着メッセージ $new_message_row_array = ACSMessage::get_new_message_row_array($user_community_id); // システムからのお知らせ $system_announce_row_array = ACSSystemAnnounce::get_valid_system_announce_row_array(); } // set $request->setAttribute('user_community_id', $user_community_id); $request->setAttribute('target_user_info_row', $target_user_info_row); $request->setAttribute('is_self_page', $is_self_page); $request->setAttribute('friends_row_array', $friends_row_array); $request->setAttribute('community_row_array', $community_row_array); $request->setAttribute('waiting_for_add_friends_row_array', $waiting_for_add_friends_row_array); $request->setAttribute('waiting_for_join_community_row_array_array', $waiting_for_join_community_row_array_array); $request->setAttribute('waiting_for_parent_community_link_row_array_array', $waiting_for_parent_community_link_row_array_array); $request->setAttribute('waiting_for_sub_community_link_row_array_array', $waiting_for_sub_community_link_row_array_array); $request->setAttribute('waiting_for_invite_to_community_row_array', $waiting_for_invite_to_community_row_array); $request->setAttribute('new_comment_diary_row_array', $new_comment_diary_row_array); $request->setAttribute('system_announce_row_array', $system_announce_row_array); $request->setAttribute('last_login', $last_login_row['contents_value']); $request->setAttribute('selection_css', $selection_css); $request->setAttribute('new_message_row_array', $new_message_row_array); return View::SUCCESS; }