function execute()
 {
     $context = $this->getContext();
     $controller = $context->getController();
     $request = $context->getRequest();
     $user = $context->getUser();
     $acs_user_info_row = $user->getAttribute('acs_user_info_row');
     $form = $form = $request->ACSGetParameters();
     // 対象となるコミュニティIDを取得
     $community_id = $request->ACSgetParameter('community_id');
     // コミュニティ情報
     $community_row = ACSCommunity::get_community_profile_row($community_id);
     // 承認が必要か
     $is_admission_required = ACSCommunity::is_admission_required_for_join_community($acs_user_info_row['user_community_id'], $community_id);
     // forward
     $done_obj = new ACSDone();
     $done_obj->set_message(ACSMsg::get_msg('Community', 'JoinCommunityAction.class.php', 'M003'));
     $done_obj->add_link($community_row['community_name'] . ' ' . ACSMsg::get_msg('Community', 'JoinCommunityAction.class.php', 'M004'), $this->getControllerPath('Community', DEFAULT_ACTION) . '&community_id=' . $community_row['community_id']);
     if ($is_admission_required) {
         // コミュニティ参加承認待ち登録
         $waiting_id = ACSWaiting::set_waiting_for_join_community($community_id, $acs_user_info_row['user_community_id'], $form['message']);
         // 参加承認依頼通知メール
         ACSWaiting::send_admission_request_notify_mail($waiting_id);
         $done_obj->set_title(ACSMsg::get_msg('Community', 'JoinCommunityAction.class.php', 'M001'));
     } else {
         // コミュニティメンバ登録
         $community_member_form = array();
         $community_member_form['community_id'] = $community_id;
         $community_member_form['user_community_id'] = $acs_user_info_row['user_community_id'];
         ACSCommunity::set_community_member($community_member_form);
         $done_obj->set_title(ACSMsg::get_msg('Community', 'JoinCommunityAction.class.php', 'M002'));
     }
     $request->setAttribute('done_obj', $done_obj);
     $controller->forward('Common', 'Done');
 }
 function execute()
 {
     $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');
     $form = $form = $request->ACSGetParameters();
     // 対象となるコミュニティIDを取得
     $community_id = $request->ACSgetParameter('community_id');
     // コミュニティ情報
     $community_row = ACSCommunity::get_community_profile_row($community_id);
     ACSDB::_do_query("BEGIN");
     // 生成されたwaiting_idの配列
     $waiting_id_array = array();
     foreach ($form['user_community_id_array'] as $invited_user_community_id) {
         // コミュニティ招待承認待ち登録
         $waiting_id = ACSWaiting::set_waiting_for_invite_to_community($invited_user_community_id, $community_id, $acs_user_info_row['user_community_id'], $form['message']);
         if (!$waiting_id) {
             ACSDB::_do_query("ROLLBACK");
             break;
         }
         // 生成されたwaiting情報を保持
         array_push($waiting_id_array, $waiting_id);
     }
     if ($waiting_id) {
         ACSDB::_do_query("COMMIT");
     }
     // 生成されたwaiting情報を元に複数メール送信
     foreach ($waiting_id_array as $waiting_id) {
         // コミュニティ招待承認依頼通知メール
         ACSWaiting::send_admission_request_notify_mail($waiting_id);
     }
     // forward
     $done_obj = new ACSDone();
     $done_obj->set_title(ACSMsg::get_msg('Community', 'InviteToCommunityAction.class.php', 'M001'));
     $done_obj->set_message(ACSMsg::get_msg('Community', 'InviteToCommunityAction.class.php', 'M002'));
     $done_obj->add_link(ACSMsg::get_tag_replace(ACSMsg::get_msg('Community', 'InviteToCommunityAction.class.php', 'BACK_TO_CM'), array("{COMMUNITY_NAME}" => $community_row['community_name'])), $this->getControllerPath('Community', DEFAULT_ACTION) . '&community_id=' . $community_row['community_id']);
     $request->setAttribute('done_obj', $done_obj);
     $controller->forward('Common', 'Done');
 }
