Skip to content

Commit

Permalink
* add statistics pgae in administrator panelö showing number of terms…
Browse files Browse the repository at this point in the history
… published/unpublished and also numbe rof articles with and without tags
  • Loading branch information
cedricwalter committed Apr 24, 2012
1 parent b2d1a42 commit 668277f
Show file tree
Hide file tree
Showing 9 changed files with 202 additions and 7 deletions.
1 change: 1 addition & 0 deletions com_cedTag/admin/cedtag.php
Expand Up @@ -16,6 +16,7 @@
require_once (JPATH_COMPONENT . '/controllers/stopwords.php');
require_once (JPATH_COMPONENT . '/controllers/import.php');
require_once (JPATH_COMPONENT . '/controllers/export.php');
require_once (JPATH_COMPONENT . '/controllers/statistics.php');

$document = & JFactory::getDocument();
$document->addStyleSheet(JURI::root() . '/media/com_cedtag/css/tag.css');
Expand Down
42 changes: 42 additions & 0 deletions com_cedTag/admin/controllers/statistics.php
@@ -0,0 +1,42 @@
<?php
/**
* @package Component cedTag for Joomla! 2.5
* @author waltercedric.com
* @copyright (C) 2012 http://www.waltercedric.com
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
**/


defined('_JEXEC') or die();
jimport('joomla.application.input');
jimport('joomla.filesystem.file');


class CedTagControllerStatistics extends JController
{
function __construct()
{
parent::__construct();
}

function execute($task)
{
switch ($task) {
default:
$this->display();
}
}

/**
* display the form
* @return void
*/
function display()
{
JFactory::getApplication()->input->set('view', 'statistics');
parent::display();
}

}

?>
46 changes: 46 additions & 0 deletions com_cedTag/admin/models/statistics.php
@@ -0,0 +1,46 @@
<?php
/**
* @package Component cedTag for Joomla! 2.5
* @author waltercedric.com
* @copyright (C) 2012 http://www.waltercedric.com 2010- http://www.joomlatags.org
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
**/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.model');
require_once JPATH_COMPONENT_SITE . DS . 'helper/helper.php';

class CedTagModelStatistics extends JModel
{

function getStatistics()
{

$statistics = new stdClass();
$query = "select count(*) as ct from #__cedtag_term where published = '1';";
$dbo = JFactory::getDbo();
$dbo->setQuery($query);
$statistics->termPublished = $dbo->loadResult();

$query = "select count(*) as ct from #__cedtag_term where published = '0';";
$dbo = JFactory::getDbo();
$dbo->setQuery($query);
$statistics->termUnpublished = $dbo->loadResult();


$query = "select count(*) as ct from #__content where id not in (select cid from #__cedtag_term_content)";
$dbo = JFactory::getDbo();
$dbo->setQuery($query);
$statistics->articlesWithoutTags = $dbo->loadResult();

$query = "select count(*) as ct from #__content where id in (select cid from #__cedtag_term_content)";
$dbo = JFactory::getDbo();
$dbo->setQuery($query);
$statistics->articlesWithTags = $dbo->loadResult();

return $statistics;
}

}
13 changes: 6 additions & 7 deletions com_cedTag/admin/views/frontpage/tmpl/default.php
Expand Up @@ -41,39 +41,38 @@
alt="<?php echo JText::_('CONFIGURATION');?>"/>
<span><?php echo JText::_('CONFIGURATION');?></span></a></div>
</div>

<div style="float: left;">
<div class="icon"><a href="index.php?option=com_cedtag&controller=css"
title="<?php echo JText::_('TEMPLATE MANAGER');?>"> <img
src="<? echo JURI::root() ?>/media/com_cedtag/images/template.png"
alt="<?php echo JText::_('TEMPLATE MANAGER');?>"/>
<span><?php echo JText::_('TEMPLATE MANAGER');?></span></a></div>
</div>

<div style="float: left;">
<div class="icon"><a href="index.php?option=com_cedtag&controller=stopwords"
title="<?php echo JText::_('STOPWORDS');?>"> <img
src="<? echo JURI::root() ?>/media/com_cedtag/images/gear_forbidden.png"
alt="<?php echo JText::_('STOPWORDS');?>"/>
<span><?php echo JText::_('STOPWORDS');?></span></a></div>
</div>


