Bildprüfung Abfragekorrektur und Bildzuschnitt

Die Bildprüfung checkt nun ob eine Akte mit Lichtbild vorhanden ist. Bild wird entweder aus der Akte oder aus der Person geladen.
Bildzuschnitt mit Croppie hinzugefügt.
This commit is contained in:
Manfred Kindl
2018-08-20 16:25:22 +02:00
parent 1b644e1fa8
commit 83efd6205f
4 changed files with 964 additions and 12 deletions
+250
View File
@@ -0,0 +1,250 @@
.croppie-container {
width: 100%;
height: 100%;
}
.croppie-container .cr-image {
z-index: -1;
position: absolute;
top: 0;
left: 0;
transform-origin: 0 0;
max-height: none;
max-width: none;
}
.croppie-container .cr-boundary {
position: relative;
overflow: hidden;
margin: 0 auto;
z-index: 1;
width: 100%;
height: 100%;
}
.croppie-container .cr-viewport,
.croppie-container .cr-resizer {
position: absolute;
border: 2px solid #fff;
margin: auto;
top: 0;
bottom: 0;
right: 0;
left: 0;
box-shadow: 0 0 2000px 2000px rgba(0, 0, 0, 0.5);
z-index: 0;
}
.croppie-container .cr-resizer {
z-index: 2;
box-shadow: none;
pointer-events: none;
}
.croppie-container .cr-resizer-vertical,
.croppie-container .cr-resizer-horisontal {
position: absolute;
pointer-events: all;
}
.croppie-container .cr-resizer-vertical::after,
.croppie-container .cr-resizer-horisontal::after {
display: block;
position: absolute;
box-sizing: border-box;
border: 1px solid black;
background: #fff;
width: 10px;
height: 10px;
content: '';
}
.croppie-container .cr-resizer-vertical {
bottom: -5px;
cursor: row-resize;
width: 100%;
height: 10px;
}
.croppie-container .cr-resizer-vertical::after {
left: 50%;
margin-left: -5px;
}
.croppie-container .cr-resizer-horisontal {
right: -5px;
cursor: col-resize;
width: 10px;
height: 100%;
}
.croppie-container .cr-resizer-horisontal::after {
top: 50%;
margin-top: -5px;
}
.croppie-container .cr-original-image {
display: none;
}
.croppie-container .cr-vp-circle {
border-radius: 50%;
}
.croppie-container .cr-overlay {
z-index: 1;
position: absolute;
cursor: move;
touch-action: none;
}
.croppie-container .cr-slider-wrap {
width: 75%;
margin: 15px auto;
text-align: center;
}
.croppie-result {
position: relative;
overflow: hidden;
}
.croppie-result img {
position: absolute;
}
.croppie-container .cr-image,
.croppie-container .cr-overlay,
.croppie-container .cr-viewport {
-webkit-transform: translateZ(0);
-moz-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
}
/*************************************/
/***** STYLING RANGE INPUT ***********/
/*************************************/
/*http://brennaobrien.com/blog/2014/05/style-input-type-range-in-every-browser.html */
/*************************************/
.cr-slider {
-webkit-appearance: none;
/*removes default webkit styles*/
/*border: 1px solid white; *//*fix for FF unable to apply focus style bug */
width: 300px;
/*required for proper track sizing in FF*/
max-width: 100%;
padding-top: 8px;
padding-bottom: 8px;
background-color: transparent;
}
.cr-slider::-webkit-slider-runnable-track {
width: 100%;
height: 3px;
background: rgba(0, 0, 0, 0.5);
border: 0;
border-radius: 3px;
}
.cr-slider::-webkit-slider-thumb {
-webkit-appearance: none;
border: none;
height: 16px;
width: 16px;
border-radius: 50%;
background: #ddd;
margin-top: -6px;
}
.cr-slider:focus {
outline: none;
}
/*
.cr-slider:focus::-webkit-slider-runnable-track {
background: #ccc;
}
*/
.cr-slider::-moz-range-track {
width: 100%;
height: 3px;
background: rgba(0, 0, 0, 0.5);
border: 0;
border-radius: 3px;
}
.cr-slider::-moz-range-thumb {
border: none;
height: 16px;
width: 16px;
border-radius: 50%;
background: #ddd;
margin-top: -6px;
}
/*hide the outline behind the border*/
.cr-slider:-moz-focusring {
outline: 1px solid white;
outline-offset: -1px;
}
.cr-slider::-ms-track {
width: 100%;
height: 5px;
background: transparent;
/*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead */
border-color: transparent;/*leave room for the larger thumb to overflow with a transparent border */
border-width: 6px 0;
color: transparent;/*remove default tick marks*/
}
.cr-slider::-ms-fill-lower {
background: rgba(0, 0, 0, 0.5);
border-radius: 10px;
}
.cr-slider::-ms-fill-upper {
background: rgba(0, 0, 0, 0.5);
border-radius: 10px;
}
.cr-slider::-ms-thumb {
border: none;
height: 16px;
width: 16px;
border-radius: 50%;
background: #ddd;
margin-top:1px;
}
.cr-slider:focus::-ms-fill-lower {
background: rgba(0, 0, 0, 0.5);
}
.cr-slider:focus::-ms-fill-upper {
background: rgba(0, 0, 0, 0.5);
}
/*******************************************/
/***********************************/
/* Rotation Tools */
/***********************************/
.cr-rotate-controls {
position: absolute;
bottom: 5px;
left: 5px;
z-index: 1;
}
.cr-rotate-controls button {
border: 0;
background: none;
}
.cr-rotate-controls i:before {
display: inline-block;
font-style: normal;
font-weight: 900;
font-size: 22px;
}
.cr-rotate-l i:before {
content: '↺';
}
.cr-rotate-r i:before {
content: '↻';
}
+40 -12
View File
@@ -342,12 +342,13 @@ $qry_anzahl_mitarbeiter = "
FROM
public.tbl_person
JOIN public.tbl_benutzer USING(person_id)
JOIN public.tbl_akte USING (person_id)
LEFT JOIN PUBLIC.tbl_akte ON (tbl_akte.person_id = tbl_person.person_id
AND tbl_akte.dokument_kurzbz = 'Lichtbil'
AND (tbl_akte.inhalt IS NOT NULL OR tbl_akte.dms_id IS NOT NULL))
LEFT JOIN public.tbl_mitarbeiter ON (tbl_benutzer.uid=mitarbeiter_uid)
WHERE
foto is not NULL
AND tbl_benutzer.aktiv
AND tbl_akte.dokument_kurzbz='Lichtbil'
AND 'akzeptiert' 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)
AND 'abgewiesen' NOT IN (SELECT fotostatus_kurzbz FROM public.tbl_person_fotostatus
@@ -367,12 +368,13 @@ $qry_anzahl_studenten = "
FROM
public.tbl_person
JOIN public.tbl_benutzer USING(person_id)
JOIN public.tbl_akte USING (person_id)
LEFT JOIN PUBLIC.tbl_akte ON (tbl_akte.person_id = tbl_person.person_id
AND tbl_akte.dokument_kurzbz = 'Lichtbil'
AND (tbl_akte.inhalt IS NOT NULL OR tbl_akte.dms_id IS NOT NULL))
LEFT JOIN public.tbl_mitarbeiter ON (tbl_benutzer.uid=mitarbeiter_uid)
WHERE
foto is not NULL
AND tbl_benutzer.aktiv
AND tbl_akte.dokument_kurzbz='Lichtbil'
AND 'akzeptiert' 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)
AND 'abgewiesen' NOT IN (SELECT fotostatus_kurzbz FROM public.tbl_person_fotostatus
@@ -392,11 +394,12 @@ $qry_anzahl_gesamt = "
FROM
public.tbl_person
JOIN public.tbl_benutzer USING(person_id)
JOIN public.tbl_akte USING (person_id)
LEFT JOIN PUBLIC.tbl_akte ON (tbl_akte.person_id = tbl_person.person_id
AND tbl_akte.dokument_kurzbz = 'Lichtbil'
AND (tbl_akte.inhalt IS NOT NULL OR tbl_akte.dms_id IS NOT NULL))
WHERE
foto is not NULL
AND tbl_benutzer.aktiv
AND tbl_akte.dokument_kurzbz='Lichtbil'
AND 'akzeptiert' 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)
AND 'abgewiesen' NOT IN (SELECT fotostatus_kurzbz FROM public.tbl_person_fotostatus
@@ -418,24 +421,29 @@ echo '<form action="'.$_SERVER['PHP_SELF'].'" method="POST" style="float:left">
// Laden einer Person deren Profilfoto noch nicht akzeptiert wurde
$qry = "
SELECT
*,
tbl_person.person_id,
tbl_person.vorname,
tbl_person.nachname,
tbl_akte.dokument_kurzbz,
tbl_akte.dms_id,
(SELECT 1 FROM public.tbl_mitarbeiter JOIN public.tbl_benutzer ON(mitarbeiter_uid=uid)
WHERE person_id=tbl_person.person_id LIMIT 1) as mitarbeiter
FROM
public.tbl_person
JOIN public.tbl_benutzer USING(person_id)
JOIN public.tbl_akte USING (person_id)
LEFT JOIN PUBLIC.tbl_akte ON (tbl_akte.person_id = tbl_person.person_id
AND tbl_akte.dokument_kurzbz = 'Lichtbil'
AND (tbl_akte.inhalt IS NOT NULL OR tbl_akte.dms_id IS NOT NULL))
WHERE
foto is not NULL
AND tbl_benutzer.aktiv
AND tbl_akte.dokument_kurzbz='Lichtbil'
".$ansicht;
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);
$qry.=" AND tbl_person.person_id=".$db->db_add_param($person_id);
}
else
{
@@ -470,7 +478,22 @@ if($result = $db->db_query($qry))
<table style="position: relative;">
<tr>
<td class="hoverbox">
<a href="#"><p class="previewtext">Originalvorschau</p><img id="image" class="image" src="../../content/bild.php?src=akte&person_id='.$row->person_id.'"><img id="imagepreview" src="../../content/bild.php?src=akte&person_id='.$row->person_id.'" class="preview"></a>
<a href="#">';
// Wenn es keine Akte mit Lichtbild gibt, das Foto der Person laden, sonst aus der Akte
if ($row->dokument_kurzbz == 'Lichtbil')
{
echo ' <p class="previewtext">Originalvorschau</p>
<img id="image" class="image" src="../../content/bild.php?src=akte&person_id='.$row->person_id.'">
<img id="imagepreview" src="../../content/bild.php?src=akte&person_id='.$row->person_id.'" class="preview">';
}
else
{
echo ' <p class="previewtext">Originalvorschau</p>
<img id="image" class="image" src="../../content/bild.php?src=person&person_id='.$row->person_id.'">
<img id="imagepreview" src="../../content/bild.php?src=person&person_id='.$row->person_id.'" class="preview">';
}
echo '
</a>
<br>
<div id="imagesize"></div>
</td>
@@ -493,7 +516,12 @@ if($result = $db->db_query($qry))
echo '<input type="submit" name="refresh" value="Refresh" /> ';
echo '</form>';
echo '<br><br><br>';
echo '<a href="#FotoUpload" onclick="window.open(\'../../content/bildupload.php?person_id='.$row->person_id.'\',\'BildUpload\', \'height=50,width=600,left=0,top=0,hotkeys=0,resizable=yes,status=no,scrollbars=yes,toolbar=no,location=no,menubar=no,dependent=yes\'); return false;">Bild Upload</a>';
// Wenn es eine Akte mit Lichtbild gibt, das Foto aus der Akte laden (Parameter Akte im Link) sonst aus der Person
if ($row->dokument_kurzbz == 'Lichtbil')
echo '<a href="#FotoUpload" onclick="window.open(\'bildzuschnitt.php?person_id='.$row->person_id.'&typ=akte\',\'BildUpload\', \'height=900,width=700,left=0,top=0,hotkeys=0,resizable=yes,status=no,scrollbars=yes,toolbar=no,location=no,menubar=no,dependent=yes\'); return false;">Bild zuschneiden/Upload</a>';
else
echo '<a href="#FotoUpload" onclick="window.open(\'bildzuschnitt.php?person_id='.$row->person_id.'&typ=person\',\'BildUpload\', \'height=900,width=700,left=0,top=0,hotkeys=0,resizable=yes,status=no,scrollbars=yes,toolbar=no,location=no,menubar=no,dependent=yes\'); return false;">Bild zuschneiden/Upload</a>';
if ($row->dms_id !='')
{
echo '<br><br>';
+429
View File
@@ -0,0 +1,429 @@
<?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: Manfred Kindl <manfred.kindl@technikum-wien.at>
*/
require_once ('../../config/cis.config.inc.php');
require_once ('../../config/global.config.inc.php');
require_once ('../../include/functions.inc.php');
require_once ('../../include/person.class.php');
require_once ('../../include/prestudent.class.php');
require_once ('../../include/benutzerberechtigung.class.php');
require_once ('../../include/akte.class.php');
require_once ('../../include/dokument.class.php');
require_once ('../../include/mail.class.php');
require_once ('../../include/phrasen.class.php');
require_once ('../../include/dms.class.php');
require_once ('../../include/fotostatus.class.php');
require_once ('../../include/studiensemester.class.php');
require_once ('../../include/nation.class.php');
require_once ('../../include/personlog.class.php');
//require_once ('../bewerbung.config.inc.php');
//require_once ('../include/functions.inc.php');
header("Content-Type: text/html; charset=utf-8");
// session_cache_limiter('none'); //muss gesetzt werden sonst funktioniert der Download mit IE8 nicht
// session_start();
$sprache = getSprache();
$p = new phrasen($sprache);
$log = new personlog();
$db = new basis_db();
if (isset($_GET['lang']))
setSprache($_GET['lang']);
$person_id = isset($_GET['person_id']) ? $_GET['person_id'] : '';
$typ = isset($_GET['typ']) ? $_GET['typ'] : 'akte'; // Parameter ob das Bild aus der Akte oder der Person geladen werden soll
$uid = get_uid();
$rechte = new benutzerberechtigung();
$rechte->getBerechtigungen($uid);
if(!$rechte->isBerechtigt('basis/fhausweis','suid'))
{
die($rechte->errormsg);
}
$dokumenttyp = 'Lichtbil';
$error = '';
$message = '';
$dokumenttyp_upload = '';
$PHP_SELF = $_SERVER['PHP_SELF']; ?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title><?php echo $p->t('bewerbung/fileUpload'); ?></title>
<link rel="stylesheet" href="../../skin/croppie.css">
<link rel="stylesheet" type="text/css" href="../../vendor/twbs/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../../skin/fhcomplete.css">
<script type="text/javascript" src="../../vendor/jquery/jqueryV1/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="../../vendor/twbs/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="../../include/js/croppie.js"></script>
<script type="text/javascript">
function showExtensionInfo()
{
var typ = 'Lichtbil';
var extinfo = "";
var fileReaderSupport = true;
// Check for support of FileReader.
if ( !window.FileReader || !window.File || !window.FileList || !window.Blob )
fileReaderSupport = false;
// Lichtbilder werden mit Croppie zugeschnitten und in imageupload.php hochgeladen
if (typ == 'Lichtbil' && fileReaderSupport)
{
imageUpload();
}
else
{
$(".croppie-container").empty();
}
};
function imageUpload()
{
$uploadCrop = $(".croppie-container").croppie({
enableExif: true,
enforceBoundary: true,
enableOrientation: true,
viewport: {
width: 240,
height: 320
},
boundary: {
width: 400,
height: 400
}
});
// $(".croppie-container").addClass("ready");
// $uploadCrop.croppie("bind",
// {
// url: 'Mani.jpg'
// }).then(function()
// {
// console.log("jQuery bind complete");
// });
// Empfehlung von https://www.passbildgroesse.de/ sind 827x1063. Das Seitenverhältnis 828x1104 passt aber besser zum FH-Ausweis
$("#fileselect").on("change", function () { readFile(this); });
$("#submitimage").on("click", function (ev)
{
// Check ob File gewählt wurde
// if ($('input[type=file]').val() == '')
// {
// $("#messages").empty();
// $("#messages").html( '<div class="alert alert-danger" id="danger-alert_dms_akteupload">'+
// '<button type="button" class="close" data-dismiss="alert">x</button>'+
// '<strong>No file selected</strong>'+
// '</div>');
// }
// else
{
$uploadCrop.croppie("result", {
type: "base64",
// size: {width: 828, height: 1104},
size: "original",
format: 'jpeg',
backgroundColor: '#DDDDDD'
}).then(function (resultdata) {
var src = resultdata;
var person_id = <?php echo $person_id; ?>;
var filename = $('input[type=file]').val().split('\\').pop();
//in imageupload.php wird das Bild verarbeitet und abgespeichert
$.post(
"imageupload.php",
{src: src, person_id: person_id, img_filename: filename, img_type: 'image/jpeg'},
function(data)
{
if (data.type == "success")
{
$("#messages").empty();
$("#messages").html( '<div class="alert alert-success" id="success-alert_dms_akteupload">'+
'<button type="button" class="close" data-dismiss="alert">x</button>'+
'<strong>'+data.msg+'</strong>'+
'</div>');
window.setTimeout(function()
{
$("#success-alert_dms_akteupload").fadeTo(500, 0).slideUp(500, function(){
$(this).remove();
});
//window.location.href = 'dms_akteupload.php?person_id=<?php echo $person_id; ?>';
//window.opener.location = 'bewerbung.php?active=dokumente';
}, 1000);
}
else if (data.type == "error")
{
$("#messages").empty();
$("#messages").html( '<div class="alert alert-danger" id="danger-alert_dms_akteupload">'+
'<button type="button" class="close" data-dismiss="alert">x</button>'+
'<strong>'+data.msg+'</strong>'+
'</div>');
}
},
"json"
);
});
}
});
};
$(function()
{
showExtensionInfo();
window.resizeTo(700, $('#documentForm').height() + 100);
});
function readFile(input)
{
if (input.files && input.files[0])
{
var reader = new FileReader();
reader.onload = function (e)
{
var image = new Image();
image.src = e.target.result;
image.onload = function () {
// Check auf Filetype
var splittedSource = this.src.split(';'); // base64 String splitten
var filetype = splittedSource[0];
if (filetype != 'data:image/jpeg' && filetype != 'data:image/jpg')
{
alert("Das Bild muss von Typ .jpg sein");
return false;
}
// Check auf Bildgroeße
var height = this.height;
var width = this.width;
if (height < 320 || width < 240)
{
alert("Das Bild muss mindestens die Auflösung 240x320 Pixel haben.\nBitte wählen Sie ein größeres Bild.");
return false;
}
else
{
$(".croppie-container").addClass("ready");
$uploadCrop.croppie("bind",
{
url: e.target.result
}).then(function()
{
console.log("jQuery bind complete");
});
}
};
}
reader.readAsDataURL(input.files[0]);
}
else
{
alert("Sorry - you\'re browser doesn\'t support the FileReader API");
}
};
window.setTimeout(function()
{
$("#success-alert_dms_akteupload").fadeTo(500, 0).slideUp(500, function(){
$(this).remove();
});
}, 1500);
</script>
<style>
body
{
margin:10px;
}
.errorAusstellungsnation
{
border-color: #a94442;
}
</style>
</head>
<body>
<?php
echo '<div class="container" id="messages">';
if ($error === false)
{
echo '<div class="alert alert-success" id="success-alert_dms_akteupload">
<button type="button" class="close" data-dismiss="alert">x</button>
<strong>'.$message.'</strong>
</div>';
}
elseif ($error === true)
{
echo '<div class="alert alert-danger" id="danger-alert_dms_akteupload">
<button type="button" class="close" data-dismiss="alert">x</button>
<strong>'.$p->t('global/fehleraufgetreten').' </strong>'.$message.'
</div>';
}
echo '</div>';
if ($person_id != '')
{
echo '
<form id="documentForm" method="POST" enctype="multipart/form-data" action="' . $PHP_SELF . '?person_id=' . $person_id . '&dokumenttyp=' . $dokumenttyp . '" class="form-horizontal">
<div class="container"> <br />
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><strong>Upload Image</strong></div>
<div class="panel-body">';
// Container für Bildzuschnitt
echo '<div class=""><img class="croppie-container" src="../../content/bild.php?src='.$typ.'&person_id='.$person_id.'" /></div>';
echo'
<div class="">
<input id="fileselect" type="file" name="file" class="file" />
</div><br>
<input id="submitimage" type="button" name="submitimage" value="Upload" class="btn btn-labeled btn-primary">
<input type="hidden" name="fileupload" id="fileupload">
</div>
</div>
</div>
</div>
</div>
</form>';
}
else
{
echo $p->t('bewerbung/fehlerKeinePersonId');
}
function resize($filename, $width, $height)
{
$ext = explode('.', $_FILES['file']['name']);
$ext = mb_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;
$tmpfname = tempnam(sys_get_temp_dir(), 'FHC');
imagejpeg($image_p, $tmpfname, 80);
imagedestroy($image_p);
@imagedestroy($image);
return $tmpfname;
}
// Sendet eine Email an die Assistenz, dass ein neues Dokument hochgeladen wurde
function sendDokumentupload($empfaenger_stgkz, $dokument_kurzbz, $orgform_kurzbz, $studiensemester_kurzbz, $prestudent_id, $dms_id)
{
global $person_id, $p;
// Array fuer Mailempfaenger. Vorruebergehende Loesung. Kindlm am 28.10.2015
$empf_array = array();
if (defined('BEWERBERTOOL_UPLOAD_EMPFAENGER'))
$empf_array = unserialize(BEWERBERTOOL_UPLOAD_EMPFAENGER);
$person = new person();
$person->load($person_id);
$dokumentbezeichnung = '';
$studiengang = new studiengang();
$studiengang->load($empfaenger_stgkz);
$typ = new studiengang();
$typ->getStudiengangTyp($studiengang->typ);
$email = $p->t('bewerbung/emailDokumentuploadStart');
$email .= '<br><table style="font-size:small"><tbody>';
$email .= '<tr><td><b>' . $p->t('global/studiengang') . '</b></td><td>' . $typ->bezeichnung . ' ' . $studiengang->bezeichnung . ($orgform_kurzbz != '' ? ' (' . $orgform_kurzbz . ')' : '') . '</td></tr>';
$email .= '<tr><td><b>' . $p->t('global/studiensemester') . '</b></td><td>' . $studiensemester_kurzbz . '</td></tr>';
$email .= '<tr><td><b>' . $p->t('global/name') . '</b></td><td>' . $person->vorname . ' ' . $person->nachname . '</td></tr>';
$email .= '<tr><td><b>' . $p->t('bewerbung/dokument') . '</b></td><td>';
$akte = new akte();
$akte->getAkten($person_id, $dokument_kurzbz);
foreach ($akte->result as $row)
{
$dokument = new dokument();
$dokument->loadDokumenttyp($row->dokument_kurzbz);
if ($row->insertvon == 'online')
{
if ($row->nachgereicht == true)
$email .= '- ' . $dokument->bezeichnung_mehrsprachig[DEFAULT_LANGUAGE] . ' -> ' . $p->t('bewerbung/dokumentWirdNachgereicht') . '<br>';
else
$email .= '<a href="' . APP_ROOT . 'cms/dms.php?id=' . $dms_id . '">' . $dokument->bezeichnung_mehrsprachig[DEFAULT_LANGUAGE] . ' [' . $row->bezeichnung . ']</a><br>';
$dokumentbezeichnung = $dokument->bezeichnung_mehrsprachig[DEFAULT_LANGUAGE];
}
}
$email .= '</td>';
$email .= '<tr><td><b>' . $p->t('bewerbung/prestudentID') . '</b></td><td>' . $prestudent_id . '</td></tr>';
$email .= '</tbody></table>';
$email .= '<br>' . $p->t('bewerbung/emailBodyEnde');
// An der FHTW werden alle Mails von Bachelor-Studiengängen an das Infocenter geschickt, solange die Bewerbung noch nicht bestätigt wurde
if (CAMPUS_NAME == 'FH Technikum Wien')
{
if( defined('BEWERBERTOOL_MAILEMPFANG') &&
BEWERBERTOOL_MAILEMPFANG != '' &&
$studiengang->typ == 'b')
{
$empfaenger = BEWERBERTOOL_MAILEMPFANG;
}
else
$empfaenger = getMailEmpfaenger($studiengang->typ, '', $orgform_kurzbz);
}
else
{
$empfaenger = getMailEmpfaenger($empfaenger_stgkz);
}
$mail = new mail($empfaenger, 'no-reply', $p->t('bewerbung/dokumentuploadZuBewerbung', array(
$dokumentbezeichnung
)) . ' ' . $person->vorname . ' ' . $person->nachname, 'Bitte sehen Sie sich die Nachricht in HTML Sicht an, um den Link vollständig darzustellen.');
$mail->setHTMLContent($email);
if (! $mail->send())
return false;
else
return true;
}
?>
</body>
</html>
+245
View File
@@ -0,0 +1,245 @@
<?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: Manfred Kindl <manfred.kindl@technikum-wien.at>
*/
header("Content-Type: text/html; charset=utf-8");
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');
require_once ('../../include/fotostatus.class.php');
require_once ('../../include/dms.class.php');
require_once ('../../include/benutzerberechtigung.class.php');
$sprache = getSprache();
$p = new phrasen($sprache);
$uid = get_uid();
$rechte = new benutzerberechtigung();
$rechte->getBerechtigungen($uid);
if(!$rechte->isBerechtigt('basis/fhausweis','suid'))
{
die($rechte->errormsg);
}
// Bild kommt im Seitenverhältnis 3:4 passend für FH-Ausweis
$base64_src = isset($_POST['src']) ? $_POST['src'] : die($p->t('global/fehlerBeiDerParameteruebergabe').'"src"');
$person_id = isset($_POST['person_id']) ? $_POST['person_id'] : die($p->t('global/fehlerBeiDerParameteruebergabe').'"person_id"');
$img_filename = isset($_POST['img_filename']) ? $_POST['img_filename'] : die($p->t('global/fehlerBeiDerParameteruebergabe').'"img_filename"');
$img_type = isset($_POST['img_type']) ? $_POST['img_type'] : die($p->t('global/fehlerBeiDerParameteruebergabe').'"img_type"');
$result_obj = array();
// Entfernt den data-string (data:image/png;base64,) vom Beginn des Codes damit nur der reine base64 Code zurueckgegeben wird
$base64_src = (preg_replace('/^data:(.*?)base64,/', '', $base64_src));
// Falls die $base64_src danach leer sein sollte, wird abgebrochen
if ($base64_src == '')
{
$result_obj['type'] = "error";
$result_obj['msg'] = "<b>Fehler: $akte->errormsg</b>";
echo json_encode($result_obj);
exit;
}
function resize($base64, $width, $height) // 828 x 1104 -> 240 x 320
{
ob_start();
$image = imagecreatefromstring (base64_decode($base64));
// Hoehe und Breite neu berechnen
list ($width_orig, $height_orig) = getimagesizefromstring (base64_decode($base64));
if ($width && ($width_orig < $height_orig))
{
$width = intval(($height / $height_orig) * $width_orig);
}
else
{
$height = intval(($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);
$retval = ob_get_contents();
ob_end_clean();
$retval = base64_encode($retval);
@imagedestroy($image_p);
@imagedestroy($image);
return $retval;
}
// Wenn der Fotostatus "Akzeptiert" ist, darf kein neues Foto hochgeladen werden
// Auskommentiert, da mit Recht basis/fhausweis schon möglich
/*$fs = new fotostatus();
if ($fs->akzeptiert($person_id))
die($p->t('profil/profilfotoUploadGesperrt'));*/
// DMS eintrag erstellen
$ext = strtolower(pathinfo($img_filename, PATHINFO_EXTENSION));
$dms_filename = uniqid();
$dms_filename .= "." . $ext;
$filename_path = DMS_PATH . $dms_filename;
// Im DMS wird das Bild in der Originalauflösung von 828x1104 gespeichert
$newfile = fopen($filename_path, 'w');
fwrite($newfile, base64_decode($base64_src));
if (fclose($newfile))
{
// Wenn Akte mit DMS-ID vorhanden, dann neue DMS-Version hochladen
$akte = new akte();
$version = '0';
$dms_id = '';
if ($akte->getAkten($person_id, 'Lichtbil'))
{
// Erste Akte @todo: Ist auch so in content/akte.php. Kann irrefuehrende Ergebisse liefern, wenn bereits mehrere Akten des selben Typs vorhanden sind.
if (isset($akte->result[0]))
{
$akte = $akte->result[0];
if ($akte->dms_id != '')
{
$dms = new dms();
$dms->load($akte->dms_id);
$version = $dms->version + 1;
$dms_id = $akte->dms_id;
}
}
}
$dms = new dms();
$dms->dms_id = $dms_id;
$dms->version = $version;
$dms->kategorie_kurzbz = 'Akte';
$dms->insertamum = date('Y-m-d H:i:s');
$dms->insertvon = $uid;
$dms->mimetype = cutString($img_type, 256);
$dms->filename = $dms_filename;
$dms->name = cutString($img_filename, 256, '~', true);
if ($dms->save(true))
{
$dms_id = $dms->dms_id;
$akte = new akte();
if ($akte->getAkten($person_id, 'Lichtbil'))
{
if (count($akte->result) > 0)
{
$akte = $akte->result[0];
$akte->new = false;
$akte->updateamum = date('Y-m-d H:i:s');
$akte->updatevon = $uid;
}
else
{
$akte->new = true;
$akte->insertamum = date('Y-m-d H:i:s');
$akte->insertvon = $uid;
}
}
else
{
$akte->new = true;
$akte->insertamum = date('Y-m-d H:i:s');
$akte->insertvon = $uid;
}
$akte->dokument_kurzbz = 'Lichtbil';
$akte->person_id = $person_id;
//$akte->inhalt = base64_encode($content); Fotos werden nur als DMS und in tbl_person gespeichert
$akte->mimetype = $img_type;
$akte->erstelltam = date('Y-m-d H:i:s');
$akte->gedruckt = false;
$akte->titel = cutString($img_filename, 32, '~', true); // Filename
$akte->bezeichnung = "Lichtbild gross";
$akte->uid = '';
$akte->nachgereicht = false;
// $akte->anmerkung = ''; Auch bei nachträglichem Upload bleibt die Anmerkung erhalten
$akte->dms_id = $dms_id;
if (! $akte->save())
{
$result_obj['type'] = "error";
$result_obj['msg'] = "<b>Fehler: $akte->errormsg</b>";
echo json_encode($result_obj);
}
}
else
{
$result_obj['type'] = "error";
$result_obj['msg'] = $p->t('global/fehlerBeimSpeichernDerDaten');
echo json_encode($result_obj);
}
}
else
{
$result_obj['type'] = "error";
$result_obj['msg'] = $p->t('global/dateiNichtErfolgreichHochgeladen');
echo json_encode($result_obj);
}
// Bild in tbl_person auf 240x320 skalieren
$base64_src = resize($base64_src, 240, 320);
$person = new person();
if ($person->load($person_id))
{
// base64 Wert in die Datenbank speichern
$person->foto = $base64_src;
$person->new = false;
// Fotostatus auf "hochgeladen" setzen
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 = $uid;
$fs->updateamum = date('Y-m-d H:i:s');
$fs->updatevon = $uid;
if (! $fs->save(true))
echo '<span class="error">Fehler beim Setzen des Bildstatus</span>';
else
{
$result_obj['type'] = "success";
$result_obj['msg'] = "<b>Bild wurde erfolgreich gespeichert</b>";
echo json_encode($result_obj);
}
}
else
{
$result_obj['type'] = "error";
$result_obj['msg'] = "<b>" . $person->errormsg . "</b>";
echo json_encode($result_obj);
}
}