--- /dev/null
+<?php
+/**
+ * ¥Õ¥©¥ë¥À ºîÀ®¡¦Êѹ¹
+ *
+ * @author kuwayama
+ * @version $Revision: 1.6 $ $Date: 2006/11/20 08:44:28 $
+ */
+require_once(ACS_CLASS_DIR . 'ACSCommunityFolder.class.php');
+class EditFolderInputView extends BaseView
+{
+ function execute() {
+ $context = $this->getContext();
+ $controller = $context->getController();
+ $request = $context->getRequest();
+ $user = $context->getUser();
+
+ // get
+ $target_user_info_row = $request->getAttribute('target_user_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'); // ¥Ç¥Õ¥©¥ë¥ÈÃͤȤ·¤Æɽ¼¨¤¹¤ëÃÍ
+
+ $target_user_community_id = $target_user_info_row['user_community_id'];
+ $view_mode = $request->getAttribute('view_mode');
+
+ $target_user_info = '&id=' . $target_user_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_user_info_row['community_name'] = $target_user_info_row['community_name'];
+ $_target_user_info_row['top_page_url'] = $this->getControllerPath('User', DEFAULT_ACTION);
+ $_target_user_info_row['top_page_url'] .= $target_community_info;
+
+ // ÅÐÏ¿¡¦¹¹¿·½èÍýURL
+ $action_url = "";
+ $action_url = $this->getControllerPath('User', 'EditFolder');
+ $action_url .= $target_user_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('User', 'Folder');
+ $cancel_url .= $target_user_info;
+ $cancel_url .= $folder_info;
+ } elseif ($view_mode == 'update') {
+ $cancel_url = $this->getControllerPath('User', 'FolderDetail');
+ $cancel_url .= $target_user_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','D10'), 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++;
+ }
+ }
+
+ // ¥Þ¥¤¥Õ¥ì¥ó¥º¥°¥ë¡¼¥×¼èÆÀ (¸ø³«ÈÏ°Ï¡Öͧ¿Í¤Ë¸ø³«¡×¤ÎÁªÂò»è)
+ $friends_group_row_array = ACSUser::get_friends_group_row_array($target_user_info_row['user_community_id']);
+
+ // ͧ¿Í¤Ë¸ø³«¤Î¾ì¹ç¤Î¥ª¥×¥·¥ç¥ó¥Ç¥Õ¥©¥ë¥ÈÃͤòÄɲÃ
+ // default_data_row ¤Ë 'trusted_community_flag' ¤òÄɲ乤ë
+ $selected_trusted_community_id_array = $default_data_row['trusted_community_id_array'];
+
+ // ¡Öͧ¿Í¤Ë¸ø³«¡×¤Î ¸ø³«ÈÏ°Ï¥³¡¼¥É¼èÆÀ
+ foreach ($open_level_master_row_array as $open_level_master_row) {
+ if ($open_level_master_row['open_level_name'] == ACSMsg::get_mst('open_level_master','D05')) {
+ $friends_open_level_code = $open_level_master_row['open_level_code'];
+ break;
+ }
+ }
+
+ if ($default_data_row['trusted_community_flag']) {
+ // ÁªÂò¤µ¤ì¤¿Ãͤ¬¤ï¤«¤Ã¤Æ¤¤¤ë¾ì¹ç¡Ê¥¨¥é¡¼¤Î¾ì¹ç¡Ë
+ // ¤½¤Î¤Þ¤Þ¤ÎÃͤò»ÈÍѤ¹¤ë
+
+ } elseif ($default_data_row['open_level_code'] != $friends_open_level_code) {
+ // Á´¤Æ¤Îͧ¿Í ¤ò¥Ç¥Õ¥©¥ë¥È¤Ë¤¹¤ë
+ $default_data_row['trusted_community_flag'] = '0';
+
+ } elseif ($friends_group_row_array && $selected_trusted_community_id_array) {
+
+ // »ØÄꤵ¤ì¤Æ¤¤¤ë¥³¥ß¥å¥Ë¥Æ¥£ID¤¬£±¤Ä¤Ç¡¢community_type ¤¬¥Þ¥¤¥Õ¥ì¥ó¥º¤Ç¤Ê¤¤¤Î¾ì¹ç
+ // ¥Þ¥¤¥Õ¥ì¥ó¥º¥°¥ë¡¼¥× ¤òÁªÂò¤¹¤ë
+ if (count($selected_trusted_community_id_array) == 1) {
+ $_trusted_community_row = ACSCommunity::get_community_row($selected_trusted_community_id_array[0]);
+ if ($_trusted_community_row['community_type_name'] != ACSMsg::get_mst('community_type_master','D20')) {
+ $default_data_row['trusted_community_flag'] = '1';
+ } else {
+ $default_data_row['trusted_community_flag'] = '0';
+ }
+
+ } else {
+ // Ê£¿ô¤¢¤ë¾ì¹ç¤Ï¡¢¥Þ¥¤¥Õ¥ì¥ó¥º¥°¥ë¡¼¥×
+ $default_data_row['trusted_community_flag'] = '1';
+ }
+
+ } elseif ($default_data_row['open_level_code'] == $friends_open_level_code && !$selected_trusted_community_id_array) {
+ // ͧ¿Í¤Ë¸ø³«¤Ç¡¢±ÜÍ÷µö²Ä¥³¥ß¥å¥Ë¥Æ¥£¤¬¤Ê¤¤¾ì¹ç¤Ï ¥Þ¥¤¥Õ¥ì¥ó¥º¤òÁªÂò
+ $default_data_row['trusted_community_flag'] = '1';
+ }
+
+
+ // ¥Æ¥ó¥×¥ì¡¼¥È
+ $this->setScreenId("0001");
+ $this->setTemplate('EditFolder.tpl.php');
+
+ // set
+ $this->setAttribute('target_user_info_row', $_target_user_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('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();
+ }
+}
+?>