OSDN Git Service

add ACS webapp, sql, htdocs
[acs/acs.git] / webapp / modules / Community / actions / EditProfileImageAction.class.php
diff --git a/webapp/modules/Community/actions/EditProfileImageAction.class.php b/webapp/modules/Community/actions/EditProfileImageAction.class.php
new file mode 100644 (file)
index 0000000..6f349a4
--- /dev/null
@@ -0,0 +1,85 @@
+<?php
+/**
+ * ¥×¥í¥Õ¥£¡¼¥ë¼Ì¿¿Êѹ¹²èÌÌ Action¥¯¥é¥¹
+ * @package  acs/webapp/modules/Community/action
+ * @author   akitsu
+ * @since      PHP 4.0
+ * @version  ver1.0  2006/02/14 $
+ */
+
+class EditProfileImageAction extends BaseAction
+{
+       /**
+        * ½é´ü²èÌÌ
+        * GET¥á¥½¥Ã¥É¤Î¾ì¹ç¡¢¸Æ¤Ð¤ì¤ë
+        */
+       function execute() {
+               $context = $this->getContext();
+               $controller = $context->getController();
+               $request =  $context->getRequest();
+               $user = $context->getUser();
+
+               /* ¥¨¥é¡¼¤ò¼èÆÀ */
+               //$error_row = $user->getAttribute('error_row');
+               //$user->removeAttribute('error_row');
+
+               // ÂоݤȤʤë¥æ¡¼¥¶¥³¥ß¥å¥Ë¥Æ¥£ID¤ò¼èÆÀ
+               $user_community_id = $request->ACSgetParameter('community_id');
+               // ¥×¥í¥Õ¥£¡¼¥ë¾ðÊó¤ò¼èÆÀ
+               $target_community_info_row = ACSCommunity::get_community_row($user_community_id);
+               // Ìá¤ë¥ê¥ó¥¯Àè¾ðÊó¤ò¼èÆÀ
+               $back_url =  $this->getControllerPath('Community','Index');
+               $back_url .= '&community_id=' . $user_community_id;
+
+               if (!$this->get_execute_privilege()) {
+                       $controller->forward(SECURE_MODULE, SECURE_ACTION);
+                       return;
+               }
+
+               // ²èÁü¤¬¿·µ¬ÅÐÏ¿¤«¹¹¿·¤«¤òȽÄꤹ¤ë true:¿·µ¬ false:¹¹¿·
+               // ¥Õ¥¡¥¤¥ë¾ðÊó¤Î¸ºß³Îǧ
+
+               $image_file_id = $target_community_info_row['file_id'];// ¥Õ¥¡¥¤¥ë¾ðÊó¼èÆÀ
+               if ($image_file_id) {
+                       $image_new_add = false;
+               } else {
+                       $image_new_add = true;
+               }
+                       
+               // set
+               //user_community_id ¤òview¥¯¥é¥¹¤ØÄÌÃΤ¹¤ë
+               $request->setAttribute('community_id', $user_community_id);
+               //target_user_info_row¤òview¥¯¥é¥¹¤ØÄÌÃΤ¹¤ë
+               $request->setAttribute('target_community_info_row', $target_community_info_row);
+               //²èÁü¤¬¿·µ¬ÅÐÏ¿¤«¹¹¿·¤«¤Îimage_new_add¤òview¥¯¥é¥¹¤ØÄÌÃΤ¹¤ë
+               $request->setAttribute('image_new_add',$image_new_add);
+               //Ìá¤ë¥ê¥ó¥¯Àè¤òview¥¯¥é¥¹¤ØÄÌÃΤ¹¤ë
+               $request->setAttribute('back_url', $back_url);  
+
+               return View::INPUT;
+       }
+
+       function getRequestMethods() {
+                       return Request::GET;
+       }
+
+       function isSecure () {
+               return false;
+       }
+
+       function getCredential () {
+               return array('COMMUNITY_ADMIN');
+       }
+
+       function get_execute_privilege () {
+               $context = $this->getContext();
+               $user = $context->getUser();
+
+               // ¥³¥ß¥å¥Ë¥Æ¥£´ÉÍý¼Ô¤ÏOK
+               if ($user->hasCredential('COMMUNITY_ADMIN')) {
+                       return true;
+               }
+               return false;
+       }
+}
+?>