diff --git a/cis/private/pers_in_grp.php b/cis/private/pers_in_grp.php index 83b15119e..e0c98097f 100644 --- a/cis/private/pers_in_grp.php +++ b/cis/private/pers_in_grp.php @@ -1,48 +1,51 @@ - * Andreas Oesterreicher - * Rudolf Hangl < rudolf.hangl@technikum-wien.at > - * Gerald Simane-Sequens < gerald.simane-sequens@technikum-wien.at > + * Andreas Oesterreicher + * Rudolf Hangl < rudolf.hangl@technikum-wien.at > + * Gerald Simane-Sequens < gerald.simane-sequens@technikum-wien.at > */ - require_once('../../config/cis.config.inc.php'); - require_once('../../include/basis_db.class.php'); - require_once('../../include/functions.inc.php'); - require_once('../../include/studiensemester.class.php'); - require_once('../../include/phrasen.class.php'); - - $sprache = getSprache(); - $p = new phrasen($sprache); - - if (!$db = new basis_db()) - die($p->t('global/fehlerBeimOeffnenDerDatenbankverbindung')); - - if (!$user=get_uid()) - die($p->t('global/fehlerBeimErmittelnDerUID')); +require_once ('../../config/cis.config.inc.php'); +require_once ('../../include/basis_db.class.php'); +require_once ('../../include/functions.inc.php'); +require_once ('../../include/studiensemester.class.php'); +require_once ('../../include/phrasen.class.php'); +require_once ('../../include/gruppe.class.php'); - $stsem_obj = new studiensemester(); - $stsem = $stsem_obj->getaktorNext(); +$sprache = getSprache(); +$p = new phrasen($sprache); + +if (! $db = new basis_db()) + die($p->t('global/fehlerBeimOeffnenDerDatenbankverbindung')); + +if (! $user = get_uid()) + die($p->t('global/fehlerBeimErmittelnDerUID')); + +$stsem_obj = new studiensemester(); +$stsem = $stsem_obj->getaktorNext(); +$ss_nearest_to_akt = $stsem_obj->getNearestFrom($stsem); + +if (check_lektor($user)) + $is_lector = true; +else + $is_lector = false; + +$gruppe_kurzbz = $_GET['grp']; + +$gruppe = new gruppe($gruppe_kurzbz); - if(check_lektor($user)) - $is_lector=true; - else - $is_lector=false; - echo ' @@ -67,37 +70,57 @@ echo ' } ); - '.$p->t('mailverteiler/personenImVerteiler').' + ' . $p->t('mailverteiler/personenImVerteiler') . ' '; - $qry = "SELECT uid, vorname, nachname FROM campus.vw_benutzer JOIN tbl_benutzergruppe USING (uid) WHERE gruppe_kurzbz='".addslashes($_GET['grp'])."' AND (studiensemester_kurzbz IS NULL OR studiensemester_kurzbz='".addslashes($stsem)."') ORDER BY nachname, vorname"; - if($result=$db->db_query($qry)) - { - echo '

'.$row=$db->db_num_rows($result).' '.$p->t('mailverteiler/personen'); - } - - echo' +$qry = "SELECT + uid, vorname, nachname + FROM + campus.vw_benutzer + JOIN + tbl_benutzergruppe USING (uid) + WHERE + gruppe_kurzbz='" . addslashes($gruppe_kurzbz) . "'"; + // Fuer den Studiengang EWU wird zusaetzlich das aktuelle Studiensemester ermittelt + if ($gruppe->studiengang_kz == 10005 && mb_stripos($gruppe_kurzbz,'EWU') === 0) + { + $qry .= " AND (studiensemester_kurzbz IS NULL + OR studiensemester_kurzbz IN ('" . addslashes($stsem) . "','" . addslashes($ss_nearest_to_akt) . "'))"; + } + else + { + $qry .= " AND (studiensemester_kurzbz IS NULL + OR studiensemester_kurzbz='" . addslashes($stsem) . "')"; + } + + $qry .= " ORDER BY + nachname, vorname"; +if ($result = $db->db_query($qry)) +{ + echo '

' . $row = $db->db_num_rows($result) . ' ' . $p->t('mailverteiler/personen'); +} + +echo '

