Skip to content
Snippets Groups Projects
Commit 9dcac1b5 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by Jan-Hendrik Willms
Browse files

make studygroup terms translatable, fixes #400

parent f180a9bd
No related branches found
No related tags found
No related merge requests found
...@@ -860,17 +860,10 @@ class Course_StudygroupController extends AuthenticatedController ...@@ -860,17 +860,10 @@ class Course_StudygroupController extends AuthenticatedController
// get institutes // get institutes
$institutes = StudygroupModel::getInstitutes(); $institutes = StudygroupModel::getInstitutes();
$default_inst = Config::Get()->STUDYGROUP_DEFAULT_INST; $default_inst = $this->flash['institute'] ?? Config::Get()->STUDYGROUP_DEFAULT_INST;
// Nutzungsbedingungen // Nutzungsbedingungen
$terms = Config::Get()->STUDYGROUP_TERMS; $terms = $this->flash['terms'] ?? Config::Get()->STUDYGROUP_TERMS;
if ($this->flash['institute']) {
$default_inst = $this->flash['institute'];
}
if ($this->flash['terms']) {
$terms = $this->flash['terms'];
}
PageLayout::setTitle(_('Verwaltung studentischer Arbeitsgruppen')); PageLayout::setTitle(_('Verwaltung studentischer Arbeitsgruppen'));
Navigation::activateItem('/admin/config/studygroup'); Navigation::activateItem('/admin/config/studygroup');
...@@ -910,7 +903,7 @@ class Course_StudygroupController extends AuthenticatedController ...@@ -910,7 +903,7 @@ class Course_StudygroupController extends AuthenticatedController
if ($errors) { if ($errors) {
$this->flash['messages'] = ['error' => ['title' => 'Die Studiengruppen konnten nicht aktiviert werden!', 'details' => $errors]]; $this->flash['messages'] = ['error' => ['title' => 'Die Studiengruppen konnten nicht aktiviert werden!', 'details' => $errors]];
$this->flash['institute'] = Request::get('institute'); $this->flash['institute'] = Request::get('institute');
$this->flash['terms'] = Request::get('terms'); $this->flash['terms'] = Request::i18n('terms');
} }
if (!$errors) { if (!$errors) {
...@@ -922,7 +915,7 @@ class Course_StudygroupController extends AuthenticatedController ...@@ -922,7 +915,7 @@ class Course_StudygroupController extends AuthenticatedController
if (Request::get('institute')) { if (Request::get('institute')) {
$cfg->store('STUDYGROUP_DEFAULT_INST', Request::get('institute')); $cfg->store('STUDYGROUP_DEFAULT_INST', Request::get('institute'));
$cfg->store('STUDYGROUP_TERMS', Request::get('terms')); $cfg->store('STUDYGROUP_TERMS', Request::i18n('terms'));
PageLayout::postSuccess(_('Die Einstellungen wurden gespeichert!')); PageLayout::postSuccess(_('Die Einstellungen wurden gespeichert!'));
} else { } else {
PageLayout::postError(_('Fehler beim Speichern der Einstellung!')); PageLayout::postError(_('Fehler beim Speichern der Einstellung!'));
......
...@@ -71,7 +71,7 @@ use Studip\Button, Studip\LinkButton; ...@@ -71,7 +71,7 @@ use Studip\Button, Studip\LinkButton;
<label> <label>
<?= _('Geben Sie hier Nutzungsbedingungen für die Studiengruppen ein. ' <?= _('Geben Sie hier Nutzungsbedingungen für die Studiengruppen ein. '
. 'Diese müssen akzeptiert werden, bevor eine Studiengruppe angelegt werden kann.') ?> . 'Diese müssen akzeptiert werden, bevor eine Studiengruppe angelegt werden kann.') ?>
<textarea name="terms"><?= htmlReady($terms) ?></textarea> <?= I18N::textarea('terms', $terms) ?>
</label> </label>
</fieldset> </fieldset>
<footer> <footer>
......
<?php
/**
* @author Jan-Hendrik Willms <tleilax+studip@gmail.com>
* @see https://develop.studip.de/trac/ticket/11418
*/
class Tic11418StudygroupTermsI18n extends Migration
{
public function description()
{
return 'Changes config type to i18n for field STUDYGROUP_TERMS';
}
protected function up()
{
$query = "UPDATE `config`
SET `type` = 'i18n'
WHERE `field` = 'STUDYGROUP_TERMS'";
DBManager::get()->exec($query);
}
protected function down()
{
$query = "DELETE FROM `i18n`
WHERE `object_id` = MD5('STUDYGROUP_TERMS')
AND `table` = 'config'
AND `field` = 'value'";
DBManager::get()->exec($query);
$query = "UPDATE `config`
SET `type` = 'string'
WHERE `field` = 'STUDYGROUP_TERMS'";
DBManager::get()->exec($query);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment