- md5
- deb9e26f2a8a97a30f4f11f2a6b2b49a
- sha1
- 68410bafc532f955c90c440da14e330e85ab71aa
- sha256
- df2a49fb733a1b70971d25bd429f056615bbea5d8318a7eaf4de7cae7b8e4822
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
<?php
/**
* @version $Id: icon.php 21020 2011-03-27 06:52:01Z infograf768 $
* @package Joomla.Site
* @subpackage com_content
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// no direct access
defined('_JEXEC') or die;
/**
* Content Component HTML Helper
*
* @static
* @package Joomla.Site
* @subpackage com_content
* @since 1.5
*/
class JHtmlIcon
{
static function create($article, $params)
{
$uri = JFactory::getURI();
$url = 'index.php?option=com_content&task=article.add&return='.base64_encode($uri).'&a_id=0';
if ($params->get('show_icons')) {
$text = JHtml::_('image','system/new.png', JText::_('JNEW'), NULL, true);
} else {
$text = JText::_('JNEW').' ';
}
$button = JHtml::_('link',JRoute::_($url), $text);
$output = '<span class="hasTip" title="'.JText::_('COM_CONTENT_CREATE_ARTICLE').'">'.$button.'</span>';
return $output;
}
static function email($article, $params, $attribs = array())
{
require_once(JPATH_SITE.DS.'components'.DS.'com_mailto'.DS.'helpers'.DS.'mailto.php');
$uri = JURI::getInstance();
$base = $uri->toString(array('scheme', 'host', 'port'));
$template = JFactory::getApplication()->getTemplate();
$link = $base.JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catid) , false);
$url = 'index.php?option=com_mailto&tmpl=component&template='.$template.'&link='.MailToHelper::addLink($link);
$status = 'width=400,height=350,menubar=yes,resizable=yes';
if ($params->get('show_icons')) {
$text = JHtml::_('image','system/emailButton.png', JText::_('JGLOBAL_EMAIL'), NULL, true);
} else {
$text = ' '.JText::_('JGLOBAL_EMAIL');
}
$attribs['title'] = JText::_('JGLOBAL_EMAIL');
$attribs['onclick'] = "window.open(this.href,'win2','".$status."'); return false;";
$output = JHtml::_('link',JRoute::_($url), $text, $attribs);
return $output;
}
/**
* Display an edit icon for the article.
*
* This icon will not display in a popup window, nor if the article is trashed.
* Edit access checks must be performed in the calling code.
*
* @param object $article The article in question.
* @param object $params The article parameters
* @param array $attribs Not used??
*
* @return string The HTML for the article edit icon.
* @since 1.6
*/
static function edit($article, $params, $attribs = array())
{
// Initialise variables.
$user = JFactory::getUser();
$userId = $user->get('id');
$uri = JFactory::getURI();
// Ignore if in a popup window.
if ($params && $params->get('popup')) {
return;
}
// Ignore if the state is negative (trashed).
if ($article->state < 0) {
return;
}
JHtml::_('behavior.tooltip');
// Show checked_out icon if the article is checked out by a different user
if (property_exists($article, 'checked_out') && property_exists($article, 'checked_out_time') && $article->checked_out > 0 && $article->checked_out != $user->get('id')) {
$checkoutUser = JFactory::getUser($article->checked_out);
$button = JHtml::_('image','system/checked_out.png', NULL, NULL, true);
$date = JHtml::_('date',$article->checked_out_time);
$tooltip = JText::_('JLIB_HTML_CHECKED_OUT').' :: '.JText::sprintf('COM_CONTENT_CHECKED_OUT_BY', $checkoutUser->name).' <br /> '.$date;
return '<span class="hasTip" title="'.htmlspecialchars($tooltip, ENT_COMPAT, 'UTF-8').'">'.$button.'</span>';
}
$url = 'index.php?task=article.edit&a_id='.$article->id.'&return='.base64_encode($uri);
$icon = $article->state ? 'edit.png' : 'edit_unpublished.png';
$text = JHtml::_('image','system/'.$icon, JText::_('JGLOBAL_EDIT'), NULL, true);
if ($article->state == 0) {
$overlib = JText::_('JUNPUBLISHED');
}
else {
$overlib = JText::_('JPUBLISHED');
}
$date = JHtml::_('date',$article->created);
$author = $article->created_by_alias ? $article->created_by_alias : $article->author;
$overlib .= '<br />';
$overlib .= $date;
$overlib .= '<br />';
$overlib .= JText::sprintf('COM_CONTENT_WRITTEN_BY', htmlspecialchars($author, ENT_COMPAT, 'UTF-8'));
$button = JHtml::_('link',JRoute::_($url), $text);
$output = '<span class="hasTip" title="'.JText::_('COM_CONTENT_EDIT_ITEM').' :: '.$overlib.'">'.$button.'</span>';
return $output;
}
static function print_popup($article, $params, $attribs = array())
{
$url = ContentHelperRoute::getArticleRoute($article->slug, $article->catid);
$url .= '&tmpl=component&print=1&layout=default&page='.@ $request->limitstart;
$status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no';
// checks template image directory for image, if non found default are loaded
if ($params->get('show_icons')) {
$text = JHtml::_('image','system/printButton.png', JText::_('JGLOBAL_PRINT'), NULL, true);
} else {
$text = JText::_('JGLOBAL_ICON_SEP') .' '. JText::_('JGLOBAL_PRINT') .' '. JText::_('JGLOBAL_ICON_SEP');
}
$attribs['title'] = JText::_('JGLOBAL_PRINT');
$attribs['onclick'] = "window.open(this.href,'win2','".$status."'); return false;";
$attribs['rel'] = 'nofollow';
return JHtml::_('link',JRoute::_($url), $text, $attribs);
}
static function print_screen($article, $params, $attribs = array())
{
// checks template image directory for image, if non found default are loaded
if ($params->get('show_icons')) {
$text = JHtml::_('image','system/printButton.png', JText::_('JGLOBAL_PRINT'), NULL, true);
} else {
$text = JText::_('JGLOBAL_ICON_SEP') .' '. JText::_('JGLOBAL_PRINT') .' '. JText::_('JGLOBAL_ICON_SEP');
}
return '<a href="#" onclick="window.print();return false;">'.$text.'</a>';
}
}
The same content is in 5 releases, Joomla 1.6.2 to 1.6.6. See them all, or every version of this file.