From f373ec7a67c0fbfa0eda3e7afbebc3c4a8ac84ca Mon Sep 17 00:00:00 2001 From: kindlm Date: Mon, 27 Apr 2015 18:55:52 +0200 Subject: [PATCH] CIS-Suche nach Organisationseinheiten --- cis/index.php | 2 +- cis/private/tools/suche.php | 122 ++++++++++++++++++++++++- include/benutzer.class.php | 41 +++++---- include/benutzerfunktion.class.php | 63 +++++++++++++ include/bisverwendung.class.php | 8 +- include/organisationseinheit.class.php | 16 +++- include/person.class.php | 66 ++++++++++++- include/studiengang.class.php | 63 +++++++++++++ locale/de-AT/global.php | 1 + locale/de-AT/menu.php | 3 +- locale/en-US/global.php | 1 + locale/en-US/menu.php | 3 +- 12 files changed, 360 insertions(+), 29 deletions(-) diff --git a/cis/index.php b/cis/index.php index e3881d8d2..2346460e5 100644 --- a/cis/index.php +++ b/cis/index.php @@ -171,7 +171,7 @@ function loadampel()
- +
diff --git a/cis/private/tools/suche.php b/cis/private/tools/suche.php index 725ad7464..7f914cf6a 100755 --- a/cis/private/tools/suche.php +++ b/cis/private/tools/suche.php @@ -32,6 +32,13 @@ require_once('../../../include/dms.class.php'); require_once('../../../include/service.class.php'); require_once('../../../include/ort.class.php'); require_once('../../../include/benutzerberechtigung.class.php'); +require_once('../../../include/organisationseinheit.class.php'); +require_once('../../../include/studiengang.class.php'); +require_once('../../../include/benutzerfunktion.class.php'); +require_once('../../../include/person.class.php'); +require_once('../../../include/mitarbeiter.class.php'); +require_once('../../../include/kontakt.class.php'); +require_once('../../../include/bisverwendung.class.php'); $uid = get_uid(); $db = new basis_db(); @@ -79,11 +86,12 @@ if (count($easteregg_intersect)==4) } $searchPerson = searchPerson($searchItems); +$searchOE = searchOE($searchItems); $searchOrt = searchOrt($search); $searchDms = searchDms($searchItems); $searchContent = searchContent($searchItems); -if (!$searchPerson && !$searchOrt && !$searchDms && !$searchContent) +if (!$searchPerson && !$searchOrt && !$searchDms && !$searchContent && !$searchOE) echo $p->t('tools/esWurdenKeineErgebnisseGefunden'); @@ -133,10 +141,18 @@ function searchPerson($searchItems) '; foreach($bn->result as $row) { + $bisverwendung = new bisverwendung(); + $bisverwendung->getLastVerwendung($row->uid); + echo ''; //echo '',$row->titelpre,''; echo '',$row->vorname,''; - echo '',$row->nachname,''; + echo '',$row->nachname,''; + if($row->aktiv==false) + echo ' (ausgeschieden)'; + elseif($bisverwendung->beschausmasscode==5) + echo ' (karenziert)'; + echo ''; //echo '',$row->titelpost,''; echo '',($row->studiengang!=''?$row->studiengang:'-'),''; echo '',($row->mitarbeiter_uid==NULL?'StudentIn':'MitarbeiterIn'),''; @@ -158,6 +174,108 @@ function searchPerson($searchItems) else return false; } +function searchOE($searchItems) +{ + global $db, $p, $noalias; + + //Suche nach Studiengaengen mit dem Suchbegriff und merge mit $searchItems + $stg_oe_array = array(); + $stg = new studiengang(); + $stg->search($searchItems); + foreach($stg->result as $row) + { + if($row->aktiv===true) + $stg_oe_array[].= $row->oe_kurzbz; + } + $searchItems = array_merge_recursive($stg_oe_array,$searchItems); + + $oe = new organisationseinheit(); + $oe->search($searchItems); + + if(count($oe->result)>0) + { + echo '

',$p->t('global/organisationseinheiten'),'

