From 4561f98c7a00d74462ac771eae1796b6cca13566 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Fri, 21 Oct 2011 19:13:38 +0200 Subject: overlapping for resizing and selecting implemented --- application/controllers/EventController.php | 79 ++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 2 deletions(-) (limited to 'application/controllers') diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php index 4055e93..74efd39 100755 --- a/application/controllers/EventController.php +++ b/application/controllers/EventController.php @@ -659,7 +659,7 @@ class EventController extends Zend_Controller_Action $this->view->poollist = $poollist; } - public function checkoverlapeventsAction() { + public function checkoverlapdropAction() { if(!$this->acl->checkRight('eo')) { $this->_redirect('/'); } @@ -667,7 +667,6 @@ class EventController extends Zend_Controller_Action $eventID = $this->getRequest()->getParam('eventID'); $date = intval(strtotime(substr($this->getRequest()->getParam('date'), 0, 24))); - $events['withrepeat'] = $this->eventMapper->getDraggingEvents($eventID); $events['withoutrepeat'] = $this->eventMapper->getDraggingEvent($eventID); @@ -715,6 +714,82 @@ class EventController extends Zend_Controller_Action $this->view->overlapswithoutrepeat = $overlapswithoutrepeat; } + + public function checkoverlapselectAction() { + if(!$this->acl->checkRight('eo')) { + $this->_redirect('/'); + } + $this->_helper->layout->disableLayout(); + + $poolID = $this->getRequest()->getParam('poolID'); + $startDate = intval(strtotime(substr($this->getRequest()->getParam('startDate'), 0, 24))); + $endDate = intval(strtotime(substr($this->getRequest()->getParam('endDate'), 0, 24))); + + $allEvents = $this->eventMapper->fetchAllasArray($poolID); + + $overlaps = array(); + foreach($allEvents as $e) { + if($startDate <= strtotime($e['start']) && $endDate >= strtotime($e['start']) + || $startDate >= strtotime($e['start']) && $startDate <= strtotime($e['end'])) + $overlaps[] = $e; + } + + $this->view->overlaps = $overlaps; + + } + + public function checkoverlapresizeAction() { + if(!$this->acl->checkRight('eo')) { + $this->_redirect('/'); + } + $this->_helper->layout->disableLayout(); + + $poolID = $this->getRequest()->getParam('poolID'); + + $eventID = $this->getRequest()->getParam('eventID'); + $minuteDelta = intval($this->getRequest()->getParam('minuteDelta')*60); + $dayDelta = intval($this->getRequest()->getParam('dayDelta')*24*60*60); + $diffDelta = intval($minuteDelta + $dayDelta); + + $events['withrepeat'] = $this->eventMapper->getDraggingEvents($eventID); + $events['withoutrepeat'] = $this->eventMapper->getDraggingEvent($eventID); + + $others = $this->eventMapper->getNotDraggingEvents($eventID); + + // Check for overlap with repeat + $overlapswithrepeat = array(); + foreach($events['withrepeat'] as $e) { + + $enewstart = strtotime($e['start']); + $enewend = strtotime($e['end']) + $diffDelta; + + foreach($others as $o) { + if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) + || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end'])) + $overlapswithrepeat[] = $o; + } + } + + // Check for overlap without repeat + $overlapswithoutrepeat = array(); + foreach($events['withoutrepeat'] as $e) { + + $enewstart = strtotime($e['start']); + $enewend = strtotime($e['end']) + $diffDelta; + + foreach($others as $o) { + if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) + || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end'])) + $overlapswithoutrepeat[] = $o; + } + } + + $this->view->events = $events; + $this->view->others = $others; + $this->view->overlapswithrepeat = $overlapswithrepeat; + $this->view->overlapswithoutrepeat = $overlapswithoutrepeat; + + } public function eventmoveAction() { if(!$this->acl->checkRight('eo')) { -- cgit v1.2.3-55-g7522 From a0a342efa28584777af0d81dc5cdb71c2a078897 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Fri, 21 Oct 2011 20:54:43 +0200 Subject: some changes --- application/controllers/EventController.php | 19 ++++-- .../views/scripts/event/checkoverlapdrop.phtml | 10 +-- .../views/scripts/event/checkoverlapresize.phtml | 10 +-- .../views/scripts/event/checkoverlapselect.phtml | 6 -- application/views/scripts/event/index.phtml | 74 ++++++++++++---------- 5 files changed, 57 insertions(+), 62 deletions(-) (limited to 'application/controllers') diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php index 74efd39..65fcc49 100755 --- a/application/controllers/EventController.php +++ b/application/controllers/EventController.php @@ -682,6 +682,8 @@ class EventController extends Zend_Controller_Action // Check for overlap with repeat $overlapswithrepeat = array(); + $cfevents = array(); + foreach($events['withrepeat'] as $e) { $enewstart = strtotime($e['start']) + $diff; @@ -712,7 +714,7 @@ class EventController extends Zend_Controller_Action $this->view->others = $others; $this->view->overlapswithrepeat = $overlapswithrepeat; $this->view->overlapswithoutrepeat = $overlapswithoutrepeat; - + //$this->view->overlapswithoutrepeat = $cfevents; } public function checkoverlapselectAction() { @@ -735,7 +737,6 @@ class EventController extends Zend_Controller_Action } $this->view->overlaps = $overlaps; - } public function checkoverlapresizeAction() { @@ -758,6 +759,8 @@ class EventController extends Zend_Controller_Action // Check for overlap with repeat $overlapswithrepeat = array(); + $cfevents = array(); + foreach($events['withrepeat'] as $e) { $enewstart = strtotime($e['start']); @@ -772,6 +775,7 @@ class EventController extends Zend_Controller_Action // Check for overlap without repeat $overlapswithoutrepeat = array(); + foreach($events['withoutrepeat'] as $e) { $enewstart = strtotime($e['start']); @@ -780,7 +784,7 @@ class EventController extends Zend_Controller_Action foreach($others as $o) { if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end'])) - $overlapswithoutrepeat[] = $o; + $overlapswithoutrepeat[] = $o; } } @@ -788,7 +792,7 @@ class EventController extends Zend_Controller_Action $this->view->others = $others; $this->view->overlapswithrepeat = $overlapswithrepeat; $this->view->overlapswithoutrepeat = $overlapswithoutrepeat; - + $this->view->overlapswithoutrepeat = $cfevents; } public function eventmoveAction() { @@ -809,7 +813,8 @@ class EventController extends Zend_Controller_Action if ($evid!="null") { $this->eventMapper->find($evid,$event); //locate the event in the DB $this->eventMapper->find($evid,$oldEvent); - $event->setRepeat(0); + //es beleibt ein repeatEvent! ob alle verschoben werden oder nur das selektierte wird über den kalender abgefragt + //$event->setRepeat(0); $event->setRepeattype(null); $event->setRepeatend(null); $event->setRepeatdate(null); @@ -894,6 +899,8 @@ class EventController extends Zend_Controller_Action $evmindelta = $this->getRequest()->getParam('evmindelta'); $evdaydelta = $this->getRequest()->getParam('evdaydelta'); $poolID = $this->getRequest()->getParam('poolID'); + + //$cfevents = $this-getRequest()->getParam('cfevents'); if ($eventTitle!=null) { @@ -1047,6 +1054,8 @@ class EventController extends Zend_Controller_Action $eventTitle = $this->getRequest()->getParam('eventTitle'); $evmindelta = $this->getRequest()->getParam('evmindelta'); $poolID = $this->getRequest()->getParam('poolID'); + + //$cfevents = $this-getRequest()->getParam('cfevents'); if ($eventTitle!=null) { diff --git a/application/views/scripts/event/checkoverlapdrop.phtml b/application/views/scripts/event/checkoverlapdrop.phtml index 6558e19..1ca1b29 100644 --- a/application/views/scripts/event/checkoverlapdrop.phtml +++ b/application/views/scripts/event/checkoverlapdrop.phtml @@ -1,9 +1,5 @@ overlaps); -//$overlaps[] = array(); - - +$output['cfevents'] = $this->cfevents; if(count($this->overlapswithrepeat) == 0) { $output['withrepeat'] = -1; @@ -14,8 +10,6 @@ else { $output['withrepeat'] .= '
  • ' . 'EventID: ' . $o['eventID'] . ', Title: ' . $o['title'] . ', Start: ' . $o['start'] . ', End: ' . $o['end'] . '
  • '; } $output['withrepeat'] .= ''; - // Echo contents of output, e.g. required values, such as title, date, etc. - //echo json_encode($this->overlaps); } if(count($this->overlapswithoutrepeat) == 0) { @@ -27,8 +21,6 @@ else { $output['withoutrepeat'] .= '
  • ' . 'EventID: ' . $o['eventID'] . ', Title: ' . $o['title'] . ', Start: ' . $o['start'] . ', End: ' . $o['end'] . '
  • '; } $output['withoutrepeat'] .= ''; - // Echo contents of output, e.g. required values, such as title, date, etc. - //echo json_encode($this->overlaps); } echo json_encode($output); ?> \ No newline at end of file diff --git a/application/views/scripts/event/checkoverlapresize.phtml b/application/views/scripts/event/checkoverlapresize.phtml index 05a7f42..4f0ad3d 100644 --- a/application/views/scripts/event/checkoverlapresize.phtml +++ b/application/views/scripts/event/checkoverlapresize.phtml @@ -1,9 +1,5 @@ overlaps); -//$overlaps[] = array(); - - +$output['cfevents'] = $this->cfevents; if(count($this->overlapswithrepeat) == 0) { $output['withrepeat'] = -1; @@ -14,8 +10,6 @@ else { $output['withrepeat'] .= '
  • ' . 'EventID: ' . $o['eventID'] . ', Title: ' . $o['title'] . ', Start: ' . $o['start'] . ', End: ' . $o['end'] . '
  • '; } $output['withrepeat'] .= ''; - // Echo contents of output, e.g. required values, such as title, date, etc. - //echo json_encode($this->overlaps); } if(count($this->overlapswithoutrepeat) == 0) { @@ -27,8 +21,6 @@ else { $output['withoutrepeat'] .= '
  • ' . 'EventID: ' . $o['eventID'] . ', Title: ' . $o['title'] . ', Start: ' . $o['start'] . ', End: ' . $o['end'] . '
  • '; } $output['withoutrepeat'] .= ''; - // Echo contents of output, e.g. required values, such as title, date, etc. - //echo json_encode($this->overlaps); } echo json_encode($output); ?> \ No newline at end of file diff --git a/application/views/scripts/event/checkoverlapselect.phtml b/application/views/scripts/event/checkoverlapselect.phtml index e6fc8c1..fa87193 100644 --- a/application/views/scripts/event/checkoverlapselect.phtml +++ b/application/views/scripts/event/checkoverlapselect.phtml @@ -1,8 +1,4 @@ overlaps); -//$overlaps[] = array(); - if(count($this->overlaps) == 0) { $output = -1; } @@ -12,8 +8,6 @@ else { $output .= '
  • ' . 'EventID: ' . $o['eventID'] . ', Title: ' . $o['title'] . ', Start: ' . $o['start'] . ', End: ' . $o['end'] . '
  • '; } $output .= ''; - // Echo contents of output, e.g. required values, such as title, date, etc. - //echo json_encode($this->overlaps); } echo json_encode($output); ?> \ No newline at end of file diff --git a/application/views/scripts/event/index.phtml b/application/views/scripts/event/index.phtml index 5b9e352..e14887c 100755 --- a/application/views/scripts/event/index.phtml +++ b/application/views/scripts/event/index.phtml @@ -378,33 +378,39 @@ var dayClick = false; eventResize: function( event, dayDelta, minuteDelta, revertFunc ) { - //initialize eventNotDroppableDialog Dialog - $(function() { - $( "#eventNotDroppableDialog" ).dialog({ - autoOpen: false, - width: 820, - modal: true, - title: 'Resizing of ' + event.title + ' is not possible!', - buttons: { - "OK": function() { - $(this).dialog("close"); - revertFunc(); - } - }, - open: function () { - $("#accordion").accordion({clearStyle: true, collapsible: true, active: 1, autoHeight: true }); - $(".ui-dialog-titlebar-close").hide(); - $(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error"); - } - }); - }); - $.get("/event/checkoverlapresize/eventID/" + event.id + "/minuteDelta/" + minuteDelta + "/dayDelta/" + dayDelta, function(data){ - // get conflicts-HTML Element - var cell = document.getElementById("conflicts"); - // get conflicts - var returndata = jQuery.parseJSON(data); + // get conflicts-HTML Element + var cell = document.getElementById("conflicts"); + // get conflicts + var returndata = jQuery.parseJSON(data); + // get conflict free events + var cfevents = data['cfevents']; + + //initialize eventNotDroppableDialog Dialog + $(function() { + $( "#eventNotDroppableDialog" ).dialog({ + autoOpen: false, + width: 820, + modal: true, + title: 'Resizing of ' + event.title + ' is not possible!', + buttons: { + "Resolve Conflicts": function() { + $(this).dialog("close"); + self.location="/event/eventresizeall/eventTitle/" + event.title + "/evmindelta/" + minuteDelta + "/poolID/" + $("#poolselectbox option:selected").val() + "/cfevents/" + cfevents; + }, + "OK": function() { + $(this).dialog("close"); + revertFunc(); + } + }, + open: function () { + $("#accordion").accordion({clearStyle: true, collapsible: true, active: 1, autoHeight: true }); + $(".ui-dialog-titlebar-close").hide(); + $(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error"); + } + }); + }); if($.get("/event/checkright/rightShortcut/er")) { if(event.repeat == 0) { @@ -429,7 +435,7 @@ var dayClick = false; $("#conflicts").append(returndata.withoutrepeat); $( "#eventNotDroppableDialog" ).dialog('open'); } - } + } }, open: function () { $(".ui-dialog-titlebar-close").hide(); @@ -493,6 +499,15 @@ var dayClick = false; eventDrop: function( event, dayDelta, minuteDelta, allDay, revertFunc ) { + $.get("/event/checkoverlapdrop/poolID/" + $("#poolselectbox option:selected").val() + "/eventID/" + event.id + "/date/" + event.start, function(data){ + + // get conflicts-HTML Element + var cell = document.getElementById("conflicts"); + // get conflicts + var returndata = jQuery.parseJSON(data); + // get conflict free events + var cfevents = data['cfevents']; + //initialize eventNotDroppableDialog Dialog $(function() { $( "#eventNotDroppableDialog" ).dialog({ @@ -514,13 +529,6 @@ var dayClick = false; }); }); - $.get("/event/checkoverlapdrop/poolID/" + $("#poolselectbox option:selected").val() + "/eventID/" + event.id + "/date/" + event.start, function(data){ - - // get conflicts-HTML Element - var cell = document.getElementById("conflicts"); - // get conflicts - var returndata = jQuery.parseJSON(data); - if(event.repeat == 0 && event.immediate == 0 && $.get("/event/checkright/rightShortcut/er")) { $(function() { $( "#defaultDialog" ).dialog({ -- cgit v1.2.3-55-g7522 From 4d4b60e3aca6b5e277aa66e746697626465f70b8 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Sat, 22 Oct 2011 14:15:35 +0200 Subject: some overlapping changes, conflict-free-event plot implemented --- application/controllers/EventController.php | 144 ++++++++++++++++++--- .../views/scripts/event/checkoverlapdrop.phtml | 18 ++- .../views/scripts/event/checkoverlapresize.phtml | 18 ++- application/views/scripts/event/index.phtml | 31 ++++- 4 files changed, 187 insertions(+), 24 deletions(-) (limited to 'application/controllers') diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php index 65fcc49..f1036d6 100755 --- a/application/controllers/EventController.php +++ b/application/controllers/EventController.php @@ -682,39 +682,59 @@ class EventController extends Zend_Controller_Action // Check for overlap with repeat $overlapswithrepeat = array(); - $cfevents = array(); + $cfeventswithrepeat = array(); foreach($events['withrepeat'] as $e) { $enewstart = strtotime($e['start']) + $diff; $enewend = strtotime($e['end']) + $diff; - + $cfv = true; + + // overlap events foreach($others as $o) { if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) - || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end'])) + || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end'])) { $overlapswithrepeat[] = $o; + $cfv = false; + } + } + // conflict free events with repeat + if($cfv) { + $cfeventswithrepeat[] = $e; } } // Check for overlap without repeat $overlapswithoutrepeat = array(); + $cfeventswithoutrepeat = array(); + $cfv = true; + foreach($events['withoutrepeat'] as $e) { $enewstart = strtotime($e['start']) + $diff; $enewend = strtotime($e['end']) + $diff; + // overlap events foreach($others as $o) { if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) - || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end'])) + || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end'])) { $overlapswithoutrepeat[] = $o; + $cfv = false; + } + } + // conflict free events without repeat + if($cfv) { + $cfeventswithoutrepeat[] = $e; } } $this->view->events = $events; $this->view->others = $others; $this->view->overlapswithrepeat = $overlapswithrepeat; + $this->view->cfeventswithrepeat = $cfeventswithrepeat; $this->view->overlapswithoutrepeat = $overlapswithoutrepeat; - //$this->view->overlapswithoutrepeat = $cfevents; + $this->view->cfeventswithoutrepeat = $cfeventswithoutrepeat; + } public function checkoverlapselectAction() { @@ -759,40 +779,59 @@ class EventController extends Zend_Controller_Action // Check for overlap with repeat $overlapswithrepeat = array(); - $cfevents = array(); + $cfeventswithrepeat = array(); foreach($events['withrepeat'] as $e) { $enewstart = strtotime($e['start']); $enewend = strtotime($e['end']) + $diffDelta; + $cfv = true; + // overlap events foreach($others as $o) { if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) - || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end'])) + || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end'])) { $overlapswithrepeat[] = $o; + $cfv = false; + } + } + // conflict free events with repeat + if($cfv) { + $cfeventswithrepeat[] = $e; } } // Check for overlap without repeat $overlapswithoutrepeat = array(); + $cfeventswithoutrepeat = array(); foreach($events['withoutrepeat'] as $e) { $enewstart = strtotime($e['start']); $enewend = strtotime($e['end']) + $diffDelta; + $cfv = true; + // overlap events foreach($others as $o) { if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) - || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end'])) - $overlapswithoutrepeat[] = $o; + || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end'])) { + $overlapswithoutrepeat[] = $o; + $cfv = false; + } + } + // conflict free events without repeat + if($cfv) { + $cfeventswithoutrepeat[] = $e; } } $this->view->events = $events; $this->view->others = $others; $this->view->overlapswithrepeat = $overlapswithrepeat; + $this->view->cfeventswithrepeat = $cfeventswithrepeat; $this->view->overlapswithoutrepeat = $overlapswithoutrepeat; - $this->view->overlapswithoutrepeat = $cfevents; + $this->view->cfeventswithoutrepeat = $cfeventswithoutrepeat; + } public function eventmoveAction() { @@ -899,8 +938,6 @@ class EventController extends Zend_Controller_Action $evmindelta = $this->getRequest()->getParam('evmindelta'); $evdaydelta = $this->getRequest()->getParam('evdaydelta'); $poolID = $this->getRequest()->getParam('poolID'); - - //$cfevents = $this-getRequest()->getParam('cfevents'); if ($eventTitle!=null) { @@ -966,6 +1003,85 @@ class EventController extends Zend_Controller_Action return; } } + + /*public function eventmovecfAction() { + if(!$this->acl->checkRight('eo')) { + $this->_redirect('/'); + } + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + $event = new Application_Model_Event(); + + $cfevents = $this->getRequest()->getParam('cfevents'); + $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 + $oldStartTime = date('H:i', strtotime($event->getStart())); + $oldStartDate = date('d.m.Y', strtotime($event->getStart())); + $evstartTime = intval(strtotime($event->getStart())) + intval($evmindelta*60) + intval($evdaydelta*86400); + $newStartTime = date('H:i', $evstartTime); + $newStartDate = date('d.m.Y', $evstartTime); + $eventStart = date('Y-m-d H:i:s', $evstartTime); + $event->setStart($eventStart); + if($event->getEnd()) { + $oldEndTime = date('H:i', strtotime($event->getEnd())); + $oldEndDate = date('d.m.Y', strtotime($event->getEnd())); + $evendTime = intval(strtotime($event->getEnd())) + intval($evmindelta*60) + intval($evdaydelta*86400); + $newEndTime = date('H:i', $evendTime); + $newEndDate = date('d.m.Y', $evendTime); + $eventEnd = date('Y-m-d H:i:s', $evendTime); + $event->setEnd($eventEnd); + } + $event->setPbs_poolID($poolID); + $result = $this->eventcategoryMapper->findBy(array('title' => 'Shutdown')); + $shutdownCategory = $result[0]; + if($event->getCategory() != $shutdownCategory->getID()) { + if($event->getPbs_filterID()) { + if($event->getRepeat()) { + $repeattypeMapper = new Application_Model_RepeattypeMapper(); + $repeattype = new Application_Model_Repeattype(); + $repeattypeMapper->find($event->getRepeattype(), $repeattype); + if($repeattype == "Once a week") { + $oldStartDate = date("N", strototime($oldStartDate)); + $oldEndDate = ''; + $newStartDate = date("N", strototime($newStartDate)); + $newEndDate = ''; + } + } + $filterentriesQuerie = "filterid=" . $event->getPbs_filterID() . "&oldvalue1=" . strtotime($oldStartDate) . "&oldvalue2=" . strtotime($oldEndDate) . "&value1=" . strtotime($newStartDate) . "&value2=" . strtotime($newEndDate); + $filterApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['changefilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesQuerie); + unset($filterApiResult); + $filterentriesQuerie = "filterid=" . $event->getPbs_filterID() . "&oldvalue1=" . $oldStartTime . "&oldvalue2=" . $oldEndTime . "&value1=" . $newStartTime . "&value2=" . $newEndTime; + $filterApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['changefilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesQuerie); + unset($filterApiResult); + } + } + $this->eventMapper->save($event); //save the event with the new data + } + } catch (Zend_Exception $e) { + echo "Caught exception: " . get_class($e) . "
    "; + echo "Message: " . $e->getMessage() . "
    "; + return; + } + $this->_redirect('/event/'); + } else { + $this->_redirect('/event/'); + return; + } + }*/ public function eventresizeAction() { if(!$this->acl->checkRight('eo')) { @@ -984,7 +1100,7 @@ class EventController extends Zend_Controller_Action if ($evid!=null) { $this->eventMapper->find($evid,$event); //locate the event in the DB $this->eventMapper->find($evid,$oldEvent); - $event->setRepeat(0); + //$event->setRepeat(0); $event->setRepeattype(null); $event->setRepeatend(null); $event->setRepeatdate(null); @@ -1054,8 +1170,6 @@ class EventController extends Zend_Controller_Action $eventTitle = $this->getRequest()->getParam('eventTitle'); $evmindelta = $this->getRequest()->getParam('evmindelta'); $poolID = $this->getRequest()->getParam('poolID'); - - //$cfevents = $this-getRequest()->getParam('cfevents'); if ($eventTitle!=null) { diff --git a/application/views/scripts/event/checkoverlapdrop.phtml b/application/views/scripts/event/checkoverlapdrop.phtml index 1ca1b29..279e798 100644 --- a/application/views/scripts/event/checkoverlapdrop.phtml +++ b/application/views/scripts/event/checkoverlapdrop.phtml @@ -1,6 +1,21 @@ cfevents; +$output['cfevents'] = $this->cfeventswithrepeat; +// conflict free plot with repeat +$output['cfplotwithrepeat'] = ''; + +// conflict free plot without repeat +$output['cfplotwithoutrepeat'] = ''; + +// conflict plot with repeat if(count($this->overlapswithrepeat) == 0) { $output['withrepeat'] = -1; } @@ -12,6 +27,7 @@ else { $output['withrepeat'] .= ''; } +// conflict plot without repeat if(count($this->overlapswithoutrepeat) == 0) { $output['withoutrepeat'] = -1; } diff --git a/application/views/scripts/event/checkoverlapresize.phtml b/application/views/scripts/event/checkoverlapresize.phtml index 4f0ad3d..85a1a1c 100644 --- a/application/views/scripts/event/checkoverlapresize.phtml +++ b/application/views/scripts/event/checkoverlapresize.phtml @@ -1,6 +1,21 @@ cfevents; +$output['cfevents'] = $this->cfeventswithrepeat; +// conflict free plot with repeat +$output['cfplotwithrepeat'] = ''; + +// conflict free plot without repeat +$output['cfplotwithoutrepeat'] = ''; + +// conflict plot with repeat if(count($this->overlapswithrepeat) == 0) { $output['withrepeat'] = -1; } @@ -12,6 +27,7 @@ else { $output['withrepeat'] .= ''; } +// conflict plot without repeat if(count($this->overlapswithoutrepeat) == 0) { $output['withoutrepeat'] = -1; } diff --git a/application/views/scripts/event/index.phtml b/application/views/scripts/event/index.phtml index e14887c..80f1b02 100755 --- a/application/views/scripts/event/index.phtml +++ b/application/views/scripts/event/index.phtml @@ -382,6 +382,7 @@ var dayClick = false; // get conflicts-HTML Element var cell = document.getElementById("conflicts"); + var cfcell = document.getElementById("cfevents"); // get conflicts var returndata = jQuery.parseJSON(data); // get conflict free events @@ -405,7 +406,7 @@ var dayClick = false; } }, open: function () { - $("#accordion").accordion({clearStyle: true, collapsible: true, active: 1, autoHeight: true }); + $("#accordion").accordion({clearStyle: true, collapsible: true, active: false, autoHeight: true }); $(".ui-dialog-titlebar-close").hide(); $(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error"); } @@ -460,10 +461,12 @@ var dayClick = false; if(returndata.withoutrepeat == -1) { $(this).dialog("close"); $.post("/event/eventresize/evid/" + event.id + "/evend/" + event.end + "/poolID/" + $("#poolselectbox option:selected").val()); - event.repeat = 0; + //event.repeat = 0; } else { $(this).dialog("close"); cell.removeChild(cell.firstChild); + cfcell.removeChild(cfcell.firstChild); + $("#cfevents").append(returndata.cfplotwithoutrepeat); $("#conflicts").append(returndata.withoutrepeat); $( "#eventNotDroppableDialog" ).dialog('open'); } @@ -475,6 +478,8 @@ var dayClick = false; } else { $(this).dialog("close"); cell.removeChild(cell.firstChild); + cfcell.removeChild(cfcell.firstChild); + $("#cfevents").append(returndata.cfplotwithrepeat); $("#conflicts").append(returndata.withrepeat); $( "#eventNotDroppableDialog" ).dialog('open'); } @@ -503,9 +508,10 @@ var dayClick = false; // get conflicts-HTML Element var cell = document.getElementById("conflicts"); + var cfcell = document.getElementById("cfevents"); // get conflicts var returndata = jQuery.parseJSON(data); - // get conflict free events + // get conflict free events with repeat var cfevents = data['cfevents']; //initialize eventNotDroppableDialog Dialog @@ -516,13 +522,17 @@ var dayClick = false; modal: true, title: 'Dropping of ' + event.title + ' is not possible!', buttons: { + "Resolve Conflicts": function() { + $(this).dialog("close"); + self.location="/event/eventmovecf/evmindelta/" + minuteDelta + "/evdaydelta/" + dayDelta + "/poolID/" + $("#poolselectbox option:selected").val() + "/cfevents/" + cfevents; + }, "OK": function() { $(this).dialog("close"); revertFunc(); } }, open: function () { - $("#accordion").accordion({clearStyle: true, collapsible: true, active: 1, autoHeight: true }); + $("#accordion").accordion({clearStyle: true, collapsible: true, active: false, autoHeight: true }); $(".ui-dialog-titlebar-close").hide(); $(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error"); } @@ -576,12 +586,14 @@ var dayClick = false; if(returndata.withoutrepeat == -1) { $(this).dialog("close"); $.post("/event/eventmove/evid/" + event.id + "/evstart/" + event.start + "/evend/" + event.end); - event.repeat = 0; + //event.repeat = 0; } else { $(this).dialog("close"); cell.removeChild(cell.firstChild); + cfcell.removeChild(cfcell.firstChild); + $("#cfevents").append(returndata.cfplotwithoutrepeat); $("#conflicts").append(returndata.withoutrepeat); - $( "#eventNotDroppableDialog" ).dialog('open'); + $( "#eventNotDroppableDialog" ).dialog('open'); } }, "Move all Events": function() { @@ -591,8 +603,10 @@ var dayClick = false; } else { $(this).dialog("close"); cell.removeChild(cell.firstChild); + cfcell.removeChild(cfcell.firstChild); + $("#cfevents").append(returndata.cfplotwithrepeat); $("#conflicts").append(returndata.withrepeat); - $( "#eventNotDroppableDialog" ).dialog('open'); + $( "#eventNotDroppableDialog" ).dialog('open'); } } }, @@ -943,6 +957,9 @@ selected one?

    Show conflicts

    +

    Show conflict-free Events

    +
    +
    -- cgit v1.2.3-55-g7522 From 3a74fb206761a09944e0c7f920fa2719e9e27065 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Sat, 22 Oct 2011 15:38:56 +0200 Subject: bugfix --- application/controllers/EventController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'application/controllers') diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php index f1036d6..21b6fd4 100755 --- a/application/controllers/EventController.php +++ b/application/controllers/EventController.php @@ -667,11 +667,13 @@ class EventController extends Zend_Controller_Action $eventID = $this->getRequest()->getParam('eventID'); $date = intval(strtotime(substr($this->getRequest()->getParam('date'), 0, 24))); + $poolID = $this->getRequest()->getParam('poolID'); $events['withrepeat'] = $this->eventMapper->getDraggingEvents($eventID); $events['withoutrepeat'] = $this->eventMapper->getDraggingEvent($eventID); $others = $this->eventMapper->getNotDraggingEvents($eventID); + $allEvents = $this->eventMapper->fetchAllasArray($poolID); // Calculate time shift $diff=0; @@ -715,9 +717,9 @@ class EventController extends Zend_Controller_Action $enewend = strtotime($e['end']) + $diff; // overlap events - foreach($others as $o) { - if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) - || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end'])) { + foreach($allEvents as $o) { + if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) && $o['eventID'] != $eventID + || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end']) && $o['eventID'] != $eventID) { $overlapswithoutrepeat[] = $o; $cfv = false; } -- cgit v1.2.3-55-g7522 From c292d06fa6542aad1b1567c7468ff838a5eb5d55 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Sat, 22 Oct 2011 15:55:28 +0200 Subject: bugfix --- application/controllers/EventController.php | 13 +++++++------ application/views/scripts/event/index.phtml | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'application/controllers') diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php index 21b6fd4..f19f850 100755 --- a/application/controllers/EventController.php +++ b/application/controllers/EventController.php @@ -778,6 +778,7 @@ class EventController extends Zend_Controller_Action $events['withoutrepeat'] = $this->eventMapper->getDraggingEvent($eventID); $others = $this->eventMapper->getNotDraggingEvents($eventID); + $allEvents = $this->eventMapper->fetchAllasArray($poolID); // Check for overlap with repeat $overlapswithrepeat = array(); @@ -790,9 +791,9 @@ class EventController extends Zend_Controller_Action $cfv = true; // overlap events - foreach($others as $o) { - if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) - || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end'])) { + foreach($allEvents as $o) { + if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) && $o['eventID'] != $e['eventID'] && $o['eventID'] != $eventID + || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end']) && $o['eventID'] != $e['eventID'] && $o['eventID'] != $eventID) { $overlapswithrepeat[] = $o; $cfv = false; } @@ -814,9 +815,9 @@ class EventController extends Zend_Controller_Action $cfv = true; // overlap events - foreach($others as $o) { - if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) - || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end'])) { + foreach($allEvents as $o) { + if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) && $o['eventID'] != $eventID + || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end']) && $o['eventID'] != $eventID) { $overlapswithoutrepeat[] = $o; $cfv = false; } diff --git a/application/views/scripts/event/index.phtml b/application/views/scripts/event/index.phtml index 80f1b02..68d8f9a 100755 --- a/application/views/scripts/event/index.phtml +++ b/application/views/scripts/event/index.phtml @@ -378,7 +378,7 @@ var dayClick = false; eventResize: function( event, dayDelta, minuteDelta, revertFunc ) { - $.get("/event/checkoverlapresize/eventID/" + event.id + "/minuteDelta/" + minuteDelta + "/dayDelta/" + dayDelta, function(data){ + $.get("/event/checkoverlapresize/eventID/" + event.id + "/minuteDelta/" + minuteDelta + "/dayDelta/" + dayDelta + "/poolID/" + $("#poolselectbox option:selected").val(), function(data){ // get conflicts-HTML Element var cell = document.getElementById("conflicts"); -- cgit v1.2.3-55-g7522 From 040265d7e2844cc4b5c6e54da270ae168c1358eb Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Sun, 23 Oct 2011 16:14:17 +0200 Subject: running icons added --- application/controllers/EventController.php | 21 +++++++++----- application/views/scripts/event/index.phtml | 44 +++++++++++++++++------------ 2 files changed, 40 insertions(+), 25 deletions(-) (limited to 'application/controllers') diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php index f19f850..dcf15dc 100755 --- a/application/controllers/EventController.php +++ b/application/controllers/EventController.php @@ -1007,23 +1007,29 @@ class EventController extends Zend_Controller_Action } } - /*public function eventmovecfAction() { + public function eventmovecfAction() { if(!$this->acl->checkRight('eo')) { $this->_redirect('/'); } $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); - $event = new Application_Model_Event(); - $cfevents = $this->getRequest()->getParam('cfevents'); $evmindelta = $this->getRequest()->getParam('evmindelta'); $evdaydelta = $this->getRequest()->getParam('evdaydelta'); $poolID = $this->getRequest()->getParam('poolID'); + + $eventsArray = (array) $cfevents; + + //$event = new Application_Model_Event($cfevents); + + var_dump($eventsArray); + + //print_r($cfevents['eventID']); - if ($eventTitle!=null) { + /*if ($cfevents!=null) { - $events = $this->eventMapper->findBy(array("title" => $eventTitle)); + $events = $this->eventMapper->findBy(array("eventID" => $cfevents['eventID'])); if ($events[0]->getPbs_membershipID() != $this->userIDsNamespace['membershipID']) { if (!$this->acl->checkRight('edo')) { $this->_redirect('/'); @@ -1083,8 +1089,8 @@ class EventController extends Zend_Controller_Action } else { $this->_redirect('/event/'); return; - } - }*/ + }*/ + } public function eventresizeAction() { if(!$this->acl->checkRight('eo')) { @@ -1253,6 +1259,7 @@ class EventController extends Zend_Controller_Action 'repeat' => $event->getRepeat(), 'opacity' => 1, 'immediate' => $event->getImmediate(), + 'running' => $event->getRunning(), ) ); } diff --git a/application/views/scripts/event/index.phtml b/application/views/scripts/event/index.phtml index 68d8f9a..6cfb733 100755 --- a/application/views/scripts/event/index.phtml +++ b/application/views/scripts/event/index.phtml @@ -135,7 +135,7 @@ var dayClick = false; $( "#eventDeleteDialog" ).dialog('open'); // dialog for deleting selected wdhEvent - }else { + } else { $(function() { $( "#eventDeleteWdhDialog" ).dialog({ autoOpen: false, @@ -320,7 +320,7 @@ var dayClick = false; } }, open: function () { - $("#accordion").accordion({clearStyle: true, collapsible: true, active: 1, autoHeight: true }); + $("#accordion").accordion({clearStyle: true, collapsible: true, active: false, autoHeight: true }); $(".ui-dialog-titlebar-close").hide(); $(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").addClass("ui-state-error"); } @@ -386,7 +386,7 @@ var dayClick = false; // get conflicts var returndata = jQuery.parseJSON(data); // get conflict free events - var cfevents = data['cfevents']; + var cfevents = returndata.cfevents; //initialize eventNotDroppableDialog Dialog $(function() { @@ -398,7 +398,7 @@ var dayClick = false; buttons: { "Resolve Conflicts": function() { $(this).dialog("close"); - self.location="/event/eventresizeall/eventTitle/" + event.title + "/evmindelta/" + minuteDelta + "/poolID/" + $("#poolselectbox option:selected").val() + "/cfevents/" + cfevents; + self.location="/event/eventmovecf/evmindelta/" + minuteDelta + "/evdaydelta/" + dayDelta + "/poolID/" + $("#poolselectbox option:selected").val() + "/cfevents/" + cfevents; }, "OK": function() { $(this).dialog("close"); @@ -512,7 +512,7 @@ var dayClick = false; // get conflicts var returndata = jQuery.parseJSON(data); // get conflict free events with repeat - var cfevents = data['cfevents']; + var cfevents = returndata.cfevents; //initialize eventNotDroppableDialog Dialog $(function() { @@ -524,7 +524,7 @@ var dayClick = false; buttons: { "Resolve Conflicts": function() { $(this).dialog("close"); - self.location="/event/eventmovecf/evmindelta/" + minuteDelta + "/evdaydelta/" + dayDelta + "/poolID/" + $("#poolselectbox option:selected").val() + "/cfevents/" + cfevents; + $.post("/event/eventmovecf/evmindelta/" + minuteDelta + "/evdaydelta/" + dayDelta + "/poolID/" + $("#poolselectbox option:selected").val() + "/cfevents/" + cfevents); }, "OK": function() { $(this).dialog("close"); @@ -651,9 +651,27 @@ var dayClick = false; }, eventRender: function(event, element, view) { - - // disable resizing if the event is a boot- or shutdown-event + // add running icons and handle editing of events + if(event.running == 0) { + // event will take place soon + $('.fc-event-time').css('background','url(/media/img/down.png) top right no-repeat'); + //event.editable = false; + } else if(event.running == 1) { + // event is running + $('.fc-event-time').css('background','url(/media/img/play.gif) top right no-repeat'); + //event.editable = false; + } else if(event.running == 2) { + // event successfully + $('.fc-event-time').css('background','url(/media/img/default.png) top right no-repeat'); + //event.editable = false; + } else if(event.running == 3) { + // event failed + $('.fc-event-time').css('background','url(/media/img/delete.png) top right no-repeat'); + //event.editable = false; + } + + // disable resizing if the event is a boot- or shutdown-event if(event.category == 'Boot' || event.category == 'Shutdown') { element.resizable(false); // calendar resizing element.resizable("destroy"); // jqeury resizing @@ -682,16 +700,6 @@ var dayClick = false; element.find('.fc-event-title').append("
    Type: " + event.category + "
    Note: " + event.note + "
    Participants: " + event.participants); } }, - - viewDisplay: function(view) { - - if (view.name == 'agendaWeek') - { - } - if (view.name == 'agendaDay') - { - } - } }); -- cgit v1.2.3-55-g7522 From ea267b84c662c95411575071d46852258105a7d6 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Sun, 23 Oct 2011 18:07:04 +0200 Subject: minor --- application/controllers/EventController.php | 2 ++ application/views/scripts/event/index.phtml | 18 +++++++++--------- public/media/css/fullcalendar.css | 22 +++++++++++++++++++++- 3 files changed, 32 insertions(+), 10 deletions(-) (limited to 'application/controllers') diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php index dcf15dc..f7711ed 100755 --- a/application/controllers/EventController.php +++ b/application/controllers/EventController.php @@ -1190,6 +1190,7 @@ class EventController extends Zend_Controller_Action } try { foreach($events as $event) { + if($event->getRunning() == 0) { $eventEnd = date('Y-m-d H:i:s', intval(strtotime($event->getEnd())) + intval($evmindelta*60)); $event->setEnd($eventEnd); $event->setPbs_poolID($poolID); @@ -1204,6 +1205,7 @@ class EventController extends Zend_Controller_Action } $this->eventMapper->save($event); //save the event with the new data } + } } catch (Zend_Exception $e) { echo "Caught exception: " . get_class($e) . "
    "; echo "Message: " . $e->getMessage() . "
    "; diff --git a/application/views/scripts/event/index.phtml b/application/views/scripts/event/index.phtml index 6cfb733..c5c7c38 100755 --- a/application/views/scripts/event/index.phtml +++ b/application/views/scripts/event/index.phtml @@ -651,24 +651,24 @@ var dayClick = false; }, eventRender: function(event, element, view) { - + // add running icons and handle editing of events if(event.running == 0) { // event will take place soon - $('.fc-event-time').css('background','url(/media/img/down.png) top right no-repeat'); - //event.editable = false; + element.addClass("fc-event-time-0"); + //$('.fc-event-time').css('background','url(/media/img/down.png) top right no-repeat'); } else if(event.running == 1) { // event is running - $('.fc-event-time').css('background','url(/media/img/play.gif) top right no-repeat'); - //event.editable = false; + element.addClass("fc-event-time-1"); + event.editable = false; } else if(event.running == 2) { // event successfully - $('.fc-event-time').css('background','url(/media/img/default.png) top right no-repeat'); - //event.editable = false; + element.addClass("fc-event-time-2"); + event.editable = false; } else if(event.running == 3) { // event failed - $('.fc-event-time').css('background','url(/media/img/delete.png) top right no-repeat'); - //event.editable = false; + element.addClass("fc-event-time-3"); + event.editable = false; } // disable resizing if the event is a boot- or shutdown-event diff --git a/public/media/css/fullcalendar.css b/public/media/css/fullcalendar.css index 8188bbf..ac2feee 100755 --- a/public/media/css/fullcalendar.css +++ b/public/media/css/fullcalendar.css @@ -294,12 +294,32 @@ a.fc-event { border-width: 2px; overflow: hidden; } - + .fc-event-time, .fc-event-title { padding: 0 1px; } +.fc-event-time-0 { + padding: 0 1px; + background: url(/media/img/down.png) top right no-repeat; + } + +.fc-event-time-1 { + padding: 0 1px; + background: url(/media/img/play.gif) top right no-repeat; + } + +.fc-event-time-2 { + padding: 0 1px; + background: url(/media/img/default.png) top right no-repeat; + } + +.fc-event-time-3 { + padding: 0 1px; + background: url(/media/img/delete.png) top right no-repeat; + } + .fc .ui-resizable-handle { /*** TODO: don't use ui-resizable anymore, change class ***/ display: block; position: absolute; -- cgit v1.2.3-55-g7522