3 * ¥³¥ß¥å¥Ë¥Æ¥£¤Î¥Õ¥©¥ë¥Àɽ¼¨
6 * @version $Revision: 1.20 $ $Date: 2006/12/08 05:06:37 $
8 class FolderSuccessView extends BaseView
11 $context = $this->getContext();
12 $controller = $context->getController();
13 $request = $context->getRequest();
14 $user = $context->getUser();
16 $acs_user_info_row = $user->getAttribute('acs_user_info_row');
17 $target_community_row = $request->getAttribute('target_community_row');
18 $community_folder_obj = $request->getAttribute('community_folder_obj');
19 $target_folder_obj = $community_folder_obj->get_folder_obj();
20 $folder_obj_array = $target_folder_obj->get_folder_obj_array();
21 $file_obj_array = $target_folder_obj->get_file_obj_array();
23 $mode = $request->getAttribute('mode');
24 if ($mode == 'group') {
25 $file_detail_info_row_array = $request->getAttribute('file_detail_info_row_array');
26 $file_contents_type_master_row_array_array = $request->getAttribute('file_contents_type_master_row_array_array');
30 // URL ¤ËÉղ乤ë target_community
31 $target_community_info = '&community_id=' . $target_community_row['community_id'];
32 // URL ¤ËÉղ乤ë target_folder
33 $target_folder_info = '&folder_id=' . $target_folder_obj->get_folder_id();
36 $community_top_page_url = $this->getControllerPath('Community', 'Index');
37 $community_top_page_url .= $target_community_info;
40 $path_folder_obj_array = $community_folder_obj->get_path_folder_obj_array();
42 $path_folder_obj_row_array = $this->make_display_folder_row_array($path_folder_obj_array, $target_community_info, $target_folder_info, $target_community_row, $mode, $controller);
45 $target_folder_open_level_row['name'] = $target_folder_obj->get_open_level_name();
46 $target_folder_open_level_row['trusted_community_row_array'] = $this->make_display_trusted_community_row_array($target_folder_obj->get_trusted_community_row_array(), &$controller);
48 // ¥³¥ß¥å¥Ë¥Æ¥£¥á¥ó¥Ð¤«¤É¤¦¤«
49 $is_community_member = ACSCommunity::is_community_member($acs_user_info_row['user_community_id'],
50 $target_community_row['community_id']);
52 // ¥ë¡¼¥È¥Õ¥©¥ë¥À¤«¤É¤¦¤«
53 $is_root_folder = $target_folder_obj->get_is_root_folder();
55 // ¥×¥Ã¥È¥Õ¥©¥ë¥À¤«¤É¤¦¤«
56 $is_put_folder = $target_folder_obj->is_put_folder($target_community_row['community_id']);
58 // ¥Õ¥¡¥¤¥ë¥¢¥Ã¥×¥í¡¼¥É URL
59 $upload_file_url = $this->getControllerPath('Community',
61 $upload_file_url .= $target_community_info;
62 $upload_file_url .= $target_folder_info;
64 /* ¥Õ¥©¥ë¥À¡¦¥Õ¥¡¥¤¥ë°ìÍ÷ */
66 $display_folder_obj_array = $target_folder_obj->get_display_folder_obj_array_for_community($acs_user_info_row, $target_community_row);
67 $folder_row_array = $this->make_display_folder_row_array($display_folder_obj_array, $target_community_info, $target_folder_info, $target_community_row, $mode, $controller);
70 if ($mode == 'group') {
72 // ¥Õ¥¡¥¤¥ë¥«¥Æ¥´¥ê¥Þ¥¹¥¿
73 $file_category_master_array = ACSDB::get_master_array('file_category');
75 // »ØÄê¤Ê¤·¤Î¥Õ¥¡¥¤¥ë¥«¥Æ¥´¥ê¥³¡¼¥É
76 $default_file_category_code = array_search(ACSMsg::get_mst('file_category_master','D0000'), $file_category_master_array);
78 $file_detail_info_row_array_array = array();
79 foreach ($file_category_master_array as $file_category_code => $file_category_name) {
80 $file_detail_info_row_array_array[$file_category_code] = array();
81 $file_detail_info_row_array_array[$file_category_code]['file_category_code'] = $file_category_code;
82 $file_detail_info_row_array_array[$file_category_code]['file_category_name'] = $file_category_name;
83 $file_detail_info_row_array_array[$file_category_code]['file_detail_info_row_array'] = array();
87 // Action¤Ç¼èÆÀ¤·¤¿$file_detail_info_row¤ÎÇÛÎó¤ò¡¢¥Õ¥¡¥¤¥ë¼ïÎॳ¡¼¥É¤´¤È¤ÎÇÛÎó¤Ë¿¶¤êʬ¤±¤ë
88 foreach ($file_detail_info_row_array as $file_detail_info_row) {
89 // ¥Õ¥¡¥¤¥ë¥«¥Æ¥´¥ê¥³¡¼¥É
90 $file_category_code = $file_detail_info_row['file_category_code'];
93 $file_detail_info_row['link_url'] = $this->getControllerPath('Community', 'DownloadFile')
94 . $target_community_info . '&file_id=' . $file_detail_info_row['file_id'] . $target_folder_info;
95 // ¥Õ¥¡¥¤¥ë¾ÜºÙ¾ðÊóURL
96 $file_detail_info_row['file_detail_url'] = $this->getControllerPath('Community', 'FileDetail')
97 . $target_community_info . '&file_id=' . $file_detail_info_row['file_id'] . $target_folder_info;
99 if ($file_category_master_array[$file_category_code] == ACSMsg::get_mst('file_category_master','D0003')) {
100 $file_detail_info_row['image_url'] = $this->getControllerPath('Community', 'DownloadFile')
101 . $target_community_info . '&file_id=' . $file_detail_info_row['file_id'] . $target_folder_info . '&mode=thumb';
105 if ($file_category_code == '') {
106 // ¥Õ¥¡¥¤¥ë¥«¥Æ¥´¥ê¥³¡¼¥É¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤Ï¥Ç¥Õ¥©¥ë¥È(»ØÄê¤Ê¤·)°·¤¤
107 $file_category_code = $default_file_category_code;
109 array_push($file_detail_info_row_array_array[$file_category_code]['file_detail_info_row_array'], $file_detail_info_row);
112 // ¥Õ¥©¥ë¥À Ä̾ïɽ¼¨URL
113 $folder_url = $this->getControllerPath('Community', 'Folder');
114 $folder_url .= $target_community_info;
115 $folder_url .= $target_folder_info;
119 $file_row_array = array();
120 foreach ($file_obj_array as $file_obj) {
123 $update_user_community_link_url = "";
125 $link_url = $this->getControllerPath('Community',
127 $link_url .= $target_community_info;
128 $link_url .= "&file_id=" . $file_obj->get_file_id();
129 $link_url .= $target_folder_info;
131 $update_user_community_link_url = $this->getControllerPath('User', 'Index');
132 $update_user_community_link_url .= "&id=" . $file_obj->get_update_user_community_id();
134 $a_file['name'] = $file_obj->get_display_file_name();
135 $a_file['file_id'] = $file_obj->get_file_id();
136 $a_file['link_url'] = $link_url;
137 $a_file['file_size'] = $file_obj->get_file_size_kb();
138 $a_file['update_user_community_name'] = $file_obj->get_update_user_community_name();
139 $a_file['update_user_community_link_url'] = $update_user_community_link_url;
140 $a_file['update_date'] = $file_obj->get_update_date_yyyymmddhmi();
142 // ¥Õ¥¡¥¤¥ë¾ÜºÙ¾ðÊóURL
143 $a_file['detail_url'] = $this->getControllerPath('Community', 'FileDetail');
144 $a_file['detail_url'] .= $target_community_info;
145 $a_file['detail_url'] .= "&file_id=" . $file_obj->get_file_id();
146 $a_file['detail_url'] .= $target_folder_info;
148 // ¥×¥Ã¥È¥Õ¥¡¥¤¥ë¤«¤É¤¦¤«
149 if ($file_obj->get_owner_community_id() == $target_community_row['community_id']) {
150 $a_file['is_put'] = false;
152 $a_file['is_put'] = true;
155 array_push($file_row_array, $a_file);
158 // ¥Õ¥©¥ë¥À ¥°¥ë¡¼¥×ɽ¼¨URL
159 $folder_group_mode_url = $this->getControllerPath('Community', 'Folder');
160 $folder_group_mode_url .= $target_community_info;
161 $folder_group_mode_url .= $target_folder_info;
162 $folder_group_mode_url .= '&mode=group';
165 // ¥ë¡¼¥È¥Õ¥©¥ë¥À¤Î¥Õ¥¡¥¤¥ë¤Ï¡¢Èó¸ø³«¤È¤·¤Æ°·¤¦
166 if ((!$is_community_member) && $is_root_folder) {
167 $file_row_array = array();
168 $file_detail_info_row_array_array = array();
172 if (!$is_put_folder) {
173 $edit_folder_url = $this->getControllerPath('Community', 'EditFolder');
174 $edit_folder_url .= $target_community_info;
175 $edit_folder_url .= $target_folder_info;
177 $edit_folder_url = "";
181 $rename_folder_url = "";
182 $rename_folder_url = $this->getControllerPath('Community', 'RenameFolderList');
183 $rename_folder_url .= $target_community_info;
184 $rename_folder_url .= $target_folder_info;
187 $delete_folder_url = "";
188 $delete_folder_url = $this->getControllerPath('Community', 'DeleteFolder');
189 $delete_folder_url .= $target_community_info;
190 $delete_folder_url .= $target_folder_info;
191 $delete_folder_url .= "&action_type=confirm"; // Á«°Ü¤¹¤ëÀè¤Î²èÌ̤ϳÎǧ²èÌÌ
194 $move_folder_url = "";
195 $move_folder_url = $this->getControllerPath('Community', 'MoveFolderList');
196 $move_folder_url .= $target_community_info;
197 $move_folder_url .= $target_folder_info;
199 // ¥³¥ß¥å¥Ë¥Æ¥£¥Õ¥©¥ë¥À¸¡º÷URL
200 $search_folder_url = $this->getControllerPath('Community', 'SearchFolder');
201 $search_folder_url .= $target_community_info;
203 $this->setAttribute('target_folder_open_level_row', $target_folder_open_level_row);
204 $this->setAttribute('community_top_page_url', $community_top_page_url);
205 $this->setAttribute('is_community_member', $is_community_member);
206 $this->setAttribute('is_root_folder', $is_root_folder);
207 $this->setAttribute('is_put_folder', $is_put_folder);
208 $this->setAttribute('upload_file_url', $upload_file_url);
209 $this->setAttribute('folder_put_community_url', $folder_put_community_url);
211 $this->setAttribute('target_user_community_name', $target_community_row['community_name']);
213 $this->setAttribute('path_folder_obj_row_array', $path_folder_obj_row_array);
214 $this->setAttribute('folder_row_array', $folder_row_array);
215 $this->setAttribute('file_row_array', $file_row_array);
218 $this->setAttribute('edit_folder_url', $edit_folder_url);
219 $this->setAttribute('rename_folder_url', $rename_folder_url);
220 $this->setAttribute('delete_folder_url', $delete_folder_url);
221 $this->setAttribute('move_folder_url', $move_folder_url);
222 $this->setAttribute('search_folder_url', $search_folder_url);
224 $this->setAttribute('mode', $mode);
225 if ($mode == 'group') {
226 $this->setAttribute('folder_url', $folder_url);
227 $this->setAttribute('file_detail_info_row_array_array', $file_detail_info_row_array_array);
228 $this->setAttribute('file_contents_type_master_row_array_array', $file_contents_type_master_row_array_array);
230 $this->setAttribute('folder_group_mode_url', $folder_group_mode_url);
234 $this->setAttribute('error_message', $this->getErrorMessage($controller, $request, $user));
237 if ($mode == 'group') {
238 $this->setScreenId("0001");
239 $this->setTemplate('Folder_group.tpl.php');
241 $this->setScreenId("0001");
242 $this->setTemplate('Folder.tpl.php');
245 return parent::execute();
248 function make_display_folder_row_array ($folder_obj_array,
249 $target_community_info,
251 $target_community_row,
254 $folder_row_array = array();
255 foreach ($folder_obj_array as $folder_obj) {
256 $folder_row = array();
259 $update_user_community_link_url = "";
261 $link_url = $this->getControllerPath('Community', 'Folder');
262 $link_url .= $target_community_info;
263 $link_url .= "&folder_id=" . $folder_obj->get_folder_id();
264 if ($mode == 'group') {
265 $link_url .= '&mode=' . $mode;
269 $update_user_community_link_url = $this->getControllerPath('User', 'Index');
270 $update_user_community_link_url .= "&id=" . $folder_obj->get_update_user_community_id();
273 $detail_url = $this->getControllerPath('Community', 'FolderDetail');
274 $detail_url .= $target_community_info;
275 $detail_url .= $target_folder_info;
276 $detail_url .= "&detail_folder_id=" . $folder_obj->get_folder_id();
278 if ($folder_obj->get_is_root_folder()) {
279 $name = $target_community_row['community_name'];
280 //$name .= "¤Î¥Õ¥©¥ë¥À";
281 $name = ACSMsg::get_tag_replace(ACSMsg::get_msg('Community', 'FolderSuccessView.class.php', 'FOLDER_NM'),
282 array("{COMMUNITY_NAME}" => $target_community_row['community_name']));
284 $name = $folder_obj->get_folder_name();
287 // ±ÜÍ÷µö²Ä¥³¥ß¥å¥Ë¥Æ¥£Ì¾ºîÀ®
288 $trusted_community_row_array = $folder_obj->get_trusted_community_row_array();
289 $new_trusted_community_row_array = $this->make_display_trusted_community_row_array($trusted_community_row_array, &$controller);
291 $folder_row['name'] = $name;
292 $folder_row['folder_id'] = $folder_obj->get_folder_id();
293 $folder_row['link_url'] = $link_url;
294 $folder_row['open_level_name'] = $folder_obj->get_open_level_name();
295 $folder_row['trusted_community_row_array'] = $new_trusted_community_row_array;
296 $folder_row['update_user_community_name'] = $folder_obj->get_update_user_community_name();
297 $folder_row['update_user_community_link_url'] = $update_user_community_link_url;
298 $folder_row['update_date'] = $folder_obj->get_update_date_yyyymmddhmi();
300 $folder_row['detail_url'] = $detail_url;
302 // ¥×¥Ã¥È¥Õ¥©¥ë¥À¤«¤É¤¦¤«
303 $folder_row['is_put'] = $folder_obj->is_put_folder($target_community_row['community_id']);
305 array_push($folder_row_array, $folder_row);
307 return $folder_row_array;
310 function make_display_trusted_community_row_array ($trusted_community_row_array, &$controller) {
311 $new_trusted_community_row_array = array();
312 foreach ($trusted_community_row_array as $trusted_community_row) {
313 $new_trusted_community_row = array();
314 $community_top_page_url = "";
316 $community_top_page_url = $this->getControllerPath('Community', 'Index');
317 $community_top_page_url .= "&community_id=" . $trusted_community_row['community_id'];
319 $new_trusted_community_row['community_name'] = $trusted_community_row['community_name'];
320 $new_trusted_community_row['community_top_page_url'] = $community_top_page_url;
322 array_push($new_trusted_community_row_array, $new_trusted_community_row);
325 return $new_trusted_community_row_array;