summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/controllers/EventController.php32
-rw-r--r--application/forms/EventAdd.php3
-rw-r--r--application/views/scripts/event/index.phtml65
3 files changed, 55 insertions, 45 deletions
diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index e47a8d5..295b946 100644
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -512,22 +512,32 @@ class EventController extends Zend_Controller_Action
$evid = $this->getRequest()->getParam('evid');
$evstart = $this->getRequest()->getParam('evstart');
$evend = $this->getRequest()->getParam('evend');
- //var_dump($eid);
-
- //$eventList = $this->eventMapper->fetchAll();
- //$ev = array();
if ($evid!=null) {
- $event = $this->eventMapper->find($evid,$event); //locate the event in the DB
- $event->setStart($evstart);
- $event->setEnd($evend);
+ $this->eventMapper->find($evid,$event); //locate the event in the DB
+ $event->setStart(date('Y-m-d H:i:s', strtotime(substr($evstart, 0, 24))));
+ $event->setEnd(date('Y-m-d H:i:s', strtotime(substr($evend, 0, 24))));
- //$ev['Event']['end']=date('Y-m-d H:i:s',strtotime(''.$dayDelta.' days '.$minDelta.' minutes',strtotime($ev['Event']['end'])));
- //$ev['Event']['start']=date('Y-m-d H:i:s',strtotime(''.$dayDelta.' days '.$minDelta.' minutes',strtotime($ev['Event']['start'])));
+ $this->eventMapper->save($event); //save the event with the new data
+ }
+ }
+
+ public function eventresizeAction() {
+
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+ $event = new Application_Model_Event();
+
+ $evid = $this->getRequest()->getParam('evid');
+ $evend = $this->getRequest()->getParam('evend');
+
+ var_dump(date('Y-m-d H:i:s', strtotime(substr($evend, 0, 24))));
+ if ($evid!=null) {
+ $this->eventMapper->find($evid,$event); //locate the event in the DB
+ $event->setEnd(date('Y-m-d H:i:s', strtotime(substr($evend, 0, 24))));
+
$this->eventMapper->save($event); //save the event with the new data
- //redirect and reload
- //$this->redirect(array('controller' => "events", 'action' => "calendar",substr($ev['Event']['start'],0,4),substr($ev['Event']['start'],5,2),substr($ev['Event']['start'],8,2)));
}
}
diff --git a/application/forms/EventAdd.php b/application/forms/EventAdd.php
index b803873..828c68d 100644
--- a/application/forms/EventAdd.php
+++ b/application/forms/EventAdd.php
@@ -48,6 +48,9 @@ class Application_Form_EventAdd extends Zend_Form
{
$this->setName('EventAdd');
$this->setMethod('post');
+
+ $evstart = $this->getRequest()->getParam('evstart');
+ var_dump($evstart);
$this->addElement('text', 'title', array(
'filters' => array('StringTrim'),
diff --git a/application/views/scripts/event/index.phtml b/application/views/scripts/event/index.phtml
index cebb386..d780d4f 100644
--- a/application/views/scripts/event/index.phtml
+++ b/application/views/scripts/event/index.phtml
@@ -66,6 +66,7 @@ var lastview;
right: 'agendaWeek,agendaDay'
},
editable: true,
+ allDaySlot: false,
// disableDragging: false,
// droppable: true,
selectable: true,
@@ -78,7 +79,7 @@ var lastview;
events: "/event/eventlist",
- dayClick: function(date, allDay, jsEvent, view) {
+ dayClick: function( date, allDay, jsEvent, view ) {
self.location="/event/add/";
},
@@ -86,43 +87,41 @@ var lastview;
eventClick: function(calEvent) {
alert('Event: ' + calEvent.title +
- '\nStart: ' + calEvent.start +
- '\nEnd: ' + calEvent.end +
- '\nNote: ' + calEvent.note +
- '\nCategory: ' + calEvent.category +
- '\nParticipants ' + calEvent.participants);
+ '\nStart: ' + calEvent.start +
+ '\nEnd: ' + calEvent.end +
+ '\nNote: ' + calEvent.note +
+ '\nCategory: ' + calEvent.category +
+ '\nParticipants: ' + calEvent.participants);
+ //$(this).css('color', 'red');
},
- eventResize: function(event,dayDelta,minuteDelta,revertFunc) {
+ select: function( startDate, endDate, allDay, jsEvent, view ) {
- alert(
- "The end date of " + event.title + " has been moved " +
- dayDelta + " days and " +
- minuteDelta + " minutes."
- );
+ //$.post("/event/add/evstart" + startDate + "/evend" + endDate);
+ //self.location="/event/add/evstart" + startDate + "/evend" + endDate;
+ alert(startDate + "\n" + endDate);
+ //if (!confirm("Are you sure to add an Event from " + startDate + " to " + endDate + " ?")) {
+ //}else {}
+
+ },
+
+ eventResize: function( event,dayDelta,minuteDelta,revertFunc ) {
+
+ var length;
+ var min = minuteDelta;
+
+ if (minuteDelta > 0) { length = 'longer';
+ }else{ length = 'shorter'; }
- if (!confirm("Is this correct?")) {
+ if (!confirm( event.title + " is now " + minuteDelta + " minutes " + length + ".\n\n" + "Is this correct?")) {
revertFunc();
}else{
- var eventID = evnet.id;
- var newStart = event.start;
- var newEnd = event.end;
- alert("Event: " + eventID + "\n" +
- "New start: " + newStart + "\n" +
- "New end: " + newEnd);
-
+ $.post("/event/eventresize/evid/" + event.id + "/evend/" + event.end);
}
},
- eventDrop: function(event,dayDelta,minuteDelta,allDay,revertFunc) {
-
- alert(
- event.title + " was moved " +
- dayDelta + " days and " +
- minuteDelta + " minutes."
- );
-
+ eventDrop: function( event,dayDelta,minuteDelta,allDay,revertFunc ) {
/*
* -------------------------
* allDay is not implemented
@@ -134,18 +133,15 @@ var lastview;
}
*/
- if (!confirm("Are you sure about this change?")) {
+ if (!confirm(event.title + " was moved to " + event.start + "\n\n" + "Are you sure about this change?")) {
revertFunc();
}else{
- alert("Event: " + event.id + "\n" +
- "New start: " + event.start + "\n" +
- "New end: " + event.end);
- $.post("/event/eventmove/evid/"+event.id+"/evstart/"+event.start+"/evend/"+event.end);
+ $.post("/event/eventmove/evid/" + event.id + "/evstart/" + event.start + "/evend/" + event.end);
}
},
- eventRender: function(event, element) {
+ eventRender: function( event, element ) {
},
viewDisplay: function(view) {
@@ -163,6 +159,7 @@ var lastview;
$('.fc-header-center').append('<span class="fc-button fc-state-default fc-corner-right fc-state-active"><span class="fc-button-inner"><span id="maintenance" class="fc-button-content">Maintenance</span><span class="fc-button-effect"><span></span></span></span></span>');
$('.fc-header-center').append('<span class="fc-button fc-state-default fc-corner-right fc-state-active"><span class="fc-button-inner"><span id="boot" class="fc-button-content">Boot</span><span class="fc-button-effect"><span></span></span></span></span>');
$('.fc-header-center').append('<span class="fc-button fc-state-default fc-corner-right fc-state-active"><span class="fc-button-inner"><span id="shutdown" class="fc-button-content">Shutdown</span><span class="fc-button-effect"><span></span></span></span></span>');
+ $('.fc-header-right').append('<span class="fc-button fc-state-default fc-corner-right fc-state-active"><span class="fc-button-inner"><span id="addevent" class="fc-button-content">Add Event</span><span class="fc-button-effect"><span></span></span></span></span>');
$("#lecture").click(function() {alert('test');})
}
</script>