- GUI zum Checken von Bildern

- Status für Profilfotos hinzugefügt
This commit is contained in:
Andreas Österreicher
2012-06-21 08:50:48 +00:00
parent 344bf7d845
commit 282a9f2339
8 changed files with 599 additions and 56 deletions
+21
View File
@@ -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 '<span class="error">Fehler beim Setzen des Bildstatus</span>';
else
{
echo "<b>Bild wurde erfolgreich gespeichert</b>
<script language='Javascript'>
if(typeof(opener.StudentAuswahl) == 'function')
@@ -182,6 +201,8 @@ if(isset($_POST['submitbild']))
}
window.close();
</script><br />";
}
}
else
echo '<b>'.$person->errormsg.'</b><br />';
}
+7 -1
View File
@@ -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 '<img id="personimage" src="../../public/bild.php?src=person&person_id='.$user->person_id.'" alt="'.$user->person_id.'" height="100px" width="75px">';
if(!$ansicht)
echo "<br><a href='#BildUpload' onclick='window.open(\"../bildupload.php?person_id=$user->person_id\",\"BildUpload\", \"height=500,width=500,left=0,top=0,hotkeys=0,resizable=yes,status=no,scrollbars=yes,toolbar=no,location=no,menubar=no,dependent=yes\"); return false;'>".$p->t('profil/bildHochladen')."</a>";
{
//Foto Upload nur möglich wenn das Bild noch nicht akzeptiert wurde
$fs = new fotostatus();
if(!$fs->akzeptiert($user->person_id))
echo "<br><a href='#BildUpload' onclick='window.open(\"../bildupload.php?person_id=$user->person_id\",\"BildUpload\", \"height=500,width=500,left=0,top=0,hotkeys=0,resizable=yes,status=no,scrollbars=yes,toolbar=no,location=no,menubar=no,dependent=yes\"); return false;'>".$p->t('profil/bildHochladen')."</a>";
}
if($user->foto_sperre)
echo '<br><b>'.$p->t('profil/profilfotoGesperrt').'</b>';
+29 -13
View File
@@ -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 "<html><body>";
@@ -150,19 +151,34 @@ if(isset($_POST['submitbild']))
$person->foto = $content;
$person->new = false;
if($person->save())
echo "<b>Bild wurde erfolgreich gespeichert</b>
<script language='Javascript'>
if(typeof(opener.StudentAuswahl) == 'function')
opener.StudentAuswahl();
if(typeof(opener.MitarbeiterAuswahl) == 'function')
opener.MitarbeiterAuswahl();
if(typeof(opener.RefreshImage) == 'function' ||
typeof(opener.RefreshImage) == 'object')
{
opener.RefreshImage();
}
window.close();
</script><br />";
{
$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 '<span class="error">Fehler beim Setzen des Bildstatus</span>';
else
{
echo "<b>Bild wurde erfolgreich gespeichert</b>
<script language='Javascript'>
if(typeof(opener.StudentAuswahl) == 'function')
opener.StudentAuswahl();
if(typeof(opener.MitarbeiterAuswahl) == 'function')
opener.MitarbeiterAuswahl();
if(typeof(opener.RefreshImage) == 'function' ||
typeof(opener.RefreshImage) == 'object')
{
opener.RefreshImage();
}
window.close();
</script><br />";
}
}
else
echo '<b>'.$person->errormsg.'</b><br />';
}
+189
View File
@@ -0,0 +1,189 @@
<?php
/* Copyright (C) 2012 FH Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> 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;
}
}
}
?>
+1
View File
@@ -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';
?>
+35 -35
View File
@@ -9197,7 +9197,7 @@
<Top>3690</Top>
<Left>7020</Left>
<z>0</z>
<Width>455</Width>
<Width>474</Width>
<Height>200</Height>
<dz>0</dz>
<RecalculateSizes>1</RecalculateSizes>
@@ -26449,7 +26449,7 @@
</WorkSpaceLinePERRelationPG83>
<WorkSpaceLinePERRelationPG83 ObjectType="2504" CSAOName="WorkSpaceLinePERRelationPG83">
<Id>{E76B9DCC-0F11-4283-9226-6A9E0CE91E76}</Id>
<Name>fk_person_personfotostatus</Name>
<Name>fk_person_person_fotostatus</Name>
<Ordinal>0</Ordinal>
<HistoryID>{14359BEE-7B30-4A4C-9D45-1725CF111C7A}</HistoryID>
<GlobalOrder>0</GlobalOrder>
@@ -26469,7 +26469,7 @@
<WorkSpaceShape2>
<Id>{435F72C8-6F6D-4FC5-BC8F-516F28671EEB}</Id>
</WorkSpaceShape2>
<NamePositionX>8872</NamePositionX>
<NamePositionX>8882</NamePositionX>
<NamePositionY>2265</NamePositionY>
<Points>
<Point>
@@ -26481,18 +26481,18 @@
<y>859</y>
</Point>
<Point>
<x>7506</x>
<x>7525</x>
<y>3790</y>
</Point>
<Point>
<x>7475</x>
<x>7494</x>
<y>3790</y>
</Point>
</Points>
</WorkSpaceLinePERRelationPG83>
<WorkSpaceLinePERRelationPG83 ObjectType="2504" CSAOName="WorkSpaceLinePERRelationPG83">
<Id>{212EE094-9435-454C-8AEC-E6317BF51755}</Id>
<Name>fk_fotostatus_personfotostatus</Name>
<Name>fk_fotostatus_person_fotostatus</Name>
<Ordinal>0</Ordinal>
<HistoryID>{3229D757-B586-44B2-9344-642F168203E6}</HistoryID>
<GlobalOrder>0</GlobalOrder>
@@ -26512,7 +26512,7 @@
<WorkSpaceShape2>
<Id>{435F72C8-6F6D-4FC5-BC8F-516F28671EEB}</Id>
</WorkSpaceShape2>
<NamePositionX>7192</NamePositionX>
<NamePositionX>7196</NamePositionX>
<NamePositionY>3910</NamePositionY>
<Points>
<Point>
@@ -26524,11 +26524,11 @@
<y>4019</y>
</Point>
<Point>
<x>7248</x>
<x>7257</x>
<y>3921</y>
</Point>
<Point>
<x>7248</x>
<x>7257</x>
<y>3890</y>
</Point>
</Points>
@@ -29196,8 +29196,8 @@
<FontStyle>0</FontStyle>
<FormatLocked>0</FormatLocked>
<FontHeight>-28</FontHeight>
<Top>3851</Top>
<Left>7795</Left>
<Top>3853</Top>
<Left>8107</Left>
<z>0</z>
<Width>851</Width>
<Height>204</Height>
@@ -29236,7 +29236,7 @@
<Top>3787</Top>
<Left>6543</Left>
<z>0</z>
<Width>854</Width>
<Width>875</Width>
<Height>356</Height>
<dz>0</dz>
<RecalculateSizes>1</RecalculateSizes>
@@ -33368,7 +33368,7 @@
</WorkSpaceLinePERRelationPG83>
<WorkSpaceLinePERRelationPG83 ObjectType="2504" CSAOName="WorkSpaceLinePERRelationPG83">
<Id>{43669901-FA47-44FB-87F4-B95989732B93}</Id>
<Name>fk_person_personfotostatus</Name>
<Name>fk_person_person_fotostatus</Name>
<Ordinal>0</Ordinal>
<HistoryID>{ABFCC2FB-5F14-4E81-B53D-DB8BC7B97C81}</HistoryID>
<GlobalOrder>0</GlobalOrder>
@@ -33388,7 +33388,7 @@
<WorkSpaceShape2>
<Id>{A3D836BC-B6F6-47F1-BD50-9C33D439E2FE}</Id>
</WorkSpaceShape2>
<NamePositionX>6930</NamePositionX>
<NamePositionX>6935</NamePositionX>
<NamePositionY>3629</NamePositionY>
<Points>
<Point>
@@ -33400,18 +33400,18 @@
<y>3622</y>
</Point>
<Point>
<x>6970</x>
<x>6980</x>
<y>3756</y>
</Point>
<Point>
<x>6970</x>
<x>6980</x>
<y>3787</y>
</Point>
</Points>
</WorkSpaceLinePERRelationPG83>
<WorkSpaceLinePERRelationPG83 ObjectType="2504" CSAOName="WorkSpaceLinePERRelationPG83">
<Id>{FFAEB0A2-7C93-4760-9FCD-18E27CE7D9AB}</Id>
<Name>fk_fotostatus_personfotostatus</Name>
<Name>fk_fotostatus_person_fotostatus</Name>
<Ordinal>0</Ordinal>
<HistoryID>{905662B6-96E2-486D-B8B8-9BAA08E88A2D}</HistoryID>
<GlobalOrder>0</GlobalOrder>
@@ -33431,23 +33431,23 @@
<WorkSpaceShape2>
<Id>{A3D836BC-B6F6-47F1-BD50-9C33D439E2FE}</Id>
</WorkSpaceShape2>
<NamePositionX>7496</NamePositionX>
<NamePositionY>3899</NamePositionY>
<NamePositionX>7599</NamePositionX>
<NamePositionY>3893</NamePositionY>
<Points>
<Point>
<x>7795</x>
<y>3953</y>
<x>8107</x>
<y>3955</y>
</Point>
<Point>
<x>7764</x>
<y>3953</y>
<x>8076</x>
<y>3955</y>
</Point>
<Point>
<x>7428</x>
<x>7449</x>
<y>3965</y>
</Point>
<Point>
<x>7397</x>
<x>7418</x>
<y>3965</y>
</Point>
</Points>
@@ -49414,7 +49414,7 @@
</WorkSpaceLinePERRelationPG83>
<WorkSpaceLinePERRelationPG83 ObjectType="2504" CSAOName="WorkSpaceLinePERRelationPG83">
<Id>{117121F4-B6F0-4DA2-892E-D0CF6FA1BE85}</Id>
<Name>fk_person_personfotostatus</Name>
<Name>fk_person_person_fotostatus</Name>
<Ordinal>0</Ordinal>
<HistoryID>{434CB90D-607D-4E8A-971B-B00AEE0EEE61}</HistoryID>
<GlobalOrder>0</GlobalOrder>
@@ -49440,7 +49440,7 @@
</WorkSpaceLinePERRelationPG83>
<WorkSpaceLinePERRelationPG83 ObjectType="2504" CSAOName="WorkSpaceLinePERRelationPG83">
<Id>{9A74E2A2-6606-40C2-B9DF-F91D9BDD93D0}</Id>
<Name>fk_fotostatus_personfotostatus</Name>
<Name>fk_fotostatus_person_fotostatus</Name>
<Ordinal>0</Ordinal>
<HistoryID>{45117CC8-415C-4F9E-A629-B6ACD4CE74B0}</HistoryID>
<GlobalOrder>0</GlobalOrder>
@@ -49602,7 +49602,7 @@
<Company>Technikum Wien</Company>
<Version>2.0</Version>
<CreatedDate>2009-04-17T11:15:21.000+02:00</CreatedDate>
<ModifiedDate>2012-06-18T16:44:47.677+02:00</ModifiedDate>
<ModifiedDate>2012-06-20T09:42:03.081+02:00</ModifiedDate>
<Project>FH-Complete 2.0</Project>
<Description>&lt;?xml-stylesheet type="text/xsl" href="FHCompleteTDM3PG83.xsl"?&gt;
</Description>
@@ -151495,7 +151495,7 @@ Wenn FALSE haengt die Anzahl der Fragen pro Level von der Gesamtzahl pro Level a
<Attributes>
<PERAttributePG83 ObjectType="2003" CSAOName="PERAttributePG83">
<Id>{E1B9C780-5FB0-4A24-A124-8EFB08C483E4}</Id>
<Name>personfotostatus_id</Name>
<Name>person_fotostatus_id</Name>
<Ordinal>1</Ordinal>
<HistoryID>{D8A1F5EC-E373-4B78-9134-4AA02ED76E6A}</HistoryID>
<GlobalOrder>0</GlobalOrder>
@@ -151513,7 +151513,7 @@ Wenn FALSE haengt die Anzahl der Fragen pro Level von der Gesamtzahl pro Level a
<DefaultValue></DefaultValue>
<NotNull>1</NotNull>
<Migrated>0</Migrated>
<Caption>personfotostatus_id</Caption>
<Caption>person_fotostatus_id</Caption>
<Unique>0</Unique>
<OriginalName></OriginalName>
<CheckConstraint></CheckConstraint>
@@ -151847,7 +151847,7 @@ Wenn FALSE haengt die Anzahl der Fragen pro Level von der Gesamtzahl pro Level a
<KeyItems>
<PERKeyConstraintItemPG83 ObjectType="2011" CSAOName="PERKeyConstraintItemPG83">
<Id>{2CDA30F7-34F0-4D6C-94A0-5C0DAD4E8F3F}</Id>
<Name>personfotostatus_id</Name>
<Name>person_fotostatus_id</Name>
<Ordinal>0</Ordinal>
<HistoryID>{FFB59F5A-AC85-4B33-9967-0E56B879CCAF}</HistoryID>
<GlobalOrder>0</GlobalOrder>
@@ -175509,7 +175509,7 @@ Wenn FALSE haengt die Anzahl der Fragen pro Level von der Gesamtzahl pro Level a
</PERRelationPG83>
<PERRelationPG83 ObjectType="2004" CSAOName="PERRelationPG83">
<Id>{94403655-C8DB-4232-B606-E0FC702DFDAC}</Id>
<Name>fk_person_personfotostatus</Name>
<Name>fk_person_person_fotostatus</Name>
<Ordinal>0</Ordinal>
<HistoryID>{1C7204B5-A622-446A-9749-D813009292F0}</HistoryID>
<GlobalOrder>0</GlobalOrder>
@@ -175527,7 +175527,7 @@ Wenn FALSE haengt die Anzahl der Fragen pro Level von der Gesamtzahl pro Level a
<MandatoryChild>0</MandatoryChild>
<CardinalityChild>-1</CardinalityChild>
<InverseName></InverseName>
<Caption>fk_person_personfotostatus</Caption>
<Caption>fk_person_person_fotostatus</Caption>
<InverseCaption></InverseCaption>
<RefIntegrityParentUpdate>0</RefIntegrityParentUpdate>
<RefIntegrityParentDelete>0</RefIntegrityParentDelete>
@@ -175567,7 +175567,7 @@ Wenn FALSE haengt die Anzahl der Fragen pro Level von der Gesamtzahl pro Level a
</PERRelationPG83>
<PERRelationPG83 ObjectType="2004" CSAOName="PERRelationPG83">
<Id>{526289A5-6F74-4DF5-B548-8FFF3D6909FE}</Id>
<Name>fk_fotostatus_personfotostatus</Name>
<Name>fk_fotostatus_person_fotostatus</Name>
<Ordinal>0</Ordinal>
<HistoryID>{6B04C8CC-6FB1-40C0-81B5-5BFA94F3A895}</HistoryID>
<GlobalOrder>0</GlobalOrder>
@@ -175585,7 +175585,7 @@ Wenn FALSE haengt die Anzahl der Fragen pro Level von der Gesamtzahl pro Level a
<MandatoryChild>0</MandatoryChild>
<CardinalityChild>-1</CardinalityChild>
<InverseName></InverseName>
<Caption>fk_fotostatus_personfotostatus</Caption>
<Caption>fk_fotostatus_person_fotostatus</Caption>
<InverseCaption></InverseCaption>
<RefIntegrityParentUpdate>0</RefIntegrityParentUpdate>
<RefIntegrityParentDelete>0</RefIntegrityParentDelete>
+74 -7
View File
@@ -3582,7 +3582,7 @@ if(!@$db->db_query("SELECT anmerkung_student FROM public.tbl_preoutgoing LIMIT 1
if(!$db->db_query($qry))
echo '<strong>public.tbl_preoutgoing: '.$db->db_last_error().'</strong><br>';
else
echo 'Tabelle public.tbl_preoutgoing Spalten anmerkungStudent, anmerkungAdmin, studienrichtungGastuniversitaet';
echo 'Tabelle public.tbl_preoutgoing Spalten anmerkungStudent, anmerkungAdmin, studienrichtungGastuniversitaet<br>';
}
// 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 '<strong>public.tbl_person: '.$db->db_last_error().'</strong><br>';
else
echo 'Tabelle public.tbl_person Spalte foto_intern hinzugefuegt';
echo 'Tabelle public.tbl_person Spalte foto_intern hinzugefuegt<br>';
}
// 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 '<strong>wawi.tbl_betriebsmittel: '.$db->db_last_error().'</strong><br>';
else
echo 'Tabelle wawi.tbl_betriebsmittel Spalte nummer2 hinzugefuegt';
echo 'Tabelle wawi.tbl_betriebsmittel Spalte nummer2 hinzugefuegt<br>';
}
// 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 '<strong>testtool.vw_auswertung_kategorie_semester: '.$db->db_last_error().'</strong><br>';
else
echo 'View testtool.vw_auswertung_kategorie_semester hinzugefuegt';
echo 'View testtool.vw_auswertung_kategorie_semester hinzugefuegt<br>';
}
// 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 '<strong>public.tbl_gruppe: '.$db->db_last_error().'</strong><br>';
else
echo 'Tabelle public.tbl_gruppe Spalte gesperrt hinzugefuegt';
echo 'Tabelle public.tbl_gruppe Spalte gesperrt hinzugefuegt<br>';
}
// 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 '<strong>public.tbl_fotostatus: '.$db->db_last_error().'</strong><br>';
else
echo 'Tabelle public.tbl_fotostatus und public.tbl_person_fotostatus hinzugefuegt<br>';
}
// 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 '<strong>wawi.tbl_betriebsmittelperson: '.$db->db_last_error().'</strong><br>';
else
echo 'Tabelle wawi.tbl_betriebsmittelperson Spalte uid hinzugefuegt<br>';
}
echo '<br>';
@@ -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"),
+243
View File
@@ -0,0 +1,243 @@
<?php
/* Copyright (C) 2012 FH Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at>
*/
/**
* 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 '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../skin/fhcomplete.css" type="text/css">
<link rel="stylesheet" href="../../skin/vilesci.css" type="text/css">
<title>Profilfoto Check</title>
</head>
<body>
<h2>Profilfoto Check</h2>
';
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 '<span class="ok">Profilbild wurde akzeptiert</span>';
}
else
{
echo '<span class="error">Fehler beim Akzeptieren:'.$fs->errormsg.'</span>';
$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 '<span class="ok">Infomail wurde versendet an '.$to.'</span>';
}
else
{
echo '<span class="error">Fehler beim Versenden des Mails an '.$to.'</span>';
$error = true;
}
}
else
{
echo '<span class="error">Keine Mail Adresse gefunden</span>';
$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 '<span class="error">Fehler beim Setzen des abgewiesen Status:'.$fs->errormsg.'</span>';
$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 '
<br><br><br>
<center>
<table>
<tr>
<td>
<img src="../../content/bild.php?src=person&person_id='.$row->person_id.'" height="100px" width="75px">
</td>
<td>&nbsp;</td>
<td>
Vorname: '.$db->convert_html_chars($row->vorname).'<br>
Nachname: '.$db->convert_html_chars($row->nachname).'<br>
'.($row->mitarbeiter=='1'?'Mitarbeiter':'Student').'
</td>
</tr>
</table>';
echo '<br><br>';
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
echo '<input type="hidden" name="person_id" value="'.$db->convert_html_chars($row->person_id).'" />';
echo '<input type="submit" name="akzeptieren" value="Akzeptieren" /> &nbsp;&nbsp;&nbsp;';
echo '<input type="submit" name="fehlerhaft" value="Fehlerhaft / Infomail" /> &nbsp;&nbsp;&nbsp;';
echo '<input type="submit" name="bestof" value="BestOf" /> ';
echo '</form>';
echo '</center>';
}
else
{
echo 'Es sind keine ungeprüften Bilder vorhanden';
}
}
echo '</body>
</html>';
?>