summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorSebastian Wagner2011-09-05 18:53:07 +0200
committerSebastian Wagner2011-09-05 18:53:07 +0200
commita47d8926df3ea36dea2cd33b36d6ccc9eabefc2d (patch)
treeec12795e17663865c959d0ed91ef91e33626c6f6 /application
parenttwo more final states added (diff)
downloadpoolctrl-a47d8926df3ea36dea2cd33b36d6ccc9eabefc2d.tar.gz
poolctrl-a47d8926df3ea36dea2cd33b36d6ccc9eabefc2d.tar.xz
poolctrl-a47d8926df3ea36dea2cd33b36d6ccc9eabefc2d.zip
eventmove- and eventlistAction added
Diffstat (limited to 'application')
-rw-r--r--application/controllers/EventController.php58
-rw-r--r--application/views/scripts/event/index.phtml19
2 files changed, 51 insertions, 26 deletions
diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index 175e454..e47a8d5 100644
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -495,28 +495,43 @@ class EventController extends Zend_Controller_Action
$this->view->params = $params;
}
}
+
+ /*
+ * ------------------------
+ * START CALENDAR FUNCTIONS
+ * ------------------------
+ */
+
+ public function eventmoveAction() {
+
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ $event = new Application_Model_Event();
- public function moveeventAction($id=null, $dayDelta, $allDay){
+ $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 ($id!=null) {
- $ev = $this->Event->findById($id); //1 - locate the event in the DB
- if ($allDay=='true') { //2- handle all day events
- $ev['Event']['allday'] = 1;
- } else {
- $ev['Event']['allday'] = 0;
- }
- //3 - Start
- $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->Event->save($ev); //4 - Save the event with the new data
- //5 - 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)));
- }
- }
+ if ($evid!=null) {
+ $event = $this->eventMapper->find($evid,$event); //locate the event in the DB
+ $event->setStart($evstart);
+ $event->setEnd($evend);
+
+ //$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
+ //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)));
+ }
+ }
- public function listeventsAction(){
+ public function eventlistAction() {
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
@@ -548,6 +563,13 @@ class EventController extends Zend_Controller_Action
echo json_encode($events);
}
+ /*
+ * ----------------------
+ * END CALENDAR FUNCTIONS
+ * ----------------------
+ */
+
+
public function runAction() {
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
diff --git a/application/views/scripts/event/index.phtml b/application/views/scripts/event/index.phtml
index 634d65c..cebb386 100644
--- a/application/views/scripts/event/index.phtml
+++ b/application/views/scripts/event/index.phtml
@@ -76,7 +76,7 @@ var lastview;
- events: "/event/listevents",
+ events: "/event/eventlist",
dayClick: function(date, allDay, jsEvent, view) {
@@ -114,7 +114,7 @@ var lastview;
}
},
-
+
eventDrop: function(event,dayDelta,minuteDelta,allDay,revertFunc) {
alert(
@@ -123,21 +123,24 @@ var lastview;
minuteDelta + " minutes."
);
+ /*
+ * -------------------------
+ * allDay is not implemented
+ * -------------------------
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();
}else{
- var eventID = evnet.id;
- var newStart = event.start;
- var newEnd = event.end;
- alert("Event: " + eventID + "\n" +
- "New start: " + newStart + "\n" +
- "New end: " + newEnd);
+ 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);
}
},