42 lines
975 B
PHP
42 lines
975 B
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
use App\Models\RadarModel;
|
|
|
|
/**
|
|
* IDEE-5 — proto écran Radar (CI4 / Raven).
|
|
*/
|
|
class Radar extends BaseController
|
|
{
|
|
public function index()
|
|
{
|
|
$model = new RadarModel();
|
|
$ready = $model->tablesExist();
|
|
|
|
return view('radar/index', [
|
|
'ready' => $ready,
|
|
'exceptions' => $ready ? $model->listExceptions() : [],
|
|
'threads' => $ready ? $model->listThreads() : [],
|
|
'feedUrl' => site_url('v4/radar/feed'),
|
|
]);
|
|
}
|
|
|
|
public function feed()
|
|
{
|
|
$model = new RadarModel();
|
|
if (!$model->tablesExist()) {
|
|
return $this->response->setJSON([
|
|
'ok' => false,
|
|
'threads' => [],
|
|
]);
|
|
}
|
|
|
|
return $this->response->setJSON([
|
|
'ok' => true,
|
|
'at' => date('c'),
|
|
'threads' => $model->listThreads(),
|
|
]);
|
|
}
|
|
}
|