Prestudententool angelegt - Studenten können bevor sie einen Account besitzen schon ein Bild hochladen

This commit is contained in:
Karl Burkhart
2012-06-25 13:24:55 +00:00
parent fab0fa9971
commit f55dd5a423
5 changed files with 550 additions and 0 deletions
+203
View File
@@ -0,0 +1,203 @@
<?php
/* Copyright (C) 2006 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: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl < rudolf.hangl@technikum-wien.at >
* Gerald Simane-Sequens < gerald.simane-sequens@technikum-wien.at >
*
*/
// Oberflaeche zum Upload von Bildern
session_start();
require_once('../../config/cis.config.inc.php');
require_once('../../include/functions.inc.php');
require_once('../../include/person.class.php');
require_once('../../include/benutzer.class.php');
require_once('../../include/akte.class.php');
require_once('../../include/phrasen.class.php');
//$user = get_uid(); Besitzt noch keine uid
$user = '';
$sprache = getSprache();
$p = new phrasen($sprache);
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../../skin/style.css.php" rel="stylesheet" type="text/css">
<title>'.$p->t('profil/Bildupload').'</title>
</head>
<body>
<h1>'.$p->t('profil/Bildupload').'</h1>';
if(!isset($_SESSION['prestudent/user']) || $_SESSION['prestudent/user']=='')
exit('Keine Berechtigung zum Bildupload.');
function resize($filename, $width, $height)
{
$ext = explode('.',$_FILES['bild']['name']);
$ext = strtolower($ext[count($ext)-1]);
// Hoehe und Breite neu berechnen
list($width_orig, $height_orig) = getimagesize($filename);
if ($width && ($width_orig < $height_orig))
{
$width = ($height / $height_orig) * $width_orig;
}
else
{
$height = ($width / $width_orig) * $height_orig;
}
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
//Bild nur verkleinern aber nicht vergroessern
if($width_orig>$width || $height_orig>$height)
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
else
$image_p = $image;
imagejpeg($image_p, $filename, 80);
@imagedestroy($image_p);
@imagedestroy($image);
}
if(!isset($_GET['person_id']))
die($p->t('global/fehlerBeiDerParameteruebergabe'));
//Bei Upload des Bildes
if(isset($_POST['submitbild']))
{
if(isset($_FILES['bild']['tmp_name']))
{
//Extension herausfiltern
$ext = explode('.',$_FILES['bild']['name']);
$ext = mb_strtolower($ext[count($ext)-1]);
$width=101;
$height=130;
//--check that it's a jpeg
if ($ext=='jpg' || $ext=='jpeg')
{
$filename = $_FILES['bild']['tmp_name'];
//groesse auf maximal 827x1063 begrenzen
resize($filename, 827, 1063);
$fp = fopen($filename,'r');
//auslesen
$content = fread($fp, filesize($filename));
fclose($fp);
$akte = new akte();
if($akte->getAkten($_GET['person_id'], 'Lichtbil'))
{
if(count($akte->result)>0)
{
$akte = $akte->result[0];
$akte->new = false;
}
else
$akte->new = true;
}
else
{
$akte->new = true;
}
$akte->dokument_kurzbz = 'Lichtbil';
$akte->person_id = $_GET['person_id'];
$akte->inhalt = base64_encode($content);
$akte->mimetype = "image/jpg";
$akte->erstelltam = date('Y-m-d H:i:s');
$akte->gedruckt = false;
$akte->titel = "Lichtbild_".$_GET['person_id'].".jpg";
$akte->bezeichnung = "Lichtbild gross";
$akte->updateamum = date('Y-m-d H:i:s');
$akte->updatevon = $user;
$akte->insertamum = date('Y-m-d H:i:s');
$akte->insertvon = $user;
$akte->uid = '';
if(!$akte->save())
{
echo "<b>Fehler: $akte->errormsg</b>";
}
//groesse auf maximal 101x130 begrenzen
resize($filename, 101, 130);
//in DB speichern
//File oeffnen
$fp = fopen($filename,'r');
//auslesen
$content = fread($fp, filesize($filename));
fclose($fp);
//in base64-Werte umrechnen
$content = base64_encode($content);
$person = new person();
if($person->load($_GET['person_id']))
{
//base64 Wert in die Datenbank speichern
$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 />";
else
echo '<b>'.$person->errormsg.'</b><br />';
}
else
echo '<b>'.$person->errormsg.'</b><br />';
}
else
echo '<b>'.$p->t('profil/nurJPGBilder').'</b><br />';
}
}
echo '<br>';
echo $p->t('profil/BilduploadInfotext',array($p->t('dms_link/bildRichtlinien'))).'<br><br>
<form accept-charset="UTF-8" method="POST" enctype="multipart/form-data" action="'.$_SERVER['PHP_SELF'].'?person_id='.$_GET['person_id'].'">
'.$p->t('profil/Bild').': <input type="file" name="bild" />
<input type="submit" name="submitbild" value="Upload" />
</form>
</td></tr>';
?>
</body>
</html>
+32
View File
@@ -0,0 +1,32 @@
<?php
/* Copyright (C) 2012 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: Karl Burkhart <burkhart@technikum-wien.at>
*
*/
session_cache_limiter('none'); //muss gesetzt werden sonst funktioniert der Download mit IE8 nicht
session_start();
if (!isset($_SESSION['prestudent/user']) || $_SESSION['prestudent/user']=='')
{
$_SESSION['request_uri']=$_SERVER['REQUEST_URI'];
header('Location: index.php');
exit;
}
?>
+115
View File
@@ -0,0 +1,115 @@
<?php
/* Copyright (C) 2012 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: Karl Burkhart <burkhart@technikum-wien.at>
*
*/
require_once('../../../config/cis.config.inc.php');
require_once('../../../include/phrasen.class.php');
require_once('../../../include/person.class.php');
if(isset($_GET['lang']))
setSprache($_GET['lang']);
$sprache = getSprache();
$p=new phrasen($sprache);
if (isset($_POST['userid']))
{
$login = $_REQUEST['userid'];
$person = new person();
session_start();
$person_id=$person->checkZugangscode($login);
//Zugangscode wird überprüft
if($person_id != false)
{
$_SESSION['prestudent/user'] = $login;
$_SESSION['prestudent/person_id'] = $person_id;
header('Location: prestudent.php');
exit;
}
else
{
$errormsg= $p->t('incoming/ungueltigerbenutzer');
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Prestudenten-Tool</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="robots" content="noindex">
<link href="../../../skin/style.css.php" rel="stylesheet" type="text/css">
<link href="../../../include/js/tablesort/table.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0">
<tr>
<td align="left"></td>
<td align ="right"><?php
echo $p->t("global/sprache")." ";
echo '<a href="'.$_SERVER['PHP_SELF'].'?lang=English">'.$p->t("global/englisch").'</a> |
<a href="'.$_SERVER['PHP_SELF'].'?lang=German">'.$p->t("global/deutsch").'</a><br>';?>
</td>
</tr>
</table>
<form action ="index.php" method="POST">
<table border ="0" width ="100%" height="40%">
<tr height="50%">
<td align ="center" valign="center"><h3>Willkommen an der Fachhochschule Technikum Wien. <br> Bitte geben Sie Ihren Zugangscode ein: </h3><span style="font-size:1.2em"></span></td>
</tr>
<tr >
<td align="center" valign="bottom"> <img src="../../../skin/images/tw_logo_02.jpg"></td>
</tr>
</table>
<table border ="0" width ="100%">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td align="center"><input type="text" size="30" value="UserID" name ="userid" onfocus="this.value='';"></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td align="center"><input type="submit" value="Login" name="submit"></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td align="center"><div class="error"><?php if(isset($errormsg))
echo $errormsg; ?></div>
</tr>
</table>
</form>
</body>
</html>
+63
View File
@@ -0,0 +1,63 @@
<?php
/* Copyright (C) 2010 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: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Karl Burkhart <karl.burkhart@technikum-wien.at>.
*/
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Logout</title>
<script type="text/javascript">
function login()
{
document.location="index.php";
}
</script>
</head>
<body>
<?php
session_start();
session_destroy();
if(isset($_SERVER['REMOTE_USER']))
{
echo 'ACHTUNG! Sie sind per BASIC-Authentifizierung angemeldet. Ein Logout ist hierbei nicht möglich. Um sich korrekt auszuloggen schliessen Sie bitte ALLE Browserfenster.';
}
else
{
echo '
<center>
<strong>
<br />
<br />
Sie wurden erfolgreich ausgeloggt!!<br /> Sie werden sofort weitergeleitet!<br />
</strong>
<script type="text/javascript">
window.setTimeout("login()", 2500);
</script>
';
}
?>
<br />
Sollten Sie nicht weitergeleitet werden klicken Sie bitte <a href="index.php">hier</a>
</center>
</body>
</html>
+137
View File
@@ -0,0 +1,137 @@
<?php
/* Copyright (C) 2012 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: Karl Burkhart <burkhart@technikum-wien.at>
*
*/
require_once('../../../config/cis.config.inc.php');
require_once('auth.php');
require_once('../../../include/phrasen.class.php');
require_once('../../../include/person.class.php');
require_once('../../../include/datum.class.php');
require_once('../../../include/prestudent.class.php');
require_once('../../../include/studiengang.class.php');
if(isset($_GET['lang']))
setSprache($_GET['lang']);
$sprache = getSprache();
$p = new phrasen($sprache);
$person_id = $_SESSION['prestudent/person_id'];
$person = new person();
$person->load($person_id);
$datum = new datum();
$prestudent = new prestudent();
$prestudent->getPrestudenten($person->person_id);
if(isset($prestudent->result[0]->studiengang_kz ))
$studiengang_kz = $prestudent->result[0]->studiengang_kz;
else
$studiengang_kz = '';
$studiengang = new studiengang();
$studiengang->load($studiengang_kz);
$method = (isset($_GET['method'])?$_GET['method']:'');
$mail = ($studiengang->email!='')?$studiengang->email:MAIL_ADMIN;
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Prestudententool</title>
<link href="../../../skin/style.css.php" rel="stylesheet" type="text/css">
<link href="../../../include/js/tablesort/table.css" rel="stylesheet" type="text/css">
<script src="../../../include/js/tablesort/table.js" type="text/javascript"></script>
</head>
<body>
<table width="100%" border="0"> <!-- Anzeige Header -->
<tr>
<td align="left" width="33%"><a href="prestudent.php">Administration</a></td>
<td align="center" width="33%"><?php echo $person->titelpre." ".$person->vorname." ".$person->nachname." ".$person->titelpost?>
<td align ="right" width="33%"><?php
echo $p->t("global/sprache")." ";
echo '<a href="'.$_SERVER['PHP_SELF'].'?lang=English">'.$p->t("global/englisch").'</a> |
<a href="'.$_SERVER['PHP_SELF'].'?lang=German">'.$p->t("global/deutsch").'</a><br>';?></td>
</tr>
</table>
<?php
if($method == 'profil') // Profil anzeigen
{
echo '
<form method="POST" action="prestudent.php?method=profil" name="ProfilForm">
<table align="center" style="margin-top:5%;" border="0">
<tr>
<td>'.$p->t('global/vorname').':</td>
<td>'.$person->vorname.'</td>
<td rowspan="5"><img id="personimage" src="../../public/bild.php?src=person&person_id='.$person->person_id.'" alt="'.$person->person_id.'" height="100px" width="75px"></td>
</tr>
<tr>
<td>'.$p->t('global/nachname').':</td>
<td>'.$person->nachname.'</td>
</tr>
<tr>
<td>'.$p->t('global/geburtsdatum').':</td>
<td>'.$datum->formatDatum($person->gebdatum, 'd.m.Y').'</td>
</tr>
<tr>
<td>'.$p->t('global/titel').' Pre</td>
<td>'.$person->titelpre.'</td>
<tr>
<tr>
<td>'.$p->t('global/titel').' Post</td>
<td>'.$person->titelpost.'</td>
</tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><input type="button" value="'.$p->t('global/zurueck').'" onclick="window.location.href=\'prestudent.php\';"></td>
<td colspan="2"><a href="mailto:'.$mail.'">'.$p->t('global/emailAnAssistenz').'</a></td>
</tr>
</table>
</form>';
}
else // Hauptmenü anzeigen
{
echo '
<br><br><br><br>
<fieldset>
<table align ="center" border="0"> <!-- Anzeige Hauptmenü -->
<tr>
<td>1. <a href="prestudent.php?method=profil">'.$p->t('incoming/profil').'</a></td>
</tr>
<tr>';
echo "<td>2. <a href='#BildUpload' onclick='window.open(\"../bildupload.php?person_id=$person->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></td>";
echo' </tr>
</table>
<table width="100%" border="0">
<tr>
<td align="right"><a href="logout.php">'.$p->t('global/abmelden').'</a> </td>
</tr>
</table>
</fieldset>';
}
?>
</body>
</html>