diff --git a/app/views/course/wizard/steps/studyareas/_assigned_node.php b/app/views/course/wizard/steps/studyareas/_assigned_node.php index 459cddd31e190299d2e67a145d488b9a889cd6f4..9525fc8ee1ec3cf5da8cbbfc0cdff7a1269ddb40 100644 --- a/app/views/course/wizard/steps/studyareas/_assigned_node.php +++ b/app/views/course/wizard/steps/studyareas/_assigned_node.php @@ -1,12 +1,12 @@ <li class="sem-tree-assigned-<?= $element['id'] ?>"> <?= htmlReady($element['name']) ?> - <?php if (!$values['locked'] && $element['assignable'] && in_array($element['id'], $studyareas ?: [])) : ?> - <?= Icon::create('trash', 'clickable')->asInput(["name" => 'unassign['.$element['id'].']', "onclick" => "return STUDIP.CourseWizard.unassignNode('".$element['id']."')"]) ?> - <input type="hidden" name="studyareas[]" value="<?= $element['id'] ?>"/> + <?php if (empty($values['locked']) && $element['assignable'] && in_array($element['id'], $studyareas ?: [])) : ?> + <?= Icon::create('trash')->asInput(["name" => 'unassign['.$element['id'].']', "onclick" => "return STUDIP.CourseWizard.unassignNode('".$element['id']."')"]) ?> + <input type="hidden" name="studyareas[]" value="<?= htmlReady($element['id']) ?>"/> <?php endif ?> <ul> <?php foreach ($element['children'] as $c) : ?> <?= $this->render_partial('studyareas/_assigned_node', ['element' => $c]) ?> <?php endforeach ?> </ul> -</li> \ No newline at end of file +</li> diff --git a/lib/models/Lvgruppe.php b/lib/models/Lvgruppe.php index 138d28e4d811b8dc7435528bf8b8e85b6f1ea754..05f3b594507d33a1a513e1a24a09406feac85977 100644 --- a/lib/models/Lvgruppe.php +++ b/lib/models/Lvgruppe.php @@ -232,7 +232,7 @@ class Lvgruppe extends ModuleManagementModelTreeItem * * @param string $term The search term. * @param array|string $filter An array with filter options or a where part. - * @return object A SimpleORMapCollection of LV-Gruppen. + * @return SimpleORMapCollection A SimpleORMapCollection of LV-Gruppen. */ public static function findBySearchTerm($term, $filter = null) { @@ -271,7 +271,7 @@ class Lvgruppe extends ModuleManagementModelTreeItem * Retrieves all LV-Gruppen related to the Modulteil with given id. * * @param string $modulteil_id The id of a Modulteil. - * @return object A SimpleORMapCollection of LV-Gruppen. + * @return SimpleORMapCollection A SimpleORMapCollection of LV-Gruppen. */ public static function findByModulteil($modulteil_id) { @@ -286,7 +286,7 @@ class Lvgruppe extends ModuleManagementModelTreeItem * Retrieves all LV-Gruppen related to the course with given id. * * @param string $seminar_id The id of a course. - * @return object A SimpleORMapCollection of LV-Gruppen. + * @return SimpleORMapCollection A SimpleORMapCollection of LV-Gruppen. */ public static function findBySeminar($seminar_id) { @@ -339,7 +339,7 @@ class Lvgruppe extends ModuleManagementModelTreeItem /** * Assigns the given course to the given LvGruppen. * - * @param array Array of ids + * @param string $seminar_id Array of ids * @return int The number of assigned LvGruppen. */ public static function setLvgruppen($seminar_id, $lvgruppen_ids) @@ -347,9 +347,13 @@ class Lvgruppe extends ModuleManagementModelTreeItem $old = Lvgruppe::findBySeminar($seminar_id); $removed = array_diff($old->pluck('id'), $lvgruppen_ids); $added = array_diff($lvgruppen_ids, $old->pluck('id')); + + $count_removed = 0; foreach ($removed as $one) { $count_removed += $old->findOneBy('id', $one)->removeSeminar($seminar_id); } + + $count_added = 0; foreach ($added as $one) { $count_added += Lvgruppe::get($one)->addSeminar($seminar_id); }