diff --git a/app/controllers/lvgruppen/lvgruppen.php b/app/controllers/lvgruppen/lvgruppen.php index 9e3e7a4902d2ce8ff46d6aa9d2d79e3abf976f79..194f1718ba0b1e4b91b8d978703c61b04233531a 100644 --- a/app/controllers/lvgruppen/lvgruppen.php +++ b/app/controllers/lvgruppen/lvgruppen.php @@ -15,6 +15,9 @@ class Lvgruppen_LvgruppenController extends MVVController public function before_filter(&$action, &$args) { parent::before_filter($action, $args); + + $this->lvgruppe_id = ''; + // set navigation Navigation::activateItem($this->me . '/lvgruppen/lvgruppen'); $this->filter = $this->sessGet('filter', []); @@ -41,7 +44,7 @@ class Lvgruppen_LvgruppenController extends MVVController // Nur LvGruppen an Modulen von verantwortlichen Einrichtungen an denen der User // eine Rolle hat $own_institutes = MvvPerm::getOwnInstitutes(); - if (!$this->filter['mvv_modul_inst.institut_id']) { + if (empty($this->filter['mvv_modul_inst.institut_id'])) { $this->filter['mvv_modul_inst.institut_id'] = $own_institutes; } else if (count($own_institutes)) { $this->filter['mvv_modul_inst.institut_id'] = array_intersect( diff --git a/app/controllers/materialien/files.php b/app/controllers/materialien/files.php index 5b35a618711c7cce670f5ba75271adf9c5059ed3..65c9b4404e37ecfd5b561ef63616bda44a4f1500 100644 --- a/app/controllers/materialien/files.php +++ b/app/controllers/materialien/files.php @@ -58,6 +58,7 @@ class Materialien_FilesController extends MVVController } } + $this->range_id = ''; if (Request::option('range_id')) { $this->filter = ['mvv_files.range_id' => Request::option('range_id')]; $this->sortby = 'position'; @@ -66,7 +67,7 @@ class Materialien_FilesController extends MVVController // show only files assigned to objects where the responsible institute is // in the list of users own institutes - if (!$this->filter['mvv_studiengang.institut_id']) { + if (empty($this->filter['mvv_studiengang.institut_id'])) { $this->filter['mvv_studiengang.institut_id'] = MvvPerm::getOwnInstitutes(); } @@ -655,16 +656,16 @@ class Materialien_FilesController extends MVVController $semesters = new SimpleCollection(array_reverse(Semester::getAll())); $filter_template = $template_factory->render('shared/filter', [ 'name_search' => true, - 'selected_name' => $this->filter['searchnames'], + 'selected_name' => $this->filter['searchnames'] ?? '', 'name_caption' => _('Name, Kategorie, Schlagwort'), 'semester' => $semesters, 'selected_semester' => $semesters->findOneBy('beginn', $this->filter['start_sem.beginn'])->id, 'default_semester' => Semester::findCurrent()->id, 'institute' => MvvFile::getAllAssignedInstitutes('name', 'ASC', $institute_filter), 'institute_count' => 'count_objects', - 'selected_institut' => $this->filter['mvv_studiengang.institut_id'], - 'zuordnungen' => MvvFile::getAllRelations($this->search_result['MvvFile']), - 'selected_zuordnung' => $this->filter['mvv_files_ranges.range_type'], + 'selected_institut' => $this->filter['mvv_studiengang.institut_id'] ?? '', + 'zuordnungen' => !empty($this->search_result['MvvFile']) ? MvvFile::getAllRelations($this->search_result['MvvFile']) : [], + 'selected_zuordnung' => $this->filter['mvv_files_ranges.range_type'] ?? '', 'action' => $this->action_url('set_filter'), 'action_reset' => $this->action_url('reset_filter')] ); diff --git a/app/controllers/module/institute.php b/app/controllers/module/institute.php index 0572640a11c597accbeab7d4b6ea0632e55e70ef..5ac67fd5a6a9b02b8d3f90cdef1c2dec5b06db96 100644 --- a/app/controllers/module/institute.php +++ b/app/controllers/module/institute.php @@ -16,6 +16,8 @@ class Module_InstituteController extends Module_ModuleController parent::before_filter($action, $args); URLHelper::bindLinkParam('institut_id', $this->institut_id); + $this->inst_id = ''; + if (Request::isXhr()) { $this->set_layout(null); } diff --git a/app/controllers/module/module.php b/app/controllers/module/module.php index c936feec0764aeeca3ac424f7e29f8d5306a8ce9..74415ba81b415efd07ca526e2f78f7ef468c1635 100644 --- a/app/controllers/module/module.php +++ b/app/controllers/module/module.php @@ -20,6 +20,9 @@ class Module_ModuleController extends MVVController Navigation::activateItem($this->me . '/module/module'); $this->filter = $this->sessGet('filter', []); $this->action = $action; + $this->modul_id = ''; + $this->details_url = ''; + $this->modulteil_id = ''; PageLayout::addSqueezePackage('statusgroups'); } @@ -44,7 +47,7 @@ class Module_ModuleController extends MVVController // Nur Module von verantwortlichen Einrichtungen an denen der User // eine Rolle hat - if (!$this->filter['mvv_modul_inst.institut_id']) { + if (empty($this->filter['mvv_modul_inst.institut_id'])) { unset($this->filter['mvv_modul_inst.institut_id']); } $this->filter = array_merge( @@ -1343,7 +1346,7 @@ class Module_ModuleController extends MVVController { // Nur Module von verantwortlichen Einrichtungen an denen der User // eine Rolle hat - if (!$this->filter['mvv_modul_inst.institut_id']) { + if (empty($this->filter['mvv_modul_inst.institut_id'])) { unset($this->filter['mvv_modul_inst.institut_id']); } $modul_filter = array_merge( @@ -1360,22 +1363,25 @@ class Module_ModuleController extends MVVController // Status $modul_ids = Modul::findByFilter($modul_filter); $template->set_attribute('status', Modul::findStatusByIds($modul_ids)); - $template->set_attribute('selected_status', $this->filter['mvv_modul.stat']); + $template->set_attribute('selected_status', $this->filter['mvv_modul.stat'] ?? ''); $template->set_attribute('status_array', $GLOBALS['MVV_MODUL']['STATUS']['values']); // Institutes $template->set_attribute('institute', Modul::getAllAssignedInstitutes('name', 'ASC', $modul_filter)); $template->set_attribute('institute_count', 'count_objects'); - $template->set_attribute('selected_institut', $this->filter['mvv_modul_inst.institut_id']); + $template->set_attribute('selected_institut', $this->filter['mvv_modul_inst.institut_id'] ?? ''); // Semesters $semesters = new SimpleCollection(Semester::getAll()); $semesters = $semesters->orderBy('beginn desc'); - $selected_semester = $semesters->findOneBy('beginn', $this->filter['start_sem.beginn']); + $selected_semester = null; + if (!empty($this->filter['start_sem.beginn'])) { + $selected_semester = $semesters->findOneBy('beginn', $this->filter['start_sem.beginn']); + } $template->set_attribute('semester', $semesters); - $template->set_attribute('selected_semester', $selected_semester->id); + $template->set_attribute('selected_semester', $selected_semester->id ?? ''); $template->set_attribute('default_semester', Semester::findCurrent()->id); $template->set_attribute('action', $this->set_filterURL()); diff --git a/app/controllers/module/mvv_controller.php b/app/controllers/module/mvv_controller.php index f54d8cf0645ce67f1afcee59a3884e94dbb8e978..e84b37cd264e9db609736d1ef1a08a2dfe7ef5e4 100644 --- a/app/controllers/module/mvv_controller.php +++ b/app/controllers/module/mvv_controller.php @@ -67,6 +67,9 @@ abstract class MVVController extends AuthenticatedController { parent::before_filter($action, $args); + $this->sortby = ''; + $this->page_params_suffix = ''; + if (!static::IsVisible()) { throw new AccessDeniedException(); } @@ -204,7 +207,7 @@ abstract class MVVController extends AuthenticatedController 0, -10)) . '/'; } $to = $this->url_for($to); - list($url, $query) = explode('?', $to); + $url = explode('?', $to)[0]; $url = URLHelper::getUrl($url, $params, true); $template = $this->get_template_factory()->open('shared/js_url'); $template->set_attributes(['url' => $url]); @@ -308,7 +311,7 @@ abstract class MVVController extends AuthenticatedController } } else { $search_term = $search_term ?: $this->search_term; - $filter = $filter ?: $this->filter; + $filter = $filter ?? []; if ($search_term) { $this->search_result = $class_name::findBySearchTerm($search_term, $filter)->pluck('id'); diff --git a/app/controllers/shared/contacts.php b/app/controllers/shared/contacts.php index 188ade4dc5c29d3f8f44ba7ba6cf7c58180b5d16..fb43669a135a8f1e490181d49e5e87dbc9685464 100644 --- a/app/controllers/shared/contacts.php +++ b/app/controllers/shared/contacts.php @@ -61,7 +61,7 @@ class Shared_ContactsController extends MVVController // Nur Module von verantwortlichen Einrichtungen an denen der User // eine Rolle hat - if (!$this->filter['mvv_modul_inst.institut_id']) { + if (empty($this->filter['mvv_modul_inst.institut_id'])) { unset($this->filter['mvv_modul_inst.institut_id']); } if ($search_result) { @@ -69,7 +69,7 @@ class Shared_ContactsController extends MVVController } $own_institutes = MvvPerm::getOwnInstitutes(); - if ($this->filter['mvv_modul_inst.institut_id']) { + if (!empty($this->filter['mvv_modul_inst.institut_id'])) { if ($own_institutes) { $this->filter['mvv_modul_inst.institut_id'] = array_intersect( $this->filter['mvv_modul_inst.institut_id'], @@ -353,13 +353,17 @@ class Shared_ContactsController extends MVVController 'default_semester' => Semester::findCurrent()->id, 'institute' => MvvContact::getAllAssignedInstitutes('name', 'ASC', $institute_filter), 'institute_count' => 'count_objects', - 'selected_institut' => $this->filter['mvv_modul_inst.institut_id'], - 'zuordnungen' => MvvContact::getAllRelations($this->search_result['MvvContact']), - 'selected_zuordnung' => $this->filter['mvv_contacts_ranges.range_type'], + 'selected_institut' => $this->filter['mvv_modul_inst.institut_id'] ?? '', + 'zuordnungen' => !empty($this->search_result['MvvContact']) ? MvvContact::getAllRelations($this->search_result['MvvContact']) : [], + 'selected_zuordnung' => $this->filter['mvv_contacts_ranges.range_type'] ?? '', 'kategorien' => $this->findCategoriesByIds(), - 'selected_kategorie' => "{$this->filter['mvv_contacts_ranges.category']}__@type__{$this->filter['mvv_contacts_ranges.range_type']}", + 'selected_kategorie' => sprintf( + "%s__@type__%s", + $this->filter['mvv_contacts_ranges.category'] ?? '', + $this->filter['mvv_contacts_ranges.range_type'] ?? '' + ), 'status' => $this->findStatusByIds(), - 'selected_status' => $this->filter['mvv_contacts.contact_status'], + 'selected_status' => $this->filter['mvv_contacts.contact_status'] ?? '', 'status_array' => ['intern' => ['name' => _('Intern')], 'extern' => ['name' =>_('Extern')]], 'action' => $this->action_url('set_filter'), 'action_reset' => $this->action_url('reset_filter') diff --git a/app/controllers/studiengaenge/fachbereiche.php b/app/controllers/studiengaenge/fachbereiche.php index e1f6d6df9c3c9f8d0c874e24cac38c440ab96db9..970c8d984de7add94ff74c374cdf97ef179dcb3b 100644 --- a/app/controllers/studiengaenge/fachbereiche.php +++ b/app/controllers/studiengaenge/fachbereiche.php @@ -17,10 +17,12 @@ class Studiengaenge_FachbereicheController extends Studiengaenge_StudiengaengeCo public function index_action($studiengang_id = null) { PageLayout::setTitle(_('Studiengänge gruppiert nach Fachbereichen')); - + // Nur Fachbereiche an denen der User eine Rolle hat $perm_institutes = MvvPerm::getOwnInstitutes(); - + + $this->fachbereich_id = ''; + $this->initPageParams('fachbereiche'); $this->sortby = $this->sortby ?: 'name'; $this->order = $this->order ?: 'ASC'; @@ -29,7 +31,7 @@ class Studiengaenge_FachbereicheController extends Studiengaenge_StudiengaengeCo $this->order, ['Institute.Institut_id' => $perm_institutes] ); - + if ($studiengang_id) { $studiengang = Studiengang::find($studiengang_id); $this->details_action($studiengang->institut_id, $studiengang->id); @@ -37,10 +39,10 @@ class Studiengaenge_FachbereicheController extends Studiengaenge_StudiengaengeCo $this->setSidebar(); } - + /** * shows the studiengaenge of a fachbereich - * + * * @param string $fachbereich_id the id of the fachbereich */ public function details_action($fachbereich_id, $studiengang_id = null, $stgteil_bez_id = null) @@ -52,16 +54,16 @@ class Studiengaenge_FachbereicheController extends Studiengaenge_StudiengaengeCo throw new Trails_Exception(403); } } - + $this->parent_id = $this->fachbereich_id; $this->studiengaenge = Studiengang::findByFachbereich($this->fachbereich_id); if ($studiengang_id) { $this->studiengang_id = $studiengang_id; $this->set_studiengangteile($studiengang_id, $stgteil_bez_id); } - + if (Request::isXhr()) { - if ($this->studiengang) { + if (!empty($this->studiengang)) { if ($this->studiengang->typ == 'einfach') { $this->render_template('studiengaenge/studiengaenge/studiengangteile'); } else { @@ -78,4 +80,4 @@ class Studiengaenge_FachbereicheController extends Studiengaenge_StudiengaengeCo $this->perform_relayed('index'); } } -} \ No newline at end of file +} diff --git a/app/controllers/studiengaenge/fachbereichestgteile.php b/app/controllers/studiengaenge/fachbereichestgteile.php index a401d50b0a446efbeee7d1b81d1295ff796e34b1..3f8e29bf71010b9694f81b98a9380322fe2bd36e 100644 --- a/app/controllers/studiengaenge/fachbereichestgteile.php +++ b/app/controllers/studiengaenge/fachbereichestgteile.php @@ -11,13 +11,14 @@ class Studiengaenge_FachbereichestgteileController extends Studiengaenge_Studien { public function index_action() { + $this->details_id = null; PageLayout::setTitle(_('Studiengangteile gruppiert nach Fachbereichen')); - + $this->initPageParams(); $this->initSearchParams(); - + $search_result = $this->getSearchResult('StudiengangTeil'); - + // Nur Studiengangteile mit zugeordnetem Fach an dessen verantwortlicher // Einrichtung der User eine Rolle hat $filter['mvv_fach_inst.institut_id'] = MvvPerm::getOwnInstitutes(); @@ -36,10 +37,10 @@ class Studiengaenge_FachbereichestgteileController extends Studiengaenge_Studien $this->show_sidebar_search = true; $this->setSidebar(); } - + /** * Shows the studiengangteile of a Fachbereich. - * + * * @param string $fachbereich_id the id of the Fachbereich */ public function details_fachbereich_action($fachbereich_id) @@ -57,7 +58,7 @@ class Studiengaenge_FachbereichestgteileController extends Studiengaenge_Studien $this->performe_relayed('index'); } } - + public function stgteil_fachbereich_action($fachbereich_id) { $fachbereich = Institute::find($fachbereich_id); @@ -69,4 +70,4 @@ class Studiengaenge_FachbereichestgteileController extends Studiengaenge_Studien throw new Trails_Exception(404); } } -} \ No newline at end of file +} diff --git a/app/controllers/studiengaenge/faecher.php b/app/controllers/studiengaenge/faecher.php index f5bbc759702b6e8e08c7481aedff3b98d3a1bfa8..7674dde355ff1c180460185dd0ffe4c0eef7f007 100644 --- a/app/controllers/studiengaenge/faecher.php +++ b/app/controllers/studiengaenge/faecher.php @@ -11,12 +11,13 @@ class Studiengaenge_FaecherController extends Studiengaenge_StudiengangteileCont { public function index_action() { + $this->details_id = null; PageLayout::setTitle(_('Verwaltung der Studiengangteile - Studiengangteile gruppiert nach Fächern')); $this->initPageParams(); $this->initSearchParams(); - + $search_result = $this->getSearchResult('StudiengangTeil'); - + // Nur Studiengangteile mit zugeordnetem Fach an dessen verantwortlicher // Einrichtung der User eine Rolle hat $filter['mvv_fach_inst.institut_id'] = MvvPerm::getOwnInstitutes(); @@ -51,10 +52,10 @@ class Studiengaenge_FaecherController extends Studiengaenge_StudiengangteileCont $this->show_sidebar_search = true; $this->setSidebar(); } - + /** * Shows the studiengangteile of a Fach. - * + * * @param string $fach_id the id of the Fach */ public function details_fach_action($fach_id) @@ -77,7 +78,7 @@ class Studiengaenge_FaecherController extends Studiengaenge_StudiengangteileCont $this->perform_relayed('index'); } } - + public function stgteil_fach_action($fach_id) { $fach = Fach::find($fach_id); @@ -89,4 +90,4 @@ class Studiengaenge_FaecherController extends Studiengaenge_StudiengangteileCont } $this->perform_relayed('stgteil'); } -} \ No newline at end of file +} diff --git a/app/controllers/studiengaenge/shared_version.php b/app/controllers/studiengaenge/shared_version.php index 8179027523621c211406f5a4323b657dcfad4729..91869ca28e5b493bd0b6398e73dd535bb4839e83 100644 --- a/app/controllers/studiengaenge/shared_version.php +++ b/app/controllers/studiengaenge/shared_version.php @@ -308,8 +308,7 @@ abstract class SharedVersionController extends MVVController $this->version = StgteilVersion::find($version_id); // search for modules so status of version doesn't matter - $filter = $this->filter; - unset($filter['mvv_stgteilversion.stat']); + $filter = []; $condition = ModuleManagementModel::getFilterSql($filter); $query = "SELECT mvv_modul.modul_id, @@ -681,18 +680,17 @@ abstract class SharedVersionController extends MVVController return; } $this->abschnitt_id = $this->abschnitt->id; - if(!$this->version) { + if(empty($this->version)) { $this->version = $this->abschnitt->getVersion(); } $this->version_id = $this->version->getId(); $this->assignments = StgteilabschnittModul::findByStgteilAbschnitt( $this->abschnitt->getId(), - $this->filter + [] ); // search for modules so status of version doesn't matter - $filter = $this->filter; - unset($filter['mvv_stgteilversion.stat']); + $filter = []; $query = " SELECT mvv_modul.modul_id, CONCAT(mvv_modul_deskriptor.bezeichnung, ', ', IF(ISNULL(mvv_modul.code), '', mvv_modul.code), diff --git a/app/controllers/studiengaenge/stgteilbezeichnungen.php b/app/controllers/studiengaenge/stgteilbezeichnungen.php index 3f738760f2a9dac9b5ce79476b58c77f6367c52a..4a23069929309da5667870ac754e918230b5d216 100644 --- a/app/controllers/studiengaenge/stgteilbezeichnungen.php +++ b/app/controllers/studiengaenge/stgteilbezeichnungen.php @@ -16,6 +16,7 @@ class Studiengaenge_StgteilbezeichnungenController extends MVVController public function index_action() { + $this->bezeichnung_id = ''; PageLayout::setTitle(_('Alle Studiengangteil-Bezeichnungen')); $this->stgteilbezeichnungen = StgteilBezeichnung::getAllEnriched(); $this->setSidebar(); diff --git a/app/controllers/studiengaenge/studiengaenge.php b/app/controllers/studiengaenge/studiengaenge.php index 717904472079b17f3fb7e46a5878db98a35e046f..e0dec62f3a6a37e845521907421dfae5094d4ca5 100644 --- a/app/controllers/studiengaenge/studiengaenge.php +++ b/app/controllers/studiengaenge/studiengaenge.php @@ -357,6 +357,7 @@ class Studiengaenge_StudiengaengeController extends MVVController { $this->set_details_studiengang($studiengang_id); $this->stgteil_bez_id = $stgteil_bez_id; + $this->stg_bez = null; $this->add_stgteil(); if ($stgteil_bez_id) { $this->stg_bez = StgteilBezeichnung::find($stgteil_bez_id); @@ -1047,31 +1048,32 @@ class Studiengaenge_StudiengaengeController extends MVVController $template_factory = $this->get_template_factory(); $studiengang_ids = Studiengang::findByFilter($this->filter); - if ($this->search_result['Studiengang']) { + if (!empty($this->search_result['Studiengang'])) { $studiengang_ids = array_intersect($studiengang_ids, $this->search_result['Studiengang']); } // Semesters $semesters = new SimpleCollection(Semester::getAll()); $semesters = $semesters->orderBy('beginn desc'); + $selected_semester = $semesters->findOneBy('beginn', $this->filter['start_sem.beginn']); $filter_template = $template_factory->render('shared/filter', [ 'semester' => $semesters, - 'selected_semester' => $semesters->findOneBy('beginn', $this->filter['start_sem.beginn'])->id, + 'selected_semester' => $selected_semester ? $selected_semester->id : '', 'default_semester' => Semester::findCurrent()->id, 'status' => Studiengang::findStatusByIds($studiengang_ids), - 'selected_status' => $this->filter['mvv_studiengang.stat'], + 'selected_status' => $this->filter['mvv_studiengang.stat'] ?? '', 'status_array' => $GLOBALS['MVV_STUDIENGANG']['STATUS']['values'], 'kategorien' => AbschlussKategorie::findByStudiengaenge($studiengang_ids), - 'selected_kategorie' => $this->filter['mvv_abschl_zuord.kategorie_id'], + 'selected_kategorie' => $this->filter['mvv_abschl_zuord.kategorie_id'] ?? '', 'abschluesse' => Abschluss::findByStudiengaenge($studiengang_ids), - 'selected_abschluss' => $this->filter['abschluss.abschluss_id'], + 'selected_abschluss' => $this->filter['abschluss.abschluss_id'] ?? '', 'institute' => Studiengang::getAllAssignedInstitutes([ 'mvv_studiengang.studiengang_id' => $studiengang_ids, ]), 'selected_institut' => $this->filter['mvv_studiengang.institut_id'], 'fachbereiche' => Fach::getAllAssignedInstitutes($studiengang_ids), - 'selected_fachbereich' => $this->filter['mvv_fach_inst.institut_id'], + 'selected_fachbereich' => $this->filter['mvv_fach_inst.institut_id'] ?? '', 'action' => $this->action_url('set_filter'), 'action_reset' => $this->action_url('reset_filter') ]); diff --git a/app/controllers/studiengaenge/versionen.php b/app/controllers/studiengaenge/versionen.php index 6868ee5cfc59c4d8eed8da771be23df3b43627ea..ec8cf44c00a2e1f401dce42aadc93cf87f7aaa5e 100644 --- a/app/controllers/studiengaenge/versionen.php +++ b/app/controllers/studiengaenge/versionen.php @@ -32,14 +32,14 @@ class Studiengaenge_VersionenController extends SharedVersionController switch ($step) { case 'index' : $this->chooser_filter['fachbereich'] = - Request::option('id', $this->chooser_filter['fachbereich']); + Request::option('id', !empty($this->chooser_filter['fachbereich'])); $this->chooser_filter['stgteile'] = null; $this->chooser_faecher_fachbereich(); $list = 'faecher_fachbereich'; break; case 'faecher_fachbereich' : $this->chooser_filter['fach'] = - Request::option('id', $this->chooser_filter['fach']); + Request::option('id', !empty($this->chooser_filter['fach'])); $this->chooser_filter['stgteile'] = null; $this->chooser_stgteile_fach(); $list = 'stgteile_fach'; @@ -53,11 +53,13 @@ class Studiengaenge_VersionenController extends SharedVersionController throw new Trails_Exception(400); } $this->name = $list; - foreach ((array) $this->lists[$list]['elements'] as $key => $element) { - $this->list['elements'][$key]['name'] = htmlReady($element['name']); + if (!empty($this->lists[$list]['elements'])) { + foreach ((array)$this->lists[$list]['elements'] as $key => $element) { + $this->list['elements'][$key]['name'] = htmlReady($element['name']); + } } $this->list['headline'] = $this->lists[$list]['headline']; - if ($this->lists[$list]['stop']) { + if (!empty($this->lists[$list]['stop'])) { $this->list['stop'] = 1; } $this->sessSet('chooser_filter', $this->chooser_filter); @@ -82,12 +84,15 @@ class Studiengaenge_VersionenController extends SharedVersionController protected function chooser_faecher_fachbereich() { - $faecher = Fach::findByFachbereich($this->chooser_filter['fachbereich'], true); + $faecher = []; + if (!empty($this->chooser_filter['fachbereich'])) { + $faecher = Fach::findByFachbereich($this->chooser_filter['fachbereich'], true); + } foreach ($faecher as $fach) { $this->lists['faecher_fachbereich']['elements'][$fach->id] = ['name' => $fach->name]; } $this->lists['faecher_fachbereich']['headline'] = _('Fach'); - $this->lists['faecher_fachbereich']['selected'] = $this->chooser_filter['fach']; + $this->lists['faecher_fachbereich']['selected'] = $this->chooser_filter['fach'] ?? ''; } protected function chooser_studiengaenge_kategorie() @@ -148,9 +153,12 @@ class Studiengaenge_VersionenController extends SharedVersionController protected function chooser_stgteile_fach() { - $stgteile = StudiengangTeil::findByFach( - $this->chooser_filter['fach'], null, 'zusatz,kp', 'ASC' - ); + $stgteile = []; + if (!empty($this->chooser_filter['fach'])) { + $stgteile = StudiengangTeil::findByFach( + $this->chooser_filter['fach'], null, 'zusatz,kp', 'ASC' + ); + } foreach ($stgteile as $stgteil) { $this->lists['stgteile_fach']['elements'][$stgteil->id] = [ 'name' => $stgteil->getDisplayName() @@ -158,7 +166,7 @@ class Studiengaenge_VersionenController extends SharedVersionController } $this->lists['stgteile_fach']['headline'] = _('Studiengangteil'); $this->lists['stgteile_fach']['stop'] = 1; - $this->lists['stgteile_fach']['selected'] = $this->chooser_filter['stgteil']; + $this->lists['stgteile_fach']['selected'] = $this->chooser_filter['stgteil'] ?? ''; } protected function chooser_index() @@ -169,7 +177,7 @@ class Studiengaenge_VersionenController extends SharedVersionController $this->lists['index']['elements'][$key] = ['name' => $fachbereich['name']]; } $this->lists['index']['headline'] = _('Fachbereich'); - $this->lists['index']['selected'] = $this->chooser_filter['fachbereich']; + $this->lists['index']['selected'] = $this->chooser_filter['fachbereich'] ?? ''; } /** @@ -203,7 +211,7 @@ class Studiengaenge_VersionenController extends SharedVersionController public function index_action($stgteil_id = null) { - $stgteil_id = Request::option('id', $stgteil_id ?: $this->chooser_filter['stgteil']); + $stgteil_id = Request::option('id', $stgteil_id ?? $this->chooser_filter['stgteil'] ?? ''); PageLayout::setTitle(_('Versionen des gewählten Studiengangteils')); if ($stgteil_id) { $this->stgteil = StudiengangTeil::find($stgteil_id); @@ -275,7 +283,7 @@ class Studiengaenge_VersionenController extends SharedVersionController $this->action_url('reset'), Icon::create('refresh') ); - if ($this->chooser_filter['stgteil']) { + if (!empty($this->chooser_filter['stgteil'])) { $stgteil = StudiengangTeil::find($this->chooser_filter['stgteil']); if ($stgteil && MvvPerm::haveFieldPermVersionen($stgteil, MvvPerm::PERM_CREATE)) { $widget->addLink( @@ -332,7 +340,7 @@ class Studiengaenge_VersionenController extends SharedVersionController 'semester' => $semesters, 'selected_semester' => $semesters->findOneBy('beginn', $this->filter['start_sem.beginn'])->id, 'status' => $status_results, - 'selected_status' => $this->filter['mvv_stgteilversion.stat'], + 'selected_status' => $this->filter['mvv_stgteilversion.stat'] ?? '', 'status_array' => $GLOBALS['MVV_STGTEILVERSION']['STATUS']['values'], 'action' => $this->action_url('set_filter'), 'action_reset' => $this->action_url('reset_filter') diff --git a/app/views/fachabschluss/abschluesse/index.php b/app/views/fachabschluss/abschluesse/index.php index 60fac2a59132d09feabd4763f4756d9c9a093b9c..99422ab64d5b421c1cd3a8009a6e431641fcf8c6 100644 --- a/app/views/fachabschluss/abschluesse/index.php +++ b/app/views/fachabschluss/abschluesse/index.php @@ -48,9 +48,6 @@ <? endif; ?> </td> </tr> - <? if ($abschluss_id === $abschluss->id) : ?> - <?= $this->render_partial('fachabschluss/abschluesse/details', compact('abschluss')) ?> - <? endif; ?> </tbody> <? endforeach; ?> <? if ($count > MVVController::$items_per_page) : ?> @@ -67,7 +64,7 @@ $pagination->set_attribute('pagelink', $page_link); echo $pagination->render('shared/pagechooser'); ?> - + </td> </tr> </tfoot> diff --git a/app/views/fachabschluss/kategorien/index.php b/app/views/fachabschluss/kategorien/index.php index 5eb1ada2072faca2e16a5b5afb5a12033bd708bd..7cfa6a530e375d1cb2788eb8c9e7783c46e6e141 100644 --- a/app/views/fachabschluss/kategorien/index.php +++ b/app/views/fachabschluss/kategorien/index.php @@ -57,9 +57,6 @@ <? endif; ?> </td> </tr> - <? if ($kategorie_id === $kategorie->id) : ?> - <?= $this->render_partial('fachabschluss/kategorien/details', compact('kategorie')) ?> - <? endif; ?> </tbody> <? endforeach; ?> <? else : ?> diff --git a/app/views/module/module/modul.php b/app/views/module/module/modul.php index b2a9e7245e38c875ab9c8cedb9698d8f1d8c9010..2fa0cdd9961213decdf4901bac7d30d35674dae4 100644 --- a/app/views/module/module/modul.php +++ b/app/views/module/module/modul.php @@ -65,7 +65,7 @@ if ($GLOBALS['MVV_MODUL']['SPRACHE']['default'] != $display_language) { <? endif; ?> <ul id="modul_target" class="mvv-assigned-items mvv-assign-single mvv-modul"> <li class="mvv-item-list-placeholder"<?= ($modul->modul_variante ? ' style="display: none;"' : '') ?>><?= _('Dieses Modul ist nicht die Variante eines anderen Moduls.') ?></li> - <? if ($modul->modul_variante->id) : ?> + <? if (!empty($modul->modul_variante->id)) : ?> <li id="modul_<?= $modul->modul_variante->id ?>"> <div class="mvv-item-list-text"> <?= htmlReady($modul->modul_variante->getDisplayName()) ?> diff --git a/app/views/module/module/module.php b/app/views/module/module/module.php index 5dfe3656a3987d784e2cd38b04796bd71babc435..7700a3f589561447406cbbdf23596f4daadb45c1 100644 --- a/app/views/module/module/module.php +++ b/app/views/module/module/module.php @@ -6,7 +6,7 @@ <tr class="header-row" id="modul_<?= $modul->getId() ?>"> <? if ($modul->count_modulteile) : ?> <td style="white-space:nowrap;" class="toggle-indicator"> - <? $details_action = $details_action ?: 'details'; ?> + <? $details_action = $details_action ?? 'details'; ?> <a class="mvv-load-in-new-row" href="<?= $controller->action_link($details_action, $modul->getId()) ?>"> <? if ($ampel_icon) : ?> <?= $ampel_icon->asImg(['title' => $ampelstatus, 'style' => 'vertical-align: text-top;']) ?> diff --git a/app/views/shared/chooser.php b/app/views/shared/chooser.php index e5e1cae3b0da061ea7bb7f0abde017f7142acc04..a7523593e430cd9e380a459420dde3d23fafe15a 100644 --- a/app/views/shared/chooser.php +++ b/app/views/shared/chooser.php @@ -4,11 +4,11 @@ <?= $this->render_partial('shared/chooser_form', compact('name', 'list')); ?> <? endforeach; ?> </div> -<? if ($last) : ?> +<? if (!empty($last)) : ?> <script> <? if (sizeof($filter)) : ?> jQuery('#mvv-chooser-toggle').addClass('mvv-chooser-hidden'); <? endif; ?> jQuery('#mvv-chooser-toggle').fadeIn(); </script> -<? endif; ?> \ No newline at end of file +<? endif; ?> diff --git a/app/views/shared/chooser_form.php b/app/views/shared/chooser_form.php index bb5e47e482b0b01b964cd97cdc459355bc9f1f96..ea5ee5f155826f08ab5ebded067ad0e8ac01f461 100644 --- a/app/views/shared/chooser_form.php +++ b/app/views/shared/chooser_form.php @@ -1,14 +1,14 @@ -<form action="<?= $list['stop'] ? $controller->action_link('index') : $controller->action_link('chooser'); ?>" style="width: 100%;" id="<?= htmlReady($name) ?>"> - <? if (is_array($list['elements']) && sizeof($list['elements'])) : ?> +<form action="<?= !empty($list['stop']) ? $controller->action_link('index') : $controller->action_link('chooser'); ?>" style="width: 100%;" id="<?= htmlReady($name) ?>"> + <? if (!empty($list['elements']) && sizeof($list['elements'])) : ?> <input type="hidden" name="step" value="<?= htmlReady($name) ?>"> - <? if ($list['stop']) : ?> + <? if (!empty($list['stop'])) : ?> <input type="hidden" name="stop" value="1"> <? endif; ?> <label><?= $list['headline'] ?> <select name="id" style="width: 100%;"> <option value="">-- <?= _('Bitte wählen') ?> --</option> <? foreach ($list['elements'] as $key => $element) : ?> - <option value="<?= htmlReady($key) ?>"<?= $key == $list['selected'] ? ' selected' : '' ?>> + <option value="<?= htmlReady($key) ?>"<?= (!empty($list['selected']) && $key == $list['selected']) ? ' selected' : '' ?>> <?= htmlReady($element['name']) ?> </option> <? endforeach; ?> diff --git a/app/views/shared/contacts/details.php b/app/views/shared/contacts/details.php index 680ccee3f538efe476811fc38b7d23e33c39681c..f39d2001e51a7fed1fb40c1dc41cb1775698292f 100644 --- a/app/views/shared/contacts/details.php +++ b/app/views/shared/contacts/details.php @@ -4,7 +4,7 @@ <? else : ?> <? $object_types = ['Studiengang', 'StudiengangTeil', 'Modul'] ?> <? foreach ($object_types as $object_type) : ?> - <? $object_relations = $relations[$object_type] ?> + <? $object_relations = $relations[$object_type] ?? [] ?> <? if (!is_array($object_relations) || count($object_relations) === 0) : continue; endif; ?> <table class="default sortable-table" style="margin-top: 10px;" data-sortlist="[[0, 0]]"> <colgroup> diff --git a/app/views/shared/contacts/index.php b/app/views/shared/contacts/index.php index 2d18dc7c7af6b085bc94082130ae6b659d15c2cf..607357407332396600accc25a3e9bd216c69979b 100644 --- a/app/views/shared/contacts/index.php +++ b/app/views/shared/contacts/index.php @@ -28,7 +28,7 @@ href="<?= $controller->url_for('shared/contacts/details/index', $mvv_contact->contact_id) ?>"><?= htmlReady($mvv_contact->getContactName()) ?></a> </td> <td class="dont-hide"><?= htmlReady($mvv_contact->alt_mail); ?></td> - <td class="dont-hide"><?= htmlReady($GLOBALS['MVV_CONTACTS']['STATUS']['values'][$mvv_contact->contact_status]['name']); ?></td> + <td class="dont-hide"><?= htmlReady($GLOBALS['MVV_CONTACTS']['STATUS']['values'][$mvv_contact->contact_status]['name'] ?? '') ?></td> <td class="dont-hide"><?= htmlReady($mvv_contact->count_relations); ?></td> <td class="dont-hide actions"> <? diff --git a/app/views/shared/filter.php b/app/views/shared/filter.php index e80d3d2322b0945771c631c8da140f7458d452f0..6869faf2df29214ad63b61f229b6566d0f6653d3 100644 --- a/app/views/shared/filter.php +++ b/app/views/shared/filter.php @@ -1,4 +1,4 @@ -<? if ($selected_status || $selected_kategorie || $selected_abschluss || $selected_fachbereich || $selected_zuordnung || $selected_institut || $selected_name || $selected_semester != $default_semester) : ?> +<? if (!empty($selected_status) || !empty($selected_kategorie) || !empty($selected_abschluss) || !empty($selected_fachbereich) || !empty($selected_zuordnung) || !empty($selected_institut) || !empty($selected_name) || (!empty($selected_semester) && !empty($default_semester) && $selected_semester != $default_semester)) : ?> <div style="width: 100%; text-align: right;"> <a href="<?= $action_reset ?>"> <?= Icon::create('refresh', 'clickable', ['title' => _('Filter zurücksetzen')])->asImg(); ?> @@ -7,16 +7,16 @@ </div> <? endif; ?> <form id="index_filter" action="<?= $action ?>" method="post"> - <? if ($name_search) : ?> + <? if (!empty($name_search)) : ?> <label class="mvv-name-search"> <?= $name_caption ?: _('Name') ?>: <input type="text" name="name_filter" value="<?= htmlReady($selected_name) ?>"> <input type="submit" value="<?= _('Suchen') ?>"> </label> <? endif ?> - <? if (isset($semester)) : ?> + <? if (!empty($semester)) : ?> <label> - <?= $semester_caption ?: _('Semester') . ':' ?><br> + <?= $semester_caption ?? _('Semester') . ':' ?><br> <select name="semester_filter" class="sidebar-selectlist submit-upon-select"> <option value="all"<?= (!$selected_semester ? ' selected' : '') ?>><?= _('Alle Semester') ?></option> <? foreach ($semester as $sem) : ?> @@ -25,7 +25,7 @@ </select> </label> <? endif; ?> - <? if (isset($zuordnungen)) : ?> + <? if (!empty($zuordnungen)) : ?> <label> <?= _('Zugeordnet zu Objekten') ?>: <select name="zuordnung_filter" class="sidebar-selectlist submit-upon-select"> @@ -37,7 +37,7 @@ </select> </label> <? endif; ?> - <? if (isset($status)) : ?> + <? if (!empty($status)) : ?> <label> <?= _('Status') ?>:<br> <select name="status_filter" class="sidebar-selectlist submit-upon-select"> @@ -49,12 +49,12 @@ <? endif; ?> <? endforeach; ?> <? if ($status['__undefined__']) : ?> - <option value="__undefined__"<?= $selected_status == '__undefined__' ? ' selected' : '' ?>><?= _('nicht angegeben') . ' (' . ($stat['count_objects'] ?: '0') . ')' ?></option> + <option value="__undefined__"<?= $selected_status == '__undefined__' ? ' selected' : '' ?>><?= _('nicht angegeben') . ' (' . ($stat['count_objects'] ?? '0') . ')' ?></option> <? endif; ?> </select> </label> <? endif; ?> - <? if (isset($kategorien)) : ?> + <? if (!empty($kategorien)) : ?> <label> <?= _('Kategorie') ?>:<br> <select name="kategorie_filter" class="sidebar-selectlist submit-upon-select"> @@ -68,7 +68,7 @@ </select> </label> <? endif; ?> - <? if (isset($abschluesse)) : ?> + <? if (!empty($abschluesse)) : ?> <label> <?= _('Abschluss') ?>:<br> <select name="abschluss_filter" class="sidebar-selectlist submit-upon-select"> @@ -79,7 +79,7 @@ </select> </label> <? endif; ?> - <? if (isset($institute)) : ?> + <? if (!empty($institute)) : ?> <? $perm_institutes = MvvPerm::getOwnInstitutes() ?> <? if ($perm_institutes !== false) : ?> <label> @@ -104,7 +104,7 @@ </label> <? endif ?> <? endif; ?> - <? if (isset($fachbereiche)) : ?> + <? if (!empty($fachbereiche)) : ?> <? $perm_institutes = MvvPerm::getOwnInstitutes() ?> <? if ($perm_institutes !== false) : ?> <label> diff --git a/app/views/studiengaenge/studiengaenge/studiengaenge.php b/app/views/studiengaenge/studiengaenge/studiengaenge.php index 57021c17b876dbb5141266cda877f2e10a2c691e..ad677ed9a5493539f041361b55fb8e60b2bd3ace 100644 --- a/app/views/studiengaenge/studiengaenge/studiengaenge.php +++ b/app/views/studiengaenge/studiengaenge/studiengaenge.php @@ -85,7 +85,7 @@ </form> </td> </tr> - <? if ($studiengang_id === $studiengang->id) : ?> + <? if (!empty($studiengang_id) && ($studiengang_id === $studiengang->id)) : ?> <? if ($studiengang->typ == 'mehrfach') : ?> <tr class="loaded-details nohover"> <?= $this->render_partial('studiengaenge/studiengaenge/stgteil_bezeichnungen', compact('studiengang_id', 'studiengang', 'bez_stgteile', 'stgteile', 'stg_stgbez_id', 'search_stgteil', 'search')) ?> diff --git a/app/views/studiengaenge/studiengangteile/details_grouped.php b/app/views/studiengaenge/studiengangteile/details_grouped.php index 499e1b2d8dfdfde01c8b10c6b74b2836031d1665..28345c1465d194b9a2795b555f1d8a02079be7ed 100644 --- a/app/views/studiengaenge/studiengangteile/details_grouped.php +++ b/app/views/studiengaenge/studiengangteile/details_grouped.php @@ -12,13 +12,13 @@ <? foreach ($stgteile as $stgteil) : ?> <tr> <td> - <? if ($ampel_icon) : ?> + <? if (!empty($ampel_icon)) : ?> <?= $ampel_icon->asImg(['title' => htmlReady($ampelstatus), 'style' => 'vertical-align: text-top;']) ?> <? endif; ?> <?= htmlReady($stgteil->getDisplayName()) ?> </td> <td class="actions" style="white-space: nowrap; width: 1%;"> - <? $actionMenu = ActionMenu::get()->setContext($stgteil->fach_name) ?> + <? $actionMenu = ActionMenu::get()->setContext($stgteil->getDisplayName()) ?> <? if (MvvPerm::havePermWrite($stgteil)) : ?> <? $actionMenu->addLink( $controller->action_url('stgteil/' . $stgteil->id), diff --git a/app/views/studiengaenge/studiengangteile/index.php b/app/views/studiengaenge/studiengangteile/index.php index 6778c7b320c35cd75477e15a4f6e9583515ca217..8c50c4cd6dc98f13719d8ee49237b7829aa8b784 100644 --- a/app/views/studiengaenge/studiengangteile/index.php +++ b/app/views/studiengaenge/studiengangteile/index.php @@ -84,7 +84,7 @@ <?= $actionMenu->render() ?> </td> </tr> - <? if ($stgteil_id == $stgteil->getId()) : ?> + <? if (!empty($stgteil_id) && ($stgteil_id == $stgteil->getId())) : ?> <? $versionen = StgteilVersion::findByStgteil($stgteil->getId()); ?> <tr class="loaded-details nohover"> <?= $this->render_partial('studiengaenge/studiengangteile/details', compact('stgteil_id', 'versionen')) ?> diff --git a/app/views/studiengaenge/versionen/abschnitte.php b/app/views/studiengaenge/versionen/abschnitte.php index 2034bffc6e670889b7ae59678718695b3c9eda13..bad66734b780e20ed0340876d988ec37807d736e 100644 --- a/app/views/studiengaenge/versionen/abschnitte.php +++ b/app/views/studiengaenge/versionen/abschnitte.php @@ -53,7 +53,7 @@ </form> </td> </tr> - <? if ($abschnitt_id === $abschnitt->id) : ?> + <? if (!empty($abschnitt_id) && ($abschnitt_id === $abschnitt->id)) : ?> <tr class="loaded-details nohover"> <?= $this->render_partial('studiengaenge/versionen/details_abschnitt', compact('abschnitt')) ?> </tr> diff --git a/app/views/studiengaenge/versionen/details_abschnitt.php b/app/views/studiengaenge/versionen/details_abschnitt.php index 295b1399eadd730b2f29e4a8e989bf7550ffd817..843316c156b30dfa2171ea6ca668f5fc4852a2fe 100644 --- a/app/views/studiengaenge/versionen/details_abschnitt.php +++ b/app/views/studiengaenge/versionen/details_abschnitt.php @@ -53,7 +53,7 @@ <? endif; ?> </td> </tr> - <? if ($modul_id == $assignment->modul->id) : ?> + <? if (!empty($modul_id) && ($modul_id == $assignment->modul->id)) : ?> <tr class="loaded-details nohover"> <?= $this->render_partial('studiengaenge/versionen/modulteile', ['modul' => $assignment->modul, 'abschnitt_id' => $assignment->abschnitt_id, 'assignment' => $assignment]) ?> </tr> diff --git a/app/views/studiengaenge/versionen/index.php b/app/views/studiengaenge/versionen/index.php index 7e382256c01acba67df9eafc44a6eddb6761cd34..ebf8fb13675b93c8e3a33c7f2ccc3cca209f13ee 100644 --- a/app/views/studiengaenge/versionen/index.php +++ b/app/views/studiengaenge/versionen/index.php @@ -36,7 +36,7 @@ </tfoot> <? endif; ?> </table> - <? if ($stgteil && !$count) : ?> + <? if (!empty($stgteil) && !$count) : ?> <div> <?= sprintf(_('Für den Studiengangteil <strong>%s</strong> wurden noch keine Versionen angelegt. '), htmlReady($stgteil->getDisplayName())) ?> </div> diff --git a/app/views/studiengaenge/versionen/versionen.php b/app/views/studiengaenge/versionen/versionen.php index 96b3470cc11330f1a1211095e108b46925515982..f4ad9af8fd2fda603100a16dba4aef48d4157b5c 100644 --- a/app/views/studiengaenge/versionen/versionen.php +++ b/app/views/studiengaenge/versionen/versionen.php @@ -82,7 +82,7 @@ </form> </td> </tr> - <? if ($version_id === $version->id) : ?> + <? if (!empty($version_id) && ($version_id === $version->id)) : ?> <tr class="loaded-details nohover"> <?= $this->render_partial('studiengaenge/versionen/abschnitte', compact('version', 'abschnitte')) ?> </tr> diff --git a/lib/classes/MvvPerm.php b/lib/classes/MvvPerm.php index 702dfd06827baa6bfd1f37839339edbc36563996..93f9f4404201e1c9e0e10cda3cd7ce265accc0d2 100644 --- a/lib/classes/MvvPerm.php +++ b/lib/classes/MvvPerm.php @@ -86,7 +86,7 @@ class MvvPerm { } else { $index = $mvv_object; } - if (!$perm_objects[$index]) { + if (empty($perm_objects[$index])) { if (!is_object($mvv_object)) { $mvv_class_name = (string) $mvv_object; $mvv_object = new $mvv_class_name; @@ -158,8 +158,10 @@ class MvvPerm { if (mb_strpos($name, 'haveperm') === 0) { $perm = 'PERM_' . mb_strtoupper(mb_substr($name, 8)); if (defined('self::' . $perm)) { - return self::get($arguments[0])->havePerm(constant('self::' . $perm), - $arguments[1], $arguments[2], $arguments[3]); + return self::get($arguments[0])->havePerm( + constant('self::' . $perm), + ...array_slice($arguments, 1) + ); } else { throw new InvalidArgumentException('Undefined Permission.'); } @@ -167,14 +169,18 @@ class MvvPerm { if (mb_strpos($name, 'getfieldperm') === 0) { $field = mb_strtolower(mb_substr($name, 12)); - return self::get($arguments[0])->getFieldPerm($field, - $arguments[1], $arguments[2]); + return self::get($arguments[0])->getFieldPerm( + $field, + ...array_slice($arguments, 1) + ); } if (mb_strpos($name, 'havefieldperm') === 0) { $field = mb_strtolower(mb_substr($name, 13)); - return self::get($arguments[0])->haveFieldPerm($field, $arguments[1], - $arguments[2], $arguments[3]); + return self::get($arguments[0])->haveFieldPerm( + $field, + ...array_slice($arguments, 1) + ); } throw new BadMethodCallException('Method ' @@ -235,8 +241,10 @@ class MvvPerm { if (mb_strpos($name, 'haveperm') === 0) { $perm = 'PERM_' . mb_strtoupper(mb_substr($name, 8)); if (defined('self::' . $perm)) { - return $this->havePerm(constant('self::' . $perm), - $arguments[0], $arguments[1], $arguments[2]); + return $this->havePerm( + constant('self::' . $perm), + ...$arguments + ); } else { throw new InvalidArgumentException('Undefined Permission.'); } @@ -250,8 +258,7 @@ class MvvPerm { if (mb_strpos($name, 'havefieldperm') === 0) { $field = mb_strtolower(mb_substr($name, 13)); - return $this->haveFieldPerm($field, $arguments[0], - $arguments[1], $arguments[2]); + return $this->haveFieldPerm($field, ...$arguments); } throw new BadMethodCallException('Method ' @@ -605,7 +612,7 @@ class MvvPerm { } } - if (self::$user_role_institutes[$user_id] === null) { + if (!isset(self::$user_role_institutes[$user_id])) { $institutes = []; foreach ($roles as $role) { diff --git a/lib/models/DatafieldEntryModel.class.php b/lib/models/DatafieldEntryModel.class.php index 2ea16f619ca5d2af5a9ba7b0937d7860af7fae26..6bc851d77ebf57ca516cd47a8d88638fb04ef5c6 100644 --- a/lib/models/DatafieldEntryModel.class.php +++ b/lib/models/DatafieldEntryModel.class.php @@ -78,7 +78,10 @@ class DatafieldEntryModel extends SimpleORMap implements PrivacyObject $range_id = $model->user_id; $sec_range_id = $model->institut_id; } elseif (is_a($model, 'ModulDeskriptor')) { - $params[':institution_ids'] = [$model->modul->responsible_institute->institut_id]; + $params[':institution_ids'] = ''; + if (!empty($model->modul->responsible_institute->institut_id)) { + $params[':institution_ids'] = [$model->modul->responsible_institute->institut_id]; + } $object_class = $model->getVariant(); $object_type = 'moduldeskriptor'; $range_id = $model->deskriptor_id; diff --git a/lib/models/Lvgruppe.php b/lib/models/Lvgruppe.php index 6983e01a06257f78ae4a023308ecd976ead187f4..3355f77de01e2d7485bcf0e158aa2b885ec4b6f5 100644 --- a/lib/models/Lvgruppe.php +++ b/lib/models/Lvgruppe.php @@ -167,6 +167,8 @@ class Lvgruppe extends ModuleManagementModelTreeItem $filter_sql = ''; } $num_args = func_num_args(); + $semester_join = ''; + $params = []; // get result filtered by a given semester if ($num_args == 2) { $semester_id = func_get_arg(1); diff --git a/lib/models/Modul.php b/lib/models/Modul.php index 8b25c788a123437ec32f2adaf5dd5051c39096f9..a3d7d9c31a5b1aae2b443d1ab512d8cae574f4d8 100644 --- a/lib/models/Modul.php +++ b/lib/models/Modul.php @@ -397,7 +397,7 @@ class Modul extends ModuleManagementModelTreeItem if (!$institute) { return false; } - if ($this->responsible_institute->institut_id != $institut_id) { + if ($this->responsible_institute && $this->responsible_institute->institut_id != $institut_id) { $this->responsible_institute && $this->responsible_institute->delete(); $resp_institute = new ModulInst(); $resp_institute->institut_id = $institute->id; diff --git a/lib/models/ModuleManagementModelTreeItem.php b/lib/models/ModuleManagementModelTreeItem.php index 1c4a6deb6d12ea86f05d425fa3b147d59874f73b..c2d4269c32b0067488d9b16d7cd42877baf8bec8 100644 --- a/lib/models/ModuleManagementModelTreeItem.php +++ b/lib/models/ModuleManagementModelTreeItem.php @@ -95,7 +95,7 @@ abstract class ModuleManagementModelTreeItem extends ModuleManagementModel imple */ private function checkFilter(MvvTreeItem $item) { - $filter = self::$object_filter[get_class($item)]; + $filter = self::$object_filter[get_class($item)] ?? null; if ($filter && is_callable($filter)) { $checked = $filter($item); if (!$checked) { diff --git a/lib/models/MvvFile.php b/lib/models/MvvFile.php index 493fd0351fae81d41ffbe9289a2479eda12d17d9..109ac2b6e4f117b41930b0184d6137d91b8fd4dc 100644 --- a/lib/models/MvvFile.php +++ b/lib/models/MvvFile.php @@ -178,7 +178,7 @@ class MvvFile extends ModuleManagementModel $parameters = []; $name_filter_sql = ''; - if ($filter['searchnames']) { + if (!empty($filter['searchnames'])) { $name_filter_sql = " AND CONCAT_WS(' ', `file_refs`.`name`, `mvv_files_filerefs`.`name`, `mvv_files`.`category`,`mvv_files`.`tags`) LIKE :needle"; $parameters[':needle'] = "%{$filter['searchnames']}%"; } @@ -297,7 +297,7 @@ class MvvFile extends ModuleManagementModel if (empty($filter)) { return parent::getCount(); } - $searchnames = $filter['searchnames']; + $searchnames = $filter['searchnames'] ?? ''; $name_filter_sql = ''; if ($searchnames) { $name_filter_sql = " AND CONCAT_WS(' ', `file_refs`.`name`, `mvv_files_filerefs`.`name`, `mvv_files`.`category`,`mvv_files`.`tags`) LIKE ". DBManager::get()->quote('%' . $searchnames . '%');