Ejemplo n.º 1
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を取得
     $form = $request->ACSgetParameters();
     // 待機種別マスタ
     $waiting_type_master_array = ACSDB::get_master_array('waiting_type');
     // 待機状態マスタ
     $waiting_status_master_array = ACSDB::get_master_array('waiting_status');
     // 待機情報
     $waiting_row = ACSWaiting::get_waiting_row($form['waiting_id']);
     // コミュニティ情報
     $community_row = ACSCommunity::get_community_row($waiting_row['community_id']);
     // forward
     $done_obj = new ACSDone();
     if ($form['accept_button']) {
         // 承認ボタン押下時 //
         ACSDB::_do_query("BEGIN");
         if ($waiting_row['waiting_type_name'] == ACSMsg::get_mst('waiting_type_master', 'D20')) {
             // コミュニティメンバ追加
             $community_member_form = array();
             $community_member_form['community_id'] = $waiting_row['community_id'];
             $community_member_form['user_community_id'] = $waiting_row['waiting_community_id'];
             $ret = ACSCommunity::set_community_member($community_member_form);
         } elseif ($waiting_row['waiting_type_name'] == ACSMsg::get_mst('waiting_type_master', 'D40')) {
             // コミュニティ間リンク設定
             $ret = ACSCommunity::set_community_link($waiting_row['community_id'], $waiting_row['waiting_community_id']);
         } elseif ($waiting_row['waiting_type_name'] == ACSMsg::get_mst('waiting_type_master', 'D50')) {
             // コミュニティ間リンク設定
             $ret = ACSCommunity::set_community_link($waiting_row['waiting_community_id'], $waiting_row['community_id']);
         }
         if ($ret) {
             // 承認済みをセット
             $ret = ACSWaiting::update_waiting_waiting_status_code($form['waiting_id'], ACSMsg::get_mst('waiting_status_master', 'D20'), $acs_user_info_row['user_community_id'], $form['reply_message']);
             if ($ret) {
                 ACSDB::_do_query("COMMIT");
                 // 整合性保持
                 if ($waiting_row['waiting_type_name'] == ACSMsg::get_mst('waiting_type_master', 'D20')) {
                     // 参加の重複を解除
                     ACSWaiting::update_waiting_for_join_community($waiting_row['community_id'], $waiting_row['waiting_community_id']);
                     // 招待の重複を解除
                     ACSWaiting::update_waiting_for_invite_to_community($waiting_row['waiting_community_id'], $waiting_row['community_id']);
                 } elseif ($waiting_row['waiting_type_name'] == ACSMsg::get_mst('waiting_type_master', 'D40')) {
                     // 親コミュニティ追加の重複解除
                     ACSWaiting::update_waiting_for_parent_community_link($waiting_row['community_id'], $waiting_row['waiting_community_id']);
                     // サブコミュニティ追加の重複解除
                     ACSWaiting::update_waiting_for_sub_community_link($waiting_row['waiting_community_id'], $waiting_row['community_id']);
                 } elseif ($waiting_row['waiting_type_name'] == ACSMsg::get_mst('waiting_type_master', 'D50')) {
                     // サブコミュニティ追加の重複解除
                     ACSWaiting::update_waiting_for_sub_community_link($waiting_row['community_id'], $waiting_row['waiting_community_id']);
                     // 親コミュニティ追加の重複解除
                     ACSWaiting::update_waiting_for_parent_community_link($waiting_row['waiting_community_id'], $waiting_row['community_id']);
                 }
                 // 返信メッセージ
                 if ($form['reply_message'] != '') {
                     $ret = ACSWaiting::send_admission_accept_notify_mail($form['waiting_id']);
                 }
                 $done_obj->set_title(ACSMsg::get_tag_replace(ACSMsg::get_msg('Community', 'WaitingListAction.class.php', 'FIN_ADM'), array("{WAITING_TYPE_NAME}" => $waiting_row[waiting_type_name])));
                 $done_obj->set_message(ACSMsg::get_msg('Community', 'WaitingListAction.class.php', 'M001'));
             } else {
                 $done_obj->set_message(ACSMsg::get_msg('Community', 'WaitingListAction.class.php', 'M002'));
             }
         } else {
             ACSDB::_do_query("ROLLBACK");
         }
     } elseif ($form['reject_button']) {
         // 拒否ボタン押下時
         $ret = ACSWaiting::update_waiting_waiting_status_code($form['waiting_id'], ACSMsg::get_mst('waiting_status_master', 'D30'), $acs_user_info_row['user_community_id']);
         if ($ret) {
             $done_obj->set_title(ACSMsg::get_tag_replace(ACSMsg::get_msg('Community', 'WaitingListAction.class.php', 'FIN_DIS'), array("{WAITING_TYPE_NAME}" => $waiting_row[waiting_type_name])));
             $done_obj->set_message(ACSMsg::get_msg('Community', 'WaitingListAction.class.php', 'M001'));
         } else {
             $done_obj->set_message(ACSMsg::get_msg('Community', 'WaitingListAction.class.php', 'M002'));
         }
     }
     $done_obj->add_link(ACSMsg::get_tag_replace(ACSMsg::get_msg('Community', 'WaitingListAction.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');
 }
Ejemplo n.º 2
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を取得
     $form = $request->ACSgetParameters();
     // 待機情報
     $waiting_row = ACSWaiting::get_waiting_row($form['waiting_id']);
     // ACSDone
     $done_obj = new ACSDone();
     if ($form['accept_button']) {
         // 承認ボタン押下時 //
         ACSDB::_do_query("BEGIN");
         if ($waiting_row['waiting_type_name'] == ACSMsg::get_mst('waiting_type_master', 'D10')) {
             $ret = ACSUser::set_friends($waiting_row['community_id'], $waiting_row['waiting_community_id']);
         } elseif ($waiting_row['waiting_type_name'] == ACSMsg::get_mst('waiting_type_master', 'D30')) {
             $community_member_form = array('community_id' => $waiting_row['waiting_community_id'], 'user_community_id' => $waiting_row['community_id']);
             $ret = ACSCommunity::set_community_member($community_member_form);
         }
         if ($ret) {
             // 承認済みをセット
             $ret = ACSWaiting::update_waiting_waiting_status_code($form['waiting_id'], ACSMsg::get_mst('waiting_status_master', 'D20'), $acs_user_info_row['user_community_id'], $form['reply_message']);
             if ($ret) {
                 ACSDB::_do_query("COMMIT");
                 // 整合性保持
                 if ($waiting_row['waiting_type_name'] == ACSMsg::get_mst('waiting_type_master', 'D10')) {
                     // マイフレンズ追加の双方向の重複を解除
                     ACSWaiting::update_waiting_for_add_friends($waiting_row['community_id'], $waiting_row['waiting_community_id']);
                 } elseif ($waiting_row['waiting_type_name'] == ACSMsg::get_mst('waiting_type_master', 'D30')) {
                     // 招待の重複を解除
                     ACSWaiting::update_waiting_for_invite_to_community($waiting_row['community_id'], $waiting_row['waiting_community_id']);
                     // 参加の重複を解除
                     ACSWaiting::update_waiting_for_join_community($waiting_row['waiting_community_id'], $waiting_row['community_id']);
                 }
                 // 返信メッセージ
                 if ($form['reply_message'] != '') {
                     $ret = ACSWaiting::send_admission_accept_notify_mail($form['waiting_id']);
                 }
                 //$done_obj->set_title("$waiting_row[waiting_type_name] 承認完了");
                 $done_obj->set_title(ACSMsg::get_tag_replace(ACSMsg::get_msg('User', 'WaitingListAction.class.php', 'FIN_ADM'), array("{WAITING_TYPE_NAME}" => $waiting_row[waiting_type_name])));
                 $done_obj->set_message(ACSMsg::get_msg('User', 'WaitingListAction.class.php', 'M001'));
             } else {
                 $done_obj->set_message(ACSMsg::get_msg('User', 'WaitingListAction.class.php', 'M002'));
             }
         } else {
             ACSDB::_do_query("ROLLBACK");
         }
     } elseif ($form['reject_button']) {
         // 拒否ボタン押下時 //
         $ret = ACSWaiting::update_waiting_waiting_status_code($form['waiting_id'], ACSMsg::get_mst('waiting_status_master', 'D30'), $acs_user_info_row['user_community_id']);
         if ($ret) {
             //$done_obj->set_title("$waiting_row[waiting_type_name] 拒否完了");
             $done_obj->set_title(ACSMsg::get_tag_replace(ACSMsg::get_msg('User', 'WaitingListAction.class.php', 'FIN_DIS'), array("{WAITING_TYPE_NAME}" => $waiting_row[waiting_type_name])));
             $done_obj->set_message(ACSMsg::get_msg('User', 'WaitingListAction.class.php', 'M001'));
         } else {
             $done_obj->set_message(ACSMsg::get_msg('User', 'WaitingListAction.class.php', 'M002'));
         }
     }
     $done_obj->add_link(ACSMsg::get_msg('User', 'WaitingListAction.class.php', 'M003'), './');
     $request->setAttribute('done_obj', $done_obj);
     $controller->forward('Common', 'Done');
 }
