summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Wagner2011-10-24 17:01:20 +0200
committerSebastian Wagner2011-10-24 17:01:20 +0200
commit0ac4cd4d2a7af3eb900c646de7beb71af92310a0 (patch)
tree91bfd10a849b38bff4358ec09aec87d704e462de
parentadd pause.png (diff)
downloadpoolctrl-0ac4cd4d2a7af3eb900c646de7beb71af92310a0.tar.gz
poolctrl-0ac4cd4d2a7af3eb900c646de7beb71af92310a0.tar.xz
poolctrl-0ac4cd4d2a7af3eb900c646de7beb71af92310a0.zip
some changes
-rwxr-xr-xapplication/controllers/EventController.php520
-rwxr-xr-xapplication/views/scripts/event/index.phtml5
2 files changed, 290 insertions, 235 deletions
diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index d796d81..b1c3ea5 100755
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -668,7 +668,7 @@ 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);
@@ -685,26 +685,26 @@ class EventController extends Zend_Controller_Action
// Check for overlap with repeat
$overlapswithrepeat = array();
$cfeventswithrepeat = array();
-
+
foreach($events['withrepeat'] as $e) {
$enewstart = strtotime($e['start']) + $diff;
$enewend = strtotime($e['end']) + $diff;
$cfv = true;
-
+
// overlap events
foreach($allEvents as $o) {
if($e['running'] == 0) {
if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) && $o['eventID'] != $e['eventID']
|| $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end']) && $o['eventID'] != $e['eventID']) {
- $overlapswithrepeat[] = $o;
- $cfv = false;
+ $overlapswithrepeat[] = $o;
+ $cfv = false;
}
} else {
if($e['start'] <= strtotime($o['start']) && $e['end'] >= strtotime($o['start']) && $o['eventID'] != $e['eventID']
|| $e['start'] >= strtotime($o['start']) && $e['start'] <= strtotime($o['end']) && $o['eventID'] != $e['eventID']) {
- $overlapswithrepeat[] = $o;
- $cfv = false;
+ $overlapswithrepeat[] = $o;
+ $cfv = false;
}
}
}
@@ -713,30 +713,30 @@ class EventController extends Zend_Controller_Action
$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($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;
- }
- }
- // conflict free events without repeat
- if($cfv) {
- $cfeventswithoutrepeat[] = $e;
- }
- }
+ $overlapswithoutrepeat = array();
+ $cfeventswithoutrepeat = array();
+ $cfv = true;
+
+ foreach($events['withoutrepeat'] as $e) {
+
+ $enewstart = strtotime($e['start']) + $diff;
+ $enewend = strtotime($e['end']) + $diff;
+
+ // overlap events
+ 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;
+ }
+ }
+ // conflict free events without repeat
+ if($cfv) {
+ $cfeventswithoutrepeat[] = $e;
+ }
+ }
$this->view->events = $events;
$this->view->others = $others;
@@ -744,113 +744,113 @@ class EventController extends Zend_Controller_Action
$this->view->cfeventswithrepeat = $cfeventswithrepeat;
$this->view->overlapswithoutrepeat = $overlapswithoutrepeat;
$this->view->cfeventswithoutrepeat = $cfeventswithoutrepeat;
-
+
}
-
+
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);
- $allEvents = $this->eventMapper->fetchAllasArray($poolID);
-
- // Check for overlap with repeat
- $overlapswithrepeat = array();
- $cfeventswithrepeat = array();
-
- foreach($events['withrepeat'] as $e) {
-
- $enewstart = strtotime($e['start']);
- $enewend = strtotime($e['end']) + $diffDelta;
- $cfv = true;
- // overlap events
- foreach($allEvents as $o) {
- if($e['running'] == 0) {
- if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) && $o['eventID'] != $e['eventID']
- || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end']) && $o['eventID'] != $e['eventID']) {
- $overlapswithrepeat[] = $o;
- $cfv = false;
- }
- } else {
- if($e['start'] <= strtotime($o['start']) && $e['end'] >= strtotime($o['start']) && $o['eventID'] != $e['eventID']
- || $e['start'] >= strtotime($o['start']) && $e['start'] <= strtotime($o['end']) && $o['eventID'] != $e['eventID']) {
- $overlapswithrepeat[] = $o;
- $cfv = false;
- }
- }
+ 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);
+ $allEvents = $this->eventMapper->fetchAllasArray($poolID);
+
+ // Check for overlap with repeat
+ $overlapswithrepeat = array();
+ $cfeventswithrepeat = array();
+
+ foreach($events['withrepeat'] as $e) {
+
+ $enewstart = strtotime($e['start']);
+ $enewend = strtotime($e['end']) + $diffDelta;
+ $cfv = true;
+ // overlap events
+ foreach($allEvents as $o) {
+ if($e['running'] == 0) {
+ if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) && $o['eventID'] != $e['eventID']
+ || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end']) && $o['eventID'] != $e['eventID']) {
+ $overlapswithrepeat[] = $o;
+ $cfv = false;
+ }
+ } else {
+ if($e['start'] <= strtotime($o['start']) && $e['end'] >= strtotime($o['start']) && $o['eventID'] != $e['eventID']
+ || $e['start'] >= strtotime($o['start']) && $e['start'] <= strtotime($o['end']) && $o['eventID'] != $e['eventID']) {
+ $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($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;
+ }
+ }
+ // 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->cfeventswithoutrepeat = $cfeventswithoutrepeat;
+
}
- // 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($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;
- }
- }
- // 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->cfeventswithoutrepeat = $cfeventswithoutrepeat;
-
- }
public function eventmoveAction() {
if(!$this->acl->checkRight('eo')) {
@@ -968,6 +968,92 @@ class EventController extends Zend_Controller_Action
try {
foreach($events as $event) {
if($event->getRunning() == 0) {
+ //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) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect('/event/');
+ } else {
+ $this->_redirect('/event/');
+ return;
+ }
+ }
+
+ public function eventmovecfAction() {
+ if(!$this->acl->checkRight('eo')) {
+ $this->_redirect('/');
+ }
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ $cfevents = $this->getRequest()->getParam('cfevents');
+ $evmindelta = $this->getRequest()->getParam('evmindelta');
+ $evdaydelta = $this->getRequest()->getParam('evdaydelta');
+ $poolID = $this->getRequest()->getParam('poolID');
+
+ $events = null;
+
+ if($cfevents!=null) {
+ foreach($cfevents as $e) {
+ $event = new Application_Model_Event($e);
+ $events[] = $event;
+ }
+ }
+
+ if ($events!=null) {
+
+ /*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()));
@@ -1011,7 +1097,6 @@ 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) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";
@@ -1023,91 +1108,6 @@ 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();
-
- $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 ($cfevents!=null) {
-
- $events = $this->eventMapper->findBy(array("eventID" => $cfevents['eventID']));
- 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) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_redirect('/event/');
- } else {
- $this->_redirect('/event/');
- return;
- }*/
- }
public function eventresizeAction() {
if(!$this->acl->checkRight('eo')) {
@@ -1208,20 +1208,20 @@ 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);
- $result = $this->eventcategoryMapper->findBy(array('title' => 'Shutdown'));
- $shutdownCategory = $result[0];
- if($event->getCategory() != $shutdownCategory->getID()) {
- if($event->getPbs_filterID()) {
- $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);
+ $eventEnd = date('Y-m-d H:i:s', intval(strtotime($event->getEnd())) + intval($evmindelta*60));
+ $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()) {
+ $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
}
- $this->eventMapper->save($event); //save the event with the new data
- }
}
} catch (Zend_Exception $e) {
echo "Caught exception: " . get_class($e) . "<br/>";
@@ -1235,6 +1235,62 @@ class EventController extends Zend_Controller_Action
}
}
+ public function eventresizecfAction() {
+ if(!$this->acl->checkRight('eo')) {
+ $this->_redirect('/');
+ }
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ $cfevents = $this->getRequest()->getParam('cfevents');
+ $evmindelta = $this->getRequest()->getParam('evmindelta');
+ $poolID = $this->getRequest()->getParam('poolID');
+
+ $events = null;
+
+ if($cfevents!=null) {
+ foreach($cfevents as $e) {
+ $event = new Application_Model_Event($e);
+ $events[] = $event;
+ }
+ }
+
+ if ($events!=null) {
+
+ /*if ($events[0]->getPbs_membershipID() != $this->userIDsNamespace['membershipID']) {
+ if (!$this->acl->checkRight('edo')) {
+ $this->_redirect('/');
+ }
+ }*/
+ 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);
+ $result = $this->eventcategoryMapper->findBy(array('title' => 'Shutdown'));
+ $shutdownCategory = $result[0];
+ if($event->getCategory() != $shutdownCategory->getID()) {
+ if($event->getPbs_filterID()) {
+ $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) . "<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 61e23e9..b85b17d 100755
--- a/application/views/scripts/event/index.phtml
+++ b/application/views/scripts/event/index.phtml
@@ -383,6 +383,7 @@ var dayClick = false;
// get conflicts-HTML Element
var cell = document.getElementById("conflicts");
var cfcell = document.getElementById("cfevents");
+ var cf_ = document.getElementById("cf_");
// get conflicts
var returndata = jQuery.parseJSON(data);
// get conflict free events
@@ -398,7 +399,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;
+ self.location="/event/eventresizecf/evmindelta/" + minuteDelta + "/evdaydelta/" + dayDelta + "/poolID/" + $("#poolselectbox option:selected").val() + "/cfevents/" + cfevents;
},
"OK": function() {
$(this).dialog("close");
@@ -590,8 +591,6 @@ var dayClick = false;
} else {
$(this).dialog("close");
cell.removeChild(cell.firstChild);
- cfcell.removeChild(cfcell.firstChild);
- $("#cfevents").append(returndata.cfplotwithoutrepeat);
$("#conflicts").append(returndata.withoutrepeat);
$( "#eventNotDroppableDialog" ).dialog('open');
}