Added backend for position of persons
This commit is contained in:
47
src/admin/views/position/view.html.php
Normal file
47
src/admin/views/position/view.html.php
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user