Neues Attribut Lehre bei Organisationseinheit hinzugefügt; Filter in Studienordnung zeigt nur noch Organisationseinheiten die das Lehre Attribut gesetzt haben an

This commit is contained in:
Andreas Österreicher
2013-11-29 13:11:25 +00:00
parent bbb6c4b87e
commit 16d1209760
4 changed files with 90 additions and 43 deletions
+61 -39
View File
@@ -39,8 +39,9 @@ class organisationseinheit extends basis_db
public $oe_parent_kurzbz;
public $bezeichnung;
public $organisationseinheittyp_kurzbz;
public $aktiv;
public $mailverteiler;
public $aktiv=true;
public $lehre=true;
public $mailverteiler=false;
public $oe_kurzbz_orig;
public $beschreibung;
@@ -62,9 +63,17 @@ class organisationseinheit extends basis_db
* Liefert alle Organisationseinheiten
* @return true wenn ok, false im Fehlerfall
*/
public function getAll()
public function getAll($aktiv=null, $lehre=null)
{
$qry = "SELECT * FROM public.tbl_organisationseinheit ORDER BY organisationseinheittyp_kurzbz, oe_kurzbz";
$qry = "SELECT * FROM public.tbl_organisationseinheit WHERE 1=1";
if(!is_null($aktiv))
$qry.=" AND aktiv=".$this->db_add_param($aktiv, FHC_BOOLEAN);
if(!is_null($lehre))
$qry.=" AND lehre=".$this->db_add_param($lehre, FHC_BOOLEAN);
$qry .=" ORDER BY organisationseinheittyp_kurzbz, oe_kurzbz";
if($this->db_query($qry))
{
@@ -76,8 +85,9 @@ class organisationseinheit extends basis_db
$obj->oe_parent_kurzbz = $row->oe_parent_kurzbz;
$obj->bezeichnung = $row->bezeichnung;
$obj->organisationseinheittyp_kurzbz = $row->organisationseinheittyp_kurzbz;
$obj->aktiv = ($row->aktiv=='t'?true:false);
$obj->mailverteiler = ($row->mailverteiler=='t'?true:false);
$obj->aktiv = $this->db_parse_bool($row->aktiv);
$obj->mailverteiler = $this->db_parse_bool($row->mailverteiler);
$obj->lehre = $this->db_parse_bool($row->lehre);
$this->result[] = $obj;
}
@@ -103,7 +113,7 @@ class organisationseinheit extends basis_db
return false;
}
$qry = "SELECT * FROM public.tbl_organisationseinheit WHERE oe_kurzbz = '$oe_kurzbz';";
$qry = "SELECT * FROM public.tbl_organisationseinheit WHERE oe_kurzbz=".$this->db_add_param($oe_kurzbz).";";
if(!$this->db_query($qry))
{
@@ -117,8 +127,9 @@ class organisationseinheit extends basis_db
$this->bezeichnung = $row->bezeichnung;
$this->oe_parent_kurzbz = $row->oe_parent_kurzbz;
$this->organisationseinheittyp_kurzbz = $row->organisationseinheittyp_kurzbz;
$this->aktiv = ($row->aktiv=='t'?true:false);
$this->mailverteiler = ($row->mailverteiler=='t'?true:false);
$this->aktiv = $this->db_parse_bool($row->aktiv);
$this->mailverteiler = $this->db_parse_bool($row->mailverteiler);
$this->lehre = $this->db_parse_bool($row->lehre);
}
else
{
@@ -148,8 +159,9 @@ class organisationseinheit extends basis_db
$obj->oe_parent_kurzbz = $row->oe_parent_kurzbz;
$obj->bezeichnung = $row->bezeichnung;
$obj->organisationseinheittyp_kurzbz = $row->organisationseinheittyp_kurzbz;
$obj->aktiv = ($row->aktiv=='t'?true:false);
$obj->mailverteiler = ($row->mailverteiler=='t'?true:false);
$obj->aktiv = $this->db_parse_bool($row->aktiv);
$obj->mailverteiler = $this->db_parse_bool($row->mailverteiler);
$obj->lehre = $this->db_parse_bool($row->lehre);
$this->result[] = $obj;
}
@@ -261,13 +273,14 @@ class organisationseinheit extends basis_db
{
//Neu anlegen
$qry = 'INSERT INTO public.tbl_organisationseinheit(oe_kurzbz, oe_parent_kurzbz, bezeichnung,
organisationseinheittyp_kurzbz, aktiv, mailverteiler) VALUES('.
$this->addslashes($this->oe_kurzbz).','.
$this->addslashes($this->oe_parent_kurzbz).','.
$this->addslashes($this->bezeichnung).','.
$this->addslasheS($this->organisationseinheittyp_kurzbz).','.
($this->aktiv?'true':'false').','.
($this->mailverteiler?'true':'false').');';
organisationseinheittyp_kurzbz, aktiv, mailverteiler, lehre) VALUES('.
$this->db_add_param($this->oe_kurzbz).','.
$this->db_add_param($this->oe_parent_kurzbz).','.
$this->db_add_param($this->bezeichnung).','.
$this->db_add_param($this->organisationseinheittyp_kurzbz).','.
$this->db_add_param($this->aktiv, FHC_BOOLEAN).','.
$this->db_add_param($this->mailverteiler, FHC_BOOLEAN).','.
$this->db_add_param($this->lehre, FHC_BOOLEAN).');';
}
else
{
@@ -283,13 +296,14 @@ class organisationseinheit extends basis_db
}
$qry = 'UPDATE public.tbl_organisationseinheit SET '.
' oe_kurzbz='.$this->addslashes($this->oe_kurzbz).','.
' oe_parent_kurzbz='.$this->addslashes($this->oe_parent_kurzbz).','.
' bezeichnung='.$this->addslashes($this->bezeichnung).','.
' organisationseinheittyp_kurzbz='.$this->addslashes($this->organisationseinheittyp_kurzbz).','.
' aktiv='.($this->aktiv?'true':'false').','.
' mailverteiler='.($this->mailverteiler?'true':'false').
" WHERE oe_kurzbz='".addslashes($this->oe_kurzbz_orig)."';";
' oe_kurzbz='.$this->db_add_param($this->oe_kurzbz).','.
' oe_parent_kurzbz='.$this->db_add_param($this->oe_parent_kurzbz).','.
' bezeichnung='.$this->db_add_param($this->bezeichnung).','.
' organisationseinheittyp_kurzbz='.$this->db_add_param($this->organisationseinheittyp_kurzbz).','.
' aktiv='.$this->db_add_param($this->aktiv, FHC_BOOLEAN).','.
' mailverteiler='.$this->db_add_param($this->mailverteiler, FHC_BOOLEAN).','.
' lehre='.$this->db_add_param($this->lehre, FHC_BOOLEAN).
" WHERE oe_kurzbz=".$this->db_add_param($this->oe_kurzbz_orig, FHC_STRING, false).";";
}
if($this->db_query($qry))
@@ -345,7 +359,7 @@ class organisationseinheit extends basis_db
if(count($kurzbzs)==0)
return true;
$kurzbzs = "'".implode("','",$kurzbzs)."'";
$kurzbzs = $this->db_implode4SQL($kurzbzs);
$qry = 'SELECT * FROM public.tbl_organisationseinheit WHERE oe_kurzbz in('.$kurzbzs.')';
if ($aktiv)
@@ -368,8 +382,9 @@ class organisationseinheit extends basis_db
$obj->oe_parent_kurzbz = $row->oe_parent_kurzbz;
$obj->bezeichnung = $row->bezeichnung;
$obj->organisationseinheittyp_kurzbz = $row->organisationseinheittyp_kurzbz;
$obj->aktiv = ($row->aktiv=='t'?true:false);
$obj->mailverteiler = ($row->mailverteiler=='t'?true:false);
$obj->aktiv = $this->db_parse_bool($row->aktiv);
$obj->mailverteiler = $this->db_parse_bool($row->mailverteiler);
$obj->lehre = $this->db_parse_bool($row->lehre);
$this->result[] = $obj;
}
@@ -406,7 +421,7 @@ class organisationseinheit extends basis_db
$qry="WITH RECURSIVE oes(oe_kurzbz, oe_parent_kurzbz) as
(
SELECT oe_kurzbz, oe_parent_kurzbz FROM public.tbl_organisationseinheit
WHERE oe_kurzbz='".addslashes($oe_kurzbz)."' and aktiv = true
WHERE oe_kurzbz=".$this->db_add_param($oe_kurzbz)." and aktiv = true
UNION ALL
SELECT o.oe_kurzbz, o.oe_parent_kurzbz FROM public.tbl_organisationseinheit o, oes
WHERE o.oe_kurzbz=oes.oe_parent_kurzbz and aktiv = true
@@ -469,10 +484,13 @@ class organisationseinheit extends basis_db
/**
* Baut die Datenstruktur für senden als JSON Objekt auf
*/
public function cleanResult(){
public function cleanResult()
{
$data = array();
if(count($this->result)>0){
foreach($this->result as $oeEinheit){
if(count($this->result)>0)
{
foreach($this->result as $oeEinheit)
{
$obj = new stdClass();
$obj->oe_kurzbz = $oeEinheit->oe_kurzbz;
$obj->oe_parent_kurzbz = $oeEinheit->oe_parent_kurzbz;
@@ -480,19 +498,23 @@ class organisationseinheit extends basis_db
$obj->organisationseinheittyp_kurzbz = $oeEinheit->organisationseinheittyp_kurzbz;
$obj->aktiv = $oeEinheit->aktiv;
$obj->mailverteiler = $oeEinheit->mailverteiler;
$obj->lehre = $oeEinheit->lehre;
$data[]=$obj;
}
} else {
}
else
{
$obj = new stdClass();
$obj->oe_kurzbz = $this->oe_kurzbz;
$obj->oe_parent_kurzbz = $this->oe_parent_kurzbz;
$obj->bezeichnung = $this->bezeichnung;
$obj->organisationseinheittyp_kurzbz = $this->organisationseinheittyp_kurzbz;
$obj->aktiv = $this->aktiv;
$obj->mailverteiler = $this->mailverteiler;
$obj->oe_parent_kurzbz = $this->oe_parent_kurzbz;
$obj->bezeichnung = $this->bezeichnung;
$obj->organisationseinheittyp_kurzbz = $this->organisationseinheittyp_kurzbz;
$obj->aktiv = $this->aktiv;
$obj->mailverteiler = $this->mailverteiler;
$obj->lehre = $this->lehre;
$data[]=$obj;
}
return $data;
}
}
?>
?>
+20 -1
View File
@@ -355,6 +355,10 @@ if(!$result = @$db->db_query("SELECT 1 FROM lehre.tbl_lehrtyp LIMIT 1;"))
ALTER TABLE lehre.tbl_lehrtyp ADD CONSTRAINT pk_lehrtyp PRIMARY KEY (lehrtyp_kurzbz);
INSERT INTO lehre.tbl_lehrtyp(lehrtyp_kurzbz, bezeichnung) VALUES('lv','Lehrveranstaltung');
INSERT INTO lehre.tbl_lehrtyp(lehrtyp_kurzbz, bezeichnung) VALUES('modul','Modul');
INSERT INTO lehre.tbl_lehrtyp(lehrtyp_kurzbz, bezeichnung) VALUES('lf','Lehrfach');
GRANT SELECT ON lehre.tbl_lehrtyp TO web;
GRANT SELECT, UPDATE, INSERT, DELETE ON lehre.tbl_lehrtyp TO vilesci;
";
@@ -598,6 +602,21 @@ if(!$result = @$db->db_query("SELECT positiv from lehre.tbl_note LIMIT 1;"))
echo 'lehre.tbl_note: Spalte positiv hinzugefügt';
}
// tbl_organisationseinheit neue Spalte lehre
if(!$result = @$db->db_query("SELECT lehre FROM public.tbl_organisationseinheit LIMIT 1;"))
{
$qry = "ALTER TABLE public.tbl_organisationseinheit ADD COLUMN lehre boolean NOT NULL DEFAULT true;
UPDATE public.tbl_organisationseinheit SET lehre=false WHERE
NOT EXISTS(SELECT 1 FROM public.tbl_studiengang WHERE oe_kurzbz=tbl_organisationseinheit.oe_kurzbz)
AND
NOT EXISTS(SELECT 1 FROM public.tbl_fachbereich WHERE oe_kurzbz=tbl_organisationseinheit.oe_kurzbz)";
if(!$db->db_query($qry))
echo '<strong>public.tbl_organisationseinheit: '.$db->db_last_error().'</strong><br>';
else
echo 'public.tbl_organisationseinheit: Spalte lehre hinzugefügt';
}
echo '<br>';
$tabellen=array(
@@ -756,7 +775,7 @@ $tabellen=array(
"public.tbl_notizzuordnung" => array("notizzuordnung_id","notiz_id","projekt_kurzbz","projektphase_id","projekttask_id","uid","person_id","prestudent_id","bestellung_id"),
"public.tbl_ort" => array("ort_kurzbz","bezeichnung","planbezeichnung","max_person","lehre","reservieren","aktiv","lageplan","dislozierung","kosten","ausstattung","updateamum","updatevon","insertamum","insertvon","ext_id","stockwerk","standort_id","telefonklappe","content_id"),
"public.tbl_ortraumtyp" => array("ort_kurzbz","hierarchie","raumtyp_kurzbz"),
"public.tbl_organisationseinheit" => array("oe_kurzbz", "oe_parent_kurzbz", "bezeichnung","organisationseinheittyp_kurzbz", "aktiv","mailverteiler","freigabegrenze","kurzzeichen"),
"public.tbl_organisationseinheit" => array("oe_kurzbz", "oe_parent_kurzbz", "bezeichnung","organisationseinheittyp_kurzbz", "aktiv","mailverteiler","freigabegrenze","kurzzeichen","lehre"),
"public.tbl_organisationseinheittyp" => array("organisationseinheittyp_kurzbz", "bezeichnung", "beschreibung"),
"public.tbl_person" => array("person_id","staatsbuergerschaft","geburtsnation","sprache","anrede","titelpost","titelpre","nachname","vorname","vornamen","gebdatum","gebort","gebzeit","foto","anmerkung","homepage","svnr","ersatzkennzeichen","familienstand","geschlecht","anzahlkinder","aktiv","insertamum","insertvon","updateamum","updatevon","ext_id","bundesland_code","kompetenzen","kurzbeschreibung","zugangscode", "foto_sperre"),
"public.tbl_person_fotostatus" => array("person_fotostatus_id","person_id","fotostatus_kurzbz","datum","insertamum","insertvon","updateamum","updatevon"),
+3 -1
View File
@@ -432,6 +432,8 @@ function loadLehrveranstaltungSTPL(studienplan_id, bezeichnung)
"typ": "json",
"class": "organisationseinheit",
"method": "getAll",
"parameter_0":true,
"parameter_1":true
},
error: loadError
}).success(function(data)
@@ -441,7 +443,7 @@ function loadLehrveranstaltungSTPL(studienplan_id, bezeichnung)
{
if(data.result[i].aktiv===true)
{
html+='<option value="'+data.result[i].oe_kurzbz+'">'+data.result[i].bezeichnung+'</option>';
html+='<option value="'+data.result[i].oe_kurzbz+'">'+data.result[i].organisationseinheittyp_kurzbz+' '+data.result[i].bezeichnung+'</option>';
}
}
html+="</select></div>";
@@ -138,7 +138,8 @@ if(isset($_POST['save']))
$oe->organisationseinheittyp_kurzbz = $_POST['organisationseinheittyp_kurzbz'];
$oe->aktiv = isset($_POST['aktiv']);
$oe->mailverteiler = isset($_POST['mailverteiler']);
$oe->lehre = isset($_POST['lehre']);
if($oe->save($new))
{
echo '<br><b>Daten erfolgreich gespeichert</b>';
@@ -222,6 +223,9 @@ if(isset($_GET['action']) && ($_GET['action']=='edit' || $_GET['action']=='neu')
<tr>
<td>Mailverteiler</td><td><input type="checkbox" name="mailverteiler" '.($oe->mailverteiler?'checked':'').'></td>
</tr>
<tr>
<td>Lehre</td><td><input type="checkbox" name="lehre" '.($oe->lehre?'checked':'').'></td>
</tr>
<tr>
<td>&nbsp;</td><td><input type="submit" name="save" value="Speichern" /></td>
</tr>
@@ -376,4 +380,4 @@ function display($arr)
echo '
</body>
</html>';
?>
?>