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->ACSgetParameter('id'); // 対象となるcontents_keyを取得 $contents_key = $request->ACSgetParameter('contents_key'); // 対象となるコンテンツ種別コードを取得 $contents_type_code = $request->ACSgetParameter('contents_type_code'); // コンテンツ種別マスタ $contents_type_master_array = ACSDB::get_master_array('contents_type'); // 公開範囲 $open_level_master_row_array = ACSAccessControl::get_open_level_master_row_array(ACSMsg::get_mst('community_type_master', 'D10'), $contents_type_master_array[$contents_type_code]); if ($acs_user_info_row['is_acs_user']) { // マイフレンズグループ $friends_group_row_array = ACSUser::get_friends_group_row_array($user_community_id); } else { $friends_group_row_array = array(); } // set $request->setAttribute('contents_key', $contents_key); $request->setAttribute('contents_type_code', $contents_type_code); $request->setAttribute('open_level_master_row_array', $open_level_master_row_array); $request->setAttribute('friends_group_row_array', $friends_group_row_array); return View::SUCCESS; }
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->ACSgetParameter('id'); if (!$this->get_execute_privilege()) { $controller->forward(SECURE_MODULE, SECURE_ACTION); return; } // ユーザ情報 $target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($user_community_id); // マイフレンズグループ $friends_group_row_array = ACSUser::get_friends_group_row_array($user_community_id); foreach ($friends_group_row_array as $index => $friends_group_row) { $friends_group_row_array[$index]['friends_row_array'] = ACSCommunity::get_community_member_user_info_row_array($friends_group_row['community_id']); } // set $request->setAttribute('target_user_info_row', $target_user_info_row); $request->setAttribute('friends_group_row_array', $friends_group_row_array); return View::SUCCESS; }
function getDefaultView() { $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'); // ユーザ情報 $target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($user_community_id); $year = $request->ACSgetParameter('year'); // 年 $month = $request->ACSgetParameter('month'); // 月 $day = $request->ACSgetParameter('day'); // 日 if (checkdate($month, $day, $year)) { // 年月日指定 $diary_row_array = ACSDiary::get_diary_row_array_by_year_month_day($user_community_id, $year, $month, $day); } elseif (checkdate($month, 1, $year)) { // 年月指定 $diary_row_array = ACSDiary::get_diary_row_array_by_year_month($user_community_id, $year, $month); unset($day); } else { // 全てのダイアリー $diary_row_array = ACSDiary::get_diary_row_array($user_community_id); unset($year); unset($month); unset($day); } // 公開範囲を最終登録と同じもので表示しておく if ($diary_row_array) { $last_open_level_code = $diary_row_array[0]['open_level_code']; } // 信頼済みコミュニティ情報 foreach ($diary_row_array as $index => $diary_row) { if ($diary_row['open_level_name'] == ACSMsg::get_mst('open_level_master', 'D05')) { $diary_row_array[$index]['trusted_community_row_array'] = ACSDiary::get_diary_trusted_community_row_array($diary_row['diary_id']); } } // 公開範囲 $open_level_master_row_array = ACSAccessControl::get_open_level_master_row_array(ACSMsg::get_mst('community_type_master', 'D10'), ACSMsg::get_mst('contents_type_master', 'D21')); // マイフレンズグループ $friends_group_row_array = ACSUser::get_friends_group_row_array($user_community_id); // set $request->setAttribute('target_user_info_row', $target_user_info_row); $request->setAttribute('diary_row_array', $diary_row_array); $request->setAttribute('open_level_master_row_array', $open_level_master_row_array); $request->setAttribute('friends_group_row_array', $friends_group_row_array); $request->setAttribute('last_open_level_code', $last_open_level_code); return View::INPUT; }
function getDefaultView() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); $acs_user_info_row = $user->getAttribute('acs_user_info_row'); // 対象となるUserIDを取得 $user_community_id = $request->getParameter('id'); // Diary情報 $diary_row_array = $request->getAttribute('diary_row_array'); // 公開範囲 $open_level_master_row_array = ACSAccessControl::get_open_level_master_row_array(ACSMsg::get_mst('community_type_master', 'D10'), ACSMsg::get_mst('contents_type_master', 'D21')); // マイフレンズグループ $friends_group_row_array = ACSUser::get_friends_group_row_array($user_community_id); // set $request->setAttribute('acs_user_info_row', $acs_user_info_row); $request->setAttribute('diary_row_array', $diary_row_array); $request->setAttribute('open_level_master_row_array', $open_level_master_row_array); $request->setAttribute('friends_group_row_array', $friends_group_row_array); //return VIEW_CONFIRM; }
/** * マイフレンズを削除する * * @param ユーザコミュニティID * @param ユーザコミュニティID * @return true(成功) / false(失敗) */ static function delete_friends($user_community_id, $target_user_community_id) { // BEGIN ACSDB::_do_query("BEGIN"); // フレンズコミュニティID $friends_community_id = ACSUser::get_friends_community_id($user_community_id); $target_friends_community_id = ACSUser::get_friends_community_id($target_user_community_id); // コミュニティ種別マスタ $community_type_master_array = ACSDB::get_master_array('community_type'); // マイフレンズ $friends_community_type_code = array_search(ACSMsg::get_mst('community_type_master', 'D20'), $community_type_master_array); // マイフレンズグループ $friends_group_community_type_code = array_search(ACSMsg::get_mst('community_type_master', 'D30'), $community_type_master_array); $user_community_id = pg_escape_string($user_community_id); $target_user_community_id = pg_escape_string($target_user_community_id); // (1) 互いのマイフレンズから削除 $sql = "DELETE"; $sql .= " FROM community_member"; $sql .= " WHERE (community_id = '{$friends_community_id}' OR community_id = '{$target_friends_community_id}')"; $sql .= " AND (user_community_id = '{$target_user_community_id}' OR user_community_id = '{$user_community_id}')"; $ret = ACSDB::_do_query($sql); if (!$ret) { ACSDB::_do_query("ROLLBACK"); return $ret; } // (2) 互いのマイフレンズグループから削除 $friends_group_row_array = ACSUser::get_friends_group_row_array($user_community_id); $target_friends_group_row_array = ACSUser::get_friends_group_row_array($target_user_community_id); $friends_group_community_id_array = array(); foreach ($friends_group_row_array as $friends_group_row) { array_push($friends_group_community_id_array, $friends_group_row['community_id']); } foreach ($target_friends_group_row_array as $target_friends_group_row) { array_push($friends_group_community_id_array, $target_friends_group_row['community_id']); } // 削除対象となるフレンズグループコミュニティIDのCSV if ($friends_group_community_id_array) { $friends_group_community_id_csv = implode(',', $friends_group_community_id_array); } else { $friends_group_community_id_csv = 'null'; } // 削除 $sql = "DELETE"; $sql .= " FROM community_member"; $sql .= " WHERE community_id IN ({$friends_group_community_id_csv})"; $sql .= " AND (user_community_id = '{$target_user_community_id}' OR user_community_id = '{$user_community_id}')"; $ret = ACSDB::_do_query($sql); if (!$ret) { ACSDB::_do_query("ROLLBACK"); return $ret; } // COMMIT ACSDB::_do_query("COMMIT"); return $ret; }
function execute() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); // get $target_user_info_row = $request->getAttribute('target_user_info_row'); $user_folder_obj = $request->getAttribute('user_folder_obj'); $edit_folder_id = $request->getAttribute('edit_folder_id'); $default_data_row = $request->getAttribute('default_data_row'); // デフォルト値として表示する値 $target_user_community_id = $target_user_info_row['user_community_id']; $view_mode = $request->getAttribute('view_mode'); $target_user_info = '&id=' . $target_user_community_id; $folder_info = '&folder_id=' . $user_folder_obj->folder_obj->get_folder_id(); if ($view_mode == 'update') { $edit_folder_info = '&edit_folder_id=' . $edit_folder_id; } else { $edit_folder_info = ""; } // フォルダの所有者 $_target_user_info_row['community_name'] = $target_user_info_row['community_name']; $_target_user_info_row['top_page_url'] = $this->getControllerPath('User', DEFAULT_ACTION); $_target_user_info_row['top_page_url'] .= $target_community_info; // 登録・更新処理URL $action_url = ""; $action_url = $this->getControllerPath('User', 'EditFolder'); $action_url .= $target_user_info; $action_url .= $folder_info; $action_url .= $edit_folder_info; $action_url .= '&action_type=' . $view_mode; $cancel_url = ""; if ($view_mode == 'create') { $cancel_url = $this->getControllerPath('User', 'Folder'); $cancel_url .= $target_user_info; $cancel_url .= $folder_info; } elseif ($view_mode == 'update') { $cancel_url = $this->getControllerPath('User', 'FolderDetail'); $cancel_url .= $target_user_info; $cancel_url .= $folder_info; $cancel_url .= '&detail_folder_id=' . $edit_folder_id; } // 公開範囲を設定できるかどうか $is_set_open_level_available = $user_folder_obj->is_set_open_level_available(); // 公開範囲選択肢取得 $open_level_master_row_array = ACSAccessControl::get_open_level_master_row_array(ACSMsg::get_mst('community_type_master', 'D10'), ACSMsg::get_mst('contents_type_master', 'D32')); // デフォルト表示データがある場合、is_default を変更する if ($default_data_row) { $selected_open_level_code = $default_data_row['open_level_code']; $index_count = 0; foreach ($open_level_master_row_array as $open_level_master_row) { if ($open_level_master_row['open_level_code'] == $selected_open_level_code) { $open_level_master_row_array[$index_count]['is_default'] = true; } else { $open_level_master_row_array[$index_count]['is_default'] = false; } $index_count++; } } // マイフレンズグループ取得 (公開範囲「友人に公開」の選択肢) $friends_group_row_array = ACSUser::get_friends_group_row_array($target_user_info_row['user_community_id']); // 友人に公開の場合のオプションデフォルト値を追加 // default_data_row に 'trusted_community_flag' を追加する $selected_trusted_community_id_array = $default_data_row['trusted_community_id_array']; // 「友人に公開」の 公開範囲コード取得 foreach ($open_level_master_row_array as $open_level_master_row) { if ($open_level_master_row['open_level_name'] == ACSMsg::get_mst('open_level_master', 'D05')) { $friends_open_level_code = $open_level_master_row['open_level_code']; break; } } if ($default_data_row['trusted_community_flag']) { // 選択された値がわかっている場合(エラーの場合) // そのままの値を使用する } elseif ($default_data_row['open_level_code'] != $friends_open_level_code) { // 全ての友人 をデフォルトにする $default_data_row['trusted_community_flag'] = '0'; } elseif ($friends_group_row_array && $selected_trusted_community_id_array) { // 指定されているコミュニティIDが1つで、community_type がマイフレンズでないの場合 // マイフレンズグループ を選択する if (count($selected_trusted_community_id_array) == 1) { $_trusted_community_row = ACSCommunity::get_community_row($selected_trusted_community_id_array[0]); if ($_trusted_community_row['community_type_name'] != ACSMsg::get_mst('community_type_master', 'D20')) { $default_data_row['trusted_community_flag'] = '1'; } else { $default_data_row['trusted_community_flag'] = '0'; } } else { // 複数ある場合は、マイフレンズグループ $default_data_row['trusted_community_flag'] = '1'; } } elseif ($default_data_row['open_level_code'] == $friends_open_level_code && !$selected_trusted_community_id_array) { // 友人に公開で、閲覧許可コミュニティがない場合は マイフレンズを選択 $default_data_row['trusted_community_flag'] = '1'; } // テンプレート $this->setScreenId("0001"); $this->setTemplate('EditFolder.tpl.php'); // set $this->setAttribute('target_user_info_row', $_target_user_info_row); $this->setAttribute('view_mode', $view_mode); $this->setAttribute('action_url', $action_url); $this->setAttribute('cancel_url', $cancel_url); $this->setAttribute('is_set_open_level_available', $is_set_open_level_available); $this->setAttribute('open_level_master_row_array', $open_level_master_row_array); $this->setAttribute('friends_group_row_array', $friends_group_row_array); $this->setAttribute('default_data_row', $default_data_row); // エラーメッセージ $this->setAttribute('error_message', $this->getErrorMessage($controller, $request, $user)); return parent::execute(); }
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->ACSgetParameter('id'); // ユーザ情報 $target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($user_community_id); //mode 画面の遷移を取得する $move_id = $request->getParameter('move_id'); // 画面上のフォーム情報を取得する if ($move_id == 1) { $form = $request->getParameters('search_form_default'); } else { if ($move_id == 2) { $form = $request->getParameters('search_form_new'); } } // formの情報に従い検索を行う if ($move_id > 0) { $err_str = ""; /* Array [id] => 1000 [move_id] => 2 [q_text] => 検索条件 //条件(※必須) [search_title] => title_in_serch //件名を選択 [search_all] => subject_in_serch //本文を選択 [open_level_code] => 00 //公開範囲(00は選択なし)(※必須) [search_all_about] => all_in_serch //すべての日記を選択 */ // ------------ 検索情報の取得(注意!バイト単位で処理) for ($i = 1; $i < 3; $i++) { $str_where_create[$i] = ACSDiary::set_diary_where_list($form, $i); if ($str_where_create[$i]['err_str']) { $err_str = $str_where_create[$i]['err_str']; //where句の一部が作成できないオペレータミス if ($err_str != '') { break; } } else { $str_where[$i] = $str_where_create[$i]['like_sql']; } } //公開範囲は別指定 $str_open_level_code = '00'; if ($form['open_level_code'] != '00') { //公開範囲を選択している場合 $str_open_level_code = $form['open_level_code']; } // ------------ // db検索処理 and or 2回行う if (!$err_str) { $diary_row_array_result = ACSDiary::get_diary_where_array($str_where[1], $str_open_level_code, array()); //複合条件のサマリ //and完全一致を省いた日記からor部分一致を検索する if ($str_where_create[1]['str_count'] == 2 || $str_where_create[2]['str_count'] == 2) { $str_where_create['not_id'] = array(); foreach ($diary_row_array_result as $index => $diary_row) { array_push($str_where_create['not_id'], $diary_row['diary_id']); } $diary_row_array_not = ACSDiary::get_diary_where_array($str_where[2], $str_open_level_code, $str_where_create['not_id']); foreach ($diary_row_array_not as $index => $diary_row) { array_push($diary_row_array_result, $diary_row); } } if (!$diary_row_array_result) { //$err_str = "該当する情報がありません"; $err_str = ACSMsg::get_msg('User', 'SearchResultDiaryAction.class.php', 'M001'); } else { // 信頼済みコミュニティ情報 foreach ($diary_row_array_result as $index => $diary_row) { if ($diary_row['open_level_name'] == ACSMsg::get_mst('open_level_master', 'D05')) { $diary_row_array_result[$index]['trusted_community_row_array'] = ACSDiary::get_diary_trusted_community_row_array($diary_row['diary_id']); } } } } $request->setAttribute('diary_row_array_result', $diary_row_array_result); $request->setAttribute('err_str', $err_str); $request->setAttribute('form_pre', $form); } // 公開範囲 $open_level_master_row_array = ACSAccessControl::get_open_level_master_row_array(ACSMsg::get_mst('community_type_master', 'D10'), ACSMsg::get_mst('contents_type_master', 'D21')); // マイフレンズグループ $friends_group_row_array = ACSUser::get_friends_group_row_array($user_community_id); // set $user->setAttribute('acs_user_info_row', $acs_user_info_row); $request->setAttribute('target_user_info_row', $target_user_info_row); $request->setAttribute('diary_row_array', $diary_row_array); $request->setAttribute('open_level_master_row_array', $open_level_master_row_array); $request->setAttribute('friends_group_row_array', $friends_group_row_array); return View::SUCCESS; }