<?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.controlleradmin');

class AdodisBlogControllerBlogs extends JControllerAdmin
{
	/**
	 * Constructor.
	 */
	public function __construct($config = array())
	{
		parent::__construct($config);
	}

	/**
	 * Proxy for getModel.
	 */
	public function getModel($name = 'Blog', $prefix = 'AdodisBlogModel', $config = array('ignore_request' => true))
	{
		$model	= parent::getModel($name, $prefix, $config);

		return $model;
	}

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