'; + echo ' + '; + + foreach($oe->result as $row) + { + if($row->aktiv==true) + { + $benutzerfunktion = new benutzerfunktion(); + $benutzerfunktion->getOeFunktionen($row->oe_kurzbz,'ass,Leitung,stvLtg,oezuordnung','now()','now()'); + $oebezeichnung = new organisationseinheit(); + $oebezeichnung->load($row->oe_kurzbz); + echo '

',$row->organisationseinheittyp_kurzbz,' ',$oebezeichnung->bezeichnung,'

'; + echo ' + + + + + + + + + + + + '; + foreach($benutzerfunktion->result as $bf) + { + $person = new person(); + $person->getPersonFromBenutzer($bf->uid); + $mitarbeiter = new mitarbeiter(); + $mitarbeiter->load($bf->uid); + $kontakt = new kontakt(); + $kontakt->loadFirmaKontakttyp($mitarbeiter->standort_id,'telefon'); + $bisverwendung = new bisverwendung(); + $bisverwendung->getLastVerwendung($bf->uid); + echo ''; + echo ''; + echo ''; + echo ''; + + echo ''; + echo ''; + //if($row->alias!='' && !in_array($row->studiengang_kz, $noalias)) ??? Was macht $noalias? + if($person->alias!='') + $mail = $person->alias.'@'.DOMAIN; + else + $mail = $person->uid.'@'.DOMAIN; + echo ''; + //if(!defined('CIS_SUCHE_LVPLAN_ANZEIGEN') || CIS_SUCHE_LVPLAN_ANZEIGEN) + //echo ''; + echo ''; + echo "\n"; + } + echo "\n"; + echo '
',$p->t('global/vorname'),'',$p->t('global/nachname'),'',$p->t('global/funktion'),'',$p->t('global/telefonnummer'),'',$p->t('lvplan/raum'),'',$p->t('global/mail'),'
'.$person->vorname.'',$person->nachname,''.$bf->bezeichnung; + if($person->aktiv==false) + echo ' (ausgeschieden)'; + elseif($bisverwendung->beschausmasscode==5) + echo ' (karenziert)'; + echo '',($mitarbeiter->telefonklappe!=''?$kontakt->kontakt.'-'.$mitarbeiter->telefonklappe:'-'),'',($mitarbeiter->ort_kurzbz!=''?$mitarbeiter->ort_kurzbz:'-'),'',$mail,''.$p->t('lvplan/lvPlan').'

