summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorSebastian Wagner2011-10-07 15:10:33 +0200
committerSebastian Wagner2011-10-07 15:10:33 +0200
commit3690f240e3d7926d561f660ca576056f429f3b15 (patch)
treecc279d817d20d2e535ca7c8f05bbaf3670b6337f /application
parentrename statistic (diff)
downloadpoolctrl-3690f240e3d7926d561f660ca576056f429f3b15.tar.gz
poolctrl-3690f240e3d7926d561f660ca576056f429f3b15.tar.xz
poolctrl-3690f240e3d7926d561f660ca576056f429f3b15.zip
rename statistic
Diffstat (limited to 'application')
-rwxr-xr-xapplication/controllers/StatisticsController.php144
-rwxr-xr-xapplication/views/scripts/statistics/category.phtml126
-rwxr-xr-xapplication/views/scripts/statistics/index.phtml4
-rwxr-xr-xapplication/views/scripts/statistics/running.phtml120
-rw-r--r--application/views/scripts/statistics/success.phtml120
-rw-r--r--application/views/scripts/statistics/type.phtml120
6 files changed, 634 insertions, 0 deletions
diff --git a/application/controllers/StatisticsController.php b/application/controllers/StatisticsController.php
new file mode 100755
index 0000000..93e63a7
--- /dev/null
+++ b/application/controllers/StatisticsController.php
@@ -0,0 +1,144 @@
+<?php
+class StatisticsController extends Zend_Controller_Action
+{
+ protected $acl;
+ protected $config;
+ protected $pbs2host;
+ protected $eventMapper;
+ protected $eventcategoryMapper;
+ protected $eventreportMapper;
+
+
+ public function init()
+ {
+ $this->eventMapper = new Application_Model_EventMapper();
+ $this->eventcategoryMapper = new Application_Model_EventcategoryMapper();
+ $this->eventreportMapper = new Application_Model_EventreportMapper();
+
+ 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');
+ $userIDsSession->poolID = $poolID;
+
+ if($this->acl->checkRight('eoo')) {
+ $eventList = $this->eventMapper->fetchAll();
+ } else {
+ $eventList = $this->eventMapper->findBy(array("pbs_membershipID", $this->userIDsNamespace['membershipID']));
+ }
+
+ $ret['dataBar'] = $this->eventMapper->getCategoryBarCount($poolID);
+ $ret['dataPie'] = $this->eventMapper->getCategoryPieCount($poolID);
+ $ret['color'] = $this->eventcategoryMapper->getCategoryColor($poolID);
+
+ echo json_encode($ret);
+
+ }
+
+ public function runninglistAction() {
+
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+ $poolID = $this->getRequest()->getParam('poolID');
+ $userIDsSession = new Zend_Session_Namespace('userIDs');
+ $userIDsSession->poolID = $poolID;
+
+ if($this->acl->checkRight('eoo')) {
+ $eventList = $this->eventMapper->fetchAll();
+ } else {
+ $eventList = $this->eventMapper->findBy(array("pbs_membershipID", $this->userIDsNamespace['membershipID']));
+ }
+
+ $ret['dataBar'] = $this->eventMapper->getRunningBarCount($poolID);
+ $ret['dataPie'] = $this->eventMapper->getRunningPieCount($poolID);
+
+ echo json_encode($ret);
+
+ }
+
+ public function successlistAction() {
+
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+ $poolID = $this->getRequest()->getParam('poolID');
+ $userIDsSession = new Zend_Session_Namespace('userIDs');
+ $userIDsSession->poolID = $poolID;
+
+ if($this->acl->checkRight('eoo')) {
+ $eventList = $this->eventMapper->fetchAll();
+ } else {
+ $eventList = $this->eventMapper->findBy(array("pbs_membershipID", $this->userIDsNamespace['membershipID']));
+ }
+
+ $ret['dataBar'] = $this->eventreportMapper->getSuccessBarCount($poolID);
+ $ret['dataPie'] = $this->eventreportMapper->getSuccessPieCount($poolID);
+
+ echo json_encode($ret);
+
+ }
+
+ public function typelistAction() {
+
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+ $poolID = $this->getRequest()->getParam('poolID');
+ $userIDsSession = new Zend_Session_Namespace('userIDs');
+ $userIDsSession->poolID = $poolID;
+
+ if($this->acl->checkRight('eoo')) {
+ $eventList = $this->eventMapper->fetchAll();
+ } else {
+ $eventList = $this->eventMapper->findBy(array("pbs_membershipID", $this->userIDsNamespace['membershipID']));
+ }
+
+ $ret['dataBar'] = $this->eventMapper->getTypeBarCount($poolID);
+ $ret['dataPie'] = $this->eventMapper->getTypePieCount($poolID);
+
+ echo json_encode($ret);
+
+ }
+
+ public function categoryAction() {
+
+ }
+
+ public function runningAction() {
+
+ }
+
+ public function successAction() {
+
+ }
+
+ public function typeAction() {
+
+ }
+
+} \ No newline at end of file
diff --git a/application/views/scripts/statistics/category.phtml b/application/views/scripts/statistics/category.phtml
new file mode 100755
index 0000000..2b58682
--- /dev/null
+++ b/application/views/scripts/statistics/category.phtml
@@ -0,0 +1,126 @@
+<h1>Statistics - Category</h1>
+
+<link
+ rel="stylesheet" type="text/css"
+ href="/media/css/jquery.jqplot.min.css" />
+<link
+ rel="stylesheet" type="text/css"
+ href="/media/css/style.css" />
+
+
+<select id="poolselectbox" name="PoolSelectbox"
+ onclick="setPoolIDtmp();" onChange="fetchPoolEvents();">
+ <option value="default">Please choose a Pool</option>
+ <option value="all">All Pools</option>
+</select>
+
+<script>
+
+//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("/statistics/categorylist/poolID/" + poolID, function(data) {
+ if(data.dataBar == '' && poolID != 'default') {
+ $( "#noEventsDialog" ).dialog('open');
+ $('#plotBar').empty();
+ $('#plotPie').empty();
+ } else if (poolID == 'default') {
+ $('#plotBar').empty();
+ $('#plotPie').empty();
+ } else refreshPlot(data.dataBar, data.dataPie, data.color);
+ }, "json");
+}
+
+//[[[4,"Lecture"],[36,"Maintenance"],[9,"Boot"],[21,"Shutdown"]]]
+
+function refreshPlot(dataBar, dataPie, color) {
+ $('#plotBar').empty();
+ $.jqplot('plotBar', dataBar, {
+ seriesDefaults: {
+ //renderer: $.jqplot.PieRenderer,
+ renderer:$.jqplot.BarRenderer,
+ pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
+ shadowAngle: 135,
+ rendererOptions: {
+ //showDataLabels: true,
+ barDirection: 'horizontal',
+ varyBarColor : true
+ }
+ },
+ axes: {
+ yaxis: {
+ renderer: $.jqplot.CategoryAxisRenderer
+ }
+ },
+ seriesColors: color,
+ highlighter: { show: false }
+ });
+ $('#plotPie').empty();
+ $.jqplot('plotPie', dataPie,
+ {
+ seriesDefaults: {
+ // Make this a pie chart.
+ renderer: jQuery.jqplot.PieRenderer,
+ rendererOptions: {
+ // Put data labels on the pie slices.
+ // By default, labels show the percentage of the slice.
+ showDataLabels: true,
+ lineLabels: true,
+ varyBarColor : true
+ }
+ },
+ seriesColors: color
+ //legend: { show:true, location: 'e' }
+ });
+}
+
+$(document).ready(function(){
+
+ //fetch poollist from pbs database
+ $.get("/event/getpoollist/", function(getpoollistresult){
+ $("#poolselectbox").append(getpoollistresult);
+ poolIDtmp = $("#poolselectbox option:selected").val();
+ fetchPoolEvents();
+ });
+});
+
+$(function() {
+ $( "#noEventsDialog" ).dialog({
+ autoOpen: false,
+ width: 600,
+ modal: true,
+ title: "No Events",
+ buttons: {
+ "OK": function() {
+ $(this).dialog("close");
+ }
+ },
+ open: function () {
+ $(".ui-dialog-titlebar-close").hide();
+ //$(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error");
+ }
+ });
+ });
+
+</script>
+
+<div>
+<div id="plotBar" class="spalte"
+ style="height: 300px; width: 350px;"></div>
+<div id="plotPie" class="spalte"
+ style="height: 300px; width: 350px;"></div>
+</div>
+
+<!-- no events -->
+<div id="noEventsDialog" style="display: none">
+<p>There are no events in this pool to plot a statistic.</p>
+</div>
diff --git a/application/views/scripts/statistics/index.phtml b/application/views/scripts/statistics/index.phtml
new file mode 100755
index 0000000..94a0f94
--- /dev/null
+++ b/application/views/scripts/statistics/index.phtml
@@ -0,0 +1,4 @@
+<h1>Statistics</h1>
+<body>
+<h2>Please choose a statistic</h2>
+</body> \ No newline at end of file
diff --git a/application/views/scripts/statistics/running.phtml b/application/views/scripts/statistics/running.phtml
new file mode 100755
index 0000000..4896eeb
--- /dev/null
+++ b/application/views/scripts/statistics/running.phtml
@@ -0,0 +1,120 @@
+<h1>Statistics - Running</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>
+ <option value="all">All Pools</option>
+</select>
+
+<script>
+
+//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("/statistics/runninglist/poolID/" + poolID, function(data) {
+ if(data.dataBar == '0,Event over,0,Event not over' && poolID != 'default') {
+ $('#plotBar').empty();
+ $('#plotPie').empty();
+ $( "#noEventsDialog" ).dialog('open');
+ } else if (poolID == 'default') {
+ $('#plotBar').empty();
+ $('#plotPie').empty();
+ } else refreshPlot(data.dataBar, data.dataPie, data.color);
+ }, "json");
+}
+
+function refreshPlot(dataBar, dataPie, color) {
+ $('#plotBar').empty();
+ $.jqplot('plotBar', dataBar, {
+ seriesDefaults: {
+ //renderer: $.jqplot.PieRenderer,
+ renderer:$.jqplot.BarRenderer,
+ pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
+ shadowAngle: 135,
+ rendererOptions: {
+ //showDataLabels: true,
+ barDirection: 'horizontal',
+ varyBarColor : true
+ }
+ },
+ axes: {
+ yaxis: {
+ renderer: $.jqplot.CategoryAxisRenderer
+ }
+ },
+ seriesColors: color,
+ highlighter: { show: false }
+ });
+ $('#plotPie').empty();
+ $.jqplot('plotPie', dataPie,
+ {
+ seriesDefaults: {
+ // Make this a pie chart.
+ renderer: jQuery.jqplot.PieRenderer,
+ rendererOptions: {
+ // Put data labels on the pie slices.
+ // By default, labels show the percentage of the slice.
+ showDataLabels: true,
+ lineLabels: true,
+ varyBarColor : true
+ }
+ },
+ seriesColors: color
+ //legend: { show:true, location: 'e' }
+ });
+ }
+
+$(document).ready(function(){
+
+ //fetch poollist from pbs database
+ $.get("/event/getpoollist/", function(getpoollistresult){
+ $("#poolselectbox").append(getpoollistresult);
+ poolIDtmp = $("#poolselectbox option:selected").val();
+ fetchPoolEvents();
+ });
+});
+
+$(function() {
+ $( "#noEventsDialog" ).dialog({
+ autoOpen: false,
+ width: 600,
+ modal: true,
+ title: "No Events",
+ buttons: {
+ "OK": function() {
+ $(this).dialog("close");
+ }
+ },
+ open: function () {
+ $(".ui-dialog-titlebar-close").hide();
+ //$(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error");
+ }
+ });
+ });
+
+</script>
+
+<div>
+<div id="plotBar" class="spalte"
+ style="height: 300px; width: 350px;"></div>
+<div id="plotPie" class="spalte"
+ style="height: 300px; width: 350px;"></div>
+</div>
+
+<!-- no events -->
+<div id="noEventsDialog" style="display: none">
+<p>There are no events in this pool to plot a statistic.</p>
+</div> \ No newline at end of file
diff --git a/application/views/scripts/statistics/success.phtml b/application/views/scripts/statistics/success.phtml
new file mode 100644
index 0000000..a1768fa
--- /dev/null
+++ b/application/views/scripts/statistics/success.phtml
@@ -0,0 +1,120 @@
+<h1>Statistics - Success</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>
+ <option value="all">All Pools</option>
+</select>
+
+<script>
+
+//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("/statistics/successlist/poolID/" + poolID, function(data) {
+ if(data.dataBar == '0,Successful,0,Failed' && poolID != 'default') {
+ $( "#noEventsDialog" ).dialog('open');
+ $('#plotBar').empty();
+ $('#plotPie').empty();
+ } else if (poolID == 'default') {
+ $('#plotBar').empty();
+ $('#plotPie').empty();
+ } else refreshPlot(data.dataBar, data.dataPie, data.color);
+ }, "json");
+}
+
+function refreshPlot(dataBar, dataPie, color) {
+ $('#plotBar').empty();
+ $.jqplot('plotBar', dataBar, {
+ seriesDefaults: {
+ //renderer: $.jqplot.PieRenderer,
+ renderer:$.jqplot.BarRenderer,
+ pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
+ shadowAngle: 135,
+ rendererOptions: {
+ //showDataLabels: true,
+ barDirection: 'horizontal',
+ varyBarColor : true
+ }
+ },
+ axes: {
+ yaxis: {
+ renderer: $.jqplot.CategoryAxisRenderer
+ }
+ },
+ seriesColors: color,
+ highlighter: { show: false }
+ });
+ $('#plotPie').empty();
+ $.jqplot('plotPie', dataPie,
+ {
+ seriesDefaults: {
+ // Make this a pie chart.
+ renderer: jQuery.jqplot.PieRenderer,
+ rendererOptions: {
+ // Put data labels on the pie slices.
+ // By default, labels show the percentage of the slice.
+ showDataLabels: true,
+ lineLabels: true,
+ varyBarColor : true
+ }
+ },
+ seriesColors: color
+ //legend: { show:true, location: 'e' }
+ });
+ }
+
+$(document).ready(function(){
+
+ //fetch poollist from pbs database
+ $.get("/event/getpoollist/", function(getpoollistresult){
+ $("#poolselectbox").append(getpoollistresult);
+ poolIDtmp = $("#poolselectbox option:selected").val();
+ fetchPoolEvents();
+ });
+});
+
+$(function() {
+ $( "#noEventsDialog" ).dialog({
+ autoOpen: false,
+ width: 600,
+ modal: true,
+ title: "No Events",
+ buttons: {
+ "OK": function() {
+ $(this).dialog("close");
+ }
+ },
+ open: function () {
+ $(".ui-dialog-titlebar-close").hide();
+ //$(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error");
+ }
+ });
+ });
+
+</script>
+
+<div>
+<div id="plotBar" class="spalte"
+ style="height: 300px; width: 350px;"></div>
+<div id="plotPie" class="spalte"
+ style="height: 300px; width: 350px;"></div>
+</div>
+
+<!-- no events -->
+<div id="noEventsDialog" style="display: none">
+<p>There are no events in this pool to plot a statistic.</p>
+</div> \ No newline at end of file
diff --git a/application/views/scripts/statistics/type.phtml b/application/views/scripts/statistics/type.phtml
new file mode 100644
index 0000000..b1da4e0
--- /dev/null
+++ b/application/views/scripts/statistics/type.phtml
@@ -0,0 +1,120 @@
+<h1>Statistics - Types</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>
+ <option value="all">All Pools</option>
+</select>
+
+<script>
+
+//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("/statistics/typelist/poolID/" + poolID, function(data) {
+ if(data.dataBar == '0,other,0,repeat,0,immediate' && poolID != 'default') {
+ $('#plotBar').empty();
+ $('#plotPie').empty();
+ $( "#noEventsDialog" ).dialog('open');
+ } else if (poolID == 'default') {
+ $('#plotBar').empty();
+ $('#plotPie').empty();
+ } else refreshPlot(data.dataBar, data.dataPie, data.color);
+ }, "json");
+}
+
+function refreshPlot(dataBar, dataPie, color) {
+ $('#plotBar').empty();
+ $.jqplot('plotBar', dataBar, {
+ seriesDefaults: {
+ //renderer: $.jqplot.PieRenderer,
+ renderer:$.jqplot.BarRenderer,
+ pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
+ shadowAngle: 135,
+ rendererOptions: {
+ //showDataLabels: true,
+ barDirection: 'horizontal',
+ varyBarColor : true
+ }
+ },
+ axes: {
+ yaxis: {
+ renderer: $.jqplot.CategoryAxisRenderer
+ }
+ },
+ seriesColors: color,
+ highlighter: { show: false }
+ });
+ $('#plotPie').empty();
+ $.jqplot('plotPie', dataPie,
+ {
+ seriesDefaults: {
+ // Make this a pie chart.
+ renderer: jQuery.jqplot.PieRenderer,
+ rendererOptions: {
+ // Put data labels on the pie slices.
+ // By default, labels show the percentage of the slice.
+ showDataLabels: true,
+ lineLabels: true,
+ varyBarColor : true
+ }
+ },
+ seriesColors: color
+ //legend: { show:true, location: 'e' }
+ });
+ }
+
+$(document).ready(function(){
+
+ //fetch poollist from pbs database
+ $.get("/event/getpoollist/", function(getpoollistresult){
+ $("#poolselectbox").append(getpoollistresult);
+ poolIDtmp = $("#poolselectbox option:selected").val();
+ fetchPoolEvents();
+ });
+});
+
+$(function() {
+ $( "#noEventsDialog" ).dialog({
+ autoOpen: false,
+ width: 600,
+ modal: true,
+ title: "No Events",
+ buttons: {
+ "OK": function() {
+ $(this).dialog("close");
+ }
+ },
+ open: function () {
+ $(".ui-dialog-titlebar-close").hide();
+ //$(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error");
+ }
+ });
+ });
+
+</script>
+
+<div>
+<div id="plotBar" class="spalte"
+ style="height: 300px; width: 350px;"></div>
+<div id="plotPie" class="spalte"
+ style="height: 300px; width: 350px;"></div>
+</div>
+
+<!-- no events -->
+<div id="noEventsDialog" style="display: none">
+<p>There are no events in this pool to plot a statistic.</p>
+</div> \ No newline at end of file