summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xapplication/controllers/StatisticController.php25
-rwxr-xr-xapplication/layouts/default.phtml1
-rwxr-xr-xapplication/models/EventMapper.php256
-rwxr-xr-xapplication/models/EventcategoryMapper.php40
-rwxr-xr-xapplication/models/EventreportMapper.php86
-rwxr-xr-xapplication/views/scripts/statistic/category.phtml1
-rwxr-xr-xapplication/views/scripts/statistic/index.phtml2
-rwxr-xr-xapplication/views/scripts/statistic/running.phtml7
-rw-r--r--application/views/scripts/statistic/success.phtml1
-rw-r--r--application/views/scripts/statistic/type.phtml120
10 files changed, 425 insertions, 114 deletions
diff --git a/application/controllers/StatisticController.php b/application/controllers/StatisticController.php
index 3f42944..57d73d3 100755
--- a/application/controllers/StatisticController.php
+++ b/application/controllers/StatisticController.php
@@ -104,6 +104,27 @@ class StatisticController extends Zend_Controller_Action
}
+ 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() {
}
@@ -116,4 +137,8 @@ class StatisticController extends Zend_Controller_Action
}
+ public function typeAction() {
+
+ }
+
} \ No newline at end of file
diff --git a/application/layouts/default.phtml b/application/layouts/default.phtml
index 53eeedb..7649a33 100755
--- a/application/layouts/default.phtml
+++ b/application/layouts/default.phtml
@@ -57,6 +57,7 @@ echo $this->headScript()."\n";
<li class='navTreeItem'><a href='/statistic/category'>Category</a></li>
<li class='navTreeItem'><a href='/statistic/running'>Running</a></li>
<li class='navTreeItem'><a href='/statistic/success'>Success</a></li>
+ <li class='navTreeItem'><a href='/statistic/type'>Type</a></li>
</ul>
</li>
<?php } ?>
diff --git a/application/models/EventMapper.php b/application/models/EventMapper.php
index 2fc4b71..0995a2d 100755
--- a/application/models/EventMapper.php
+++ b/application/models/EventMapper.php
@@ -187,101 +187,229 @@ class Application_Model_EventMapper
public function getCategoryBarCount($poolID) {
$db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->setIntegrityCheck(false)
- ->from(array('pce' => 'poolctrl_event'),
- array('count' => 'COUNT(*)', 'category' => 'pcec.title'))
- ->join(array('pcec' => 'poolctrl_eventcategory'),
+ 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');
+ 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;
+ $stmt = $db->query($select);
+ $result = $stmt->fetchAll(PDO::FETCH_NUM);
+ $ret = null;
- foreach ($result as $r) {
- $ret[] = array((int)$r[0], $r[1]);
- }
+ foreach ($result as $r) {
+ $ret[] = array((int)$r[0], $r[1]);
+ }
- return array($ret);
+ return array($ret);
}
public function getCategoryPieCount($poolID) {
$db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->setIntegrityCheck(false)
- ->from(array('pce' => 'poolctrl_event'),
- array('category' => 'pcec.title', 'count' => 'COUNT(*)'))
- ->join(array('pcec' => 'poolctrl_eventcategory'),
+ if($poolID != 'all'){
+ $select = $this->getDbTable()->select()
+ ->setIntegrityCheck(false)
+ ->from(array('pce' => 'poolctrl_event'),
+ array('category' => 'pcec.title', 'count' => 'COUNT(*)'))
+ ->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('category' => 'pcec.title', 'count' => 'COUNT(*)'))
+ ->join(array('pcec' => 'poolctrl_eventcategory'),
'pce.category = pcec.eventcategoryID',
- array())
- ->where('pce.pbs_poolID = ?', $poolID)
- ->group('pce.category')
- ->order('pce.category ASC');
+ array())
+ ->group('pce.category')
+ ->order('pce.category ASC');
+ }
- $stmt = $db->query($select);
- $result = $stmt->fetchAll(PDO::FETCH_NUM);
- $ret = null;
+ $stmt = $db->query($select);
+ $result = $stmt->fetchAll(PDO::FETCH_NUM);
+ $ret = null;
- foreach ($result as $r) {
- $ret[] = array($r[0], (int)$r[1]);
- }
+ foreach ($result as $r) {
+ $ret[] = array($r[0], (int)$r[1]);
+ }
- return array($ret);
+ return array($ret);
}
public function getRunningBarCount($poolID) {
$db = Zend_Db_Table::getDefaultAdapter();
- $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=0,1,0))')
- )
- ->join(array('pcec' => 'poolctrl_eventcategory'),
+ 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=0,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('over' => 'SUM(IF(pce.running=1,1,0))', 'not_over' => 'SUM(IF(pce.running=0,1,0))')
+ )
+ ->join(array('pcec' => 'poolctrl_eventcategory'),
'pce.category = pcec.eventcategoryID',
- array())
- ->where('pce.pbs_poolID = ?', $poolID);
+ array());
+ }
- $stmt = $db->query($select);
- $result = $stmt->fetchAll(PDO::FETCH_NUM);
+ $stmt = $db->query($select);
+ $result = $stmt->fetchAll(PDO::FETCH_NUM);
- foreach ($result as $r) {
- $ret1 = array((int)$r[0],'Event over');
- $ret2 = array((int)$r[1],'Event not over');
- $return[] = array($ret1,$ret2);
- }
+ foreach ($result as $r) {
+ $ret1 = array((int)$r[0],'Event over');
+ $ret2 = array((int)$r[1],'Event not over');
+ $return[] = array($ret1,$ret2);
+ }
- return $return;
+ return $return;
}
public function getRunningPieCount($poolID) {
$db = Zend_Db_Table::getDefaultAdapter();
- $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=0,1,0))')
- )
- ->join(array('pcec' => 'poolctrl_eventcategory'),
+ 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=0,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('over' => 'SUM(IF(pce.running=1,1,0))', 'not_over' => 'SUM(IF(pce.running=0,1,0))')
+ )
+ ->join(array('pcec' => 'poolctrl_eventcategory'),
'pce.category = pcec.eventcategoryID',
- array())
- ->where('pce.pbs_poolID = ?', $poolID);
+ array());
+ }
- $stmt = $db->query($select);
- $result = $stmt->fetchAll(PDO::FETCH_NUM);
+ $stmt = $db->query($select);
+ $result = $stmt->fetchAll(PDO::FETCH_NUM);
- foreach ($result as $r) {
- $ret1 = array('running0', (int)$r[0]);
- $ret2 = array('running1', (int)$r[1]);
- $return[] = array($ret1,$ret2);
- }
+ foreach ($result as $r) {
+ $ret1 = array('Event over', (int)$r[0]);
+ $ret2 = array('Event not over', (int)$r[1]);
+ $return[] = array($ret1,$ret2);
+ }
+
+ return $return;
+ }
+
+ public function getTypeBarCount($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((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);
+ }
- return $return;
+ return $return;
}
} \ No newline at end of file
diff --git a/application/models/EventcategoryMapper.php b/application/models/EventcategoryMapper.php
index f481140..f1a5996 100755
--- a/application/models/EventcategoryMapper.php
+++ b/application/models/EventcategoryMapper.php
@@ -155,23 +155,35 @@ class Application_Model_EventcategoryMapper
public function getCategoryColor($poolID) {
$db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->distinct()
- ->setIntegrityCheck(false)
- ->from(array('pcec' => 'poolctrl_eventcategory'),
- array('color' => 'pcec.color'))
- ->join(array('pce' => 'poolctrl_event'),
+ if($poolID != 'all'){
+ $select = $this->getDbTable()->select()
+ ->distinct()
+ ->setIntegrityCheck(false)
+ ->from(array('pcec' => 'poolctrl_eventcategory'),
+ array('color' => 'pcec.color'))
+ ->join(array('pce' => 'poolctrl_event'),
+ 'pce.category = pcec.eventcategoryID',
+ array())
+ ->where('pce.pbs_poolID = ?', $poolID)
+ ->group('pce.category')
+ ->order('eventcategoryID ASC');}
+ else {
+ $select = $this->getDbTable()->select()
+ ->distinct()
+ ->setIntegrityCheck(false)
+ ->from(array('pcec' => 'poolctrl_eventcategory'),
+ array('color' => 'pcec.color'))
+ ->join(array('pce' => 'poolctrl_event'),
'pce.category = pcec.eventcategoryID',
- array())
- ->where('pce.pbs_poolID = ?', $poolID)
- ->group('pce.category')
- ->order('eventcategoryID ASC')
- ;
+ array())
+ ->group('pce.category')
+ ->order('eventcategoryID ASC');
+ }
- $stmt = $db->query($select);
- $result = $stmt->fetchAll(PDO::FETCH_COLUMN, 0);
+ $stmt = $db->query($select);
+ $result = $stmt->fetchAll(PDO::FETCH_COLUMN, 0);
- return $result;
+ return $result;
}
} \ No newline at end of file
diff --git a/application/models/EventreportMapper.php b/application/models/EventreportMapper.php
index 309dd18..7f7434e 100755
--- a/application/models/EventreportMapper.php
+++ b/application/models/EventreportMapper.php
@@ -167,51 +167,73 @@ class Application_Model_EventreportMapper
public function getSuccessBarCount($poolID) {
$db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->setIntegrityCheck(false)
- ->from(array('pcr' => 'poolctrl_eventreport'),
- array('count1' => 'SUM(IF(pcr.result="successful",1,0))', 'count0' => 'SUM(IF(pcr.result="failed",1,0))')
- )
- ->join(array('pce' => 'poolctrl_event'),
+ if($poolID != 'all'){
+ $select = $this->getDbTable()->select()
+ ->setIntegrityCheck(false)
+ ->from(array('pcr' => 'poolctrl_eventreport'),
+ array('count1' => 'SUM(IF(pcr.result="successful",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="successful",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);
+ array());
+ }
- $stmt = $db->query($select);
- $result = $stmt->fetchAll(PDO::FETCH_NUM);
+ $stmt = $db->query($select);
+ $result = $stmt->fetchAll(PDO::FETCH_NUM);
- foreach ($result as $r) {
- $ret1 = array((int)$r[0],'Successful');
- $ret2 = array((int)$r[1],'Failed');
- $return[] = array($ret1,$ret2);
- }
+ foreach ($result as $r) {
+ $ret1 = array((int)$r[0],'Successful');
+ $ret2 = array((int)$r[1],'Failed');
+ $return[] = array($ret1,$ret2);
+ }
- return $return;
+ return $return;
}
public function getSuccessPieCount($poolID) {
$db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->setIntegrityCheck(false)
- ->from(array('pcr' => 'poolctrl_eventreport'),
- array('count1' => 'SUM(IF(pcr.result="successful",1,0))', 'count0' => 'SUM(IF(pcr.result="failed",1,0))')
- )
- ->join(array('pce' => 'poolctrl_event'),
+ if($poolID != 'all'){
+ $select = $this->getDbTable()->select()
+ ->setIntegrityCheck(false)
+ ->from(array('pcr' => 'poolctrl_eventreport'),
+ array('count1' => 'SUM(IF(pcr.result="successful",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="successful",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);
+ array());
+ }
- $stmt = $db->query($select);
- $result = $stmt->fetchAll(PDO::FETCH_NUM);
+ $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);
- }
+ foreach ($result as $r) {
+ $ret1 = array('Successful', (int)$r[0]);
+ $ret2 = array('Failed', (int)$r[1]);
+ $return[] = array($ret1,$ret2);
+ }
- return $return;
+ return $return;
}
}
diff --git a/application/views/scripts/statistic/category.phtml b/application/views/scripts/statistic/category.phtml
index 364d176..4f94216 100755
--- a/application/views/scripts/statistic/category.phtml
+++ b/application/views/scripts/statistic/category.phtml
@@ -11,6 +11,7 @@
<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>
diff --git a/application/views/scripts/statistic/index.phtml b/application/views/scripts/statistic/index.phtml
index 0d735bf..1303efd 100755
--- a/application/views/scripts/statistic/index.phtml
+++ b/application/views/scripts/statistic/index.phtml
@@ -1,4 +1,4 @@
<h1>Statistic</h1>
<body>
-<h2>Please choose a statistic Type</h2>
+<h2>Please choose a statistic</h2>
</body> \ No newline at end of file
diff --git a/application/views/scripts/statistic/running.phtml b/application/views/scripts/statistic/running.phtml
index c59ab83..1ac0a49 100755
--- a/application/views/scripts/statistic/running.phtml
+++ b/application/views/scripts/statistic/running.phtml
@@ -7,6 +7,7 @@
<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>
@@ -24,10 +25,10 @@ function setPoolIDtmp() {
function plot() {
poolID = $("#poolselectbox option:selected").val();
$.get("/statistic/runninglist/poolID/" + poolID, function(data) {
- if(data.dataBar == '0,running0,0,running1' && poolID != 'default') {
- $( "#noEventsDialog" ).dialog('open');
- $('#plotBar').empty();
+ 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();
diff --git a/application/views/scripts/statistic/success.phtml b/application/views/scripts/statistic/success.phtml
index 0180ad9..0d502b6 100644
--- a/application/views/scripts/statistic/success.phtml
+++ b/application/views/scripts/statistic/success.phtml
@@ -7,6 +7,7 @@
<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>
diff --git a/application/views/scripts/statistic/type.phtml b/application/views/scripts/statistic/type.phtml
new file mode 100644
index 0000000..6e72a8c
--- /dev/null
+++ b/application/views/scripts/statistic/type.phtml
@@ -0,0 +1,120 @@
+<h1>Statistic - 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("/statistic/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