diff options
| author | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2024-09-24 10:53:31 +0200 |
|---|---|---|
| committer | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2024-09-24 10:53:31 +0200 |
| commit | 4459dd7917f4d1c34f40bb68f0e991e9c3d53e4c (patch) | |
| tree | 5c07151ae61276d334e88f6309c30d439a85c12e /lib/classes/coursewizardsteps | |
| parent | da0022e5c1abbf9825ae76debaabdff7e8623bb4 (diff) | |
| parent | 97a188592c679890a25c37ab78463add76a52ff7 (diff) | |
Merge branch 'main' into issue-3911issue-3911
Diffstat (limited to 'lib/classes/coursewizardsteps')
4 files changed, 29 insertions, 23 deletions
diff --git a/lib/classes/coursewizardsteps/AdvancedBasicDataWizardStep.php b/lib/classes/coursewizardsteps/AdvancedBasicDataWizardStep.php index 780f837..cd33fd3 100644 --- a/lib/classes/coursewizardsteps/AdvancedBasicDataWizardStep.php +++ b/lib/classes/coursewizardsteps/AdvancedBasicDataWizardStep.php @@ -36,7 +36,7 @@ class AdvancedBasicDataWizardStep extends BasicDataWizardStep } // Load template from step template directory. - $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'].'/app/views/course/wizard/steps'); + $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'].'/app/views/course/wizard/steps'); $template = $factory->open('advancedbasicdata/index'); $template = $this->setupTemplateAttributes($template, $values, $stepnumber, $temp_id); diff --git a/lib/classes/coursewizardsteps/BasicDataWizardStep.php b/lib/classes/coursewizardsteps/BasicDataWizardStep.php index 4f424e8..d47c4f3 100644 --- a/lib/classes/coursewizardsteps/BasicDataWizardStep.php +++ b/lib/classes/coursewizardsteps/BasicDataWizardStep.php @@ -28,7 +28,7 @@ class BasicDataWizardStep implements CourseWizardStep public function getStepTemplate($values, $stepnumber, $temp_id) { // Load template from step template directory. - $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views/course/wizard/steps'); + $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views/course/wizard/steps'); if (!empty($values[__CLASS__]['studygroup'])) { $tpl = $factory->open('basicdata/index_studygroup'); $values[__CLASS__]['lecturers'][$GLOBALS['user']->id] = 1; @@ -356,9 +356,9 @@ class BasicDataWizardStep implements CourseWizardStep htmlReady(get_title_for_status('dozent', 1, $values['coursetype'])) ); } - if (!$values['lecturers'][$GLOBALS['user']->id] && !$GLOBALS['perm']->have_perm('admin')) { + if (empty($values['lecturers'][$GLOBALS['user']->id]) && !$GLOBALS['perm']->have_perm('admin')) { if (Config::get()->DEPUTIES_ENABLE) { - if (!$values['deputies'][$GLOBALS['user']->id]) { + if (empty($values['deputies'][$GLOBALS['user']->id])) { $errors[] = sprintf( _('Sie selbst müssen entweder als %s oder als Vertretung eingetragen sein.'), htmlReady(get_title_for_status('dozent', 1, $values['coursetype'])) @@ -620,7 +620,10 @@ class BasicDataWizardStep implements CourseWizardStep } } - + } else { + foreach ($indices as $index) { + $values[$index] = $values[$index] ?? ''; + } } return $values; diff --git a/lib/classes/coursewizardsteps/LVGroupsWizardStep.php b/lib/classes/coursewizardsteps/LVGroupsWizardStep.php index 22f11ea..c651714 100644 --- a/lib/classes/coursewizardsteps/LVGroupsWizardStep.php +++ b/lib/classes/coursewizardsteps/LVGroupsWizardStep.php @@ -13,7 +13,7 @@ * @category Stud.IP */ -require_once dirname(__FILE__) . '/../StudipLvgruppeSelection.class.php'; +require_once dirname(__FILE__) . '/../StudipLvgruppeSelection.php'; class LVGroupsWizardStep implements CourseWizardStep { @@ -36,10 +36,10 @@ class LVGroupsWizardStep implements CourseWizardStep $course_start_time = $values[$step_one_class]['start_time']; // We only need our own stored values here. - $values = $values[__CLASS__]; + $values = $values[__CLASS__] ?? []; // Load template from step template directory. - $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views/course/wizard/steps'); + $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views/course/wizard/steps'); $tpl = $factory->open('lvgroups/index'); $tpl->set_attribute('values', $values); @@ -53,9 +53,12 @@ class LVGroupsWizardStep implements CourseWizardStep } } - $selection_details = $values['lvgruppe_selection']['area_details']; + $selection_details = $values['lvgruppe_selection']['area_details'] ?? null; - if ($_SESSION[__CLASS__]['course_start_time'] != $course_start_time) { + if ( + isset($_SESSION[__CLASS__]['course_start_time']) + && $_SESSION[__CLASS__]['course_start_time'] != $course_start_time + ) { // don't store previously opened nodes // because we get in trouble if the semester has changed $open_nodes = []; @@ -65,15 +68,15 @@ class LVGroupsWizardStep implements CourseWizardStep $_SESSION[__CLASS__]['course_start_time'] = $course_start_time; - $tpl->set_attribute('open_lvg_nodes', $open_nodes); - $tpl->set_attribute('selection', $selection); - $tpl->set_attribute('selection_details', $selection_details); - $tpl->set_attribute('tree', $lvgtree->getRootItem()->getChildren()); + $tpl->open_lvg_nodes = $open_nodes; + $tpl->selection = $selection; + $tpl->selection_details = $selection_details; + $tpl->tree = $lvgtree->getRootItem()->getChildren(); - $tpl->set_attribute('ajax_url', $values['ajax_url'] ?: URLHelper::getLink('dispatch.php/course/wizard/ajax')); - $tpl->set_attribute('no_js_url', $values['no_js_url'] ?: 'dispatch.php/course/wizard/forward/'.$stepnumber.'/'.$temp_id); - $tpl->set_attribute('stepnumber', $stepnumber); - $tpl->set_attribute('temp_id', $temp_id); + $tpl->ajax_url = !empty($values['ajax_url']) ? $values['ajax_url'] : URLHelper::getLink('dispatch.php/course/wizard/ajax'); + $tpl->no_js_url = !empty($values['no_js_url']) ? $values['no_js_url'] : URLHelper::getURL('dispatch.php/course/wizard/forward/'.$stepnumber.'/'.$temp_id); + $tpl->stepnumber = $stepnumber; + $tpl->temp_id = $temp_id; return $tpl->render(); } @@ -223,7 +226,7 @@ class LVGroupsWizardStep implements CourseWizardStep continue; } - $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views'); + $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views'); $html = $factory->render('course/wizard/steps/lvgroups/lvgroup_searchentry', compact('area')); $data = [ 'id' => $area->id, @@ -285,7 +288,7 @@ class LVGroupsWizardStep implements CourseWizardStep 'Studiengang']); $pathes = ModuleManagementModelTreeItem::getPathes($trails); - $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views'); + $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views'); $html = $factory->render('course/lvgselector/entry_trails', compact('area', 'pathes')); @@ -305,7 +308,7 @@ class LVGroupsWizardStep implements CourseWizardStep $mvvid = explode('-', $id); $area = Lvgruppe::find($mvvid[0]); - $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views'); + $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views'); $html = $factory->render('course/wizard/steps/lvgroups/lvgroup_entry', ['area' => $area, 'locked' => false, 'course_id' => '']); $data = [ diff --git a/lib/classes/coursewizardsteps/StudyAreasWizardStep.php b/lib/classes/coursewizardsteps/StudyAreasWizardStep.php index f81ce41..eac7e37 100644 --- a/lib/classes/coursewizardsteps/StudyAreasWizardStep.php +++ b/lib/classes/coursewizardsteps/StudyAreasWizardStep.php @@ -28,9 +28,9 @@ class StudyAreasWizardStep implements CourseWizardStep public function getStepTemplate($values, $stepnumber, $temp_id) { // We only need our own stored values here. - $values = $values[get_class($this)]; + $values = $values[get_class($this)] ?? []; // Load template from step template directory. - $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'].'/app/views/course/wizard/steps'); + $factory = new Flexi\Factory($GLOBALS['STUDIP_BASE_PATH'].'/app/views/course/wizard/steps'); $tpl = $factory->open('studyareas/index'); if (!empty($values['studyareas'])) { $tree = $this->buildPartialSemTree(StudipStudyArea::backwards(StudipStudyArea::findMany($values['studyareas']))); |
