Exemple #1
0
 function getList(&$params)
 {
     $dbo = JFactory::getDBO();
     $query = $dbo->getQuery(true);
     $query->select('count(*) as frequency');
     $query->select('name as name');
     $query->select('t.hits as hits');
     $query->select('t.created as created');
     $query->from('#__cedtag_term_content as tc');
     $query->innerJoin('#__cedtag_term as t on t.id=tc.tid');
     $query->where("t.published='1'");
     $query->group('tid');
     $query->order('hits desc');
     $dbo->setQuery($query);
     $count = intval($params->get('count', 25));
     $dbo->setQuery($query, 0, $count);
     $rows = $dbo->loadObjectList();
     if (isset($rows) && !empty($rows)) {
         $CedTagsHelper = new CedTagsHelper();
         $rows = $CedTagsHelper->mappingFrequencyToSize($rows);
         $sorting = $params->get('sorting', 'hitsasort');
         usort($rows, array('CedTagsHelper', $sorting));
         $CedTagThemes = new CedTagThemes();
         $CedTagThemes->addCss();
         if (intval($params->get('reverse', 0))) {
             $rows = array_reverse($rows);
         }
     }
     return $rows;
 }
Exemple #2
0
 /**
  * Add Attachment button
  *
  * @return a button
  */
 function onDisplay($name, $asset, $author)
 {
     // Avoid displaying the button for anything except content articles
     $option = JRequest::getVar('option');
     if ($option != 'com_content') {
         return new JObject();
     }
     // Get the article ID
     $cid = JRequest::getVar('cid', array(0), '', 'array');
     $id = 0;
     if (count($cid) > 0) {
         $id = intval($cid[0]);
     }
     if ($id == 0) {
         $nid = JRequest::getVar('id', null);
         if (!is_null($nid)) {
             $id = intval($nid);
         }
     }
     JHtml::_('behavior.modal');
     // Create the button object
     $button = new JObject();
     // Figure out where we are and construct the right link and set
     // up the style sheet (to get the visual for the button working)
     $document =& JFactory::getDocument();
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         $document->addStyleSheet(JURI::root() . '/media/com_cedtag/css/admintag.css');
         if ($id == 0) {
             $button->set('options', "{handler: 'iframe', size: {x: 400, y: 300}}");
             $link = "index.php?option=com_cedtag&controller=tag&task=warning&tmpl=component&tagsWarning=FIRST_SAVE_WARNING";
         } else {
             $button->set('options', "{handler: 'iframe', size: {x: 600, y: 300}}");
             $link = "index.php?option=com_cedtag&controller=tag&task=add&article_id=" . $id . "&tmpl=component";
         }
     } else {
         $CedTagThemes = new CedTagThemes();
         $CedTagThemes->addCss();
         //return $button;
         if ($id == 0) {
             $button->set('options', "{handler: 'iframe', size: {x: 400, y: 300}}");
             $msg = JText::_('SAVE ARTICLE BEFORE ADD TAGS');
             $link = "index.php?option=com_cedtag&task=warning&tmpl=component&tagsWarning=FIRST_SAVE_WARNING";
         } else {
             $button->set('options', "{handler: 'iframe', size: {x: 500, y: 300}}");
             $link = "index.php?option=com_cedtag&tmpl=component&task=add&article_id=" . $id;
         }
     }
     $button->set('modal', true);
     $button->set('class', 'modal');
     $button->set('text', JText::_('Add Tags'));
     $button->set('name', 'add_Tags');
     $button->set('link', $link);
     //$button->set('image', '');
     return $button;
 }
Exemple #3
0
 function defaultTpl($tpl = null)
 {
     $this->addToolbar();
     $CedTagThemes = new CedTagThemes();
     $tagCssFile = $CedTagThemes->getFile();
     $isCssWritable = is_writable($tagCssFile);
     $cssFileContent = file_get_contents($tagCssFile);
     $this->assign('isCssWritable', $isCssWritable);
     $this->assignRef('cssFileName', $tagCssFile);
     $this->assignRef('cssFileContent', $cssFileContent);
     parent::display($tpl);
 }