Exemplo n.º 3
0
 function execute()
 {
     $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->getParameter('id');
     $form = $request->ACSGetParameters();
     // マイフレンズ追加 承認待ち を登録する
     $waiting_id = ACSWaiting::set_waiting_for_add_friends($user_community_id, $acs_user_info_row['user_community_id'], $form['message']);
     // マイフレンズ追加 承認依頼通知メール
     ACSWaiting::send_admission_request_notify_mail($waiting_id);
     // forward
     $done_obj = new ACSDone();
     $done_obj->set_title(ACSMsg::get_msg('User', 'AddFriendsAction.class.php', 'M001'));
     $done_obj->set_message(ACSMsg::get_msg('User', 'AddFriendsAction.class.php', 'M002'));
     $done_obj->add_link(ACSMsg::get_msg('User', 'AddFriendsAction.class.php', 'M003'), './');
     $request->setAttribute('done_obj', $done_obj);
     $controller->forward('Common', 'Done');
 }
 function execute()
 {
     $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');
     // 対象となるコミュニティIDを取得
     $community_id = $request->ACSgetParameter('community_id');
     $form = $request->ACSGetParameters();
     // コミュニティ情報
     $community_row = ACSCommunity::get_community_profile_row($community_id);
     // forward
     $done_obj = new ACSDone();
     ACSDB::_do_query("BEGIN");
     // 生成されたwaiting_idの配列
     $waiting_id_array = array();
     $ret = 1;
     // 1:成功 / 0:失敗
     foreach ($form['trusted_community_id_array'] as $link_community_id) {
         if (ACSCommunity::is_community_admin($acs_user_info_row['user_community_id'], $link_community_id)) {
             // リンク依頼先コミュニティの管理者である場合は承認待ち登録せずに、即座にリンクを追加する
             if ($form['link_type'] == 'parent') {
                 $ret = ACSCommunity::set_community_link($link_community_id, $community_id);
             } elseif ($form['link_type'] == 'sub') {
                 $ret = ACSCommunity::set_community_link($community_id, $link_community_id);
             }
         } else {
             if ($form['link_type'] == 'parent') {
                 // 親コミュニティ追加承認待ち登録
                 $waiting_id = ACSWaiting::set_waiting_for_parent_community_link($link_community_id, $community_id, $acs_user_info_row['user_community_id'], $form['message']);
             } elseif ($form['link_type'] == 'sub') {
                 // サブコミュニティ追加承認待ち登録
                 $waiting_id = ACSWaiting::set_waiting_for_sub_community_link($link_community_id, $community_id, $acs_user_info_row['user_community_id'], $form['message']);
             }
             if ($waiting_id) {
                 // 生成されたwaiting情報を保持
                 array_push($waiting_id_array, $waiting_id);
             } else {
                 $ret = 0;
             }
         }
         if (!$ret) {
             ACSDB::_do_query("ROLLBACK");
             break;
         }
     }
     if ($ret) {
         // COMMIT
         ACSDB::_do_query("COMMIT");
         // 生成されたwaiting情報を元に複数メール送信
         foreach ($waiting_id_array as $waiting_id) {
             // コミュニティ間リンク追加依頼通知メール
             ACSWaiting::send_admission_request_notify_mail($waiting_id);
         }
         $done_obj->set_title(ACSMsg::get_msg('Community', 'AddCommunityLinkAction.class.php', 'M001'));
         $done_obj->set_message(ACSMsg::get_msg('Community', 'AddCommunityLinkAction.class.php', 'M002'));
         $done_obj->add_link(ACSMsg::get_msg('Community', 'AddCommunityLinkAction.class.php', 'M003'), $this->getControllerPath('Community', 'CommunityLink') . '&community_id=' . $community_row['community_id']);
         $done_obj->add_link($community_row['community_name'] . ' ' . ACSMsg::get_msg('Community', 'AddCommunityLinkAction.class.php', 'M004'), $this->getControllerPath('Community', DEFAULT_ACTION) . '&community_id=' . $community_row['community_id']);
     } else {
         $done_obj->set_message('失敗しました。');
     }
     $request->setAttribute('done_obj', $done_obj);
     $controller->forward('Common', 'Done');
 }