Source for file history.php

Documentation is available at history.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_contenthistory
  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.  * Contenthistory list controller class.
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_contenthistory
  17.  * @since       3.2
  18.  */
  19. {
  20.     /**
  21.      * Deletes and returns correctly.
  22.      *
  23.      * @return    void 
  24.      *
  25.      * @since    3.2
  26.      */
  27.     public function delete()
  28.     {
  29.         JSession::checkToken(or jexit(JText::_('JINVALID_TOKEN'));
  30.  
  31.         // Get items to remove from the request.
  32.         $cid $this->input->get('cid'array()'array');
  33.  
  34.         if (!is_array($cid|| count($cid1)
  35.         {
  36.             JError::raiseWarning(500JText::_('COM_CONTENTHISTORY_NO_ITEM_SELECTED'));
  37.         }
  38.         else
  39.         {
  40.             // Get the model.
  41.             $model $this->getModel();
  42.  
  43.             // Make sure the item ids are integers
  44.             jimport('joomla.utilities.arrayhelper');
  45.             JArrayHelper::toInteger($cid);
  46.  
  47.             // Remove the items.
  48.             if ($model->delete($cid))
  49.             {
  50.                 $this->setMessage(JText::plural('COM_CONTENTHISTORY_N_ITEMS_DELETED'count($cid)));
  51.             }
  52.             else
  53.             {
  54.                 $this->setMessage($model->getError());
  55.             }
  56.         }
  57.  
  58.         $this->setRedirect(
  59.             JRoute::_(
  60.                 'index.php?option=com_contenthistory&view=history&layout=modal&tmpl=component&item_id='
  61.                 . $this->input->getInt('item_id''&type_id=' $this->input->getInt('type_id')
  62.                 . '&type_alias=' $this->input->getCmd('type_alias''&' JSession::getFormToken('=1'false
  63.             )
  64.         );
  65.     }
  66.  
  67.     /**
  68.      * Proxy for getModel.
  69.      *
  70.      * @param   string  $name    The name of the model
  71.      * @param   string  $prefix  The prefix for the model
  72.      * @param   array   $config  An additional array of parameters
  73.      *
  74.      * @return  JModelLegacy  The model
  75.      *
  76.      * @since   3.2
  77.      */
  78.     public function getModel($name 'History'$prefix 'ContenthistoryModel'$config array('ignore_request' => true))
  79.     {
  80.         return parent::getModel($name$prefix$config);
  81.     }
  82.  
  83.     /**
  84.      * Toggles the keep forever value for one or more history rows. If it was Yes, changes to No. If No, changes to Yes.
  85.      *
  86.      * @return    void 
  87.      *
  88.      * @since    3.2
  89.      */
  90.     public function keep()
  91.     {
  92.         JSession::checkToken(or jexit(JText::_('JINVALID_TOKEN'));
  93.  
  94.         // Get items to remove from the request.
  95.         $cid $this->input->get('cid'array()'array');
  96.  
  97.         if (!is_array($cid|| count($cid1)
  98.         {
  99.             JError::raiseWarning(500JText::_('COM_CONTENTHISTORY_NO_ITEM_SELECTED'));
  100.         }
  101.         else
  102.         {
  103.             // Get the model.
  104.             $model $this->getModel();
  105.  
  106.             // Make sure the item ids are integers
  107.             jimport('joomla.utilities.arrayhelper');
  108.             JArrayHelper::toInteger($cid);
  109.  
  110.             // Remove the items.
  111.             if ($model->keep($cid))
  112.             {
  113.                 $this->setMessage(JText::plural('COM_CONTENTHISTORY_N_ITEMS_KEEP_TOGGLE'count($cid)));
  114.             }
  115.             else
  116.             {
  117.                 $this->setMessage($model->getError());
  118.             }
  119.         }
  120.  
  121.         $this->setRedirect(
  122.             JRoute::_(
  123.                 'index.php?option=com_contenthistory&view=history&layout=modal&tmpl=component&item_id='
  124.                 . $this->input->getInt('item_id''&type_id=' $this->input->getInt('type_id')
  125.                 . '&type_alias=' $this->input->getCmd('type_alias''&' JSession::getFormToken('=1'false
  126.             )
  127.         );
  128.     }
  129. }

Documentation generated on Tue, 19 Nov 2013 15:04:44 +0100 by phpDocumentor 1.4.3