Merge branch 'merge_C4_25999_61235_61730_calendar' into merge_C4_25999_61235_61730

This commit is contained in:
chfhtw
2025-07-24 10:46:23 +02:00
52 changed files with 3951 additions and 1288 deletions
+6
View File
@@ -0,0 +1,6 @@
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
// Define configuration parameters
$config['timezone'] = 'Europe/Vienna';
+4
View File
@@ -15,6 +15,9 @@ class LvPlan extends Auth_Controller
parent::__construct([
'index' => ['basis/cis:r']
]);
// Load Config
$this->load->config('calendar');
}
// -----------------------------------------------------------------------------------------------------------------
@@ -28,6 +31,7 @@ class LvPlan extends Auth_Controller
$viewData = array(
'uid'=>getAuthUID(),
'timezone' => $this->config->item('timezone')
);
$this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'LvPlan']);
+8 -4
View File
@@ -17,6 +17,9 @@ class Cis4 extends Auth_Controller
'index' => 'basis/cis:r'
)
);
// Load Config
$this->load->config('calendar');
}
// -----------------------------------------------------------------------------------------------------------------
@@ -27,15 +30,16 @@ class Cis4 extends Auth_Controller
*/
public function index()
{
$this->load->model('person/Person_model','PersonModel');
$this->load->model('person/Person_model', 'PersonModel');
$personData = getData($this->PersonModel->getByUid(getAuthUID()))[0];
$viewData = array(
'uid' => getAuthUID(),
'name' => $personData->vorname,
'person_id' => $personData->person_id
'person_id' => $personData->person_id,
'timezone' => $this->config->item('timezone')
);
$this->load->view('CisRouterView/CisRouterView.php',['viewData' => $viewData, 'route' => 'FhcDashboard']);
$this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'FhcDashboard']);
}
}
}
+7 -2
View File
@@ -87,9 +87,14 @@ class Cms extends Auth_Controller
$this->load->view('CisRouterView/CisRouterView.php', ['viewData'=>$viewData, 'route' => 'News']);
}
public function getRoomInformation($ort_kurzbz){
public function getRoomInformation($ort_kurzbz)
{
// Load Config
$this->load->config('calendar');
$viewData = array(
'ort_kurzbz' => $ort_kurzbz
'ort_kurzbz' => $ort_kurzbz,
'timezone' => $this->config->item('timezone')
);
$this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'CmsRoom']);
}
@@ -32,7 +32,7 @@ class LvPlan extends FHCAPI_Controller
parent::__construct([
'getRoomplan' => self::PERM_LOGGED,
'Stunden' => self::PERM_LOGGED,
'Reservierungen' => self::PERM_LOGGED,
'getReservierungen' => self::PERM_LOGGED,
'LvPlanEvents' => self::PERM_LOGGED,
'getLehreinheitStudiensemester' => self::PERM_LOGGED,
'studiensemesterDateInterval' => self::PERM_LOGGED,
@@ -177,55 +177,69 @@ class LvPlan extends FHCAPI_Controller
$this->terminateWithSuccess($stunden);
}
/**
* fetches room events from a certain date
* @access public
*
*/
/**
* fetches room events from a certain date
* @access public
*
* @return void
*/
public function getRoomplan()
{
// form validation
$this->load->library('form_validation');
$this->form_validation->set_rules('ort_kurzbz', "Ort", "required");
$this->form_validation->set_rules('start_date', "start_date", "required");
$this->form_validation->set_rules('end_date', "end_date", "required");
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
// storing the post parameter in local variables
$ort_kurzbz = $this->input->post('ort_kurzbz', true);
$start_date = $this->input->post('start_date', true);
$end_date = $this->input->post('end_date', true);
// get data
$this->load->library('StundenplanLib');
// form validation
$this->load->library('form_validation');
$this->form_validation->set_data($_GET);
$this->form_validation->set_rules('ort_kurzbz',"Ort","required");
$this->form_validation->set_rules('start_date',"start_date","required");
$this->form_validation->set_rules('end_date',"end_date","required");
if($this->form_validation->run() === FALSE) $this->terminateWithValidationErrors($this->form_validation->error_array());
// storing the get parameter in local variables
$ort_kurzbz = $this->input->get('ort_kurzbz', TRUE);
$start_date = $this->input->get('start_date', TRUE);
$end_date = $this->input->get('end_date', TRUE);
$roomplan_data = $this->LvPlan->lvPlanGruppierung($this->LvPlan->getRoomQuery($ort_kurzbz, $start_date, $end_date));
$roomplan_data = $this->getDataOrTerminateWithError($roomplan_data);
$this->stundenplanlib->expand_object_information($roomplan_data);
$roomplan_data = $this->stundenplanlib->getRoomplan($ort_kurzbz, $start_date, $end_date);
$roomplan_data = $this->getDataOrTerminateWithError($roomplan_data);
$this->terminateWithSuccess($roomplan_data);
}
// gets the reservierungen of a room if the ort_kurzbz parameter is supplied otherwise gets the reservierungen of the lvplan of a student
public function Reservierungen($ort_kurzbz = null)
/**
* gets the reservierungen of a room if the ort_kurzbz parameter is
* supplied otherwise gets the reservierungen of the lvplan of a student
* @access public
*
* @param string $ort_kurzbz
* @return void
*/
public function getReservierungen($ort_kurzbz = null)
{
$this->load->library('StundenplanLib');
//form validation
$this->load->library('form_validation');
$this->form_validation->set_data($_GET);
$this->form_validation->set_rules('start_date', "StartDate", "required");
$this->form_validation->set_rules('end_date', "EndDate", "required");
if($this->form_validation->run() == FALSE) $this->terminateWithValidationErrors($this->form_validation->error_array());
if (!$this->form_validation->run())
$this->terminateWithValidationErrors($this->form_validation->error_array());
$this->load->model('ressource/Mitarbeiter_model','MitarbeiterModel');
// storing the post parameter in local variables
$start_date = $this->input->post('start_date', true);
$end_date = $this->input->post('end_date', true);
// storing the get parameter in local variables
$start_date = $this->input->get('start_date', TRUE);
$end_date = $this->input->get('end_date', TRUE);
// get data
$this->load->library('StundenplanLib');
$result = $this->stundenplanlib->getReservierungen($start_date, $end_date, $ort_kurzbz);
$result = $this->getDataOrTerminateWithError($result);
$result = $this->stundenplanlib->getReservierungen($start_date,$end_date,$ort_kurzbz);
$result = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($result);
}
+93 -22
View File
@@ -3,6 +3,11 @@
if (! defined('BASEPATH')) exit('No direct script access allowed');
use \DateTime as DateTime;
use \DateTimeZone as DateTimeZone;
use \DateInterval as DateInterval;
use \DatePeriod as DatePeriod;
class StundenplanLib{
private $_ci; // Code igniter instance
@@ -14,9 +19,11 @@ class StundenplanLib{
*
*/
public function getStundenplan($start_date, $end_date, $lv_id = null){
$this->_ci =& get_instance();
// Load Config
$this->_ci->load->config('calendar');
$this->_ci->load->model('ressource/Mitarbeiter_model','MitarbeiterModel');
$this->_ci->load->model('organisation/Studiensemester_model','StudiensemesterModel');
$this->_ci->load->model('education/Studentlehrverband_model', 'StudentlehrverbandModel');
@@ -123,26 +130,69 @@ class StundenplanLib{
}
public function getReservierungen($start_date, $end_date, $ort_kurzbz){
/**
* Get stundenplan for a room
*
* @param string $ort_kurzbz
* @param string $start_date
* @param string $end_date
* @return stdClass
*/
public function getRoomplan($ort_kurzbz, $start_date, $end_date)
{
$this->_ci =& get_instance();
// Load Config
$this->_ci->load->config('calendar');
// Load Models
$this->_ci->load->model('ressource/Stundenplan_model', 'StundenplanModel');
$query = $this->_ci->StundenplanModel->getRoomQuery($ort_kurzbz, $start_date, $end_date);
$roomplan_data = $this->_ci->StundenplanModel->stundenplanGruppierung($query);
if (isError($roomplan_data))
return $roomplan_data;
$this->expand_object_information($roomplan_data->retval);
return $roomplan_data;
}
/**
* Get reservations (for a room or all)
*
* @param string $start_date
* @param string $end_date
* @param string $ort_kurzbz
* @return stdClass
*/
public function getReservierungen($start_date, $end_date, $ort_kurzbz = '')
{
$this->_ci =& get_instance();
// Load Config
$this->_ci->load->config('calendar');
// Load Models
$this->_ci->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel');
$is_mitarbeiter = getData($this->_ci->MitarbeiterModel->isMitarbeiter(getAuthUID()));
if($is_mitarbeiter)
{
if ($is_mitarbeiter) {
$reservierungen = $this->_ci->ReservierungModel->getReservierungenMitarbeiter($start_date, $end_date, $ort_kurzbz);
} else {
// querying the reservierungen
$reservierungen = $this->_ci->ReservierungModel->getReservierungen($start_date, $end_date, $ort_kurzbz);
}
if(isError($reservierungen))
{
return error(getData($reservierungen));
}
$reservierungen = getData($reservierungen) ?? [];
$function_error = $this->expand_object_information($reservierungen);
if(!is_null($function_error)){
if (isError($reservierungen))
return $reservierungen;
$function_error = $this->expand_object_information($reservierungen->retval);
if (!is_null($function_error))
return $function_error;
}
return success($reservierungen);
return $reservierungen;
}
public function getLektorenFromLehrveranstaltung($lehrveranstaltung_id, $semester, $studiengang_kz, $studiensemester_kurzbz){
@@ -181,8 +231,15 @@ class StundenplanLib{
public function expand_object_information($data){
$this->_ci =& get_instance();
foreach ($data as $item)
{
$tz = new DateTimeZone($this->_ci->config->item('timezone'));
$isostart = new DateTime($item->datum . ' ' . $item->beginn, $tz);
$item->isostart = $isostart->format(DateTime::ATOM);
$isoend = new DateTime($item->datum . ' ' . $item->ende, $tz);
$item->isoend = $isoend->format(DateTime::ATOM);
$lektor_obj_array = array();
$gruppe_obj_array = array();
@@ -254,9 +311,17 @@ class StundenplanLib{
}
}
public function fetchFerienTageEvents($start_date, $end_date, $studiengang_kz){
public function fetchFerienTageEvents($start_date, $end_date, $studiengang_kz)
{
$this->_ci =& get_instance();
$this->_ci->load->model('organisation/Ferien_model','FerienModel');
// Load Config
$this->_ci->load->config('calendar');
$this->_ci->load->model('organisation/Ferien_model', 'FerienModel');
$tz = new DateTimeZone($this->_ci->config->item('timezone'));
$ferienEvents = $this->_ci->FerienModel->execReadOnlyQuery("
SELECT *
FROM lehre.tbl_ferien
@@ -277,35 +342,41 @@ class StundenplanLib{
$interval = new DateInterval('P1D');
$period = new DatePeriod($event_start, $interval, $event_end);
$event->dates = array_map(function($date){
return $date->format('Y-m-d');
}, iterator_to_array($period));
$event->dates = iterator_to_array($period);
return $event;
}, $ferienEvents);
$start_date = new DateTime($start_date);
$start_date->setTime(0, 0, 0);
$end_date = new DateTime($end_date);
$end_date->setTime(23, 59, 59);
$ferienEventsFlattened=[];
foreach($ferienEvents as $ferien_event){
foreach($ferien_event->dates as $date){
if ($date < $start_date || $date > $end_date)
continue;
$event = new stdClass();
$event->bezeichnung = $ferien_event->bezeichnung;
$event->datum = $date;
$event->datum = $date->format('Y-m-d');
$event->type = 'ferien';
$ferienEventsFlattened[] = $event;
}
};
$today=new DateTime();
$ferienEventsFlattened = array_map(function($event) use($today){
$ferienEventsFlattened = array_map(function($event) use($today, $tz){
$ferien_event = (object) array(
'type' => 'ferien',
'beginn' => $today->format('H:i:s'),
'ende' => $today->format('H:i:s'),
'isostart' => (new DateTime($event->datum . ' 00:00:00', $tz))->format('c'),
'isoend' => (new DateTime($event->datum . ' 23:59:59', $tz))->format('c'),
'allDayEvent' => true,
'datum' => $event->datum,
'topic' => $event->bezeichnung,
'titel' => $event->bezeichnung,
'farbe' => '00689E'
);
return $ferien_event;
}, $ferienEventsFlattened);
@@ -635,7 +706,7 @@ class StundenplanLib{
{
return $sem->studiensemester_kurzbz;
},
getData($semester_range)
getData($semester_range) ?: []
);
// if no studiensemester is found for the given timespan, get the nearest studiensemester
@@ -15,7 +15,7 @@ $includesArray = array(
'public/css/components/searchbar/searchbar.css',
'public/css/Fhc.css',
'public/css/components/dashboard.css',
'public/css/components/calendar.css',
//'public/css/components/calendar.css', <= imported in dashboard.css
'public/css/components/Sprachen.css',
'public/css/components/MyLv.css',
'public/css/components/FilterComponent.css',
@@ -29,7 +29,8 @@ $includesArray = array(
'vendor/npm-asset/primevue/accordiontab/accordiontab.min.js',
'vendor/npm-asset/primevue/inputnumber/inputnumber.min.js',
'vendor/npm-asset/primevue/textarea/textarea.min.js',
'vendor/npm-asset/primevue/checkbox/checkbox.min.js'
'vendor/npm-asset/primevue/checkbox/checkbox.min.js',
'vendor/moment/luxonjs/luxon.min.js'
),
'customJSModules' => array(
'public/js/apps/Dashboard/Fhc.js'
@@ -39,7 +40,7 @@ $includesArray = array(
$this->load->view('templates/CISVUE-Header', $includesArray);
?>
<div id="fhccontent" route=<?php echo $route ?>>
<div id="fhccontent" class="h-100" route=<?php echo $route ?>>
<router-view
:view-data='<?php echo json_encode($viewData) ?>'
></router-view>