mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-06-06 06:46:25 +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
|
@ -72,6 +72,51 @@ class Phone extends \descartes\Controller
|
|||
$this->render('phone/list', ['phones' => $phones]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return phones as json with additionnals datas about callbacks
|
||||
*/
|
||||
public function list_json()
|
||||
{
|
||||
$id_user = $_SESSION['user']['id'];
|
||||
$api_key = $_SESSION['user']['api_key'];
|
||||
$phones = $this->internal_phone->list_for_user($id_user);
|
||||
|
||||
$adapters = [];
|
||||
$adapters = $this->internal_adapter->list_adapters();
|
||||
foreach ($adapters as $key => $adapter)
|
||||
{
|
||||
unset($adapters[$key]);
|
||||
$adapters[$adapter['meta_classname']] = $adapter;
|
||||
}
|
||||
|
||||
foreach ($phones as &$phone)
|
||||
{
|
||||
$adapter = $adapters[$phone['adapter']] ?? false;
|
||||
|
||||
if (!$adapter)
|
||||
{
|
||||
$phone['adapter'] = 'Inconnu';
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$phone['adapter'] = $adapter['meta_name'];
|
||||
|
||||
if ($adapter['meta_support_reception'])
|
||||
{
|
||||
$phone['callback_reception'] = \descartes\Router::url('Callback', 'reception', ['adapter_uid' => $adapter['meta_uid'], 'id_phone' => $phone['id']], ['api_key' => $api_key]);
|
||||
}
|
||||
|
||||
if ($adapter['meta_support_status_change'])
|
||||
{
|
||||
$phone['callback_status'] = \descartes\Router::url('Callback', 'update_sended_status', ['adapter_uid' => $adapter['meta_uid']], ['api_key' => $api_key]);
|
||||
}
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(['data' => $phones]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cette fonction va supprimer une liste de phones.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue