mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-21 08:52:21 +00:00
Merge master into feature-54564/FHC-4_Studierendenverwaltung_Abschlusspruefung
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
class LehrveranstaltungFaktor_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'lehre.tbl_lehrveranstaltung_faktor';
|
||||
$this->pk = 'lehrveranstaltung_faktor_id';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
class Gruppe_manager_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'public.tbl_gruppe_manager';
|
||||
$this->pk = 'gruppe_manager_id';
|
||||
}
|
||||
}
|
||||
@@ -142,7 +142,7 @@ class Notiz_model extends DB_Model
|
||||
$this->addSelect('public.tbl_notiz.*');
|
||||
$this->addJoin('public.tbl_notizzuordnung', 'notiz_id');
|
||||
|
||||
return $this->loadWhere(array('person_id' => $person_id));
|
||||
return $this->loadWhere(array('person_id' => $person_id, 'tbl_notiz.typ' => NULL));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
class Projects_Employees_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'sync.tbl_projects_employees';
|
||||
$this->pk = 'projects_employees_id';
|
||||
}
|
||||
|
||||
public function deleteByProjectTaskId($ids)
|
||||
{
|
||||
$qry = "DELETE FROM " . $this->dbTable . "
|
||||
WHERE project_task_id IN ?";
|
||||
|
||||
return $this->execQuery($qry, array($ids));
|
||||
}
|
||||
}
|
||||
@@ -135,7 +135,7 @@ class Stundenplan_model extends DB_Model
|
||||
|
||||
|
||||
/**
|
||||
* function that takes a query that fetches lehre.vw_stundenplan rows and groups them so that they can be displayed in a calendar
|
||||
* groups rows of a subquery that fetches data from the lehre.vw_stundenplan table
|
||||
* @param string $stundenplanViewQuery the subquery used to group the result
|
||||
*
|
||||
* @return stdClass
|
||||
@@ -190,7 +190,7 @@ class Stundenplan_model extends DB_Model
|
||||
* NO STANDALONE FUNCTION - Generates a SQL query string to fetch 'stundenplan' events for a specific student within the current semester.
|
||||
* @param string $uid the user id that is used to fetch the stundenplan rows from the lehre.vw_stundenplan table
|
||||
*
|
||||
* @return string
|
||||
* @return mixed
|
||||
*/
|
||||
public function getStundenplanQuery($start_date, $end_date,$semester,$gruppen,$studentlehrverbaende){
|
||||
|
||||
@@ -206,7 +206,13 @@ class Stundenplan_model extends DB_Model
|
||||
}
|
||||
return $result;
|
||||
};
|
||||
|
||||
|
||||
// if both the gruppen and the studentlehrverbaende are empty we early return
|
||||
if($emptyCheck($gruppen) && $emptyCheck($studentlehrverbaende))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$query =
|
||||
"select sp.*
|
||||
from lehre.vw_stundenplan sp
|
||||
@@ -233,15 +239,15 @@ class Stundenplan_model extends DB_Model
|
||||
// converts the array of gruppen strings into a sql IN (_,_,_) chain
|
||||
$query .="(sp.gruppe_kurzbz IN (" .implode(',',$gruppen[$sem_date]).") AND sp.datum BETWEEN ".$this->escape($sem_date_range->start)." AND ".$this->escape($sem_date_range->ende)." )";
|
||||
|
||||
// adds the OR sql chain only if the $studentlehrverbaende array is not empty
|
||||
// DOES not include the sql OR if the $studentlehrverbaende are empty and it is the last gruppen element in the iteration
|
||||
if(key($semester) != $sem || !$emptyCheck($studentlehrverbaende))
|
||||
{
|
||||
$query .="OR";
|
||||
}
|
||||
|
||||
$query .="OR";
|
||||
}
|
||||
}
|
||||
|
||||
// if there are no studentlehrverbaende and the gruppen are not empty, we can remove the last OR added after the groups
|
||||
if($emptyCheck($studentlehrverbaende) && !$emptyCheck($gruppen))
|
||||
{
|
||||
$query = substr($query, 0, -2);
|
||||
}
|
||||
|
||||
foreach($semester as $sem=>$semester_date_range)
|
||||
{
|
||||
@@ -253,20 +259,24 @@ class Stundenplan_model extends DB_Model
|
||||
}
|
||||
foreach($studentlehrverbaende[$sem_date] as $key=>$lehrverband)
|
||||
{
|
||||
// adds the OR sql chain only if its not the first element in the first semester of the $studentlehrverbaende array
|
||||
if($sem != array_keys($semester)[0] || $key != array_keys($semester)[0])
|
||||
{
|
||||
$query .="OR";
|
||||
}
|
||||
$query .= "((sp.studiengang_kz = ".$this->escape($lehrverband->studiengang_kz)." AND sp.semester = ".$this->escape($lehrverband->semester)." AND sp.verband = ".$this->escape($lehrverband->verband)." AND sp.gruppe = ".$this->escape($lehrverband->gruppe)." AND sp.datum BETWEEN ".$this->escape($sem_date_range->start)." AND ".$this->escape($sem_date_range->ende).")";
|
||||
// Eintraege fuer den ganzen Verband
|
||||
$query .= "OR (sp.studiengang_kz = ".$this->escape($lehrverband->studiengang_kz)." AND sp.semester = ".$this->escape($lehrverband->semester)." AND sp.verband = ".$this->escape($lehrverband->verband)." AND (sp.gruppe is null OR sp.gruppe='') AND sp.datum BETWEEN ".$this->escape($sem_date_range->start)." AND ".$this->escape($sem_date_range->ende).")";
|
||||
// Eintraege fuer das ganze Semester
|
||||
$query .= "OR (sp.studiengang_kz = ".$this->escape($lehrverband->studiengang_kz)." AND sp.semester = ".$this->escape($lehrverband->semester)." AND (sp.verband is null OR sp.verband='') AND sp.datum BETWEEN ".$this->escape($sem_date_range->start)." AND ".$this->escape($sem_date_range->ende).") AND gruppe_kurzbz is null)";
|
||||
|
||||
$query .="OR";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if the studentlehrverbaende is not empty we can remove the last OR that was added to the query
|
||||
if(!$emptyCheck($studentlehrverbaende))
|
||||
{
|
||||
$query = substr($query, 0, -2);
|
||||
}
|
||||
|
||||
// closes the AND sql chain only if it was opened previously
|
||||
if(!$emptyCheck($gruppen) || !$emptyCheck($studentlehrverbaende))
|
||||
{
|
||||
|
||||
@@ -13,5 +13,33 @@ class Stundensatz_model extends DB_Model
|
||||
$this->pk = 'stundensatz_id';
|
||||
$this->hasSequence = true;
|
||||
}
|
||||
|
||||
|
||||
public function getStundensatzByDatum($uid, $beginn, $ende = null, $typ = null)
|
||||
{
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
hr.tbl_stundensatz
|
||||
WHERE
|
||||
uid = ?
|
||||
AND (gueltig_bis >= ? OR gueltig_bis is null)";
|
||||
|
||||
$params = array($uid, $beginn);
|
||||
|
||||
if (!is_null($ende))
|
||||
{
|
||||
$qry .= " AND (gueltig_von <= ?)";
|
||||
$params[] = $ende;
|
||||
}
|
||||
|
||||
if (!is_null($typ))
|
||||
{
|
||||
$qry .= " AND stundensatztyp = ?";
|
||||
$params[] = $typ;
|
||||
}
|
||||
|
||||
$qry .= " ORDER BY gueltig_bis DESC NULLS FIRST, gueltig_von DESC NULLS LAST LIMIT 1;";
|
||||
|
||||
return $this->execQuery($qry, $params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
class Notiztyp_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'public.tbl_notiz_typ';
|
||||
$this->pk = 'typ_kurzbz';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user