From 92c66441276e03c6fd53496ac8d57ff52b4a3eb4 Mon Sep 17 00:00:00 2001
From: Simon
Date: Tue, 5 Apr 2011 15:54:00 +0200
Subject: Session-Controller erstellt
---
.../modules/user/controllers/SessionController.php | 89 ++++++++++++++++++++++
1 file changed, 89 insertions(+)
create mode 100644 application/modules/user/controllers/SessionController.php
(limited to 'application/modules/user/controllers/SessionController.php')
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 @@
+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']));
+ }
+
+
+}
+
--
cgit v1.2.3-55-g7522
From 3def9f74091e1b8616ad2e1870574705e73fc1b1 Mon Sep 17 00:00:00 2001
From: Simon
Date: Tue, 5 Apr 2011 16:27:13 +0200
Subject: Suche gefixt & Neues Recht für Session
---
application/modules/user/controllers/BootisoController.php | 2 +-
application/modules/user/controllers/BootmenuController.php | 2 +-
application/modules/user/controllers/BootosController.php | 2 +-
application/modules/user/controllers/ClientController.php | 2 +-
application/modules/user/controllers/ConfigController.php | 2 +-
application/modules/user/controllers/FilterController.php | 2 +-
application/modules/user/controllers/PoolController.php | 2 +-
application/modules/user/controllers/SessionController.php | 12 +++++++++++-
library/Pbs/Search.php | 2 +-
pbs.sql | 7 ++++++-
public/media/css/style.css | 5 +++++
11 files changed, 30 insertions(+), 10 deletions(-)
(limited to 'application/modules/user/controllers/SessionController.php')
diff --git a/application/modules/user/controllers/BootisoController.php b/application/modules/user/controllers/BootisoController.php
index 5c3acaa..654e7eb 100644
--- a/application/modules/user/controllers/BootisoController.php
+++ b/application/modules/user/controllers/BootisoController.php
@@ -84,11 +84,11 @@ class user_BootisoController extends Zend_Controller_Action
$mySearch = new Pbs_Search();
$mySearch->setSearchTerm($search);
$mySearch->setModule('bootiso');
- $this->view->searchform = $mySearch->searchForm();
if($search != ''){
$this->view->search = $mySearch->getSearchTerm();
$this->view->bootisolist = $mySearch->search($this->view->bootisolist);
}
+ $this->view->searchform = $mySearch->searchForm();
// Pagination
$pagination = new Pbs_Pagination();
diff --git a/application/modules/user/controllers/BootmenuController.php b/application/modules/user/controllers/BootmenuController.php
index 84c31ff..cb7810b 100644
--- a/application/modules/user/controllers/BootmenuController.php
+++ b/application/modules/user/controllers/BootmenuController.php
@@ -92,11 +92,11 @@ class user_BootmenuController extends Zend_Controller_Action
$mySearch = new Pbs_Search();
$mySearch->setSearchTerm($search);
$mySearch->setModule('bootmenu');
- $this->view->searchform = $mySearch->searchForm();
if($search != ''){
$this->view->search = $mySearch->getSearchTerm();
$bootmenu = $mySearch->search($bootmenu);
}
+ $this->view->searchform = $mySearch->searchForm();
// Pagination
$pagination = new Pbs_Pagination();
diff --git a/application/modules/user/controllers/BootosController.php b/application/modules/user/controllers/BootosController.php
index eeb60a7..12e2d68 100644
--- a/application/modules/user/controllers/BootosController.php
+++ b/application/modules/user/controllers/BootosController.php
@@ -71,11 +71,11 @@ class user_BootosController extends Zend_Controller_Action
$mySearch = new Pbs_Search();
$mySearch->setSearchTerm($search);
$mySearch->setModule('bootos');
- $this->view->searchform = $mySearch->searchForm();
if($search != ''){
$this->view->search = $mySearch->getSearchTerm();
$this->view->bootoslist = $mySearch->search($this->view->bootoslist);
}
+ $this->view->searchform = $mySearch->searchForm();
// Pagination
$pagination = new Pbs_Pagination();
diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php
index 9fe4b03..73c5279 100644
--- a/application/modules/user/controllers/ClientController.php
+++ b/application/modules/user/controllers/ClientController.php
@@ -54,11 +54,11 @@ class User_ClientController extends Zend_Controller_Action
$mySearch = new Pbs_Search();
$mySearch->setSearchTerm($search);
$mySearch->setModule('client');
- $this->view->searchform = $mySearch->searchForm();
if($search != ''){
$this->view->search = $mySearch->getSearchTerm();
$clientsInGroup = $mySearch->search($clientsInGroup);
}
+ $this->view->searchform = $mySearch->searchForm();
// Pagination
$pagination = new Pbs_Pagination();
diff --git a/application/modules/user/controllers/ConfigController.php b/application/modules/user/controllers/ConfigController.php
index ecc3c65..498e890 100644
--- a/application/modules/user/controllers/ConfigController.php
+++ b/application/modules/user/controllers/ConfigController.php
@@ -70,11 +70,11 @@ class user_ConfigController extends Zend_Controller_Action
$mySearch = new Pbs_Search();
$mySearch->setSearchTerm($search);
$mySearch->setModule('config');
- $this->view->searchform = $mySearch->searchForm();
if($search != ''){
$this->view->search = $mySearch->getSearchTerm();
$this->view->configlist = $mySearch->search($this->view->configlist);
}
+ $this->view->searchform = $mySearch->searchForm();
// Pagination
$pagination = new Pbs_Pagination();
diff --git a/application/modules/user/controllers/FilterController.php b/application/modules/user/controllers/FilterController.php
index f84f501..e9850a9 100644
--- a/application/modules/user/controllers/FilterController.php
+++ b/application/modules/user/controllers/FilterController.php
@@ -61,11 +61,11 @@ class User_FilterController extends Zend_Controller_Action
$mySearch = new Pbs_Search();
$mySearch->setSearchTerm($search);
$mySearch->setModule('filter');
- $this->view->searchform = $mySearch->searchForm();
if($search != ''){
$this->view->search = $mySearch->getSearchTerm();
$allFilter = $mySearch->search($allFilter);
}
+ $this->view->searchform = $mySearch->searchForm();
// Pagination
$pagination = new Pbs_Pagination();
diff --git a/application/modules/user/controllers/PoolController.php b/application/modules/user/controllers/PoolController.php
index 7800c7a..87f330a 100644
--- a/application/modules/user/controllers/PoolController.php
+++ b/application/modules/user/controllers/PoolController.php
@@ -70,11 +70,11 @@ class User_PoolController extends Zend_Controller_Action
$mySearch = new Pbs_Search();
$mySearch->setSearchTerm($search);
$mySearch->setModule('pool');
- $this->view->searchform = $mySearch->searchForm();
if($search != ''){
$this->view->search = $mySearch->getSearchTerm();
$yourpools = $mySearch->search($yourpools);
}
+ $this->view->searchform = $mySearch->searchForm();
// Pagination
$pagination = new Pbs_Pagination();
diff --git a/application/modules/user/controllers/SessionController.php b/application/modules/user/controllers/SessionController.php
index 3c3c192..b027f63 100644
--- a/application/modules/user/controllers/SessionController.php
+++ b/application/modules/user/controllers/SessionController.php
@@ -23,6 +23,9 @@ class User_SessionController extends Zend_Controller_Action
public function indexAction()
{
+ if(!Pbs_Acl::checkRight('so'))
+ $this->_redirect('/user/index');
+
$sessionMapper = new Application_Model_SessionMapper();
$bootisoMapper = new Application_Model_BootIsoMapper();
$bootosMapper = new Application_Model_BootOsMapper();
@@ -54,17 +57,22 @@ class User_SessionController extends Zend_Controller_Action
$mySessions[] =$session;
}
}
+ // Sort after date/id
+ usort($mySessions, function($func_a, $func_b) {
+ if($func_a->getID() == $func_b->getID()) return 0;
+ return ($func_a->getID() < $func_b->getID()) ? -1 : 1;
+ });
// 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);
}
+ $this->view->searchform = $mySearch->searchForm();
// Pagination
$pagination = new Pbs_Pagination();
@@ -79,6 +87,8 @@ class User_SessionController extends Zend_Controller_Action
$this->view->sessions = $mySessions;
}
+
+
public function searchAction(){
$this->_redirect('/user/session/index/search/'.($_GET['search']));
diff --git a/library/Pbs/Search.php b/library/Pbs/Search.php
index eb9d198..611c5e2 100644
--- a/library/Pbs/Search.php
+++ b/library/Pbs/Search.php
@@ -16,7 +16,7 @@ class Pbs_Search{
$highlight = array();
if($this->searchTerm != ''){
$str .= "
";
- $str .= "