[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/administrator/components/com_contact/helpers/ -> contact.php (source)

   1  <?php
   2  /**
   3   * @copyright    Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
   4   * @license        GNU General Public License version 2 or later; see LICENSE.txt
   5   */
   6  
   7  // No direct access
   8  defined('_JEXEC') or die;
   9  
  10  /**
  11   * Contact component helper.
  12   *
  13   * @package        Joomla.Administrator
  14   * @subpackage    com_contact
  15   * @since        1.6
  16   */
  17  class ContactHelper
  18  {
  19      /**
  20       * Configure the Linkbar.
  21       *
  22       * @param    string    $vName    The name of the active view.
  23       *
  24       * @return    void
  25       * @since    1.6
  26       */
  27  	public static function addSubmenu($vName)
  28      {
  29          JSubMenuHelper::addEntry(
  30              JText::_('COM_CONTACT_SUBMENU_CONTACTS'),
  31              'index.php?option=com_contact&view=contacts',
  32              $vName == 'contacts'
  33          );
  34          JSubMenuHelper::addEntry(
  35              JText::_('COM_CONTACT_SUBMENU_CATEGORIES'),
  36              'index.php?option=com_categories&extension=com_contact',
  37              $vName == 'categories'
  38          );
  39  
  40          if ($vName=='categories') {
  41              JToolBarHelper::title(
  42                  JText::sprintf('COM_CATEGORIES_CATEGORIES_TITLE', JText::_('com_contact')),
  43                  'contact-categories');
  44          }
  45      }
  46  
  47      /**
  48       * Gets a list of the actions that can be performed.
  49       *
  50       * @param    int        The category ID.
  51       * @param    int        The contact ID.
  52       *
  53       * @return    JObject
  54       * @since    1.6
  55       */
  56  	public static function getActions($categoryId = 0, $contactId = 0)
  57      {
  58          $user    = JFactory::getUser();
  59          $result    = new JObject;
  60  
  61          if (empty($contactId) && empty($categoryId)) {
  62              $assetName = 'com_contact';
  63          }
  64          elseif (empty($contactId)) {
  65              $assetName = 'com_contact.category.'.(int) $categoryId;
  66          }
  67          else {
  68              $assetName = 'com_contact.contact.'.(int) $contactId;
  69          }
  70  
  71          $actions = array(
  72              'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.own', 'core.edit.state', 'core.delete'
  73          );
  74  
  75          foreach ($actions as $action) {
  76              $result->set($action,    $user->authorise($action, $assetName));
  77          }
  78  
  79          return $result;
  80      }
  81  }


Generated: Tue Apr 3 11:40:28 2012 Cross-referenced by PHPXref 0.7.1