- - - + + + '; - - //$sql_query = "SELECT vornamen AS vn,nachname AS nn,a.uid as uid FROM public.tbl_personmailgrp AS a, public.tbl_person AS b WHERE a.uid=b.uid AND a.mailgrp_kurzbz='$grp' ORDER BY nachname"; - if($result=$db->db_query($qry)) - { - while($row = $db->db_fetch_object($result)) - { - echo ""; - echo " "; - echo " "; - echo " "; - echo ""; - } - } +// $sql_query = "SELECT vornamen AS vn,nachname AS nn,a.uid as uid FROM public.tbl_personmailgrp AS a, public.tbl_person AS b WHERE a.uid=b.uid AND a.mailgrp_kurzbz='$grp' ORDER BY nachname"; +if ($result = $db->db_query($qry)) +{ + while ($row = $db->db_fetch_object($result)) + { + echo ""; + echo " "; + echo " "; + echo " "; + echo ""; + } +} echo '
'.$p->t('global/nachname').''.$p->t('global/vorname').''.$p->t('global/mail').'' . $p->t('global/nachname') . '' . $p->t('global/vorname') . '' . $p->t('global/mail') . '
$row->nachname$row->vorname$row->uid@".DOMAIN."
$row->nachname$row->vorname$row->uid@" . DOMAIN . "
diff --git a/content/zutrittskarte.php b/content/zutrittskarte.php index cfa78cd43..f319dad73 100644 --- a/content/zutrittskarte.php +++ b/content/zutrittskarte.php @@ -218,7 +218,7 @@ foreach ($uid_arr as $uid) 'vorname' => $bn->vorname, 'nachname' => $bn->nachname, 'titelpre' => $bn->titelpre, - 'titepost' => $bn->titelpost, + 'titelpost' => $bn->titelpost, 'personalnummer' => $ma->personalnummer, 'ausstellungsdatum' => date('d.m.Y'), 'gebdatum' => $datum_obj->formatDatum($ma->gebdatum, 'd.m.Y'), @@ -261,7 +261,7 @@ foreach ($uid_arr as $uid) 'vorname' => $bn->vorname, 'nachname' => $bn->nachname, 'titelpre' => $bn->titelpre, - 'titepost' => $bn->titelpost, + 'titelpost' => $bn->titelpost, 'studiengang' => $studiengang->kurzbzlang, 'gebdatum' => $datum_obj->formatDatum($bn->gebdatum, 'd.m.Y'), 'matrikelnummer' => $student->matrikelnr, diff --git a/include/js/croppie.js b/include/js/croppie.js new file mode 100644 index 000000000..8fd32c2ce --- /dev/null +++ b/include/js/croppie.js @@ -0,0 +1,1596 @@ +/************************* + * Croppie + * Copyright 2017 + * Foliotek + * Version: 2.5.1 + *************************/ +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['exports'], factory); + } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') { + // CommonJS + factory(exports); + } else { + // Browser globals + factory((root.commonJsStrict = {})); + } +}(this, function (exports) { + + /* Polyfills */ + if (typeof Promise !== 'function') { + /*! promise-polyfill 3.1.0 */ + !function(a){function b(a,b){return function(){a.apply(b,arguments)}}function c(a){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof a)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],i(a,b(e,this),b(f,this))}function d(a){var b=this;return null===this._state?void this._deferreds.push(a):void k(function(){var c=b._state?a.onFulfilled:a.onRejected;if(null===c)return void(b._state?a.resolve:a.reject)(b._value);var d;try{d=c(b._value)}catch(e){return void a.reject(e)}a.resolve(d)})}function e(a){try{if(a===this)throw new TypeError("A promise cannot be resolved with itself.");if(a&&("object"==typeof a||"function"==typeof a)){var c=a.then;if("function"==typeof c)return void i(b(c,a),b(e,this),b(f,this))}this._state=!0,this._value=a,g.call(this)}catch(d){f.call(this,d)}}function f(a){this._state=!1,this._value=a,g.call(this)}function g(){for(var a=0,b=this._deferreds.length;b>a;a++)d.call(this,this._deferreds[a]);this._deferreds=null}function h(a,b,c,d){this.onFulfilled="function"==typeof a?a:null,this.onRejected="function"==typeof b?b:null,this.resolve=c,this.reject=d}function i(a,b,c){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,c(a))})}catch(e){if(d)return;d=!0,c(e)}}var j=setTimeout,k="function"==typeof setImmediate&&setImmediate||function(a){j(a,1)},l=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};c.prototype["catch"]=function(a){return this.then(null,a)},c.prototype.then=function(a,b){var e=this;return new c(function(c,f){d.call(e,new h(a,b,c,f))})},c.all=function(){var a=Array.prototype.slice.call(1===arguments.length&&l(arguments[0])?arguments[0]:arguments);return new c(function(b,c){function d(f,g){try{if(g&&("object"==typeof g||"function"==typeof g)){var h=g.then;if("function"==typeof h)return void h.call(g,function(a){d(f,a)},c)}a[f]=g,0===--e&&b(a)}catch(i){c(i)}}if(0===a.length)return b([]);for(var e=a.length,f=0;fd;d++)a[d].then(b,c)})},c._setImmediateFn=function(a){k=a},"undefined"!=typeof module&&module.exports?module.exports=c:a.Promise||(a.Promise=c)}(this); + } + + if ( typeof window.CustomEvent !== "function" ) { + (function(){ + function CustomEvent ( event, params ) { + params = params || { bubbles: false, cancelable: false, detail: undefined }; + var evt = document.createEvent( 'CustomEvent' ); + evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); + return evt; + } + CustomEvent.prototype = window.Event.prototype; + window.CustomEvent = CustomEvent; + }()); + } + + if (!HTMLCanvasElement.prototype.toBlob) { + Object.defineProperty(HTMLCanvasElement.prototype, 'toBlob', { + value: function (callback, type, quality) { + var binStr = atob( this.toDataURL(type, quality).split(',')[1] ), + len = binStr.length, + arr = new Uint8Array(len); + + for (var i=0; i= 5) { + var x= w; + w = h; + h = x; + } + return { width: w, height: h }; + } + + /* CSS Transform Prototype */ + var TRANSLATE_OPTS = { + 'translate3d': { + suffix: ', 0px' + }, + 'translate': { + suffix: '' + } + }; + var Transform = function (x, y, scale) { + this.x = parseFloat(x); + this.y = parseFloat(y); + this.scale = parseFloat(scale); + }; + + Transform.parse = function (v) { + if (v.style) { + return Transform.parse(v.style[CSS_TRANSFORM]); + } + else if (v.indexOf('matrix') > -1 || v.indexOf('none') > -1) { + return Transform.fromMatrix(v); + } + else { + return Transform.fromString(v); + } + }; + + Transform.fromMatrix = function (v) { + var vals = v.substring(7).split(','); + if (!vals.length || v === 'none') { + vals = [1, 0, 0, 1, 0, 0]; + } + + return new Transform(num(vals[4]), num(vals[5]), parseFloat(vals[0])); + }; + + Transform.fromString = function (v) { + var values = v.split(') '), + translate = values[0].substring(Croppie.globals.translate.length + 1).split(','), + scale = values.length > 1 ? values[1].substring(6) : 1, + x = translate.length > 1 ? translate[0] : 0, + y = translate.length > 1 ? translate[1] : 0; + + return new Transform(x, y, scale); + }; + + Transform.prototype.toString = function () { + var suffix = TRANSLATE_OPTS[Croppie.globals.translate].suffix || ''; + return Croppie.globals.translate + '(' + this.x + 'px, ' + this.y + 'px' + suffix + ') scale(' + this.scale + ')'; + }; + + var TransformOrigin = function (el) { + if (!el || !el.style[CSS_TRANS_ORG]) { + this.x = 0; + this.y = 0; + return; + } + var css = el.style[CSS_TRANS_ORG].split(' '); + this.x = parseFloat(css[0]); + this.y = parseFloat(css[1]); + }; + + TransformOrigin.prototype.toString = function () { + return this.x + 'px ' + this.y + 'px'; + }; + + function getExifOrientation (img) { + return img.exifdata.Orientation; + } + + function drawCanvas(canvas, img, orientation) { + var width = img.width, + height = img.height, + ctx = canvas.getContext('2d'); + + canvas.width = img.width; + canvas.height = img.height; + + ctx.save(); + switch (orientation) { + case 2: + ctx.translate(width, 0); + ctx.scale(-1, 1); + break; + + case 3: + ctx.translate(width, height); + ctx.rotate(180*Math.PI/180); + break; + + case 4: + ctx.translate(0, height); + ctx.scale(1, -1); + break; + + case 5: + canvas.width = height; + canvas.height = width; + ctx.rotate(90*Math.PI/180); + ctx.scale(1, -1); + break; + + case 6: + canvas.width = height; + canvas.height = width; + ctx.rotate(90*Math.PI/180); + ctx.translate(0, -height); + break; + + case 7: + canvas.width = height; + canvas.height = width; + ctx.rotate(-90*Math.PI/180); + ctx.translate(-width, height); + ctx.scale(1, -1); + break; + + case 8: + canvas.width = height; + canvas.height = width; + ctx.translate(0, width); + ctx.rotate(-90*Math.PI/180); + break; + } + ctx.drawImage(img, 0,0, width, height); + ctx.restore(); + } + + /* Private Methods */ + function _create() { + var self = this, + contClass = 'croppie-container', + customViewportClass = self.options.viewport.type ? 'cr-vp-' + self.options.viewport.type : null, + boundary, img, viewport, overlay, bw, bh; + + self.options.useCanvas = self.options.enableOrientation || _hasExif.call(self); + // Properties on class + self.data = {}; + self.elements = {}; + + boundary = self.elements.boundary = document.createElement('div'); + viewport = self.elements.viewport = document.createElement('div'); + img = self.elements.img = document.createElement('img'); + overlay = self.elements.overlay = document.createElement('div'); + + if (self.options.useCanvas) { + self.elements.canvas = document.createElement('canvas'); + self.elements.preview = self.elements.canvas; + } + else { + self.elements.preview = self.elements.img; + } + + addClass(boundary, 'cr-boundary'); + boundary.setAttribute('aria-dropeffect', 'none'); + bw = self.options.boundary.width; + bh = self.options.boundary.height; + css(boundary, { + width: (bw + (isNaN(bw) ? '' : 'px')), + height: (bh + (isNaN(bh) ? '' : 'px')) + }); + + addClass(viewport, 'cr-viewport'); + if (customViewportClass) { + addClass(viewport, customViewportClass); + } + css(viewport, { + width: self.options.viewport.width + 'px', + height: self.options.viewport.height + 'px' + }); + viewport.setAttribute('tabindex', 0); + + addClass(self.elements.preview, 'cr-image'); + setAttributes(self.elements.preview, { 'alt': 'preview', 'aria-grabbed': 'false' }); + addClass(overlay, 'cr-overlay'); + + self.element.appendChild(boundary); + boundary.appendChild(self.elements.preview); + boundary.appendChild(viewport); + boundary.appendChild(overlay); + + addClass(self.element, contClass); + if (self.options.customClass) { + addClass(self.element, self.options.customClass); + } + + _initDraggable.call(this); + + if (self.options.enableZoom) { + _initializeZoom.call(self); + } + + // if (self.options.enableOrientation) { + // _initRotationControls.call(self); + // } + + if (self.options.enableResize) { + _initializeResize.call(self); + } + } + + // function _initRotationControls () { + // var self = this, + // wrap, btnLeft, btnRight, iLeft, iRight; + + // wrap = document.createElement('div'); + // self.elements.orientationBtnLeft = btnLeft = document.createElement('button'); + // self.elements.orientationBtnRight = btnRight = document.createElement('button'); + + // wrap.appendChild(btnLeft); + // wrap.appendChild(btnRight); + + // iLeft = document.createElement('i'); + // iRight = document.createElement('i'); + // btnLeft.appendChild(iLeft); + // btnRight.appendChild(iRight); + + // addClass(wrap, 'cr-rotate-controls'); + // addClass(btnLeft, 'cr-rotate-l'); + // addClass(btnRight, 'cr-rotate-r'); + + // self.elements.boundary.appendChild(wrap); + + // btnLeft.addEventListener('click', function () { + // self.rotate(-90); + // }); + // btnRight.addEventListener('click', function () { + // self.rotate(90); + // }); + // } + + function _hasExif() { + return this.options.enableExif && window.EXIF; + } + + function _initializeResize () { + var self = this; + var wrap = document.createElement('div'); + var isDragging = false; + var direction; + var originalX; + var originalY; + var minSize = 50; + var maxWidth; + var maxHeight; + var vr; + var hr; + + addClass(wrap, 'cr-resizer'); + css(wrap, { + width: this.options.viewport.width + 'px', + height: this.options.viewport.height + 'px' + }); + + if (this.options.resizeControls.height) { + vr = document.createElement('div'); + addClass(vr, 'cr-resizer-vertical'); + wrap.appendChild(vr); + } + + if (this.options.resizeControls.width) { + hr = document.createElement('div'); + addClass(hr, 'cr-resizer-horisontal'); + wrap.appendChild(hr); + } + + function mouseDown(ev) { + if (ev.button !== undefined && ev.button !== 0) return; + + ev.preventDefault(); + if (isDragging) { + return; + } + + var overlayRect = self.elements.overlay.getBoundingClientRect(); + + isDragging = true; + originalX = ev.pageX; + originalY = ev.pageY; + direction = ev.currentTarget.className.indexOf('vertical') !== -1 ? 'v' : 'h'; + maxWidth = overlayRect.width; + maxHeight = overlayRect.height; + + if (ev.touches) { + var touches = ev.touches[0]; + originalX = touches.pageX; + originalY = touches.pageY; + } + + window.addEventListener('mousemove', mouseMove); + window.addEventListener('touchmove', mouseMove); + window.addEventListener('mouseup', mouseUp); + window.addEventListener('touchend', mouseUp); + document.body.style[CSS_USERSELECT] = 'none'; + } + + function mouseMove(ev) { + var pageX = ev.pageX; + var pageY = ev.pageY; + + ev.preventDefault(); + + if (ev.touches) { + var touches = ev.touches[0]; + pageX = touches.pageX; + pageY = touches.pageY; + } + + var deltaX = pageX - originalX; + var deltaY = pageY - originalY; + var newHeight = self.options.viewport.height + deltaY; + var newWidth = self.options.viewport.width + deltaX; + + if (direction === 'v' && newHeight >= minSize && newHeight <= maxHeight) { + css(wrap, { + height: newHeight + 'px' + }); + + self.options.boundary.height += deltaY; + css(self.elements.boundary, { + height: self.options.boundary.height + 'px' + }); + + self.options.viewport.height += deltaY; + css(self.elements.viewport, { + height: self.options.viewport.height + 'px' + }); + } + else if (direction === 'h' && newWidth >= minSize && newWidth <= maxWidth) { + css(wrap, { + width: newWidth + 'px' + }); + + self.options.boundary.width += deltaX; + css(self.elements.boundary, { + width: self.options.boundary.width + 'px' + }); + + self.options.viewport.width += deltaX; + css(self.elements.viewport, { + width: self.options.viewport.width + 'px' + }); + } + + _updateOverlay.call(self); + _updateZoomLimits.call(self); + _updateCenterPoint.call(self); + _triggerUpdate.call(self); + originalY = pageY; + originalX = pageX; + } + + function mouseUp() { + isDragging = false; + window.removeEventListener('mousemove', mouseMove); + window.removeEventListener('touchmove', mouseMove); + window.removeEventListener('mouseup', mouseUp); + window.removeEventListener('touchend', mouseUp); + document.body.style[CSS_USERSELECT] = ''; + } + + if (vr) { + vr.addEventListener('mousedown', mouseDown); + } + + if (hr) { + hr.addEventListener('mousedown', mouseDown); + } + + this.elements.boundary.appendChild(wrap); + } + + function _setZoomerVal(v) { + if (this.options.enableZoom) { + var z = this.elements.zoomer, + val = fix(v, 4); + + z.value = Math.max(z.min, Math.min(z.max, val)); + } + } + + function _initializeZoom() { + var self = this, + wrap = self.elements.zoomerWrap = document.createElement('div'), + zoomer = self.elements.zoomer = document.createElement('input'); + + addClass(wrap, 'cr-slider-wrap'); + addClass(zoomer, 'cr-slider'); + zoomer.type = 'range'; + zoomer.step = '0.0001'; + zoomer.value = 1; + zoomer.style.display = self.options.showZoomer ? '' : 'none'; + zoomer.setAttribute('aria-label', 'zoom'); + + self.element.appendChild(wrap); + wrap.appendChild(zoomer); + + self._currentZoom = 1; + + function change() { + _onZoom.call(self, { + value: parseFloat(zoomer.value), + origin: new TransformOrigin(self.elements.preview), + viewportRect: self.elements.viewport.getBoundingClientRect(), + transform: Transform.parse(self.elements.preview) + }); + } + + function scroll(ev) { + var delta, targetZoom; + + if (ev.wheelDelta) { + delta = ev.wheelDelta / 1200; //wheelDelta min: -120 max: 120 // max x 10 x 2 + } else if (ev.deltaY) { + delta = ev.deltaY / 1060; //deltaY min: -53 max: 53 // max x 10 x 2 + } else if (ev.detail) { + delta = ev.detail / -60; //delta min: -3 max: 3 // max x 10 x 2 + } else { + delta = 0; + } + + targetZoom = self._currentZoom + (delta * self._currentZoom); + + ev.preventDefault(); + _setZoomerVal.call(self, targetZoom); + change.call(self); + } + + self.elements.zoomer.addEventListener('input', change);// this is being fired twice on keypress + self.elements.zoomer.addEventListener('change', change); + + if (self.options.mouseWheelZoom) { + self.elements.boundary.addEventListener('mousewheel', scroll); + self.elements.boundary.addEventListener('DOMMouseScroll', scroll); + } + } + + function _onZoom(ui) { + var self = this, + transform = ui ? ui.transform : Transform.parse(self.elements.preview), + vpRect = ui ? ui.viewportRect : self.elements.viewport.getBoundingClientRect(), + origin = ui ? ui.origin : new TransformOrigin(self.elements.preview); + + function applyCss() { + var transCss = {}; + transCss[CSS_TRANSFORM] = transform.toString(); + transCss[CSS_TRANS_ORG] = origin.toString(); + css(self.elements.preview, transCss); + } + + self._currentZoom = ui ? ui.value : self._currentZoom; + transform.scale = self._currentZoom; + self.elements.zoomer.setAttribute('aria-valuenow', self._currentZoom); + applyCss(); + + if (self.options.enforceBoundary) { + var boundaries = _getVirtualBoundaries.call(self, vpRect), + transBoundaries = boundaries.translate, + oBoundaries = boundaries.origin; + + if (transform.x >= transBoundaries.maxX) { + origin.x = oBoundaries.minX; + transform.x = transBoundaries.maxX; + } + + if (transform.x <= transBoundaries.minX) { + origin.x = oBoundaries.maxX; + transform.x = transBoundaries.minX; + } + + if (transform.y >= transBoundaries.maxY) { + origin.y = oBoundaries.minY; + transform.y = transBoundaries.maxY; + } + + if (transform.y <= transBoundaries.minY) { + origin.y = oBoundaries.maxY; + transform.y = transBoundaries.minY; + } + } + applyCss(); + _debouncedOverlay.call(self); + _triggerUpdate.call(self); + } + + function _getVirtualBoundaries(viewport) { + var self = this, + scale = self._currentZoom, + vpWidth = viewport.width, + vpHeight = viewport.height, + centerFromBoundaryX = self.elements.boundary.clientWidth / 2, + centerFromBoundaryY = self.elements.boundary.clientHeight / 2, + imgRect = self.elements.preview.getBoundingClientRect(), + curImgWidth = imgRect.width, + curImgHeight = imgRect.height, + halfWidth = vpWidth / 2, + halfHeight = vpHeight / 2; + + var maxX = ((halfWidth / scale) - centerFromBoundaryX) * -1; + var minX = maxX - ((curImgWidth * (1 / scale)) - (vpWidth * (1 / scale))); + + var maxY = ((halfHeight / scale) - centerFromBoundaryY) * -1; + var minY = maxY - ((curImgHeight * (1 / scale)) - (vpHeight * (1 / scale))); + + var originMinX = (1 / scale) * halfWidth; + var originMaxX = (curImgWidth * (1 / scale)) - originMinX; + + var originMinY = (1 / scale) * halfHeight; + var originMaxY = (curImgHeight * (1 / scale)) - originMinY; + + return { + translate: { + maxX: maxX, + minX: minX, + maxY: maxY, + minY: minY + }, + origin: { + maxX: originMaxX, + minX: originMinX, + maxY: originMaxY, + minY: originMinY + } + }; + } + + function _updateCenterPoint() { + var self = this, + scale = self._currentZoom, + data = self.elements.preview.getBoundingClientRect(), + vpData = self.elements.viewport.getBoundingClientRect(), + transform = Transform.parse(self.elements.preview.style[CSS_TRANSFORM]), + pc = new TransformOrigin(self.elements.preview), + top = (vpData.top - data.top) + (vpData.height / 2), + left = (vpData.left - data.left) + (vpData.width / 2), + center = {}, + adj = {}; + + center.y = top / scale; + center.x = left / scale; + + adj.y = (center.y - pc.y) * (1 - scale); + adj.x = (center.x - pc.x) * (1 - scale); + + transform.x -= adj.x; + transform.y -= adj.y; + + var newCss = {}; + newCss[CSS_TRANS_ORG] = center.x + 'px ' + center.y + 'px'; + newCss[CSS_TRANSFORM] = transform.toString(); + css(self.elements.preview, newCss); + } + + function _initDraggable() { + var self = this, + isDragging = false, + originalX, + originalY, + originalDistance, + vpRect, + transform; + + function assignTransformCoordinates(deltaX, deltaY) { + var imgRect = self.elements.preview.getBoundingClientRect(), + top = transform.y + deltaY, + left = transform.x + deltaX; + + if (self.options.enforceBoundary) { + if (vpRect.top > imgRect.top + deltaY && vpRect.bottom < imgRect.bottom + deltaY) { + transform.y = top; + } + + if (vpRect.left > imgRect.left + deltaX && vpRect.right < imgRect.right + deltaX) { + transform.x = left; + } + } + else { + transform.y = top; + transform.x = left; + } + } + + function toggleGrabState(isDragging) { + self.elements.preview.setAttribute('aria-grabbed', isDragging); + self.elements.boundary.setAttribute('aria-dropeffect', isDragging? 'move': 'none'); + } + + function keyDown(ev) { + var LEFT_ARROW = 37, + UP_ARROW = 38, + RIGHT_ARROW = 39, + DOWN_ARROW = 40; + + if (ev.shiftKey && (ev.keyCode == UP_ARROW || ev.keyCode == DOWN_ARROW)) { + var zoom = 0.0; + if (ev.keyCode == UP_ARROW) { + zoom = parseFloat(self.elements.zoomer.value, 10) + parseFloat(self.elements.zoomer.step, 10) + } + else { + zoom = parseFloat(self.elements.zoomer.value, 10) - parseFloat(self.elements.zoomer.step, 10) + } + self.setZoom(zoom); + } + else if (self.options.enableKeyMovement && (ev.keyCode >= 37 && ev.keyCode <= 40)) { + ev.preventDefault(); + var movement = parseKeyDown(ev.keyCode); + + transform = Transform.parse(self.elements.preview); + document.body.style[CSS_USERSELECT] = 'none'; + vpRect = self.elements.viewport.getBoundingClientRect(); + keyMove(movement); + }; + + function parseKeyDown(key) { + switch (key) { + case LEFT_ARROW: + return [1, 0]; + case UP_ARROW: + return [0, 1]; + case RIGHT_ARROW: + return [-1, 0]; + case DOWN_ARROW: + return [0, -1]; + }; + }; + } + + function keyMove(movement) { + var deltaX = movement[0], + deltaY = movement[1], + newCss = {}; + + assignTransformCoordinates(deltaX, deltaY); + + newCss[CSS_TRANSFORM] = transform.toString(); + css(self.elements.preview, newCss); + _updateOverlay.call(self); + document.body.style[CSS_USERSELECT] = ''; + _updateCenterPoint.call(self); + _triggerUpdate.call(self); + originalDistance = 0; + } + + function mouseDown(ev) { + if (ev.button !== undefined && ev.button !== 0) return; + + ev.preventDefault(); + if (isDragging) return; + isDragging = true; + originalX = ev.pageX; + originalY = ev.pageY; + + if (ev.touches) { + var touches = ev.touches[0]; + originalX = touches.pageX; + originalY = touches.pageY; + } + toggleGrabState(isDragging); + transform = Transform.parse(self.elements.preview); + window.addEventListener('mousemove', mouseMove); + window.addEventListener('touchmove', mouseMove); + window.addEventListener('mouseup', mouseUp); + window.addEventListener('touchend', mouseUp); + document.body.style[CSS_USERSELECT] = 'none'; + vpRect = self.elements.viewport.getBoundingClientRect(); + } + + function mouseMove(ev) { + ev.preventDefault(); + var pageX = ev.pageX, + pageY = ev.pageY; + + if (ev.touches) { + var touches = ev.touches[0]; + pageX = touches.pageX; + pageY = touches.pageY; + } + + var deltaX = pageX - originalX, + deltaY = pageY - originalY, + newCss = {}; + + if (ev.type == 'touchmove') { + if (ev.touches.length > 1) { + var touch1 = ev.touches[0]; + var touch2 = ev.touches[1]; + var dist = Math.sqrt((touch1.pageX - touch2.pageX) * (touch1.pageX - touch2.pageX) + (touch1.pageY - touch2.pageY) * (touch1.pageY - touch2.pageY)); + + if (!originalDistance) { + originalDistance = dist / self._currentZoom; + } + + var scale = dist / originalDistance; + + _setZoomerVal.call(self, scale); + dispatchChange(self.elements.zoomer); + return; + } + } + + assignTransformCoordinates(deltaX, deltaY); + + newCss[CSS_TRANSFORM] = transform.toString(); + css(self.elements.preview, newCss); + _updateOverlay.call(self); + originalY = pageY; + originalX = pageX; + } + + function mouseUp() { + isDragging = false; + toggleGrabState(isDragging); + window.removeEventListener('mousemove', mouseMove); + window.removeEventListener('touchmove', mouseMove); + window.removeEventListener('mouseup', mouseUp); + window.removeEventListener('touchend', mouseUp); + document.body.style[CSS_USERSELECT] = ''; + _updateCenterPoint.call(self); + _triggerUpdate.call(self); + originalDistance = 0; + } + + self.elements.overlay.addEventListener('mousedown', mouseDown); + self.elements.viewport.addEventListener('keydown', keyDown); + self.elements.overlay.addEventListener('touchstart', mouseDown); + } + + function _updateOverlay() { + var self = this, + boundRect = self.elements.boundary.getBoundingClientRect(), + imgData = self.elements.preview.getBoundingClientRect(); + + css(self.elements.overlay, { + width: imgData.width + 'px', + height: imgData.height + 'px', + top: (imgData.top - boundRect.top) + 'px', + left: (imgData.left - boundRect.left) + 'px' + }); + } + var _debouncedOverlay = debounce(_updateOverlay, 500); + + function _triggerUpdate() { + var self = this, + data = self.get(), + ev; + + if (!_isVisible.call(self)) { + return; + } + + self.options.update.call(self, data); + if (self.$ && typeof Prototype == 'undefined') { + self.$(self.element).trigger('update', data); + } + else { + var ev; + if (window.CustomEvent) { + ev = new CustomEvent('update', { detail: data }); + } else { + ev = document.createEvent('CustomEvent'); + ev.initCustomEvent('update', true, true, data); + } + + self.element.dispatchEvent(ev); + } + } + + function _isVisible() { + return this.elements.preview.offsetHeight > 0 && this.elements.preview.offsetWidth > 0; + } + + function _updatePropertiesFromImage() { + var self = this, + initialZoom = 1, + cssReset = {}, + img = self.elements.preview, + imgData = null, + transformReset = new Transform(0, 0, initialZoom), + originReset = new TransformOrigin(), + isVisible = _isVisible.call(self); + + if (!isVisible || self.data.bound) { + // if the croppie isn't visible or it doesn't need binding + return; + } + + self.data.bound = true; + cssReset[CSS_TRANSFORM] = transformReset.toString(); + cssReset[CSS_TRANS_ORG] = originReset.toString(); + cssReset['opacity'] = 1; + css(img, cssReset); + + imgData = self.elements.preview.getBoundingClientRect(); + + self._originalImageWidth = imgData.width; + self._originalImageHeight = imgData.height; + + if (self.options.enableZoom) { + _updateZoomLimits.call(self, true); + } + else { + self._currentZoom = initialZoom; + } + + transformReset.scale = self._currentZoom; + cssReset[CSS_TRANSFORM] = transformReset.toString(); + css(img, cssReset); + + if (self.data.points.length) { + _bindPoints.call(self, self.data.points); + } + else { + _centerImage.call(self); + } + + _updateCenterPoint.call(self); + _updateOverlay.call(self); + } + + function _updateZoomLimits (initial) { + var self = this, + minZoom = 0, + maxZoom = 1.5, + initialZoom, + defaultInitialZoom, + zoomer = self.elements.zoomer, + scale = parseFloat(zoomer.value), + boundaryData = self.elements.boundary.getBoundingClientRect(), + imgData = self.elements.preview.getBoundingClientRect(), + vpData = self.elements.viewport.getBoundingClientRect(), + minW, + minH; + + if (self.options.enforceBoundary) { + minW = vpData.width / (initial ? imgData.width : imgData.width / scale); + minH = vpData.height / (initial ? imgData.height : imgData.height / scale); + minZoom = Math.max(minW, minH); + } + + if (minZoom >= maxZoom) { + maxZoom = minZoom + 1; + } + + zoomer.min = fix(minZoom, 4); + zoomer.max = fix(maxZoom, 4); + + if (initial) { + defaultInitialZoom = Math.max((boundaryData.width / imgData.width), (boundaryData.height / imgData.height)); + initialZoom = self.data.boundZoom !== null ? self.data.boundZoom : defaultInitialZoom; + _setZoomerVal.call(self, initialZoom); + } + + dispatchChange(zoomer); + } + + function _bindPoints(points) { + if (points.length != 4) { + throw "Croppie - Invalid number of points supplied: " + points; + } + var self = this, + pointsWidth = points[2] - points[0], + // pointsHeight = points[3] - points[1], + vpData = self.elements.viewport.getBoundingClientRect(), + boundRect = self.elements.boundary.getBoundingClientRect(), + vpOffset = { + left: vpData.left - boundRect.left, + top: vpData.top - boundRect.top + }, + scale = vpData.width / pointsWidth, + originTop = points[1], + originLeft = points[0], + transformTop = (-1 * points[1]) + vpOffset.top, + transformLeft = (-1 * points[0]) + vpOffset.left, + newCss = {}; + + newCss[CSS_TRANS_ORG] = originLeft + 'px ' + originTop + 'px'; + newCss[CSS_TRANSFORM] = new Transform(transformLeft, transformTop, scale).toString(); + css(self.elements.preview, newCss); + + _setZoomerVal.call(self, scale); + self._currentZoom = scale; + } + + function _centerImage() { + var self = this, + imgDim = self.elements.preview.getBoundingClientRect(), + vpDim = self.elements.viewport.getBoundingClientRect(), + boundDim = self.elements.boundary.getBoundingClientRect(), + vpLeft = vpDim.left - boundDim.left, + vpTop = vpDim.top - boundDim.top, + w = vpLeft - ((imgDim.width - vpDim.width) / 2), + h = vpTop - ((imgDim.height - vpDim.height) / 2), + transform = new Transform(w, h, self._currentZoom); + + css(self.elements.preview, CSS_TRANSFORM, transform.toString()); + } + + function _transferImageToCanvas(customOrientation) { + var self = this, + canvas = self.elements.canvas, + img = self.elements.img, + ctx = canvas.getContext('2d'), + exif = _hasExif.call(self), + customOrientation = self.options.enableOrientation && customOrientation; + + ctx.clearRect(0, 0, canvas.width, canvas.height); + canvas.width = img.width; + canvas.height = img.height; + + if (exif && !customOrientation) { + var orientation = getExifOrientation(img); + drawCanvas(canvas, img, num(orientation || 0, 10)); + } + else if (customOrientation) { + drawCanvas(canvas, img, customOrientation); + } + } + + function _getCanvas(data) { + var self = this, + points = data.points, + left = num(points[0]), + top = num(points[1]), + right = num(points[2]), + bottom = num(points[3]), + width = right-left, + height = bottom-top, + circle = data.circle, + canvas = document.createElement('canvas'), + ctx = canvas.getContext('2d'), + outWidth = width, + outHeight = height, + startX = 0, + startY = 0, + canvasWidth = outWidth, + canvasHeight = outHeight, + customDimensions = (data.outputWidth && data.outputHeight), + outputWidthRatio = 1; + outputHeightRatio = 1; + + if (customDimensions) { + canvasWidth = data.outputWidth; + canvasHeight = data.outputHeight; + outputWidthRatio = canvasWidth / outWidth; + outputHeightRatio = canvasHeight / outHeight; + } + + canvas.width = canvasWidth; + canvas.height = canvasHeight; + + if (data.backgroundColor) { + ctx.fillStyle = data.backgroundColor; + ctx.fillRect(0, 0, canvasWidth, canvasHeight); + } + + + // start fixing data to send to draw image for enforceBoundary: false + if (!self.options.enforceBoundary) { + if (left < 0) { + startX = Math.abs(left); + left = 0; + } + if (top < 0) { + startY = Math.abs(top); + top = 0; + } + if (right > self._originalImageWidth) { + width = self._originalImageWidth - left; + outWidth = width; + } + if (bottom > self._originalImageHeight) { + height = self._originalImageHeight - top; + outHeight = height; + } + } + else{ + width=Math.min(width, self._originalImageWidth); + height=Math.min(height, self._originalImageHeight) + } + + if (outputWidthRatio !== 1 || outputHeightRatio !== 1) { + startX *= outputWidthRatio; + startY *= outputHeightRatio; + outWidth *= outputWidthRatio; + outHeight *= outputHeightRatio; + } + ctx.drawImage(this.elements.preview, left, top, width, height, startX, startY, outWidth, outHeight); + if (circle) { + ctx.fillStyle = '#fff'; + ctx.globalCompositeOperation = 'destination-in'; + ctx.beginPath(); + ctx.arc(outWidth / 2, outHeight / 2, outWidth / 2, 0, Math.PI * 2, true); + ctx.closePath(); + ctx.fill(); + } + return canvas; + } + + function _getHtmlResult(data) { + var points = data.points, + div = document.createElement('div'), + img = document.createElement('img'), + width = points[2] - points[0], + height = points[3] - points[1]; + + addClass(div, 'croppie-result'); + div.appendChild(img); + css(img, { + left: (-1 * points[0]) + 'px', + top: (-1 * points[1]) + 'px' + }); + img.src = data.url; + css(div, { + width: width + 'px', + height: height + 'px' + }); + + return div; + } + + function _getBase64Result(data) { + return _getCanvas.call(this, data).toDataURL(data.format, data.quality); + } + + function _getBlobResult(data) { + var self = this; + return new Promise(function (resolve, reject) { + _getCanvas.call(self, data).toBlob(function (blob) { + resolve(blob); + }, data.format, data.quality); + }); + } + + function _bind(options, cb) { + var self = this, + url, + points = [], + zoom = null, + hasExif = _hasExif.call(self);; + + if (typeof (options) === 'string') { + url = options; + options = {}; + } + else if (Array.isArray(options)) { + points = options.slice(); + } + else if (typeof (options) == 'undefined' && self.data.url) { //refreshing + _updatePropertiesFromImage.call(self); + _triggerUpdate.call(self); + return null; + } + else { + url = options.url; + points = options.points || []; + zoom = typeof(options.zoom) === 'undefined' ? null : options.zoom; + } + + self.data.bound = false; + self.data.url = url || self.data.url; + self.data.boundZoom = zoom; + + return loadImage(url, self.elements.img, hasExif).then(function (img) { + if (!points.length) { + var natDim = naturalImageDimensions(img); + var rect = self.elements.viewport.getBoundingClientRect(); + var aspectRatio = rect.width / rect.height; + var imgAspectRatio = natDim.width / natDim.height; + var width, height; + + if (imgAspectRatio > aspectRatio) { + height = natDim.height; + width = height * aspectRatio; + } + else { + width = natDim.width; + height = width / aspectRatio; + } + + var x0 = (natDim.width - width) / 2; + var y0 = (natDim.height - height) / 2; + var x1 = x0 + width; + var y1 = y0 + height; + + self.data.points = [x0, y0, x1, y1]; + } + else if (self.options.relative) { + points = [ + points[0] * img.naturalWidth / 100, + points[1] * img.naturalHeight / 100, + points[2] * img.naturalWidth / 100, + points[3] * img.naturalHeight / 100 + ]; + } + + self.data.points = points.map(function (p) { + return parseFloat(p); + }); + if (self.options.useCanvas) { + _transferImageToCanvas.call(self, options.orientation || 1); + } + _updatePropertiesFromImage.call(self); + _triggerUpdate.call(self); + cb && cb(); + }); + } + + function fix(v, decimalPoints) { + return parseFloat(v).toFixed(decimalPoints || 0); + } + + function _get() { + var self = this, + imgData = self.elements.preview.getBoundingClientRect(), + vpData = self.elements.viewport.getBoundingClientRect(), + x1 = vpData.left - imgData.left, + y1 = vpData.top - imgData.top, + widthDiff = (vpData.width - self.elements.viewport.offsetWidth) / 2, //border + heightDiff = (vpData.height - self.elements.viewport.offsetHeight) / 2, + x2 = x1 + self.elements.viewport.offsetWidth + widthDiff, + y2 = y1 + self.elements.viewport.offsetHeight + heightDiff, + scale = self._currentZoom; + + if (scale === Infinity || isNaN(scale)) { + scale = 1; + } + + var max = self.options.enforceBoundary ? 0 : Number.NEGATIVE_INFINITY; + x1 = Math.max(max, x1 / scale); + y1 = Math.max(max, y1 / scale); + x2 = Math.max(max, x2 / scale); + y2 = Math.max(max, y2 / scale); + + return { + points: [fix(x1), fix(y1), fix(x2), fix(y2)], + zoom: scale + }; + } + + var RESULT_DEFAULTS = { + type: 'canvas', + format: 'png', + quality: 1 + }, + RESULT_FORMATS = ['jpeg', 'webp', 'png']; + + function _result(options) { + var self = this, + data = _get.call(self), + opts = deepExtend(RESULT_DEFAULTS, deepExtend({}, options)), + resultType = (typeof (options) === 'string' ? options : (opts.type || 'base64')), + size = opts.size || 'viewport', + format = opts.format, + quality = opts.quality, + backgroundColor = opts.backgroundColor, + circle = typeof opts.circle === 'boolean' ? opts.circle : (self.options.viewport.type === 'circle'), + vpRect = self.elements.viewport.getBoundingClientRect(), + ratio = vpRect.width / vpRect.height, + prom; + + if (size === 'viewport') { + data.outputWidth = vpRect.width; + data.outputHeight = vpRect.height; + } else if (typeof size === 'object') { + if (size.width && size.height) { + data.outputWidth = size.width; + data.outputHeight = size.height; + } else if (size.width) { + data.outputWidth = size.width; + data.outputHeight = size.width / ratio; + } else if (size.height) { + data.outputWidth = size.height * ratio; + data.outputHeight = size.height; + } + } + + if (RESULT_FORMATS.indexOf(format) > -1) { + data.format = 'image/' + format; + data.quality = quality; + } + + data.circle = circle; + data.url = self.data.url; + data.backgroundColor = backgroundColor; + + prom = new Promise(function (resolve, reject) { + switch(resultType.toLowerCase()) + { + case 'rawcanvas': + resolve(_getCanvas.call(self, data)); + break; + case 'canvas': + case 'base64': + resolve(_getBase64Result.call(self, data)); + break; + case 'blob': + _getBlobResult.call(self, data).then(resolve); + break; + default: + resolve(_getHtmlResult.call(self, data)); + break; + } + }); + return prom; + } + + function _refresh() { + _updatePropertiesFromImage.call(this); + } + + function _rotate(deg) { + if (!this.options.useCanvas) { + throw 'Croppie: Cannot rotate without enableOrientation'; + } + + var self = this, + canvas = self.elements.canvas, + copy = document.createElement('canvas'), + ornt = 1; + + copy.width = canvas.width; + copy.height = canvas.height; + var ctx = copy.getContext('2d'); + ctx.drawImage(canvas, 0, 0); + + if (deg === 90 || deg === -270) ornt = 6; + if (deg === -90 || deg === 270) ornt = 8; + if (deg === 180 || deg === -180) ornt = 3; + + drawCanvas(canvas, copy, ornt); + _onZoom.call(self); + copy = null; + } + + function _destroy() { + var self = this; + self.element.removeChild(self.elements.boundary); + removeClass(self.element, 'croppie-container'); + if (self.options.enableZoom) { + self.element.removeChild(self.elements.zoomerWrap); + } + delete self.elements; + } + + if (window.jQuery) { + var $ = window.jQuery; + $.fn.croppie = function (opts) { + var ot = typeof opts; + + if (ot === 'string') { + var args = Array.prototype.slice.call(arguments, 1); + var singleInst = $(this).data('croppie'); + + if (opts === 'get') { + return singleInst.get(); + } + else if (opts === 'result') { + return singleInst.result.apply(singleInst, args); + } + else if (opts === 'bind') { + return singleInst.bind.apply(singleInst, args); + } + + return this.each(function () { + var i = $(this).data('croppie'); + if (!i) return; + + var method = i[opts]; + if ($.isFunction(method)) { + method.apply(i, args); + if (opts === 'destroy') { + $(this).removeData('croppie'); + } + } + else { + throw 'Croppie ' + opts + ' method not found'; + } + }); + } + else { + return this.each(function () { + var i = new Croppie(this, opts); + i.$ = $; + $(this).data('croppie', i); + }); + } + }; + } + + function Croppie(element, opts) { + this.element = element; + this.options = deepExtend(deepExtend({}, Croppie.defaults), opts); + + if (this.element.tagName.toLowerCase() === 'img') { + var origImage = this.element; + addClass(origImage, 'cr-original-image'); + setAttributes(origImage, {'aria-hidden' : 'true', 'alt' : '' }); + var replacementDiv = document.createElement('div'); + this.element.parentNode.appendChild(replacementDiv); + replacementDiv.appendChild(origImage); + this.element = replacementDiv; + this.options.url = this.options.url || origImage.src; + } + + _create.call(this); + if (this.options.url) { + var bindOpts = { + url: this.options.url, + points: this.options.points + }; + delete this.options['url']; + delete this.options['points']; + _bind.call(this, bindOpts); + } + } + + Croppie.defaults = { + viewport: { + width: 100, + height: 100, + type: 'square' + }, + boundary: { }, + orientationControls: { + enabled: true, + leftClass: '', + rightClass: '' + }, + resizeControls: { + width: true, + height: true + }, + customClass: '', + showZoomer: true, + enableZoom: true, + enableResize: false, + mouseWheelZoom: true, + enableExif: false, + enforceBoundary: true, + enableOrientation: false, + enableKeyMovement: true, + update: function () { } + }; + + Croppie.globals = { + translate: 'translate3d' + }; + + deepExtend(Croppie.prototype, { + bind: function (options, cb) { + return _bind.call(this, options, cb); + }, + get: function () { + var data = _get.call(this); + var points = data.points; + if (this.options.relative) { + points[0] /= this.elements.img.naturalWidth / 100; + points[1] /= this.elements.img.naturalHeight / 100; + points[2] /= this.elements.img.naturalWidth / 100; + points[3] /= this.elements.img.naturalHeight / 100; + } + return data; + }, + result: function (type) { + return _result.call(this, type); + }, + refresh: function () { + return _refresh.call(this); + }, + setZoom: function (v) { + _setZoomerVal.call(this, v); + dispatchChange(this.elements.zoomer); + }, + rotate: function (deg) { + _rotate.call(this, deg); + }, + destroy: function () { + return _destroy.call(this); + } + }); + + exports.Croppie = window.Croppie = Croppie; + + if (typeof module === 'object' && !!module.exports) { + module.exports = Croppie; + } +})); \ No newline at end of file diff --git a/locale/de-AT/dms_link.php b/locale/de-AT/dms_link.php index 655b108bb..4e4296038 100644 --- a/locale/de-AT/dms_link.php +++ b/locale/de-AT/dms_link.php @@ -16,7 +16,7 @@ $this->phrasen['dms_link/berechtigungskonzeptMailverteiler']='1475'; //Berechtig $this->phrasen['dms_link/handbuchUrlaubsverwaltung']='759'; //Handbuch Urlaubsverwaltung -> Leer lassen, falls es keines gibt $this->phrasen['dms_link/handbuchZeitaufzeichnung']='1545'; //Handbuch Zeitaufzeichnung -> Leer lassen, falls es keines gibt $this->phrasen['dms_link/fiktiveNormalarbeitszeit']='2512'; //fiktive Normalarbeitszeit -> Leer lassen, falls es keines gibt -$this->phrasen['dms_link/learningAgreementErasmus']='29266'; //Learning Agreement Incomings Erasmus +$this->phrasen['dms_link/learningAgreementErasmus']='85863'; //Learning Agreement Incomings Erasmus $this->phrasen['dms_link/learningAgreement']='38866'; //Learning Agreement Incomings NICHT Erasmus $this->phrasen['dms_link/passwortpolicy']='57972'; //Passwortpolicy diff --git a/locale/de-AT/lehre.php b/locale/de-AT/lehre.php index 98d8cc623..46633c747 100644 --- a/locale/de-AT/lehre.php +++ b/locale/de-AT/lehre.php @@ -18,7 +18,7 @@ $this->phrasen['lehre/anwesenheitsUndNotenlisten']='Anwesenheits- und Notenliste $this->phrasen['lehre/leistungsuebersicht']='Leistungsübersicht'; $this->phrasen['lehre/newsgroups']='Newsgroups'; $this->phrasen['lehre/feedback']='Feedback'; -$this->phrasen['lehre/termineImLvPlan']='Termine im LV-Plan'; +$this->phrasen['lehre/termineImLvPlan']='Alle Termine dieser LV'; $this->phrasen['lehre/benotungstoolHandbuch']='Handbuch'; $this->phrasen['lehre/kreuzerltool']='Übungstool
("Kreuzerl"-Tool)'; diff --git a/locale/en-US/dms_link.php b/locale/en-US/dms_link.php index 983a7d40e..80e95529e 100644 --- a/locale/en-US/dms_link.php +++ b/locale/en-US/dms_link.php @@ -16,7 +16,7 @@ $this->phrasen['dms_link/berechtigungskonzeptMailverteiler']='1475'; //Berechtig $this->phrasen['dms_link/handbuchUrlaubsverwaltung']='759'; //Handbuch Urlaubsverwaltung $this->phrasen['dms_link/handbuchZeitaufzeichnung']='1545'; //Handbuch Zeitaufzeichnung -> Leer lassen, falls es keines gibt $this->phrasen['dms_link/fiktiveNormalarbeitszeit']='2512'; //fiktive Normalarbeitszeit -> Leer lassen, falls es keines gibt -$this->phrasen['dms_link/learningAgreementErasmus']='29266'; //Learning Agreement Incomings Erasmus +$this->phrasen['dms_link/learningAgreementErasmus']='85863'; //Learning Agreement Incomings Erasmus $this->phrasen['dms_link/learningAgreement']='38866'; //Learning Agreement Incomings NICHT Erasmus // Content IDs (=Deutsch) diff --git a/skin/croppie.css b/skin/croppie.css new file mode 100644 index 000000000..0af2e2c60 --- /dev/null +++ b/skin/croppie.css @@ -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: '↻'; +} diff --git a/system/vorlage_zip/Zutrittskarte.odt b/system/vorlage_zip/Zutrittskarte.odt index 6f2fff292..31ff85baa 100644 Binary files a/system/vorlage_zip/Zutrittskarte.odt and b/system/vorlage_zip/Zutrittskarte.odt differ diff --git a/system/xsl/Zutrittskarte_10005_WarmUp.xsl b/system/xsl/Zutrittskarte_10005_WarmUp.xsl new file mode 100644 index 000000000..d3f3895af --- /dev/null +++ b/system/xsl/Zutrittskarte_10005_WarmUp.xsl @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Zutrittskarte + + + WarmUp-Kurse + + + + + + + + + + + + + + + + + , + + + + + + + + + + + + + diff --git a/system/xsl/Zutrittskarte_AO.xsl b/system/xsl/Zutrittskarte_AO.xsl new file mode 100644 index 000000000..157b7c9ed --- /dev/null +++ b/system/xsl/Zutrittskarte_AO.xsl @@ -0,0 +1,206 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Ausweis für ao. + + + Studierende + + + Student Card + + + + + + + + + + + + + + + + + + + + , + + + + Pers.-Kz. + + + + + + + + + + diff --git a/system/xsl/Zutrittskarte_Academy_AO.xsl b/system/xsl/Zutrittskarte_Academy_AO.xsl new file mode 100644 index 000000000..19930cbba --- /dev/null +++ b/system/xsl/Zutrittskarte_Academy_AO.xsl @@ -0,0 +1,206 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Ausweis für ao. + + + Studierende + + + Student Card + + + + + + + + + + + + + + + + + + + + , + + + + Pers.-Kz. + + + + + + + + + + diff --git a/system/xsl/Zutrittskarte_Alumni.xsl b/system/xsl/Zutrittskarte_Alumni.xsl new file mode 100644 index 000000000..5bf82a374 --- /dev/null +++ b/system/xsl/Zutrittskarte_Alumni.xsl @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Ausweis für + + + Alumni Club Mitglieder + + + + + + + + + + + + + + + + + , + + + + + + + + + + + + + diff --git a/system/xsl/Zutrittskarte_Aufbaukurse.xsl b/system/xsl/Zutrittskarte_Aufbaukurse.xsl new file mode 100644 index 000000000..76e22ac67 --- /dev/null +++ b/system/xsl/Zutrittskarte_Aufbaukurse.xsl @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Zutrittskarte + + + Aufbaukurse + + + + + + + + + + + + + + + + + , + + + + + + + + + + + + + diff --git a/system/xsl/Zutrittskarte_HSA.xsl b/system/xsl/Zutrittskarte_HSA.xsl new file mode 100644 index 000000000..701cdaf59 --- /dev/null +++ b/system/xsl/Zutrittskarte_HSA.xsl @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Zutrittskarte + + + Hertha Firnberg Schulen + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/system/xsl/Zutrittskarte_Vorbereitungslehrgaenge.xsl b/system/xsl/Zutrittskarte_Vorbereitungslehrgaenge.xsl new file mode 100644 index 000000000..d6d12838f --- /dev/null +++ b/system/xsl/Zutrittskarte_Vorbereitungslehrgaenge.xsl @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Zutrittskarte + + + Vorbereitungslehrgang AMS + + + + + + + + + + + + + + + + + , + + + + + + + + + + + + + diff --git a/system/xsl/accountinfoblatt_0.xsl b/system/xsl/accountinfoblatt_0.xsl index 82995634a..98daad780 100644 --- a/system/xsl/accountinfoblatt_0.xsl +++ b/system/xsl/accountinfoblatt_0.xsl @@ -215,7 +215,7 @@ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" Account Mini FAQ - Wie aktiviere ich meinen Acccount? + Wie aktiviere ich meinen Account? Öffnen Sie mit ihrem Web-Browser die Adresse https://cis.technikum-wien.at/cis/public/accountactivation.php diff --git a/vilesci/fhausweis/bildpruefung.php b/vilesci/fhausweis/bildpruefung.php index 9b5ef7dc4..6be0cabac 100644 --- a/vilesci/fhausweis/bildpruefung.php +++ b/vilesci/fhausweis/bildpruefung.php @@ -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 '

