function execute() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); // get $target_community_info_row = $request->getAttribute('target_community_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'); // デフォルト値として表示する値 $parent_community_row_array = $request->getAttribute('parent_community_row_array'); $sub_community_row_array = $request->getAttribute('sub_community_row_array'); $target_community_id = $target_community_info_row['community_id']; $view_mode = $request->getAttribute('view_mode'); $target_community_info = '&community_id=' . $target_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_community_info_row['community_id'] = $target_community_info_row['community_id']; $_target_community_info_row['community_name'] = $target_community_info_row['community_name']; $_target_community_info_row['top_page_url'] = $this->getControllerPath('User', DEFAULT_ACTION); $_target_community_info_row['top_page_url'] .= $target_community_info; // 登録・更新処理URL $action_url = ""; $action_url = $this->getControllerPath('Community', 'EditFolder'); $action_url .= $target_community_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('Community', 'Folder'); $cancel_url .= $target_community_info; $cancel_url .= $folder_info; } elseif ($view_mode == 'update') { $cancel_url = $this->getControllerPath('Community', 'FolderDetail'); $cancel_url .= $target_community_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', 'D40'), 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++; } } // ------------------------- // 閲覧許可コミュニティ $trusted_community_row_array = array(); // 親コミュニティ $parent_community_info_array = $this->make_trusted_community_row_array($controller, $parent_community_row_array); //array_push($trusted_community_row_array, $parent_community_row_array); // サブコミュニティ $sub_community_info_array = $this->make_trusted_community_row_array($controller, $sub_community_row_array); //array_push($trusted_community_row_array, $sub_community_row_array); // 選択されているコミュニティ $selected_trusted_community_row_array = ACSCommunity::get_each_community_row_array($default_data_row['trusted_community_id_array']); $selected_trusted_community_info_array = $this->make_trusted_community_row_array($controller, $selected_trusted_community_row_array); // デフォルトで表示する閲覧許可コミュニティを作成 //$trusted_community_row_array = array_merge($parent_community_info_array, $sub_community_info_array, $selected_trusted_community_info_array); //$trusted_community_row_array = array_unique($trusted_community_row_array); // 閲覧許可コミュニティ追加URL #index.php?module=Community&action=SelectTrustedCommunity&form_name=folder_open_level_form $add_trusted_community_url = ""; $add_trusted_community_url = $this->getControllerPath('Community', 'SelectTrustedCommunity'); $add_trusted_community_url .= '&form_name=folder_info'; // テンプレート $this->setScreenId("0001"); $this->setTemplate('EditFolder.tpl.php'); // set $this->setAttribute('target_community_info_row', $_target_community_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('parent_community_info_array', $parent_community_info_array); $this->setAttribute('sub_community_info_array', $sub_community_info_array); $this->setAttribute('selected_trusted_community_info_array', $selected_trusted_community_info_array); $this->setAttribute('add_trusted_community_url', $add_trusted_community_url); // $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(); if (!$this->get_execute_privilege()) { $controller->forward(SECURE_MODULE, SECURE_ACTION); return; } //mode 画面の遷移を取得する $move_id = $request->getParameter('move_id'); // 公開範囲 $open_level_master_row_array = ACSAccessControl::get_open_level_master_row_array(ACSMsg::get_mst('community_type_master', 'D40'), ACSMsg::get_mst('contents_type_master', 'D42')); // ユーザー情報 $acs_user_info_row = $user->getAttribute('acs_user_info_row'); // 対象となるコミュニティIDを取得 $community_id = $request->getParameter('community_id'); //エラーの初期化 /* 入力画面より */ if ($move_id == 1) { $err = 'OK'; //エラー値の初期化 //☆☆ ここからほぼ同じ // 画面上のフォーム情報を取得する $form['subject'] = $request->getParameter('subject'); //件名:subject $form['body'] = $request->getParameter('body'); //内容:body $form['open_level_code'] = $request->getParameter('open_level_code'); //公開範囲コード:open_level_code foreach ($open_level_master_row_array as $open_level_master_row) { if ($open_level_master_row['open_level_code'] == $form['open_level_code']) { $form['open_level_name'] = htmlspecialchars($open_level_master_row['open_level_name']); //公開範囲表示名:open_level_name } } $form['new_file'] = $request->getParameter('new_file'); //画像:new_file //ファイル情報のあるなしをチェックしておく if (!ini_get('mbstring.encoding_translation')) { $form['file_name'] = mb_convert_encoding($_FILES['new_file']['name'], mb_internal_encoding(), mb_http_output()); } else { $form['file_name'] = $_FILES['new_file']['name']; } if ($form['file_name'] != '') { /* ディレクトリ存在チェック */ // ない場合は作成する $to_dir = ACS_TEMPORARY_FILE_DIR; if (!file_exists($to_dir)) { mkdir($to_dir); chmod($to_dir, 0777); } //ファイルがある場合、仮置き場所を設定する $_FILES['new_file']['upload_tmp_dir'] = ACS_TEMPORARY_FILE_DIR; //仮置きのファイル名を設定する $type_name = session_id(); $upload = $_FILES['new_file']['upload_tmp_dir']; $upload .= $type_name; if (!move_uploaded_file($_FILES['new_file']['tmp_name'], $upload)) { echo "ファイルの読み込みに失敗しました\n"; } $_FILES['new_file']['tmp_name'] = $upload; $form['file_obj'] = $_FILES['new_file']; $user->setAttribute('new_file_info', $upload); $user->setAttribute('new_file_obj', $_FILES['new_file']); } $form['xdate'] = $request->getParameter('xdate'); //掲載最終日:xdate //掲載最終日デフォルト値 if ($form['xdate'] == '') { $form[xdate] = ''; } //閲覧許可コミュニティ $form['trusted_community_id_array'] = $request->getParameter('trusted_community_id_array'); $form['trusted_community_row_array'] = ACSCommunity::get_each_community_row_array($form['trusted_community_id_array']); $form['community_id'] = $community_id; //当コミュニティのID $form['user_community_id'] = $acs_user_info_row['user_community_id']; // 投稿者print "form_row:"; // ML送信オプション $form['is_ml_send'] = $request->getParameter('is_ml_send'); //画像:new_file //☆☆ ここまでほぼ同じ $user->setAttribute('new_form_obj', $form); return View::SUCCESS; /* 登録確定ボタン「はい」より */ } else { if ($move_id == 2) { //☆☆ ここからほぼ同 // 画面上のフォーム情報を取得する $form = $user->getAttribute('new_form_obj'); $new_file_obj = $form['file_obj']; //☆☆ ここまでほぼ同じ // DBへの書き込み等 ACSDB::_do_query("BEGIN"); if ($form['file_name'] != "") { //ファイル情報があった場合 //1.ファイル情報取得(新規) $file_obj = ACSFile::get_upload_file_info_instance($user->getAttribute('new_file_obj'), $community_id, $form['user_community_id']); //form情報へ登録 $form['new_file'] = $file_obj; } //2.bbsテーブル情報 $ret = ACSBBS::set_bbs($form); if ($ret) { ACSDB::_do_query("COMMIT"); // 掲示板アクセス履歴 ACSBBS::set_bbs_access_history($acs_user_info_row['user_community_id'], $ret); } else { ACSDB::_do_query("ROLLBACK"); } $bbs_id_seq = $ret; // MLオプションありの場合 if ($form['is_ml_send'] == 't') { // MLステータスの取得 $ml_status_row = ACSCommunity::get_contents_row($community_id, ACSMsg::get_mst('contents_type_master', 'D62')); $ml_status = $ml_status_row['contents_value']; // ML有りの場合メールを送信 if ($bbs_id_seq && $ml_status == 'ACTIVE') { // 件名編集 $subject = str_replace('{BBSID}', $bbs_id_seq, ACS_COMMUNITY_ML_SUBJECT_FORMAT) . $form['subject']; // ML送信 ACSCommunityMail::send_community_mailing_list($community_id, $acs_user_info_row['mail_addr'], $subject, $form['body']); } } $action_url = $this->getControllerPath('Community', 'BBS') . '&community_id=' . $community_id . '&move_id=4'; header("Location: {$action_url}"); } } }