Changeset 502
- Timestamp:
- 08/24/08 02:05:36 (3 months ago)
- Location:
- trunk
- Files:
-
- 3 added
- 11 modified
-
modules/base/dashboardTrendWidget.php (modified) (5 diffs)
-
modules/base/metrics/dashCoreByDay.php (modified) (2 diffs)
-
modules/base/metrics/dashCoreByMonth.php (modified) (2 diffs)
-
modules/base/templates/generic_table.tpl (added)
-
modules/base/templates/ofc.tpl (added)
-
modules/base/templates/report_dashboard.tpl (modified) (2 diffs)
-
modules/base/templates/widget.tpl (modified) (1 diff)
-
modules/base/widget.php (modified) (2 diffs)
-
owa_base.php (modified) (2 diffs)
-
owa_coreAPI.php (modified) (2 diffs)
-
owa_metric.php (modified) (3 diffs)
-
owa_template.php (modified) (2 diffs)
-
owa_view.php (modified) (5 diffs)
-
public/js/jQuery.owa.js (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/base/dashboardTrendWidget.php
r501 r502 42 42 $m->setPeriod($this->params['period']); 43 43 $m->setOrder(OWA_SQL_ASCENDING); 44 $results = $m->generate();44 45 45 46 46 if (array_key_exists('format', $this->params)): … … 51 51 52 52 $data['title'] = 'Dashboard Trend'; 53 $data['view'] = 'base.widget'; 54 $data['y']['label'] = 'Page Views'; 55 $data['y2']['label'] = 'Visits'; 56 $data['x']['label'] = 'Day'; 53 $data['params'] = $this->params; 54 $data['widget'] = 'base.dashboardTrendWidget'; 57 55 58 56 switch ($format) { … … 60 58 case 'graph': 61 59 60 $data['view'] = 'base.openFlashChart'; 61 $data['height'] = $this->params['height']; 62 $data['width'] = $this->params['width']; 63 break; 64 65 case 'graph-data': 66 $results = $m->generate(); 62 67 $series = owa_lib::deconstruct_assoc($results); 68 $data['y']['label'] = 'Page Views'; 69 $data['y2']['label'] = 'Visits'; 70 $data['x']['label'] = 'Day'; 63 71 $data['y']['series'] = $series['page_views']; 64 72 $data['y2']['series'] = $series['sessions']; … … 68 76 69 77 case 'table': 70 $data['column_labels'] = array(); 71 $data['data'] = ''; 78 $m->setLimit(5); 79 $results = $m->generate(); 80 $data['labels'] = $m->getLabels(); 81 $data['rows'] = $results; 72 82 $data['view'] = 'base.genericTable'; 73 83 break; … … 75 85 76 86 } 87 88 if ($this->params['initial-view'] == true): 89 $data['subview'] = $data['view']; 90 $data['view'] = 'base.widget'; 91 endif; 92 77 93 78 94 return $data; -
trunk/modules/base/metrics/dashCoreByDay.php
r501 r502 33 33 function owa_dashCoreByDay($params = null) { 34 34 35 $this->params = $params; 35 return owa_dashCoreByDay::__construct($params); 36 37 } 38 39 function __construct($params = null) { 40 41 parent::__construct($params); 36 42 37 $this-> owa_metric();43 $this->setLabels(array('Month', 'Day', 'Year', 'Unique Visitors', 'Sessions', 'Page Views')); 38 44 39 45 return; … … 62 68 $db->orderBy('day'); 63 69 70 if (array_key_exists('limit', $this->params)): 71 $db->limit($this->params['limit']); 72 endif; 73 64 74 $ret = $db->getAllRows(); 65 75 66 76 return $ret; 67 68 69 /* 70 71 $this->params['select'] = "session.month, 72 session.day, 73 session.year, 74 count(distinct session.visitor_id) as unique_visitors, 75 count(session.id) as sessions, 76 sum(session.num_pageviews) as page_views "; 77 78 79 $this->params['groupby'] = array('day', 'month'); 80 81 $this->params['orderby'] = array('year', 'month', 'day'); 82 83 $this->setTimePeriod($this->params['period']); 84 85 $s = owa_coreAPI::entityFactory('base.session'); 86 87 return $s->query($this->params); 88 89 */ 77 90 78 } 91 79 -
trunk/modules/base/metrics/dashCoreByMonth.php
r501 r502 33 33 function owa_dashCoreByMonth($params = null) { 34 34 35 $this->params = $params;35 return owa_dashCoreByMonth::__construct($params); 36 36 37 $this->owa_metric(); 37 } 38 39 function __construct($params = null) { 40 41 parent::__construct($params); 38 42 43 $this->setLabels(array('Month', 'Day', 'Year', 'Unique Visitors', 'Sessions', 'Page Views')); 44 39 45 return; 40 46 … … 61 67 return $db->getAllRows(); 62 68 63 /*64 65 $this->params['select'] = "session.month,66 session.day,67 session.year,68 count(distinct session.visitor_id) as unique_visitors,69 count(session.id) as sessions,70 sum(session.num_pageviews) as page_views ";71 72 $this->params['use_summary'] = true;73 74 $this->params['groupby'] = array('month', 'year');75 76 $this->params['orderby'] = array('year', 'month');77 78 $this->setTimePeriod($this->params['period']);79 80 $s = owa_coreAPI::entityFactory('base.session');81 82 return $s->query($this->params);83 84 */85 69 } 86 70 -
trunk/modules/base/templates/report_dashboard.tpl
r501 r502 13 13 </style> 14 14 15 <script type="text/javascript" src="<?=$this->config['public_url'];?>js/includes/jquery/jquery.js"></script> 16 15 17 <? include('report_header.tpl');?> 16 18 … … 19 21 <TD valign="top" id="trend_graph"> 20 22 21 < img src="<?=$this->graphLink(array('view' => 'base.graphDashboardTrend', 'period' => 'last_thirty_days', 'site_id' => $params['site_id'])); ?>">23 <!-- <img src="<?=$this->graphLink(array('view' => 'base.graphDashboardTrend', 'period' => 'last_thirty_days', 'site_id' => $params['site_id'])); ?>"> --> 22 24 23 25 <?=$this->getWidget('base.dashboardTrendWidget', 'graph', array('height' => 300, 'width' => 900));?> 26 <? //$this->getWidget('base.dashboardTrendWidget', 'table', array('height' => 300, 'width' => 900));?> 24 27 </TD> 25 28 </TR> -
trunk/modules/base/templates/widget.tpl
r501 r502 1 < div style="border: 2px solid red;">1 <style> 2 2 3 <div id="flash-graph" style="visiblity:;"> 3 .widget-container {border:1px solid #cccccc; width:100%;} 4 .widget-header {color: white;background-color:orange; padding:10px;text-align:left; font-weight:bold; font-size:18px;} 5 .widget-title {font-size:20px;text-align:right;} 6 .widget-title a {color: white;} 7 .widget-title-controls {font-size:14px;text-align:right;} 8 .widget-controls {text-align:right;padding:10px} 9 .widget-content {padding:10px;} 4 10 5 < ?=$this->ofc($params['width'], $params['height'], $this->makeAbsoluteLink(array('do' => $widget, 'period' => 'last_thirty_days', 'site_id' => $params['site_id'], 'format' => $format), false , $this->config['action_url'])); ?>11 </style> 6 12 7 </div>8 9 <div id="data-table"></div>10 <div id="data-export"></div>11 12 </div>13 13 14 14 <script> 15 var state = new Object; 16 state['<?=$widget;?>'] = new Object; 17 state['<?=$widget;?>'].url = "http://wp25-php5-test.openwebanalytics.com/index.php?owa_specialAction&owa_do=base.dashboardTrendWidget&owa_period=last_thirty_days&owa_format="; 15 18 16 19 </script> 20 21 <script> 22 //var widgeturl = "http://wp25-php5-test.openwebanalytics.com/index.php?owa_specialAction&owa_do=base.dashboardTrendWidget&owa_period=last_thirty_days&owa_format="; 23 var widgeturl = state['<?=$widget;?>'].url; 24 25 // When the document loads do everything inside here ... 26 jQuery(document).ready(function(){ 27 //$('#content').load('boo.php'); //by default initally load text from boo.php 28 jQuery('.widget-control').click(function() { //start function when any link is clicked 29 var parentname = jQuery("div").parent(".widget-container").attr("id"); 30 var widgetname2 = parentname.split("_"); 31 var widgetname = widgetname2[0]; 32 var widgetcontentid = "#"+widgetname+"_widget-content"; 33 var format = jQuery(this).attr("name"); 34 //alert(widgetcontentid); 35 jQuery(widgetcontentid).slideUp("slow"); 36 //var content_show = $(this).attr("title"); //retrieve title of link so we can compare with php file 37 jQuery.ajax({ 38 method: "get",url: widgeturl+format, 39 beforeSend: function(){ jQuery(".widget-status").show("fast");}, //show loading just when link is clicked 40 complete: function(){ jQuery(".widget-status").hide("fast");}, //stop showing loading when the process is complete 41 success: function(html){ //so, if data is retrieved, store it in html 42 jQuery(widgetcontentid).show("slow"); //animation 43 jQuery(widgetcontentid).html(html); //show the html inside .content div 44 } 45 }); //close $.ajax( 46 }); //close click( 47 }); //close $( 48 </script> 49 50 51 <div id="<?=$widget;?>_widget-container" class="widget-container"> 52 53 <div id="<?=$widget;?>_widget-header"class="widget-header"> 54 <span class="widget-title"><?=$title;?></span> 55 56 <div id="<?=$widget;?>_widget-title-controls" style="float:right;"> 57 <span class="widget-title-controls"><a href="">Close</a></span> 58 </div> 59 60 </div> 61 62 <div id="<?=$widget;?>_widget-status" class="widget-status">LOADING</div> 63 64 <div id="<?=$widget;?>_widget-content" class="widget-content"><?=$subview;?></div> 65 66 <div id="<?=$widget;?>_widget-controls" class="widget-controls"> 67 <a class="widget-control" href="#base-dashboardTrendWidget_widget-header" name="graph">Graph</a> | 68 <a class="widget-control" href="#base-dashboardTrendWidget_widget-header" name="table">Table</a> | 69 <a class="widget-control" href="#base-dashboardTrendWidget_widget-header" name="sparkline">Sparkline</a> 70 </div> 71 72 73 </div> -
trunk/modules/base/widget.php
r501 r502 83 83 // load template 84 84 85 if ($data[' is_external'] == true):85 if ($data['params']['is_external'] == true): 86 86 $this->t->set_template('wrapper_widget.tpl'); 87 87 else: … … 90 90 91 91 if (!array_key_exists('width', $data)): 92 $data[' width'] = 300;92 $data['params']['width'] = 300; 93 93 endif; 94 94 95 95 if (!array_key_exists('width', $data)): 96 $data[' height'] = 250;96 $data['params']['height'] = 250; 97 97 endif; 98 98 99 99 $this->body->set_template('widget.tpl'); 100 $this->body->set('format', $data['format']); 101 $this->body->set('widget', $data['widget']); 102 $this->body->set('params', $data['params']); 100 $this->body->set('format', $data['params']['format']); 101 $this->body->set('widget', str_replace('.', '-', $data['widget'])); 102 $this->body->set('params', $data['params']['params']); 103 $this->body->set('title', $data['title']); 103 104 return; 104 105 } -
trunk/owa_base.php
r498 r502 75 75 function owa_base() { 76 76 77 return owa_base::__construct(); 78 79 } 80 81 function __construct() { 82 77 83 $this->e = &owa_coreAPI::errorSingleton(); 78 84 $this->c = &owa_coreAPI::configSingleton(); … … 80 86 81 87 return; 82 88 83 89 } 84 90 -
trunk/owa_coreAPI.php
r501 r502 300 300 list($module, $file) = split("\.", $modulefile); 301 301 $class = $class_ns.$file.$class_suffix; 302 302 //print $class; 303 303 // Require class file if class does not already exist 304 304 if(!class_exists($class)): … … 369 369 list($module, $class) = split("\.", $subview); 370 370 371 owa_lib::moduleRequireOnce($module, $class);371 //owa_lib::moduleRequireOnce($module, $class); 372 372 373 373 $subview = owa_lib::moduleFactory($module, $class.'View', $params); -
trunk/owa_metric.php
r501 r502 52 52 */ 53 53 var $params = array(); 54 55 var $db; 54 55 /** 56 * The lables for calculated measures 57 * 58 * @var array 59 */ 60 var $labels = array(); 56 61 57 62 /** … … 63 68 function owa_metric($params = '') { 64 69 65 return $this->__construct($params);70 return owa_metric::__construct($params); 66 71 } 67 72 … … 412 417 413 418 } 419 420 421 /** 422 * Set the labels of the measures 423 * 424 */ 425 function setLabels($array) { 426 427 $this->labels = $array; 428 return; 429 } 430 431 /** 432 * Retrieve the labels of the measures 433 * 434 */ 435 function getLabels() { 436 437 return $this->labels; 438 439 } 440 441 414 442 } 415 443 -
trunk/owa_template.php
r501 r502 579 579 } 580 580 581 function getWidget($widget, $format, $params = '') {581 function getWidget($widget, $format, $params = array()) { 582 582 583 583 if (empty($params)): … … 587 587 $params['widget'] = $widget; 588 588 $params['format'] = $format; 589 590 $api = owa_coreAPI::singleton(); 591 592 return $api->performAction('base.widget', $params); 589 $params['initial-view'] = true; 590 591 return owa_coreAPI::performAction($widget, $params); 593 592 } 594 593 -
trunk/owa_view.php
r501 r502 17 17 // 18 18 19 require_once( 'owa_template.php');20 require_once('owa_base.php');21 require_once( 'owa_requestContainer.php');22 require_once(OWA_BASE_CLASSES_DIR.'owa_coreAPI.php');19 require_once(OWA_BASE_CLASSES_DIR.'owa_template.php'); 20 //require_once(OWA_BASE_CLASSES_DIR.'owa_base.php'); 21 require_once(OWA_BASE_CLASSES_DIR.'owa_requestContainer.php'); // ?? 22 //require_once(OWA_BASE_CLASSES_DIR.'owa_coreAPI.php'); 23 23 24 24 /** … … 301 301 else: 302 302 //$this->e->debug('RenderView: '.print_r($data, true)); 303 $api = &owa_coreAPI::singleton();304 305 $subview = $api->displaySubView($auth_data);303 //$api = &owa_coreAPI::singleton(); 304 305 $subview = owa_coreAPI::displaySubView($auth_data); 306 306 307 307 return $subview; … … 412 412 } 413 413 414 class owa_pieFlashChartView extends owa_ base{414 class owa_pieFlashChartView extends owa_view { 415 415 416 416 function owa_pieFlashChartView() { … … 421 421 function __construct() { 422 422 423 return $this->owa_base();423 return parent::__construct(); 424 424 425 425 } … … 458 458 } 459 459 460 461 462 460 class owa_genericTableView extends owa_view { 461 462 function __construct() { 463 464 return parent::__construct(); 465 466 } 467 468 function owa_genericTableView() { 469 470 return owa_genericTableView::__construct(); 471 } 472 473 function construct($data) { 474 475 $this->t->set_template('wrapper_blank.tpl'); 476 $this->body->set_template('generic_table.tpl'); 477 478 if (!empty($data['labels'])): 479 $this->body->set('labels', $data['labels']); 480 else: 481 $this->body->set('labels', ''); 482 endif; 483 484 if (!empty($data['rows'])): 485 $this->body->set('rows', $data['rows']); 486 $this->body->set('row_count', count($data['rows'])); 487 else: 488 $this->body->set('rows', ''); 489 $this->body->set('row_count', 0); 490 endif; 491 492 } 493 494 } 495 496 class owa_openFlashChartView extends owa_view { 497 498 function owa_openFlashChartView() { 499 500 owa_openFlashChartView::__construct(); 501 502 return; 503 } 504 505 function __construct() { 506 507 return parent::__construct(); 508 509 } 510 511 function construct($data) { 512 513 // load template 514 $this->t->set_template('wrapper_blank.tpl'); 515 $this->body->set_template('ofc.tpl'); 516 // set 517 $this->body->set('widget', $data['widget']); 518 $this->body->set('height', $data['height']); 519 $this->body->set('width', $data['width']); 520 521 return; 522 523 } 524 525 } 463 526 464 527 ?>
