From a19068db1ccc0982fa604edd32a7e5351e2e2388 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Fri, 30 Sep 2011 17:09:23 +0200 Subject: some changes --- application/controllers/StatisticController.php | 22 +++++++++++++--- application/models/EventcategoryMapper.php | 31 ++++++++++++++++++++++ application/views/scripts/event/index.phtml | 2 +- application/views/scripts/statistic/index.phtml | 34 ++++++++++++++++--------- 4 files changed, 73 insertions(+), 16 deletions(-) (limited to 'application') diff --git a/application/controllers/StatisticController.php b/application/controllers/StatisticController.php index cb36b89..4def963 100644 --- a/application/controllers/StatisticController.php +++ b/application/controllers/StatisticController.php @@ -37,13 +37,19 @@ class StatisticController extends Zend_Controller_Action $this->view->right = $this->acl->checkRight($rightShortcut); } + public function dumpAction() { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + $data = $this->_request->getParam("data"); + var_dump($data); + } + 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')) { @@ -51,7 +57,7 @@ class StatisticController extends Zend_Controller_Action } else { $eventList = $this->eventMapper->findBy(array("pbs_membershipID", $this->userIDsNamespace['membershipID'])); } - + $count = 0; foreach ($eventList as $event){ @@ -60,6 +66,16 @@ class StatisticController extends Zend_Controller_Action $count += 1; } } - echo $count; + //echo $count; + + $ret = array(); + + $ret[] = array(3,'Lecture'); + $ret[] = array(2,'Boot'); + $ret[] = array(65,'Shutdown'); + $ret[] = array(20,'Maintenance'); + + echo json_encode(array($ret)); + } } \ No newline at end of file diff --git a/application/models/EventcategoryMapper.php b/application/models/EventcategoryMapper.php index b70a116..1ba0369 100755 --- a/application/models/EventcategoryMapper.php +++ b/application/models/EventcategoryMapper.php @@ -82,6 +82,37 @@ class Application_Model_EventcategoryMapper return $this->_dbTable; } + + /*public function getCategoryCount() { + + + $select = $db->select() + ->from(array('p' => 'products'), + array('product_id')) + ->join(array('l' => 'line_items'), + 'p.product_id = l.product_id', + array('line_items_per_product' => 'COUNT(*)')) + ->group('p.product_id'); + + +// Erzeugt diese Anfrage: +// SELECT p."product_id", COUNT(*) AS line_items_per_product +// FROM "products" AS p JOIN "line_items" AS l +// ON p.product_id = l.product_id +// GROUP BY p.product_id + * + * + * + * + * SELECT category, COUNT( * ) AS count + * FROM `poolctrl_event` + * GROUP BY category + * LIMIT 0 , 30 + + + }*/ + + public function save(Application_Model_Eventcategory $eventcategory) { diff --git a/application/views/scripts/event/index.phtml b/application/views/scripts/event/index.phtml index aaf277c..f5beb9e 100755 --- a/application/views/scripts/event/index.phtml +++ b/application/views/scripts/event/index.phtml @@ -621,7 +621,7 @@ var dayClick = false; autoOpen: false, width: 600, modal: true, - title: 'Edit ' + event.title, + title: 'Edit ' + selectedEvent.title, buttons: { "Cancel": function() { $(this).dialog("close"); diff --git a/application/views/scripts/statistic/index.phtml b/application/views/scripts/statistic/index.phtml index 369a5a8..d6c9ca9 100644 --- a/application/views/scripts/statistic/index.phtml +++ b/application/views/scripts/statistic/index.phtml @@ -15,6 +15,7 @@ var lecture = 0; var boot = 0; var shutdown = 0; var maintenance = 0; +var foo; //fetch all poolevents of the selected #poolselectbox value function fetchPoolEvents() { @@ -28,16 +29,29 @@ function setPoolIDtmp() { 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();}); + + $.get("/statistic/categorylist/poolID/" + poolID + "/category/" + 2, function(data) { +// lecture = data.lecture; +// boot = data.boot; +// shutdown = data.shutdown; +// maintenance = data.maintenance; + refreshPlot(data); +// $.ajax({ +// type: 'POST', +// url: "/statistic/dump", +// data: {data: [[[boot,'Boot'], [shutdown,'Shutdwon'], [maintenance,'Maintenance'], [lecture,'Lecture']]]}, +// success: function(){alert("done");}, +// dataType: "json" +// }); + + }, "json"); } -function refreshPlot() { +function refreshPlot(data) { $('#plot').empty(); - $.jqplot('plot', [ - [[boot,'Boot'], [shutdown,'Shutdwon'], [maintenance,'Maintenance'], [lecture,'Lecture']]], { +// $.jqplot('plot', [ +// [[boot,'Boot'], [shutdown,'Shutdwon'], [maintenance,'Maintenance'], [lecture,'Lecture']]], { + $.jqplot('plot', data, { seriesDefaults: { renderer:$.jqplot.BarRenderer, // Show point labels to the right ('e'ast) of each bar. @@ -68,11 +82,7 @@ $(document).ready(function(){ poolIDtmp = $("#poolselectbox option:selected").val(); fetchPoolEvents(); }); - - // For horizontal bar charts, x an y values must will be "flipped" - // from their vertical bar counterpart. }); -
+
-- cgit v1.2.3-55-g7522