summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xapplication/configs/application.ini.dist1
-rwxr-xr-xapplication/controllers/EventController.php239
-rwxr-xr-xinstall.sh6
3 files changed, 161 insertions, 85 deletions
diff --git a/application/configs/application.ini.dist b/application/configs/application.ini.dist
index 3b56d48..3453ad4 100755
--- a/application/configs/application.ini.dist
+++ b/application/configs/application.ini.dist
@@ -28,6 +28,7 @@ pbs2.deletebootmenu = /resource/deletebootmenu/apikey/
pbs2.addfilter = /resource/addfilter/apikey/
pbs2.addfilterentry = /resource/addfilterentry/apikey/
pbs2.deletefilter = /resource/deletefilter/apikey/
+pbs2.changefilterentry = /resource/changefilterentry/apikey/
pbs2.getperson = /resource/getperson/apikey/
pbs2.getmembership = /resource/getmembership/apikey/
pbs2.getgroup = /resource/getgroup/apikey/
diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index 6e67617..7e09c37 100755
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -631,56 +631,118 @@ class EventController extends Zend_Controller_Action
if ($evid!="null") {
$this->eventMapper->find($evid,$event); //locate the event in the DB
+ $oldStartTime = date('H:i', strtotime($event->getStart()));
+ $oldStartDate = date('Y-m-d', strtotime($event->getStart()));
+ $newStartTime = date('H:i', strtotime(substr($evstart, 0, 24)));
+ $newStartDate = date('Y-m-d', strtotime(substr($evstart, 0, 24)));
$event->setStart(date('Y-m-d H:i:s', strtotime(substr($evstart, 0, 24))));
+ $oldEndTime = date('H:i', strtotime($event->getEnd()));
+ $oldEndDate = date('Y-m-d', strtotime($event->getEnd()));
+ $newEndTime = date('H:i', strtotime(substr($evend, 0, 24)));
+ $newEndDate = date('Y-m-d', strtotime(substr($evend, 0, 24)));
if($evend!="null"){
$event->setEnd(date('Y-m-d H:i:s', strtotime(substr($evend, 0, 24))));
}
$this->eventMapper->save($event); //save the event with the new data
+ 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") {
+ $filterentriesquery1 = "filterID=" . $event->getPbs_filterID() . "&filtertypeID=7&filtervalue=" . $newStartTime . "&filtervalue2=" . $newEndTime;
+ $filterentriesApiResult1 = PostToHost($this->pbs2host, $this->config['pbs2']['addfilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesquery1);
+ $filterentriesquery2 = "filterID=" . $event->getPbs_filterID() . "&filtertypeID=11&filtervalue=" . $newStartDate . "&filtervalue2=" . $newEndDate;
+ $filterentriesApiResult2 = PostToHost($this->pbs2host, $this->config['pbs2']['addfilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesquery1);
+ } else {
+ $filterentriesQuerie = "filterid=" . $event->getPbs_filterID() . "&oldvalue1=" . $oldStartDate . "&oldvalue2=" . $oldEndDate . "&value1=" . $newStartDate . "&value2=" . $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);
+ }
+ } else {
+ $filterentriesQuerie = "filterid=" . $event->getPbs_filterID() . "&oldvalue1=" . $oldStartDate . "&oldvalue2=" . $oldEndDate . "&value1=" . $newStartDate . "&value2=" . $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);
+ }
+ }
}
}
-
+
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;
- }
+ 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
+ $oldStartTime = date('H:i', strtotime($event->getStart()));
+ $oldStartDate = date('Y-m-d', strtotime($event->getStart()));
+ $newStartTime = date('H:i', strtotime(substr($evstart, 0, 24)));
+ $newStartDate = date('Y-m-d', strtotime(substr($evstart, 0, 24)));
+ $oldEndTime = date('H:i', strtotime($event->getEnd()));
+ $oldEndDate = date('Y-m-d', strtotime($event->getEnd()));
+ $newEndTime = date('H:i', strtotime(substr($evend, 0, 24)));
+ $newEndDate = date('Y-m-d', strtotime(substr($evend, 0, 24)));
+ $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);
+ 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=" . $oldStartDate . "&oldvalue2=" . $oldEndDate . "&value1=" . $newStartDate . "&value2=" . $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() {
@@ -700,53 +762,66 @@ class EventController extends Zend_Controller_Action
if ($evid!=null) {
$this->eventMapper->find($evid,$event); //locate the event in the DB
+ $oldStartTime = date('H:i', strtotime($event->getStart()));
+ $newStartTime = $oldStartTime;
+ $oldEndTime = date('H:i', strtotime($event->getEnd()));
+ $newEndTime = date('H:i', strtotime(substr($evend, 0, 24)));
$event->setEnd(date('Y-m-d H:i:s', strtotime(substr($evend, 0, 24))));
$event->setPbs_poolID($poolID);
-
$this->eventMapper->save($event); //save the event with the new data
+ 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);
+ }
}
}
-
+
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));
- $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;
- }
+ $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));
+ $event->setEnd($eventEnd);
+ $event->setPbs_poolID($poolID);
+ 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')) {
@@ -1528,7 +1603,7 @@ class EventController extends Zend_Controller_Action
}
$repeattypeMapper = new Application_Model_RepeattypeMapper();
$repeattype = new Application_Model_Repeattype();
- $repeattypes = $repeattypeMapper->find($event->getRepeattype(), $repeattype);
+ $repeattypeMapper->find($event->getRepeattype(), $repeattype);
$repeatendMapper = new Application_Model_RepeatendMapper();
$repeatend = new Application_Model_Repeatend();
$repeatendMapper->find($event->getRepeatend(), $repeatend);
diff --git a/install.sh b/install.sh
index c9b1d07..c33987c 100755
--- a/install.sh
+++ b/install.sh
@@ -15,7 +15,7 @@ echo "Copying to /var/www/"
sourceDir=$(readlink -f $(dirname $(readlink -f $0)))
echo -n "enter vhost name: "
read vhost_name
-sed -e "36s/\$/$vhost_name/" -i $targetDir/application/configs/application.ini
+sed -e "37s/\$/$vhost_name/" -i $targetDir/application/configs/application.ini
targetDir="/var/www/$vhost_name"
mkdir -p $targetDir
cp -R $sourceDir/* $targetDir
@@ -72,12 +72,12 @@ sed -e "21s/\$/$pbs2_host/" -i $targetDir/application/configs/application.ini
echo -n "Please enter host of gearman server [localhost]: "
read gearman_server_host
[ "x" = "x$gearman_server_host" ] && gearman_server_host="localhost"
-sed -e "39s/\$/$gearman_server_host/" -i $targetDir/application/configs/application.ini
+sed -e "40s/\$/$gearman_server_host/" -i $targetDir/application/configs/application.ini
echo -n "Please enter port of gearman server [4730]: "
read gearman_server_port
[ "x" = "x$gearman_server_port" ] && gearman_server_port="4730"
-sed -e "40s/\$/$gearman_server_port/" -i $targetDir/application/configs/application.ini
+sed -e "41s/\$/$gearman_server_port/" -i $targetDir/application/configs/application.ini
echo "Create database and tables"
cat $targetDir/setup/poolctrl.sql | sed -e "s,##poolctrl##,$db_name," > /tmp/poolctrl.sql