fix(Plugin Moodle Event.php) adds the moodle calendar events integration through the Events instead of having a fixed dependency

This commit is contained in:
SimonGschnell
2025-02-27 12:06:43 +01:00
parent 9b68bfd336
commit e2b1dad776
4 changed files with 24 additions and 8 deletions
@@ -18,6 +18,8 @@
if (! defined('BASEPATH')) exit('No direct script access allowed');
use CI3_Events as Events;
class Stundenplan extends FHCAPI_Controller
{
@@ -28,6 +30,7 @@ class Stundenplan extends FHCAPI_Controller
{
parent::__construct([
'fetchMoodleEvents' => self::PERM_LOGGED,
'getRoomplan' => self::PERM_LOGGED,
'Stunden' => self::PERM_LOGGED,
'Reservierungen' => self::PERM_LOGGED,
@@ -57,6 +60,21 @@ class Stundenplan extends FHCAPI_Controller
//------------------------------------------------------------------------------------------------------------------
// Public methods
public function fetchMoodleEvents(){
$this->load->library('form_validation');
$this->form_validation->set_data($_GET);
$this->form_validation->set_rules('timestart',"timestart","required");
$this->form_validation->set_rules('timeend',"timeend","required");
if($this->form_validation->run() === FALSE) $this->terminateWithValidationErrors($this->form_validation->error_array());
$timestart = intval($this->input->get('timestart', TRUE));
$timeend = intval($this->input->get('timeend', TRUE));
Events::trigger('moodleCalendarEvents',
['timestart'=>$timestart,'timeend'=>$timeend, 'username'=>getAuthUID()]
);
$this->terminateWithSuccess(json_decode(ob_get_contents()));
}
//TODO: delete this function if we don't use the old calendar export endpoints anymore
public function studiensemesterDateInterval($date){
$this->load->model('organisation/Studiensemester_model','StudiensemesterModel');