summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorSebastian Wagner2011-09-28 15:24:32 +0200
committerSebastian Wagner2011-09-28 15:24:32 +0200
commitcfd4098feb3e1101911df9bccdbd72c1a6a8b1cb (patch)
treef6a047726230ab48d040a5cbaa3d4136ef0bbd54 /application
parentminor (diff)
downloadpoolctrl-cfd4098feb3e1101911df9bccdbd72c1a6a8b1cb.tar.gz
poolctrl-cfd4098feb3e1101911df9bccdbd72c1a6a8b1cb.tar.xz
poolctrl-cfd4098feb3e1101911df9bccdbd72c1a6a8b1cb.zip
resize wdh events implemented
Diffstat (limited to 'application')
-rwxr-xr-xapplication/controllers/EventController.php49
-rwxr-xr-xapplication/views/scripts/event/index.phtml40
2 files changed, 83 insertions, 6 deletions
diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index 6a56263..83ec5d7 100755
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -576,20 +576,59 @@ class EventController extends Zend_Controller_Action
$evid = $this->getRequest()->getParam('evid');
$evend = $this->getRequest()->getParam('evend');
$poolID = $this->getRequest()->getParam('poolID');
- if($poolID != null); {
- }
-
- var_dump(date('Y-m-d H:i:s', strtotime(substr($evend, 0, 24))));
+ //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))));
- $event->setPoolID($poolID);
+ $event->setPbs_poolID($poolID);
$this->eventMapper->save($event); //save the event with the new data
}
}
+
+ public function eventresizeallAction() {
+ 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');
+ $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) {
+ $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
+ }
+ } 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 eventlistAction() {
if(!$this->acl->checkRight('eo')) {
diff --git a/application/views/scripts/event/index.phtml b/application/views/scripts/event/index.phtml
index 96cfa5d..9179e0d 100755
--- a/application/views/scripts/event/index.phtml
+++ b/application/views/scripts/event/index.phtml
@@ -309,6 +309,7 @@ var dayClick = false;
eventResize: function( event, dayDelta, minuteDelta, revertFunc ) {
$(this).qtip("destroy");
if($.get("/event/checkright/rightShortcut/er")) {
+ if(event.repeat == 0) {
$(function() {
$( "#defaultDialog" ).dialog({
autoOpen: false,
@@ -333,7 +334,37 @@ var dayClick = false;
});
$( "#defaultDialog" ).dialog('open');
$(this).qtip("destroy");
- } else {
+ } else if (event.repeat == 1) {
+ $(function() {
+ $( "#eventResizeWdhDialog" ).dialog({
+ autoOpen: false,
+ width: 600,
+ modal: true,
+ title: 'Resize ' + event.title + ' (' + minuteDelta + ' minutes)',
+ buttons: {
+ "Cancel": function() {
+ $(this).dialog("close");
+ revertFunc();
+ },
+ "Resize just this Event": function() {
+ $(this).dialog("close");
+ $.post("/event/eventresize/evid/" + event.id + "/evend/" + event.end + "/poolID/" + $("#poolselectbox option:selected").val());
+ },
+ "Resize all Events": function() {
+ $(this).dialog("close");
+ self.location="/event/eventresizeall/eventTitle/" + event.title + "/evmindelta/" + minuteDelta + "/poolID/" + $("#poolselectbox option:selected").val();
+ }
+ },
+ open: function () {
+ $(".ui-dialog-titlebar-close").hide();
+ //$(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error");
+ }
+ });
+ });
+ $( "#eventResizeWdhDialog" ).dialog('open');
+ }
+ }
+ else {
revertFunc();
$( "#errorRightsDialog" ).dialog('open');
}
@@ -630,6 +661,13 @@ var dayClick = false;
selected one?</p>
</div>
+<!-- resize wdhEvent -->
+<div id="eventResizeWdhDialog" style="display: none">
+<p>This is a Wdh-Event!</p>
+<p>Do you want to resize any event occurring this event or just the
+selected one?</p>
+</div>
+
<!-- move wdhEvent -->
<div id="eventMoveWdhDialog" style="display: none">
<p>This is a Wdh-Event!</p>