OSDN Git Service

add ACS webapp, sql, htdocs
[acs/acs.git] / webapp / modules / Community / actions / ScheduleAction.class.php
diff --git a/webapp/modules/Community/actions/ScheduleAction.class.php b/webapp/modules/Community/actions/ScheduleAction.class.php
new file mode 100644 (file)
index 0000000..c55095d
--- /dev/null
@@ -0,0 +1,87 @@
+<?php
+require_once(ACS_CLASS_DIR . 'ACSSchedule.class.php');
+
+/**
+ * ¥³¥ß¥å¥Ë¥Æ¥£¤Î¥¹¥±¥¸¥å¡¼¥ëɽ¼¨
+ *
+ * @author  z-satosi
+ * @version $Revision: 1.1 $
+ */
+class ScheduleAction extends BaseAction
+{
+       /**
+        * ½é´ü²èÌÌ
+        * GET¥á¥½¥Ã¥É¤Î¾ì¹ç¡¢¸Æ¤Ð¤ì¤ë
+        */
+       function getDefaultView () {
+               $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');
+               $request->setAttributeByRef('acs_user_info_row', $acs_user_info_row);
+
+               // ¥³¥ß¥å¥Ë¥Æ¥£¾ðÊó¤Î¼èÆÀ
+               $target_community_id = $request->getParameter('community_id');
+               $target_community_row = 
+                               ACSCommunity::get_community_row($target_community_id);
+               $request->setAttributeByRef('target_community_row', $target_community_row);
+
+               // ¥³¥ß¥å¥Ë¥Æ¥£¿Í¿ô¤Î¼èÆÀ
+               $request->setAttribute('member_count',
+                               ACSCommunity::get_community_member_count($target_community_id));
+
+               // ¥¹¥±¥¸¥å¡¼¥ë¥¤¥ó¥¹¥¿¥ó¥¹ÇÛÎó¤Î¼èÆÀ
+               $schedule_array =& 
+                               ACSSchedule::get_community_schedule_instance_list($target_community_id);
+
+               $request->setAttributeByRef('schedules', $schedule_array);
+
+               // ¥¹¥±¥¸¥å¡¼¥ë¿Í¿ô¾ðÊóÇÛÎó¤Î¼èÆÀ
+               $schedule_persons_array =& 
+                               ACSSchedule::get_total_person_count($target_community_id);
+
+               $request->setAttributeByRef('schedule_persons', $schedule_persons_array);
+               
+               return View::SUCCESS;
+       }
+
+       function execute () {
+               $context = $this->getContext();
+               $controller = $context->getController();
+               $request =  $context->getRequest();
+               $user = $context->getUser();
+               return $this->getDefaultView();
+       }
+
+       function getRequestMethods () {
+               return Request::POST | Request::GET;
+       }
+
+       function isSecure () {
+               return false;
+       }
+
+       function getCredential () {
+               return array('COMMUNITY_MEMBER');
+       }
+
+       function get_execute_privilege () {
+               $context = $this->getContext();
+               $user = $context->getUser();
+
+               // ¥³¥ß¥å¥Ë¥Æ¥£¥á¥ó¥Ð¤ÏOK
+               if ($user->hasCredential('COMMUNITY_MEMBER')) {
+                       return true;
+               }
+               return false;
+       }
+}
+?>