summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorSebastian Wagner2011-09-29 17:42:54 +0200
committerSebastian Wagner2011-09-29 17:42:54 +0200
commitefb63aa4e1a11debc1865c8ea704eb3ad3929aae (patch)
treee314da372f2fff25f1b44045b68c50f630b20e21 /application
parentMerge branch 'master' of git.openslx.org:lsfks/projekte/poolctrl (diff)
downloadpoolctrl-efb63aa4e1a11debc1865c8ea704eb3ad3929aae.tar.gz
poolctrl-efb63aa4e1a11debc1865c8ea704eb3ad3929aae.tar.xz
poolctrl-efb63aa4e1a11debc1865c8ea704eb3ad3929aae.zip
statistics
Diffstat (limited to 'application')
-rw-r--r--application/controllers/StatisticController.php65
-rwxr-xr-xapplication/layouts/default.phtml7
-rwxr-xr-xapplication/views/scripts/event/index.phtml5
-rwxr-xr-xapplication/views/scripts/index/index.phtml2
-rw-r--r--application/views/scripts/statistic/index.phtml78
5 files changed, 151 insertions, 6 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
diff --git a/application/layouts/default.phtml b/application/layouts/default.phtml
index 1b4d713..c65ec37 100755
--- a/application/layouts/default.phtml
+++ b/application/layouts/default.phtml
@@ -25,6 +25,10 @@ echo $this->headScript()."\n";
<script type='text/javascript' src='/media/js/fullcalendar.js'></script>
<script type="text/javascript"
src='/media/js/jquery.qtip-1.0.0-rc3.min.js'></script>
+<script type='text/javascript' src='/media/js/jquery.jqplot.min.js'></script>
+<script type='text/javascript' src='/media/js/jqplot.pointLabels.min.js'></script>
+<script type='text/javascript' src='/media/js/jqplot.categoryAxisRenderer.min.js'></script>
+<script type='text/javascript' src='/media/js/jqplot.barRenderer.min.js'></script>
</head>
<body>
@@ -42,7 +46,8 @@ echo $this->headScript()."\n";
<?php if(count($userIDsNamespace) > 1) {
$acl = new Poolctrl_Acl($pbs2host, $config['pbs2']['checkright'] . $userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);;
if($acl->checkRight('eo')) { ?>
- <li class='navTreeItem'><a href='/event'>Event</a></li>
+ <li class='navTreeItem'><a href='/event'>PoolCtrl</a></li>
+ <li class='navTreeItem'><a href='/statistic'>Statistics</a></li>
<?php } ?>
<li class='navTreeItem'><a href='/person/changemembership'>Change
Membership</a></li>
diff --git a/application/views/scripts/event/index.phtml b/application/views/scripts/event/index.phtml
index f67a0f5..1077cf3 100755
--- a/application/views/scripts/event/index.phtml
+++ b/application/views/scripts/event/index.phtml
@@ -677,9 +677,6 @@ var dayClick = false;
}
});
});
-
-
-
</script>
@@ -757,4 +754,4 @@ selected one?</p>
<!-- default -->
<div id="defaultDialog" style="display: none">
<p>Are you sure about this change?</p>
-</div> \ No newline at end of file
+</div>
diff --git a/application/views/scripts/index/index.phtml b/application/views/scripts/index/index.phtml
index 57e6edb..f47aba5 100755
--- a/application/views/scripts/index/index.phtml
+++ b/application/views/scripts/index/index.phtml
@@ -1 +1 @@
-<h1>Welcome</h1>
+<h1>Welcome</h1> \ No newline at end of file
diff --git a/application/views/scripts/statistic/index.phtml b/application/views/scripts/statistic/index.phtml
new file mode 100644
index 0000000..369a5a8
--- /dev/null
+++ b/application/views/scripts/statistic/index.phtml
@@ -0,0 +1,78 @@
+<h1>Category - Statistic</h1>
+
+<link
+ rel="stylesheet" type="text/css"
+ href="/media/css/jquery.jqplot.min.css" />
+
+<select id="poolselectbox" name="PoolSelectbox"
+ onclick="setPoolIDtmp();" onChange="fetchPoolEvents();">
+ <option value="default">Please choose a Pool</option>
+</select>
+
+<script>
+
+var lecture = 0;
+var boot = 0;
+var shutdown = 0;
+var maintenance = 0;
+
+//fetch all poolevents of the selected #poolselectbox value
+function fetchPoolEvents() {
+ poolID = $("#poolselectbox option:selected").val();
+ plot();
+}
+
+function setPoolIDtmp() {
+ poolIDtmp = $("#poolselectbox option:selected").val();
+ }
+
+function plot() {
+ poolID = $("#poolselectbox option:selected").val();
+ $.get("/statistic/categorylist/poolID/" + poolID + "/category/" + 1, function(data) {lecture = data;});
+ $.get("/statistic/categorylist/poolID/" + poolID + "/category/" + 3, function(data) {boot = data;});
+ $.get("/statistic/categorylist/poolID/" + poolID + "/category/" + 4, function(data) {shutdown = data;});
+ $.get("/statistic/categorylist/poolID/" + poolID + "/category/" + 2, function(data) {maintenance = data; refreshPlot();});
+}
+
+function refreshPlot() {
+ $('#plot').empty();
+ $.jqplot('plot', [
+ [[boot,'Boot'], [shutdown,'Shutdwon'], [maintenance,'Maintenance'], [lecture,'Lecture']]], {
+ seriesDefaults: {
+ renderer:$.jqplot.BarRenderer,
+ // Show point labels to the right ('e'ast) of each bar.
+ // edgeTolerance of -15 allows labels flow outside the grid
+ // up to 15 pixels. If they flow out more than that, they
+ // will be hidden.
+ pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
+ // Rotate the bar shadow as if bar is lit from top right.
+ shadowAngle: 135,
+ // Here's where we tell the chart it is oriented horizontally.
+ rendererOptions: {
+ barDirection: 'horizontal'
+ }
+ },
+ axes: {
+ yaxis: {
+ renderer: $.jqplot.CategoryAxisRenderer
+ }
+ }
+ });
+}
+
+$(document).ready(function(){
+
+ //fetch poollist from pbs database
+ $.get("/event/getpoollist/", function(getpoollistresult){
+ $("#poolselectbox").append(getpoollistresult);
+ poolIDtmp = $("#poolselectbox option:selected").val();
+ fetchPoolEvents();
+ });
+
+ // For horizontal bar charts, x an y values must will be "flipped"
+ // from their vertical bar counterpart.
+});
+</script>
+
+<div id="plot"
+ style="height: 400px; width: 700px;"></div>