Added backend for position of persons

This commit is contained in:
2019-04-17 15:04:24 +02:00
parent e801770b80
commit 22566986a8
7 changed files with 463 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 ClubsViewPosition 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=position.new');
$this->position = ClubsPosition::createPosition();
$this->isNew = true;
}
else if(is_numeric($id))
{
$this->address = Route::_('index.php?option=com_clubs&task=position.change');
$this->position = ClubsPosition::loadPosition((int) $id);
$this->isNew = false;
}
else
throw new Exception('Need a position 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->position->setName($data['name']);
}
ToolbarHelper::title('Club-Management - Position');
parent::display($tpl);
}
}