OSDN Git Service

add ACS webapp, sql, htdocs
[acs/acs.git] / webapp / modules / User / views / EditProfileImageInputView.class.php
diff --git a/webapp/modules/User/views/EditProfileImageInputView.class.php b/webapp/modules/User/views/EditProfileImageInputView.class.php
new file mode 100644 (file)
index 0000000..2075f9d
--- /dev/null
@@ -0,0 +1,102 @@
+<?php
+/**
+ * ¼Ì¿¿¥¢¥Ã¥×¥í¡¼¥Éµ¡Ç½¡¡View¥¯¥é¥¹
+ * ¥×¥í¥Õ¥£¡¼¥ë¼Ì¿¿Êѹ¹²èÌÌ
+ * @package  acs/webapp/modules/User/views
+ * EditProfileImageView::INPUT
+ * @author   akitsu
+ * @since      PHP 4.0
+ * @revision ver1.5 $Date: 2008/03/24 07:00:36 $
+ */
+
+class EditProfileImageInputView extends BaseView
+{
+        /**
+        * execute ¥á¥½¥Ã¥É
+        *¡¡¥á¥Ã¥»¡¼¥¸¥Ñ¥Ã¥·¥ó¥°
+        * @param object   $user                        ¥æ¡¼¥¶¾ðÊó
+        * @param object   $request              ¥ê¥¯¥¨¥¹¥È¾ðÊó
+        * @param object   $controller    ¡õ¥¢¥É¥ì¥¹¡¡¥³¥ó¥È¥í¡¼¥é
+        *
+        * @return parent::execute($controller, $request, $user)                  BaseView¥¯¥é¥¹¼Â¹Ô
+        */
+       function execute() {
+               $context = $this->getContext();
+               $controller = $context->getController();
+               $request =  $context->getRequest();
+               $user = $context->getUser();
+               
+               //action¥¯¥é¥¹¤«¤éÄÌÃÎset¤µ¤ì¤¿user_community_id ¤ò¼èÆÀ¤¹¤ë
+               $user_community_id = $request->getAttribute('user_community_id');
+               //action¥¯¥é¥¹¤«¤éÄÌÃÎset¤µ¤ì¤¿target_user_info_row ¤ò¼èÆÀ¤·$profileÊÑ¿ô¤Î¥ª¥Ö¥¸¥§¥¯¥ÈÇÛÎó¤È¤¹¤ë
+               $profile = $request->getAttribute('target_user_info_row');
+
+               $image_new_mode = $request->getAttribute('image_new_add');
+               $image_file_label = $request->getAttribute('image_file_label');
+               $open_level_code_row = $request->getAttribute('open_level_code_row');
+               $display_for_public = ACSSystemConfig::get_keyword_value(
+                               ACSMsg::get_mst('system_config_group','D08'), 'DISPLAY_PHOTOS_FOR_PUBLIC');             
+               if ($display_for_public == NULL) {
+                       $display_for_public = "0";
+               }
+                               
+               // ²èÁü¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¹¤òÀßÄê
+               $image_file_array = ACSUser::get_image_url_with_open_level(
+                               $user_community_id, $open_level_code_row);
+//             $profile['image_url'] = ACSUser::get_image_url($user_community_id);
+
+               $file_id = "";                  //¹¹¿·½èÍýÍÑ¡¡Äɲàver1.2 2006/2/13 (¿·µ¬ÄɲäؤÎÂбþ)
+
+               // ¥á¥Ë¥å¡¼ÀßÄê ¿·µ¬ÅÐÏ¿°Ê³°¤Ïºï½ü¥á¥Ë¥å¡¼¤òɽ¼¨¤¹¤ë
+               $menu = array();
+               for ($i = 0; $i < count($open_level_code_row); $i++) {
+                       $key_name = 'file_id_ol' . $open_level_code_row[$i];
+                       if ($image_new_mode[$key_name]) {
+                               $menu['delete_image_url' . $open_level_code_row[$i]] = null;
+                       } else {
+                   $file_id = $profile[$key_name];
+                               $delete_confirm_url = 
+                                               $this->getControllerPath(
+                                                               'User','DeleteProfileImage');
+                               $delete_confirm_url .= '&id=' . $user_community_id;
+                               $delete_confirm_url .= '&file_id=' . $file_id;
+                               $delete_confirm_url .= '&open_level_code=' . $open_level_code_row[$i];
+                               $menu['delete_image_url' . $open_level_code_row[$i]]
+                                       = $delete_confirm_url;
+                       }
+                       $menu['image_new_mode' . $open_level_code_row[$i]] 
+                                       = $image_new_mode[$key_name];
+
+                       //²èÁü¤Î¥¢¥Ã¥×¥í¡¼¥ÉURL ver1.1
+                       $upload_image_url[$key_name] = $this->getControllerPath(
+                                                       'User','UploadProfileImage');
+                       $upload_image_url[$key_name] .= '&id=' . $user_community_id;
+                       $upload_image_url[$key_name] .= '&image_new_mode=' . $image_new_mode[$key_name];
+                       $upload_image_url[$key_name] .= '&file_id=' . $file_id; 
+                       $upload_image_url[$key_name] .= '&open_level_code=' . $open_level_code_row[$i];
+               }
+
+               // ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸ÀßÄê
+               $error_msg_array = array();
+               $error_row = $request->getAttribute('error_row');
+               if ($error_row) {
+                       foreach ($error_row as $key => $msg) {
+                               array_push($error_msg_array, $msg);
+                       }
+               }
+
+               //set
+               $this->setAttribute('image_file_array', $image_file_array);
+               $this->setAttribute('display_for_public', $display_for_public);
+               $this->setAttribute('profile', $profile);
+               $this->setAttribute('menu', $menu);
+               $this->setAttribute('error_msg_array', $error_msg_array);
+               $this->setAttribute('upload_image_url', $upload_image_url);
+
+               // ¥Æ¥ó¥×¥ì¡¼¥È
+               $this->setScreenId("0001");
+               $this->setTemplate('EditProfileImage.tpl.php');
+               return parent::execute();
+       }
+}
+?>