/administrator/components/com_content/helpers/html/contentadministrator.php

https://bitbucket.org/eternaware/joomus · PHP · 38 lines · 19 code · 3 blank · 16 comment · 2 complexity · 02eef1338dbab7358ca960072c62b911 MD5 · raw file

  1. <?php
  2. /**
  3. * @package Joomla.Administrator
  4. * @subpackage com_content
  5. *
  6. * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
  7. * @license GNU General Public License version 2 or later; see LICENSE.txt
  8. */
  9. defined('_JEXEC') or die;
  10. /**
  11. * @package Joomla.Administrator
  12. * @subpackage com_content
  13. */
  14. abstract class JHtmlContentAdministrator
  15. {
  16. /**
  17. * @param int $value The state value
  18. * @param int $i
  19. */
  20. public static function featured($value = 0, $i, $canChange = true)
  21. {
  22. // Array of image, task, title, action
  23. $states = array(
  24. 0 => array('star-empty', 'articles.featured', 'COM_CONTENT_UNFEATURED', 'COM_CONTENT_TOGGLE_TO_FEATURE'),
  25. 1 => array('star', 'articles.unfeatured', 'COM_CONTENT_FEATURED', 'COM_CONTENT_TOGGLE_TO_UNFEATURE'),
  26. );
  27. $state = JArrayHelper::getValue($states, (int) $value, $states[1]);
  28. $icon = $state[0];
  29. if ($canChange) {
  30. $html = '<a href="#" onclick="return listItemTask(\'cb'.$i.'\',\''.$state[1].'\')" class="btn btn-micro ' . ($value == 1 ? 'active' : '') . '" rel="tooltip" title="'.JText::_($state[3]).'"><i class="icon-'
  31. . $icon.'"></i></a>';
  32. }
  33. return $html;
  34. }
  35. }