[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/components/com_content/helpers/ -> icon.php (source)

   1  <?php
   2  /**
   3   * @version        $Id: icon.php 21078 2011-04-04 20:52:23Z dextercowley $
   4   * @package        Joomla
   5   * @subpackage    Content
   6   * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   7   * @license        GNU/GPL, see LICENSE.php
   8   * Joomla! is free software. This version may have been modified pursuant to the
   9   * GNU General Public License, and as distributed it includes or is derivative
  10   * of works licensed under the GNU General Public License or other free or open
  11   * source software licenses. See COPYRIGHT.php for copyright notices and
  12   * details.
  13   */
  14  
  15  // no direct access
  16  defined('_JEXEC') or die('Restricted access');
  17  
  18  /**
  19   * Content Component HTML Helper
  20   *
  21   * @static
  22   * @package        Joomla
  23   * @subpackage    Content
  24   * @since 1.5
  25   */
  26  class JHTMLIcon
  27  {
  28  	function create($article, $params, $access, $attribs = array())
  29      {
  30          $uri =& JFactory::getURI();
  31          $ret = $uri->toString();    
  32      
  33          $url = 'index.php?task=new&ret='.base64_encode($ret).'&id=0&sectionid='.$article->sectionid;
  34  
  35          if ($params->get('show_icons')) {
  36              $text = JHTML::_('image.site', 'new.png', '/images/M_images/', NULL, NULL, JText::_('New') );
  37          } else {
  38              $text = JText::_('New').'&nbsp;';
  39          }
  40  
  41          $attribs    = array( 'title' => JText::_( 'New' ));
  42          return JHTML::_('link', JRoute::_($url), $text, $attribs);
  43      }
  44  
  45  	function pdf($article, $params, $access, $attribs = array())
  46      {
  47          $url  = 'index.php?view=article';
  48          $url .=  @$article->catslug ? '&catid='.$article->catslug : '';
  49          $url .= '&id='.$article->slug.'&format=pdf';
  50  
  51          $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no';
  52  
  53          // checks template image directory for image, if non found default are loaded
  54          if ($params->get('show_icons')) {
  55              $text = JHTML::_('image.site', 'pdf_button.png', '/images/M_images/', NULL, NULL, JText::_('PDF'));
  56          } else {
  57              $text = JText::_('PDF').'&nbsp;';
  58          }
  59  
  60          $attribs['title']    = JText::_( 'PDF' );
  61          $attribs['onclick'] = "window.open(this.href,'win2','".$status."'); return false;";
  62          $attribs['rel']     = 'nofollow';
  63  
  64          return JHTML::_('link', JRoute::_($url), $text, $attribs);
  65      }
  66  
  67  	function email($article, $params, $access, $attribs = array())
  68          {
  69                  require_once (JPATH_SITE.DS.'components'.DS.'com_mailto'.DS.'helpers'.DS.'mailto.php');
  70          $uri    =& JURI::getInstance();
  71          $base    = $uri->toString( array('scheme', 'host', 'port'));
  72                  $link    = $base.JRoute::_( ContentHelperRoute::getArticleRoute($article->slug, $article->catslug, $article->sectionid) , false );
  73  
  74                  $url    = 'index.php?option=com_mailto&tmpl=component&link='.MailToHelper::addLink($link);
  75          $status = 'width=400,height=350,menubar=yes,resizable=yes';
  76  
  77          if ($params->get('show_icons'))     {
  78              $text = JHTML::_('image.site', 'emailButton.png', '/images/M_images/', NULL, NULL, JText::_('Email'));
  79          } else {
  80              $text = '&nbsp;'.JText::_('Email');
  81          }
  82  
  83          $attribs['title']    = JText::_( 'Email' );
  84          $attribs['onclick'] = "window.open(this.href,'win2','".$status."'); return false;";
  85  
  86          $output = JHTML::_('link', JRoute::_($url), $text, $attribs);
  87          return $output;
  88      }
  89  
  90  	function edit($article, $params, $access, $attribs = array())
  91      {
  92          $user =& JFactory::getUser();
  93          $uri =& JFactory::getURI();
  94          $ret = $uri->toString();
  95  
  96          if ($params->get('popup')) {
  97              return;
  98          }
  99  
 100          if ($article->state < 0) {
 101              return;
 102          }
 103  
 104          if (!$access->canEdit && !($access->canEditOwn && $article->created_by == $user->get('id'))) {
 105              return;
 106          }
 107  
 108          JHTML::_('behavior.tooltip');
 109  
 110          $url = 'index.php?view=article&id='.$article->slug.'&task=edit&ret='.base64_encode($ret);
 111          $icon = $article->state ? 'edit.png' : 'edit_unpublished.png';
 112          $text = JHTML::_('image.site', $icon, '/images/M_images/', NULL, NULL, JText::_('Edit'));
 113  
 114          if ($article->state == 0) {
 115              $overlib = JText::_('Unpublished');
 116          } else {
 117              $overlib = JText::_('Published');
 118          }
 119          $date = JHTML::_('date', $article->created);
 120          $author = $article->created_by_alias ? $article->created_by_alias : $article->author;
 121  
 122          $overlib .= '&lt;br /&gt;';
 123          $overlib .= JText::_($article->groups);
 124          $overlib .= '&lt;br /&gt;';
 125          $overlib .= $date;
 126          $overlib .= '&lt;br /&gt;';
 127          $overlib .= htmlspecialchars($author, ENT_COMPAT, 'UTF-8');
 128  
 129          $button = JHTML::_('link', JRoute::_($url), $text);
 130  
 131          $output = '<span class="hasTip" title="'.JText::_( 'Edit Item' ).' :: '.$overlib.'">'.$button.'</span>';
 132          return $output;
 133      }
 134  
 135  
 136  	function print_popup($article, $params, $access, $attribs = array())
 137      {
 138          $url  = 'index.php?view=article';
 139          $url .=  @$article->catslug ? '&catid='.$article->catslug : '';
 140          $url .= '&id='.$article->slug.'&tmpl=component&print=1&layout=default&page='.@ $request->limitstart;
 141  
 142          $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no';
 143  
 144          // checks template image directory for image, if non found default are loaded
 145          if ( $params->get( 'show_icons' ) ) {
 146              $text = JHTML::_('image.site',  'printButton.png', '/images/M_images/', NULL, NULL, JText::_( 'Print' ) );
 147          } else {
 148              $text = JText::_( 'ICON_SEP' ) .'&nbsp;'. JText::_( 'Print' ) .'&nbsp;'. JText::_( 'ICON_SEP' );
 149          }
 150  
 151          $attribs['title']    = JText::_( 'Print' );
 152          $attribs['onclick'] = "window.open(this.href,'win2','".$status."'); return false;";
 153          $attribs['rel']     = 'nofollow';
 154  
 155          return JHTML::_('link', JRoute::_($url), $text, $attribs);
 156      }
 157  
 158  	function print_screen($article, $params, $access, $attribs = array())
 159      {
 160          // checks template image directory for image, if non found default are loaded
 161          if ( $params->get( 'show_icons' ) ) {
 162              $text = JHTML::_('image.site',  'printButton.png', '/images/M_images/', NULL, NULL, JText::_( 'Print' ) );
 163          } else {
 164              $text = JText::_( 'ICON_SEP' ) .'&nbsp;'. JText::_( 'Print' ) .'&nbsp;'. JText::_( 'ICON_SEP' );
 165          }
 166          return '<a href="#" onclick="window.print();return false;">'.$text.'</a>';
 167      }
 168  
 169  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1