Skip to content

Commit

Permalink
* add 15 more popular google fonts
Browse files Browse the repository at this point in the history
* add ne statictics pie chart to know how many tags do not have any description
  • Loading branch information
cedricwalter committed Apr 26, 2012
1 parent 1b02078 commit d8921d3
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 108 deletions.
13 changes: 12 additions & 1 deletion com_cedTag/admin/config.xml
Expand Up @@ -44,9 +44,20 @@

<field name="googleFonts" type="list" default="font-family: 'Open Sans', sans-serif;|Open+Sans" label="Google Fonts *"
description="Google Fonts, hit save css if changing this settings!">
<option value="font-family: 'Droid Sans', sans-serif;|Droid+Sans">Droid Sans</option>
<option value="font-family: 'Lato', sans-serif;|Lato">Lato</option>
<option value="font-family: 'Arvo', serif;|Arvo">Arvo</option>
<option value="font-family: 'Lora', serif;|Lora">Lora</option>
<option value="font-family: 'PT Sans', sans-serif;|PT+Sans">PT Sans</option>
<option value="font-family: 'PT Sans Narrow', sans-serif;|PT+Sans+Narrow">PT Sans Narrow</option>
<option value="font-family: 'Ubuntu', sans-serif;|Ubuntu">Ubuntu</option>
<option value="font-family: 'Lobster', cursive;|Lobster">Lobster</option>
<option value="font-family: 'Droid Serif', serif;|Droid+Serif">Droid Serif</option>
<option value="font-family: 'Open Sans', sans-serif;|Open+Sans">Open Sans</option>
<option value="font-family: 'Oswald', sans-serif;|Oswald">Oswald</option>
<option value="font-family: 'Yanone Kaffeesatz', sans-serif;|Yanone+Kaffeesatz">Yanone Kaffeesatz</option>
<option value="font-family: 'Just Me Again Down Here', cursive;|Just+Me+Again+Down+Here">Just Me Again Down Here</option>
<option value="font-family: 'Great Vibes', cursive;|Great+Vibes">Great Vibes cursive</option>
<option value="font-family: 'Open Sans', sans-serif;|Open+Sans">Open Sans</option>
</field>
</fieldset>

Expand Down
11 changes: 11 additions & 0 deletions com_cedTag/admin/models/statistics.php
Expand Up @@ -30,6 +30,17 @@ function getStatistics()
$statistics->termUnpublished = $dbo->loadResult();


$query = "select count(*) as ct from #__cedtag_term where published = '1' and description is null;";
$dbo = JFactory::getDbo();
$dbo->setQuery($query);
$statistics->termPublishedWithoutDescription = $dbo->loadResult();

$query = "select count(*) as ct from #__cedtag_term where published = '1' and description is not null;";
$dbo = JFactory::getDbo();
$dbo->setQuery($query);
$statistics->termPublishedWithDescription = $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);
Expand Down
48 changes: 24 additions & 24 deletions com_cedTag/admin/models/tag.php
Expand Up @@ -258,30 +258,30 @@ protected function getListQuery()
return $query;
}

/**
* Build a list of authors
*
* @return JDatabaseQuery
* @since 1.6
*/
public function getAuthors() {
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);

// Construct the query
$query->select('u.id AS value, u.name AS text');
$query->from('#__users AS u');
$query->join('INNER', '#__content AS c ON c.created_by = u.id');
$query->group('u.id, u.name');
$query->order('u.name');

// Setup the query
$db->setQuery($query->__toString());

// Return the result
return $db->loadObjectList();
}
/**
* Build a list of authors
*
* @return JDatabaseQuery
* @since 1.6
*/
public function getAuthors() {
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);

// Construct the query
$query->select('u.id AS value, u.name AS text');
$query->from('#__users AS u');
$query->join('INNER', '#__content AS c ON c.created_by = u.id');
$query->group('u.id, u.name');
$query->order('u.name');

// Setup the query
$db->setQuery($query->__toString());

// Return the result
return $db->loadObjectList();
}

