mirror of
https://github.com/Deutscher-Tischfussballbund/com_sportsmanager.git
synced 2026-06-10 06:27:52 +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);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+46
-57
@@ -1,57 +1,46 @@
|
||||
<?php
|
||||
/*
|
||||
* Sports Manager (C) 2006-2020, Sven Nickel
|
||||
*/
|
||||
|
||||
// Check to ensure this file is included in Joomla!
|
||||
defined('_JEXEC') or die();
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
|
||||
/**
|
||||
* @package SportsManager.Site
|
||||
* @subpackage com_sportsmanager
|
||||
*
|
||||
* @copyright Copyright (C) 2020 John Smith. All rights reserved.
|
||||
* @license GNU General Public License version 3; see LICENSE
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class DisplayController
|
||||
* @since 2.0.0
|
||||
* The DisplayController class handles the display of views in the application.
|
||||
* It extends the BaseController class.
|
||||
*/
|
||||
class DisplayController extends BaseController {
|
||||
|
||||
/**
|
||||
* Displays the view for the given URL parameters.
|
||||
*
|
||||
* @param bool $cachable Whether the view can be cached or not. Default is false.
|
||||
* @param array $urlparams The URL parameters to be passed to the view. Default is an empty array.
|
||||
* @param array $safeurlparams An associative array of 'safe' URL parameters and their variable types.
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function display($cachable = false, $urlparams = array(), $safeurlparams = null) {
|
||||
|
||||
$document = Factory::getDocument();
|
||||
$viewName = $this->input->getCmd('view', 'default');
|
||||
$viewFormat = $document->getType();
|
||||
$view = $this->getView($viewName, $viewFormat);
|
||||
$view->document = $document;
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$input = $app->input;
|
||||
$layout = $input->get('layout', '', 'STRING');
|
||||
|
||||
//var_dump($layout);
|
||||
$view->display($layout);
|
||||
}
|
||||
}
|
||||
|
||||
<?php
|
||||
/*
|
||||
* Sports Manager (C) 2006-2020, Sven Nickel
|
||||
*/
|
||||
|
||||
namespace Dtfb\Component\com_sportsmanager\Site\Controller;
|
||||
|
||||
// Check to ensure this file is included in Joomla!
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\MVC\Controller\BaseController;
|
||||
|
||||
/**
|
||||
* @package SportsManager.Site
|
||||
* @subpackage com_sportsmanager
|
||||
*
|
||||
* @copyright Copyright (C) 2020 John Smith. All rights reserved.
|
||||
* @license GNU General Public License version 3; see LICENSE
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class DisplayController
|
||||
* @since 2.0.0
|
||||
* The DisplayController class handles the display of views in the application.
|
||||
* It extends the BaseController class.
|
||||
*/
|
||||
class DisplayController extends BaseController {
|
||||
|
||||
/**
|
||||
* Displays the view for the given URL parameters.
|
||||
*
|
||||
* @param bool $cachable Whether the view can be cached or not. Default is false.
|
||||
* @param array $urlparams The URL parameters to be passed to the view. Default is an empty array.
|
||||
* @param array|null $safeurlparams An associative array of 'safe' URL parameters and their variable types.
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function display($cachable = false, $urlparams = array(), array $safeurlparams = null): void
|
||||
{
|
||||
require_once JPATH_SITE . '/components/com_sportsmanager/sportsmanager.php';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,18 +8,19 @@
|
||||
<license>GNU/GPL</license>
|
||||
<version>2.0.0</version>
|
||||
<description>Verwaltung von Spielern und Vereinen in Mannschafts- und Individualwettbewerben</description>
|
||||
<namespace path="src">Dtfb\Component\com_sportsmanager</namespace>
|
||||
<files folder="site">
|
||||
<filename>index.html</filename>
|
||||
<filename>admin.php</filename>
|
||||
<filename>api.php</filename>
|
||||
<filename>controller.php</filename>
|
||||
<filename>database.php</filename>
|
||||
<filename>sportsmanager.php</filename>
|
||||
<filename>mathparser.php</filename>
|
||||
<filename>tools.php</filename>
|
||||
<filename>js/jquery.min.js</filename>
|
||||
<folder>images</folder>
|
||||
<folder>database</folder>
|
||||
<folder>images</folder>
|
||||
<folder>models</folder>
|
||||
<folder>src</folder>
|
||||
<folder>util</folder>
|
||||
<folder>views</folder>
|
||||
</files>
|
||||
@@ -35,10 +36,10 @@
|
||||
<administration>
|
||||
<files folder="admin">
|
||||
<filename>access.xml</filename>
|
||||
<filename>sportsmanager.php</filename>
|
||||
<filename>controller.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<folder>views</folder>
|
||||
<folder>services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages folder="admin">
|
||||
<language tag="en-GB">language/en-GB/en-GB.com_sportsmanager.ini
|
||||
|
||||
Reference in New Issue
Block a user