function execute() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); $target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($request->getParameter('id')); $target_user_community_id = $request->getParameter('id'); $acs_user_info_row = $user->getAttribute('acs_user_info_row'); $target_user_community_folder_id = $request->getParameter('folder_id'); $target_file_id = $request->getParameter('file_id'); $file_history_id = $request->getParameter('file_history_id'); $view_mode = $request->getParameter('mode'); // ファイルダウンロード処理 $user_folder_obj = new ACSUserFolder($target_user_community_id, $acs_user_info_row, $target_user_community_folder_id); $folder_obj = $user_folder_obj->get_folder_obj(); // フォルダの公開範囲でアクセス制御 if (!$user_folder_obj->has_privilege($target_user_info_row)) { $controller->forward(SECURE_MODULE, SECURE_ACTION); return; } // ルートフォルダ直下のファイルは本人以外アクセス不可 $privilege_array = $this->getCredential(); if ($folder_obj->get_is_root_folder() && !in_array('USER_PAGE_OWNER', $privilege_array)) { $controller->forward(SECURE_MODULE, SECURE_ACTION); return; } $file_obj = ACSFile::get_file_info_instance($target_file_id); if ($view_mode == 'thumb') { $ret = $file_obj->view_image($file_history_id, $view_mode); } else { $file_obj->download_history_file($file_history_id, $view_mode); } }
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を取得 $target_user_community_id = $request->getParameter('id'); // 対象となるフォルダIDを取得 $target_user_community_folder_id = $request->getParameter('folder_id'); // 詳細情報を表示するフォルダIDを取得 $detail_user_community_folder_id = $request->getParameter('detail_folder_id'); // 表示するページの所有者情報取得 $target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($target_user_community_id); // フォルダ情報取得 $user_folder_obj = new ACSUserFolder($target_user_community_id, $acs_user_info_row, $target_user_community_folder_id); $detail_user_folder_obj = new ACSUserFolder($target_user_community_id, $acs_user_info_row, $detail_user_community_folder_id); // フォルダの公開範囲でアクセス制御 if (!$detail_user_folder_obj->has_privilege($target_user_info_row)) { $controller->forward(SECURE_MODULE, SECURE_ACTION); return; } // set $request->setAttribute('target_user_info_row', $target_user_info_row); $request->setAttribute('user_folder_obj', $user_folder_obj); $request->setAttribute('detail_user_folder_obj', $detail_user_folder_obj); 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を取得 $target_user_community_id = $request->getParameter('id'); // 対象となるフォルダIDを取得 $target_user_community_folder_id = $request->getParameter('folder_id'); // 詳細情報を表示するファイルIDを取得 $file_id = $request->getParameter('file_id'); // 表示するページの所有者情報取得 $target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($target_user_community_id); // フォルダ情報取得 $user_folder_obj = new ACSUserFolder($target_user_community_id, $acs_user_info_row, $target_user_community_folder_id); $folder_obj = $user_folder_obj->get_folder_obj(); // フォルダの公開範囲でアクセス制御 if (!$user_folder_obj->has_privilege($target_user_info_row)) { $controller->forward(SECURE_MODULE, SECURE_ACTION); return; } // ルートフォルダ直下のファイルは本人以外アクセス不可 $privilege_array = $this->getCredential(); //if ($folder_obj->get_is_root_folder() && !in_array('USER_PAGE_OWNER', $privilege_array)) { if ($folder_obj->get_is_root_folder() && !$this->get_execute_privilege()) { $controller->forward(SECURE_MODULE, SECURE_ACTION); return; } // ファイル情報取得 $file_obj = ACSFile::get_file_info_instance($file_id); // ファイルの詳細情報 $file_detail_info_row = ACSFileDetailInfo::get_file_detail_info_row($file_id); // ファイルの履歴情報 $file_history_row_array = ACSFileHistory::get_file_history_row_array($file_id); // ファイル履歴ごとのコメント foreach ($file_history_row_array as $index => $file_history_row) { $file_history_row_array[$index]['file_history_comment_row_array'] = ACSFileHistoryComment::get_file_history_comment_row_array($file_history_row['file_history_id']); } // ファイルアクセス履歴登録 if ($acs_user_info_row['is_acs_user']) { ACSFile::set_file_access_history($acs_user_info_row['user_community_id'], $file_id); } // 足跡情報取得 $footprint_url = $this->getControllerPath('User', 'FileDetail') . "&id=" . $target_user_community_id . "&file_id=" . $file_obj->get_file_id() . "&folder_id=" . $user_folder_obj->folder_obj->get_folder_id(); $where = "foot.contents_link_url = '" . $footprint_url . "'"; $where .= " AND foot.visitor_community_id = '" . $acs_user_info_row['user_community_id'] . "'"; $footprint_info = ACSUser::get_footprint_list($target_user_community_id, $where); // set $request->setAttribute('target_user_info_row', $target_user_info_row); $request->setAttribute('file_obj', $file_obj); $request->setAttribute('user_folder_obj', $user_folder_obj); $request->setAttribute('file_detail_info_row', $file_detail_info_row); $request->setAttribute('file_history_row_array', $file_history_row_array); $request->setAttribute('footprint_info', $footprint_info); return View::SUCCESS; }
/** * 初期画面 * GETメソッドの場合、呼ばれる */ function getDefaultView() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); /* エラーを取得 */ //$error_row = $user->getAttribute('error_row'); //$user->removeAttribute('error_row'); $target_user_community_id = $request->getParameter('id'); $acs_user_info_row = $user->getAttribute('acs_user_info_row'); $target_user_community_folder_id = $request->getParameter('folder_id'); $mode = $request->getParameter('mode'); // 表示モード $user_folder_obj = new ACSUserFolder($target_user_community_id, $acs_user_info_row, $target_user_community_folder_id); $target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($request->getParameter('id')); // グループ表示 $file_detail_info_row_array = array(); if ($mode == 'group') { // ファイルオブジェクトの配列 $target_folder_obj = $user_folder_obj->get_folder_obj(); $file_obj_array = $target_folder_obj->get_file_obj_array(); foreach ($file_obj_array as $file_obj) { $file_detail_info_row = ACSFileDetailInfo::get_file_detail_info_row($file_obj->get_file_id()); if (!$file_detail_info_row['file_id']) { // ファイル詳細情報が設定されてない場合 $file_detail_info_row['file_id'] = $file_obj->get_file_id(); } $file_detail_info_row['display_file_name'] = $file_obj->get_display_file_name(); $file_detail_info_row['thumbnail_server_file_name'] = $file_obj->get_thumbnail_server_file_name(); array_push($file_detail_info_row_array, $file_detail_info_row); } // ファイルカテゴリコードごとのファイルコンテンツ種別の連想配列を取得する $file_contents_type_master_row_array_array = ACSFileDetailInfo::get_file_contents_type_master_row_array_array(); } // フォルダの公開範囲でアクセス制御 if (!$user_folder_obj->has_privilege($target_user_info_row)) { $controller->forward(SECURE_MODULE, SECURE_ACTION); return; } $request->setAttribute('target_user_info_row', $target_user_info_row); $request->setAttribute('user_folder_obj', $user_folder_obj); $request->setAttribute('error_row', $error_row); $request->setAttribute('mode', $mode); if ($mode == 'group') { $request->setAttribute('file_detail_info_row_array', $file_detail_info_row_array); $request->setAttribute('file_contents_type_master_row_array_array', $file_contents_type_master_row_array_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'); $target_user_community_id = $request->getParameter('id'); $target_user_community_folder_id = $request->getParameter('folder_id'); // form $form = $request->ACSGetParameters(); /* ファイルアップロード処理 */ $ret = 0; if ($_FILES['new_file']['tmp_name'] != '') { // ファイル情報取得 $file_obj = ACSFile::get_upload_file_info_instance($_FILES['new_file'], $target_user_community_id, $acs_user_info_row['user_community_id']); // フォルダにファイル追加処理 $user_folder_obj = new ACSUserFolder($target_user_community_id, $acs_user_info_row, $target_user_community_folder_id); $folder_obj = $user_folder_obj->get_folder_obj(); $ret = $folder_obj->add_file($file_obj); } if (!$ret) { print "ERROR: Upload file failed."; } if ($ret) { // 新規登録したファイルID $file_id = $file_obj->get_file_id(); } // ファイル履歴情報登録 if ($ret) { $file_info_row = ACSFileInfoModel::select_file_info_row($file_id); $ret = ACSFileHistory::set_file_history($file_info_row, $acs_user_info_row['user_community_id'], $form['comment'], ACSMsg::get_mst('file_history_operation_master', 'D0101')); } // ファイル詳細情報登録 if ($form['file_category_code'] != '' && $ret) { $file_contents_type_list_row_array = ACSFileDetailInfo::get_file_contents_type_list_row_array($form['file_category_code']); $file_contents_form_array = array(); foreach ($file_contents_type_list_row_array as $file_contents_type_list_row) { $file_contents_form = array('file_id' => $file_id, 'file_contents_type_code' => $file_contents_type_list_row['file_contents_type_code'], 'file_contents_value' => $form['file_contents_array'][$file_contents_type_list_row['file_contents_type_code']]); array_push($file_contents_form_array, $file_contents_form); } $ret = ACSFileDetailInfo::set_file_detail_info($file_id, $form['file_category_code'], $file_contents_form_array); } // フォルダ表示アクション呼び出し $acs_user_info_row = $user->getAttribute('acs_user_info_row'); $folder_action = $this->getControllerPath('User', 'Folder'); $folder_action .= '&id=' . $target_user_community_id; $folder_action .= '&folder_id=' . $target_user_community_folder_id; header("Location: {$folder_action}"); }
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'); $target_community_id = $request->getParameter('community_id'); $target_community_folder_id = $request->getParameter('folder_id'); $file_id = $request->getParameter('file_id'); $file_history_id = $request->getParameter('file_history_id'); // アクセス制御 // プットフォルダ、ファイルはNG $file_obj = ACSFile::get_file_info_instance($file_id); if ($file_obj->get_owner_community_id() != $target_community_id) { $controller->forward(SECURE_MODULE, SECURE_ACTION); return; //return VIEW_NONE; } $file_info_row = ACSFileInfoModel::select_file_info_row($file_id); $file_history_row = ACSFileHistory::get_file_history_row($file_history_id); // form $form = $request->ACSGetParameters(); // ファイル復活処理 // フォルダobj $community_folder_obj = new ACSUserFolder($target_community_id, $acs_user_info_row, $target_community_folder_id); $folder_obj = $community_folder_obj->get_folder_obj(); // file_info更新 $ret = $folder_obj->restore_history_file($file_info_row, $file_history_row); if (!$ret) { print "ERROR: Restore file failed."; } // ファイル履歴情報登録 if ($ret) { $file_info_row = ACSFileInfoModel::select_file_info_row($file_id); $ret = ACSFileHistory::set_file_history($file_info_row, $acs_user_info_row['user_community_id'], $form['comment'], ACSMsg::get_msg('Community', '', 'M001')); } // ファイル詳細情報へ遷移 $file_detail_url = $this->getControllerPath('Community', 'FileDetail'); $file_detail_url .= '&community_id=' . $target_community_id; $file_detail_url .= '&file_id=' . $file_id; $file_detail_url .= '&folder_id=' . $target_community_folder_id; header("Location: {$file_detail_url}"); //return VIEW_NONE; }
function execute() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); $acs_user_info_row = $user->getAttribute('acs_user_info_row'); $target_user_community_id = $request->getParameter('id'); $target_user_community_folder_id = $request->getParameter('folder_id'); $file_id = $request->getParameter('file_id'); if (!$this->get_execute_privilege()) { $controller->forward(SECURE_MODULE, SECURE_ACTION); return; } // form $form = $request->ACSGetParameters(); // ファイル更新処理 if ($_FILES['new_file']['tmp_name'] != '') { // ファイルobj $file_obj = ACSFile::get_upload_file_info_instance_for_update($_FILES['new_file'], $target_user_community_id, $acs_user_info_row['user_community_id'], $file_id); // フォルダobj $user_folder_obj = new ACSUserFolder($target_user_community_id, $acs_user_info_row, $target_user_community_folder_id); $folder_obj = $user_folder_obj->get_folder_obj(); // ファイル履歴が1件も登録されていない場合は"作成"を登録する $file_history_row_array = ACSFileHistory::get_file_history_row_array($file_id); if (count($file_history_row_array) == 0) { $file_info_row = ACSFileInfoModel::select_file_info_row($file_id); $file_history_id = ACSFileHistory::set_file_history($file_info_row, $file_info_row['entry_user_community_id'], '', ACSMsg::get_mst('file_history_operation_master', 'D0101')); } // file_info更新, ファイル保存 $ret = $folder_obj->update_file($file_obj); } if (!$ret) { print "ERROR: Upload file failed."; } // ファイル履歴情報登録 if ($ret) { $file_info_row = ACSFileInfoModel::select_file_info_row($file_id); $ret = ACSFileHistory::set_file_history($file_info_row, $acs_user_info_row['user_community_id'], $form['comment'], ACSMsg::get_mst('file_history_operation_master', 'D0201')); } // ファイル詳細情報へ遷移 $file_detail_url = $this->getControllerPath('User', 'FileDetail'); $file_detail_url .= '&id=' . $target_user_community_id; $file_detail_url .= '&file_id=' . $file_id; $file_detail_url .= '&folder_id=' . $target_user_community_folder_id; header("Location: {$file_detail_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'); // 対象となるユーザコミュニティIDを取得 $user_community_id = $request->ACSgetParameter('id'); // 対象となるフォルダIDを取得 $target_folder_id = $request->ACSgetParameter('folder_id'); // ACSUserFolder インスタンス生成 $user_folder_obj = new ACSUserFolder($user_community_id, $acs_user_info_row, $target_folder_id); $target_folder_obj = $user_folder_obj->get_folder_obj(); // 選択された community_id, folder_id を取得 $selected_put_folder_row_array = $request->getParameter('selected_put_folder_id'); // ---------------------------- // 更新用にデータ加工 // プット先コミュニティ更新用に、row_array 作成 $put_community_row_array = array(); foreach ($selected_put_folder_row_array as $community_id => $folder_id) { array_push($put_community_row_array, array('put_community_id' => $community_id, 'put_community_folder_id' => $folder_id)); } // ---------------------------- // 更新処理 $ret = $target_folder_obj->update_put_community($target_folder_id, $put_community_row_array); if (!$ret) { print "ERROR: Update put-community failed.<br>\n"; exit; } // ML通知チェックがあればMLにメール送信する // コミュニティ情報の取得 $send_announce_mail = $request->getParameter('send_announce_mail'); if ($send_announce_mail == "t") { foreach ($selected_put_folder_row_array as $community_id => $folder_id) { $folder_info = ACSFolderModel::select_folder_row($folder_id); ACSCommunityMail::send_putfolder_mail($acs_user_info_row, $folder_info, $community_id); } } // 処理が終わったら、ウィンドウを閉じる $controller->forward('Common', 'CloseChildWindow'); }
/** * 表示対象コミュニティの全フォルダリストセット * * @param $community_id */ function set_all_community_folders_obj_array($community_id) { parent::set_all_community_folders_obj_array($community_id); // パス順に取得 $target_folder_obj = $this->get_folder_obj(); // プットフォルダの場合 // プットされているフォルダまで検索 if ($target_folder_obj->is_put_folder($this->get_community_id())) { $add_folder_obj_array = array(); // プットされているフォルダのユーザフォルダ内のパスを格納 // プットされているフォルダのユーザフォルダを取得 $put_folder_obj = new ACSUserFolder($target_folder_obj->get_community_id(), $target_folder_obj->get_acs_user_info_row(), $target_folder_obj->get_folder_id()); // プットされているフォルダのユーザフォルダ内のパスを取得 // 1階層目のフォルダしかプットできないため、1階層目のフォルダ以降のパスを取得 $add_folder_obj_array = array_slice($put_folder_obj->get_path_folder_obj_array(), 1); } //_debug($add_folder_obj_array); //_debug($this->all_community_folders_obj_array); if ($this->all_community_folders_obj_array == NULL || $add_folder_obj_array == NULL) { return; } $this->all_community_folders_obj_array = array_merge($this->all_community_folders_obj_array, $add_folder_obj_array); //_debug($this->all_community_folders_obj_array); }
/** * マイフレンズの新着フォルダ情報を取得する * * @param $user_community_id ユーザコミュニティID (ダイアリーへのアクセス者となるユーザ) * @return 新着フォルダ一覧 (連想配列の配列) */ function get_new_friends_folder_row_array($user_community_id) { // マイフレンズのユーザコミュニティIDのCSVを作成する // マイフレンズの取得 $friends_row_array = ACSUser::get_simple_friends_row_array($user_community_id); // マイフレンズの条件csv文字列取得 $csv_string = ACSLib::get_csv_string_from_array($friends_row_array, 'user_community_id'); // マイフレンズフォルダの新着情報を取得 $row_array = ACSUserFolder::get_new_folder_row_array($user_community_id, $csv_string); return $row_array; }
/** * 入力画面表示 */ 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を取得 $target_user_community_id = $request->getParameter('id'); // 対象となるフォルダIDを取得 $target_user_community_folder_id = $request->getParameter('folder_id'); $edit_folder_id = $request->getParameter('edit_folder_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($target_user_community_id); // フォルダ情報取得 $user_folder_obj = new ACSUserFolder($target_user_community_id, $acs_user_info_row, $target_user_community_folder_id); // 作成・更新の判別 if ($request->getParameter('edit_folder_id')) { $edit_folder_id = $request->getParameter('edit_folder_id'); $view_mode = 'update'; } else { $view_mode = 'create'; } // set $request->setAttribute('target_user_info_row', $target_user_info_row); $request->setAttribute('user_folder_obj', $user_folder_obj); $request->setAttribute('view_mode', $view_mode); $request->setAttribute('edit_folder_id', $edit_folder_id); // エラーで呼ばれた場合は、入力値を取得 // hasErrors 関数作成? if ($this->hasErrors($controller, $request, $user)) { // デフォルト値として表示する値を row にセット $default_data_row['folder_id'] = $request->getParameter('folder_id'); $default_data_row['folder_name'] = $request->getParameter('folder_name'); $default_data_row['comment'] = $request->getParameter('comment'); $default_data_row['open_level_code'] = $request->getParameter('open_level_code'); $default_data_row['trusted_community_flag'] = $request->getParameter('trusted_community_flag'); $default_data_row['trusted_community_id_array'] = $request->getParameter('trusted_community'); // set $request->setAttribute('default_data_row', $default_data_row); return View::INPUT; } // 更新の場合は、更新対象のフォルダIDを取得 if ($view_mode == 'update') { // 初期表示の場合、更新対象のフォルダ情報取得 if (!$this->hasErrors($controller, $request, $user)) { // 更新対象のフォルダ情報取得 $update_user_folder_obj = new ACSUserFolder($request->getParameter('id'), $acs_user_info_row, $edit_folder_id); $update_folder_obj = $update_user_folder_obj->get_folder_obj(); // 閲覧許可コミュニティID取得 $trusted_community_id_array = array(); foreach ($update_folder_obj->get_trusted_community_row_array() as $trusted_community_row) { array_push($trusted_community_id_array, $trusted_community_row['community_id']); } // デフォルト値として表示する値を row にセット $default_data_row['folder_id'] = $update_folder_obj->get_folder_id(); $default_data_row['folder_name'] = $update_folder_obj->get_folder_name(); $default_data_row['comment'] = $update_folder_obj->get_comment(); $default_data_row['open_level_code'] = $update_folder_obj->get_open_level_code(); $default_data_row['trusted_community_flag'] = ""; // view で値を判断する $default_data_row['trusted_community_id_array'] = $trusted_community_id_array; $request->setAttribute('default_data_row', $default_data_row); } // set $request->setAttribute('input_data_row', $input_data_row); return View::INPUT; } elseif ($view_mode == 'create') { return View::INPUT; } }
function execute() { $context =& $this->getContext(); $controller = $context->getController(); $user = $context->getUser(); $request = $context->getRequest(); $acs_user_info_row = $user->getAttribute('acs_user_info_row'); // 対象となるユーザコミュニティIDを取得 $user_community_id = $request->ACSgetParameter('id'); if ($user_community_id == null || $user_community_id == '') { $user_community_id = $request->getAttribute("id"); } // 他ユーザのデータが見えないようチェック if (!$this->get_execute_privilege() && $acs_user_info_row["user_community_id"] != $user_community_id) { // このページへアクセスすることはできません。 $controller->forward(SECURE_MODULE, SECURE_ACTION); return; } // インライン表示の場合: 1(true) $inline_mode = $request->ACSgetParameter('inline_mode'); if ($inline_mode == null || $inline_mode == '') { $inline_mode = $request->getAttribute("inline_mode"); } // 取得範囲の指定 $get_days = ACSSystemConfig::get_keyword_value(ACSMsg::get_mst('system_config_group', 'D02'), $inline_mode ? 'NEW_INFO_TOP_TERM' : 'NEW_INFO_LIST_TERM'); $request->setAttribute('get_days', $get_days); // マイフレンズの新着ファイル一覧を取得する if ($inline_mode) { $new_file_row_array = ACSUserFolder::get_new_friends_file_row_array($user_community_id, $get_days, true); } else { $new_file_row_array = ACSUserFolder::get_new_friends_file_row_array($user_community_id, $get_days); } // 表示件数取得 if ($inline_mode) { $display_count = ACSSystemConfig::get_keyword_value(ACSMsg::get_mst('system_config_group', 'D02'), 'NEW_INFO_TOP_DISPLAY_MAX_COUNT'); } else { $display_count = count($new_file_row_array); } $request->setAttribute('display_count', $display_count); // // マイページ新着、新着一覧ともに表示件数分の情報を取得 // $rec_cnt = 0; $_new_file_row_array = array(); foreach ($new_file_row_array as $index => $new_file_row) { // 表示件数に達している場合は終了 if ($rec_cnt >= $display_count) { break; } $target_folder_obj = new ACSUserFolder($new_file_row['owner_community_id'], $acs_user_info_row, $new_file_row['folder_id']); $target_file_obj = new ACSFile($new_file_row); $new_file_row['is_root_folder'] = $target_folder_obj->folder_obj->get_is_root_folder(); // 公開レベル $new_file_row['open_level_code'] = $target_folder_obj->folder_obj->get_open_level_code(); $new_file_row['open_level_name'] = $target_folder_obj->folder_obj->get_open_level_name(); $open_level_master_row = ACSAccessControl::get_open_level_master_row($new_file_row['open_level_code']); $new_file_row = array_merge($new_file_row, $open_level_master_row); $new_file_row['trusted_community_row_array'] = $target_folder_obj->folder_obj->get_trusted_community_row_array(); // パス $path_folder_obj_array = $target_folder_obj->get_path_folder_obj_array(); $path_array = array(); foreach ($path_folder_obj_array as $path_folder_obj_index => $path_folder_obj) { if ($path_folder_obj_index != 0) { array_push($path_array, $path_folder_obj->get_folder_name()); } } array_push($path_array, $new_file_row['display_file_name']); $new_file_row['path_array'] = $path_array; // // アクセス権限の判定 // $is_access_ok = TRUE; // マイフレンズは本人以外なのでis_root_folderのファイルを閲覧できない if ($new_file_row['is_root_folder']) { $is_access_ok = FALSE; // ファイルのアクセス権限をチェックする } else { // ファイルのオーナー情報取得 $target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($new_file_row['owner_community_id']); // 権限情報取得 $role_array = ACSAccessControl::get_user_community_role_array($acs_user_info_row, $target_user_info_row); // アクセス判定 if (!ACSAccessControl::is_valid_user_for_user_community($acs_user_info_row, $role_array, $new_file_row)) { $is_access_ok = FALSE; } } if ($is_access_ok) { // ファイル詳細情報URL $new_file_row['file_detail_url'] = $this->getControllerPath(DEFAULT_MODULE, 'FileDetail') . '&id=' . $new_file_row['owner_community_id'] . '&folder_id=' . $new_file_row['folder_id'] . '&file_id=' . $new_file_row['file_id']; $new_file_row['is_unread'] = ACSLib::get_boolean($new_file_row['is_unread']); array_push($_new_file_row_array, $new_file_row); $rec_cnt = $rec_cnt + 1; } } $new_file_row_array = $_new_file_row_array; // set $request->setAttribute('user_community_id', $user_community_id); $request->setAttribute('new_file_row_array', $new_file_row_array); if ($inline_mode) { return View::INPUT; } else { 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'); // get $user_community_id = $request->ACSgetParameter('id'); $target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($request->getParameter('id')); $form = $request->ACSgetParameters(); // 検索時 if ($form['search']) { $folder_row_array = array(); $file_info_row_array = array(); // フォルダ検索 if ($form['target'] != 'file') { $folder_row_array = ACSUserFolder::search_folder_row_array($user_community_id, $form); } // ファイル検索 if ($form['target'] != 'folder') { $file_info_row_array = ACSUserFolder::search_file_info_row_array($user_community_id, $form); } foreach ($folder_row_array as $index => $folder_row) { $target_folder_obj = new ACSUserFolder($user_community_id, $acs_user_info_row, $folder_row['folder_id']); $folder_row_array[$index]['update_date'] = $target_folder_obj->folder_obj->get_update_date_yyyymmddhmi(); // 公開レベル $folder_row_array[$index]['open_level_code'] = $target_folder_obj->folder_obj->get_open_level_code(); $folder_row_array[$index]['open_level_name'] = $target_folder_obj->folder_obj->get_open_level_name(); $open_level_master_row = ACSAccessControl::get_open_level_master_row($folder_row_array[$index]['open_level_code']); $folder_row_array[$index] = array_merge($folder_row_array[$index], $open_level_master_row); $folder_row_array[$index]['trusted_community_row_array'] = $target_folder_obj->folder_obj->get_trusted_community_row_array(); // パス $path_folder_obj_array = $target_folder_obj->get_path_folder_obj_array(); $path_array = array(); foreach ($path_folder_obj_array as $path_folder_obj_index => $path_folder_obj) { if ($path_folder_obj_index != 0) { array_push($path_array, $path_folder_obj->get_folder_name()); } } $folder_row_array[$index]['path_array'] = $path_array; } foreach ($file_info_row_array as $index => $file_info_row) { $target_folder_obj = new ACSUserFolder($user_community_id, $acs_user_info_row, $file_info_row['folder_id']); $target_file_obj = new ACSFile($file_info_row); $file_info_row_array[$index]['file_size'] = $target_file_obj->get_file_size_kb(); $file_info_row_array[$index]['update_date'] = $target_file_obj->get_update_date_yyyymmddhmi(); $file_info_row_array[$index]['is_root_folder'] = $target_folder_obj->folder_obj->get_is_root_folder(); // 公開レベル $file_info_row_array[$index]['open_level_code'] = $target_folder_obj->folder_obj->get_open_level_code(); $file_info_row_array[$index]['open_level_name'] = $target_folder_obj->folder_obj->get_open_level_name(); $open_level_master_row = ACSAccessControl::get_open_level_master_row($file_info_row_array[$index]['open_level_code']); $file_info_row_array[$index] = array_merge($file_info_row_array[$index], $open_level_master_row); $file_info_row_array[$index]['trusted_community_row_array'] = $target_folder_obj->folder_obj->get_trusted_community_row_array(); // パス $path_folder_obj_array = $target_folder_obj->get_path_folder_obj_array(); $path_array = array(); foreach ($path_folder_obj_array as $path_folder_obj_index => $path_folder_obj) { if ($path_folder_obj_index != 0) { array_push($path_array, $path_folder_obj->get_folder_name()); } } array_push($path_array, $file_info_row['display_file_name']); $file_info_row_array[$index]['path_array'] = $path_array; } } // set $request->setAttribute('target_user_info_row', $target_user_info_row); $request->setAttribute('form', $form); $request->setAttribute('folder_row_array', $folder_row_array); $request->setAttribute('file_info_row_array', $file_info_row_array); return View::INPUT; }
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 = $acs_user_info_row['user_community_id']; // ワークディレクトリの作成(存在しない場合) $work_dir = ACS_CONTENTS_BACKUP_DIR; ACSLib::make_dir($work_dir); $work_dir .= $user_community_id . '/'; ACSLib::make_dir($work_dir); $work_dir .= ACS_BACKUP_ZIP_DIR_NAME; ACSLib::make_dir($work_dir); // バックアップ用ZIPクラスの生成 $zip = new ACSZip($work_dir); // Folder, Diary ディレクトリを作成しておく(0件対応) ACSLib::make_dir($work_dir . '/' . ACS_BACKUP_MYFOLDER_SUBDIR_NAME); ACSLib::make_dir($work_dir . '/' . ACS_BACKUP_MYDIARY_SUBDIR_NAME); // ----- マイフォルダバックアップコンテンツの生成 // フォルダ取得用の配列を設定 $form = array('q' => '', 'order' => 'name'); // フォルダの取得 $folder_row_array = ACSUserFolder::search_folder_row_array($user_community_id, $form); // パス情報の設定 foreach ($folder_row_array as $index => $folder_row) { $target_folder_obj = new ACSUserFolder($user_community_id, $acs_user_info_row, $folder_row['folder_id']); // パス $path_folder_obj_array = $target_folder_obj->get_path_folder_obj_array(); $path_array = array(); foreach ($path_folder_obj_array as $path_folder_obj_index => $path_folder_obj) { if ($path_folder_obj_index != 0) { array_push($path_array, $path_folder_obj->get_folder_name()); } } // ディレクトリを作成(空ディレクトリ対応) $zip->make_dir(ACS_BACKUP_MYFOLDER_SUBDIR_NAME . '/' . implode("/", $path_array), ACS_BACKUP_NAME_ENCODING); } // ファイルの取得 $file_info_row_array = ACSUserFolder::search_file_info_row_array($user_community_id, $form); // パス情報の設定 foreach ($file_info_row_array as $index => $file_info_row) { $target_folder_obj = new ACSUserFolder($user_community_id, $acs_user_info_row, $file_info_row['folder_id']); // パス $path_folder_obj_array = $target_folder_obj->get_path_folder_obj_array(); $path_array = array(); foreach ($path_folder_obj_array as $path_folder_obj_index => $path_folder_obj) { if ($path_folder_obj_index != 0) { array_push($path_array, $path_folder_obj->get_folder_name()); } } array_push($path_array, $file_info_row['display_file_name']); $file_info_row_array[$index]['path_array'] = $path_array; } // マイフォルダのフォルダ構成でファイルを配置 $dest_path_array = array(); foreach ($file_info_row_array as $file_info_row) { $from_path = ACS_FOLDER_DIR . $file_info_row['server_file_name']; $dest_path = ACS_BACKUP_MYFOLDER_SUBDIR_NAME . '/' . implode("/", $file_info_row['path_array']); // 同一名ファイル時の連番付加対応 $dest_path_array[$dest_path]++; if ($dest_path_array[$dest_path] > 1) { $count = $dest_path_array[$dest_path]; mb_ereg('.*(\\.[^\\.\\/]*$)', $dest_path, $matches); $ext = $matches[1]; if ($ext) { $dest_path = mb_ereg_replace('\\.[^\\.\\/]*$', '', $dest_path); } $dest_path .= '_' . ($count - 1) . $ext; } $zip->entry($from_path, $dest_path, ACS_BACKUP_NAME_ENCODING); } // ----- マイダイアリバックアップコンテンツの生成 $diary_backup = new ACSDiaryBackup($user_community_id, $work_dir . '/' . ACS_BACKUP_MYDIARY_SUBDIR_NAME); $diary_backup->make_contents(ACS_BACKUP_NAME_ENCODING); // ダウンロード時ZIPファイル名の生成 $download_filename = 'ACSBackup_' . date('Ymd', time()) . '.zip'; // バックアップzipアーカイブの作成(zip圧縮の実行) $zip->commpress(); $zip->download($download_filename); // 不必要なワークファイルの削除 $zip->clear_work_dir_and_files(); }
function &getPutFolderRows(&$acs_user_info_row, &$folder_row) { $put_community_id = $folder_row['put_community_id']; $put_folder_rows = array(); // 2階層以上深い階層のputファイルの場合 // (put先のコミュニティフォルダが取得できていない) // (put先が複数の場合あり) if ($put_community_id == '') { // ユーザフォルダobj取得 $user_folder_obj = new ACSUserFolder($folder_row['owner_community_id'], $acs_user_info_row, $folder_row['folder_id']); // パス情報取得 $path_folder_obj_array = $user_folder_obj->get_path_folder_obj_array(); // 第1階層フォルダID取得 $second_folder_obj =& $path_folder_obj_array[1]; // 第1階層フォルダからプット先のコミュニティ情報を取得(複数の場合有) $put_community_array =& $second_folder_obj->get_put_community_row_array(); foreach ($put_community_array as $put_community) { $add_folder_row = $folder_row; $add_folder_row['url_community_id'] = $put_community['community_id']; $add_folder_row['url_folder_id'] = $folder_row['folder_id']; $add_folder_row['community_name'] = $put_community['community_name']; $put_folder_rows[] = $add_folder_row; } // 1階層目のputファイルの場合 // (put先のコミュニティフォルダが取得できている) } else { // バッファにコミュニティ名が無い場合は問い合わせる if ($this->community_name_buffer[$put_community_id] == '') { $community_row =& ACSCommunity::get_community_row($put_community_id); $this->community_name_buffer[$put_community_id] = $community_row['community_name']; } // 表示用にコミュニティ名を設定しておく $folder_row['community_name'] = $this->community_name_buffer[$put_community_id]; $folder_row['url_community_id'] = $folder_row['put_community_id']; $folder_row['url_folder_id'] = $folder_row['put_community_folder_id']; $put_folder_rows = array($folder_row); } return $put_folder_rows; }