v0.8.0-rc
This commit is contained in:
@ -5,39 +5,24 @@ use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Container\ContainerInterface as Container;
|
||||
use Slim\Views\Blade as View;
|
||||
use ProVM\Common\Service\Filemanager;
|
||||
|
||||
class Home {
|
||||
public function __invoke(Request $request, Response $response, View $view, Container $container): Response {
|
||||
public function __invoke(Request $request, Response $response, View $view, Filemanager $manager, Container $container): Response {
|
||||
$banner = (object) [
|
||||
'titulo' => "5° NOTARÍA DE SANTIAGO\nPATRICIO RABY BENAVENTE",
|
||||
'contenido' => "Gertrudis Echenique 30, of. 32, El Golf\n<span class=\"icon-metro\"></span> Metro Alcantara"
|
||||
];
|
||||
$suplente = (object) [
|
||||
'datos' => (object) [
|
||||
'fechas' => "DEL 1 DE ABRIL AL 15 DE MAYO",
|
||||
'nombre' => "MARIA VIRGINIA\nWIELANDT COVARRUBIAS"
|
||||
]
|
||||
];
|
||||
|
||||
$links = (object) [
|
||||
'documentos' => [
|
||||
new Documento($container, 'Autorizaciones'),
|
||||
new Documento($container, 'Declaraciones'),
|
||||
new Documento($container, 'Certificados'),
|
||||
new Documento($container, 'Poderes'),
|
||||
new Documento($container, 'Contratos'),
|
||||
new Documento($container, 'Otros')
|
||||
],
|
||||
'consulta' => [
|
||||
new Link('Servicios de Impuestos Internos', 'http://www.sii.cl'),
|
||||
new Link('Registro Civil', 'http://www.registrocivil.cl'),
|
||||
new Link('Conservador de Bienes Raices', ''),
|
||||
new Link('Diario Oficial', ''),
|
||||
new Link('Tesorería General de la República', ''),
|
||||
new Link('Fojas', '')
|
||||
]
|
||||
];
|
||||
return $view->render($response, 'home', compact('banner', 'suplente', 'links'));
|
||||
$links = $manager->folder('data')->load('documentos.yml');
|
||||
array_walk($links->documentos, function(&$item) use ($container) {
|
||||
$item = new Documento($container, $item->texto, $item->uri);
|
||||
});
|
||||
array_walk($links->consulta, function(&$item) {
|
||||
$item = new Link($item->texto, $item->uri);
|
||||
});
|
||||
$aviso = $manager->folder('data')->load('aviso.yml');
|
||||
return $view->render($response, 'home', compact('banner', 'aviso', 'links'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,16 +31,18 @@ class Documento {
|
||||
protected $texto;
|
||||
protected $uri;
|
||||
|
||||
public function __construct(Container $container, string $nombre) {
|
||||
public function __construct(Container $container, string $nombre, string $uri = '') {
|
||||
$this->icono = implode('/', [$container->get('urls.images'), $nombre . '.png']);
|
||||
$this->texto = $nombre;
|
||||
$this->uri = implode('/', [$container->get('urls.base'), 'documentos', strtolower($nombre)]);
|
||||
$this->uri = $uri;
|
||||
if ($uri == '') {
|
||||
$this->uri = implode('/', [$container->get('urls.base'), 'documentos', strtolower($nombre)]);
|
||||
}
|
||||
}
|
||||
public function show(): string {
|
||||
return '<a href="' . $this->uri . '"><img src="' . $this->icono . '" /> ' . $this->texto . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
class Link {
|
||||
protected $uri;
|
||||
protected $texto;
|
||||
|
Reference in New Issue
Block a user