From d1486fe683ec0fe725245a54e73411b3aee30864 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Mon, 11 Jan 2010 09:49:33 +0000 Subject: [PATCH] =?UTF-8?q?-=20In=20Emails=20muss=20ein=20@=20enthalten=20?= =?UTF-8?q?sein=20-=20loadArray=20f=C3=BCr=20Organisationseinheiten?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/benutzerberechtigung.class.php | 39 +++++++++++++++++++++++ include/kontakt.class.php | 5 +++ include/organisationseinheit.class.php | 43 ++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) diff --git a/include/benutzerberechtigung.class.php b/include/benutzerberechtigung.class.php index 2bb19040a..93fce3d2f 100644 --- a/include/benutzerberechtigung.class.php +++ b/include/benutzerberechtigung.class.php @@ -639,5 +639,44 @@ class benutzerberechtigung extends basis_db sort($fachbereich_kurzbz); return $fachbereich_kurzbz; } + + /** + * Gibt Array mit den Organisationseinheiten zurueck fuer welche die + * Person eine Berechtigung besitzt. + * Optional wird auf Berechtigung eingeschraenkt. + */ + public function getOEkurzbz($berechtigung_kurzbz=null) + { + $oe_kurzbz=array(); + $timestamp=time(); + $in=''; + $not=''; + $all=false; + + foreach ($this->berechtigungen as $b) + { + if (($berechtigung_kurzbz==$b->berechtigung_kurzbz || $berechtigung_kurzbz==null) + && (($timestamp>$b->starttimestamp || $b->starttimestamp==null) && ($timestamp<$b->endetimestamp || $b->endetimestamp==null))) + { + if($b->negativ) + { + //Negativ-Recht + if(!is_null($b->oe_kurzbz)) + $not .="'".addslashes($b->oe_kurzbz)."',"; + else + return array(); + } + else + { + $oe_kurzbz[] = $b->oe_kurzbz; + } + } + } + + $studiengang_kz=array_unique($oe_kurzbz); + sort($oe_kurzbz); + return $oe_kurzbz; + } + } ?> \ No newline at end of file diff --git a/include/kontakt.class.php b/include/kontakt.class.php index fcae2b9ec..3adf0b72e 100644 --- a/include/kontakt.class.php +++ b/include/kontakt.class.php @@ -131,6 +131,11 @@ class kontakt extends basis_db $this->errormsg = 'kontakt darf nicht länger als 128 Zeichen sein'; return false; } + if($this->kontakttyp=='email' && !strstr($this->kontakt, '@')) + { + $this->errormsg = 'Wenn der Typ E-Mail ausgewählt wurde, muss der Kontakt ein @ enthalten!'; + return false; + } $this->errormsg = ''; return true; } diff --git a/include/organisationseinheit.class.php b/include/organisationseinheit.class.php index f119a8516..bd9ff3fd6 100644 --- a/include/organisationseinheit.class.php +++ b/include/organisationseinheit.class.php @@ -319,5 +319,48 @@ class organisationseinheit extends basis_db return false; } } + + /** + * Laedt die Organisationseinheiten die als Array uebergeben werden + * @param $kurzbzs Array mit den kurzbezeichnungen + * @param $order Sortierreihenfolge + * @param $aktiv wenn true dann nur aktive sonst alle + * @return true wenn ok, false im Fehlerfall + */ + public function loadArray($kurzbzs, $order=null, $aktiv=true) + { + if(count($kurzbzs)==0) + return true; + + $kurzbzs = "'".implode("','",$kurzbzs)."'"; + + $qry = 'SELECT * FROM public.tbl_organisationseinheit WHERE oe_kurzbz in('.$kurzbzs.')'; + if ($aktiv) + $qry.=' AND aktiv=true'; + + if($order!=null) + $qry .=" ORDER BY $order"; + + if(!$result = $this->db_query($qry)) + { + $this->errormsg = 'Datensatz konnte nicht geladen werden'; + return false; + } + + while($row = $this->db_fetch_object($result)) + { + $obj = new organisationseinheit(); + + $obj->oe_kurzbz = $row->oe_kurzbz; + $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); + + $this->result[] = $obj; + } + + return true; + } } ?> \ No newline at end of file