summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorSebastian Wagner2011-10-07 17:44:10 +0200
committerSebastian Wagner2011-10-07 17:44:10 +0200
commitbd9b37b87cc771a4b72aa7a62811eac8850bffe1 (patch)
treeba9bc0ceaf96fd051c6164f18b59f4e5ecf14290 /application
parentminor (diff)
downloadpoolctrl-bd9b37b87cc771a4b72aa7a62811eac8850bffe1.tar.gz
poolctrl-bd9b37b87cc771a4b72aa7a62811eac8850bffe1.tar.xz
poolctrl-bd9b37b87cc771a4b72aa7a62811eac8850bffe1.zip
some changes
Diffstat (limited to 'application')
-rwxr-xr-xapplication/controllers/StatisticsController.php3
-rwxr-xr-xapplication/layouts/default.phtml2
-rwxr-xr-xapplication/models/EventreportMapper.php37
-rwxr-xr-xapplication/views/scripts/statistics/category.phtml7
-rw-r--r--application/views/scripts/statistics/success.phtml55
5 files changed, 76 insertions, 28 deletions
diff --git a/application/controllers/StatisticsController.php b/application/controllers/StatisticsController.php
index 93e63a7..a523683 100755
--- a/application/controllers/StatisticsController.php
+++ b/application/controllers/StatisticsController.php
@@ -98,7 +98,8 @@ class StatisticsController extends Zend_Controller_Action
}
$ret['dataBar'] = $this->eventreportMapper->getSuccessBarCount($poolID);
- $ret['dataPie'] = $this->eventreportMapper->getSuccessPieCount($poolID);
+ $ret['dataPieS'] = $this->eventreportMapper->getSuccessPieCount($poolID);
+ $ret['dataPieT'] = $this->eventreportMapper->getSuccessTypePieCount($poolID);
echo json_encode($ret);
diff --git a/application/layouts/default.phtml b/application/layouts/default.phtml
index 5c999dd..0db0dd2 100755
--- a/application/layouts/default.phtml
+++ b/application/layouts/default.phtml
@@ -25,7 +25,7 @@ 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/jquery.jqplot.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>
diff --git a/application/models/EventreportMapper.php b/application/models/EventreportMapper.php
index 7f7434e..4d2b55d 100755
--- a/application/models/EventreportMapper.php
+++ b/application/models/EventreportMapper.php
@@ -236,5 +236,42 @@ class Application_Model_EventreportMapper
return $return;
}
+ public function getSuccessTypePieCount($poolID) {
+
+ $db = Zend_Db_Table::getDefaultAdapter();
+ if($poolID != 'all'){
+ $select = $this->getDbTable()->select()
+ ->setIntegrityCheck(false)
+ ->from(array('pcr' => 'poolctrl_eventreport'),
+ array('errortype' => 'pcr.errors', 'count' => 'COUNT(*)'))
+ ->join(array('pce' => 'poolctrl_event'),
+ 'pce.eventID = pcr.eventID',
+ array())
+ ->where('pce.pbs_poolID = ?', $poolID)
+ ->group('pcr.errors')
+ ->order('pce.category ASC');}
+ else {
+ $select = $this->getDbTable()->select()
+ ->setIntegrityCheck(false)
+ ->from(array('pcr' => 'poolctrl_eventreport'),
+ array('errortype' => 'pcr.errors', 'count' => 'COUNT(*)'))
+ ->join(array('pce' => 'poolctrl_event'),
+ 'pce.eventID = pcr.eventID',
+ array())
+ ->group('pcr.errors')
+ ->order('pce.category ASC');
+ }
+
+ $stmt = $db->query($select);
+ $result = $stmt->fetchAll(PDO::FETCH_NUM);
+ $ret = null;
+
+ foreach ($result as $r) {
+ $ret[] = array($r[0], (int)$r[1]);
+ }
+
+ return array($ret);
+ }
+
}
diff --git a/application/views/scripts/statistics/category.phtml b/application/views/scripts/statistics/category.phtml
index b509229..5d62170 100755
--- a/application/views/scripts/statistics/category.phtml
+++ b/application/views/scripts/statistics/category.phtml
@@ -4,10 +4,6 @@
<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();">
@@ -41,8 +37,6 @@ function plot() {
}, "json");
}
-//[[[4,"Lecture"],[36,"Maintenance"],[9,"Boot"],[21,"Shutdown"]]]
-
function refreshPlot(dataBar, dataPie, color) {
$('#plotBar').empty();
$.jqplot('plotBar', dataBar, {
@@ -75,7 +69,6 @@ function refreshPlot(dataBar, dataPie, color) {
// Put data labels on the pie slices.
// By default, labels show the percentage of the slice.
showDataLabels: true,
- lineLabels: true,
varyBarColor : true
}
},
diff --git a/application/views/scripts/statistics/success.phtml b/application/views/scripts/statistics/success.phtml
index 5d15c73..4e67698 100644
--- a/application/views/scripts/statistics/success.phtml
+++ b/application/views/scripts/statistics/success.phtml
@@ -1,14 +1,13 @@
<h1>Statistics</h1>
-<h2>How many events were successfully?</h2>
+<h2>How many events were successful?</h2>
-<link
- rel="stylesheet" type="text/css"
- href="/media/css/jquery.jqplot.min.css" />
+<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>
+ onclick="setPoolIDtmp();" onChange="fetchPoolEvents();">
+ <option value="default">Please choose a Pool</option>
+ <option value="all">All Pools</option>
</select>
<script>
@@ -29,15 +28,17 @@ function plot() {
if(data.dataBar == '0,Successful,0,Failed' && poolID != 'default') {
$( "#noEventsDialog" ).dialog('open');
$('#plotBar').empty();
- $('#plotPie').empty();
+ $('#plotPieS').empty();
+ $('#plotPieT').empty();
} else if (poolID == 'default') {
$('#plotBar').empty();
- $('#plotPie').empty();
- } else refreshPlot(data.dataBar, data.dataPie, data.color);
+ $('#plotPieS').empty();
+ $('#plotPieT').empty();
+ } else refreshPlot(data.dataBar, data.dataPieS, data.dataPieT, data.color);
}, "json");
}
-function refreshPlot(dataBar, dataPie, color) {
+function refreshPlot(dataBar, dataPieS, dataPieT, color) {
$('#plotBar').empty();
$.jqplot('plotBar', dataBar, {
seriesDefaults: {
@@ -59,8 +60,8 @@ function refreshPlot(dataBar, dataPie, color) {
seriesColors: color,
highlighter: { show: false }
});
- $('#plotPie').empty();
- $.jqplot('plotPie', dataPie,
+ $('#plotPieS').empty();
+ $.jqplot('plotPieS', dataPieS,
{
seriesDefaults: {
// Make this a pie chart.
@@ -69,13 +70,30 @@ function refreshPlot(dataBar, dataPie, color) {
// 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' }
});
+ $('#plotPieT').empty();
+ $.jqplot('plotPieT', dataPieT,
+ {
+ title: 'Chart with ErrorType Labels',
+ 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,
+ dataLabels: 'label'
+ }
+ },
+ seriesColors: color
+ //legend: { show:true, location: 'ne' }
+ });
}
$(document).ready(function(){
@@ -109,13 +127,12 @@ $(function() {
</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 id="plotBar" class="spalte" style="height: 300px; width: 250px;"></div>
+<div id="plotPieS" class="spalte" style="height: 300px; width: 250px;"></div>
+<div id="plotPieT" class="spalte" style="height: 300px; width: 250px;"></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
+</div>