mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
added filter to list of studienverpflichtungen
This commit is contained in:
@@ -41,7 +41,6 @@ $lang->load($sprache);
|
||||
$p = new phrasen($sprache);
|
||||
|
||||
$uid = get_uid();
|
||||
$uid = "p20110133";
|
||||
|
||||
$rechte = new benutzerberechtigung();
|
||||
$rechte->getBerechtigungen($uid);
|
||||
@@ -119,7 +118,7 @@ switch($method)
|
||||
break;
|
||||
case 'getLvKompatibel':
|
||||
$lvid = filter_input(INPUT_POST, "lehrveranstaltung_id");
|
||||
$data = getLvKompatibel($lvid);
|
||||
$data = getLvKompatibel($lvid, $uid);
|
||||
break;
|
||||
case 'getPrestudenten':
|
||||
$data = getPrestudenten($uid, $aktStudiensemester);
|
||||
@@ -1221,10 +1220,28 @@ function saveRaum($terminId, $ort_kurzbz, $uid)
|
||||
return $data;
|
||||
}
|
||||
|
||||
function getLvKompatibel($lvid)
|
||||
function getLvKompatibel($lvid, $uid)
|
||||
{
|
||||
$person = new person();
|
||||
$person->getPersonFromBenutzer($uid);
|
||||
$prestudent = new prestudent();
|
||||
$prestudent->getPrestudenten($person->person_id);
|
||||
|
||||
$stplIds = array();
|
||||
|
||||
foreach ($prestudent->result as $ps)
|
||||
{
|
||||
if ($ps->getLaststatus($ps->prestudent_id))
|
||||
{
|
||||
if (($ps->status_kurzbz == "Student") || ($ps->status_kurzbz == "Unterbrecher"))
|
||||
{
|
||||
array_push($stplIds, $ps->studienplan_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$lv = new lehrveranstaltung();
|
||||
if($lv->getLVkompatibelTo($lvid))
|
||||
if($lv->getLVkompatibelTo($lvid, $stplIds))
|
||||
{
|
||||
$data['result']=$lv->lehrveranstaltungen;
|
||||
$data['error']='false';
|
||||
|
||||
@@ -1596,7 +1596,7 @@ class lehrveranstaltung extends basis_db
|
||||
* Lädt alle Lehrveranstaltungen zu denen die übergebene LV ID kompatibel ist
|
||||
* @param $lehrveranstaltung_id ID der Lehrveranstaltung
|
||||
*/
|
||||
public function getLVkompatibelTo($lehrveranstaltung_id)
|
||||
public function getLVkompatibelTo($lehrveranstaltung_id, $studienplan_ids=array())
|
||||
{
|
||||
if (!is_numeric($lehrveranstaltung_id))
|
||||
{
|
||||
@@ -1604,10 +1604,26 @@ class lehrveranstaltung extends basis_db
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "SELECT * FROM lehre.tbl_lehrveranstaltung WHERE lehrveranstaltung_id IN (
|
||||
SELECT lehrveranstaltung_id
|
||||
FROM lehre.tbl_lehrveranstaltung_kompatibel
|
||||
WHERE lehrveranstaltung_id_kompatibel=".$this->db_add_param($lehrveranstaltung_id, FHC_INTEGER).");";
|
||||
if((!is_array($studienplan_ids)) && (count($studienplan_ids) < 1))
|
||||
{
|
||||
$this->errormsg = 'Es muss ein Array von Studienplan_IDs mit mindestens einem Element übergeben werden.';
|
||||
return false;
|
||||
}
|
||||
|
||||
$studienplaene = "";
|
||||
foreach($studienplan_ids as $stplId)
|
||||
{
|
||||
$studienplaene .= $stplId.",";
|
||||
}
|
||||
$studienplaene = rtrim($studienplaene, ",");
|
||||
|
||||
$qry = "SELECT * FROM lehre.tbl_lehrveranstaltung
|
||||
JOIN lehre.tbl_studienplan_lehrveranstaltung USING (lehrveranstaltung_id)
|
||||
WHERE lehrveranstaltung_id IN (
|
||||
SELECT lehrveranstaltung_id
|
||||
FROM lehre.tbl_lehrveranstaltung_kompatibel
|
||||
WHERE lehrveranstaltung_id_kompatibel=".$this->db_add_param($lehrveranstaltung_id, FHC_INTEGER).")
|
||||
AND studienplan_id IN(".$studienplaene.");";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user