Inserted basic structure for clubs and models

This commit is contained in:
2019-04-17 16:41:28 +02:00
parent b08b01689f
commit 893dc754f0
7 changed files with 788 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
<?php
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Toolbar\ToolbarHelper;
// No direct access.
defined('_JEXEC') or die;
class ClubsViewOffer extends HtmlView
{
function display($tpl = null)
{
$input = Factory::getApplication()->input;
$id = $input->get->get('id');
if($id === 'new')
{
$this->address = Route::_('index.php?option=com_clubs&task=offer.new');
$this->offer = ClubsOffer::createOffer();
$this->isNew = true;
}
else if(is_numeric($id))
{
$this->address = Route::_('index.php?option=com_clubs&task=offer.change');
$this->offer = ClubsOffer::loadOffer((int) $id);
$this->isNew = false;
}
else
throw new Exception('Need a user id.');
if($input->get->get('data', null, 'json') != null)
{
// Restore previous data
$dataurl = $input->get->get('data', null, 'json');
$data = json_decode($dataurl, true);
$this->offer->setName($data['name']);
}
ToolbarHelper::title('Club-Management - Angebot');
parent::display($tpl);
}
}