31 lines
1.1 KiB
PHP
31 lines
1.1 KiB
PHP
<?php
|
|
namespace ProVM\NotariaRaby\Common\Controller\Web\Admin;
|
|
|
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
|
use Psr\Http\Message\ResponseInterface as Response;
|
|
use Slim\Views\Blade as View;
|
|
use Carbon\Carbon;
|
|
use ProVM\Common\Service\Filemanager;
|
|
|
|
class Admin {
|
|
public function __invoke(Request $request, Response $response, Filemanager $filemanager, View $view): Response {
|
|
$filename = 'aviso.yml';
|
|
$aviso = $filemanager->folder('data')->load($filename);
|
|
if (!$aviso) {
|
|
$aviso = (object) [
|
|
'titulo' => '',
|
|
'contenido' => '',
|
|
'activo' => false
|
|
];
|
|
}
|
|
$months = (object) ['full' => [], 'short' => []];
|
|
$m = Carbon::createFromDate(0, 1, 1);
|
|
for ($i = 0; $i < 12; $i ++) {
|
|
$months->full []= ucwords($m->copy()->addMonths($i)->locale('es_ES')->isoFormat('MMMM'));
|
|
$months->short []= ucwords($m->copy()->addMonths($i)->locale('es_ES')->isoFormat('MMM'));
|
|
}
|
|
$transparencia = $filemanager->folder('data')->load('transparencia.yml')->activo;
|
|
return $view->render($response, 'admin.admin', compact('aviso', 'transparencia', 'months'));
|
|
}
|
|
}
|