]>
git.agnieray.net Git - galette.git/blob - galette/lib/Galette/Controllers/TextController.php
d680b9554a49e683691a41ffdba5266f6ca07c49
3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
6 * Galette texts controller
10 * Copyright © 2020-2021 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-2021 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
34 * @link http://galette.tuxfamily.org
35 * @since Available since 0.9.4dev - 2020-06-08
38 namespace Galette\Controllers
;
40 use Slim\Http\Request
;
41 use Slim\Http\Response
;
42 use Galette\Entity\Texts
;
46 * Galette texts controller
48 * @category Controllers
49 * @name TextController
51 * @author Johan Cwiklinski <johan@x-tnd.be>
52 * @copyright 2020-2021 The Galette Team
53 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
54 * @link http://galette.tuxfamily.org
55 * @since Available since 0.9.4dev - 2020-06-08
58 class TextController
extends AbstractController
63 * @param Request $request PSR Request
64 * @param Response $response PSR Response
65 * @param string $lang Language
66 * @param string $ref Ref code
70 public function list(Request
$request, Response
$response, string $lang = null, string $ref = null)
73 $lang = $this->preferences
->pref_lang
;
76 $ref = Texts
::DEFAULT_REF
;
84 $texts->setCurrent($ref);
85 $mtxt = $texts->getTexts($ref, $lang);
92 'page_title' => _T("Automatic emails texts edition"),
94 'reflist' => $texts->getRefs($lang),
95 'langlist' => $this->i18n
->getList(),
107 * @param Request $request PSR Request
108 * @param Response $response PSR Response
112 public function change(Request
$request, Response
$response)
114 $post = $request->getParsedBody();
119 $this->router
->pathFor(
122 'lang' => $post['sel_lang'],
123 'ref' => $post['sel_ref']
132 * @param Request $request PSR Request
133 * @param Response $response PSR Response
137 public function edit(Request
$request, Response
$response)
139 $post = $request->getParsedBody();
140 $texts = new Texts($this->preferences
, $this->router
);
143 $cur_lang = $post['cur_lang'];
145 $cur_ref = $post['cur_ref'];
147 $mtxt = $texts->getTexts($cur_ref, $cur_lang, $this->router
);
148 $res = $texts->setTexts(
151 $post['text_subject'],
156 $this->flash
->addMessage(
161 _T("Email: '%s' has not been modified!")
165 $this->flash
->addMessage(
170 _T("Email: '%s' has been successfully modified.")
179 $this->router
->pathFor(