mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-17 03:59:28 +00:00
Coodle Loeschen von Terminvorschlaegen hinzugefuegt
This commit is contained in:
@@ -164,10 +164,86 @@ switch($work)
|
||||
if($coodletermin->saveTermin(true))
|
||||
echo $coodletermin->coodle_termin_id;
|
||||
else
|
||||
echo $this->errormsg;
|
||||
echo $coodletermin->errormsg;
|
||||
|
||||
break;
|
||||
|
||||
case 'moveTermin':
|
||||
if(isset($_POST['datum']))
|
||||
$datum = $_POST['datum'];
|
||||
else
|
||||
die('Datum fehlt');
|
||||
|
||||
if(isset($_POST['uhrzeit']))
|
||||
$uhrzeit = $_POST['uhrzeit'];
|
||||
else
|
||||
die('Uhrzeit fehlt');
|
||||
|
||||
if(isset($_POST['coodle_id']))
|
||||
$coodle_id = $_POST['coodle_id'];
|
||||
else
|
||||
die('CoodleID fehlt');
|
||||
|
||||
if(isset($_POST['coodle_termin_id']))
|
||||
$coodle_termin_id = $_POST['coodle_termin_id'];
|
||||
else
|
||||
die('CoodleTerminID fehlt');
|
||||
|
||||
$coodle = new coodle();
|
||||
if(!$coodle->load($coodle_id))
|
||||
die('Fehler: '.$coodle->errormsg);
|
||||
|
||||
if($coodle->ersteller_uid!=$user)
|
||||
die('Diese Aktion ist nur durch den Ersteller der Umfrage möglich');
|
||||
|
||||
$coodletermin = new coodle();
|
||||
if(!$coodletermin->loadTermin($coodle_termin_id))
|
||||
die('Fehler: '.$coodletermin->errormsg);
|
||||
|
||||
$coodletermin->datum = $datum;
|
||||
$coodletermin->uhrzeit = $uhrzeit;
|
||||
$coodletermin->coodle_termin_id = $coodle_termin_id;
|
||||
|
||||
if($coodletermin->saveTermin(false))
|
||||
echo 'true';
|
||||
else
|
||||
echo $coodletermin->errormsg;
|
||||
|
||||
break;
|
||||
|
||||
case 'removeTermin':
|
||||
if(isset($_POST['coodle_id']))
|
||||
$coodle_id = $_POST['coodle_id'];
|
||||
else
|
||||
die('CoodleID fehlt');
|
||||
|
||||
if(isset($_POST['coodle_termin_id']))
|
||||
$coodle_termin_id = $_POST['coodle_termin_id'];
|
||||
else
|
||||
die('CoodleTerminID fehlt');
|
||||
|
||||
$coodle = new coodle();
|
||||
if(!$coodle->load($coodle_id))
|
||||
die('Fehler: '.$coodle->errormsg);
|
||||
|
||||
if($coodle->ersteller_uid!=$user)
|
||||
die('Diese Aktion ist nur durch den Ersteller der Umfrage möglich');
|
||||
|
||||
$coodletermin = new coodle();
|
||||
if(!$coodletermin->loadTermin($coodle_termin_id))
|
||||
die('Fehler: '.$coodletermin->errormsg);
|
||||
|
||||
if($coodle->coodle_id!=$coodletermin->coodle_id)
|
||||
{
|
||||
die('Termin und Umfrage passen nicht zusammen!');
|
||||
}
|
||||
|
||||
if($coodletermin->deleteTermin($coodle_termin_id))
|
||||
echo 'true';
|
||||
else
|
||||
echo $coodletermin->errormsg;
|
||||
|
||||
break;
|
||||
default:
|
||||
die('Invalid Work Parameter');
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ echo '<html>
|
||||
<link rel="stylesheet" type="text/css" href="../../../include/js/fullcalendar/fullcalendar.print.css" media="print" />
|
||||
<script type="text/javascript" src="../../../include/js/jquery-ui.js"></script>
|
||||
<script type="text/javascript" src="../../../include/js/fullcalendar/fullcalendar.min.js"></script>
|
||||
<script type="text/javascript" src="../../../include/js/jquery.contextmenu.r2.js"></script>
|
||||
<title>'.$p->t('coodle/coodle').' - '.$p->t('coodle/termine').'</title>
|
||||
|
||||
<style type="text/css">
|
||||
@@ -159,7 +160,8 @@ echo '<html>
|
||||
{
|
||||
var eventObject =
|
||||
{
|
||||
title: $.trim($(this).text()) // use the elements text as the event title
|
||||
title: $.trim($(this).text()), // use the elements text as the event title
|
||||
termin: true
|
||||
};
|
||||
|
||||
// store the Event Object in the DOM element so we can get to it later
|
||||
@@ -218,7 +220,9 @@ echo '<html>
|
||||
week: "MMM d[ yyyy]{ \'—\'[ MMM] d yyyy}", // Sep 7 - 13 2009
|
||||
day: "dddd, MMM d, yyyy" // Tuesday, Sep 8, 2009
|
||||
},
|
||||
defaultEventMinutes: '.$coodle->dauer.',
|
||||
editable: true,
|
||||
disableResizing: true,
|
||||
droppable: true, // this allows things to be dropped onto the calendar !!!
|
||||
drop: function(date, allDay)
|
||||
{
|
||||
@@ -236,7 +240,7 @@ echo '<html>
|
||||
|
||||
// Datum konvertieren
|
||||
datum = $.fullCalendar.formatDate(date, "yyyy-MM-dd");
|
||||
uhrzeit = $.fullCalendar.formatDate(date, "hh:mm:ss");
|
||||
uhrzeit = $.fullCalendar.formatDate(date, "HH:mm:ss");
|
||||
//alert("datum:"+datum+" uhrzeit:"+uhrzeit);
|
||||
|
||||
// Termin Speichern
|
||||
@@ -266,40 +270,82 @@ echo '<html>
|
||||
},
|
||||
eventDrop: function(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view)
|
||||
{
|
||||
/*
|
||||
alert(
|
||||
event.title + " was moved " +
|
||||
dayDelta + " days and " +
|
||||
minuteDelta + " minutes."
|
||||
);
|
||||
|
||||
if (allDay) {
|
||||
alert("Event is now all-day");
|
||||
}else{
|
||||
alert("Event has a time-of-day");
|
||||
}
|
||||
|
||||
if (!confirm("Are you sure about this change?")) {
|
||||
revertFunc();
|
||||
}
|
||||
event.id + " was moved " +
|
||||
$.fullCalendar.formatDate(event.start,"yyyy-MM-dd HH:mm:ss")
|
||||
);*/
|
||||
|
||||
datum = $.fullCalendar.formatDate(event.start,"yyyy-MM-dd")
|
||||
uhrzeit = $.fullCalendar.formatDate(event.start,"HH:mm:ss")
|
||||
// Verschiebung Speichern
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:"coodle_worker.php",
|
||||
data:{
|
||||
"work": "moveTermin",
|
||||
"datum": datum,
|
||||
"uhrzeit": uhrzeit,
|
||||
"coodle_termin_id": event.id,
|
||||
"coodle_id": "'.$coodle_id.'"
|
||||
},
|
||||
success: function(data)
|
||||
{
|
||||
if(data!="true")
|
||||
{
|
||||
alert("ERROR:"+data)
|
||||
revertFunc();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Verschiebung OK
|
||||
}
|
||||
},
|
||||
error: function() { alert("error"); }
|
||||
});
|
||||
},
|
||||
eventResize: function(event,dayDelta,minuteDelta,revertFunc, ui, view)
|
||||
{
|
||||
|
||||
alert(
|
||||
"The end date of " + event.title + "has been moved " +
|
||||
dayDelta + " days and " +
|
||||
minuteDelta + " minutes."
|
||||
);
|
||||
|
||||
if (!confirm("is this okay?")) {
|
||||
revertFunc();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
eventRender: function (event, element)
|
||||
{
|
||||
// Conext Menue nur an Umfragetermine nicht an FreeBusy Eintraege haengen
|
||||
if(event.termin)
|
||||
{
|
||||
element.contextMenu("myContextMenu",
|
||||
{
|
||||
bindings:
|
||||
{
|
||||
"delete": function(t)
|
||||
{
|
||||
// Termin loeschen
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:"coodle_worker.php",
|
||||
data:{
|
||||
"work": "removeTermin",
|
||||
"coodle_termin_id": event.id,
|
||||
"coodle_id": "'.$coodle_id.'"
|
||||
},
|
||||
success: function(data)
|
||||
{
|
||||
if(data!="true")
|
||||
{
|
||||
alert("ERROR:"+data)
|
||||
revertFunc();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Loeschen aus DB OK
|
||||
//Event aus Kalender entfernen
|
||||
$("#calendar").fullCalendar("removeEvents", event.id);
|
||||
}
|
||||
},
|
||||
error: function() { alert("error"); }
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -308,7 +354,13 @@ echo '<html>
|
||||
<body>
|
||||
<h1>'.$p->t('coodle/coodle').' - '.$p->t('coodle/termine').'</h1>';
|
||||
|
||||
|
||||
// Contextmenue
|
||||
echo '
|
||||
<div id="myContextMenu" class="contextMenu">
|
||||
<ul>
|
||||
<li id="delete"><img src="../../../skin/images/delete_round.png" />'.$p->t('global/entfernen').'</li>
|
||||
</ul>
|
||||
</div>';
|
||||
//echo '<h2>'.$coodle->titel.'</h2>';
|
||||
//echo $coodle->beschreibung;
|
||||
|
||||
@@ -528,7 +580,8 @@ foreach($coodletermin->result as $row)
|
||||
id: "'.$db->convert_html_chars($row->coodle_termin_id).'",
|
||||
title: "'.$db->convert_html_chars($event_titel).'",
|
||||
start: "'.$db->convert_html_chars($row->datum).'T'.$db->convert_html_chars($row->uhrzeit).'",
|
||||
allDay: false
|
||||
allDay: false,
|
||||
termin: true
|
||||
};
|
||||
$("#calendar").fullCalendar("renderEvent", eventObject, true);
|
||||
';
|
||||
|
||||
@@ -585,7 +585,7 @@ class coodle extends basis_db
|
||||
else
|
||||
{
|
||||
$qry='UPDATE campus.tbl_coodle_termin SET'.
|
||||
' datum='.$this->db_add_param($this->datum).
|
||||
' datum='.$this->db_add_param($this->datum).','.
|
||||
' uhrzeit='.$this->db_add_param($this->uhrzeit).
|
||||
' WHERE coodle_termin_id='.$this->db_add_param($this->coodle_termin_id);
|
||||
}
|
||||
@@ -656,5 +656,55 @@ class coodle extends basis_db
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt einen Termin
|
||||
* @param $coodle_termin_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function loadTermin($coodle_termin_id)
|
||||
{
|
||||
$qry = "SELECT * FROM campus.tbl_coodle_termin WHERE coodle_termin_id=".$this->db_add_param($coodle_termin_id);
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$this->coodle_termin_id = $row->coodle_termin_id;
|
||||
$this->coodle_id = $row->coodle_id;
|
||||
$this->datum = $row->datum;
|
||||
$this->uhrzeit = $row->uhrzeit;
|
||||
$this->auswahl = $this->db_parse_bool($row->auswahl);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Termin wurde nicht gefunden';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg ='Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loescht einen Termin
|
||||
* @param $coodle_termin_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function deleteTermin($coodle_termin_id)
|
||||
{
|
||||
$qry = "DELETE FROM campus.tbl_coodle_termin WHERE coodle_termin_id=".$this->db_add_param($coodle_termin_id);
|
||||
|
||||
if($this->db_query($qry))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Löschen des Eintrags';
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* ContextMenu - jQuery plugin for right-click context menus
|
||||
*
|
||||
* Author: Chris Domigan
|
||||
* Contributors: Dan G. Switzer, II
|
||||
* Parts of this plugin are inspired by Joern Zaefferer's Tooltip plugin
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Version: r2
|
||||
* Date: 16 July 2007
|
||||
*
|
||||
* For documentation visit http://www.trendskitchens.co.nz/jquery/contextmenu/
|
||||
*
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
var menu, shadow, trigger, content, hash, currentTarget;
|
||||
var defaults = {
|
||||
menuStyle: {
|
||||
listStyle: 'none',
|
||||
padding: '1px',
|
||||
margin: '0px',
|
||||
backgroundColor: '#fff',
|
||||
border: '1px solid #999',
|
||||
width: '100px'
|
||||
},
|
||||
itemStyle: {
|
||||
margin: '0px',
|
||||
color: '#000',
|
||||
display: 'block',
|
||||
cursor: 'default',
|
||||
padding: '3px',
|
||||
border: '1px solid #fff',
|
||||
backgroundColor: 'transparent'
|
||||
},
|
||||
itemHoverStyle: {
|
||||
border: '1px solid #0a246a',
|
||||
backgroundColor: '#b6bdd2'
|
||||
},
|
||||
eventPosX: 'pageX',
|
||||
eventPosY: 'pageY',
|
||||
shadow : true,
|
||||
onContextMenu: null,
|
||||
onShowMenu: null
|
||||
};
|
||||
|
||||
$.fn.contextMenu = function(id, options) {
|
||||
if (!menu) { // Create singleton menu
|
||||
menu = $('<div id="jqContextMenu"></div>')
|
||||
.hide()
|
||||
.css({position:'absolute', zIndex:'500'})
|
||||
.appendTo('body')
|
||||
.bind('click', function(e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
}
|
||||
if (!shadow) {
|
||||
shadow = $('<div></div>')
|
||||
.css({backgroundColor:'#000',position:'absolute',opacity:0.2,zIndex:499})
|
||||
.appendTo('body')
|
||||
.hide();
|
||||
}
|
||||
hash = hash || [];
|
||||
hash.push({
|
||||
id : id,
|
||||
menuStyle: $.extend({}, defaults.menuStyle, options.menuStyle || {}),
|
||||
itemStyle: $.extend({}, defaults.itemStyle, options.itemStyle || {}),
|
||||
itemHoverStyle: $.extend({}, defaults.itemHoverStyle, options.itemHoverStyle || {}),
|
||||
bindings: options.bindings || {},
|
||||
shadow: options.shadow || options.shadow === false ? options.shadow : defaults.shadow,
|
||||
onContextMenu: options.onContextMenu || defaults.onContextMenu,
|
||||
onShowMenu: options.onShowMenu || defaults.onShowMenu,
|
||||
eventPosX: options.eventPosX || defaults.eventPosX,
|
||||
eventPosY: options.eventPosY || defaults.eventPosY
|
||||
});
|
||||
|
||||
var index = hash.length - 1;
|
||||
$(this).bind('contextmenu', function(e) {
|
||||
// Check if onContextMenu() defined
|
||||
var bShowContext = (!!hash[index].onContextMenu) ? hash[index].onContextMenu(e) : true;
|
||||
if (bShowContext) display(index, this, e, options);
|
||||
return false;
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
function display(index, trigger, e, options) {
|
||||
var cur = hash[index];
|
||||
content = $('#'+cur.id).find('ul:first').clone(true);
|
||||
content.css(cur.menuStyle).find('li').css(cur.itemStyle).hover(
|
||||
function() {
|
||||
$(this).css(cur.itemHoverStyle);
|
||||
},
|
||||
function(){
|
||||
$(this).css(cur.itemStyle);
|
||||
}
|
||||
).find('img').css({verticalAlign:'middle',paddingRight:'2px'});
|
||||
|
||||
// Send the content to the menu
|
||||
menu.html(content);
|
||||
|
||||
// if there's an onShowMenu, run it now -- must run after content has been added
|
||||
// if you try to alter the content variable before the menu.html(), IE6 has issues
|
||||
// updating the content
|
||||
if (!!cur.onShowMenu) menu = cur.onShowMenu(e, menu);
|
||||
|
||||
$.each(cur.bindings, function(id, func) {
|
||||
$('#'+id, menu).bind('click', function(e) {
|
||||
hide();
|
||||
func(trigger, currentTarget);
|
||||
});
|
||||
});
|
||||
|
||||
menu.css({'left':e[cur.eventPosX],'top':e[cur.eventPosY]}).show();
|
||||
if (cur.shadow) shadow.css({width:menu.width(),height:menu.height(),left:e.pageX+2,top:e.pageY+2}).show();
|
||||
$(document).one('click', hide);
|
||||
}
|
||||
|
||||
function hide() {
|
||||
menu.hide();
|
||||
shadow.hide();
|
||||
}
|
||||
|
||||
// Apply defaults
|
||||
$.contextMenu = {
|
||||
defaults : function(userDefaults) {
|
||||
$.each(userDefaults, function(i, val) {
|
||||
if (typeof val == 'object' && defaults[i]) {
|
||||
$.extend(defaults[i], val);
|
||||
}
|
||||
else defaults[i] = val;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
$(function() {
|
||||
$('div.contextMenu').hide();
|
||||
});
|
||||
Reference in New Issue
Block a user