Your IP : 216.73.216.240


Current Path : /home/juvelize/martine/administrator/components/com_elioallvideos2/classes/
Upload File :
Current File : /home/juvelize/martine/administrator/components/com_elioallvideos2/classes/jcontroller.php

<?php
/**                               ______________________________________________
*                          o O   |                                              |
*                 (((((  o      <    Generated with Cook Self Service  V1.5.2   |
*                ( o o )         |______________________________________________|
* --------oOOO-----(_)-----OOOo---------------------------------- www.j-cook.pro --- +
* @version		2.0
* @package		ElioAllVideos 2
* @subpackage	Viewlevels
* @copyright	http://www.eliopro.fr 28.10.2012
* @author		Félix Dr. Dimitric - http://www.eliopro.fr - felix@eliopro.fr
* @license		GNU/GPL
*
* /!\  Joomla! is free software.
* This version may have been modified pursuant to the GNU General Public License,
* and as distributed it includes or is derivative of works licensed under the
* GNU General Public License or other free or open source software licenses.
*
*             .oooO  Oooo.     See COPYRIGHT.php for copyright notices and details.
*             (   )  (   )
* -------------\ (----) /----------------------------------------------------------- +
*               \_)  (_/
*/

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

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

/**
 * Elioallvideos2 Component Elioallvideos2Controller Controller
 *
 * @package		Joomla
 * @subpackage	Elioallvideos2
 *
 */
class Elioallvideos2Controller extends JController
{
	var $context;

	/**
	 * Constructor
	 *
	 */
	function __construct()
	{
		parent::__construct();

	}

	function can($accesses, $taskString, $itemAccess = null)
	{
		if (!is_Array($accesses))
			$accesses = array($accesses);

		if (isset($itemAccess))
			$acl = $itemAccess;
		else
			$acl = Elioallvideos2Helper::getAcl();


		foreach($accesses as $access)
		{
			if ($acl->get($access))
				return true;
		}

		JError::raiseWarning(403, JText::sprintf( "ELIOALLVIDEOS2_ACL_UNAUTORIZED_TASK", $taskString) );
		$this->setRedirect(Elioallvideos2Helper::urlRequest());
		return false;
	}

	function _apply($data)
	{

		$model = $this->getModel($this->singular);
		$item = $model->getItem();

		if ((int)$item->id > 0)
		{
			//Check Item ACL
			if (!$this->can('access-edit', JText::_("ELIOALLVIDEOS2_JTOOLBAR_EDIT"), $item->params))
				return;

		}


        if ($model->save($data))
        {
			JRequest::setVar('cid', $model->getId());
        	$app = JFactory::getApplication();
			$app->enqueueMessage(JText::_('ELIOALLVIDEOS2_CONTROLLER_DONE'));
        	return array($model->_id);
		}

    	JError::raiseWarning( 1000, JText::_('ELIOALLVIDEOS2_CONTROLLER_ERROR') );

		return false;

	}

	function _save($data)
	{

		$model = $this->getModel($this->singular);
		$item = $model->getItem();

		if ((int)$item->id > 0)
		{
			//Check Item ACL
			if (!$this->can('access-edit', JText::_("ELIOALLVIDEOS2_JTOOLBAR_EDIT"), $item->params))
				return;

		}


        if ($model->save($data))
        {
        	JRequest::setVar('cid', $model->getId());
        	$app = JFactory::getApplication();
			$app->enqueueMessage(JText::_('ELIOALLVIDEOS2_CONTROLLER_DONE'));
        	return array($model->_id);
        }

		JError::raiseWarning( 1000, JText::_('ELIOALLVIDEOS2_CONTROLLER_ERROR') );

		return false;
	}

	function _delete($cid)
	{

		$model = $this->getModel($this->singular);

	    if ($model->delete($cid))
	    {
	    	JRequest::setVar('cid', 0);
        	$app = JFactory::getApplication();
			$app->enqueueMessage(JText::_('ELIOALLVIDEOS2_CONTROLLER_DONE'));
        	return true;
	    }

        JError::raiseWarning( 1000, JText::_('ELIOALLVIDEOS2_CONTROLLER_ERROR') );

		return false;
	}






}