summaryrefslogtreecommitdiffstats
path: root/application/modules/user/controllers/SessionController.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/modules/user/controllers/SessionController.php')
-rw-r--r--application/modules/user/controllers/SessionController.php89
1 files changed, 89 insertions, 0 deletions
diff --git a/application/modules/user/controllers/SessionController.php b/application/modules/user/controllers/SessionController.php
new file mode 100644
index 0000000..3c3c192
--- /dev/null
+++ b/application/modules/user/controllers/SessionController.php
@@ -0,0 +1,89 @@
+<?php
+
+class User_SessionController extends Zend_Controller_Action
+{
+ private $membership;
+ public function init()
+ {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ if($userIDsNamespace['membershipID'] ==''){
+ $pbsNotifier = new Pbs_Notifier();
+ echo $pbsNotifier->notify('No membershipID set','forbidden');
+ }
+
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $this->membership = new Application_Model_Membership();
+ $membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ }
+ $this->page = $this->_request->getParam('page');
+ }
+
+ public function indexAction()
+ {
+ $sessionMapper = new Application_Model_SessionMapper();
+ $bootisoMapper = new Application_Model_BootIsoMapper();
+ $bootosMapper = new Application_Model_BootOsMapper();
+ $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $personMapper = new Application_Model_PersonMapper();
+
+ $bootisos = $bootisoMapper->findBy(array('groupID',$this->membership->getGroupID()));
+ foreach($bootisos as $bootiso){
+ $sessions = $sessionMapper->findBy(array('bootisoID',$bootiso->getID()));
+ foreach($sessions as $session){
+ #echo $session->getBootosID();
+ if($session->getBootosID() != '')
+ $session->setBootosID("[".$session->getBootosID()."] ".$bootosMapper->find($session->getBootosID())->getTitle());
+
+ if($session->getBootmenuentryID() != '')
+ $session->setBootmenuentryID("[".$session->getBootmenuentryID()."] ".$bootmenuentriesMapper->find($session->getBootmenuentryID())->getTitle());
+
+ if($session->getBootisoID() != '')
+ $session->setBootisoID("[".$session->getBootisoID()."] ".$bootisoMapper->find($session->getBootisoID())->getTitle());
+
+ if($session->getMembershipID() != ''){
+ $personID = $membershipMapper->find($session->getMembershipID())->getPersonID();
+ $p = new Application_Model_Person();
+ $personMapper->find($personID,$p);
+ $session->setMembershipID("[".$session->getMembershipID()."] ".$p->getFirstname()." ".$p->getName());
+
+ }
+ $mySessions[] =$session;
+ }
+ }
+
+ // Search
+ $search = $this->_request->getParam('search');
+ $mySearch = new Pbs_Search();
+ $mySearch->setSearchTerm($search);
+ $mySearch->setModule('session');
+ $this->view->searchform = $mySearch->searchForm();
+ if($search != ''){
+ $this->view->search = $mySearch->getSearchTerm();
+ $mySessions = $mySearch->search($mySessions);
+ }
+
+ // Pagination
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(3);
+ $pagination->setElement($mySessions);
+ $pagination->setRequestPage($this->_request->getParam('page'));
+ $pagination->setPageUrl('/user/session/index'.((isset($this->view->search))?'/search/'.$this->view->search:''));
+ $mySessions = $pagination->getElements();
+
+ $this->view->pagination = $pagination->pagination($pageurl);
+ $this->view->page = $pagination->getRequestPage();
+ $this->view->sessions = $mySessions;
+
+ }
+
+ public function searchAction(){
+ $this->_redirect('/user/session/index/search/'.($_GET['search']));
+ }
+
+
+}
+