OSDN Git Service

add ACS webapp, sql, htdocs
[acs/acs.git] / webapp / modules / Community / actions / CommunityImageAction.class.php
diff --git a/webapp/modules/Community/actions/CommunityImageAction.class.php b/webapp/modules/Community/actions/CommunityImageAction.class.php
new file mode 100644 (file)
index 0000000..a9c3f69
--- /dev/null
@@ -0,0 +1,60 @@
+<?php
+/**
+ * ¥×¥í¥Õ¥£¡¼¥ë¼Ì¿¿É½¼¨
+ *
+ * @author  kuwayama
+ * @version $Revision: 1.3 $ $Date: 2007/03/28 02:51:43 $
+ */
+class CommunityImageAction extends BaseAction
+{
+       function execute () {
+               $context = $this->getContext();
+               $controller = $context->getController();
+               $request = $context->getRequest();
+               $user = $context->getUser(); 
+               $community_id      = $request->getParameter('community_id');
+               $view_mode         = $request->getParameter('mode');
+               $acs_user_info_row = $user->getAttribute('acs_user_info_row');
+
+               $community_row = ACSCommunity::get_community_profile_row($community_id);
+
+               $is_permitted = false;
+               /* ¥¢¥¯¥»¥¹¸¢¥Á¥§¥Ã¥¯ */
+               // ±ÜÍ÷²Äǽ¤«¥Á¥§¥Ã¥¯¤¹¤ë
+               // ºï½ü¥Õ¥é¥°¡¢Á´ÂΤθø³«ÈϰϤò¥Á¥§¥Ã¥¯
+
+               /* ¼Ì¿¿É½¼¨ */
+               // ¥Õ¥¡¥¤¥ë¾ðÊó¼èÆÀ
+               $image_file_id = $community_row['file_id'];
+               if ($image_file_id) {
+                       $file_obj = ACSFile::get_file_info_instance($image_file_id);
+                       $ret = $file_obj->view_image($view_mode);
+               } else {
+                       $image_url = ACSCommunity::get_default_image_url($view_mode);
+                       header("Location: $image_url");
+               }
+
+       }
+
+       function getRequestMethods () {
+               return Request::GET;
+       }
+
+       function isSecure () {
+               return false;
+       }
+
+       function getCredential () {
+               $context = $this->getContext();
+               $controller = $context->getController();
+               $request =  $context->getRequest();
+               $user = $context->getUser();  
+               // Èó¸ø³«¥³¥ß¥å¥Ë¥Æ¥£¤Ï¥á¥ó¥Ð¤Î¤ß¥¢¥¯¥»¥¹²Äǽ
+               $community_self_info_row = ACSCommunity::get_contents_row($request->getParameter('community_id'), ACSMsg::get_mst('contents_type_master','D00'));
+               if ($community_self_info_row['open_level_name'] == ACSMsg::get_mst('open_level_master','D03')) {
+                       return array('COMMUNITY_MEMBER');
+               }
+               return array();
+       }
+}
+?>