import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -1,106 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
* @package CommunityID
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
class Stats_AuthorizationsController extends CommunityID_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->weekSelected = '';
|
||||
$this->view->yearSelected = '';
|
||||
|
||||
switch ($this->_getParam('type')) {
|
||||
case 'year':
|
||||
$this->view->yearSelected = 'selected="true"';
|
||||
$this->view->type = 'year';
|
||||
break;
|
||||
default:
|
||||
$this->view->weekSelected = 'selected="true"';
|
||||
$this->view->type = 'week';
|
||||
}
|
||||
|
||||
$this->view->rand = rand(0, 1000);
|
||||
}
|
||||
|
||||
public function graphAction()
|
||||
{
|
||||
require_once 'libs/jpgraph/jpgraph.php';
|
||||
require_once 'libs/jpgraph/jpgraph_bar.php';
|
||||
|
||||
$this->_helper->viewRenderer->setNeverRender(true);
|
||||
$this->_helper->layout->disableLayout();
|
||||
|
||||
$graph = new Graph(300,200 ,'auto');
|
||||
$graph->SetMarginColor('white');
|
||||
$graph->SetFrame(false);
|
||||
$graph->SetScale("textlin");
|
||||
$graph->img->SetMargin(0,30,20,40);
|
||||
$graph->yaxis->scale->SetGrace(20);
|
||||
$graph->yaxis->HideLabels();
|
||||
$graph->yaxis->HideTicks();
|
||||
$graph->ygrid->SetFill(true,'#EFEFEF@0.5','#BBCCFF@0.5');
|
||||
|
||||
$labelsy = array();
|
||||
$datay = array();
|
||||
|
||||
switch ($this->_getParam('type')) {
|
||||
case 'year':
|
||||
$this->_populateYearData($labelsy, $datay);
|
||||
break;
|
||||
default:
|
||||
$this->_populateWeekData($labelsy, $datay);
|
||||
}
|
||||
|
||||
$graph->xaxis->SetTickLabels($labelsy);
|
||||
$bplot = new BarPlot($datay);
|
||||
|
||||
$bplot->SetFillGradient("navy","lightsteelblue",GRAD_WIDE_MIDVER);
|
||||
$bplot->value->Show();
|
||||
$bplot->value->SetFormat('%d');
|
||||
$graph->Add($bplot);
|
||||
|
||||
$graph->Stroke();
|
||||
}
|
||||
|
||||
private function _populateWeekData(&$labelsy, &$datay)
|
||||
{
|
||||
$stats = new Stats_Model_Stats();
|
||||
$authorizations = $stats->getNumAuthorizationsDays(strtotime('-1 week'), time());
|
||||
|
||||
for ($i = -7; $i < 0; $i++) {
|
||||
$time = strtotime("$i days");
|
||||
$date = date('Y-m-d', $time);
|
||||
$labelsy[] = Stats_Model_Stats::$weekDays[date('w', $time)];
|
||||
if (isset($authorizations[$date])) {
|
||||
$datay[] = $authorizations[$date]['entry'];
|
||||
} else {
|
||||
$datay[] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function _populateYearData(&$labelsy, &$datay)
|
||||
{
|
||||
$stats = new Stats_Model_Stats();
|
||||
$firstDayOfMonth = date('Y-' . date('m') . '-01');
|
||||
$authorizations = $stats->getNumAuthorizationsYear(strtotime('-11 months', strtotime($firstDayOfMonth)), time());
|
||||
|
||||
for ($i = -11; $i <= 0; $i++) {
|
||||
$time = strtotime("$i months");
|
||||
$monthNumber = date('n', $time);
|
||||
$labelsy[] = Stats_Model_Stats::$months[$monthNumber];
|
||||
if (isset($authorizations[$monthNumber])) {
|
||||
$datay[] = $authorizations[$monthNumber]['entry'];
|
||||
} else {
|
||||
$datay[] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
@ -11,9 +11,52 @@
|
||||
|
||||
class Stats_IndexController extends CommunityID_Controller_Action
|
||||
{
|
||||
const LOCATION_LEFT = 0;
|
||||
const LOCATION_RIGHT = 1;
|
||||
|
||||
protected $_numCols = 1;
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$statPlugins = array();
|
||||
$this->view->pluginsLeft = array();
|
||||
$this->view->pluginsRight = array();
|
||||
|
||||
$dir = dir(APP_DIR . Stats_Model_Report::STATS_PLUGIN_DIR);
|
||||
$i = 0;
|
||||
while (false !== ($entry = $dir->read())) {
|
||||
if (in_array($entry, array('.', '..'))
|
||||
|| substr($entry, -4) != '.php') {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
$reportName = substr($entry, 0, -4);
|
||||
$statPlugins[$i] = Stats_Model_Report::getReportInstance($reportName);
|
||||
$statPlugins[$i]->setView($this->view);
|
||||
} catch (Monkeys_AccessDeniedException $ex) {
|
||||
Zend_Registry::get('logger')->log("Unable to open Stats plugin: $entry", Zend_Log::WARN);
|
||||
continue;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$dir->close();
|
||||
usort($statPlugins, array($this, '_sortPlugins'));
|
||||
|
||||
$location = self::LOCATION_LEFT;
|
||||
foreach ($statPlugins as $statPlugin) {
|
||||
if ($location == self::LOCATION_LEFT) {
|
||||
$this->view->pluginsLeft[] = $statPlugin;
|
||||
$location = self::LOCATION_RIGHT;
|
||||
} else {
|
||||
$this->view->pluginsRight[] = $statPlugin;
|
||||
$location = self::LOCATION_LEFT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function _sortPlugins(Stats_Model_Report $pluginA, Stats_Model_Report $pluginB)
|
||||
{
|
||||
return $pluginA->getPriority() - $pluginB->getPriority();
|
||||
}
|
||||
}
|
||||
|
@ -1,130 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
* @package CommunityID
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
class Stats_RegistrationsController extends CommunityID_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->weekSelected = '';
|
||||
$this->view->yearSelected = '';
|
||||
|
||||
switch ($this->_getParam('type')) {
|
||||
case 'month':
|
||||
$this->view->monthSelected = 'selected="true"';
|
||||
$this->view->type = 'month';
|
||||
break;
|
||||
case 'year':
|
||||
$this->view->yearSelected = 'selected="true"';
|
||||
$this->view->type = 'year';
|
||||
break;
|
||||
default:
|
||||
$this->view->weekSelected = 'selected="true"';
|
||||
$this->view->type = 'week';
|
||||
}
|
||||
|
||||
$this->view->rand = rand(0, 1000);
|
||||
}
|
||||
|
||||
public function graphAction()
|
||||
{
|
||||
require_once 'libs/jpgraph/jpgraph.php';
|
||||
require_once 'libs/jpgraph/jpgraph_bar.php';
|
||||
|
||||
$this->_helper->viewRenderer->setNeverRender(true);
|
||||
$this->_helper->layout->disableLayout();
|
||||
|
||||
$graph = new Graph($this->_getParam('type') == 'month'? 400 : 300, 200 ,'auto');
|
||||
$graph->SetMarginColor('white');
|
||||
$graph->SetFrame(false);
|
||||
$graph->SetScale("textlin");
|
||||
$graph->img->SetMargin(0,30,20,40);
|
||||
$graph->yaxis->scale->SetGrace(20);
|
||||
$graph->yaxis->HideLabels();
|
||||
$graph->yaxis->HideTicks();
|
||||
$graph->ygrid->SetFill(true,'#EFEFEF@0.5','#BBCCFF@0.5');
|
||||
|
||||
$labelsy = array();
|
||||
$datay = array();
|
||||
|
||||
switch ($this->_getParam('type')) {
|
||||
case 'month':
|
||||
$this->_populateMonthData($labelsy, $datay);
|
||||
break;
|
||||
case 'year':
|
||||
$this->_populateYearData($labelsy, $datay);
|
||||
break;
|
||||
default:
|
||||
$this->_populateWeekData($labelsy, $datay);
|
||||
}
|
||||
|
||||
$graph->xaxis->SetTickLabels($labelsy);
|
||||
$bplot = new BarPlot($datay);
|
||||
|
||||
$bplot->SetFillGradient("navy","lightsteelblue",GRAD_WIDE_MIDVER);
|
||||
$bplot->value->Show();
|
||||
$bplot->value->SetFormat('%d');
|
||||
$graph->Add($bplot);
|
||||
|
||||
$graph->Stroke();
|
||||
}
|
||||
|
||||
private function _populateWeekData(&$labelsy, &$datay)
|
||||
{
|
||||
$stats = new Stats_Model_Stats();
|
||||
$registeredUsers = $stats->getNumRegisteredUsersDays(strtotime('-1 week'), time(), true);
|
||||
|
||||
for ($i = -7; $i < 0; $i++) {
|
||||
$time = strtotime("$i days");
|
||||
$date = date('Y-m-d', $time);
|
||||
$labelsy[] = Stats_Model_Stats::$weekDays[date('w', $time)];
|
||||
if (isset($registeredUsers[$date])) {
|
||||
$datay[] = $registeredUsers[$date]['users'];
|
||||
} else {
|
||||
$datay[] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function _populateMonthData(&$labelsy, &$datay)
|
||||
{
|
||||
$stats = new Stats_Model_Stats();
|
||||
$registeredUsers = $stats->getNumRegisteredUsersDays(strtotime('-30 days'), strtotime('-1 week'), true);
|
||||
|
||||
for ($i = -30; $i < -7; $i++) {
|
||||
$time = strtotime("$i days");
|
||||
$date = date('Y-m-d', $time);
|
||||
$labelsy[] = date('j', $time);
|
||||
if (isset($registeredUsers[$date])) {
|
||||
$datay[] = $registeredUsers[$date]['users'];
|
||||
} else {
|
||||
$datay[] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function _populateYearData(&$labelsy, &$datay)
|
||||
{
|
||||
$stats = new Stats_Model_Stats();
|
||||
$firstDayOfMonth = date('Y-' . date('m') . '-01');
|
||||
$registeredUsers = $stats->getNumRegisteredUsersYear(strtotime('-11 months', strtotime($firstDayOfMonth)), time(), true);
|
||||
|
||||
for ($i = -11; $i <= 0; $i++) {
|
||||
$time = strtotime("$i months");
|
||||
$monthNumber = date('n', $time);
|
||||
$labelsy[] = Stats_Model_Stats::$months[$monthNumber];
|
||||
if (isset($registeredUsers[$monthNumber])) {
|
||||
$datay[] = $registeredUsers[$monthNumber]['users'];
|
||||
} else {
|
||||
$datay[] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
50
modules/stats/controllers/ReportsController.php
Normal file
50
modules/stats/controllers/ReportsController.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
* @package CommunityID
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
class Stats_ReportsController extends CommunityID_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$statPlugin = $this->_getPlugin();
|
||||
$statPlugin->setTemplateVars();
|
||||
|
||||
$pluginView = clone $this->view;
|
||||
$pluginView->plugin = $statPlugin;
|
||||
$pluginView->setScriptPath(APP_DIR . Stats_Model_Report::STATS_PLUGIN_DIR);
|
||||
$this->view->reportTitle = $statPlugin->getTitle();
|
||||
$this->view->content = $pluginView->render($statPlugin->getClassName().'.phtml');
|
||||
}
|
||||
|
||||
public function graphAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNeverRender(true);
|
||||
$this->_helper->layout->disableLayout();
|
||||
$statPlugin = $this->_getPlugin();
|
||||
$statPlugin->renderGraph();
|
||||
}
|
||||
|
||||
private function _getPlugin()
|
||||
{
|
||||
$reportName = $this->_getParam('report');
|
||||
|
||||
try {
|
||||
$statPlugin = Stats_Model_Report::getReportInstance($reportName);
|
||||
} catch (Monkeys_AccessDeniedException $ex) {
|
||||
throw new Exception("Unable to open Stats plugin: $entry");
|
||||
}
|
||||
|
||||
$statPlugin->setControllerAction($this);
|
||||
$statPlugin->setView($this->view);
|
||||
|
||||
return $statPlugin;
|
||||
}
|
||||
}
|
||||
|
@ -1,168 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
* @package CommunityID
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
class Stats_SitesController extends CommunityID_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->weekSelected = '';
|
||||
$this->view->yearSelected = '';
|
||||
|
||||
switch ($this->_getParam('type')) {
|
||||
case 'year':
|
||||
$this->view->yearSelected = 'selected="true"';
|
||||
$this->view->type = 'year';
|
||||
break;
|
||||
default:
|
||||
$this->view->weekSelected = 'selected="true"';
|
||||
$this->view->type = 'week';
|
||||
}
|
||||
|
||||
$this->view->rand = rand(0, 1000);
|
||||
}
|
||||
|
||||
public function graphAction()
|
||||
{
|
||||
require_once 'libs/jpgraph/jpgraph.php';
|
||||
require_once 'libs/jpgraph/jpgraph_bar.php';
|
||||
require_once 'libs/jpgraph/jpgraph_line.php';
|
||||
|
||||
$this->_helper->viewRenderer->setNeverRender(true);
|
||||
$this->_helper->layout->disableLayout();
|
||||
|
||||
$graph = new Graph(300,200 ,'auto');
|
||||
$graph->SetMarginColor('white');
|
||||
$graph->SetFrame(false);
|
||||
$graph->SetScale("textlin");
|
||||
$graph->SetY2Scale("lin");
|
||||
$graph->img->SetMargin(0,30,20,50);
|
||||
$graph->yaxis->HideLabels();
|
||||
$graph->yaxis->HideTicks();
|
||||
$graph->yaxis->scale->SetGrace(20);
|
||||
$graph->y2axis->SetColor("black","red");
|
||||
$graph->ygrid->SetFill(true,'#EFEFEF@0.5','#BBCCFF@0.5');
|
||||
|
||||
$labelsy = array();
|
||||
$datay = array();
|
||||
$datay2 = array();
|
||||
|
||||
switch ($this->_getParam('type')) {
|
||||
case 'year':
|
||||
$this->_populateYearData($labelsy, $datay, $datay2);
|
||||
break;
|
||||
default:
|
||||
$this->_populateWeekData($labelsy, $datay, $datay2);
|
||||
}
|
||||
|
||||
$graph->xaxis->SetTickLabels($labelsy);
|
||||
|
||||
$bplot = new BarPlot($datay);
|
||||
$bplot->setLegend(utf8_decode($this->view->translate('Trusted sites')));
|
||||
$bplot->SetFillGradient("navy","lightsteelblue",GRAD_WIDE_MIDVER);
|
||||
$bplot->value->Show();
|
||||
$bplot->value->SetFormat('%d');
|
||||
|
||||
$p1 = new LinePlot($datay2);
|
||||
$p1->SetColor("red");
|
||||
$p1->SetLegend(utf8_decode($this->view->translate('Sites per user')));
|
||||
|
||||
$graph->Add($bplot);
|
||||
$graph->AddY2($p1);
|
||||
|
||||
$graph->legend->SetLayout(LEGEND_HOR);
|
||||
$graph->legend->Pos(0.5,0.99,"center","bottom");
|
||||
|
||||
$graph->Stroke();
|
||||
}
|
||||
|
||||
private function _populateWeekData(&$labelsy, &$datay, &$datay2)
|
||||
{
|
||||
$stats = new Stats_Model_Stats();
|
||||
$initialTrustedSites = $stats->getNumTrustedSites(strtotime('-1 week'));
|
||||
$initialRegisteredUsers = $stats->getNumRegisteredUsers(strtotime('-1 week'));
|
||||
|
||||
$sites = $stats->getNumTrustedSitesDays(strtotime('-1 week'), time());
|
||||
$numUsers = $stats->getNumRegisteredUsersDays(strtotime('-1 week'), time());
|
||||
|
||||
for ($i = -7; $i < 0; $i++) {
|
||||
$time = strtotime("$i days");
|
||||
$date = date('Y-m-d', $time);
|
||||
$labelsy[] = Stats_Model_Stats::$weekDays[date('w', $time)];
|
||||
|
||||
if (isset($sites[$date])) {
|
||||
$sitesPeriod = $sites[$date]['site'];
|
||||
} else {
|
||||
$sitesPeriod = 0;
|
||||
}
|
||||
|
||||
if (isset($numUsers[$date])) {
|
||||
$usersPeriod = $numUsers[$date]['users'];
|
||||
} else {
|
||||
$usersPeriod = 0;
|
||||
}
|
||||
|
||||
if ($i > -7) {
|
||||
$datay[] = $datay[$i + 6] + $sitesPeriod;
|
||||
$datay2[] = $datay2[$i + 6] + $usersPeriod;
|
||||
} else {
|
||||
$datay[] = $initialTrustedSites + $sitesPeriod;
|
||||
$datay2[] = $initialRegisteredUsers + $usersPeriod;
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0; $i < count($datay2); $i++) {
|
||||
$datay2[$i] = round($datay[$i] / $datay2[$i], 2);
|
||||
}
|
||||
}
|
||||
|
||||
private function _populateYearData(&$labelsy, &$datay, &$datay2)
|
||||
{
|
||||
$stats = new Stats_Model_Stats();
|
||||
$initialTrustedSites = $stats->getNumTrustedSites(strtotime('-1 week'));
|
||||
$initialRegisteredUsers = $stats->getNumRegisteredUsers(strtotime('-1 week'));
|
||||
|
||||
$firstDayOfMonth = date('Y-' . date('m') . '-01');
|
||||
|
||||
$sites = $stats->getNumTrustedSitesYear(strtotime('-11 months', strtotime($firstDayOfMonth)), time());
|
||||
$numUsers = $stats->getNumRegisteredUsersYear(strtotime('-1 week'), time());
|
||||
|
||||
for ($i = -11; $i <= 0; $i++) {
|
||||
$time = strtotime("$i months");
|
||||
$monthNumber = date('n', $time);
|
||||
$labelsy[] = Stats_Model_Stats::$months[$monthNumber];
|
||||
|
||||
if (isset($sites[$monthNumber])) {
|
||||
$sitesPeriod = $sites[$monthNumber]['site'];
|
||||
} else {
|
||||
$sitesPeriod = 0;
|
||||
}
|
||||
|
||||
if (isset($numUsers[$monthNumber])) {
|
||||
$usersPeriod = $numUsers[$monthNumber]['users'];
|
||||
} else {
|
||||
$usersPeriod = 0;
|
||||
}
|
||||
|
||||
if ($i > -11) {
|
||||
$datay[] = $datay[$i + 10] + $sitesPeriod;
|
||||
$datay2[] = $datay2[$i + 10] + $usersPeriod;
|
||||
} else {
|
||||
$datay[] = $initialTrustedSites + $sitesPeriod;
|
||||
$datay2[] = $initialRegisteredUsers + $usersPeriod;
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0; $i < count($datay2); $i++) {
|
||||
$datay2[$i] = round($datay[$i] / $datay2[$i], 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
* @package CommunityID
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
class Stats_TopController extends CommunityID_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$stats = new Stats_Model_Stats();
|
||||
$this->view->sites = $stats->getTopTenSites();
|
||||
}
|
||||
}
|
65
modules/stats/models/Report.php
Normal file
65
modules/stats/models/Report.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkeys Ltd.
|
||||
* @since CommunityID 0.9
|
||||
* @package CommunityID
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
abstract class Stats_Model_Report
|
||||
{
|
||||
const STATS_PLUGIN_DIR = '/plugins/stats';
|
||||
|
||||
protected $_controllerAction;
|
||||
protected $view;
|
||||
|
||||
public abstract function getTitle();
|
||||
|
||||
public abstract function getPriority();
|
||||
|
||||
public abstract function setTemplateVars();
|
||||
|
||||
public function renderGraph() {}
|
||||
|
||||
public function setView(Zend_View $view)
|
||||
{
|
||||
$this->view = $view;
|
||||
}
|
||||
|
||||
public function setControllerAction(CommunityID_Controller_Action $controllerAction)
|
||||
{
|
||||
$this->_controllerAction = $controllerAction;
|
||||
}
|
||||
|
||||
public function getIdentifier()
|
||||
{
|
||||
return md5($this->getTitle());
|
||||
}
|
||||
|
||||
public function getClassName()
|
||||
{
|
||||
return get_class($this);
|
||||
}
|
||||
|
||||
public static function getReportInstance($reportName)
|
||||
{
|
||||
$statPath = APP_DIR . self::STATS_PLUGIN_DIR . "/$reportName.php";
|
||||
if (Zend_Registry::get('config')->environment->production) {
|
||||
$includeResult = @include $statPath;
|
||||
} else {
|
||||
$includeResult = include $statPath;
|
||||
}
|
||||
if (!$includeResult) {
|
||||
throw new Monkeys_AccessDeniedException();
|
||||
Zend_Registry::get('logger')->log("Unable to open Stats plugin: $statPath", Zend_Log::WARN);
|
||||
continue;
|
||||
}
|
||||
|
||||
$statPlugin = new $reportName();
|
||||
|
||||
return $statPlugin;
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @copyright Copyright (C) 2005-2010 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkeys Ltd.
|
||||
* @since CommunityID 0.9
|
||||
|
@ -1,10 +0,0 @@
|
||||
<h3><?php echo $this->translate('Authorizations per day') ?></h3>
|
||||
<div>
|
||||
<?php echo $this->translate('Select view') ?>:
|
||||
<select name="view" onchange="COMMID.stats.loadReport('authorizations', 'statsAuths', 'type=' + this.value)">
|
||||
<option value="week" <?php echo $this->weekSelected ?>><?php echo $this->translate('Last Week') ?></option>
|
||||
<option value="year" <?php echo $this->yearSelected ?>><?php echo $this->translate('Last Year') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<img src="<?php echo $this->base ?>/stats/authorizations/graph?rand=<?php echo $this->rand ?>&type=<?php echo $this->type ?>" />
|
||||
|
@ -1,12 +1,12 @@
|
||||
<script>
|
||||
var reports = new Array();
|
||||
YAHOO.util.Event.onDOMReady(function () {
|
||||
COMMID.loader.insert(
|
||||
["connection"],
|
||||
function() {
|
||||
COMMID.stats.loadReport("registrations", "statsRegs");
|
||||
COMMID.stats.loadReport("authorizations", "statsAuths");
|
||||
COMMID.stats.loadReport("sites", "statsNumTrustedSites");
|
||||
COMMID.stats.loadReport("top", "statsTopTen");
|
||||
for (var i = 0; i < reports.length; i++) {
|
||||
COMMID.stats.loadReport(reports[i].name, reports[i].location);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
@ -14,11 +14,19 @@ YAHOO.util.Event.onDOMReady(function () {
|
||||
|
||||
<div class="yui-g">
|
||||
<div class="yui-u first">
|
||||
<div id="statsRegs"></div>
|
||||
<div id="statsNumTrustedSites"></div>
|
||||
<? foreach ($this->pluginsLeft as $plugin): ?>
|
||||
<div id="stats_<?= $plugin->getIdentifier() ?>"></div>
|
||||
<script>
|
||||
reports.push({name: "<?= $plugin->getClassName() ?>", location: "stats_<?= $plugin->getIdentifier() ?>"});
|
||||
</script>
|
||||
<? endforeach ?>
|
||||
</div>
|
||||
<div class="yui-u">
|
||||
<div id="statsAuths"></div>
|
||||
<div id="statsTopTen"></div>
|
||||
<? foreach ($this->pluginsRight as $plugin): ?>
|
||||
<div id="stats_<?= $plugin->getIdentifier() ?>"></div>
|
||||
<script>
|
||||
reports.push({name: "<?= $plugin->getClassName() ?>", location: "stats_<?= $plugin->getIdentifier() ?>"});
|
||||
</script>
|
||||
<? endforeach ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,10 +0,0 @@
|
||||
<h3><?php echo $this->translate('Registrations per day') ?></h3>
|
||||
<div>
|
||||
<?php echo $this->translate('Select view') ?>:
|
||||
<select name="view" onchange="COMMID.stats.loadReport('registrations', 'statsRegs', 'type=' + this.value)">
|
||||
<option value="week" <?php echo $this->weekSelected ?>><?php echo $this->translate('Last Week') ?></option>
|
||||
<option value="month" <?php echo $this->monthSelected ?>><?php echo $this->translate('Last Month') ?></option>
|
||||
<option value="year" <?php echo $this->yearSelected ?>><?php echo $this->translate('Last Year') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<img src="<?php echo $this->base ?>/stats/registrations/graph?rand=<?php echo $this->rand ?>&type=<?php echo $this->type ?>" />
|
2
modules/stats/views/scripts/reports/index.phtml
Normal file
2
modules/stats/views/scripts/reports/index.phtml
Normal file
@ -0,0 +1,2 @@
|
||||
<h3><?= $this->reportTitle ?></h3>
|
||||
<?= $this->content ?>
|
@ -1,9 +0,0 @@
|
||||
<h3><?php echo $this->translate('Trusted Sites') ?></h3>
|
||||
<div>
|
||||
<?php echo $this->translate('Select view') ?>:
|
||||
<select name="view" onchange="COMMID.stats.loadReport('sites', 'statsNumTrustedSites', 'type=' + this.value)">
|
||||
<option value="week" <?php echo $this->weekSelected ?>><?php echo $this->translate('Last Week') ?></option>
|
||||
<option value="year" <?php echo $this->yearSelected ?>><?php echo $this->translate('Last Year') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<img src="<?php echo $this->base ?>/stats/sites/graph?rand=<?php echo $this->rand ?>&type=<?php echo $this->type ?>" />
|
@ -1,10 +0,0 @@
|
||||
<h3><?php echo $this->translate('Top 10 Trusted Sites') ?></h3>
|
||||
<table id="topTenTable">
|
||||
<?php foreach ($this->sites as $num => $siteInfo): ?>
|
||||
<tr>
|
||||
<td><?php echo $num + 1 ?></td>
|
||||
<td><?php echo $siteInfo['site'] ?></td>
|
||||
<td>(<?php echo $this->translate('%s users', $siteInfo['num']) ?>)</td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</table>
|
Reference in New Issue
Block a user