summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorSebastian Wagner2011-09-28 15:46:13 +0200
committerSebastian Wagner2011-09-28 15:46:13 +0200
commite30533c684e5cbc5766cede4534fbf3327a87b4f (patch)
treef0ff3d5b37fb1a604a89d8fac64341a1c7e6c37a /application
parentresize wdh events implemented (diff)
downloadpoolctrl-e30533c684e5cbc5766cede4534fbf3327a87b4f.tar.gz
poolctrl-e30533c684e5cbc5766cede4534fbf3327a87b4f.tar.xz
poolctrl-e30533c684e5cbc5766cede4534fbf3327a87b4f.zip
move wdh events implemented
Diffstat (limited to 'application')
-rwxr-xr-xapplication/controllers/EventController.php45
-rwxr-xr-xapplication/views/scripts/event/index.phtml7
2 files changed, 48 insertions, 4 deletions
diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index 83ec5d7..53d866d 100755
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -563,6 +563,50 @@ class EventController extends Zend_Controller_Action
$this->eventMapper->save($event); //save the event with the new data
}
}
+
+ public function eventmoveallAction() {
+ if(!$this->acl->checkRight('eo')) {
+ $this->_redirect('/');
+ }
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ $event = new Application_Model_Event();
+
+ $eventTitle = $this->getRequest()->getParam('eventTitle');
+ $evmindelta = $this->getRequest()->getParam('evmindelta');
+ $evdaydelta = $this->getRequest()->getParam('evdaydelta');
+ $poolID = $this->getRequest()->getParam('poolID');
+
+ if ($eventTitle!=null) {
+
+ $events = $this->eventMapper->findBy(array("title" => $eventTitle));
+ if ($events[0]->getPbs_membershipID() != $this->userIDsNamespace['membershipID']) {
+ if (!$this->acl->checkRight('edo')) {
+ $this->_redirect('/');
+ }
+ }
+ try {
+ foreach($events as $event) {
+ //1min = 60sec, 1d = 86400sec
+ $eventStart = date('Y-m-d H:i:s', intval(strtotime($event->getStart())) + intval($evmindelta*60) + intval($evdaydelta*86400));
+ $eventEnd = date('Y-m-d H:i:s', intval(strtotime($event->getEnd())) + intval($evmindelta*60) + intval($evdaydelta*86400));
+ $event->setStart($eventStart);
+ $event->setEnd($eventEnd);
+ $event->setPbs_poolID($poolID);
+ $this->eventMapper->save($event); //save the event with the new data
+ }
+ } catch (Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect('/event/');
+ } else {
+ $this->_redirect('/event/');
+ return;
+ }
+ }
public function eventresizeAction() {
if(!$this->acl->checkRight('eo')) {
@@ -612,7 +656,6 @@ class EventController extends Zend_Controller_Action
try {
foreach($events as $event) {
$eventEnd = date('Y-m-d H:i:s', intval(strtotime($event->getEnd())) + intval($evmindelta*60));
- $end = ($event->getEnd() + $evmindelta);
$event->setEnd($eventEnd);
$event->setPbs_poolID($poolID);
$this->eventMapper->save($event); //save the event with the new data
diff --git a/application/views/scripts/event/index.phtml b/application/views/scripts/event/index.phtml
index 9179e0d..b46928f 100755
--- a/application/views/scripts/event/index.phtml
+++ b/application/views/scripts/event/index.phtml
@@ -408,15 +408,16 @@ var dayClick = false;
title: 'Move ' + event.title,
buttons: {
"Cancel": function() {
- $(this).dialog("close");
- revertFunc();
+ $(this).dialog("close");
+ revertFunc();
},
"Move just this Event": function() {
$(this).dialog("close");
- $.post("/event/eventmove/evid/" + event.id + "/evstart/" + event.start + "/evend/" + event.end);
+ $.post("/event/eventmove/evid/" + event.id + "/evstart/" + event.start + "/evend/" + event.end);
},
"Move all Events": function() {
$(this).dialog("close");
+ self.location="/event/eventmoveall/eventTitle/" + event.title + "/evmindelta/" + minuteDelta + "/evdaydelta/" + dayDelta + "/poolID/" + $("#poolselectbox option:selected").val();
}
},
open: function () {