summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Geiger2011-11-17 13:06:39 +0100
committerBjörn Geiger2011-11-17 13:06:39 +0100
commit78d46b7c9caac5402330cb6957882a12ae8d62cb (patch)
treea69acae5285eb8493a7bdf0d9d5e0f5ace6003b3
parentpbs2Api klasse korrigiert (diff)
parentnew js files (diff)
downloadpoolctrl-master.tar.gz
poolctrl-master.tar.xz
poolctrl-master.zip
-rw-r--r--[-rwxr-xr-x]application/controllers/EventController.php11
-rwxr-xr-xapplication/controllers/StatisticsController.php32
-rwxr-xr-xapplication/models/EventMapper.php155
-rwxr-xr-xapplication/models/EventreportMapper.php50
-rwxr-xr-xapplication/views/scripts/statistics/category.phtml95
-rwxr-xr-xapplication/views/scripts/statistics/running.phtml93
-rwxr-xr-xapplication/views/scripts/statistics/success.phtml93
-rwxr-xr-xapplication/views/scripts/statistics/type.phtml93
-rw-r--r--public/media/js/categoryPlot.js88
-rw-r--r--public/media/js/runningPlot.js86
-rw-r--r--public/media/js/successPlot.js86
-rw-r--r--public/media/js/typePlot.js86
12 files changed, 418 insertions, 550 deletions
diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index bb48528..8cd21ea 100755..100644
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -1323,9 +1323,9 @@ class EventController extends Zend_Controller_Action
if($event->getPbs_poolID() == 2) {$textColor = 'black';}
else $textColor = 'white';
- $events[] = array(
-
- $events[] = array(
+ $events[] = array(
+
+ $events[] = array(
'id' => $event->getID(),
'title' => $event->getTitle(),
'start' => $event->getStart(),
@@ -1344,9 +1344,8 @@ class EventController extends Zend_Controller_Action
'opacity' => 1,
'immediate' => $event->getImmediate(),
'running' => $event->getRunning(),
- )
- );
- //}
+ )
+ );
}
echo json_encode($events);
}
diff --git a/application/controllers/StatisticsController.php b/application/controllers/StatisticsController.php
index 868a2a6..66141c8 100755
--- a/application/controllers/StatisticsController.php
+++ b/application/controllers/StatisticsController.php
@@ -41,7 +41,7 @@ class StatisticsController extends Zend_Controller_Action
}
}
- public function categorylistAction() {
+ public function categoryplotAction() {
if(!$this->acl->checkRight('eo')) {
$this->_redirect('/');
}
@@ -56,16 +56,16 @@ class StatisticsController extends Zend_Controller_Action
} else {
$eventList = $this->eventMapper->findBy(array("pbs_membershipID", $this->userIDsNamespace['membershipID']));
}
-
- $ret['dataBar'] = $this->eventMapper->getCategoryBarCount($poolID);
- $ret['dataPie'] = $this->eventMapper->getCategoryPieCount($poolID);
+ // 1 = barPlot 2 = piePlot
+ $ret['dataBar'] = $this->eventMapper->getCategoryPlotdata($poolID, 1);
+ $ret['dataPie'] = $this->eventMapper->getCategoryPlotdata($poolID, 2);
$ret['color'] = $this->eventcategoryMapper->getCategoryColor($poolID, null);
echo json_encode($ret);
}
- public function runninglistAction() {
+ public function runningplotAction() {
if(!$this->acl->checkRight('er')) {
$this->_redirect('/');
}
@@ -80,15 +80,15 @@ class StatisticsController extends Zend_Controller_Action
} else {
$eventList = $this->eventMapper->findBy(array("pbs_membershipID", $this->userIDsNamespace['membershipID']));
}
-
- $ret['dataBar'] = $this->eventMapper->getRunningBarCount($poolID);
- $ret['dataPie'] = $this->eventMapper->getRunningPieCount($poolID);
+ // 1 = barPlot 2 = piePlot
+ $ret['dataBar'] = $this->eventMapper->getRunningPlotdata($poolID, 1);
+ $ret['dataPie'] = $this->eventMapper->getRunningPlotdata($poolID, 2);
echo json_encode($ret);
}
- public function successlistAction() {
+ public function successplotAction() {
if(!$this->acl->checkRight('er')) {
$this->_redirect('/');
}
@@ -103,15 +103,15 @@ class StatisticsController extends Zend_Controller_Action
} else {
$eventList = $this->eventMapper->findBy(array("pbs_membershipID", $this->userIDsNamespace['membershipID']));
}
-
- $ret['dataBar'] = $this->eventreportMapper->getSuccessBarCount($poolID);
- $ret['dataPieS'] = $this->eventreportMapper->getSuccessPieCount($poolID);
+ // 1 = barPlot 2 = piePlot
+ $ret['dataBar'] = $this->eventreportMapper->getSuccessPlotdata($poolID, 1);
+ $ret['dataPieS'] = $this->eventreportMapper->getSuccessPlotdata($poolID, 2);
echo json_encode($ret);
}
- public function typelistAction() {
+ public function typeplotAction() {
if(!$this->acl->checkRight('eo')) {
$this->_redirect('/');
}
@@ -126,9 +126,9 @@ class StatisticsController extends Zend_Controller_Action
} else {
$eventList = $this->eventMapper->findBy(array("pbs_membershipID", $this->userIDsNamespace['membershipID']));
}
-
- $ret['dataBar'] = $this->eventMapper->getTypeBarCount($poolID);
- $ret['dataPie'] = $this->eventMapper->getTypePieCount($poolID);
+ // 1 = barPlot 2 = piePlot
+ $ret['dataBar'] = $this->eventMapper->getTypePlotdata($poolID, 1);
+ $ret['dataPie'] = $this->eventMapper->getTypePlotdata($poolID, 2);
echo json_encode($ret);
diff --git a/application/models/EventMapper.php b/application/models/EventMapper.php
index 438613f..01d2f4c 100755
--- a/application/models/EventMapper.php
+++ b/application/models/EventMapper.php
@@ -186,44 +186,7 @@ class Application_Model_EventMapper
return array_diff_assoc($vv1,$vv2);
}
- public function getCategoryBarCount($poolID) {
-
- $db = Zend_Db_Table::getDefaultAdapter();
- if($poolID != 'all'){
- $select = $this->getDbTable()->select()
- ->setIntegrityCheck(false)
- ->from(array('pce' => 'poolctrl_event'),
- array('count' => 'COUNT(*)', 'category' => 'pcec.title'))
- ->join(array('pcec' => 'poolctrl_eventcategory'),
- 'pce.category = pcec.eventcategoryID',
- array())
- ->where('pce.pbs_poolID = ?', $poolID)
- ->group('pce.category')
- ->order('pce.category ASC');}
- else {
- $select = $this->getDbTable()->select()
- ->setIntegrityCheck(false)
- ->from(array('pce' => 'poolctrl_event'),
- array('count' => 'COUNT(*)', 'category' => 'pcec.title'))
- ->join(array('pcec' => 'poolctrl_eventcategory'),
- 'pce.category = pcec.eventcategoryID',
- array())
- ->group('pce.category')
- ->order('pce.category ASC');
- }
-
- $stmt = $db->query($select);
- $result = $stmt->fetchAll(PDO::FETCH_NUM);
- $ret = null;
-
- foreach ($result as $r) {
- $ret[] = array((int)$r[0], $r[1]);
- }
-
- return array($ret);
- }
-
- public function getCategoryPieCount($poolID) {
+ public function getCategoryPlotdata($poolID, $plotType) {
$db = Zend_Db_Table::getDefaultAdapter();
if($poolID != 'all'){
@@ -254,13 +217,17 @@ class Application_Model_EventMapper
$ret = null;
foreach ($result as $r) {
- $ret[] = array($r[0], (int)$r[1]);
+ if($plotType == 1) {
+ $ret[] = array((int)$r[1], $r[0]);
+ } else if ($plotType == 2) {
+ $ret[] = array($r[0], (int)$r[1]);
+ }
}
return array($ret);
}
- public function getRunningBarCount($poolID) {
+ public function getRunningPlotdata($poolID, $plotType) {
$db = Zend_Db_Table::getDefaultAdapter();
if($poolID != 'all'){
@@ -288,51 +255,21 @@ class Application_Model_EventMapper
$result = $stmt->fetchAll(PDO::FETCH_NUM);
foreach ($result as $r) {
- $ret1 = array((int)$r[0],'not over');
- $ret2 = array((int)$r[1],'over');
- $return[] = array($ret1,$ret2);
- }
-
- return $return;
- }
-
- public function getRunningPieCount($poolID) {
-
- $db = Zend_Db_Table::getDefaultAdapter();
- if($poolID != 'all'){
- $select = $this->getDbTable()->select()
- ->setIntegrityCheck(false)
- ->from(array('pce' => 'poolctrl_event'),
- array('count1' => 'SUM(IF(pce.running=1,1,0))', 'count0' => 'SUM(IF(pce.running=1,0,1))')
- )
- ->join(array('pcec' => 'poolctrl_eventcategory'),
- 'pce.category = pcec.eventcategoryID',
- array())
- ->where('pce.pbs_poolID = ?', $poolID);}
- else {
- $select = $this->getDbTable()->select()
- ->setIntegrityCheck(false)
- ->from(array('pce' => 'poolctrl_event'),
- array('over' => 'SUM(IF(pce.running=1,1,0))', 'not_over' => 'SUM(IF(pce.running=1,0,1))')
- )
- ->join(array('pcec' => 'poolctrl_eventcategory'),
- 'pce.category = pcec.eventcategoryID',
- array());
- }
-
- $stmt = $db->query($select);
- $result = $stmt->fetchAll(PDO::FETCH_NUM);
-
- foreach ($result as $r) {
- $ret1 = array('over', (int)$r[0]);
- $ret2 = array('not over', (int)$r[1]);
- $return[] = array($ret1,$ret2);
+ if($plotType == 1) {
+ $ret1 = array((int)$r[0],'not over');
+ $ret2 = array((int)$r[1],'over');
+ $return[] = array($ret1,$ret2);
+ } else if($plotType == 2) {
+ $ret1 = array('over', (int)$r[0]);
+ $ret2 = array('not over', (int)$r[1]);
+ $return[] = array($ret1,$ret2);
+ }
}
return $return;
}
- public function getTypeBarCount($poolID) {
+ public function getTypePlotdata($poolID, $plotType) {
$db = Zend_Db_Table::getDefaultAdapter();
if($poolID != 'all'){
@@ -364,51 +301,17 @@ class Application_Model_EventMapper
$result = $stmt->fetchAll(PDO::FETCH_NUM);
foreach ($result as $r) {
- $ret1 = array((int)$r[0], 'other');
- $ret2 = array((int)$r[1], 'repeat');
- $ret3 = array((int)$r[2], 'immediate');
- $return[] = array($ret1,$ret2,$ret3);
- }
-
- return $return;
- }
-
- public function getTypePieCount($poolID) {
-
- $db = Zend_Db_Table::getDefaultAdapter();
- if($poolID != 'all'){
- $select = $this->getDbTable()->select()
- ->setIntegrityCheck(false)
- ->from(array('pce' => 'poolctrl_event'),
- array('other' => 'SUM(IF(pce.repeat=0 AND pce.immediate=0,1,0))',
- 'repeat' => 'SUM(IF(pce.repeat=1 AND pce.immediate=0,1,0))',
- 'immediate' => 'SUM(IF(pce.repeat=0 AND pce.immediate=1,1,0))')
- )
- ->join(array('pcec' => 'poolctrl_eventcategory'),
- 'pce.category = pcec.eventcategoryID',
- array())
- ->where('pce.pbs_poolID = ?', $poolID);}
- else {
- $select = $this->getDbTable()->select()
- ->setIntegrityCheck(false)
- ->from(array('pce' => 'poolctrl_event'),
- array('other' => 'SUM(IF(pce.repeat=0 AND pce.immediate=0,1,0))',
- 'repeat' => 'SUM(IF(pce.repeat=1 AND pce.immediate=0,1,0))',
- 'immediate' => 'SUM(IF(pce.repeat=0 AND pce.immediate=1,1,0))')
- )
- ->join(array('pcec' => 'poolctrl_eventcategory'),
- 'pce.category = pcec.eventcategoryID',
- array());
- }
-
- $stmt = $db->query($select);
- $result = $stmt->fetchAll(PDO::FETCH_NUM);
-
- foreach ($result as $r) {
- $ret1 = array('other', (int)$r[0]);
- $ret2 = array('repeat', (int)$r[1]);
- $ret3 = array('immediate', (int)$r[2]);
- $return[] = array($ret1,$ret2,$ret3);
+ if($plotType == 1) {
+ $ret1 = array((int)$r[0], 'other');
+ $ret2 = array((int)$r[1], 'repeat');
+ $ret3 = array((int)$r[2], 'immediate');
+ $return[] = array($ret1,$ret2,$ret3);
+ } else if ($plotType == 2) {
+ $ret1 = array('other', (int)$r[0]);
+ $ret2 = array('repeat', (int)$r[1]);
+ $ret3 = array('immediate', (int)$r[2]);
+ $return[] = array($ret1,$ret2,$ret3);
+ }
}
return $return;
@@ -468,7 +371,7 @@ class Application_Model_EventMapper
$event->setID($result['eventID']);
$return[] = $event;
}
-
+
return $return;
}
diff --git a/application/models/EventreportMapper.php b/application/models/EventreportMapper.php
index da37e66..371fa26 100755
--- a/application/models/EventreportMapper.php
+++ b/application/models/EventreportMapper.php
@@ -164,7 +164,7 @@ class Application_Model_EventreportMapper
return array_diff_assoc($vv1,$vv2);
}
- public function getSuccessBarCount($poolID) {
+ public function getSuccessPlotdata($poolID, $plotType) {
$db = Zend_Db_Table::getDefaultAdapter();
if($poolID != 'all'){
@@ -192,49 +192,19 @@ class Application_Model_EventreportMapper
$result = $stmt->fetchAll(PDO::FETCH_NUM);
foreach ($result as $r) {
- $ret1 = array((int)$r[0],'Succeeded');
- $ret2 = array((int)$r[1],'Failed');
- $return[] = array($ret1,$ret2);
+ if($plotType == 1) {
+ $ret1 = array((int)$r[0],'Succeeded');
+ $ret2 = array((int)$r[1],'Failed');
+ $return[] = array($ret1,$ret2);
+ } else if($plotType == 2) {
+ $ret1 = array('Successful', (int)$r[0]);
+ $ret2 = array('Failed', (int)$r[1]);
+ $return[] = array($ret1,$ret2);
+ }
}
return $return;
}
- public function getSuccessPieCount($poolID) {
-
- $db = Zend_Db_Table::getDefaultAdapter();
- if($poolID != 'all'){
- $select = $this->getDbTable()->select()
- ->setIntegrityCheck(false)
- ->from(array('pcr' => 'poolctrl_eventreport'),
- array('count1' => 'SUM(IF(pcr.result="succeeded",1,0))', 'count0' => 'SUM(IF(pcr.result="failed",1,0))')
- )
- ->join(array('pce' => 'poolctrl_event'),
- 'pce.eventID = pcr.eventID',
- array())
- ->where('pce.pbs_poolID = ?', $poolID);}
- else {
- $select = $this->getDbTable()->select()
- ->setIntegrityCheck(false)
- ->from(array('pcr' => 'poolctrl_eventreport'),
- array('count1' => 'SUM(IF(pcr.result="succeeded",1,0))', 'count0' => 'SUM(IF(pcr.result="failed",1,0))')
- )
- ->join(array('pce' => 'poolctrl_event'),
- 'pce.eventID = pcr.eventID',
- array());
- }
-
- $stmt = $db->query($select);
- $result = $stmt->fetchAll(PDO::FETCH_NUM);
-
- foreach ($result as $r) {
- $ret1 = array('Successful', (int)$r[0]);
- $ret2 = array('Failed', (int)$r[1]);
- $return[] = array($ret1,$ret2);
- }
-
- return $return;
- }
-
}
diff --git a/application/views/scripts/statistics/category.phtml b/application/views/scripts/statistics/category.phtml
index 8319d20..2f8ed37 100755
--- a/application/views/scripts/statistics/category.phtml
+++ b/application/views/scripts/statistics/category.phtml
@@ -11,98 +11,9 @@
<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");
-}
-
-function refreshPlot(dataBar, dataPie, color) {
- $('#plotBar').empty();
- $.jqplot('plotBar', dataBar, {
- seriesDefaults: {
- renderer:$.jqplot.BarRenderer,
- pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
- shadowAngle: 135,
- rendererOptions: {
- 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,
- varyBarColor : true
- }
- },
- seriesColors: color
- });
-}
-
-$(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>
+<!-- Add CategoryPlot -->
+<script
+ type="text/javascript" src="/media/js/categoryPlot.js"></script>
<div>
<div id="plotBar" class="spalte"
diff --git a/application/views/scripts/statistics/running.phtml b/application/views/scripts/statistics/running.phtml
index 7bf27b8..2d2688c 100755
--- a/application/views/scripts/statistics/running.phtml
+++ b/application/views/scripts/statistics/running.phtml
@@ -11,96 +11,9 @@
<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);
- }, "json");
-}
-
-function refreshPlot(dataBar, dataPie) {
- $('#plotBar').empty();
- $.jqplot('plotBar', dataBar, {
- seriesDefaults: {
- renderer:$.jqplot.BarRenderer,
- pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
- shadowAngle: 135,
- rendererOptions: {
- barDirection: 'horizontal',
- varyBarColor : true
- }
- },
- axes: {
- yaxis: {
- renderer: $.jqplot.CategoryAxisRenderer
- }
- }
- });
- $('#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
- }
- }
- });
- }
-
-$(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>
+<!-- Add RunningPlot -->
+<script
+ type="text/javascript" src="/media/js/runningPlot.js"></script>
<div>
<div id="plotBar" class="spalte"
diff --git a/application/views/scripts/statistics/success.phtml b/application/views/scripts/statistics/success.phtml
index e00a01d..c4c204d 100755
--- a/application/views/scripts/statistics/success.phtml
+++ b/application/views/scripts/statistics/success.phtml
@@ -10,96 +10,9 @@
<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();
- $('#plotPieS').empty();
- } else if (poolID == 'default') {
- $('#plotBar').empty();
- $('#plotPieS').empty();
- } else refreshPlot(data.dataBar, data.dataPieS, data.dataPieT);
- }, "json");
-}
-
-function refreshPlot(dataBar, dataPieS, dataPieT) {
- $('#plotBar').empty();
- $.jqplot('plotBar', dataBar, {
- seriesDefaults: {
- //renderer: $.jqplot.PieRenderer,
- renderer:$.jqplot.BarRenderer,
- pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
- shadowAngle: 135,
- rendererOptions: {
- barDirection: 'horizontal',
- varyBarColor : true
- }
- },
- axes: {
- yaxis: {
- renderer: $.jqplot.CategoryAxisRenderer
- }
- }
- });
- $('#plotPieS').empty();
- $.jqplot('plotPieS', dataPieS,
- {
- 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,
- varyBarColor : true
- }
- }
- });
- }
-
-$(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>
+<!-- Add SuccessPlot -->
+<script
+ type="text/javascript" src="/media/js/successPlot.js"></script>
<div>
<div id="plotBar" class="spalte" style="height: 300px; width: 350px;"></div>
diff --git a/application/views/scripts/statistics/type.phtml b/application/views/scripts/statistics/type.phtml
index a34eb2b..b4082e6 100755
--- a/application/views/scripts/statistics/type.phtml
+++ b/application/views/scripts/statistics/type.phtml
@@ -11,96 +11,9 @@
<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);
- }, "json");
-}
-
-function refreshPlot(dataBar, dataPie) {
- $('#plotBar').empty();
- $.jqplot('plotBar', dataBar, {
- seriesDefaults: {
- renderer:$.jqplot.BarRenderer,
- pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
- shadowAngle: 135,
- rendererOptions: {
- barDirection: 'horizontal',
- varyBarColor : true
- }
- },
- axes: {
- yaxis: {
- renderer: $.jqplot.CategoryAxisRenderer
- }
- }
- });
- $('#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
- }
- }
- });
- }
-
-$(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>
+<!-- Add TypePlot -->
+<script
+ type="text/javascript" src="/media/js/typePlot.js"></script>
<div>
<div id="plotBar" class="spalte"
diff --git a/public/media/js/categoryPlot.js b/public/media/js/categoryPlot.js
new file mode 100644
index 0000000..e633b9e
--- /dev/null
+++ b/public/media/js/categoryPlot.js
@@ -0,0 +1,88 @@
+//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/categoryplot/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");
+}
+
+function refreshPlot(dataBar, dataPie, color) {
+ $('#plotBar').empty();
+ $.jqplot('plotBar', dataBar, {
+ seriesDefaults: {
+ renderer:$.jqplot.BarRenderer,
+ pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
+ shadowAngle: 135,
+ rendererOptions: {
+ 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,
+ varyBarColor : true
+ }
+ },
+ seriesColors: color
+ });
+}
+
+$(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");
+ }
+ });
+ }); \ No newline at end of file
diff --git a/public/media/js/runningPlot.js b/public/media/js/runningPlot.js
new file mode 100644
index 0000000..ff8a8f5
--- /dev/null
+++ b/public/media/js/runningPlot.js
@@ -0,0 +1,86 @@
+//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/runningplot/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);
+ }, "json");
+}
+
+function refreshPlot(dataBar, dataPie) {
+ $('#plotBar').empty();
+ $.jqplot('plotBar', dataBar, {
+ seriesDefaults: {
+ renderer:$.jqplot.BarRenderer,
+ pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
+ shadowAngle: 135,
+ rendererOptions: {
+ barDirection: 'horizontal',
+ varyBarColor : true
+ }
+ },
+ axes: {
+ yaxis: {
+ renderer: $.jqplot.CategoryAxisRenderer
+ }
+ }
+ });
+ $('#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
+ }
+ }
+ });
+ }
+
+$(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");
+ }
+ });
+ }); \ No newline at end of file
diff --git a/public/media/js/successPlot.js b/public/media/js/successPlot.js
new file mode 100644
index 0000000..f2c0d7e
--- /dev/null
+++ b/public/media/js/successPlot.js
@@ -0,0 +1,86 @@
+//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/successplot/poolID/" + poolID, function(data) {
+ if(data.dataBar == '0,Successful,0,Failed' && poolID != 'default') {
+ $( "#noEventsDialog" ).dialog('open');
+ $('#plotBar').empty();
+ $('#plotPieS').empty();
+ } else if (poolID == 'default') {
+ $('#plotBar').empty();
+ $('#plotPieS').empty();
+ } else refreshPlot(data.dataBar, data.dataPieS, data.dataPieT);
+ }, "json");
+}
+
+function refreshPlot(dataBar, dataPieS, dataPieT) {
+ $('#plotBar').empty();
+ $.jqplot('plotBar', dataBar, {
+ seriesDefaults: {
+ //renderer: $.jqplot.PieRenderer,
+ renderer:$.jqplot.BarRenderer,
+ pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
+ shadowAngle: 135,
+ rendererOptions: {
+ barDirection: 'horizontal',
+ varyBarColor : true
+ }
+ },
+ axes: {
+ yaxis: {
+ renderer: $.jqplot.CategoryAxisRenderer
+ }
+ }
+ });
+ $('#plotPieS').empty();
+ $.jqplot('plotPieS', dataPieS,
+ {
+ 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,
+ varyBarColor : true
+ }
+ }
+ });
+ }
+
+$(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");
+ }
+ });
+ }); \ No newline at end of file
diff --git a/public/media/js/typePlot.js b/public/media/js/typePlot.js
new file mode 100644
index 0000000..09f12ad
--- /dev/null
+++ b/public/media/js/typePlot.js
@@ -0,0 +1,86 @@
+//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/typeplot/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);
+ }, "json");
+}
+
+function refreshPlot(dataBar, dataPie) {
+ $('#plotBar').empty();
+ $.jqplot('plotBar', dataBar, {
+ seriesDefaults: {
+ renderer:$.jqplot.BarRenderer,
+ pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
+ shadowAngle: 135,
+ rendererOptions: {
+ barDirection: 'horizontal',
+ varyBarColor : true
+ }
+ },
+ axes: {
+ yaxis: {
+ renderer: $.jqplot.CategoryAxisRenderer
+ }
+ }
+ });
+ $('#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
+ }
+ }
+ });
+ }
+
+$(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");
+ }
+ });
+ }); \ No newline at end of file