33
0
mirror of https://github.com/joomla-extensions/patchtester.git synced 2024-11-10 15:21:01 +00:00
patchtester/administrator/components/com_patchtester/controllers/pull.php
2013-07-11 20:49:58 -05:00

59 lines
1.2 KiB
PHP

<?php
/**
* @package PatchTester
* @copyright Copyright (C) 2011 Ian MacLennan, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access
defined('_JEXEC') or die;
jimport('joomla.application.component.controllerform');
/**
* Pull controller class
*
* @package PatchTester
*/
class PatchtesterControllerPull extends JControllerLegacy
{
public function apply()
{
try
{
$this->getModel('pull')
->apply(JFactory::getApplication()->input->getInt('pull_id'));
$msg = JText::_('COM_PATCHTESTER_APPLY_OK');
$type = 'message';
}
catch (Exception $e)
{
$msg = $e->getMessage();
$type = 'error';
}
$this->setRedirect(JRoute::_('index.php?option=com_patchtester&view=pulls', false), $msg, $type);
}
public function revert()
{
try
{
$this->getModel('pull')
->revert(JFactory::getApplication()->input->getInt('pull_id'));
$msg = JText::_('COM_PATCHTESTER_REVERT_OK');
$type = 'message';
}
catch (Exception $e)
{
$msg = $e->getMessage();
$type = 'error';
}
$this->setRedirect(JRoute::_('index.php?option=com_patchtester&view=pulls', false), $msg, $type);
}
}