// 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)) @@ -493,7 +516,12 @@ if($result = $db->db_query($qry)) echo ' '; echo ''; echo '


'; - echo 'Bild Upload'; + // 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 'Bild zuschneiden/Upload'; + else + echo 'Bild zuschneiden/Upload'; + if ($row->dms_id !='') { echo '

'; diff --git a/vilesci/fhausweis/bildzuschnitt.php b/vilesci/fhausweis/bildzuschnitt.php new file mode 100644 index 000000000..e1fabbb1e --- /dev/null +++ b/vilesci/fhausweis/bildzuschnitt.php @@ -0,0 +1,429 @@ + + */ + +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']; ?> + + + + + <?php echo $p->t('bewerbung/fileUpload'); ?> + + + + + + + + + + + +'; + +if ($error === false) +{ + echo '
+ + '.$message.' +
'; +} +elseif ($error === true) +{ + echo '
+ + '.$p->t('global/fehleraufgetreten').' '.$message.' +
'; +} +echo ''; + +if ($person_id != '') +{ + echo ' + +

+
+
+
+
Upload Image
+
'; + + // Container für Bildzuschnitt + echo '
'; + echo' +
+ +

+ + +
+
+
+
+
+ + '; +} +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 .= '
-

Originalvorschau

+ '; + // Wenn es keine Akte mit Lichtbild gibt, das Foto der Person laden, sonst aus der Akte + if ($row->dokument_kurzbz == 'Lichtbil') + { + echo '

