only adds the Events file from addons which are actually active and refactors the Lv Information into its own component

This commit is contained in:
SimonGschnell
2024-10-28 14:15:45 +01:00
parent b801401d2b
commit fbf0417269
5 changed files with 66 additions and 61 deletions
+7 -1
View File
@@ -13,7 +13,8 @@ class MyLv extends Auth_Controller
public function __construct()
{
parent::__construct([
'index' => ['student/anrechnung_beantragen:r','user:r'] // TODO(chris): permissions?
'index' => ['student/anrechnung_beantragen:r','user:r'], // TODO(chris): permissions?
'Info' => ['student/anrechnung_beantragen:r','user:r'] // TODO(chris): permissions?
]);
}
@@ -27,4 +28,9 @@ class MyLv extends Auth_Controller
{
$this->load->view('Cis/MyLv');
}
public function Info($studien_semester,$lvid)
{
$this->load->view('Cis/LvInfo',['lvid'=> $lvid, 'studien_semester' => $studien_semester]);
}
}
+10 -1
View File
@@ -47,10 +47,19 @@ class CI3_Events
*/
require_once(APPPATH.'config/Events.php');
$active_addons_array = explode(";", ACTIVE_ADDONS);
foreach (scandir(APPPATH.'config/extensions') as $dir)
if ($dir[0] != '.' && file_exists(APPPATH.'config/extensions/'.$dir.'/Events.php'))
require_once APPPATH.'config/extensions/'.$dir.'/Events.php';
foreach (scandir(FHCPATH.'addons') as $dir)
if ($dir[0] != '.' && file_exists(FHCPATH.'addons/'.$dir.'/Events.php'))
require_once FHCPATH.'addons/'.$dir.'/Events.php';
{
// only includes the Events of the addon if the addon is one of the active addons in the cis config
if(in_array($dir,$active_addons_array))
{
require_once FHCPATH . 'addons/' . $dir . '/Events.php';
}
}
+15
View File
@@ -0,0 +1,15 @@
<?php
$includesArray = array(
'title' => 'LvInfo',
'customJSModules' => ['public/js/apps/Cis/LvInfo.js']
);
$this->load->view('templates/CISVUE-Header', $includesArray);
?>
<div id="content">
<Info studien_semester="<?= $studien_semester ?>" lehrveranstaltung_id="<?= $lvid ?>"></Info>
</div>
<?php $this->load->view('templates/CISVUE-Footer', $includesArray); ?>