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を取得 $community_id = $request->getParameter('community_id'); // コミュニティ情報 $community_row = ACSCommunity::get_community_profile_row($community_id); $community_row = ACSExternalRSS::add_contents_row_array($community_row); // BBS記事一覧 $bbs_row_array = ACSBBS::get_bbs_row_array($community_id); foreach ($bbs_row_array as $index => $bbs_row) { // 信頼済みコミュニティ一覧 $bbs_row_array[$index]['trusted_community_row_array'] = ACSBBS::get_bbs_trusted_community_row_array($bbs_row['bbs_id']); // 返信記事 $bbs_row_array[$index]['bbs_res_row_array'] = ACSBBS::get_bbs_res_row_array($bbs_row['bbs_id']); } if ($community_row['contents_row_array']['self']['open_level_name'] == ACSMsg::get_mst('open_level_master', 'D03')) { // 非公開コミュニティ $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', 'D43')); } else { // 公開範囲 $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')); } // set $request->setAttribute('community_row', $community_row); $request->setAttribute('bbs_row_array', $bbs_row_array); $request->setAttribute('open_level_master_row_array', $open_level_master_row_array); return View::INPUT; }
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'); // コミュニティ情報 $community_row = ACSCommunity::get_community_row($community_id); $form = $request->ACSGetParameters(); $ret = ACSExternalRSS::set_external_rss_contents($community_id, $form); // forward $done_obj = new ACSDone(); if ($ret) { $done_obj->set_title(ACSMsg::get_msg('Community', 'EditExternalRSSAction.class.php', 'M001')); $done_obj->set_message(ACSMsg::get_msg('Community', 'EditExternalRSSAction.class.php', 'M002')); $done_obj->add_link($community_row['community_name'] . ' ' . ACSMsg::get_msg('Community', 'EditExternalRSSAction.class.php', 'M003'), $this->getControllerPath('Community', DEFAULT_ACTION) . '&community_id=' . $community_row['community_id']); } else { $done_obj->set_title(ACSMsg::get_msg('Community', 'EditExternalRSSAction.class.php', 'M004')); } $request->setAttribute('done_obj', $done_obj); $controller->forward('Common', 'Done'); }
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を取得 $community_id = $request->ACSgetParameter('community_id'); $community_row = ACSCommunity::get_community_row($community_id); // 実行 ACSExternalRSS::do_process($community_row); $bbs_url = $this->getControllerPath('Community', 'BBS') . '&community_id=' . $community_id; header("Location: {$bbs_url}"); }
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 $community_row = $request->getAttribute('community_row'); $bbs_row = $request->getAttribute('bbs_row'); //ユーザ入力情報 $form = $user->getAttribute('new_form_obj'); // コミュニティメンバかどうか $is_community_member = ACSCommunity::is_community_member($acs_user_info_row['user_community_id'], $community_row['community_id']); //コミュニティ管理者かどうか $is_community_admin = ACSCommunity::is_community_admin($acs_user_info_row['user_community_id'], $community_row['community_id']); // 加工 if ($bbs_row['bbs_res_delete_flag'] != 't') { // 親記事の投稿者 トップページURL $bbs_row['top_page_url'] = $this->getControllerPath(DEFAULT_MODULE, DEFAULT_ACTION) . '&id=' . $bbs_row['user_community_id']; // 写真URL $bbs_row['image_url'] = ACSUser::get_image_url($bbs_row['user_community_id'], 'thumb'); // 投稿日時 $bbs_row['post_date'] = ACSLib::convert_pg_date_to_str($bbs_row['post_date']); //ファイルの画像URL $bbs_row['file_url'] = ""; if ($bbs_row['file_id'] != "") { $bbs_row['file_url'] = ACSBBSFile::get_image_url($bbs_row['bbs_id'], 'thumb'); //投稿内表示用 $bbs_row['file_url_alink'] = ACSBBSFile::get_image_url($bbs_row['bbs_id'], ''); //ポップアップ用 } // パブリックリリース 掲載終了日 if ($bbs_row['expire_date'] != "") { $bbs_row['expire_date'] = ACSLib::convert_pg_date_to_str($bbs_row['expire_date'], true, false, false); } // 外部RSS情報 $external_rss_row = ACSExternalRSS::get_external_rss_row($bbs_row['bbs_id']); if ($external_rss_row) { if ($external_rss_row['rss_item_date'] != '') { // YYYY/MM/DD H:MM $external_rss_row['rss_item_date'] = ACSLib::convert_pg_date_to_str($external_rss_row['rss_item_date'], 0, 1, 0); } $bbs_row['external_rss_row'] = $external_rss_row; } // 返信記事 foreach ($bbs_row['bbs_res_row_array'] as $res_index => $bbs_res_row) { // 返信記事の投稿者 トップページURL $bbs_row['bbs_res_row_array'][$res_index]['top_page_url'] = $this->getControllerPath(DEFAULT_MODULE, DEFAULT_ACTION) . '&id=' . $bbs_res_row['user_community_id']; // 写真URL $bbs_row['bbs_res_row_array'][$res_index]['image_url'] = ACSUser::get_image_url($bbs_res_row['user_community_id'], 'thumb'); // 投稿日時 $bbs_row['bbs_res_row_array'][$res_index]['post_date'] = ACSLib::convert_pg_date_to_str($bbs_res_row['post_date']); // 返信の削除URL $bbs_row['bbs_res_row_array'][$res_index]['delete_bbs_res_url'] = $this->getControllerPath('Community', 'DeleteBBSRes') . '&community_id=' . $community_row['community_id'] . '&bbs_res_id=' . $bbs_row['bbs_res_row_array'][$res_index]['bbs_res_id'] . '&bbs_id=' . $bbs_row['bbs_id']; // 編集URL if (!ACSLib::get_boolean($bbs_res_row['bbs_res_delete_flag']) && ($bbs_res_row['user_community_id'] == $acs_user_info_row['user_community_id'] || $is_community_admin)) { $bbs_row['bbs_res_row_array'][$res_index]['edit_bbs_res_url'] = $this->getControllerPath('Community', 'EditBBSRes') . '&community_id=' . $community_row['community_id'] . '&bbs_id=' . $bbs_res_row['bbs_id'] . '&bbs_res_id=' . $bbs_res_row['bbs_res_id']; } //削除権限フラグ (自分が投稿したもの 又は コミュニティ管理者) if ($bbs_res_row['user_community_id'] == $acs_user_info_row['user_community_id'] || $is_community_admin == 1) { $bbs_row['bbs_res_row_array'][$res_index]['bbs_set_delete_flag'] = true; } else { $bbs_row['bbs_res_row_array'][$res_index]['bbs_set_delete_flag'] = false; } } } // form action 確認画面への遷移 $action_url = $this->getControllerPath('Community', 'BBSResPre') . '&community_id=' . $community_row['community_id'] . '&bbs_id=' . $bbs_row['bbs_id'] . '&move_id=1'; // コミュニティトップページのURL $community_top_page_url = $this->getControllerPath('Community', DEFAULT_ACTION) . '&community_id=' . $community_row['community_id']; // BBS URL $bbs_top_page_url = $this->getControllerPath('Community', 'BBS') . '&community_id=' . $community_row['community_id']; // set $this->setAttribute('is_community_member', $is_community_member); $this->setAttribute('community_row', $request->getAttribute('community_row')); $this->setAttribute('bbs_row', $bbs_row); $this->setAttribute('action_url', $action_url); $this->setAttribute('community_top_page_url', $community_top_page_url); $this->setAttribute('bbs_top_page_url', $bbs_top_page_url); // テンプレート $this->setScreenId("0001"); $this->setTemplate('BBSRes.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')); } return parent::execute(); }
/** * 外部RSS自動取り込みを実行する * * @param $community_row コミュニティ情報 * @return $msg */ static function do_process($community_row) { $msg = ""; // 公開レベルマスタ $open_level_master_array = ACSDB::get_master_array('open_level'); // 外部RSSコンテンツ情報を付加 $community_row = ACSExternalRSS::add_contents_row_array($community_row); // RSS情報を取得 $rss_row_array = ACSExternalRSS::get_external_rss_row_array($community_row['contents_row_array']['external_rss_url']['contents_value']); if ($rss_row_array == false) { return; } // 外部RSS.投稿者が該当コミュニティのコミュニティ管理者であるかどうかチェックする $community_admin_user_info_row_array = ACSCommunity::get_community_admin_user_info_row_array($community_row['community_id']); $err_flg = 1; foreach ($community_admin_user_info_row_array as $community_admin_user_info_row) { if ($community_admin_user_info_row['user_community_id'] == $community_row['contents_row_array']['external_rss_post_user']['contents_value']) { $err_flg = 0; break; } } if ($err_flg) { return; } // 投稿者情報 (ml_addrを含む情報) $post_user_info_row = ACSUser::get_user_info_row_by_user_community_id($community_row['contents_row_array']['external_rss_post_user']['contents_value']); $post_user_info_row = ACSUser::get_user_info_row_by_user_id($post_user_info_row['user_id']); // 投稿情報($form) // // 初期化 $form = array(); $form['community_id'] = $community_row['community_id']; $form['user_community_id'] = $community_row['contents_row_array']['external_rss_post_user']['contents_value']; $form['open_level_code'] = $community_row['contents_row_array']['external_rss_url']['open_level_code']; // パブリックリリース の場合 if ($open_level_master_array[$form['open_level_code']] == ACSMsg::get_mst('open_level_master', 'D06') && intval($community_row['contents_row_array']['external_rss_public_release_expire_term']['contents_value']) >= 1) { $form['expire_date'] = "CURRENT_DATE + '@ " . ($community_row['contents_row_array']['external_rss_public_release_expire_term']['contents_value'] - 1) . " days'::INTERVAL"; } else { $form['expire_date'] = ''; } // 非公開 (メンバのみ) の場合 if ($open_level_master_array[$form['open_level_code']] == ACSMsg::get_mst('open_level_master', 'D04')) { $form['trusted_community_row_array'] = $community_row['contents_row_array']['external_rss_url']['trusted_community_row_array']; } else { $form['trusted_community_row_array'] = array(); } $form['ml_send_flag'] = ACSLib::get_pg_boolean(ACSLib::get_boolean($community_row['contents_row_array']['external_rss_ml_send_flag']['contents_value'])); // RSS記事ごとの処理 // foreach ($rss_row_array['items'] as $rss_item_row) { // 掲載されているかチェック if (!ACSExternalRSS::is_posted_value($community_row['community_id'], $rss_item_row['rss_item_title'], $rss_item_row['rss_item_date'])) { // 掲載されていない場合 $form['subject'] = $rss_item_row['rss_item_title']; $form['body'] = $rss_item_row['rss_item_content']; $form['post_date'] = $rss_item_row['rss_item_date']; $bbs_id = ACSExternalRSS::set_bbs_and_external_rss($form, $rss_row_array['channel_info'], $rss_item_row); if (!$bbs_id) { echo "ERROR\n"; exit; } else { $msg .= "掲載: {$community_row['community_name']} (community_id={$community_row['community_id']})\n"; $msg .= "\t=> {$form['subject']} (bbs_id={$bbs_id})\n"; if (ACSLib::get_boolean($form['ml_send_flag'])) { // MLステータスの取得 $ml_status_row = ACSCommunity::get_contents_row($community_row['community_id'], ACSMsg::get_mst('contents_type_master', 'D62')); $ml_status = $ml_status_row['contents_value']; // ML有りの場合メールを送信 if ($ml_status == 'ACTIVE') { // 件名編集 $subject = str_replace('{BBSID}', $bbs_id, ACS_COMMUNITY_ML_SUBJECT_FORMAT) . $form['subject']; // ML送信 ACSCommunityMail::send_community_mailing_list($community_row['community_id'], $post_user_info_row['mail_addr'], $form['subject'], $form['body']); $msg .= "\t=> ML送信\n"; } } } } } return $msg; }
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 $community_row = $request->getAttribute('community_row'); $bbs_row_array = $request->getAttribute('bbs_row_array'); // コミュニティメンバかどうか $is_community_member = ACSCommunity::is_community_member($acs_user_info_row['user_community_id'], $community_row['community_id']); //コミュニティ管理者かどうか $is_community_admin = ACSCommunity::is_community_admin($acs_user_info_row['user_community_id'], $community_row['community_id']); // form action 確認画面への遷移 $action_url = $this->getControllerPath('Community', 'BBSPre') . '&community_id=' . $community_row['community_id'] . '&move_id=1'; // コミュニティトップページのURL $community_top_page_url = $this->getControllerPath('Community', DEFAULT_ACTION) . '&community_id=' . $community_row['community_id']; // BBSスレッド一覧URL $bbs_thread_list_url = $this->getControllerPath('Community', 'BBSThreadList') . '&community_id=' . $community_row['community_id']; // 信頼済みコミュニティ選択ページのURL $select_trusted_community_url = $this->getControllerPath('Community', 'SelectTrustedCommunity') . '&form_name=bbs_form'; //検索画面url $search_bbs_url = $this->getControllerPath('Community', 'SearchBBS') . '&community_id=' . $community_row['community_id'] . '&move_id=1'; //外部RSS取り込み実行 if ($community_row['contents_row_array']['external_rss_url']['contents_value'] != '') { $get_external_rss_url = $this->getControllerPath('Community', 'GetExternalRSS') . '&community_id=' . $community_row['community_id']; } // 掲示板RSS URL $term = ACSSystemConfig::get_keyword_value(ACSMsg::get_mst('system_config_group', 'D03'), 'BBS_RSS_TERM'); $bbs_rss_url = $this->getControllerPath('Community', 'BBSRSS') . '&community_id=' . $community_row['community_id'] . '&term=' . $term; // 加工 foreach ($bbs_row_array as $index => $bbs_row) { // 親記事の投稿者 トップページURL $bbs_row_array[$index]['top_page_url'] = $this->getControllerPath(DEFAULT_MODULE, DEFAULT_ACTION) . '&id=' . $bbs_row['user_community_id']; // 写真URL $bbs_row_array[$index]['image_url'] = ACSUser::get_image_url($bbs_row['user_community_id'], 'thumb'); // 投稿日時 $bbs_row_array[$index]['post_date'] = ACSLib::convert_pg_date_to_str($bbs_row['post_date']); // 返信画面URL $bbs_row_array[$index]['bbs_res_url'] = $this->getControllerPath('Community', 'BBSRes') . '&community_id=' . $community_row['community_id'] . '&bbs_id=' . $bbs_row['bbs_id']; // 編集画面URL if ($bbs_row['user_community_id'] == $acs_user_info_row['user_community_id'] || $is_community_admin) { $bbs_row_array[$index]['edit_bbs_url'] = $this->getControllerPath('Community', 'EditBBS') . '&community_id=' . $community_row['community_id'] . '&bbs_id=' . $bbs_row['bbs_id']; } // 削除画面URL $bbs_row_array[$index]['bbs_delete_url'] = $this->getControllerPath('Community', 'DeleteBBS') . '&community_id=' . $community_row['community_id'] . '&bbs_id=' . $bbs_row['bbs_id']; //削除権限フラグ (自分が投稿したもの 又は コミュニティ管理者) if ($bbs_row['user_community_id'] == $acs_user_info_row['user_community_id'] || $is_community_admin == 1) { $bbs_row_array[$index]['bbs_set_delete_flag'] = true; } else { $bbs_row_array[$index]['bbs_set_delete_flag'] = false; } //ファイルの画像URL $bbs_row_array[$index]['file_url'] = ""; if ($bbs_row['file_id'] != "") { $bbs_row_array[$index]['file_url'] = ACSBBSFile::get_image_url($bbs_row['bbs_id'], 'thumb'); //投稿内表示用 $bbs_row_array[$index]['file_url_alink'] = ACSBBSFile::get_image_url($bbs_row['bbs_id'], ''); //ポップアップ用 } // パブリックリリース 掲載終了日 2/21add @akitsu $bbs_row_array[$index]['expire_date'] = ""; if ($bbs_row['expire_date'] != "") { $bbs_row_array[$index]['expire_date'] = ACSLib::convert_pg_date_to_str($bbs_row['expire_date'], true, false, false); } if ($bbs_row['bbs_delete_flag'] != 't') { // 返信記事 $bbs_res_display_max = 10; $bbs_row_array[$index]['bbs_res_row_array_num'] = count($bbs_row_array[$index]['bbs_res_row_array']); if ($bbs_row_array[$index]['bbs_res_row_array_num'] > $bbs_res_display_max) { // 最新の10件のみslice $bbs_row_array[$index]['bbs_res_row_array'] = array_slice($bbs_row_array[$index]['bbs_res_row_array'], -1 * $bbs_res_display_max); // 省略件数を算出 $bbs_row_array[$index]['omission_num'] = $bbs_row_array[$index]['bbs_res_row_array_num'] - $bbs_res_display_max; } foreach ($bbs_row_array[$index]['bbs_res_row_array'] as $res_index => $bbs_res_row) { // 返信記事の投稿者 トップページURL $bbs_row_array[$index]['bbs_res_row_array'][$res_index]['top_page_url'] = $this->getControllerPath(DEFAULT_MODULE, DEFAULT_ACTION) . '&id=' . $bbs_res_row['user_community_id']; // 写真URL $bbs_row_array[$index]['bbs_res_row_array'][$res_index]['image_url'] = ACSUser::get_image_url($bbs_res_row['user_community_id'], 'thumb'); // 投稿日時 $bbs_row_array[$index]['bbs_res_row_array'][$res_index]['post_date'] = ACSLib::convert_pg_date_to_str($bbs_res_row['post_date']); //削除情報 $bbs_row_array[$index]['bbs_res_row_array'][$res_index]['delete_flag'] = ACSLib::get_boolean($bbs_res_row['res_delete_flag']); } } } // 親コミュニティ / サブコミュニティの情報を取得する $parent_community_row_array = ACSCommunity::get_parent_community_row_array($community_row['community_id']); foreach ($parent_community_row_array as $index => $parent_community_row) { $parent_community_row_array[$index]['top_page_url'] = $this->getControllerPath('Community', DEFAULT_ACTION) . '&community_id=' . $parent_community_row['community_id']; } $sub_community_row_array = ACSCommunity::get_sub_community_row_array($community_row['community_id']); foreach ($sub_community_row_array as $index => $sub_community_row) { $sub_community_row_array[$index]['top_page_url'] = $this->getControllerPath('Community', DEFAULT_ACTION) . '&community_id=' . $sub_community_row['community_id']; } //---- アクセス制御 ----// $role_array = ACSAccessControl::get_community_role_array($acs_user_info_row, $community_row); $bbs_row_array = ACSAccessControl::get_valid_row_array_for_community($acs_user_info_row, $role_array, $bbs_row_array); //----------------------// // 外部RSS情報 foreach ($bbs_row_array as $index => $bbs_row) { $external_rss_row = ACSExternalRSS::get_external_rss_row($bbs_row['bbs_id']); if ($external_rss_row) { if ($external_rss_row['rss_item_date'] != '') { // YYYY/MM/DD H:MM $external_rss_row['rss_item_date'] = ACSLib::convert_pg_date_to_str($external_rss_row['rss_item_date'], 0, 1, 0); } $bbs_row_array[$index]['external_rss_row'] = $external_rss_row; } } // ページング設定 $display_count = ACSSystemConfig::get_keyword_value(ACSMsg::get_mst('system_config_group', 'D02'), 'NEW_INFO_LIST_DISPLAY_MAX_COUNT'); $paging_info = $this->getPagingInfo($controller, $request, $bbs_row_array, $display_count); // set $this->setAttribute('is_community_member', $is_community_member); $this->setAttribute('is_community_admin', $is_community_admin); $this->setAttribute('action_url', $action_url); $this->setAttribute('community_top_page_url', $community_top_page_url); $this->setAttribute('bbs_thread_list_url', $bbs_thread_list_url); $this->setAttribute('select_trusted_community_url', $select_trusted_community_url); $this->setAttribute('search_bbs_url', $search_bbs_url); $this->setAttribute('get_external_rss_url', $get_external_rss_url); $this->setAttribute('bbs_rss_url', $bbs_rss_url); $this->setAttribute('community_row', $request->getAttribute('community_row')); $this->setAttribute('bbs_row_array', $bbs_row_array); $this->setAttribute('paging_info', $paging_info); $this->setAttribute('open_level_master_row_array', $request->getAttribute('open_level_master_row_array')); $this->setAttribute('parent_community_row_array', $parent_community_row_array); $this->setAttribute('sub_community_row_array', $sub_community_row_array); // ML送信チェック表示設定 if ($community_row['contents_row_array']['ml_status']['contents_value'] == 'ACTIVE') { $this->setAttribute('is_ml_active', TRUE); } // テンプレート $this->setScreenId("0001"); $this->setTemplate('BBS.tpl.php'); // エラーメッセージ $this->setAttribute('error_message', $this->getErrorMessage($controller, $request, $user)); if ($request->getParameter('move_id') == 3) { //ユーザ入力情報 $form = $user->getAttribute('new_form_obj'); // パブリックリリース 掲載終了日 $form['expire_date'] = ""; if ($form['expire_date'] != "") { $form['expire_date'] = ACSLib::convert_pg_date_to_str($form['expire_date'], false, false, false); } $this->setAttribute('form', $form); $this->setAttribute('move_id', $request->getParameter('move_id')); } return parent::execute(); }