summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xapplication/controllers/EventController.php138
-rwxr-xr-xapplication/layouts/default.phtml8
-rwxr-xr-xapplication/views/scripts/event/index.phtml77
3 files changed, 24 insertions, 199 deletions
diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index b28e69e..0cfa282 100755
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -72,108 +72,6 @@ class EventController extends Zend_Controller_Action
if(!$this->acl->checkRight('eo')) {
$this->_redirect('/');
}
- if($this->acl->checkRight('eoo')) {
- $events = $this->eventMapper->fetchAll();
- } else {
- $events = $this->eventMapper->findBy(array("pbs_membershipID", $this->userIDsNamespace['membershipID']));
- }
- if(count($events) > 0) {
- $bootOsApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getbootoss'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', '');
- $bootOsXMLString = $bootOsApiResult['http-body'];
- if(strlen($bootOsXMLString) > 0) {
- $bootOsXML = new SimpleXMLElement($bootOsXMLString);
- foreach($bootOsXML->bootoslist->bootos as $bootos) {
- $bootosobj = new Application_Model_BootOs();
- $bootosobj->setID(sprintf("%s", $bootos->id));
- $bootosobj->setCreated(sprintf("%s", $bootos->created));
- $bootosobj->setDefaultkcl(sprintf("%s", $bootos->defaultkcl));
- $bootosobj->setDescription(sprintf("%s", $bootos->description));
- $bootosobj->setDistro(sprintf("%s", $bootos->distro));
- $bootosobj->setDistroversion(sprintf("%s", $bootos->distroversion));
- $bootosobj->setExpires(sprintf("%s", $bootos->expires));
- $bootosobj->setGroupID(sprintf("%s", $bootos->groupid));
- $bootosobj->setMembershipID(sprintf("%s", $bootos->membershipid));
- $bootosobj->setPublic(sprintf("%s", $bootos->public));
- $bootosobj->setShare(sprintf("%s", $bootos->share));
- $bootosobj->setShortname(sprintf("%s", $bootos->shortname));
- $bootosobj->setSource(sprintf("%s", $bootos->source));
- $bootosobj->setTitle(sprintf("%s", $bootos->title));
- $bootoslist[$bootosobj->getID()] = $bootosobj;
- }
- }
- $poolApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getpools'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', '');
- $poolXMLString = $poolApiResult['http-body'];
- if(strlen($poolXMLString) > 0) {
- $poolXML = new SimpleXMLElement($poolXMLString);
- foreach($poolXML->poollist->pool as $pool) {
- $poolobj = new Application_Model_Pool();
- $poolobj->setID(sprintf("%s", $pool->id));
- $poolobj->setDescription(sprintf("%s", $pool->description));
- $poolobj->setGroupID(sprintf("%s", $pool->groupid));
- $poolobj->setLocation(sprintf("%s", $pool->location));
- $poolobj->setTitle(sprintf("%s", $pool->title));
- $poollist[$poolobj->getID()] = $poolobj;
- }
- }
- foreach($events as $eventObj) {
- $event = $eventObj->toArray();
- $bootos = new Application_Model_BootOs();
- $event['pbs_bootos_title'] = $bootoslist[$event['pbs_bootosID']]->getTitle();
- if($event['pbs_membershipID'] == $this->userIDsNamespace['membershipID']) {
- foreach(Zend_Session::namespaceGet('persons') as $person) {
- if($person->getID() == $this->userIDsNamespace['personID']) {
- break;
- }
- }
- } else {
- foreach(Zend_Session::namespaceGet('memberships') as $membership) {
- if($membership->getID() == $event['pbs_membershipID']) {
- break;
- }
- }
- $person = null;
- foreach(Zend_Session::namespaceGet('persons') as $sessionPerson) {
- if($sessionPerson->getID() == $membership->getPersonID()) {
- $person = $sessionPerson;
- break;
- }
- }
- if($person == null) {
- $personApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getperson'] . $membership->getApikey(), 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', '');
- $personXMLString = $personApiResult['http-body'];
- if(strlen($personXMLString) > 0) {
- $personXML = new SimpleXMLElement($personXMLString);
- $person = new Application_Model_Person();
- $person->setID(sprintf("%s", $personXML->person->id));
- $person->setCity(sprintf("%s", $personXML->person->city));
- $person->setEmail(sprintf("%s", $personXML->person->email));
- $person->setFirstname(sprintf("%s", $personXML->person->firstname));
- $person->setHousenumber(sprintf("%s", $personXML->person->housenumber));
- $person->setLogin(sprintf("%s", $personXML->person->login));
- $person->setLogindate(sprintf("%s", $personXML->person->logindate));
- $person->setName(sprintf("%s", $personXML->person->name));
- $person->setPostalcode(sprintf("%s", $personXML->person->postalcode));
- $person->setRegisterdate(sprintf("%s", $personXML->person->registerdate));
- $person->setStreet(sprintf("%s", $personXML->person->street));
- $person->setSuspend(sprintf("%s", $personXML->person->suspend));
- $person->setTitle(sprintf("%s", $personXML->person->title));
- $personSession = new Zend_Session_Namespace('persons');
- $personID = $person->getID();
- $personSession->$personID = $person;
- }
- }
- }
- $event['pbs_person_name'] = $person->getFirstname() . " " . $person->getName();
- $eventcategory = new Application_Model_Eventcategory();
- $this->eventcategoryMapper->find($event['category'], $eventcategory);
- $event['category'] = $eventcategory->getTitle();
- $eventlist[$event['pbs_poolID']][] = $event;
- }
- }
- $params = $this->getRequest()->getParams();
- $this->view->params = $params;
- $this->view->eventlist = $eventlist;
- $this->view->poollist = $poollist;
if(isset($this->userIDsNamespace['poolID'])) {
$this->view->poolID = $this->userIDsNamespace['poolID'];
}
@@ -184,10 +82,8 @@ class EventController extends Zend_Controller_Action
if(!$this->acl->checkRight('ec')) {
$this->_redirect('/');
}
- //var_dump($this->poolVal);
$eventcategorylist = $this->eventcategoryMapper->fetchAll();
$this->poolVal = $this->getRequest()->getParam('poolSelectBoxVal');
- //var_dump($this->poolVal);
$bootOsApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getbootoss'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', '');
$bootOsXMLString = $bootOsApiResult['http-body'];
if(strlen($bootOsXMLString) > 0) {
@@ -211,18 +107,20 @@ class EventController extends Zend_Controller_Action
$bootoslist[$bootosobj->getID()] = $bootosobj;
}
}
- $poolApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getpools'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', '');
- $poolXMLString = $poolApiResult['http-body'];
- if(strlen($poolXMLString) > 0) {
- $poolXML = new SimpleXMLElement($poolXMLString);
- foreach($poolXML->poollist->pool as $pool) {
- $poolobj = new Application_Model_Pool();
- $poolobj->setID(sprintf("%s", $pool->id));
- $poolobj->setDescription(sprintf("%s", $pool->description));
- $poolobj->setGroupID(sprintf("%s", $pool->groupid));
- $poolobj->setLocation(sprintf("%s", $pool->location));
- $poolobj->setTitle(sprintf("%s", $pool->title));
- $poollist[$poolobj->getID()] = $poolobj;
+ if(!isset($this->userIDsNamespace['poolID'])) {
+ $poolApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getpools'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', '');
+ $poolXMLString = $poolApiResult['http-body'];
+ if(strlen($poolXMLString) > 0) {
+ $poolXML = new SimpleXMLElement($poolXMLString);
+ foreach($poolXML->poollist->pool as $pool) {
+ $poolobj = new Application_Model_Pool();
+ $poolobj->setID(sprintf("%s", $pool->id));
+ $poolobj->setDescription(sprintf("%s", $pool->description));
+ $poolobj->setGroupID(sprintf("%s", $pool->groupid));
+ $poolobj->setLocation(sprintf("%s", $pool->location));
+ $poolobj->setTitle(sprintf("%s", $pool->title));
+ $poollist[$poolobj->getID()] = $poolobj;
+ }
}
}
@@ -358,7 +256,6 @@ class EventController extends Zend_Controller_Action
$params = $this->getRequest()->getParams();
$this->view->params = $params;
$this->view->addForm = $addForm;
- //$this->view->poolSelectBoxVal = $this->poolVal;
}
public function deleteAction()
@@ -661,7 +558,12 @@ class EventController extends Zend_Controller_Action
$poolID = $this->getRequest()->getParam('poolID');
$userIDsSession = new Zend_Session_Namespace('userIDs');
$userIDsSession->poolID = $poolID;
- $eventList = $this->eventMapper->fetchAll();
+
+ if($this->acl->checkRight('eoo')) {
+ $eventList = $this->eventMapper->fetchAll();
+ } else {
+ $eventList = $this->eventMapper->findBy(array("pbs_membershipID", $this->userIDsNamespace['membershipID']));
+ }
foreach ($eventList as $event){
diff --git a/application/layouts/default.phtml b/application/layouts/default.phtml
index c3a6006..1b4d713 100755
--- a/application/layouts/default.phtml
+++ b/application/layouts/default.phtml
@@ -1,12 +1,10 @@
-<?php
-$bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');
-$config = $bootstrap->getOptions();
-$pbs2host = $config['pbs2']['host'];
-?>
<?php echo $this->doctype(); ?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<?php
+$bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');
+$config = $bootstrap->getOptions();
+$pbs2host = $config['pbs2']['host'];
$request = Zend_Controller_Front::getInstance()->getRequest();
$this->headTitle()->append(ucwords($request->getControllerName()));
$this->headTitle()->append(ucwords($request->getActionName()));
diff --git a/application/views/scripts/event/index.phtml b/application/views/scripts/event/index.phtml
index c0ac1e3..c0416f5 100755
--- a/application/views/scripts/event/index.phtml
+++ b/application/views/scripts/event/index.phtml
@@ -600,79 +600,4 @@ selected one?</p>
<!-- default -->
<div id="defaultDialog" style="display: none">
<p>Are you sure about this change?</p>
-</div>
-
-
-<br />
-<br />
-<div class='listelement'><?php
-if(count($this->eventlist)>0) {
- ?> <?php
- foreach ($this->poollist as $pool):?>
-<div id='pool<?php echo $pool->getID(); ?>' style='display: none;'>
-<h2><?php echo $pool->getTitle(); ?></h2>
- <?php if(!isset($this->eventlist[$pool->getID()])) {
- echo "This Pool hasn't events yet";
- } else { ?> <?php $poolEvents = $this->eventlist[$pool->getID()]; ?> <?php foreach ($poolEvents as $event): ?>
-<div class='element'>
-<div class='content'>
-<div class='actions'><a
- href="<?php echo $this->url(
- array(
- 'controller' => 'event',
- 'action' => 'edit',
- 'eventID' => $event['eventID']
- ),
- 'default',
- true);?>"><img src='/media/img/edit.png' alt='Edit Group' /></a> <a
- href="<?php echo $this->url(
- array(
- 'controller' => 'event',
- 'action' => 'delete',
- 'eventID' => $event['eventID']
- ),
- 'default',
- true);?>"><img src='/media/img/delete.png' alt='Delete Group' /></a>
-</div>
-<div class='title'><?php echo $event['title']; ?></div>
- <?php if($event['category']) {
- ?>
-<div class='subtitle'><?php echo $event['category']; ?></div>
- <?php
- } else {
- ?>
-<div class='subtitle'>&nbsp;</div>
- <?php
- }
- ?>
-<div class='details'><label>Start Time:</label>
-<div class='item'><?php echo date ('d F Y - H:i', strtotime($event['start'])); ?>&nbsp;</div>
-</div>
-<div class='details'><label>End Time:</label>
-<div class='item'><?php echo date ('d F Y - H:i', strtotime($event['end'])); ?>&nbsp;</div>
-</div>
-<div class='details'><label>Participants:</label>
-<div class='item'><?php echo $event['participants']; ?>&nbsp;</div>
-</div>
-<div class='details'><label>Membership:</label>
-<div class='item'><?php echo $event['pbs_person_name']; ?>&nbsp;</div>
-</div>
-<div class='details'><label>BootOs:</label>
-<div class='item'><?php echo $event['pbs_bootos_title']; ?>&nbsp;</div>
-</div>
-<div class='details'><label>Repeat:</label>
-<div class='item'><?php if($event['repeat']) echo 'yes'; else echo 'no'; ?>&nbsp;</div>
-</div>
-<div class='details'><label>Immediate:</label>
-<div class='item'><?php if($event['immediate']) echo 'yes'; else echo 'no'; ?>&nbsp;</div>
-</div>
-<div class='details'><label>Note:</label>
-<div class='item'><?php echo $event['note']; ?>&nbsp;</div>
-</div>
-</div>
-</div>
-<div class='clear'></div>
-<?php endforeach ?> <?php } ?></div>
-<?php endforeach ?> <?php } ?></div>
-<br />
-<br />
+</div> \ No newline at end of file