<div style="float: left;">
<div class="icon"><a href="index.php?option=com_cedtag&controller=import"
title="<?php echo JText::_('IMPORT TAGS FROM OTHER COMPONENTS');?>">
<img src="<? echo JURI::root() ?>/media/com_cedtag/images/import.png"/>
<span><?php echo JText::_('IMPORT TAGS');?></span></a></div>
</div>

<div style="float: left;">
<div class="icon"><a href="index.php?option=com_cedtag&controller=export"
title="<?php echo JText::_('EXPORT TAGS TO OTHER COMPONENTS');?>">
<img src="<? echo JURI::root() ?>/media/com_cedtag/images/import.png"/>
<span><?php echo JText::_('EXPORT TAGS');?></span></a></div>
</div>


<div style="float: left;">
<div class="icon"><a href="index.php?option=com_cedtag&controller=statistics"
title="<?php echo JText::_('statistics');?>">
<img src="<? echo JURI::root() ?>/media/com_cedtag/images/statistics.png"/>
<span><?php echo JText::_('statistics');?></span></a></div>
</div>
<div style="float: left;">
<div class="icon"><a href="http://www.waltercedric.com" target="_blank"
title="<?php echo JText::_('CedTags HOME PAGE');?>"> <img
Expand Down
3 changes: 3 additions & 0 deletions com_cedTag/admin/views/statistics/index.html
@@ -0,0 +1,3 @@
<html>
<body bgcolor="#FFFFFF"></body>
</html>
62 changes: 62 additions & 0 deletions com_cedTag/admin/views/statistics/tmpl/default.php
@@ -0,0 +1,62 @@
<?php
/**
* @package Component Tag for Joomla! 2.5
* @author waltercedric.com
* @copyright (C) 2012 http://www.waltercedric.com 2010- http://www.joomlatags.org
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
**/
defined('_JEXEC') or die('Restricted access');

$document =& JFactory::getDocument();
$document->addScript("https://www.google.com/jsapi");

$document->addScriptDeclaration("
google.load('visualization', '1', {packages:['corechart']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var terms = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
['published', " . $this->statistics->termPublished . " ],
['unpublished', " . $this->statistics->termUnpublished . "]
]);
var optionsTerms = {
title: 'Terms'
};
var chartTerms = new google.visualization.PieChart(document.getElementById('chart_terms'));
chartTerms.draw(terms, optionsTerms);
var articles = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
['with tags', " . $this->statistics->articlesWithTags . " ],
['without tags', " . $this->statistics->articlesWithoutTags . "]
]);
var optionsArticles = {
title: 'Articles'
};
var chartArticles = new google.visualization.PieChart(document.getElementById('chart_articles'));
chartArticles.draw(articles, optionsArticles);
}
");
?>

<form action="<?php echo JRoute::_('index.php?controller=statistics&option=com_cedtag'); ?>" method="post" name="adminForm" id="adminForm" autocomplete="off">
<div>
<div id="chart_terms" style="float:left; width: 450px; height: 450px;"></div>
<div id="chart_articles" style="float:left; width: 450px; height: 450px;"></div>
</div>
<input type="hidden" name="controller" value="statistics">
<?php echo JHTML::_('form.token'); ?>

</form>
3 changes: 3 additions & 0 deletions com_cedTag/admin/views/statistics/tmpl/index.html
@@ -0,0 +1,3 @@
<html>
<body bgcolor="#FFFFFF"></body>
</html>
39 changes: 39 additions & 0 deletions com_cedTag/admin/views/statistics/view.html.php
@@ -0,0 +1,39 @@
<?php
/**
* @package Component Tag for Joomla! 2.5
* @author waltercedric.com
* @copyright (C) 2012 http://www.waltercedric.com 2010- http://www.joomlatags.org
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
**/

defined('_JEXEC') or die();
jimport('joomla.application.component.view');

class CedTagViewStatistics extends JView
{

function display($tpl = null)
{
$this->defaultTpl($tpl);
}

function defaultTpl($tpl = null)
{
$this->addToolbar();

$statistics = $this->get('statistics');
$this->assign('statistics', $statistics);

parent::display($tpl);
}

function addToolbar()
{
JToolBarHelper::title(JText::_('STATISTICS'), 'tag.png');
JToolBarHelper::spacer();
JToolBarHelper::back(JText::_('CONTROL PANEL'), 'index.php?option=com_cedtag');

}


}
Binary file added com_cedTag/images/statistics.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 668277f

Please sign in to comment.