]>
git.agnieray.net Git - galette.git/blob - galette/lib/Galette/Controllers/TextController.php
3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
6 * Galette texts controller
10 * Copyright © 2020-2023 The Galette Team
12 * This file is part of Galette (http://galette.tuxfamily.org).
14 * Galette is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
19 * Galette is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
27 * @category Controllers
30 * @author Johan Cwiklinski <johan@x-tnd.be>
31 * @copyright 2020-2023 The Galette Team
32 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
33 * @link http://galette.tuxfamily.org
34 * @since Available since 0.9.4dev - 2020-06-08
37 namespace Galette\Controllers
;
39 use Slim\Psr7\Request
;
40 use Slim\Psr7\Response
;
41 use Galette\Entity\Texts
;
45 * Galette texts controller
47 * @category Controllers
48 * @name TextController
50 * @author Johan Cwiklinski <johan@x-tnd.be>
51 * @copyright 2020-2023 The Galette Team
52 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
53 * @link http://galette.tuxfamily.org
54 * @since Available since 0.9.4dev - 2020-06-08
57 class TextController
extends AbstractController
62 * @param Request $request PSR Request
63 * @param Response $response PSR Response
64 * @param string $lang Language
65 * @param string $ref Ref code
69 public function list(Request
$request, Response
$response, string $lang = null, string $ref = null)
72 $lang = $this->preferences
->pref_lang
;
75 $ref = Texts
::DEFAULT_REF
;
83 $texts->setCurrent($ref);
84 $mtxt = $texts->getTexts($ref, $lang);
89 'pages/configuration_texts.html.twig',
91 'page_title' => _T("Automatic emails texts edition"),
93 'reflist' => $texts->getRefs($lang),
94 'langlist' => $this->i18n
->getList(),
106 * @param Request $request PSR Request
107 * @param Response $response PSR Response
111 public function change(Request
$request, Response
$response)
113 $post = $request->getParsedBody();
118 $this->routeparser
->urlFor(
121 'lang' => $post['sel_lang'],
122 'ref' => $post['sel_ref']
131 * @param Request $request PSR Request
132 * @param Response $response PSR Response
136 public function edit(Request
$request, Response
$response)
138 $post = $request->getParsedBody();
139 $texts = new Texts($this->preferences
, $this->routeparser
);
142 $cur_lang = $post['cur_lang'];
144 $cur_ref = $post['cur_ref'];
146 $mtxt = $texts->getTexts($cur_ref, $cur_lang);
147 $res = $texts->setTexts(
150 $post['text_subject'],
155 $this->flash
->addMessage(
160 _T("Email: '%s' has not been modified!")
164 $this->flash
->addMessage(
169 _T("Email: '%s' has been successfully modified.")
178 $this->routeparser
->urlFor(