PageRenderTime 43ms CodeModel.GetById 10ms RepoModel.GetById 1ms app.codeStats 0ms

/contentmanager/code/trunk/administrator/components/com_contentmanager/helpers/html/jxgrid.php

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 91 lines | 42 code | 9 blank | 40 comment | 7 complexity | a0f161b1eea9df7e1a9ade180c05f44e MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: jxgrid.php 80 2009-06-01 07:22:16Z eddieajau $
  4. * @copyright Copyright (C) 2009 New Life in IT Pty Ltd. All rights reserved.
  5. * @license GNU General Public License <http://www.gnu.org/copyleft/gpl.html>
  6. * @link http://www.theartofjoomla.com
  7. */
  8. // no direct access
  9. defined('_JEXEC') or die;
  10. /**
  11. * HTML Grid Helper
  12. *
  13. * @package TAOJ.ContentManager
  14. * @subpackage com_contentmanager
  15. */
  16. class JHTMLJxGrid
  17. {
  18. /**
  19. * Display the access setting and change link
  20. *
  21. * @param int The row index
  22. * @param int The access value
  23. * @param int The current access name
  24. * @param string Optional task prefix
  25. *
  26. * @return string
  27. */
  28. function access($i, $accessValue, $accessName, $prefix='')
  29. {
  30. if (!$accessValue) {
  31. $color_access = 'green';
  32. }
  33. else if ($accessValue == 1) {
  34. $color_access = 'red';
  35. }
  36. else {
  37. $color_access = 'black';
  38. }
  39. $href = '<a href="javascript:void(0);" onclick="return listItemTask(\'cb'. $i .'\',\''.$prefix.'access\')" style="color:'. $color_access .'">
  40. '. JText::_($accessName) .'</a>';
  41. return $href;
  42. }
  43. /**
  44. * Display the published setting and icon
  45. *
  46. * @param int The value of the published field
  47. * @param int The row index
  48. * @param string Optional task prefix
  49. *
  50. * @return string
  51. */
  52. function published($i, $value, $prefix='')
  53. {
  54. $images = array(-2 => 'components/com_contentmanager/media/images/icon-16-trash.png', 0 => 'images/publish_x.png', 1 => 'images/tick.png');
  55. $alts = array(-2 => 'Trash', 0 => 'Unpublished', 1 => 'Published');
  56. $img = JArrayHelper::getValue($images, $value, $images[0]);
  57. $task = $value == 1 ? 'unpublish' : 'publish';
  58. $alt = JArrayHelper::getValue($alts, $value, $images[0]);
  59. $action = $value == 1 ? JText::_('Unpublish Item') : JText::_('Publish item');
  60. $href = '
  61. <a href="javascript:void(0);" onclick="return listItemTask(\'cb'. $i .'\',\''. $prefix.$task .'\')" title="'. $action .'">
  62. <img src="'. $img .'" border="0" alt="'. $alt .'" /></a>';
  63. return $href;
  64. }
  65. /**
  66. * Display the checked out icon
  67. *
  68. * @param string The editor name
  69. * @param string The checked out time
  70. *
  71. * @return string
  72. */
  73. function checkedout($editor, $time)
  74. {
  75. $text = addslashes(htmlspecialchars($editor));
  76. $date = JHtml::_('date', $time, '%A, %d %B %Y');
  77. $time = JHtml::_('date', $time, '%H:%M');
  78. $hover = '<span class="editlinktip hasTip" title="'. JText::_('Checked Out') .'::'. $text .'<br />'. $date .'<br />'. $time .'">';
  79. $checked = $hover .'<img src="components/com_contentmanager/media/images/checked_out.png" alt="" /></span>';
  80. return $checked;
  81. }
  82. }