Source for file contacts.php

Documentation is available at contacts.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_contact
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. /**
  13.  * Articles list controller class.
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_contact
  17.  * @since       1.6
  18.  */
  19. {
  20.     /**
  21.      * Constructor.
  22.      *
  23.      * @param   array  $config    An optional associative array of configuration settings.
  24.      *
  25.      * @return  ContactControllerContacts 
  26.      * @see     JController
  27.      * @since   1.6
  28.      */
  29.     public function __construct($config array())
  30.     {
  31.         parent::__construct($config);
  32.  
  33.         $this->registerTask('unfeatured',    'featured');
  34.     }
  35.  
  36.     /**
  37.      * Method to toggle the featured setting of a list of contacts.
  38.      *
  39.      * @return  void 
  40.      * @since   1.6
  41.      */
  42.     public function featured()
  43.     {
  44.         // Check for request forgeries
  45.         JSession::checkToken(or jexit(JText::_('JINVALID_TOKEN'));
  46.  
  47.         $user   JFactory::getUser();
  48.         $ids    $this->input->get('cid'array()'array');
  49.         $values array('featured' => 1'unfeatured' => 0);
  50.         $task   $this->getTask();
  51.         $value  JArrayHelper::getValue($values$task0'int');
  52.  
  53.         // Get the model.
  54.         $model  $this->getModel();
  55.  
  56.         // Access checks.
  57.         foreach ($ids as $i => $id)
  58.         {
  59.             $item $model->getItem($id);
  60.             if (!$user->authorise('core.edit.state''com_contact.category.'.(int) $item->catid))
  61.             {
  62.                 // Prune items that you can't change.
  63.                 unset($ids[$i]);
  64.                 JError::raiseNotice(403JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
  65.             }
  66.         }
  67.  
  68.         if (empty($ids))
  69.         {
  70.             JError::raiseWarning(500JText::_('COM_CONTACT_NO_ITEM_SELECTED'));
  71.         }
  72.         else
  73.         {
  74.             // Publish the items.
  75.             if (!$model->featured($ids$value))
  76.             {
  77.                 JError::raiseWarning(500$model->getError());
  78.             }
  79.         }
  80.  
  81.         $this->setRedirect('index.php?option=com_contact&view=contacts');
  82.     }
  83.  
  84.     /**
  85.      * Proxy for getModel.
  86.      *
  87.      * @param   string    $name    The name of the model.
  88.      * @param   string    $prefix    The prefix for the PHP class name.
  89.      *
  90.      * @return  JModel 
  91.      * @since   1.6
  92.      */
  93.     public function getModel($name 'Contact'$prefix 'ContactModel'$config array('ignore_request' => true))
  94.     {
  95.         $model parent::getModel($name$prefix$config);
  96.  
  97.         return $model;
  98.     }
  99.  
  100.     /**
  101.      * Function that allows child controller access to model data
  102.      * after the item has been deleted.
  103.      *
  104.      * @param   JModelLegacy  $model  The data model object.
  105.      * @param   integer       $ids    The array of ids for items being deleted.
  106.      *
  107.      * @return  void 
  108.      *
  109.      * @since   12.2
  110.      */
  111.     protected function postDeleteHook(JModelLegacy $model$ids null)
  112.     {
  113.     }
  114.  
  115. }

Documentation generated on Tue, 19 Nov 2013 14:56:43 +0100 by phpDocumentor 1.4.3