OSDN Git Service

add ACS webapp, sql, htdocs
[acs/acs.git] / webapp / modules / Community / actions / IndexAction.class.php
diff --git a/webapp/modules/Community/actions/IndexAction.class.php b/webapp/modules/Community/actions/IndexAction.class.php
new file mode 100644 (file)
index 0000000..db977a5
--- /dev/null
@@ -0,0 +1,115 @@
+<?php
+// $Id: IndexAction.class.php,v 1.12 2006/12/08 05:06:34 w-ota Exp $
+
+class IndexAction extends BaseAction
+{
+       function execute() {
+
+               $context = &$this->getContext();
+               $controller = $context->getController();
+               $user = $context->getUser();
+               $request = $context->getRequest();
+               $acs_user_info_row = $user->getAttribute('acs_user_info_row');
+               
+               // ÂоݤȤʤ륳¥ß¥å¥Ë¥Æ¥£ID¤ò¼èÆÀ
+               $community_id = $request->ACSGetParameter('community_id');
+
+               // ¥³¥ß¥å¥Ë¥Æ¥£Â¸ºß¥Á¥§¥Ã¥¯
+               $community_row = ACSCommunity::get_community_row($community_id);
+               if (!$community_row || $community_row['community_type_name'] != ACSMsg::get_mst('community_type_master','D40')) {
+                       return View::ERROR;
+               }
+
+               // ¸¢¸Â¥Á¥§¥Ã¥¯
+               if (!$this->get_execute_privilege()) {
+                       $controller->forward(SECURE_MODULE, SECURE_ACTION);
+                       return;
+               }
+
+               // ¥³¥ß¥å¥Ë¥Æ¥£¾ðÊó
+               $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);
+
+               // ¥³¥ß¥å¥Ë¥Æ¥£¥á¥ó¥Ð, ¥³¥ß¥å¥Ë¥Æ¥£´ÉÍý¼Ô
+               $community_member_user_info_row_array = ACSCommunity::get_community_member_user_info_row_array($community_id);
+               $community_admin_user_info_row_array = ACSCommunity::get_community_admin_user_info_row_array($community_id);
+
+               // ÂÔµ¡: ¥³¥ß¥å¥Ë¥Æ¥£»²²Ã ¾µÇ§ÂÔ¤Á
+               $waiting_for_join_community_row_array = ACSWaiting::get_waiting_row_array($community_id, ACSMsg::get_mst('waiting_type_master','D20'), ACSMsg::get_mst('waiting_status_master','D10'));
+
+               // ÂÔµ¡: ¿Æ¥³¥ß¥å¥Ë¥Æ¥£ÄɲÃ, ¥µ¥Ö¥³¥ß¥å¥Ë¥Æ¥£ÄɲÃ
+               $waiting_for_parent_community_link_row_array = ACSWaiting::get_waiting_row_array($community_id, ACSMsg::get_mst('waiting_type_master','D40'), ACSMsg::get_mst('waiting_status_master','D10'));
+               $waiting_for_sub_community_link_row_array = ACSWaiting::get_waiting_row_array($community_id, ACSMsg::get_mst('waiting_type_master','D50'), ACSMsg::get_mst('waiting_status_master','D10'));
+
+               // ºÇ¿·¾ðÊó: BBS
+               // BBSµ­»ö°ìÍ÷
+               $bbs_row_array = ACSBBS::get_bbs_row_array($community_id);
+               foreach ($bbs_row_array as $index => $bbs_row) {
+                       // ¿®ÍêºÑ¤ß¥³¥ß¥å¥Ë¥Æ¥£°ìÍ÷
+                       $bbs_row_array[$index]['trusted_community_row_array'] = ACSBBS::get_bbs_trusted_community_row_array($bbs_row['bbs_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);
+               $request->setAttribute('community_member_user_info_row_array', $community_member_user_info_row_array);
+               $request->setAttribute('community_admin_user_info_row_array', $community_admin_user_info_row_array);
+               $request->setAttribute('waiting_for_join_community_row_array', $waiting_for_join_community_row_array);
+               $request->setAttribute('waiting_for_parent_community_link_row_array', $waiting_for_parent_community_link_row_array);
+               $request->setAttribute('waiting_for_sub_community_link_row_array', $waiting_for_sub_community_link_row_array);
+               $request->setAttribute('bbs_row_array', $bbs_row_array);
+
+               return View::SUCCESS;
+       }
+
+       /**
+        * Ç§¾Ú¥Á¥§¥Ã¥¯¤ò¹Ô¤¦¤«
+        * ¥¢¥¯¥·¥ç¥ó¤ò¼Â¹Ô¤¹¤ëÁ°¤Ë¡¢Ç§¾Ú¥Á¥§¥Ã¥¯¤¬É¬Íפ«ÀßÄꤹ¤ë
+        * @access  public
+        * @return  boolean Ç§¾Ú¥Á¥§¥Ã¥¯Í­Ìµ¡Êtrue:ɬÍס¢false:ÉÔÍסË
+        */
+       function isSecure()
+       {
+               return false;
+       }
+
+       function getCredential () {
+
+               $context = &$this->getContext();
+               $user = $context->getUser();
+               $request = $context->getRequest();
+
+               // Èó¸ø³«¥³¥ß¥å¥Ë¥Æ¥£¤Ï¥á¥ó¥Ð¤Î¤ß¥¢¥¯¥»¥¹²Äǽ
+               $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();
+       }
+
+       function get_execute_privilege () {
+               $context = $this->getContext();
+               $request =  $context->getRequest();
+               $user = $context->getUser();
+
+               // ¥³¥ß¥å¥Ë¥Æ¥£¥á¥ó¥Ð¤ÏOK
+               if ($user->hasCredential('COMMUNITY_MEMBER')) {
+                       return true;
+               }
+
+               // Èó¸ø³«¥³¥ß¥å¥Ë¥Æ¥£¤Ï¥³¥ß¥å¥Ë¥Æ¥£¥á¥ó¥Ð¤ÏÉÔ²Äǽ
+               $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 false;
+               }
+               return true;
+       }
+}
+
+?>