Skip to content
Snippets Groups Projects
Commit fb47f10e authored by André Noack's avatar André Noack
Browse files

Resolve #3193 "Keine unbegrenzten Veranstaltungen mehr in der Kategorie Lehre"

Closes #3193

Merge request studip/studip!2160
parent c79263d7
No related branches found
No related tags found
No related merge requests found
Pipeline #19951 passed
......@@ -125,6 +125,7 @@ class Admin_SemClassesController extends AuthenticatedController
$sem_class->set('admission_type_default', Request::int("admission_type_default"));
$sem_class->set('show_raumzeit', Request::int("show_raumzeit"));
$sem_class->set('is_group', Request::int("is_group"));
$sem_class->set('unlimited_forbidden', Request::bool('unlimited_forbidden'));
$sem_class->store();
foreach (array_keys($sem_class->getModules()) as $module_name) {
if ($sem_class->isModuleMandatory($module_name) && !$old_data_sem_class->isModuleMandatory($module_name)) {
......
......@@ -196,14 +196,20 @@
</label>
<label>
<?= _("Kurzer Beschreibungstext zum Anlegen einer Veranstaltung") ?>
<textarea id="create_description" maxlength="200" style="width: 100%"><?= htmlReady($sem_class['create_description']) ?></textarea>
<input type="checkbox" id="is_group" value="1" <?= $sem_class['is_group'] ? 'checked' : '' ?>>
<?= _('Kann Unterveranstaltungen haben') ?>
</label>
<label>
<input type="checkbox" id="unlimited_forbidden" value="1" <?= $sem_class['unlimited_forbidden'] ? 'checked' : '' ?>>
<?= _('Unbegrenzte Laufzeit verbieten') ?>
</label>
<label>
<input type="checkbox" id="is_group" value="1"<?= $sem_class['is_group'] ? " checked" : "" ?>>
<?= _("Kann Unterveranstaltungen haben") ?>
<?= _('Kurzer Beschreibungstext zum Anlegen einer Veranstaltung') ?>
<textarea id="create_description" maxlength="200" style="width: 100%"><?= htmlReady($sem_class['create_description']) ?></textarea>
</label>
</fieldset>
<fieldset class="attribute_table">
......
......@@ -37,9 +37,11 @@
</option>
<? endif ?>
<? endforeach ?>
<option value="-1"<?= $course->isOpenEnded() ? 'selected' : '' ?>>
<?= _('Unbegrenzt') ?>
</option>
<? if (!$course->getSemClass()['unlimited_forbidden']) : ?>
<option value="-1"<?= $course->isOpenEnded() ? 'selected' : '' ?>>
<?= _('Unbegrenzt') ?>
</option>
<? endif ?>
</select>
</label>
</fieldset>
......
<?php
final class Tic3193NoUnlimitedCourses extends Migration
{
public function description()
{
return 'adds option to forbid unlimited courses';
}
public function up()
{
DBManager::get()->exec("
ALTER TABLE `sem_classes` ADD `unlimited_forbidden` TINYINT UNSIGNED NOT NULL DEFAULT 0 AFTER `is_group`
");
$cache = StudipCacheFactory::getCache();
$cache->expire('DB_SEM_CLASSES_ARRAY');
}
public function down()
{
DBManager::get()->exec("ALTER TABLE `sem_classes` DROP `unlimited_forbidden`");
$cache = StudipCacheFactory::getCache();
$cache->expire('DB_SEM_CLASSES_ARRAY');
}
}
......@@ -383,6 +383,7 @@ class SemClass implements ArrayAccess
"admission_type_default = :admission_type_default, " .
"show_raumzeit = :show_raumzeit, " .
"is_group = :is_group, " .
"unlimited_forbidden = :unlimited_forbidden, " .
"chdate = UNIX_TIMESTAMP() " .
"WHERE id = :id ".
"");
......@@ -425,7 +426,8 @@ class SemClass implements ArrayAccess
'admission_prelim_default' => (int)$this->data['admission_prelim_default'],
'admission_type_default' => (int)$this->data['admission_type_default'],
'show_raumzeit' => (int) $this->data['show_raumzeit'],
'is_group' => (int) $this->data['is_group']
'is_group' => (int) $this->data['is_group'],
'unlimited_forbidden' => (int) $this->data['unlimited_forbidden'],
]);
}
......
......@@ -65,7 +65,8 @@ const admin_sem_class = {
admission_prelim_default: jQuery('#admission_prelim_default').val(),
admission_type_default: jQuery('#admission_type_default').val(),
show_raumzeit: jQuery('#show_raumzeit').is(':checked') ? 1 : 0,
is_group: jQuery('#is_group').is(':checked') ? 1 : 0
is_group: jQuery('#is_group').is(':checked') ? 1 : 0,
unlimited_forbidden: jQuery('#unlimited_forbidden').is(':checked') ? 1 : 0
},
type: 'POST',
dataType: 'json',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment