Created basic backend for club view

This commit is contained in:
2019-05-20 14:22:45 +02:00
parent 4dc78c21af
commit 5ce47c288d
6 changed files with 148 additions and 61 deletions

View File

@@ -1,47 +1,31 @@
<?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
JLoader::register("ClubsControllerClub", JPATH_ROOT . "/administrator/components/com_clubs/controllers/club.php");
class ClubsViewClub extends AbstractClubsViewSingle
{
function display($tpl = null)
{
ToolbarHelper::title('Club-Management - Verein');
$input = Factory::getApplication()->input;
$id = $input->get->get('id');
$this->users = ClubsUser::loadUsers();
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);
}
protected function getViewName()
{
return 'club';
}
protected function getElementController()
{
return new ClubsControllerClub();
}
}