Merge branch 'feature-25999/C4_cleanup' into merge_FHC4_C4

This commit is contained in:
Harald Bamberger
2025-02-05 16:57:52 +01:00
26 changed files with 495 additions and 158 deletions
+2 -2
View File
@@ -25,9 +25,9 @@ class Stundenplan extends Auth_Controller
*/
public function index($lv_id = null)
{
$viewData = array(
'lv_id' => $lv_id
'lv_id' => $lv_id,
'uid'=>getAuthUID(),
);
$this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'Stundenplan']);
@@ -0,0 +1,52 @@
<?php
/**
* Copyright (C) 2024 fhcomplete.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
if (!defined('BASEPATH')) exit('No direct script access allowed');
class AuthInfo extends FHCAPI_Controller
{
/**
* Object initialization
*/
public function __construct()
{
parent::__construct([
'getAuthUID' => self::PERM_LOGGED,
]);
$this->uid = getAuthUID();
$this->pid = getAuthPersonID();
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* returns the uid of the currently logged in user
* @access public
*
*/
public function getAuthUID()
{
$this->terminateWithSuccess(['uid'=>$this->uid]);
}
}
@@ -33,6 +33,7 @@ class Stundenplan extends FHCAPI_Controller
'Reservierungen' => self::PERM_LOGGED,
'getStundenplan' => self::PERM_LOGGED,
'getLehreinheitStudiensemester' => self::PERM_LOGGED,
'studiensemesterDateInterval' => self::PERM_LOGGED,
]);
$this->load->library('LogLib');
@@ -56,6 +57,15 @@ class Stundenplan extends FHCAPI_Controller
//------------------------------------------------------------------------------------------------------------------
// Public methods
//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');
$studiensemester =$this->StudiensemesterModel->getByDate(date_format(date_create($date),'Y-m-d'));
$studiensemester =current($this->getDataOrTerminateWithError($studiensemester));
$this->terminateWithSuccess($studiensemester);
}
/**
* fetches Stunden layout from database
* @access public
@@ -545,7 +555,7 @@ class Stundenplan extends FHCAPI_Controller
private function studienSemesterErmitteln($start_date,$end_date){
// gets all studiensemester from the student from start_date to end_date
$semester_range = $this->StudiensemesterModel->getByDate($start_date,$end_date);
$semester_range = $this->StudiensemesterModel->getByDateRange($start_date,$end_date);
$semester_range = array_map(
function($sem)
{
@@ -170,13 +170,31 @@ class Studiensemester_model extends DB_Model
return $this->execQuery($query, array($studiensemester_kurzbz, $studiengang_kz));
}
/**
* Gets a Studiensemester for a date
* @param $date
* @return string
*/
public function getByDate($date)
{
// gets the studiensemster of a date or the next closest previous studiensemester if a date is not within a studiensemester
$query = "
SELECT studiensemester_kurzbz, start, ende
FROM public.tbl_studiensemester
WHERE ( ende >= ?::date AND start <= ?::date ) OR ( ende >= ?::date + '-45 days'::interval AND start <= ?::date + '-45 days'::interval )
ORDER BY start DESC
LIMIT 1";
return $this->execQuery($query, array($date,$date,$date,$date));
}
/**
* Gets all Studiensemester between two dates
* @param $from
* @param $to
* @return array|null
*/
public function getByDate($from, $to)
public function getByDateRange($from, $to)
{
if (date_format(date_create($from), 'Y-m-d') > (date_format(date_create($to), 'Y-m-d')))
return success(array());
+1 -1
View File
@@ -10,7 +10,7 @@ $this->load->view(
);
?>
<iframe style="width:100%; height:100%;" id="Infoterminal" src="<?php echo base_url() . 'cis/infoterminal/'; ?>" name="Infoterminal" frameborder="0" >
<iframe style="width:100%; height:100%;" id="Infoterminal" src="<?php echo base_url() . 'cis/infoterminal/?forcelogin=true'; ?>" name="Infoterminal" frameborder="0" >
No iFrames
</iframe>
<?php $this->load->view('templates/CISVUE-Footer', $includesArray); ?>