<?php
/**
 * Adodis Blog package
 * @author J-Extension <contact@jextn.com>
 * @link http://www.jextn.com
 * @copyright (C) 2012 - 2013 J-Extension
 * @license GNU/GPL, see LICENSE.php for full license.
**/

//Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.controllerform');

class AdodisBlogControllerUsers extends JControllerForm
{
	public function __construct($config = array())
	{
		parent::__construct($config);
	}

	public function cancel($key = null)
	{
		// Redirect to the main page.
		$this->setRedirect(JRoute::_('index.php?option=com_adodisblog&view=blogs', false));
	}

    function blockUser()
    {
    	$model 		= $this->getModel();
    	$result		= $model->blockUsers();
		$link		= JRoute::_('index.php?option=com_adodisblog&view=users',false);
		if($result){
			$msg	= JText::_('COM_ADODISBLOG_BLOCKED_SUCCESSFULLY');
		} else {
			$msg	= JText::_('COM_ADODISBLOG_BLOCKED_FAILED');
		}
		// Redirect to the user page.
		$this->setRedirect($link, $msg);
    }

    function unBlockUser()
    {
    	$model 		= $this->getModel();
    	$result		= $model->unBlockUsers();
		$link		= JRoute::_('index.php?option=com_adodisblog&view=users',false);
		if($result){
			$msg	= JText::_('COM_ADODISBLOG_UNBLOCKED_SUCCESSFULLY');
		} else {
			$msg	= JText::_('COM_ADODISBLOG_UNBLOCKED_FAILED');
		}
		// Redirect to the user page.
		$this->setRedirect($link, $msg);
    }
}
?>
