mirror of
https://github.com/Deutscher-Tischfussballbund/com_sportsmanager.git
synced 2026-09-12 02:51:50 +00:00
chore: update project structure with basic mvc approach
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
// no direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// Require the base controller
|
||||
require_once (JPATH_COMPONENT.DS.'controller.php');
|
||||
|
||||
// Require specific controller if requested
|
||||
//if($controller = JRequest::getVar('controller')) {
|
||||
// require_once (JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php');
|
||||
//}
|
||||
|
||||
// Create the controller
|
||||
//$classname = 'AutosController'.$controller;
|
||||
//$controller = new $classname( );
|
||||
|
||||
// Perform the Request task
|
||||
//$controller->execute( JRequest::getVar('task'));
|
||||
|
||||
// Redirect if set by the controller
|
||||
//$controller->redirect();
|
||||
|
||||
?>
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Sports Manager (C) 2006-2020, Sven Nickel
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla controller library
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
/**
|
||||
* General Controller of SportsManager component
|
||||
*/
|
||||
class SportsManagerController extends JControllerLegacy
|
||||
{
|
||||
/**
|
||||
* display task
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function display($cachable = false, $urlparams = false)
|
||||
{
|
||||
// set default view if not set
|
||||
$input = JFactory::getApplication()->input;
|
||||
$input->set('view', $input->getCmd('view', 'SportsManager'));
|
||||
|
||||
// call parent behavior
|
||||
parent::display($cachable);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_inlinecontact
|
||||
*
|
||||
* @copyright (C) Alexander Niklaus. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later
|
||||
* @link https://an-software.net
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Dtfb\Component\com_sportsmanager\Administrator\Extension\SportsmanagerComponent;
|
||||
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
|
||||
use Joomla\CMS\Extension\ComponentInterface;
|
||||
use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory;
|
||||
use Joomla\CMS\Extension\Service\Provider\MVCFactory;
|
||||
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
|
||||
/**
|
||||
* The contact service provider.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
return new class implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function register(Container $container): void
|
||||
{
|
||||
$container->registerServiceProvider(new MVCFactory('\\Dtfb\\Component\\com_sportsmanager'));
|
||||
$container->registerServiceProvider(new ComponentDispatcherFactory('\\Dtfb\\Component\\com_sportsmanager'));
|
||||
|
||||
$container->set(
|
||||
ComponentInterface::class,
|
||||
function (Container $container) {
|
||||
$component = new SportsmanagerComponent($container->get(ComponentDispatcherFactoryInterface::class));
|
||||
$component->setMVCFactory($container->get(MVCFactoryInterface::class));
|
||||
|
||||
return $component;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import joomla controller library
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
// Get an instance of the controller prefixed by HelloWorld
|
||||
$controller = JControllerLegacy::getInstance('SportsManager');
|
||||
|
||||
// Get the task
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$task = $jinput->get('task', "", 'STR' );
|
||||
|
||||
// Perform the Request task
|
||||
$controller->execute($task);
|
||||
|
||||
// Redirect if set by the controller
|
||||
$controller->redirect();
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/*
|
||||
* Sports Manager (C) 2006-2020, Sven Nickel
|
||||
*/
|
||||
|
||||
namespace Dtfb\Component\com_sportsmanager\Administrator\Controller;
|
||||
|
||||
// No direct access to this file
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* General Controller of SportsManager component
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class DisplayController extends BaseController
|
||||
{
|
||||
protected $default_view = 'sportsmanager';
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Dtfb\Component\com_sportsmanager\Administrator\Extension;
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
use Joomla\CMS\Extension\MVCComponent;
|
||||
use function defined;
|
||||
|
||||
/**
|
||||
* Component class for com_sportsmanager
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
class SportsmanagerComponent extends MVCComponent {}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/*
|
||||
* Sports Manager (C) 2006-2020, Sven Nickel
|
||||
*/
|
||||
|
||||
namespace Dtfb\Component\com_sportsmanager\Administrator\View\Sportsmanager;
|
||||
|
||||
// No direct access to this file
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* SportsManager View
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
function display($tpl = null): void
|
||||
{
|
||||
ToolbarHelper::title(Text::_('COM_SPORTSMANAGER'));
|
||||
|
||||
?>
|
||||
<h2><?php echo Text::_('COM_SPORTSMANAGER'); ?> Copyright © 2006 – 2014 Sven Nickel</h2>
|
||||
<?php
|
||||
// Display the template
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/*
|
||||
* Sports Manager (C) 2006-2020, Sven Nickel
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
<?php
|
||||
/*
|
||||
* Sports Manager (C) 2006-2020, Sven Nickel
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
-1
@@ -1 +0,0 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
-1
@@ -1 +0,0 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Sports Manager (C) 2006-2020, Sven Nickel
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla view library
|
||||
jimport('joomla.application.component.view');
|
||||
|
||||
/**
|
||||
* SportsManager View
|
||||
*/
|
||||
|
||||
class SportsManagerViewSportsManager extends JViewLegacy
|
||||
{
|
||||
/**
|
||||
* SportsManager view display method
|
||||
* @return void
|
||||
*/
|
||||
function display($tpl = null)
|
||||
{
|
||||
JToolbarHelper::title(JText::_('COM_SPORTSMANAGER'));
|
||||
|
||||
?>
|
||||
<h2><?php echo JText::_('COM_SPORTSMANAGER'); ?> Copyright © 2006 – 2014 Sven Nickel</h2>
|
||||
<?php
|
||||
/*
|
||||
// Get data from the model
|
||||
$items = $this->get('Items');
|
||||
$pagination = $this->get('Pagination');
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseError(500, implode('<br />', $errors));
|
||||
return false;
|
||||
}
|
||||
// Assign data to the view
|
||||
$this->items = $items;
|
||||
$this->pagination = $pagination;
|
||||
*/
|
||||
|
||||
// Display the template
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user