<?php
/**
 * @version    CVS: 1.0.0
 * @package    Com_Prod
 * @author     Jose <satjaisat@gmail.com>
 * @copyright  2023 Jose
 * @license    Licencia Pública General GNU versión 2 o posterior. Consulte LICENSE.txt
 */

// No direct access
defined('_JEXEC') or die;

use \Joomla\CMS\MVC\Controller\BaseController;
use \Joomla\CMS\Factory;
use \Joomla\CMS\Language\Text;

// Access check.
if (!Factory::getUser()->authorise('core.manage', 'com_prod'))
{
	throw new Exception(Text::_('JERROR_ALERTNOAUTHOR'));
}

// Include dependancies
jimport('joomla.application.component.controller');

JLoader::registerPrefix('Prod', JPATH_COMPONENT_ADMINISTRATOR);
JLoader::register('ProdHelper', JPATH_COMPONENT_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'prod.php');
/*
$controller = BaseController::getInstance('Prod');
$controller->execute(Factory::getApplication()->input->get('task'));
$controller->redirect();
*/
$controller = 'cProd'; //nombre del controlador
 $path = JPATH_COMPONENT.'/controllers/'.$controller.'.php';
 $input = Factory::getApplication()->input;  
 
	require_once($path);
	$classname = 'ProdController'.$controller;
	$controller = new $classname();
	if($input->get('task') !=''){$task = $input->get('task');}else{$task = 'default';}
  
 $controller->$task();