Exemple #4
0
 public function getList(&$params)
 {
     $termIds = $params->get("tagIds");
     $idsArray = @explode(',', $termIds);
     if (empty($idsArray)) {
         return array();
     }
     $dbo = JFactory::getDBO();
     $query = $dbo->getQuery(true);
     $query->select('count(*) as frequency');
     $query->select('id as id');
     $query->select('name as name');
     $query->select('t.hits as hits');
     $query->select('t.created as created');
     $query->select('1 as sequence');
     $query->from('#__cedtag_term as t');
     $query->where("t.id in (" . @implode(',', $idsArray) . ")");
     $dbo->setQuery($query);
     $query = $query->dump();
     $rows = $dbo->loadObjectList();
     //if there is results
     if (isset($rows) && !empty($rows)) {
         $rowsMap = array();
         $total_tags = count($rows);
         foreach ($rows as $row) {
             $rowsMap[$row->id] = $row;
         }
         $sortedRows = array();
         for ($index = 0; $index < $total_tags; $index++) {
             $id = $idsArray[$index];
             $rowsMap[$id]->sequence = $total_tags - $index;
             $sortedRows[] = $rowsMap[$id];
         }
         $rows = array_reverse($sortedRows);
         unset($sortedRows);
         unset($rowsMap);
         $CedTagsHelper = new CedTagsHelper();
         $rows = $CedTagsHelper->mappingFrequencyToSize($rows);
         $sorting = $params->get('sorting', 'tag_latestasort');
         usort($rows, array('CedTagsHelper', $sorting));
         $CedTagThemes = new CedTagThemes();
         $CedTagThemes->addCss();
         if (intval($params->get('reverse', 0))) {
             $rows = array_reverse($rows);
         }
     }
     return $rows;
 }
Exemple #5
0
<?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
 **/
defined('_JEXEC') or die('Restricted access');
require_once JPATH_SITE . '/components/com_cedtag/helpers/themes.php';
$firstWarning = JRequest::getVar('FirstWarning', true);
$warning = JRequest::getVar('tagsWarning', 'FIRST_SAVE_WARNING');
if ($firstWarning) {
    $CedTagThemes = new CedTagThemes();
    $CedTagThemes->addCss();
    ?>

<div class="warning">
</div>
<h1><?php 
    echo $this->tag;
    ?>
</h1>
<h2><?php 
    echo JText::_($warning);
    ?>
</h2>
<!-- CedTag Free Tagging system for Joomla by www.waltercedric.com -->

<?php 
}
Exemple #6
0
 /**
  * @Override
  * @return string
  */
 public function getFile()
 {
     $CedTagThemes = new CedTagThemes();
     return $CedTagThemes->getFile();
 }
Exemple #7
0
 function getPopularTagModel($count = 25, $sorting = 'sizeasort', $reverse = 1)
 {
     $this->cache = JFactory::getCache('com_cedtag', '');
     $rows = $this->cache->get("getAllTagModel");
     //if not found in cache
     if ($rows === false) {
         $dbo = JFactory::getDBO();
         $query = $dbo->getQuery(true);
         $query->select('count(*) as frequency');
         $query->select('t.name as name');
         $query->select('t.hits as hits');
         $query->select('t.created as created');
         $query->from('#__cedtag_term_content as tc');
         $query->innerJoin(' #__cedtag_term as t on t.id=tc.tid ');
         $query->where('t.published=' . $dbo->quote(1));
         $query->group('tid');
         $query->order('frequency DESC');
         $dbo->setQuery($query, 0, $count);
         $rows = $dbo->loadObjectList();
         if (isset($rows) && !empty($rows)) {
             $rows = $this->mappingFrequencyToSize($rows);
             usort($rows, array('CedTagsHelper', 'tag_popularasort'));
             if ($reverse) {
                 $rows = array_reverse($rows);
             }
         }
         $this->cache->store($rows, "getAllTagModel");
     }
     if (isset($rows) && !empty($rows)) {
         $CedTagThemes = new CedTagThemes();
         $CedTagThemes->addCss();
     }
     return $rows;
 }