From 282a9f2339f7f54e386526340adaed824233eedf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Thu, 21 Jun 2012 08:50:48 +0000 Subject: [PATCH] =?UTF-8?q?-=20GUI=20zum=20Checken=20von=20Bildern=20-=20S?= =?UTF-8?q?tatus=20f=C3=BCr=20Profilfotos=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cis/private/bildupload.php | 21 +++ cis/private/profile/index.php | 8 +- content/bildupload.php | 42 +++-- include/fotostatus.class.php | 189 ++++++++++++++++++++++ locale/de-AT/profil.php | 1 + system/FH-Complete.txp | 70 ++++----- system/checksystem.php | 81 +++++++++- vilesci/fhausweis/bildpruefung.php | 243 +++++++++++++++++++++++++++++ 8 files changed, 599 insertions(+), 56 deletions(-) create mode 100755 include/fotostatus.class.php create mode 100755 vilesci/fhausweis/bildpruefung.php diff --git a/cis/private/bildupload.php b/cis/private/bildupload.php index eeb9070cf..002296753 100644 --- a/cis/private/bildupload.php +++ b/cis/private/bildupload.php @@ -30,6 +30,7 @@ require_once('../../include/person.class.php'); require_once('../../include/benutzer.class.php'); require_once('../../include/akte.class.php'); require_once('../../include/phrasen.class.php'); +require_once('../../include/fotostatus.class.php'); $user = get_uid(); $sprache = getSprache(); @@ -85,6 +86,10 @@ if(isset($_GET['person_id'])) if($benutzer->person_id!=$_GET['person_id']) die($p->t('global/keineBerechtigungFuerDieseSeite')); + + $fs = new fotostatus(); + if($fs->akzeptiert($benutzer->person_id)) + die($p->t('profil/profilfotoUploadGesperrt')); } else die($p->t('global/fehlerBeiDerParameteruebergabe')); @@ -169,6 +174,20 @@ if(isset($_POST['submitbild'])) $person->foto = $content; $person->new = false; if($person->save()) + { + $fs = new fotostatus(); + $fs->person_id=$person->person_id; + $fs->fotostatus_kurzbz='hochgeladen'; + $fs->datum = date('Y-m-d'); + $fs->insertamum = date('Y-m-d H:i:s'); + $fs->insertvon = $user; + $fs->updateamum = date('Y-m-d H:i:s'); + $fs->updatevon = $user; + if(!$fs->save(true)) + echo 'Fehler beim Setzen des Bildstatus'; + else + { + echo "Bild wurde erfolgreich gespeichert
"; + } + } else echo ''.$person->errormsg.'
'; } diff --git a/cis/private/profile/index.php b/cis/private/profile/index.php index 3aa4fed8f..fa769793a 100644 --- a/cis/private/profile/index.php +++ b/cis/private/profile/index.php @@ -37,6 +37,7 @@ require_once('../../../include/benutzer.class.php'); require_once('../../../include/mitarbeiter.class.php'); require_once('../../../include/student.class.php'); require_once('../../../include/kontakt.class.php'); +require_once('../../../include/fotostatus.class.php'); $sprache = getSprache(); $p=new phrasen($sprache); @@ -195,7 +196,12 @@ if(!($ansicht && $user->foto_sperre)) echo ''.$user->person_id.''; if(!$ansicht) - echo "
".$p->t('profil/bildHochladen').""; +{ + //Foto Upload nur möglich wenn das Bild noch nicht akzeptiert wurde + $fs = new fotostatus(); + if(!$fs->akzeptiert($user->person_id)) + echo "
".$p->t('profil/bildHochladen').""; +} if($user->foto_sperre) echo '
'.$p->t('profil/profilfotoGesperrt').''; diff --git a/content/bildupload.php b/content/bildupload.php index e01974b11..b6a959156 100644 --- a/content/bildupload.php +++ b/content/bildupload.php @@ -26,6 +26,7 @@ require_once('../include/functions.inc.php'); require_once('../include/person.class.php'); require_once('../include/benutzerberechtigung.class.php'); require_once('../include/akte.class.php'); +require_once('../include/fotostatus.class.php'); $PHP_SELF = $_SERVER['PHP_SELF']; echo ""; @@ -150,19 +151,34 @@ if(isset($_POST['submitbild'])) $person->foto = $content; $person->new = false; if($person->save()) - echo "Bild wurde erfolgreich gespeichert -
"; + { + $fs = new fotostatus(); + $fs->person_id=$person->person_id; + $fs->fotostatus_kurzbz='hochgeladen'; + $fs->datum = date('Y-m-d'); + $fs->insertamum = date('Y-m-d H:i:s'); + $fs->insertvon = $user; + $fs->updateamum = date('Y-m-d H:i:s'); + $fs->updatevon = $user; + if(!$fs->save(true)) + echo 'Fehler beim Setzen des Bildstatus'; + else + { + echo "Bild wurde erfolgreich gespeichert +
"; + } + } else echo ''.$person->errormsg.'
'; } diff --git a/include/fotostatus.class.php b/include/fotostatus.class.php new file mode 100755 index 000000000..f62bb5a86 --- /dev/null +++ b/include/fotostatus.class.php @@ -0,0 +1,189 @@ + and + */ +require_once(dirname(__FILE__).'/basis_db.class.php'); + +class fotostatus extends basis_db +{ + public $new; // boolean + public $result = array(); // adresse Objekt + + //Tabellenspalten + public $fotostatus_kurzbz; // varchar(32) + public $beschreibung; // varchar(256) + + public $person_fotostatus_id; // integer + public $person_id; // integer + public $datum; // date + public $updateamum; // timestamp + public $updatevon; // string + public $insertamum; // timestamp + public $insertvon; // string + + /** + * Konstruktor + */ + public function __construct() + { + parent::__construct(); + } + + /** + * Prueft ob das Profilfoto der Person bereits akzeptiert wurde + * @param $person_id + */ + public function akzeptiert($person_id) + { + $qry = "SELECT + * + FROM + public.tbl_person_fotostatus + WHERE + person_id=".$this->db_add_param($person_id)." + AND fotostatus_kurzbz='akzeptiert'"; + if($result = $this->db_query($qry)) + { + if($this->db_num_rows($result)>0) + { + return true; + } + else + { + return false; + } + } + else + { + $this->errormsg = 'Fehler beim Laden der Daten'; + return false; + } + } + + public function save($new=null) + { + if(is_null($new)) + $new = $this->new; + + if($new) + { + $qry = 'BEGIN;INSERT INTO public.tbl_person_fotostatus(person_id, fotostatus_kurzbz, datum, + insertamum, insertvon, updateamum, updatevon) VALUES('. + $this->db_add_param($this->person_id).','. + $this->db_add_param($this->fotostatus_kurzbz).','. + $this->db_add_param($this->datum).','. + $this->db_add_param($this->insertamum).','. + $this->db_add_param($this->insertvon).','. + $this->db_add_param($this->updateamum).','. + $this->db_add_param($this->updatevon).');'; + } + else + { + $qry = 'UPDATE public.tbl_person_fotostatus SET '. + 'person_id='.$this->db_add_param($this->person_id).', '. + 'fotostatus_kurzbz='.$this->db_add_param($this->fotostatus_kurzbz).', '. + 'datum='.$this->db_add_param($this->datum).', '. + 'updateamum='.$this->db_add_param($this->updateamum).', '. + 'updatevon='.$this->db_add_param($this->updatevon).' '. + 'WHERE person_fotostatus_id='.$this->db_add_param($this->person_fotostatus_id); + } + + if($result = $this->db_query($qry)) + { + if($new) + { + // ID aus der Sequence holen + $qry="SELECT currval('public.seq_person_fotostatus_person_fotostatus_id') as id;"; + if($this->db_query($qry)) + { + if($row = $this->db_fetch_object()) + { + $this->person_fotostatus_id = $row->id; + $this->db_query('COMMIT'); + return true; + } + else + { + $this->db_query('ROLLBACK'); + $this->errormsg = "Fehler beim Auslesen der Sequence"; + return false; + } + } + else + { + $this->db_query('ROLLBACK'); + $this->errormsg = 'Fehler beim Auslesen der Sequence'; + return false; + } + } + else + { + return true; + } + } + else + { + $this->errormsg = 'Fehler beim Speichern des Fotostatus'; + return false; + } + } + + /** + * Laedt den letzten Fotostatus einer Person + * @param $person_id + */ + public function getLastFotoStatus($person_id) + { + $qry = 'SELECT + * + FROM + public.tbl_person_fotostatus + WHERE + person_id='.$this->db_add_param($person_id).' + ORDER BY datum desc, person_fotostatus_id DESC + LIMIT 1'; + + if($result = $this->db_query($qry)) + { + if($row = $this->db_fetch_object($result)) + { + $this->person_fotostatus_id = $row->person_fotostatus_id; + $this->person_id = $row->person_id; + $this->fotostatus_kurzbz = $row->fotostatus_kurzbz; + $this->datum = $row->datum; + $this->insertamum = $row->insertamum; + $this->insertvon = $row->insertvon; + $this->updateaum = $row->updateamum; + $this->updatevon = $row->updatevon; + + return true; + } + else + { + $this->errormsg = 'Eintrag wurde nicht gefunden'; + return false; + } + } + else + { + $this->errormsg = 'Fehler beim Laden der Daten'; + return false; + } + } +} +?> diff --git a/locale/de-AT/profil.php b/locale/de-AT/profil.php index fd3644606..831e4ec81 100644 --- a/locale/de-AT/profil.php +++ b/locale/de-AT/profil.php @@ -60,4 +60,5 @@ $this->phrasen['profil/fotofreigeben']='Sperre des Profilfotos aufheben'; $this->phrasen['profil/fotosperren']='Profilfoto sperren'; $this->phrasen['profil/infotextSperre']='Gesperrte Profilbilder werden nur für Zutrittskarten verwendet und scheinen nicht auf Anwesenheitslisten oder in der Personensuche auf'; $this->phrasen['profil/profilfotoGesperrt']='Profilfoto gesperrt'; +$this->phrasen['profil/profilfotoUploadGesperrt']='Der Upload des Profilfotos ist nicht mehr möglich'; ?> diff --git a/system/FH-Complete.txp b/system/FH-Complete.txp index a73eb9b08..3f6e8b7c4 100644 --- a/system/FH-Complete.txp +++ b/system/FH-Complete.txp @@ -9197,7 +9197,7 @@ 3690 7020 0 - 455 + 474 200 0 1 @@ -26449,7 +26449,7 @@ {E76B9DCC-0F11-4283-9226-6A9E0CE91E76} - fk_person_personfotostatus + fk_person_person_fotostatus 0 {14359BEE-7B30-4A4C-9D45-1725CF111C7A} 0 @@ -26469,7 +26469,7 @@ {435F72C8-6F6D-4FC5-BC8F-516F28671EEB} - 8872 + 8882 2265 @@ -26481,18 +26481,18 @@ 859 - 7506 + 7525 3790 - 7475 + 7494 3790 {212EE094-9435-454C-8AEC-E6317BF51755} - fk_fotostatus_personfotostatus + fk_fotostatus_person_fotostatus 0 {3229D757-B586-44B2-9344-642F168203E6} 0 @@ -26512,7 +26512,7 @@ {435F72C8-6F6D-4FC5-BC8F-516F28671EEB} - 7192 + 7196 3910 @@ -26524,11 +26524,11 @@ 4019 - 7248 + 7257 3921 - 7248 + 7257 3890 @@ -29196,8 +29196,8 @@ 0 0 -28 - 3851 - 7795 + 3853 + 8107 0 851 204 @@ -29236,7 +29236,7 @@ 3787 6543 0 - 854 + 875 356 0 1 @@ -33368,7 +33368,7 @@ {43669901-FA47-44FB-87F4-B95989732B93} - fk_person_personfotostatus + fk_person_person_fotostatus 0 {ABFCC2FB-5F14-4E81-B53D-DB8BC7B97C81} 0 @@ -33388,7 +33388,7 @@ {A3D836BC-B6F6-47F1-BD50-9C33D439E2FE} - 6930 + 6935 3629 @@ -33400,18 +33400,18 @@ 3622 - 6970 + 6980 3756 - 6970 + 6980 3787 {FFAEB0A2-7C93-4760-9FCD-18E27CE7D9AB} - fk_fotostatus_personfotostatus + fk_fotostatus_person_fotostatus 0 {905662B6-96E2-486D-B8B8-9BAA08E88A2D} 0 @@ -33431,23 +33431,23 @@ {A3D836BC-B6F6-47F1-BD50-9C33D439E2FE} - 7496 - 3899 + 7599 + 3893 - 7795 - 3953 + 8107 + 3955 - 7764 - 3953 + 8076 + 3955 - 7428 + 7449 3965 - 7397 + 7418 3965 @@ -49414,7 +49414,7 @@ {117121F4-B6F0-4DA2-892E-D0CF6FA1BE85} - fk_person_personfotostatus + fk_person_person_fotostatus 0 {434CB90D-607D-4E8A-971B-B00AEE0EEE61} 0 @@ -49440,7 +49440,7 @@ {9A74E2A2-6606-40C2-B9DF-F91D9BDD93D0} - fk_fotostatus_personfotostatus + fk_fotostatus_person_fotostatus 0 {45117CC8-415C-4F9E-A629-B6ACD4CE74B0} 0 @@ -49602,7 +49602,7 @@ Technikum Wien 2.0 2009-04-17T11:15:21.000+02:00 - 2012-06-18T16:44:47.677+02:00 + 2012-06-20T09:42:03.081+02:00 FH-Complete 2.0 <?xml-stylesheet type="text/xsl" href="FHCompleteTDM3PG83.xsl"?> @@ -151495,7 +151495,7 @@ Wenn FALSE haengt die Anzahl der Fragen pro Level von der Gesamtzahl pro Level a {E1B9C780-5FB0-4A24-A124-8EFB08C483E4} - personfotostatus_id + person_fotostatus_id 1 {D8A1F5EC-E373-4B78-9134-4AA02ED76E6A} 0 @@ -151513,7 +151513,7 @@ Wenn FALSE haengt die Anzahl der Fragen pro Level von der Gesamtzahl pro Level a 1 0 - personfotostatus_id + person_fotostatus_id 0 @@ -151847,7 +151847,7 @@ Wenn FALSE haengt die Anzahl der Fragen pro Level von der Gesamtzahl pro Level a {2CDA30F7-34F0-4D6C-94A0-5C0DAD4E8F3F} - personfotostatus_id + person_fotostatus_id 0 {FFB59F5A-AC85-4B33-9967-0E56B879CCAF} 0 @@ -175509,7 +175509,7 @@ Wenn FALSE haengt die Anzahl der Fragen pro Level von der Gesamtzahl pro Level a {94403655-C8DB-4232-B606-E0FC702DFDAC} - fk_person_personfotostatus + fk_person_person_fotostatus 0 {1C7204B5-A622-446A-9749-D813009292F0} 0 @@ -175527,7 +175527,7 @@ Wenn FALSE haengt die Anzahl der Fragen pro Level von der Gesamtzahl pro Level a 0 -1 - fk_person_personfotostatus + fk_person_person_fotostatus 0 0 @@ -175567,7 +175567,7 @@ Wenn FALSE haengt die Anzahl der Fragen pro Level von der Gesamtzahl pro Level a {526289A5-6F74-4DF5-B548-8FFF3D6909FE} - fk_fotostatus_personfotostatus + fk_fotostatus_person_fotostatus 0 {6B04C8CC-6FB1-40C0-81B5-5BFA94F3A895} 0 @@ -175585,7 +175585,7 @@ Wenn FALSE haengt die Anzahl der Fragen pro Level von der Gesamtzahl pro Level a 0 -1 - fk_fotostatus_personfotostatus + fk_fotostatus_person_fotostatus 0 0 diff --git a/system/checksystem.php b/system/checksystem.php index a7028eb66..1251b1b13 100644 --- a/system/checksystem.php +++ b/system/checksystem.php @@ -3582,7 +3582,7 @@ if(!@$db->db_query("SELECT anmerkung_student FROM public.tbl_preoutgoing LIMIT 1 if(!$db->db_query($qry)) echo 'public.tbl_preoutgoing: '.$db->db_last_error().'
'; else - echo 'Tabelle public.tbl_preoutgoing Spalten anmerkungStudent, anmerkungAdmin, studienrichtungGastuniversitaet'; + echo 'Tabelle public.tbl_preoutgoing Spalten anmerkungStudent, anmerkungAdmin, studienrichtungGastuniversitaet
'; } // foto_intern Boolean @@ -3593,7 +3593,7 @@ if(!@$db->db_query("SELECT foto_sperre FROM public.tbl_person LIMIT 1")) if(!$db->db_query($qry)) echo 'public.tbl_person: '.$db->db_last_error().'
'; else - echo 'Tabelle public.tbl_person Spalte foto_intern hinzugefuegt'; + echo 'Tabelle public.tbl_person Spalte foto_intern hinzugefuegt
'; } // nummer_myfare in Tabelle Betriebsmittel @@ -3604,7 +3604,7 @@ if(!@$db->db_query("SELECT nummer2 FROM wawi.tbl_betriebsmittel LIMIT 1")) if(!$db->db_query($qry)) echo 'wawi.tbl_betriebsmittel: '.$db->db_last_error().'
'; else - echo 'Tabelle wawi.tbl_betriebsmittel Spalte nummer2 hinzugefuegt'; + echo 'Tabelle wawi.tbl_betriebsmittel Spalte nummer2 hinzugefuegt
'; } // View fuer Testtool Auswertung @@ -3642,7 +3642,7 @@ if(!@$db->db_query("SELECT * FROM testtool.vw_auswertung_kategorie_semester LIMI if(!$db->db_query($qry)) echo 'testtool.vw_auswertung_kategorie_semester: '.$db->db_last_error().'
'; else - echo 'View testtool.vw_auswertung_kategorie_semester hinzugefuegt'; + echo 'View testtool.vw_auswertung_kategorie_semester hinzugefuegt
'; } // Gesperrt Attribut fuer Tabelle Gruppe @@ -3656,7 +3656,72 @@ if(!@$db->db_query("SELECT gesperrt FROM public.tbl_gruppe LIMIT 1")) if(!$db->db_query($qry)) echo 'public.tbl_gruppe: '.$db->db_last_error().'
'; else - echo 'Tabelle public.tbl_gruppe Spalte gesperrt hinzugefuegt'; + echo 'Tabelle public.tbl_gruppe Spalte gesperrt hinzugefuegt
'; +} + +// Tabellen fuer Status des Profilfotos +if(!@$db->db_query("SELECT 1 FROM public.tbl_person_fotostatus LIMIT 1")) +{ + $qry = "CREATE TABLE public.tbl_fotostatus + ( + fotostatus_kurzbz varchar(32) NOT NULL, + beschreibung varchar(256) + ); + + CREATE TABLE public.tbl_person_fotostatus + ( + person_fotostatus_id integer NOT NULL, + person_id integer NOT NULL, + fotostatus_kurzbz varchar(32) NOT NULL, + datum date NOT NULL, + insertamum timestamp, + insertvon varchar(32), + updateamum timestamp, + updatevon varchar(32) + ); + + CREATE SEQUENCE public.seq_person_fotostatus_person_fotostatus_id + INCREMENT BY 1 + NO MAXVALUE + NO MINVALUE + CACHE 1; + + ALTER TABLE public.tbl_fotostatus ADD CONSTRAINT pk_fotostatus PRIMARY KEY (fotostatus_kurzbz); + ALTER TABLE public.tbl_person_fotostatus ADD CONSTRAINT pk_person_fotostatus PRIMARY KEY (person_fotostatus_id); + ALTER TABLE public.tbl_person_fotostatus ALTER COLUMN person_fotostatus_id SET DEFAULT nextval('public.seq_person_fotostatus_person_fotostatus_id'); + ALTER TABLE public.tbl_person_fotostatus ADD CONSTRAINT fk_person_person_fotostatus FOREIGN KEY(person_id) REFERENCES public.tbl_person (person_id) ON DELETE CASCADE ON UPDATE CASCADE; + ALTER TABLE public.tbl_person_fotostatus ADD CONSTRAINT fk_fotostatus_person_fotostatus FOREIGN KEY(fotostatus_kurzbz) REFERENCES public.tbl_fotostatus (fotostatus_kurzbz) ON DELETE RESTRICT ON UPDATE CASCADE; + + GRANT SELECT ON public.tbl_fotostatus TO web; + GRANT SELECT ON public.tbl_fotostatus TO vilesci; + GRANT SELECT, UPDATE, INSERT, DELETE ON public.tbl_person_fotostatus TO web; + GRANT SELECT, UPDATE, INSERT, DELETE ON public.tbl_person_fotostatus TO vilesci; + GRANT SELECT, UPDATE ON SEQUENCE public.seq_person_fotostatus_person_fotostatus_id TO web; + GRANT SELECT, UPDATE ON SEQUENCE public.seq_person_fotostatus_person_fotostatus_id TO vilesci; + + INSERT INTO public.tbl_fotostatus (fotostatus_kurzbz, beschreibung) VALUES('akzeptiert', 'Profilfoto wurde akzeptiert'); + INSERT INTO public.tbl_fotostatus (fotostatus_kurzbz, beschreibung) VALUES('hochgeladen', 'Neues Profilfoto wurde hochgeladen'); + INSERT INTO public.tbl_fotostatus (fotostatus_kurzbz, beschreibung) VALUES('abgewiesen', 'Profilfoto wurde abgewiesen'); + "; + + if(!$db->db_query($qry)) + echo 'public.tbl_fotostatus: '.$db->db_last_error().'
'; + else + echo 'Tabelle public.tbl_fotostatus und public.tbl_person_fotostatus hinzugefuegt
'; +} + +// Optionaler FK auf Benutzer von Betriebsmittel +// (wird bei Zutrittskarten gesetzt) +if(!@$db->db_query("SELECT uid FROM wawi.tbl_betriebsmittelperson LIMIT 1")) +{ + $qry = "ALTER TABLE wawi.tbl_betriebsmittelperson ADD COLUMN uid varchar(32); + ALTER TABLE wawi.tbl_betriebsmittelperson ADD CONSTRAINT fk_benutzer_betriebsmittelperson FOREIGN KEY(uid) REFERENCES public.tbl_benutzer (uid) ON DELETE RESTRICT ON UPDATE CASCADE; + "; + + if(!$db->db_query($qry)) + echo 'wawi.tbl_betriebsmittelperson: '.$db->db_last_error().'
'; + else + echo 'Tabelle wawi.tbl_betriebsmittelperson Spalte uid hinzugefuegt
'; } echo '
'; @@ -3780,6 +3845,7 @@ $tabellen=array( "public.tbl_firma_organisationseinheit" => array("firma_organisationseinheit_id","firma_id","oe_kurzbz","bezeichnung","kundennummer","updateamum","updatevon","insertamum","insertvon","ext_id"), "public.tbl_firmentyp" => array("firmentyp_kurzbz","beschreibung"), "public.tbl_firmatag" => array("firma_id","tag","insertamum","insertvon"), + "public.tbl_fotostatus" => array("fotostatus_kurzbz","beschreibung"), "public.tbl_funktion" => array("funktion_kurzbz","beschreibung","aktiv","fachbereich","semester"), "public.tbl_geschaeftsjahr" => array("geschaeftsjahr_kurzbz","start","ende","bezeichnung"), "public.tbl_gruppe" => array("gruppe_kurzbz","studiengang_kz","semester","bezeichnung","beschreibung","sichtbar","lehre","aktiv","sort","mailgrp","generiert","updateamum","updatevon","insertamum","insertvon","ext_id","orgform_kurzbz","gid","content_visible","gesperrt"), @@ -3797,6 +3863,7 @@ $tabellen=array( "public.tbl_organisationseinheit" => array("oe_kurzbz", "oe_parent_kurzbz", "bezeichnung","organisationseinheittyp_kurzbz", "aktiv","mailverteiler","freigabegrenze","kurzzeichen"), "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"), "public.tbl_personfunktionstandort" => array("personfunktionstandort_id","funktion_kurzbz","person_id","standort_id","position","anrede"), "public.tbl_preincoming" => array("preincoming_id","person_id","mobilitaetsprogramm_code","zweck_code","firma_id","universitaet","aktiv","bachelorthesis","masterthesis","von","bis","uebernommen","insertamum","insertvon","updateamum","updatevon","anmerkung","zgv","zgv_ort","zgv_datum","zgv_name","zgvmaster","zgvmaster_datum","zgvmaster_ort","zgvmaster_name","program_name","bachelor","master","jahre","person_id_emergency","person_id_coordinator_dep","person_id_coordinator_int","code","deutschkurs1","deutschkurs2","research_area","deutschkurs3"), "public.tbl_preincoming_lehrveranstaltung" => array("preincoming_id","lehrveranstaltung_id","insertamum","insertvon"), @@ -3845,8 +3912,8 @@ $tabellen=array( "system.tbl_webservicerecht" => array("webservicerecht_id","berechtigung_kurzbz","methode","attribut","insertamum","insertvon","updateamum","updatevon"), "system.tbl_webservicetyp" => array("webservicetyp_kurzbz","beschreibung"), "system.tbl_server" => array("server_kurzbz","beschreibung"), - "wawi.tbl_betriebsmittelperson" => array("betriebsmittelperson_id","betriebsmittel_id","person_id", "anmerkung", "kaution", "ausgegebenam", "retouram","insertamum", "insertvon","updateamum", "updatevon","ext_id"), - "wawi.tbl_betriebsmittel" => array("betriebsmittel_id","betriebsmitteltyp","oe_kurzbz", "ort_kurzbz", "beschreibung", "nummer", "hersteller","seriennummer", "bestellung_id","bestelldetail_id", "afa","verwendung","anmerkung","reservieren","updateamum","updatevon","insertamum","insertvon","ext_id","inventarnummer","leasing_bis","inventuramum","inventurvon","anschaffungsdatum","anschaffungswert","hoehe","breite","tiefe","nummer_myfare"), + "wawi.tbl_betriebsmittelperson" => array("betriebsmittelperson_id","betriebsmittel_id","person_id", "anmerkung", "kaution", "ausgegebenam", "retouram","insertamum", "insertvon","updateamum", "updatevon","ext_id","uid"), + "wawi.tbl_betriebsmittel" => array("betriebsmittel_id","betriebsmitteltyp","oe_kurzbz", "ort_kurzbz", "beschreibung", "nummer", "hersteller","seriennummer", "bestellung_id","bestelldetail_id", "afa","verwendung","anmerkung","reservieren","updateamum","updatevon","insertamum","insertvon","ext_id","inventarnummer","leasing_bis","inventuramum","inventurvon","anschaffungsdatum","anschaffungswert","hoehe","breite","tiefe","nummer2"), "wawi.tbl_betriebsmittel_betriebsmittelstatus" => array("betriebsmittelbetriebsmittelstatus_id","betriebsmittel_id","betriebsmittelstatus_kurzbz", "datum", "updateamum", "updatevon", "insertamum", "insertvon","anmerkung"), "wawi.tbl_betriebsmittelstatus" => array("betriebsmittelstatus_kurzbz","beschreibung"), "wawi.tbl_betriebsmitteltyp" => array("betriebsmitteltyp","beschreibung","anzahl","kaution","typ_code","mastershapename"), diff --git a/vilesci/fhausweis/bildpruefung.php b/vilesci/fhausweis/bildpruefung.php new file mode 100755 index 000000000..1bc4b325d --- /dev/null +++ b/vilesci/fhausweis/bildpruefung.php @@ -0,0 +1,243 @@ + + */ +/** + * GUI zur einfachen Prüfung von Profilbildern + */ +require_once('../../config/vilesci.config.inc.php'); +require_once('../../include/betriebsmittel.class.php'); +require_once('../../include/benutzerberechtigung.class.php'); +require_once('../../include/functions.inc.php'); +require_once('../../include/mail.class.php'); +require_once('../../include/benutzer.class.php'); +require_once('../../include/person.class.php'); +require_once('../../include/fotostatus.class.php'); + +$uid = get_uid(); +$rechte = new benutzerberechtigung(); +$rechte->getBerechtigungen($uid); + +$db = new basis_db(); +echo ' + + + + + + Profilfoto Check + + +

Profilfoto Check

+'; +if(!$rechte->isBerechtigt('basis/person','suid')) +{ + die('Sie haben keine Berechtigung für diese Seite'); +} +$error = false; +$person_id=''; +if(isset($_POST['person_id'])) +{ + $person_id=$_POST['person_id']; + + //Profilbild OK - Akzeptiert Status setzen + if(isset($_POST['akzeptieren'])) + { + $fs = new fotostatus(); + $fs->person_id=$person_id; + $fs->fotostatus_kurzbz='akzeptiert'; + $fs->datum = date('Y-m-d'); + $fs->insertvon = $uid; + $fs->insertamum = date('Y-m-d H:i:s'); + $fs->updatevon = $uid; + $fs->updateamum = date('Y-m-d H:i:s'); + + if($fs->save(true)) + { + echo 'Profilbild wurde akzeptiert'; + } + else + { + echo 'Fehler beim Akzeptieren:'.$fs->errormsg.''; + $error = true; + } + } + + //Profilbild Fehlerhaft - Infomail an die Person versenden + if(isset($_POST['fehlerhaft'])) + { + $benutzer = new benutzer(); + $to=''; + if($benutzer->getBenutzerFromPerson($person_id)) + { + foreach($benutzer->result as $row) + { + if($to!='') + $to.','; + $to = $row->uid.'@'.DOMAIN; + } + } + //Wenn kein Benutzer gefunden wurde, ist es ein + if($to!='') + { + $person = new person(); + $person->load($person_id); + + $from = 'fhausweis@technikum-wien.at'; + $subject = 'Profilbild'; + if($person->geschlecht=='m') + $text = "Sehr geehrter Herr ".$person->vorname.' '.$person->nachname.",\n\n"; + else + $text = "Sehr geehrte Frau ".$person->vorname.' '.$person->nachname.",\n\n"; + + $text .= "Ihr Profilbild wurde von uns geprüft und entspricht nicht den Bildkriterien.\n"; + $text .= "Die aktuellen Bildkriterien finden Sie unter folgendem Link:\n"; + $text .= "https://cis.technikum-wien.at/cms/content.php?content_id=6174\n\n"; + $text .= "Bitte Laden Sie ein entsprechendes Profilbild im CIS unter 'Mein CIS'->'Profil' hoch.\n"; + $text .= "\n"; + $text .= "Herzlichen Dank\n"; + $text .= "Fachhochschule Technikum Wien"; + + $mail = new mail($to, $from, $subject, $text); + if($mail->send()) + { + echo 'Infomail wurde versendet an '.$to.''; + } + else + { + echo 'Fehler beim Versenden des Mails an '.$to.''; + $error = true; + } + } + else + { + echo 'Keine Mail Adresse gefunden'; + $error = true; + } + + if(!$error) + { + //Status setzen + $fs = new fotostatus(); + $fs->person_id=$person_id; + $fs->fotostatus_kurzbz='abgewiesen'; + $fs->datum = date('Y-m-d'); + $fs->insertvon = $uid; + $fs->insertamum = date('Y-m-d H:i:s'); + $fs->updatevon = $uid; + $fs->updateamum = date('Y-m-d H:i:s'); + + if(!$fs->save(true)) + { + echo 'Fehler beim Setzen des abgewiesen Status:'.$fs->errormsg.''; + $error = true; + } + } + } + + //BestOf Profilbilder werden gesichert + if(isset($_POST['bestof'])) + { + echo 'Zu BestOf hinzugefügt'; + $qry = "SELECT inhalt FROM public.tbl_akte + WHERE dokument_kurzbz='Lichtbil' AND person_id=".$db->db_add_param($person_id); + if($result = $db->db_query($qry)) + { + if($row = $db->db_fetch_object($result)) + { + file_put_contents('bestof/'.$person_id.'.jpg',base64_decode($row->inhalt)); + //Error setzen damit die Person nochmals angezeigt wird + $error = true; + } + } + } +} + +// Laden einer Person deren Profilfoto noch nicht akzeptiert wurde +$qry = " + SELECT + *, + (SELECT 1 FROM public.tbl_mitarbeiter JOIN public.tbl_benutzer ON(mitarbeiter_uid=uid) + WHERE person_id=tbl_person.person_id) as mitarbeiter + FROM + public.tbl_person + JOIN public.tbl_benutzer USING(person_id) + WHERE + foto is not NULL + AND tbl_benutzer.aktiv"; +if($error==true && $person_id!='') +{ + // Wenn ein Fehler auftritt oder Bestof geklickt wird, wird die Person erneut angezeigt + $qry.=" AND person_id=".$db->db_add_param($person_id); +} +else +{ + // Zufaellige Reihenfolge + $qry.=" AND random() <0.01"; + + // Keine Eintraege die bereits akzeptiert wurden + $qry.=" AND NOT EXISTS (SELECT 1 FROM public.tbl_person_fotostatus + WHERE person_id=tbl_person.person_id AND fotostatus_kurzbz='akzeptiert')"; + + // Keine Eintraege bei denen Abgewiesen der letzte Status ist + $qry.=" AND 'abgewiesen' NOT IN (SELECT fotostatus_kurzbz FROM public.tbl_person_fotostatus + WHERE person_id=tbl_person.person_id ORDER BY datum desc, person_fotostatus_id desc LIMIT 1)"; +} +$qry.=" LIMIT 1"; + +if($result = $db->db_query($qry)) +{ + if($row = $db->db_fetch_object($result)) + { + //Anzeige des Profilbildes + echo ' +


+
+ + + + + + +
+ +   + Vorname: '.$db->convert_html_chars($row->vorname).'
+ Nachname: '.$db->convert_html_chars($row->nachname).'
+ '.($row->mitarbeiter=='1'?'Mitarbeiter':'Student').' +
'; + + echo '

'; + echo '
'; + echo ''; + echo '    '; + echo '    '; + echo ' '; + echo '
'; + echo '
'; + } + else + { + echo 'Es sind keine ungeprüften Bilder vorhanden'; + } +} + +echo ' +'; +?> \ No newline at end of file