'; + } + } + return true; + } + else + return false; +} function searchOrt($search) { global $db, $p, $noalias; diff --git a/include/benutzer.class.php b/include/benutzer.class.php index 61888e060..c314a42b6 100644 --- a/include/benutzer.class.php +++ b/include/benutzer.class.php @@ -297,23 +297,29 @@ class benutzer extends person */ public function search($searchItems, $limit=null, $aktiv=true) { - $qry = "SELECT * FROM (SELECT - distinct on (uid) vorname, nachname, uid, mitarbeiter_uid, titelpre, titelpost, lektor, fixangestellt, alias, - (SELECT UPPER(tbl_studiengang.typ || tbl_studiengang.kurzbz) - FROM public.tbl_student JOIN public.tbl_studiengang USING(studiengang_kz) - WHERE student_uid=tbl_benutzer.uid) as studiengang, - (SELECT studiengang_kz FROM public.tbl_student - WHERE student_uid=tbl_benutzer.uid) as studiengang_kz, - (SELECT tbl_kontakt.kontakt || ' - ' ||telefonklappe - FROM public.tbl_mitarbeiter - LEFT JOIN public.tbl_kontakt USING(standort_id) - WHERE - mitarbeiter_uid=tbl_benutzer.uid - AND (tbl_kontakt.kontakttyp='telefon' OR tbl_kontakt.kontakttyp is null) - limit 1) as klappe, - (SELECT planbezeichnung FROM public.tbl_mitarbeiter - LEFT JOIN public.tbl_ort USING (ort_kurzbz) - WHERE mitarbeiter_uid=tbl_benutzer.uid) as raum + $qry = "SELECT * FROM ( + SELECT + distinct on (uid) vorname, nachname, uid, mitarbeiter_uid, titelpre, titelpost, lektor, fixangestellt, alias, tbl_benutzer.aktiv, + (SELECT UPPER + (tbl_studiengang.typ || tbl_studiengang.kurzbz) + FROM public.tbl_student + JOIN public.tbl_studiengang USING(studiengang_kz) + WHERE student_uid=tbl_benutzer.uid) as studiengang, + + (SELECT studiengang_kz FROM public.tbl_student + WHERE student_uid=tbl_benutzer.uid) as studiengang_kz, + + (SELECT tbl_kontakt.kontakt || ' - ' ||telefonklappe + FROM public.tbl_mitarbeiter + LEFT JOIN public.tbl_kontakt USING(standort_id) + WHERE + mitarbeiter_uid=tbl_benutzer.uid + AND (tbl_kontakt.kontakttyp='telefon' OR tbl_kontakt.kontakttyp is null) + limit 1) as klappe, + + (SELECT planbezeichnung FROM public.tbl_mitarbeiter + LEFT JOIN public.tbl_ort USING (ort_kurzbz) + WHERE mitarbeiter_uid=tbl_benutzer.uid) as raum FROM public.tbl_person JOIN public.tbl_benutzer USING(person_id) @@ -359,6 +365,7 @@ class benutzer extends person $obj->alias = $row->alias; $obj->lektor = $row->lektor; $obj->fixangestellt = $row->fixangestellt; + $obj->aktiv = $this->db_parse_bool($row->aktiv); $this->result[] = $obj; } diff --git a/include/benutzerfunktion.class.php b/include/benutzerfunktion.class.php index 71acc4e3e..06cc3af5d 100644 --- a/include/benutzerfunktion.class.php +++ b/include/benutzerfunktion.class.php @@ -458,5 +458,68 @@ class benutzerfunktion extends basis_db return false; } } + + /** + * Laedt alle Benutzerfunktionen in einer Organisationseinheit + * @param $oe_kurzbz + * @param $funktionen_kurzbz (optional) Funktionen in der OE, kommagetrennt + * @param type $startZeitraum OPTIONAL Start Zeitraum in dem die Funktion aktiv ist + * @param type $endeZeitraum OPTIONAL Ende Zeitraum in dem die Funktion aktiv ist + * @return false wenn nicht vorhanden oder fehler + * sonst true + */ + public function getOeFunktionen($oe_kurzbz, $funktionen_kurzbz=null, $startZeitraum=null, $endeZeitraum=null) + { + $qry = "SELECT * FROM public.tbl_benutzerfunktion + WHERE oe_kurzbz=".$this->db_add_param($oe_kurzbz); + + if(!is_null($funktionen_kurzbz)) + { + $funktionen_kurzbz = explode(',', $funktionen_kurzbz); + $qry .= ' AND funktion_kurzbz IN('.$this->implode4SQL($funktionen_kurzbz).')'; + } + if(!is_null($startZeitraum)) + { + $qry .=' AND (datum_bis IS NULL OR datum_bis >='.$this->db_add_param($startZeitraum).')'; + } + if(!is_null($endeZeitraum)) + { + $qry .=' AND (datum_von IS NULL OR datum_von <='.$this->db_add_param($endeZeitraum).')'; + } + + $qry.=" ORDER BY bezeichnung, uid"; + + if($result = $this->db_query($qry)) + { + while($row = $this->db_fetch_object($result)) + { + $obj = new benutzerfunktion(); + + $obj->benutzerfunktion_id = $row->benutzerfunktion_id; + $obj->fachbereich_kurzbz = $row->fachbereich_kurzbz; + $obj->uid = $row->uid; + $obj->oe_kurzbz = $row->oe_kurzbz; + $obj->funktion_kurzbz = $row->funktion_kurzbz; + $obj->insertamum = $row->insertamum; + $obj->insertvon = $row->insertvon; + $obj->updateamum = $row->updateamum; + $obj->updatevon = $row->updatevon; + $obj->semester = $row->semester; + $obj->datum_von = $row->datum_von; + $obj->datum_bis = $row->datum_bis; + $obj->bezeichnung = $row->bezeichnung; + $obj->wochenstunden = $row->wochenstunden; + + $this->result[] = $obj; + + } + return true; + } + else + { + $this->errormsg = 'Fehler beim Laden der OE-Funktionen'; + return false; + } + } } ?> diff --git a/include/bisverwendung.class.php b/include/bisverwendung.class.php index 19193161c..62b395a3d 100644 --- a/include/bisverwendung.class.php +++ b/include/bisverwendung.class.php @@ -408,7 +408,7 @@ class bisverwendung extends basis_db } /** - * Laedt alle Verwendungen eines Mitarbeiters + * Laedt die Letzte (aktuellste) Verwendungen eines Mitarbeiters * @param $uid UID des Mitarbeiters * @return true wenn ok, false wenn Fehler */ @@ -421,7 +421,11 @@ class bisverwendung extends basis_db bis.tbl_bisverwendung WHERE mitarbeiter_uid=".$this->db_add_param($uid)." - ORDER BY beginn DESC LIMIT 1;"; + AND + (beginn<=now() OR beginn IS NULL) + AND + (ende>=now() OR ende IS NULL) + ORDER BY ende DESC NULLS LAST,beginn DESC NULLS LAST LIMIT 1;"; if($this->db_query($qry)) { diff --git a/include/organisationseinheit.class.php b/include/organisationseinheit.class.php index e0122208c..2364c28bd 100644 --- a/include/organisationseinheit.class.php +++ b/include/organisationseinheit.class.php @@ -556,15 +556,23 @@ class organisationseinheit extends basis_db /** * Sucht nach einer Organisationseinheit - * @param type $oetyp_kurzbz + * @param type $searchItem * @return boolean true, wenn ok; false, im Fehlerfall */ public function search($searchItem) { $qry = 'SELECT * FROM public.tbl_organisationseinheit WHERE - (LOWER(bezeichnung) LIKE LOWER(\'%'.$this->db_escape((implode(' ',$searchItem))).'%\') OR - LOWER(organisationseinheittyp_kurzbz) LIKE LOWER(\'%'.$this->db_escape((implode(' ',$searchItem))).'%\')) - ORDER BY organisationseinheittyp_kurzbz, bezeichnung;'; + ( + LOWER(bezeichnung) LIKE LOWER(\'%'.$this->db_escape((implode(' ',$searchItem))).'%\') + OR + LOWER(organisationseinheittyp_kurzbz) LIKE LOWER(\'%'.$this->db_escape((implode(' ',$searchItem))).'%\') + )'; + foreach($searchItem as $value) + { + $qry.=' OR (oe_kurzbz='.$this->db_add_param($value).') + OR (bezeichnung='.$this->db_add_param($value).')'; + } + $qry.= 'ORDER BY organisationseinheittyp_kurzbz, bezeichnung;'; if($this->db_query($qry)) { diff --git a/include/person.class.php b/include/person.class.php index f18e258c1..89405fac3 100644 --- a/include/person.class.php +++ b/include/person.class.php @@ -867,5 +867,69 @@ class person extends basis_db return $fullname; } - } + /** + * Laedt Personendaten eines Benutzers + * @param $uid + */ + function getPersonFromBenutzer($uid) + { + $qry = "SELECT + * + FROM + public.tbl_person + JOIN public.tbl_benutzer USING(person_id) + WHERE + uid=".$this->db_add_param($uid, FHC_STRING); + + if($this->db_query($qry)) + { + if($row = $this->db_fetch_object()) + { + $this->person_id = $row->person_id; + $this->staatsbuergerschaft = $row->staatsbuergerschaft; + $this->geburtsnation = $row->geburtsnation; + $this->sprache = $row->sprache; + $this->anrede = $row->anrede; + $this->titelpost = $row->titelpost; + $this->titelpre = $row->titelpre; + $this->nachname = $row->nachname; + $this->vorname = $row->vorname; + $this->vornamen = $row->vornamen; + $this->gebdatum = $row->gebdatum; + $this->gebort = $row->gebort; + $this->gebzeit = $row->gebzeit; + $this->foto = $row->foto; + $this->anmerkungen = $row->anmerkung; + $this->homepage = $row->homepage; + $this->svnr = $row->svnr; + $this->ersatzkennzeichen = $row->ersatzkennzeichen; + $this->familienstand = $row->familienstand; + $this->geschlecht = $row->geschlecht; + $this->anzahlkinder = $row->anzahlkinder; + $this->aktiv = $this->db_parse_bool($row->aktiv); + $this->updateamum = $row->updateamum; + $this->updatevon = $row->updatevon; + $this->insertamum = $row->insertamum; + $this->insertvon = $row->insertvon; + $this->ext_id = $row->ext_id; + $this->kurzbeschreibung = $row->kurzbeschreibung; + $this->zugangscode = $row->zugangscode; + $this->foto_sperre = $this->db_parse_bool($row->foto_sperre); + $this->matr_nr = $row->matr_nr; + $this->uid = $row->uid; + $this->aktiv = $this->db_parse_bool($row->aktiv);; + $this->alias = $row->alias; + $this->updateaktivvon = $row->updateaktivvon; + $this->updateaktivam = $row->updateaktivam; + $this->aktivierungscode = $row->aktivierungscode; + } + else + { + $this->errormsg = 'Keine Personendaten zu dieser UID gefunden'; + return false; + } + } + } + +} ?> diff --git a/include/studiengang.class.php b/include/studiengang.class.php index 301904ae7..27e6992dd 100644 --- a/include/studiengang.class.php +++ b/include/studiengang.class.php @@ -710,4 +710,67 @@ class studiengang extends basis_db return false; } } + + /** + * Sucht nach einem Studiengang + * @param type $searchItem + * @return boolean true, wenn ok; false, im Fehlerfall + */ + public function search($searchItem) + { + $qry = 'SELECT * FROM public.tbl_studiengang WHERE + LOWER(bezeichnung) LIKE LOWER(\'%'.$this->db_escape((implode(' ',$searchItem))).'%\') OR + LOWER(english) LIKE LOWER(\'%'.$this->db_escape((implode(' ',$searchItem))).'%\') + ORDER BY typ,bezeichnung;'; + + if($this->db_query($qry)) + { + while($row = $this->db_fetch_object()) + { + $obj = new studiengang(); + + $obj->studiengang_kz = $row->studiengang_kz; + $obj->kurzbz = $row->kurzbz; + $obj->kurzbzlang = $row->kurzbzlang; + $obj->bezeichnung = $row->bezeichnung; + $obj->english = $row->english; + $obj->typ = $row->typ; + $obj->farbe = $row->farbe; + $obj->email = $row->email; + $obj->max_semester = $row->max_semester; + $obj->max_verband = $row->max_verband; + $obj->max_gruppe = $row->max_gruppe; + $obj->erhalter_kz = $row->erhalter_kz; + $obj->bescheid = $row->bescheid; + $obj->bescheidbgbl1 = $row->bescheidbgbl1; + $obj->bescheidbgbl2 = $row->bescheidbgbl2; + $obj->bescheidgz = $row->bescheidgz; + $obj->bescheidvom = $row->bescheidvom; + $obj->ext_id = $row->ext_id; + $obj->kuerzel = mb_strtoupper($row->typ . $row->kurzbz); + $obj->orgform_kurzbz = $row->orgform_kurzbz; + $obj->zusatzinfo_html = $row->zusatzinfo_html; + $obj->sprache = $row->sprache; + $obj->testtool_sprachwahl = $this->db_parse_bool($row->testtool_sprachwahl); + $obj->studienplaetze = $row->studienplaetze; + $obj->oe_kurzbz = $row->oe_kurzbz; + $obj->lgartcode = $row->lgartcode; + $obj->telefon = $row->telefon; + $obj->titelbescheidvom = $row->titelbescheidvom; + $obj->onlinebewerbung = $this->db_parse_bool($row->onlinebewerbung); + $obj->moodle = $this->db_parse_bool($row->moodle); + $obj->mischform = $this->db_parse_bool($row->mischform); + $obj->projektarbeit_note_anzeige = $this->db_parse_bool($row->projektarbeit_note_anzeige); + $obj->aktiv = $this->db_parse_bool($row->aktiv); + + $this->result[] = $obj; + } + return true; + } + else + { + $this->errormsg = 'Fehler beim Laden des Studiengangs'; + return false; + } + } } diff --git a/locale/de-AT/global.php b/locale/de-AT/global.php index a7299ef4c..b777d7513 100755 --- a/locale/de-AT/global.php +++ b/locale/de-AT/global.php @@ -9,6 +9,7 @@ $this->phrasen['global/studiengangsleitung']='Studiengangsleitung'; $this->phrasen['global/lehrveranstaltung']='Lehrveranstaltung'; $this->phrasen['global/lehreinheit']='Lehreinheit'; $this->phrasen['global/organisationseinheit']='Organisationseinheit'; +$this->phrasen['global/organisationseinheiten']='Organisationseinheiten'; $this->phrasen['global/fhtw']='Fachhochschule Technikum Wien'; $this->phrasen['global/fhTechnikumWien']='FH Technikum Wien'; diff --git a/locale/de-AT/menu.php b/locale/de-AT/menu.php index e376a55b1..24083d2a2 100755 --- a/locale/de-AT/menu.php +++ b/locale/de-AT/menu.php @@ -7,5 +7,6 @@ $this->phrasen['menu/organisationseinheit']='Zeitsperren nach Organisationseinhe $this->phrasen['menu/assistenz']='Zeitsperren aller AssistentInnen'; $this->phrasen['menu/lektoren']='Lektoren'; $this->phrasen['menu/urlaubAlle']='Alle'; -$this->phrasen['menu/suchePersonOrtDokumentInhalt']='Suche Person / Ort / Dokument / Inhalt / Durchwahl'; +$this->phrasen['menu/suchePersonOrtDokumentInhalt']='Suche Person / OE / Ort / Dokument / Inhalt / DW'; +$this->phrasen['menu/suchePersonOrtDokumentInhaltLang']='Suche Person / Organisationseinheit / Ort / Dokument / Inhalt / Durchwahl'; ?> diff --git a/locale/en-US/global.php b/locale/en-US/global.php index 827f7cc40..f58f7e3b2 100755 --- a/locale/en-US/global.php +++ b/locale/en-US/global.php @@ -9,6 +9,7 @@ $this->phrasen['global/studiengangsleitung']='Program Director'; $this->phrasen['global/lehrveranstaltung']='Subject'; $this->phrasen['global/lehreinheit']='Teaching unit'; $this->phrasen['global/organisationseinheit']='Organisation Unit'; +$this->phrasen['global/organisationseinheiten']='Organisation Units'; $this->phrasen['global/fhtw']='University of Applied Sciences Technikum Wien'; $this->phrasen['global/fhTechnikumWien']='UAS Technikum Wien'; diff --git a/locale/en-US/menu.php b/locale/en-US/menu.php index 6a3ebec38..a21ce5ede 100755 --- a/locale/en-US/menu.php +++ b/locale/en-US/menu.php @@ -7,5 +7,6 @@ $this->phrasen['menu/organisationseinheit']='Organization Units'; $this->phrasen['menu/assistenz']='Assistants'; $this->phrasen['menu/lektoren']='Lector'; $this->phrasen['menu/urlaubAlle']='All'; -$this->phrasen['menu/suchePersonOrtDokumentInhalt']='Search Person / Room / Document / Content / Extension'; +$this->phrasen['menu/suchePersonOrtDokumentInhalt']='Search Person / OU / Room / Document / Content / Ext.'; +$this->phrasen['menu/suchePersonOrtDokumentInhaltLang']='Search Person / Organisation Unit / Room / Document / Content / Extension'; ?>