Ejemplo n.º 3
0
 /**
  * 依頼承諾メールを送信する
  *
  * @param $waiting_id 待機ID
  * @param $return 成功(true) / 失敗(false)
  * @return 
  */
 static function send_admission_accept_notify_mail($waiting_id)
 {
     // 待機情報
     $waiting_row = ACSWaiting::get_waiting_row($waiting_id);
     // システムURL
     $system_base_url = ACSSystemConfig::get_keyword_value(ACSMsg::get_mst('system_config_group', 'D01'), 'SYSTEM_BASE_URL');
     // システムログインURL
     $system_base_login_url = ACSSystemConfig::get_keyword_value(ACSMsg::get_mst('system_config_group', 'D01'), 'SYSTEM_BASE_LOGIN_URL');
     // システムのメールアドレス (From:)
     $system_mail_addr = ACSSystemConfig::get_keyword_value(ACSMsg::get_mst('system_config_group', 'D01'), 'SYSTEM_MAIL_ADDR');
     // 利用者の言語設定を一時的に保存
     $org_lang = ACSMsg::get_lang();
     // 各言語のタイトルを取得
     $mail_titles = array();
     foreach (ACSMsg::get_lang_list_array() as $lang_key => $lang_name) {
         ACSMsg::set_lang($lang_key);
         $mail_titles[$lang_key] = ACSMsg::get_serial_msg('lib', 'ACSWaiting.class.php', 'MTL%03d') . "\n";
     }
     // 言語を一旦元に戻す
     ACSMsg::set_lang($org_lang);
     if ($waiting_row['waiting_type_name'] == ACSMsg::get_mst('waiting_type_master', 'D10')) {
         // 承認側のユーザ情報
         $user_info_row = ACSUser::get_user_profile_row($waiting_row['community_id']);
         // 承認される側のユーザ情報
         $target_user_info_row = ACSUser::get_user_profile_row($waiting_row['waiting_community_id']);
         $target_lang = ACSMsg::get_mail_lang_by_inforow($target_user_info_row);
         // 一旦依頼される側の言語に設定する
         ACSMsg::set_lang($target_lang);
         $body = $mail_titles[$target_lang];
         $body .= ACSMsg::get_tag_replace(ACSMsg::get_serial_msg('lib', 'ACSWaiting.class.php', 'AMF%03d'), array("{TARGET_USER_NAME}" => $target_user_info_row['user_name'], "{USER_NAME}" => $user_info_row['user_name'], "{USER_COMMUNITY_NAME}" => $user_info_row['community_name'], "{MESSAGE}" => trim($waiting_row['reply_message']), "{SYSTEM_BASE_URL}" => $system_base_url));
         $subject = ACSMsg::get_mdmsg(__FILE__, 'M006');
         $ret = ACSLib::send_mail($system_mail_addr, $target_user_info_row['mail_addr'], null, $subject, $body);
         // 言語を元に戻す
         ACSMsg::set_lang($org_lang);
     } elseif ($waiting_row['waiting_type_name'] == ACSMsg::get_mst('waiting_type_master', 'D20')) {
         // 承認側のコミュニティ情報
         $community_row = ACSCommunity::get_community_row($waiting_row['community_id']);
         // 承認される側のユーザ情報
         $target_user_info_row = ACSUser::get_user_profile_row($waiting_row['waiting_community_id']);
         // 待機承認URL
         $waiting_url = $system_base_login_url . SCRIPT_PATH;
         $waiting_url .= "?" . MODULE_ACCESSOR . "=Community";
         $waiting_url .= "&" . ACTION_ACCESSOR . "=WaitingList";
         $waiting_url .= "&community_id={$waiting_row['community_id']}";
         $waiting_url .= "&waiting_type_code={$waiting_row['waiting_type_code']}";
         $waiting_url .= "&waiting_status_code={$waiting_status_code}";
         $target_lang = ACSMsg::get_mail_lang_by_inforow($target_user_info_row);
         // 一旦依頼される側の言語に設定する
         ACSMsg::set_lang($target_lang);
         $body = $mail_titles[$target_lang];
         $body .= ACSMsg::get_tag_replace(ACSMsg::get_serial_msg('lib', 'ACSWaiting.class.php', 'ACM%03d'), array("{TARGET_USER_NAME}" => $target_user_info_row['user_name'], "{COMMUNITY_NAME}" => $community_row['community_name'], "{MESSAGE}" => trim($waiting_row['reply_message']), "{SYSTEM_BASE_URL}" => $system_base_url));
         $subject = ACSMsg::get_mdmsg(__FILE__, 'M007');
         // 言語を元に戻す
         ACSMsg::set_lang($org_lang);
         $ret = ACSLib::send_mail($system_mail_addr, $target_user_info_row['mail_addr'], null, $subject, $body);
     } elseif ($waiting_row['waiting_type_name'] == ACSMsg::get_mst('waiting_type_master', 'D30')) {
         // 招待されたコミュニティ情報
         $community_row = ACSCommunity::get_community_row($waiting_row['waiting_community_id']);
         // 承認側のユーザ情報
         $user_info_row = ACSUser::get_user_profile_row($waiting_row['community_id']);
         // 承認された側のユーザ情報
         $target_user_info_row = ACSUser::get_user_profile_row($waiting_row['entry_user_community_id']);
         // コミュニティトップページURL
         $community_top_page_url = $system_base_login_url . SCRIPT_PATH;
         $community_top_page_url .= "?" . MODULE_ACCESSOR . "=Community";
         $community_top_page_url .= "&" . ACTION_ACCESSOR . "=" . DEFAULT_ACTION;
         $community_top_page_url .= "&community_id=" . $community_row['community_id'];
         $target_lang = ACSMsg::get_mail_lang_by_inforow($target_user_info_row);
         // 一旦依頼される側の言語に設定する
         ACSMsg::set_lang($target_lang);
         $body = $mail_titles[$target_lang];
         $body .= ACSMsg::get_tag_replace(ACSMsg::get_serial_msg('lib', 'ACSWaiting.class.php', 'AIM%03d'), array("{TARGET_USER_NAME}" => $target_user_info_row['user_name'], "{USER_NAME}" => $user_info_row['user_name'], "{USER_COMMUNITY_NAME}" => $user_info_row['community_name'], "{COMMUNITY_NAME}" => $community_row['community_name'], "{COMMUNITY_URL}" => $community_top_page_url, "{MESSAGE}" => trim($waiting_row['reply_message']), "{SYSTEM_BASE_URL}" => $system_base_url));
         $subject = ACSMsg::get_mdmsg(__FILE__, 'M004');
         // 言語を元に戻す
         ACSMsg::set_lang($org_lang);
         $ret = ACSLib::send_mail($system_mail_addr, $target_user_info_row['mail_addr'], null, $subject, $body);
     } elseif ($waiting_row['waiting_type_name'] == ACSMsg::get_mst('waiting_type_master', 'D40') || $waiting_row['waiting_type_name'] == ACSMsg::get_mst('waiting_type_master', 'D50')) {
         // 承認側のコミュニティ情報
         $community_row = ACSCommunity::get_community_row($waiting_row['community_id']);
         // 承認される側コミュニティ情報
         $target_community_row = ACSCommunity::get_community_row($waiting_row['waiting_community_id']);
         // 承認される側のコミュニティ管理者情報の配列
         $community_admin_user_info_row_array = ACSCommunity::get_community_admin_user_info_row_array($target_community_row['community_id']);
         // コミュニティトップページURL
         $community_top_page_url = $system_base_login_url . SCRIPT_PATH;
         $community_top_page_url .= "?" . MODULE_ACCESSOR . "=Community";
         $community_top_page_url .= "&" . ACTION_ACCESSOR . "=" . DEFAULT_ACTION;
         $community_top_page_url .= "&community_id=" . $community_row['community_id'];
         foreach ($community_admin_user_info_row_array as $community_admin_user_info_row) {
             $community_admin_user_info_row = ACSUser::get_user_profile_row($community_admin_user_info_row['user_community_id']);
             $target_lang = ACSMsg::get_mail_lang_by_inforow($community_admin_user_info_row);
             // 一旦依頼される側の言語に設定する
             ACSMsg::set_lang($target_lang);
             $body = $mail_titles[$target_lang];
             $body .= ACSMsg::get_tag_replace(ACSMsg::get_serial_msg('lib', 'ACSWaiting.class.php', 'ACL%03d'), array("{TARGET_COMMUNITY_NAME}" => $target_community_row['community_name'], "{COMMUNITY_NAME}" => $community_row['community_name'], "{WAITING_TYPE_NAME}" => $waiting_row['waiting_type_name'], "{COMMUNITY_URL}" => $community_top_page_url, "{MESSAGE}" => trim($waiting_row['reply_message']), "{SYSTEM_BASE_URL}" => $system_base_url));
             $subject = ACSMsg::get_mdmsg(__FILE__, 'M009');
             $ret = ACSLib::send_mail($system_mail_addr, $community_admin_user_info_row['mail_addr'], null, $subject, $body);
         }
         // 言語を元に戻す
         ACSMsg::set_lang($org_lang);
     }
     return $ret;
 }