]> git.agnieray.net Git - galette.git/blob - galette/includes/routes/public_pages.routes.php
446268e4dae7350c344e4d58cc69bb6ecc7a535c
[galette.git] / galette / includes / routes / public_pages.routes.php
1 <?php
2
3 /**
4 * Copyright © 2003-2024 The Galette Team
5 *
6 * This file is part of Galette (https://galette.eu).
7 *
8 * Galette is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * Galette is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 use Galette\Controllers\Crud;
23 use Slim\Routing\RouteCollectorProxy;
24
25 $app->group('/public', function (RouteCollectorProxy $app) use ($routeparser) {
26 //public members list
27 $app->get(
28 '/{type:list|trombi}[/{option:page|order}/{value:\d+|\w+}]',
29 [Crud\MembersController::class, 'publicList']
30 )->setName('publicList');
31
32 //members list filtering
33 $app->post(
34 '/{type:list|trombi}/filter[/{from}]',
35 [Crud\MembersController::class, 'filterPublicList']
36 )->setName('filterPublicList');
37
38 $app->get(
39 '/members[/{option:page|order}/{value:\d+|\w+}]',
40 function ($request, $response, string $option = null, string $value = null) use ($routeparser) {
41 $args = ['type' => 'list'];
42 if ($option !== null && $value !== null) {
43 $args['option'] = $option;
44 $args['value'] = $value;
45 }
46 return $response
47 ->withStatus(301)
48 ->withHeader('Location', $routeparser->urlFor('publicList', $args));
49 }
50 );
51
52 $app->get(
53 '/trombinoscope',
54 function ($request, $response) use ($routeparser) {
55 $args = ['type' => 'trombi'];
56 return $response
57 ->withStatus(301)
58 ->withHeader('Location', $routeparser->urlFor('publicList', $args));
59 }
60 );
61
62 $app->get(
63 '/documents[/{option:page|order}/{value:\d+|\w+}]',
64 [Crud\DocumentsController::class, 'publicList']
65 )->setName('documentsPublicList');
66 })->add(\Galette\Middleware\PublicPages::class);