/**
  * 表示対象コミュニティの全フォルダリストセット
  *
  * @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);
 }
 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');
     // 更新対象となるユーザコミュニティ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 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 &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;
 }