Originalvorschau

+ + '; + } + else + { + echo '

Originalvorschau

+ + '; + } + echo ' +

'; + $email .= ''; + $email .= ''; + $email .= ''; + $email .= ''; + $email .= ''; + $email .= '
' . $p->t('global/studiengang') . '' . $typ->bezeichnung . ' ' . $studiengang->bezeichnung . ($orgform_kurzbz != '' ? ' (' . $orgform_kurzbz . ')' : '') . '
' . $p->t('global/studiensemester') . '' . $studiensemester_kurzbz . '
' . $p->t('global/name') . '' . $person->vorname . ' ' . $person->nachname . '
' . $p->t('bewerbung/dokument') . ''; + $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') . '
'; + else + $email .= '' . $dokument->bezeichnung_mehrsprachig[DEFAULT_LANGUAGE] . ' [' . $row->bezeichnung . ']
'; + $dokumentbezeichnung = $dokument->bezeichnung_mehrsprachig[DEFAULT_LANGUAGE]; + } + } + $email .= '
' . $p->t('bewerbung/prestudentID') . '' . $prestudent_id . '
'; + $email .= '
' . $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; +} + +?> + + diff --git a/vilesci/fhausweis/imageupload.php b/vilesci/fhausweis/imageupload.php new file mode 100644 index 000000000..c7eb7dd55 --- /dev/null +++ b/vilesci/fhausweis/imageupload.php @@ -0,0 +1,245 @@ + + */ +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'] = "Fehler: $akte->errormsg"; + 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'] = "Fehler: $akte->errormsg"; + 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 'Fehler beim Setzen des Bildstatus'; + else + { + $result_obj['type'] = "success"; + $result_obj['msg'] = "Bild wurde erfolgreich gespeichert"; + echo json_encode($result_obj); + } + } + else + { + $result_obj['type'] = "error"; + $result_obj['msg'] = "" . $person->errormsg . ""; + echo json_encode($result_obj); + } +}