/**
* Method to get a list of articles.
Expand Down
21 changes: 12 additions & 9 deletions com_cedTag/admin/views/statistics/tmpl/default.php
Expand Up @@ -27,6 +27,14 @@ function drawChart() {
var chartTerms = new google.visualization.PieChart(document.getElementById('chart_terms'));
chartTerms.draw(terms, optionsTerms);
var description = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
['With Description', " . $this->statistics->termPublishedWithDescription . " ],
['Without Description', " . $this->statistics->termPublishedWithoutDescription . "]
]);
var chartDescription = new google.visualization.PieChart(document.getElementById('chart_description'));
chartDescription.draw(description, optionsTerms);
var articles = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
Expand All @@ -38,23 +46,18 @@ function drawChart() {
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 id="chart_terms" style="float:left; width: 450px; height: 450px;"></div>
<div id="chart_description" 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'); ?>
Expand Down
41 changes: 29 additions & 12 deletions com_cedTag/site/models/tag.php
Expand Up @@ -105,35 +105,33 @@ function _buildQuery()

JFactory::getApplication()->input->set('tag', $tag);
$tag = trim($tag);
$dbo =& JFactory::getDBO();
$dbo = JFactory::getDBO();
$tagObj = null;
$ids = $this->_ids;
if (!isset($this->_tagDescription)) {
$tagDescriptionQuery = "select id,description from #__cedtag_term as t where binary t.name=" .$dbo->quote($tag) . " and t.published='1';";
$tagDescriptionQuery = "select id, description from #__cedtag_term as t where binary t.name=" .$dbo->quote($tag) . " and t.published='1';";

$dbo->setQuery($tagDescriptionQuery);
$dbo->query();
$this->_tagDescription = $dbo->loadResult();
$tagObj = $dbo->loadObject();
$this->_tagDescription = $tagObj->description;

if (isset($tagObj) && $tagObj->id) {
$this->_termExist = true;
} else {
$this->_termExist = false;
return '';
}
$updateHitsQuery = "update #__cedtag_term set hits=hits+1 where id=" . $dbo->quote($tagObj->id);
$dbo->setQuery($updateHitsQuery);
$dbo->query();
$this->_tagDescription = $tagObj->description;

$totalQuery = "select count(c.cid) from #__cedtag_term_content as c where c.tid=" . $dbo->quote($tagObj->id);
$dbo->setQuery($totalQuery);
$dbo->query();
$this->_total = $dbo->loadResult();
$this->incrementHitsForTagId($tagObj->id);

$this->_total = $this->countNumberOfArticleForTagId($tagObj->id);

$dbo = JFactory::getDBO();
$tagQuery = "select c.cid from #__cedtag_term_content as c where c.tid=" . $dbo->quote($tagObj->id);
$dbo->setQuery($tagQuery);
$contentIds = $dbo->loadResultArray();
$contentIds = $dbo->loadColumn();

$ids = implode(',', $contentIds);
$this->_ids = $ids;
Expand All @@ -147,7 +145,7 @@ function _buildQuery()
$nullDate = $dbo->getNullDate();
jimport('joomla.utilities.date');
$date = new JDate();
$now = $date->toMySQL();
$now = JDate::getInstance()->toSql($date);
$order = CedTagsHelper::param('Order');
$ShowArchiveArticles = CedTagsHelper::param('ShowArchiveArticles');
$state = ' a.state = 1 ';
Expand Down Expand Up @@ -178,6 +176,25 @@ function _buildQuery()

}

private function countNumberOfArticleForTagId($tagid)
{
$dbo = JFactory::getDBO();
$totalQuery = "select count(c.cid) from #__cedtag_term_content as c where c.tid=" . $dbo->quote($tagid);
$dbo->setQuery($totalQuery);
$dbo->query();
$total = $dbo->loadResult();
return $total;
}

private function incrementHitsForTagId($tagid)
{
$dbo = JFactory::getDBO();
$updateHitsQuery = "update #__cedtag_term set hits=hits+1 where id=" . $dbo->quote($tagid);
$dbo->setQuery($updateHitsQuery);
$dbo->query();
return $dbo;
}

function _buildOrderBy($order)
{
switch ($order)
Expand Down
81 changes: 19 additions & 62 deletions com_cedTag/site/views/tag/tmpl/blog.php
Expand Up @@ -13,11 +13,11 @@
$config =& JFactory::getConfig();

$params = JComponentHelper::getParams('com_cedtag');
$comContentParams = JComponentHelper::getParams('com_content');

$topAds = $params->get('topAds');
$bottomAds = $params->get('bottomAds');
$showTagDescription = $params->get('description');
$showMeta = $params->get('contentMeta', '1');
$user =& JFactory::getUser();

function readmore($item, $user)
{
Expand Down Expand Up @@ -58,66 +58,9 @@ function readmore($item, $user)
<td valign="top"><?php
$count = $this->pagination->limitstart;
if (isset($this->results) && !empty($this->results)) {
foreach ($this->results as $result) {
$readmore = $params->get('onlyIntro');
$readmore = $readmore && $result->readmore;
//echo($readmore);
if ($readmore) {
$result = readmore($result, $user);
$result->text =& $result->introtext;
} else {
$result->text = $result->introtext . $result->fulltext;
$result->readmore_link = JRoute::_(ContentHelperRoute::getArticleRoute($result->slug, $result->catslug));
}
?>

<div>
<div class="contentpaneopen">
<h2 class="contentheading">
<a href="<?php echo $result->readmore_link; ?>"
class="contentpagetitle"> <?php echo $this->escape($result->title);?>
</a>
</h2>
</div>

<?php if ($showMeta) { ?>
<div class="article-tools">
<div class="article-meta">
<span class="createdate">
<?php echo JHTML::_('date', $result->created, JText::_('DATE_FORMAT_LC1')); ?></span>
<span class="createby">
<?php JText::_('Written by');
$author = $result->created_by_alias ? $result->created_by_alias : $result->author;
echo(' ' . $author);
?>
</span>
</div>
</div>
<?php };?>

<div class="article-content">
<?php echo $result->text; ?>

<?php
//echo $this->loadTemplate('item');
?>

</div>

<?php if ($readmore) {
//read more
?>
<a href="<?php echo $result->readmore_link; ?>"
class="readon"> <?php if ($result->readmore_register) {
echo JText::_('Register to read more...');
} else {
echo JText::sprintf('Read more...');
} ?>
</a>
<?php }?>
<span class="article_separator">&nbsp;</span>
</div>
<?php
foreach ($this->results as $item) {
$this->item = &$item;
echo $this->loadTemplate('item');
}
} ?></td>
</tr>
Expand All @@ -136,6 +79,20 @@ class="readon"> <?php if ($result->readmore_register) {
</tbody>

</table>
aaaa
<?php if (($comContentParams->def('show_pagination', 1) == 1 || ($comContentParams->get('show_pagination') == 2)) && ($comContentParams->get('pages.total') > 1)) : ?>
<div class="pagination">
<?php if ($comContentParams->def('show_pagination_results', 1)) : ?>
<p class="counter">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>

<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
bbb


<?php
$document =& JFactory::getDocument();
Expand Down

0 comments on commit d8921d3

Please sign in to comment.