summaryrefslogtreecommitdiffstats
path: root/application/controllers/StatisticController.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/controllers/StatisticController.php')
-rw-r--r--application/controllers/StatisticController.php65
1 files changed, 65 insertions, 0 deletions
diff --git a/application/controllers/StatisticController.php b/application/controllers/StatisticController.php
new file mode 100644
index 0000000..cb36b89
--- /dev/null
+++ b/application/controllers/StatisticController.php
@@ -0,0 +1,65 @@
+<?php
+class StatisticController extends Zend_Controller_Action
+{
+ protected $acl;
+ protected $config;
+ protected $pbs2host;
+ protected $eventMapper;
+
+
+ public function init()
+ {
+ $this->eventMapper = new Application_Model_EventMapper();
+
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ if(isset($this->userIDsNamespace['apikey'])) {
+ $this->acl = new Poolctrl_Acl($this->pbs2host, $this->config['pbs2']['checkright'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+ }
+ if(!$this->userIDsNamespace['membershipID'] !='') {
+ $this->_helper->redirector('selectmembership', 'person');
+ return;
+ }
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ return;
+ }
+ }
+
+ public function indexAction()
+ {
+
+ }
+
+ public function checkrightAction() {
+ $this->_helper->layout->disableLayout();
+ $rightShortcut = $this->_request->getParam("rightShortcut");
+ $this->view->right = $this->acl->checkRight($rightShortcut);
+ }
+
+ public function categorylistAction() {
+
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+ $poolID = $this->getRequest()->getParam('poolID');
+ $userIDsSession = new Zend_Session_Namespace('userIDs');
+ $category = $this->getRequest()->getParam('category');
+ $userIDsSession->poolID = $poolID;
+
+ if($this->acl->checkRight('eoo')) {
+ $eventList = $this->eventMapper->fetchAll();
+ } else {
+ $eventList = $this->eventMapper->findBy(array("pbs_membershipID", $this->userIDsNamespace['membershipID']));
+ }
+
+ $count = 0;
+
+ foreach ($eventList as $event){
+
+ if($event->getPbs_poolID() == $poolID AND $event->getCategory() == $category) {
+ $count += 1;
+ }
+ }
+ echo $count;
+ }
+} \ No newline at end of file