mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
adding user operator save into db and browser
This commit is contained in:
parent
a25f6e05de
commit
7dd91a838b
@ -1 +1 @@
|
||||
Subproject commit 055f2bb572244fbd5b4d71c2ca84d4493ae88dd1
|
||||
Subproject commit a4af9311f84e31d1b4682ea6de953c3a018b5343
|
||||
@ -46,10 +46,46 @@ class AppController extends Controller
|
||||
]);
|
||||
$this->loadComponent('Flash');
|
||||
|
||||
$this->loadComponent('Auth', [
|
||||
'loginAction' => [
|
||||
'controller' => 'ServerUsers',
|
||||
'action' => 'login'
|
||||
],
|
||||
'loginRedirect' => [
|
||||
'controller' => 'Transactions',
|
||||
'action' => 'index'
|
||||
],
|
||||
'logoutRedirect' => [
|
||||
'controller' => 'Pages',
|
||||
'action' => 'display',
|
||||
'gradido'
|
||||
],
|
||||
'authenticate' => [
|
||||
'all' => ['userModel' => 'ServerUsers'],
|
||||
'Form' => [
|
||||
'userModel' => 'ServerUsers',
|
||||
]
|
||||
]
|
||||
]);
|
||||
|
||||
$this->Auth->deny(['index']);
|
||||
|
||||
/*
|
||||
* Enable the following component for recommended CakePHP security settings.
|
||||
* see https://book.cakephp.org/3.0/en/controllers/components/security.html
|
||||
*/
|
||||
//$this->loadComponent('Security');
|
||||
}
|
||||
/*
|
||||
public function beforeFilter(Event $event)
|
||||
{
|
||||
//$this->Auth->allow(['display']);
|
||||
}
|
||||
*/
|
||||
|
||||
public function returnJson($array) {
|
||||
$this->autoRender = false;
|
||||
$response = $this->response->withType('application/json');
|
||||
return $response->withStringBody(json_encode($array));
|
||||
}
|
||||
}
|
||||
|
||||
106
src/Controller/OperatorTypesController.php
Normal file
106
src/Controller/OperatorTypesController.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Controller\AppController;
|
||||
|
||||
/**
|
||||
* OperatorTypes Controller
|
||||
*
|
||||
* @property \App\Model\Table\OperatorTypesTable $OperatorTypes
|
||||
*
|
||||
* @method \App\Model\Entity\OperatorType[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
|
||||
*/
|
||||
class OperatorTypesController extends AppController
|
||||
{
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
* @return \Cake\Http\Response|null
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$operatorTypes = $this->paginate($this->OperatorTypes);
|
||||
|
||||
$this->set(compact('operatorTypes'));
|
||||
}
|
||||
|
||||
/**
|
||||
* View method
|
||||
*
|
||||
* @param string|null $id Operator Type id.
|
||||
* @return \Cake\Http\Response|null
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function view($id = null)
|
||||
{
|
||||
$operatorType = $this->OperatorTypes->get($id, [
|
||||
'contain' => ['Operators']
|
||||
]);
|
||||
|
||||
$this->set('operatorType', $operatorType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add method
|
||||
*
|
||||
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$operatorType = $this->OperatorTypes->newEntity();
|
||||
if ($this->request->is('post')) {
|
||||
$operatorType = $this->OperatorTypes->patchEntity($operatorType, $this->request->getData());
|
||||
if ($this->OperatorTypes->save($operatorType)) {
|
||||
$this->Flash->success(__('The operator type has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The operator type could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('operatorType'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit method
|
||||
*
|
||||
* @param string|null $id Operator Type id.
|
||||
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function edit($id = null)
|
||||
{
|
||||
$operatorType = $this->OperatorTypes->get($id, [
|
||||
'contain' => []
|
||||
]);
|
||||
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||
$operatorType = $this->OperatorTypes->patchEntity($operatorType, $this->request->getData());
|
||||
if ($this->OperatorTypes->save($operatorType)) {
|
||||
$this->Flash->success(__('The operator type has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The operator type could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('operatorType'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete method
|
||||
*
|
||||
* @param string|null $id Operator Type id.
|
||||
* @return \Cake\Http\Response|null Redirects to index.
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function delete($id = null)
|
||||
{
|
||||
$this->request->allowMethod(['post', 'delete']);
|
||||
$operatorType = $this->OperatorTypes->get($id);
|
||||
if ($this->OperatorTypes->delete($operatorType)) {
|
||||
$this->Flash->success(__('The operator type has been deleted.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The operator type could not be deleted. Please, try again.'));
|
||||
}
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
}
|
||||
@ -12,6 +12,12 @@ use App\Controller\AppController;
|
||||
*/
|
||||
class OperatorsController extends AppController
|
||||
{
|
||||
|
||||
public function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
$this->Auth->allow(['ajaxSave', 'ajaxLoad']);
|
||||
}
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
@ -19,10 +25,69 @@ class OperatorsController extends AppController
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->paginate = [
|
||||
'contain' => ['OperatorTypes']
|
||||
];
|
||||
$operators = $this->paginate($this->Operators);
|
||||
|
||||
$this->set(compact('operators'));
|
||||
}
|
||||
|
||||
public function ajaxSave()
|
||||
{
|
||||
if ($this->request->is('post')) {
|
||||
|
||||
|
||||
|
||||
$operatorTypeName = $this->request->getData('operator_type_name');
|
||||
$usernamePasswordHash = $this->request->getData('usernamePasswordHash');
|
||||
$operatorTypeId = $this->Operators->OperatorTypes->
|
||||
find()
|
||||
->where(['name' => $operatorTypeName])
|
||||
->select(['id'])
|
||||
->first();
|
||||
|
||||
// load operator from db if already exist
|
||||
$operator = $this->Operators
|
||||
->find()
|
||||
->where([
|
||||
'operator_type_id' => $operatorTypeId->id,
|
||||
'usernamePasswordHash' => $usernamePasswordHash])
|
||||
->first();
|
||||
if(!$operator) {
|
||||
// create new entity
|
||||
$operator = $this->Operators->newEntity();
|
||||
}
|
||||
|
||||
$operator = $this->Operators->patchEntity($operator, $this->request->getData());
|
||||
$operator->operator_type_id = $operatorTypeId->id;
|
||||
if ($this->Operators->save($operator)) {
|
||||
return $this->returnJson(['state' => 'success']);
|
||||
}
|
||||
return $this->returnJson(['state' => 'error', 'details' => $operator->getErrors()]);
|
||||
}
|
||||
return $this->returnJson(['state' => 'error', 'msg' => 'no post request']);
|
||||
}
|
||||
|
||||
public function ajaxLoad()
|
||||
{
|
||||
if ($this->request->is('get')) {
|
||||
$usernamePasswordHash = $this->request->getQuery('usernamePasswordHash');
|
||||
$operators = $this->Operators
|
||||
->find()
|
||||
->where(['usernamePasswordHash' => $usernamePasswordHash])
|
||||
->contain(['OperatorTypes'])
|
||||
->toArray();
|
||||
;
|
||||
if($operators) {
|
||||
return $this->returnJson(['state' => 'success', 'operators' => $operators]);
|
||||
} else {
|
||||
return $this->returnJson(['state' => 'not found']);
|
||||
}
|
||||
|
||||
}
|
||||
return $this->returnJson(['state' => 'error', 'msg' => 'no post request']);
|
||||
}
|
||||
|
||||
/**
|
||||
* View method
|
||||
@ -34,7 +99,7 @@ class OperatorsController extends AppController
|
||||
public function view($id = null)
|
||||
{
|
||||
$operator = $this->Operators->get($id, [
|
||||
'contain' => []
|
||||
'contain' => ['OperatorTypes']
|
||||
]);
|
||||
|
||||
$this->set('operator', $operator);
|
||||
@ -57,7 +122,8 @@ class OperatorsController extends AppController
|
||||
}
|
||||
$this->Flash->error(__('The operator could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('operator'));
|
||||
$operatorTypes = $this->Operators->OperatorTypes->find('list', ['limit' => 200]);
|
||||
$this->set(compact('operator', 'operatorTypes'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -81,7 +147,8 @@ class OperatorsController extends AppController
|
||||
}
|
||||
$this->Flash->error(__('The operator could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('operator'));
|
||||
$operatorTypes = $this->Operators->OperatorTypes->find('list', ['limit' => 200]);
|
||||
$this->set(compact('operator', 'operatorTypes'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -29,6 +29,12 @@ use Cake\View\Exception\MissingTemplateException;
|
||||
class PagesController extends AppController
|
||||
{
|
||||
|
||||
public function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
$this->Auth->allow(['display']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a view
|
||||
*
|
||||
|
||||
@ -12,6 +12,13 @@ use App\Controller\AppController;
|
||||
*/
|
||||
class ServerUsersController extends AppController
|
||||
{
|
||||
public function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
//$this->Auth->allow(['add', 'edit']);
|
||||
$this->Auth->deny('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
@ -23,6 +30,23 @@ class ServerUsersController extends AppController
|
||||
|
||||
$this->set(compact('serverUsers'));
|
||||
}
|
||||
|
||||
public function login()
|
||||
{
|
||||
if ($this->request->is('post')) {
|
||||
$user = $this->Auth->identify();
|
||||
if ($user) {
|
||||
$this->Auth->setUser($user);
|
||||
return $this->redirect($this->Auth->redirectUrl());
|
||||
}
|
||||
$this->Flash->error(__('Invalid username or password, try again'));
|
||||
}
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
return $this->redirect($this->Auth->logout());
|
||||
}
|
||||
|
||||
/**
|
||||
* View method
|
||||
|
||||
@ -8,6 +8,7 @@ use Cake\ORM\Entity;
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $username
|
||||
* @property int $operator_type_id
|
||||
* @property string $data_base64
|
||||
*/
|
||||
class Operator extends Entity
|
||||
@ -22,7 +23,9 @@ class Operator extends Entity
|
||||
* @var array
|
||||
*/
|
||||
protected $_accessible = [
|
||||
'username' => true,
|
||||
'data_base64' => true
|
||||
'usernamePasswordHash' => true,
|
||||
'operator_type_id' => true,
|
||||
'data_base64' => true,
|
||||
'modified' => true
|
||||
];
|
||||
}
|
||||
|
||||
31
src/Model/Entity/OperatorType.php
Normal file
31
src/Model/Entity/OperatorType.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
namespace App\Model\Entity;
|
||||
|
||||
use Cake\ORM\Entity;
|
||||
|
||||
/**
|
||||
* OperatorType Entity
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $text
|
||||
*
|
||||
* @property \App\Model\Entity\Operator[] $operators
|
||||
*/
|
||||
class OperatorType extends Entity
|
||||
{
|
||||
/**
|
||||
* Fields that can be mass assigned using newEntity() or patchEntity().
|
||||
*
|
||||
* Note that when '*' is set to true, this allows all unspecified fields to
|
||||
* be mass assigned. For security purposes, it is advised to set '*' to false
|
||||
* (or remove it), and explicitly make individual fields accessible as needed.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_accessible = [
|
||||
'name' => true,
|
||||
'text' => true,
|
||||
'operators' => true
|
||||
];
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace App\Model\Entity;
|
||||
|
||||
use Cake\Auth\DefaultPasswordHasher;
|
||||
use Cake\ORM\Entity;
|
||||
|
||||
/**
|
||||
@ -46,4 +47,11 @@ class ServerUser extends Entity
|
||||
protected $_hidden = [
|
||||
'password'
|
||||
];
|
||||
|
||||
protected function _setPassword($password)
|
||||
{
|
||||
if (strlen($password) > 0) {
|
||||
return (new DefaultPasswordHasher)->hash($password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
70
src/Model/Table/OperatorTypesTable.php
Normal file
70
src/Model/Table/OperatorTypesTable.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
namespace App\Model\Table;
|
||||
|
||||
use Cake\ORM\Query;
|
||||
use Cake\ORM\RulesChecker;
|
||||
use Cake\ORM\Table;
|
||||
use Cake\Validation\Validator;
|
||||
|
||||
/**
|
||||
* OperatorTypes Model
|
||||
*
|
||||
* @property \App\Model\Table\OperatorsTable&\Cake\ORM\Association\HasMany $Operators
|
||||
*
|
||||
* @method \App\Model\Entity\OperatorType get($primaryKey, $options = [])
|
||||
* @method \App\Model\Entity\OperatorType newEntity($data = null, array $options = [])
|
||||
* @method \App\Model\Entity\OperatorType[] newEntities(array $data, array $options = [])
|
||||
* @method \App\Model\Entity\OperatorType|false save(\Cake\Datasource\EntityInterface $entity, $options = [])
|
||||
* @method \App\Model\Entity\OperatorType saveOrFail(\Cake\Datasource\EntityInterface $entity, $options = [])
|
||||
* @method \App\Model\Entity\OperatorType patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
|
||||
* @method \App\Model\Entity\OperatorType[] patchEntities($entities, array $data, array $options = [])
|
||||
* @method \App\Model\Entity\OperatorType findOrCreate($search, callable $callback = null, $options = [])
|
||||
*/
|
||||
class OperatorTypesTable extends Table
|
||||
{
|
||||
/**
|
||||
* Initialize method
|
||||
*
|
||||
* @param array $config The configuration for the Table.
|
||||
* @return void
|
||||
*/
|
||||
public function initialize(array $config)
|
||||
{
|
||||
parent::initialize($config);
|
||||
|
||||
$this->setTable('operator_types');
|
||||
$this->setDisplayField('name');
|
||||
$this->setPrimaryKey('id');
|
||||
|
||||
$this->hasMany('Operators', [
|
||||
'foreignKey' => 'operator_type_id'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default validation rules.
|
||||
*
|
||||
* @param \Cake\Validation\Validator $validator Validator instance.
|
||||
* @return \Cake\Validation\Validator
|
||||
*/
|
||||
public function validationDefault(Validator $validator)
|
||||
{
|
||||
$validator
|
||||
->integer('id')
|
||||
->allowEmptyString('id', null, 'create');
|
||||
|
||||
$validator
|
||||
->scalar('name')
|
||||
->maxLength('name', 25)
|
||||
->requirePresence('name', 'create')
|
||||
->notEmptyString('name');
|
||||
|
||||
$validator
|
||||
->scalar('text')
|
||||
->maxLength('text', 255)
|
||||
->requirePresence('text', 'create')
|
||||
->notEmptyString('text');
|
||||
|
||||
return $validator;
|
||||
}
|
||||
}
|
||||
@ -9,6 +9,8 @@ use Cake\Validation\Validator;
|
||||
/**
|
||||
* Operators Model
|
||||
*
|
||||
* @property &\Cake\ORM\Association\BelongsTo $OperatorTypes
|
||||
*
|
||||
* @method \App\Model\Entity\Operator get($primaryKey, $options = [])
|
||||
* @method \App\Model\Entity\Operator newEntity($data = null, array $options = [])
|
||||
* @method \App\Model\Entity\Operator[] newEntities(array $data, array $options = [])
|
||||
@ -31,8 +33,15 @@ class OperatorsTable extends Table
|
||||
parent::initialize($config);
|
||||
|
||||
$this->setTable('operators');
|
||||
$this->setDisplayField('id');
|
||||
$this->setDisplayField('name');
|
||||
$this->setPrimaryKey('id');
|
||||
|
||||
$this->belongsTo('OperatorTypes', [
|
||||
'foreignKey' => 'operator_type_id',
|
||||
'joinType' => 'INNER'
|
||||
]);
|
||||
|
||||
$this->addBehavior('Timestamp');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -48,11 +57,11 @@ class OperatorsTable extends Table
|
||||
->allowEmptyString('id', null, 'create');
|
||||
|
||||
$validator
|
||||
->scalar('username')
|
||||
->maxLength('username', 128)
|
||||
->requirePresence('username', 'create')
|
||||
->notEmptyString('username')
|
||||
->add('username', 'unique', ['rule' => 'validateUnique', 'provider' => 'table']);
|
||||
->scalar('usernamePasswordHash')
|
||||
->maxLength('usernamePasswordHash', 255)
|
||||
->requirePresence('usernamePasswordHash', 'create')
|
||||
->notEmptyString('usernamePasswordHash');
|
||||
//->add('usernamePasswordHash', 'unique', ['rule' => 'validateUnique', 'provider' => 'table']);
|
||||
|
||||
$validator
|
||||
->scalar('data_base64')
|
||||
@ -72,7 +81,8 @@ class OperatorsTable extends Table
|
||||
*/
|
||||
public function buildRules(RulesChecker $rules)
|
||||
{
|
||||
$rules->add($rules->isUnique(['username']));
|
||||
//$rules->add($rules->isUnique(['usernamePasswordHash']));
|
||||
$rules->add($rules->existsIn(['operator_type_id'], 'OperatorTypes'));
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
@ -55,18 +55,18 @@ class ServerUsersTable extends Table
|
||||
->scalar('username')
|
||||
->maxLength('username', 50)
|
||||
->requirePresence('username', 'create')
|
||||
->notEmptyString('username');
|
||||
->notEmptyString('username', __('Please give a username'));
|
||||
|
||||
$validator
|
||||
->scalar('password')
|
||||
->maxLength('password', 255)
|
||||
->requirePresence('password', 'create')
|
||||
->notEmptyString('password');
|
||||
->notEmptyString('password', __('Please give a password'));
|
||||
|
||||
$validator
|
||||
->email('email')
|
||||
->requirePresence('email', 'create')
|
||||
->notEmptyString('email');
|
||||
->notEmptyString('email', __('Please give a email'));
|
||||
|
||||
$validator
|
||||
->scalar('role')
|
||||
|
||||
@ -42,8 +42,9 @@ $cakeDescription = 'CakePHP: the rapid development php framework';
|
||||
</ul>
|
||||
<div class="top-bar-section">
|
||||
<ul class="right">
|
||||
<li><a target="_blank" href="https://book.cakephp.org/3.0/">Documentation</a></li>
|
||||
<li><a target="_blank" href="https://api.cakephp.org/3.0/">API</a></li>
|
||||
<li><?= $this->html->link(__('Logout'), ['controller' => 'ServerUsers', 'action' => 'logout'])?></li>
|
||||
<li><a target="_blank" href="https://book.cakephp.org/3.0/">Documentation</a></li>
|
||||
<li><a target="_blank" href="https://api.cakephp.org/3.0/">API</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
26
src/Template/OperatorTypes/add.ctp
Normal file
26
src/Template/OperatorTypes/add.ctp
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* @var \App\View\AppView $this
|
||||
* @var \App\Model\Entity\OperatorType $operatorType
|
||||
*/
|
||||
?>
|
||||
<nav class="large-3 medium-4 columns" id="actions-sidebar">
|
||||
<ul class="side-nav">
|
||||
<li class="heading"><?= __('Actions') ?></li>
|
||||
<li><?= $this->Html->link(__('List Operator Types'), ['action' => 'index']) ?></li>
|
||||
<li><?= $this->Html->link(__('List Operators'), ['controller' => 'Operators', 'action' => 'index']) ?></li>
|
||||
<li><?= $this->Html->link(__('New Operator'), ['controller' => 'Operators', 'action' => 'add']) ?></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="operatorTypes form large-9 medium-8 columns content">
|
||||
<?= $this->Form->create($operatorType) ?>
|
||||
<fieldset>
|
||||
<legend><?= __('Add Operator Type') ?></legend>
|
||||
<?php
|
||||
echo $this->Form->control('name');
|
||||
echo $this->Form->control('text');
|
||||
?>
|
||||
</fieldset>
|
||||
<?= $this->Form->button(__('Submit')) ?>
|
||||
<?= $this->Form->end() ?>
|
||||
</div>
|
||||
32
src/Template/OperatorTypes/edit.ctp
Normal file
32
src/Template/OperatorTypes/edit.ctp
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* @var \App\View\AppView $this
|
||||
* @var \App\Model\Entity\OperatorType $operatorType
|
||||
*/
|
||||
?>
|
||||
<nav class="large-3 medium-4 columns" id="actions-sidebar">
|
||||
<ul class="side-nav">
|
||||
<li class="heading"><?= __('Actions') ?></li>
|
||||
<li><?= $this->Form->postLink(
|
||||
__('Delete'),
|
||||
['action' => 'delete', $operatorType->id],
|
||||
['confirm' => __('Are you sure you want to delete # {0}?', $operatorType->id)]
|
||||
)
|
||||
?></li>
|
||||
<li><?= $this->Html->link(__('List Operator Types'), ['action' => 'index']) ?></li>
|
||||
<li><?= $this->Html->link(__('List Operators'), ['controller' => 'Operators', 'action' => 'index']) ?></li>
|
||||
<li><?= $this->Html->link(__('New Operator'), ['controller' => 'Operators', 'action' => 'add']) ?></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="operatorTypes form large-9 medium-8 columns content">
|
||||
<?= $this->Form->create($operatorType) ?>
|
||||
<fieldset>
|
||||
<legend><?= __('Edit Operator Type') ?></legend>
|
||||
<?php
|
||||
echo $this->Form->control('name');
|
||||
echo $this->Form->control('text');
|
||||
?>
|
||||
</fieldset>
|
||||
<?= $this->Form->button(__('Submit')) ?>
|
||||
<?= $this->Form->end() ?>
|
||||
</div>
|
||||
51
src/Template/OperatorTypes/index.ctp
Normal file
51
src/Template/OperatorTypes/index.ctp
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* @var \App\View\AppView $this
|
||||
* @var \App\Model\Entity\OperatorType[]|\Cake\Collection\CollectionInterface $operatorTypes
|
||||
*/
|
||||
?>
|
||||
<nav class="large-3 medium-4 columns" id="actions-sidebar">
|
||||
<ul class="side-nav">
|
||||
<li class="heading"><?= __('Actions') ?></li>
|
||||
<li><?= $this->Html->link(__('New Operator Type'), ['action' => 'add']) ?></li>
|
||||
<li><?= $this->Html->link(__('List Operators'), ['controller' => 'Operators', 'action' => 'index']) ?></li>
|
||||
<li><?= $this->Html->link(__('New Operator'), ['controller' => 'Operators', 'action' => 'add']) ?></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="operatorTypes index large-9 medium-8 columns content">
|
||||
<h3><?= __('Operator Types') ?></h3>
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?= $this->Paginator->sort('id') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('name') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('text') ?></th>
|
||||
<th scope="col" class="actions"><?= __('Actions') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($operatorTypes as $operatorType): ?>
|
||||
<tr>
|
||||
<td><?= $this->Number->format($operatorType->id) ?></td>
|
||||
<td><?= h($operatorType->name) ?></td>
|
||||
<td><?= h($operatorType->text) ?></td>
|
||||
<td class="actions">
|
||||
<?= $this->Html->link(__('View'), ['action' => 'view', $operatorType->id]) ?>
|
||||
<?= $this->Html->link(__('Edit'), ['action' => 'edit', $operatorType->id]) ?>
|
||||
<?= $this->Form->postLink(__('Delete'), ['action' => 'delete', $operatorType->id], ['confirm' => __('Are you sure you want to delete # {0}?', $operatorType->id)]) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="paginator">
|
||||
<ul class="pagination">
|
||||
<?= $this->Paginator->first('<< ' . __('first')) ?>
|
||||
<?= $this->Paginator->prev('< ' . __('previous')) ?>
|
||||
<?= $this->Paginator->numbers() ?>
|
||||
<?= $this->Paginator->next(__('next') . ' >') ?>
|
||||
<?= $this->Paginator->last(__('last') . ' >>') ?>
|
||||
</ul>
|
||||
<p><?= $this->Paginator->counter(['format' => __('Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total')]) ?></p>
|
||||
</div>
|
||||
</div>
|
||||
61
src/Template/OperatorTypes/view.ctp
Normal file
61
src/Template/OperatorTypes/view.ctp
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* @var \App\View\AppView $this
|
||||
* @var \App\Model\Entity\OperatorType $operatorType
|
||||
*/
|
||||
?>
|
||||
<nav class="large-3 medium-4 columns" id="actions-sidebar">
|
||||
<ul class="side-nav">
|
||||
<li class="heading"><?= __('Actions') ?></li>
|
||||
<li><?= $this->Html->link(__('Edit Operator Type'), ['action' => 'edit', $operatorType->id]) ?> </li>
|
||||
<li><?= $this->Form->postLink(__('Delete Operator Type'), ['action' => 'delete', $operatorType->id], ['confirm' => __('Are you sure you want to delete # {0}?', $operatorType->id)]) ?> </li>
|
||||
<li><?= $this->Html->link(__('List Operator Types'), ['action' => 'index']) ?> </li>
|
||||
<li><?= $this->Html->link(__('New Operator Type'), ['action' => 'add']) ?> </li>
|
||||
<li><?= $this->Html->link(__('List Operators'), ['controller' => 'Operators', 'action' => 'index']) ?> </li>
|
||||
<li><?= $this->Html->link(__('New Operator'), ['controller' => 'Operators', 'action' => 'add']) ?> </li>
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="operatorTypes view large-9 medium-8 columns content">
|
||||
<h3><?= h($operatorType->name) ?></h3>
|
||||
<table class="vertical-table">
|
||||
<tr>
|
||||
<th scope="row"><?= __('Name') ?></th>
|
||||
<td><?= h($operatorType->name) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?= __('Text') ?></th>
|
||||
<td><?= h($operatorType->text) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?= __('Id') ?></th>
|
||||
<td><?= $this->Number->format($operatorType->id) ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="related">
|
||||
<h4><?= __('Related Operators') ?></h4>
|
||||
<?php if (!empty($operatorType->operators)): ?>
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<th scope="col"><?= __('Id') ?></th>
|
||||
<th scope="col"><?= __('Username') ?></th>
|
||||
<th scope="col"><?= __('Operator Type Id') ?></th>
|
||||
<th scope="col"><?= __('Data Base64') ?></th>
|
||||
<th scope="col" class="actions"><?= __('Actions') ?></th>
|
||||
</tr>
|
||||
<?php foreach ($operatorType->operators as $operators): ?>
|
||||
<tr>
|
||||
<td><?= h($operators->id) ?></td>
|
||||
<td><?= h($operators->username) ?></td>
|
||||
<td><?= h($operators->operator_type_id) ?></td>
|
||||
<td><?= h($operators->data_base64) ?></td>
|
||||
<td class="actions">
|
||||
<?= $this->Html->link(__('View'), ['controller' => 'Operators', 'action' => 'view', $operators->id]) ?>
|
||||
<?= $this->Html->link(__('Edit'), ['controller' => 'Operators', 'action' => 'edit', $operators->id]) ?>
|
||||
<?= $this->Form->postLink(__('Delete'), ['controller' => 'Operators', 'action' => 'delete', $operators->id], ['confirm' => __('Are you sure you want to delete # {0}?', $operators->id)]) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -15,7 +15,8 @@
|
||||
<fieldset>
|
||||
<legend><?= __('Add Operator') ?></legend>
|
||||
<?php
|
||||
echo $this->Form->control('username');
|
||||
echo $this->Form->control('usernamePasswordHash');
|
||||
echo $this->Form->control('operator_type_id');
|
||||
echo $this->Form->control('data_base64');
|
||||
?>
|
||||
</fieldset>
|
||||
|
||||
@ -21,7 +21,8 @@
|
||||
<fieldset>
|
||||
<legend><?= __('Edit Operator') ?></legend>
|
||||
<?php
|
||||
echo $this->Form->control('username');
|
||||
echo $this->Form->control('usernamePasswordHash');
|
||||
echo $this->Form->control('operator_type_id');
|
||||
echo $this->Form->control('data_base64');
|
||||
?>
|
||||
</fieldset>
|
||||
|
||||
@ -16,17 +16,22 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?= $this->Paginator->sort('id') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('username') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('usernamePasswordHash') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('operator_type_id') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('data_base64') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('modified') ?></th>
|
||||
<th scope="col" class="actions"><?= __('Actions') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($operators as $operator): ?>
|
||||
<?php foreach ($operators as $operator): //var_dump($operator);
|
||||
//echo $operator->operator_type->name ?>
|
||||
<tr>
|
||||
<td><?= $this->Number->format($operator->id) ?></td>
|
||||
<td><?= h($operator->username) ?></td>
|
||||
<td><?= h($operator->usernamePasswordHash) ?></td>
|
||||
<td><?= $this->Html->link(__($operator->operator_type->name), ['controller' => 'OperatorTypes', 'action' => 'view', $operator->operator_type_id]) ?></td>
|
||||
<td><?= h($operator->data_base64) ?></td>
|
||||
<td><?= h($operator->modified) ?></td>
|
||||
<td class="actions">
|
||||
<?= $this->Html->link(__('View'), ['action' => 'view', $operator->id]) ?>
|
||||
<?= $this->Html->link(__('Edit'), ['action' => 'edit', $operator->id]) ?>
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
<h3><?= h($operator->id) ?></h3>
|
||||
<table class="vertical-table">
|
||||
<tr>
|
||||
<th scope="row"><?= __('Username') ?></th>
|
||||
<td><?= h($operator->username) ?></td>
|
||||
<th scope="row"><?= __('Username Password Hash') ?></th>
|
||||
<td><?= h($operator->usernamePasswordHash) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?= __('Data Base64') ?></th>
|
||||
@ -28,5 +28,9 @@
|
||||
<th scope="row"><?= __('Id') ?></th>
|
||||
<td><?= $this->Number->format($operator->id) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?= __('Operator Type Id') ?></th>
|
||||
<td><?= $this->Number->format($operator->operator_type_id) ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@ -19,8 +19,6 @@
|
||||
echo $this->Form->control('password');
|
||||
echo $this->Form->control('email');
|
||||
echo $this->Form->control('role');
|
||||
echo $this->Form->control('activated');
|
||||
echo $this->Form->control('last_login', ['empty' => true]);
|
||||
?>
|
||||
</fieldset>
|
||||
<?= $this->Form->button(__('Submit')) ?>
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
<tr>
|
||||
<th scope="col"><?= $this->Paginator->sort('id') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('username') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('password') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('email') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('role') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('activated') ?></th>
|
||||
@ -32,7 +31,6 @@
|
||||
<tr>
|
||||
<td><?= $this->Number->format($serverUser->id) ?></td>
|
||||
<td><?= h($serverUser->username) ?></td>
|
||||
<td><?= h($serverUser->password) ?></td>
|
||||
<td><?= h($serverUser->email) ?></td>
|
||||
<td><?= h($serverUser->role) ?></td>
|
||||
<td><?= h($serverUser->activated) ?></td>
|
||||
|
||||
19
src/Template/ServerUsers/login.ctp
Normal file
19
src/Template/ServerUsers/login.ctp
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
?>
|
||||
<div class="users form large-6 medium-8 columns content center">
|
||||
<?= $this->Flash->render() ?>
|
||||
<?= $this->Form->create() ?>
|
||||
<fieldset>
|
||||
<legend><?= __('Please enter your username and password') ?></legend>
|
||||
<?= $this->Form->control('username') ?>
|
||||
<?= $this->Form->control('password') ?>
|
||||
</fieldset>
|
||||
<?= $this->Form->button(__('Login')); ?>
|
||||
<?= $this->Form->end() ?>
|
||||
</div>
|
||||
@ -522,3 +522,8 @@ table td {
|
||||
vertical-align: top;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.center {
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user