Source for file contentadministrator.php

Documentation is available at contentadministrator.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_content
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. JLoader::register('ContentHelper'JPATH_ADMINISTRATOR '/components/com_content/helpers/content.php');
  13.  
  14. /**
  15.  * Content HTML helper
  16.  *
  17.  * @package     Joomla.Administrator
  18.  * @subpackage  com_content
  19.  *
  20.  * @since       3.0
  21.  */
  22. abstract class JHtmlContentAdministrator
  23. {
  24.     /**
  25.      * Render the list of associated items
  26.      *
  27.      * @param   int  $articleid  The article item id
  28.      *
  29.      * @return  string  The language HTML
  30.      */
  31.     public static function association($articleid)
  32.     {
  33.         // Defaults
  34.         $html '';
  35.  
  36.         // Get the associations
  37.         if ($associations JLanguageAssociations::getAssociations('com_content''#__content''com_content.item'$articleid))
  38.         {
  39.             foreach ($associations as $tag => $associated)
  40.             {
  41.                 $associations[$tag= (int) $associated->id;
  42.             }
  43.  
  44.             // Get the associated menu items
  45.             $db JFactory::getDbo();
  46.             $query $db->getQuery(true)
  47.                 ->select('c.*')
  48.                 ->select('l.sef as lang_sef')
  49.                 ->from('#__content as c')
  50.                 ->select('cat.title as category_title')
  51.                 ->join('LEFT''#__categories as cat ON cat.id=c.catid')
  52.                 ->where('c.id IN (' implode(','array_values($associations)) ')')
  53.                 ->join('LEFT''#__languages as l ON c.language=l.lang_code')
  54.                 ->select('l.image')
  55.                 ->select('l.title as language_title');
  56.             $db->setQuery($query);
  57.  
  58.             try
  59.             {
  60.                 $items $db->loadObjectList('id');
  61.             }
  62.             catch (RuntimeException $e)
  63.             {
  64.                 throw new Exception($e->getMessage()500);
  65.             }
  66.  
  67.             if ($items)
  68.             {
  69.                 foreach ($items as &$item)
  70.                 {
  71.                     $text strtoupper($item->lang_sef);
  72.                     $url JRoute::_('index.php?option=com_content&task=article.edit&id=' . (int) $item->id);
  73.                     $tooltipParts array(
  74.                         JHtml::_('image''mod_languages/' $item->image '.gif',
  75.                             $item->language_title,
  76.                             array('title' => $item->language_title),
  77.                             true
  78.                         ),
  79.                         $item->title,
  80.                         '(' $item->category_title ')'
  81.                     );
  82.                     $item->link JHtml::_('tooltip'implode(' '$tooltipParts)nullnull$text$urlnull'hasTooltip label label-association label-' $item->lang_sef);
  83.                 }
  84.             }
  85.  
  86.             $html JLayoutHelper::render('joomla.content.associations'$items);
  87.         }
  88.  
  89.         return $html;
  90.     }
  91.  
  92.     /**
  93.      * Show the feature/unfeature links
  94.      *
  95.      * @param   int      $value      The state value
  96.      * @param   int      $i          Row number
  97.      * @param   boolean  $canChange  Is user allowed to change?
  98.      *
  99.      * @return  string       HTML code
  100.      */
  101.     public static function featured($value 0$i$canChange true)
  102.     {
  103.         JHtml::_('bootstrap.tooltip');
  104.  
  105.         // Array of image, task, title, action
  106.         $states    array(
  107.             0    => array('unfeatured',    'articles.featured',    'COM_CONTENT_UNFEATURED',    'COM_CONTENT_TOGGLE_TO_FEATURE'),
  108.             1    => array('featured',    'articles.unfeatured',    'COM_CONTENT_FEATURED',        'COM_CONTENT_TOGGLE_TO_UNFEATURE'),
  109.         );
  110.         $state    JArrayHelper::getValue($states(int) $value$states[1]);
  111.         $icon    $state[0];
  112.  
  113.         if ($canChange)
  114.         {
  115.             $html    '<a href="#" onclick="return listItemTask(\'cb' $i '\',\'' $state[1'\')" class="btn btn-micro hasTooltip' ($value == ' active' '''" title="' JHtml::tooltipText($state[3]'"><i class="icon-'
  116.                     . $icon '"></i></a>';
  117.         }
  118.         else
  119.         {
  120.             $html    '<a class="btn btn-micro hasTooltip disabled' ($value == ' active' '''" title="' JHtml::tooltipText($state[2]'"><i class="icon-'
  121.                     . $icon '"></i></a>';
  122.         }
  123.  
  124.         return $html;
  125.     }
  126. }

Documentation generated on Tue, 19 Nov 2013 14:56:56 +0100 by phpDocumentor 1.4.3