mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-23 01:42:17 +00:00
Merge Praktikant into Master
This commit is contained in:
@@ -1547,5 +1547,84 @@ class content extends basis_db
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loescht wahlweise den geamten Content oder nur eine Version in der uebergebenen Sprache
|
||||
*
|
||||
* @param integer $content_id ID des Contents, der geloescht werden soll
|
||||
* @param string $sprache (optional) Sprache des Contents, die geloescht werden soll
|
||||
* @param string $version (optional) Version des Contents, die geloescht werden soll (nur in Kombination mit Sprache)
|
||||
* @return boolean
|
||||
*/
|
||||
|
||||
public function deleteContent($content_id, $sprache = NULL, $version = NULL)
|
||||
{
|
||||
if($content_id=='' || !is_numeric($content_id))
|
||||
{
|
||||
$this->errormsg = 'ContentID ungueltig';
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_null($version) && is_null($sprache))
|
||||
{
|
||||
//gesamter content wird gelöscht
|
||||
$qry = "DELETE FROM campus.tbl_contentchild WHERE content_id=".$this->db_add_param($content_id, FHC_INTEGER).";
|
||||
DELETE FROM campus.tbl_contentchild WHERE child_content_id=".$this->db_add_param($content_id, FHC_INTEGER).";
|
||||
DELETE FROM campus.tbl_contentlog WHERE contentsprache_id IN (SELECT contentsprache_id FROM campus.tbl_contentsprache WHERE content_id=".$this->db_add_param($content_id, FHC_INTEGER).");
|
||||
DELETE FROM campus.tbl_contentchild WHERE content_id=".$this->db_add_param($content_id, FHC_INTEGER).";
|
||||
DELETE FROM campus.tbl_contentsprache WHERE content_id=".$this->db_add_param($content_id, FHC_INTEGER).";
|
||||
DELETE FROM campus.tbl_contentgruppe WHERE content_id=".$this->db_add_param($content_id, FHC_INTEGER).";
|
||||
DELETE FROM campus.tbl_content WHERE content_id=".$this->db_add_param($content_id, FHC_INTEGER).";";
|
||||
}
|
||||
else
|
||||
{
|
||||
//eine version wird gelöscht
|
||||
$qry = "DELETE FROM campus.tbl_contentlog WHERE contentsprache_id IN (SELECT contentsprache_id FROM campus.tbl_contentsprache WHERE content_id=".$this->db_add_param($content_id, FHC_INTEGER)." AND sprache=".$this->db_add_param($sprache)." AND version=".$this->db_add_param($version, FHC_INTEGER).");
|
||||
DELETE FROM campus.tbl_contentsprache WHERE content_id=".$this->db_add_param($content_id, FHC_INTEGER)." AND sprache=".$this->db_add_param($sprache)." AND version=".$this->db_add_param($version, FHC_INTEGER).";";
|
||||
}
|
||||
$this->errormsg = $qry;
|
||||
|
||||
if($this->db_query($qry))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt die Anzahl der verbliebenen Eintraege in tbl_contentsprache in der uebergebenen Sprache zurueck
|
||||
*
|
||||
* @param integer $content_id ID des Contents
|
||||
* @param string $sprache Sprache des Contents
|
||||
* @return anzahl
|
||||
*/
|
||||
|
||||
public function getNumberOfVersions($content_id, $sprache)
|
||||
{
|
||||
$qry = "SELECT COUNT(*) as anzahl FROM campus.tbl_contentsprache WHERE content_id = ".$this->db_add_param($content_id, FHC_INTEGER)." AND sprache = ".$this->db_add_param($sprache).";";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
$row = $this->db_fetch_object($result);
|
||||
return $row->anzahl;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+44
-8
@@ -614,16 +614,33 @@ class dms extends basis_db
|
||||
* Laedt die Dokumente einer Kategorie
|
||||
*
|
||||
* @param $kategorie_kurzbz
|
||||
* @param $dpp = Documents Per Page
|
||||
*/
|
||||
public function getDocuments($kategorie_kurzbz)
|
||||
public function getDocuments($kategorie_kurzbz, $dpp=NULL, $page=NULL)
|
||||
{
|
||||
if (!is_null($dpp) && !is_null($page))
|
||||
{
|
||||
if ($page == 0)
|
||||
{
|
||||
$limit = '';
|
||||
$offset = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$limit = 'LIMIT '.$dpp;
|
||||
$offset = ' OFFSET '.($page-1)*$dpp;
|
||||
}
|
||||
}
|
||||
$qry = "SELECT * FROM campus.tbl_dms JOIN campus.tbl_dms_version USING(dms_id)
|
||||
WHERE (dms_id, version) in(
|
||||
SELECT dms_id, max(version)
|
||||
FROM campus.tbl_dms_version
|
||||
GROUP BY dms_id)
|
||||
AND kategorie_kurzbz=".$this->db_add_param($kategorie_kurzbz)."
|
||||
ORDER BY name;";
|
||||
ORDER BY name ";
|
||||
if (isset($limit)) $qry .= $limit;
|
||||
if (isset($offset)) $qry .= $offset;
|
||||
$qry .= ";";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
@@ -660,16 +677,35 @@ class dms extends basis_db
|
||||
*
|
||||
* @param $kategorie_kurzbz
|
||||
*/
|
||||
public function search($suchstring)
|
||||
public function search($suchstring, $dpp=NULL, $page=NULL)
|
||||
{
|
||||
if (!is_null($dpp) && !is_null($page))
|
||||
{
|
||||
if ($page == 0)
|
||||
{
|
||||
$limit = '';
|
||||
$offset = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$limit = ' LIMIT '.$dpp;
|
||||
$offset = ' OFFSET '.($page-1)*$dpp;
|
||||
}
|
||||
}
|
||||
|
||||
$qry = "SELECT * FROM campus.tbl_dms JOIN campus.tbl_dms_version USING(dms_id)
|
||||
WHERE lower(name) like lower('%".$this->db_escape($suchstring)."%')
|
||||
OR lower(beschreibung) like lower('%".$this->db_escape($suchstring)."%')
|
||||
";
|
||||
if (is_numeric($suchstring))
|
||||
$qry.= "OR dms_id = ".$this->db_escape($suchstring)."";
|
||||
";
|
||||
|
||||
$qry.=";";
|
||||
|
||||
if (is_numeric($suchstring))
|
||||
$qry.= " OR dms_id = ".$this->db_escape($suchstring)."";
|
||||
|
||||
if (isset($limit)) $qry .= $limit;
|
||||
if (isset($offset)) $qry .= $offset;
|
||||
|
||||
$qry.=";";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
@@ -701,7 +737,7 @@ class dms extends basis_db
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Sucht nach Dokumenten (nur Spalte Beschreibung) mit der aktuellsten Version.
|
||||
* Optional kann die Anzahl an Suchergebnissen übergeben werden.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
// ****
|
||||
// * Liefert einen Timestamp in Sekunden
|
||||
// * zum anhaengen an eine URL um Caching zu verhindern
|
||||
// ****
|
||||
function gettimestamp()
|
||||
{
|
||||
var now = new Date();
|
||||
var ret = now.getHours()*60*60*60;
|
||||
ret = ret + now.getMinutes()*60*60;
|
||||
ret = ret + now.getSeconds()*60;
|
||||
ret = ret + now.getMilliseconds();
|
||||
return ret;
|
||||
}
|
||||
/**
|
||||
* schließt das fenster
|
||||
*/
|
||||
function closeWindow() {
|
||||
window.close();
|
||||
}
|
||||
|
||||
$('document').ready(function() {
|
||||
|
||||
$('#saveimgbutton').click(function() {
|
||||
//src und person_id von hidden input feldern
|
||||
var img = document.getElementById('croppingdiv').getElementsByTagName('img')[0];
|
||||
var src = (img.src).substring(22, (img.src).length);
|
||||
var person_id = document.getElementById('person_id');
|
||||
var person_idValue = person_id.getAttribute('value');
|
||||
|
||||
//in crop.php wird das bild verarbeitet und abgespeichert
|
||||
$.post('crop.php', {src:src, person_idValue:person_idValue}, function() {});
|
||||
|
||||
//cis seite auf zwei verschiedenen arten neu laden, damit das bild auch sicher nicht im cache abgelegt wird
|
||||
window.opener.location.reload(true);
|
||||
var locat=window.opener.location.href+'?ts='+gettimestamp();
|
||||
window.opener.location.href = locat;
|
||||
//warten bevor das fenster geschlossen wird, weil chrome und opera sonst probleme haben das bild zu speichern
|
||||
setTimeout(closeWindow, 100);
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
Author : Tomaz Dragar
|
||||
Mail : <tomaz@dragar.net>
|
||||
Homepage : http://www.dragar.net
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
$.fn.simpleCropper = function() {
|
||||
|
||||
var image_dimension_x = 600;
|
||||
var image_dimension_y = 600;
|
||||
var scaled_width = 0;
|
||||
var scaled_height = 0;
|
||||
var x1 = 0;
|
||||
var y1 = 0;
|
||||
var x2 = 0;
|
||||
var y2 = 0;
|
||||
var current_image = null;
|
||||
var aspX = 1;
|
||||
var aspY = 1;
|
||||
var file_display_area = null;
|
||||
var ias = null;
|
||||
var jcrop_api;
|
||||
var bottom_html = "<input type='file' id='fileInput' name='files[]'/><canvas id='myCanvas' style='display:none;'></canvas><div id='modal'></div><div id='preview'><div class='buttons'><div class='cancel' style='background-image:url(../../skin/images/false-27.png);'></div><div class='ok' style='background-image:url(../../skin/images/true-27.png);'></div></div></div>";
|
||||
$('body').append(bottom_html);
|
||||
|
||||
//add click to element
|
||||
this.click(function() {
|
||||
aspX = $(this).width();
|
||||
aspY = $(this).height();
|
||||
file_display_area = $(this);
|
||||
$('#fileInput').click();
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
//capture selected filename
|
||||
$('#fileInput').change(function(click) {
|
||||
imageUpload($('#preview').get(0));
|
||||
// Reset input value
|
||||
$(this).val("");
|
||||
});
|
||||
|
||||
//ok listener
|
||||
$('.ok').click(function() {
|
||||
preview();
|
||||
$('#preview').delay(100).hide();
|
||||
$('#modal').hide();
|
||||
jcrop_api.destroy();
|
||||
reset();
|
||||
});
|
||||
|
||||
//cancel listener
|
||||
$('.cancel').click(function(event) {
|
||||
$('#preview').delay(100).hide();
|
||||
$('#modal').hide();
|
||||
jcrop_api.destroy();
|
||||
reset();
|
||||
});
|
||||
});
|
||||
|
||||
function reset() {
|
||||
scaled_width = 0;
|
||||
scaled_height = 0;
|
||||
x1 = 0;
|
||||
y1 = 0;
|
||||
x2 = 0;
|
||||
y2 = 0;
|
||||
current_image = null;
|
||||
aspX = 1;
|
||||
aspY = 1;
|
||||
file_display_area = null;
|
||||
}
|
||||
|
||||
function imageUpload(dropbox) {
|
||||
var file = $("#fileInput").get(0).files[0];
|
||||
//var file = document.getElementById('fileInput').files[0];
|
||||
var imageType = /image.*/;
|
||||
|
||||
if (file.type.match(imageType)) {
|
||||
var reader = new FileReader();
|
||||
|
||||
reader.onload = function(e) {
|
||||
// Clear the current image.
|
||||
$('#photo').remove();
|
||||
|
||||
// Create a new image with image crop functionality
|
||||
current_image = new Image();
|
||||
current_image.src = reader.result;
|
||||
current_image.id = "photo";
|
||||
current_image.style['maxWidth'] = image_dimension_x + 'px';
|
||||
current_image.style['maxHeight'] = image_dimension_y + 'px';
|
||||
current_image.onload = function() {
|
||||
// Calculate scaled image dimensions
|
||||
if (current_image.width > image_dimension_x || current_image.height > image_dimension_y) {
|
||||
if (current_image.width > current_image.height) {
|
||||
scaled_width = image_dimension_x;
|
||||
scaled_height = image_dimension_x * current_image.height / current_image.width;
|
||||
}
|
||||
if (current_image.width < current_image.height) {
|
||||
scaled_height = image_dimension_y;
|
||||
scaled_width = image_dimension_y * current_image.width / current_image.height;
|
||||
}
|
||||
if (current_image.width == current_image.height) {
|
||||
scaled_width = image_dimension_x;
|
||||
scaled_height = image_dimension_y;
|
||||
}
|
||||
}
|
||||
else {
|
||||
scaled_width = current_image.width;
|
||||
scaled_height = current_image.height;
|
||||
}
|
||||
|
||||
|
||||
// Position the modal div to the center of the screen
|
||||
$('#modal').css('display', 'block');
|
||||
var window_width = $(window).width() / 2 - scaled_width / 2 + "px";
|
||||
var window_height = $(window).height() / 2 - scaled_height / 2 + "px";
|
||||
|
||||
// Show image in modal view
|
||||
$("#preview").css("top", window_height);
|
||||
$("#preview").css("left", window_width);
|
||||
$('#preview').show(500);
|
||||
|
||||
|
||||
// Calculate selection rect
|
||||
var selection_width = 0;
|
||||
var selection_height = 0;
|
||||
|
||||
var max_x = Math.floor(scaled_height * aspX / aspY);
|
||||
var max_y = Math.floor(scaled_width * aspY / aspX);
|
||||
|
||||
|
||||
if (max_x > scaled_width) {
|
||||
selection_width = scaled_width;
|
||||
selection_height = max_y;
|
||||
}
|
||||
else {
|
||||
selection_width = max_x;
|
||||
selection_height = scaled_height;
|
||||
}
|
||||
|
||||
ias = $(this).Jcrop({
|
||||
onSelect: showCoords,
|
||||
onChange: showCoords,
|
||||
bgColor: '#747474',
|
||||
bgOpacity: .4,
|
||||
aspectRatio: aspX / aspY,
|
||||
setSelect: [0, 0, selection_width, selection_height]
|
||||
}, function() {
|
||||
jcrop_api = this;
|
||||
});
|
||||
}
|
||||
|
||||
// Add image to dropbox element
|
||||
dropbox.appendChild(current_image);
|
||||
}
|
||||
reader.readAsDataURL(file);
|
||||
|
||||
} else {
|
||||
dropbox.innerHTML = "File not supported!";
|
||||
}
|
||||
}
|
||||
|
||||
function showCoords(c) {
|
||||
x1 = c.x;
|
||||
y1 = c.y;
|
||||
x2 = c.x2;
|
||||
y2 = c.y2;
|
||||
}
|
||||
|
||||
function preview() {
|
||||
// Set canvas
|
||||
var canvas = document.getElementById('myCanvas');
|
||||
var context = canvas.getContext('2d');
|
||||
|
||||
// Delete previous image on canvas
|
||||
context.clearRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
// Set selection width and height
|
||||
var sw = x2 - x1;
|
||||
var sh = y2 - y1;
|
||||
|
||||
|
||||
// Set image original width and height
|
||||
var imgWidth = current_image.naturalWidth;
|
||||
var imgHeight = current_image.naturalHeight;
|
||||
|
||||
// Set selection koeficient
|
||||
var kw = imgWidth / $("#preview").width();
|
||||
var kh = imgHeight / $("#preview").height();
|
||||
|
||||
// Set canvas width and height and draw selection on it
|
||||
canvas.width = aspX;
|
||||
canvas.height = aspY;
|
||||
context.drawImage(current_image, (x1 * kw), (y1 * kh), (sw * kw), (sh * kh), 0, 0, aspX, aspY);
|
||||
|
||||
// Convert canvas image to normal img
|
||||
var dataUrl = canvas.toDataURL();
|
||||
var imageFoo = document.createElement('img');
|
||||
imageFoo.src = dataUrl;
|
||||
|
||||
// Append it to the body element
|
||||
$('#preview').delay(100).hide();
|
||||
$('#modal').hide();
|
||||
file_display_area.html('');
|
||||
file_display_area.append(imageFoo);
|
||||
|
||||
}
|
||||
|
||||
$(window).resize(function() {
|
||||
// Position the modal div to the center of the screen
|
||||
var window_width = $(window).width() / 2 - scaled_width / 2 + "px";
|
||||
var window_height = $(window).height() / 2 - scaled_height / 2 + "px";
|
||||
|
||||
// Show image in modal view
|
||||
$("#preview").css("top", window_height);
|
||||
$("#preview").css("left", window_width);
|
||||
});
|
||||
}
|
||||
}(jQuery));
|
||||
@@ -325,7 +325,7 @@ class lehreinheitmitarbeiter extends basis_db
|
||||
* @param $uid
|
||||
* @return true wenn die Zuteilung existiert sonst false
|
||||
*/
|
||||
public function existsLV($lehrveranstaltung_id, $studiensemester_kurzbz, $uid)
|
||||
public function existsLV($lehrveranstaltung_id, $studiensemester_kurzbz=NULL, $uid)
|
||||
{
|
||||
if(!is_numeric($lehrveranstaltung_id))
|
||||
{
|
||||
@@ -340,8 +340,12 @@ class lehreinheitmitarbeiter extends basis_db
|
||||
JOIN lehre.tbl_lehreinheit USING(lehreinheit_id)
|
||||
WHERE
|
||||
lehrveranstaltung_id=".$this->db_add_param($lehrveranstaltung_id, FHC_INTEGER)."
|
||||
AND studiensemester_kurzbz=".$this->db_add_param($studiensemester_kurzbz)."
|
||||
AND mitarbeiter_uid=".$this->db_add_param($uid).';';
|
||||
AND mitarbeiter_uid=".$this->db_add_param($uid);
|
||||
|
||||
if(!is_null($studiensemester_kurzbz))
|
||||
$qry .= " AND studiensemester_kurzbz=".$this->db_add_param($studiensemester_kurzbz);
|
||||
|
||||
$qry .= ";";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
|
||||
@@ -168,6 +168,7 @@ $menu=array
|
||||
'Infoscreen'=>array('name'=>'Infoscreen', 'link'=>'stammdaten/infoscreen_frameset.html', 'target'=>'main','permissions'=>array('basis/infoscreen')),
|
||||
'Ferien'=>array('name'=>'Ferien', 'link'=>'lehre/ferienverwaltung.php', 'target'=>'main','permissions'=>array('admin')),
|
||||
'Service'=>array('name'=>'Service', 'link'=>'stammdaten/service_frameset.html', 'target'=>'main','permissions'=>array('basis/service')),
|
||||
'Dokumentvorlagen'=>array('name'=>'Dokumentvorlagen', 'link'=>'stammdaten/dokumentvorlagen_verwaltung.php', 'target'=>'main','permissions'=>array('basis/dokumente')),
|
||||
'FH Ausweis'=>array
|
||||
(
|
||||
'name'=>'FH Ausweis','permissions'=>array('basis/fhausweis'),
|
||||
|
||||
@@ -110,7 +110,7 @@ class vorlage extends basis_db
|
||||
$qry = 'UPDATE public.tbl_vorlage
|
||||
SET bezeichnung='.$this->db_add_param($this->bezeichnung).',
|
||||
anmerkung='.$this->db_add_param($this->anmerkung).',
|
||||
mimetype='.$this->db_add_param($this->mimetype).',
|
||||
mimetype='.$this->db_add_param($this->mimetype).'
|
||||
WHERE vorlage_kurzbz='.$this->db_add_param($this->vorlage_kurzbz).';';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user