OSDN Git Service

add ACS webapp, sql, htdocs
[acs/acs.git] / webapp / modules / Community / actions / CommunityLinkAction.class.php
diff --git a/webapp/modules/Community/actions/CommunityLinkAction.class.php b/webapp/modules/Community/actions/CommunityLinkAction.class.php
new file mode 100644 (file)
index 0000000..41098f5
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+// $Id: CommunityLinkAction.class.php,v 1.2 2006/03/28 02:00:22 kuwayama Exp $
+
+class CommunityLinkAction extends BaseAction
+{
+       function execute() {
+               $context = $this->getContext();
+               $controller = $context->getController();
+               $request = $context->getRequest();
+               $user = $context->getUser();
+       
+               if (!$this->get_execute_privilege()) {
+                       $controller->forward(SECURE_MODULE, SECURE_ACTION);
+                       return;
+               }
+               $acs_user_info_row = $user->getAttribute('acs_user_info_row');
+               
+               // ÂоݤȤʤ륳¥ß¥å¥Ë¥Æ¥£ID¤ò¼èÆÀ
+               $community_id = $request->ACSGetParameter('community_id');
+
+               // ¥³¥ß¥å¥Ë¥Æ¥£¾ðÊó
+               $community_row = ACSCommunity::get_community_profile_row($community_id);
+
+               // ¥µ¥Ö¥³¥ß¥å¥Ë¥Æ¥£¾ðÊó¤Î°ìÍ÷
+               $sub_community_row_array = ACSCommunity::get_sub_community_row_array($community_id);
+
+               // ¿Æ¥³¥ß¥å¥Ë¥Æ¥£¾ðÊó¤Î°ìÍ÷
+               $parent_community_row_array = ACSCommunity::get_parent_community_row_array($community_id);
+
+               // set
+               $request->setAttribute('community_row', $community_row);
+               $request->setAttribute('sub_community_row_array', $sub_community_row_array);
+               $request->setAttribute('parent_community_row_array', $parent_community_row_array);
+
+               return View::SUCCESS;
+       }
+
+       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;
+       }
+}
+
+?>