PageRenderTime 44ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/components/com_weblinks/helpers/icon.php

https://bitbucket.org/rippleau/nrm-org-au
PHP | 89 lines | 46 code | 14 blank | 29 comment | 5 complexity | 19762d76ef3676cf19602faeec62a4d3 MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0, 0BSD, MIT, LGPL-2.1
  1. <?php
  2. /**
  3. * @package Joomla.Administrator
  4. * @subpackage Weblinks
  5. *
  6. * @copyright Copyright (C) 2005 - 2017 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. * Weblink Component HTML Helper.
  12. *
  13. * @since 1.5
  14. */
  15. class JHtmlIcon
  16. {
  17. /**
  18. * Create a link to create a new weblink
  19. *
  20. * @param mixed $weblink Unused
  21. * @param mixed $params Unused
  22. *
  23. * @return string
  24. */
  25. public static function create($weblink, $params)
  26. {
  27. JHtml::_('bootstrap.tooltip');
  28. $uri = JUri::getInstance();
  29. $url = JRoute::_(WeblinksHelperRoute::getFormRoute(0, base64_encode($uri)));
  30. $text = JHtml::_('image', 'system/new.png', JText::_('JNEW'), null, true);
  31. $button = JHtml::_('link', $url, $text);
  32. return '<span class="hasTooltip" title="' . JHtml::tooltipText('COM_WEBLINKS_FORM_CREATE_WEBLINK') . '">' . $button . '</span>';
  33. }
  34. /**
  35. * Create a link to edit an existing weblink
  36. *
  37. * @param object $weblink Weblink data
  38. * @param \Joomla\Registry\Registry $params Item params
  39. * @param array $attribs Unused
  40. *
  41. * @return string
  42. */
  43. public static function edit($weblink, $params, $attribs = array())
  44. {
  45. $uri = JUri::getInstance();
  46. if ($params && $params->get('popup'))
  47. {
  48. return;
  49. }
  50. if ($weblink->state < 0)
  51. {
  52. return;
  53. }
  54. JHtml::_('bootstrap.tooltip');
  55. $url = WeblinksHelperRoute::getFormRoute($weblink->id, base64_encode($uri));
  56. $icon = $weblink->state ? 'edit.png' : 'edit_unpublished.png';
  57. $text = JHtml::_('image', 'system/' . $icon, JText::_('JGLOBAL_EDIT'), null, true);
  58. if ($weblink->state == 0)
  59. {
  60. $overlib = JText::_('JUNPUBLISHED');
  61. }
  62. else
  63. {
  64. $overlib = JText::_('JPUBLISHED');
  65. }
  66. $date = JHtml::_('date', $weblink->created);
  67. $author = $weblink->created_by_alias ? $weblink->created_by_alias : $weblink->author;
  68. $overlib .= '&lt;br /&gt;';
  69. $overlib .= $date;
  70. $overlib .= '&lt;br /&gt;';
  71. $overlib .= htmlspecialchars($author, ENT_COMPAT, 'UTF-8');
  72. $button = JHtml::_('link', JRoute::_($url), $text);
  73. return '<span class="hasTooltip" title="' . JHtml::tooltipText('COM_WEBLINKS_EDIT') . ' :: ' . $overlib . '">' . $button . '</span>';
  74. }
  75. }