mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-20 16:37:48 +02:00
Change all lists to use ajax data source and high perf datatable + improve all consuming listing queries + add indexes on numbers for perf improvment
This commit is contained in:
parent
52ac5b459b
commit
b98d5a22ef
34 changed files with 1238 additions and 767 deletions
|
@ -40,8 +40,22 @@ namespace controllers\publics;
|
|||
*/
|
||||
public function list()
|
||||
{
|
||||
$events = $this->internal_event->list_for_user($_SESSION['user']['id']);
|
||||
$this->render('event/list', ['events' => $events, 'nb_results' => \count($events)]);
|
||||
$this->render('event/list');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return events as json
|
||||
*/
|
||||
public function list_json()
|
||||
{
|
||||
$entities = $this->internal_event->list_for_user($_SESSION['user']['id']);
|
||||
foreach ($entities as &$entity)
|
||||
{
|
||||
$entity['icon'] = \controllers\internals\Tool::event_type_to_icon($entity['type']);
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(['data' => $entities]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,6 +74,13 @@ namespace controllers\publics;
|
|||
|
||||
return $this->redirect(\descartes\Router::url('Event', 'list'));
|
||||
}
|
||||
|
||||
if (!\controllers\internals\Tool::is_admin())
|
||||
{
|
||||
\FlashMessage\FlashMessage::push('danger', 'Vous devez être administrateur pour supprimer un event !');
|
||||
|
||||
return $this->redirect(\descartes\Router::url('Event', 'list'));
|
||||
}
|
||||
|
||||
$ids = $_GET['ids'] ?? [];
|
||||
foreach ($ids as $id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue