Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add statistics pgae in administrator panelö showing number of terms…
… published/unpublished and also numbe rof articles with and without tags
- Loading branch information
1 parent
b2d1a42
commit 668277f
Showing
9 changed files
with
202 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
|
||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<html> | ||
<body bgcolor="#FFFFFF"></body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<html> | ||
<body bgcolor="#FFFFFF"></body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); | ||
|
||
} | ||
|
||
|
||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.