2020-05-29 13:41:58 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Controller;
|
|
|
|
|
|
|
|
use App\Controller\AppController;
|
|
|
|
use Cake\Utility\Hash;
|
|
|
|
use Cake\Utility\Text;
|
2020-11-06 10:26:15 +01:00
|
|
|
use Cake\Database\Expression\QueryExpression;
|
2020-06-19 00:37:56 +02:00
|
|
|
use Cake\Http\Exception\NotFoundException;
|
|
|
|
use Cake\Http\Exception\MethodNotAllowedException;
|
|
|
|
use Cake\Http\Exception\ForbiddenException;
|
2020-05-29 13:41:58 +02:00
|
|
|
|
|
|
|
class OrganisationsController extends AppController
|
|
|
|
{
|
|
|
|
public function index()
|
|
|
|
{
|
2020-06-19 00:37:56 +02:00
|
|
|
$this->CRUD->index([
|
|
|
|
'filters' => ['name', 'uuid', 'nationality', 'sector', 'type', 'url', 'Alignments.id'],
|
|
|
|
'quickFilters' => ['name', 'uuid', 'nationality', 'sector', 'type', 'url'],
|
|
|
|
'contain' => ['Alignments' => 'Individuals']
|
|
|
|
]);
|
2021-01-11 16:28:07 +01:00
|
|
|
$responsePayload = $this->CRUD->getResponsePayload();
|
|
|
|
if (!empty($responsePayload)) {
|
|
|
|
return $responsePayload;
|
2020-05-29 13:41:58 +02:00
|
|
|
}
|
2020-06-19 00:37:56 +02:00
|
|
|
$this->set('alignmentScope', 'individuals');
|
|
|
|
$this->set('metaGroup', 'ContactDB');
|
2020-05-29 13:41:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function add()
|
|
|
|
{
|
2020-06-19 00:37:56 +02:00
|
|
|
$this->CRUD->add();
|
2021-01-11 16:28:07 +01:00
|
|
|
$responsePayload = $this->CRUD->getResponsePayload();
|
|
|
|
if (!empty($responsePayload)) {
|
|
|
|
return $responsePayload;
|
2020-05-29 13:41:58 +02:00
|
|
|
}
|
|
|
|
$this->set('metaGroup', 'ContactDB');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function view($id)
|
|
|
|
{
|
2020-06-19 00:37:56 +02:00
|
|
|
$this->CRUD->view($id, ['contain' => ['Alignments' => 'Individuals']]);
|
2021-01-11 16:28:07 +01:00
|
|
|
$responsePayload = $this->CRUD->getResponsePayload();
|
|
|
|
if (!empty($responsePayload)) {
|
|
|
|
return $responsePayload;
|
2020-05-29 13:41:58 +02:00
|
|
|
}
|
|
|
|
$this->set('metaGroup', 'ContactDB');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function edit($id)
|
|
|
|
{
|
2020-06-19 00:37:56 +02:00
|
|
|
$this->CRUD->edit($id);
|
2021-01-11 16:28:07 +01:00
|
|
|
$responsePayload = $this->CRUD->getResponsePayload();
|
|
|
|
if (!empty($responsePayload)) {
|
|
|
|
return $responsePayload;
|
2020-05-29 13:41:58 +02:00
|
|
|
}
|
|
|
|
$this->set('metaGroup', 'ContactDB');
|
|
|
|
$this->render('add');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function delete($id)
|
|
|
|
{
|
2020-06-19 00:37:56 +02:00
|
|
|
$this->CRUD->delete($id);
|
2021-01-11 16:28:07 +01:00
|
|
|
$responsePayload = $this->CRUD->getResponsePayload();
|
|
|
|
if (!empty($responsePayload)) {
|
|
|
|
return $responsePayload;
|
2020-05-29 13:41:58 +02:00
|
|
|
}
|
|
|
|
$this->set('metaGroup', 'ContactDB');
|
|
|
|
}
|
|
|
|
}
|