summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.zfproject.xml7
-rw-r--r--application/models/BootMenuEntriesMapper.php20
-rw-r--r--application/modules/user/controllers/PrebootController.php2
-rw-r--r--application/modules/user/controllers/SessionController.php89
-rw-r--r--application/modules/user/layouts/user.phtml1
-rw-r--r--application/modules/user/views/scripts/session/index.phtml31
-rw-r--r--library/Pbs/Search.php10
7 files changed, 153 insertions, 7 deletions
diff --git a/.zfproject.xml b/.zfproject.xml
index 21e4994..3a64fde 100644
--- a/.zfproject.xml
+++ b/.zfproject.xml
@@ -184,6 +184,9 @@
<controllerFile controllerName="Preboot">
<actionMethod actionName="index"/>
</controllerFile>
+ <controllerFile controllerName="Session">
+ <actionMethod actionName="index"/>
+ </controllerFile>
</controllersDirectory>
<formsDirectory>
<formFile formName="Login"/>
@@ -342,6 +345,9 @@
<viewControllerScriptsDirectory forControllerName="Person">
<viewScriptFile forActionName="show"/>
</viewControllerScriptsDirectory>
+ <viewControllerScriptsDirectory forControllerName="Session">
+ <viewScriptFile forActionName="index"/>
+ </viewControllerScriptsDirectory>
</viewScriptsDirectory>
</viewsDirectory>
<bootstrapFile filesystemName="Bootstrap.php"/>
@@ -827,6 +833,7 @@
<testApplicationControllerFile filesystemName="AuthControllerTest.php"/>
<testApplicationControllerFile filesystemName="StatsControllerTest.php"/>
<testApplicationControllerFile filesystemName="PrebootControllerTest.php"/>
+ <testApplicationControllerFile filesystemName="SessionControllerTest.php"/>
</testApplicationControllerDirectory>
</testApplicationDirectory>
<testLibraryDirectory>
diff --git a/application/models/BootMenuEntriesMapper.php b/application/models/BootMenuEntriesMapper.php
index 02c5e07..466b80b 100644
--- a/application/models/BootMenuEntriesMapper.php
+++ b/application/models/BootMenuEntriesMapper.php
@@ -129,11 +129,25 @@ class Application_Model_BootMenuEntriesMapper
$row = $result->current();
if($botmenuentries == null){
- $botmenuentries = new Application_Model_BootMenuEntriesMapper();
- $botmenuentries->setID($row->bootmenuentriesID)->setBootosID($row->bootosID)->setBootmenuID($row->bootmenuID)->setTitle($row->title)->setConfigID($row->configID)->setKcl($row->kcl)->setKclappend($row->kclappend)->setOrder($row->order);
+ $botmenuentries = new Application_Model_BootMenuEntries();
+ $botmenuentries->setID($row->bootmenuentriesID)
+ ->setBootosID($row->bootosID)
+ ->setBootmenuID($row->bootmenuID)
+ ->setTitle($row->title)
+ ->setConfigID($row->configID)
+ ->setKcl($row->kcl)
+ ->setKclappend($row->kclappend)
+ ->setOrder($row->order);
return $botmenuentries;
}else{
- $botmenuentries->setID($row->bootmenuentriesID)->setBootosID($row->bootosID)->setBootmenuID($row->bootmenuID)->setTitle($row->title)->setConfigID($row->configID)->setKcl($row->kcl)->setKclappend($row->kclappend)->setOrder($row->order);
+ $botmenuentries->setID($row->bootmenuentriesID)
+ ->setBootosID($row->bootosID)
+ ->setBootmenuID($row->bootmenuID)
+ ->setTitle($row->title)
+ ->setConfigID($row->configID)
+ ->setKcl($row->kcl)
+ ->setKclappend($row->kclappend)
+ ->setOrder($row->order);
}
}
diff --git a/application/modules/user/controllers/PrebootController.php b/application/modules/user/controllers/PrebootController.php
index 94759f6..f283969 100644
--- a/application/modules/user/controllers/PrebootController.php
+++ b/application/modules/user/controllers/PrebootController.php
@@ -69,11 +69,11 @@ class User_PrebootController extends Zend_Controller_Action
$mySearch = new Pbs_Search();
$mySearch->setSearchTerm($search);
$mySearch->setModule('preboot');
- $this->view->searchform = $mySearch->searchForm();
if($search != ''){
$this->view->search = $mySearch->getSearchTerm();
$this->view->prebootlist = $mySearch->search($this->view->prebootlist);
}
+ $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
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']));
+ }
+
+
+}
+
diff --git a/application/modules/user/layouts/user.phtml b/application/modules/user/layouts/user.phtml
index 84873ef..14ce235 100644
--- a/application/modules/user/layouts/user.phtml
+++ b/application/modules/user/layouts/user.phtml
@@ -40,6 +40,7 @@ echo $this->headScript()."\n";
<li class='navTreeItem'><a href='/user/client'>Client</a></li>
<li class='navTreeItem'><a href='/user/filter'>Filter</a></li>
<li class='navTreeItem'><a href='/user/pool'>Pool</a></li>
+ <li class='navTreeItem'><a href='/user/session'>Session</a></li>
<?php
}
?>
diff --git a/application/modules/user/views/scripts/session/index.phtml b/application/modules/user/views/scripts/session/index.phtml
new file mode 100644
index 0000000..bb9f1e2
--- /dev/null
+++ b/application/modules/user/views/scripts/session/index.phtml
@@ -0,0 +1,31 @@
+<h1>Session</h1>
+<?php echo $this->searchform; ?>
+<table>
+<tr>
+ <th>ID <span class='code'>sessionID</span></th>
+ <th>alphasessionID <span class='code'>alphasessionID</span></th>
+ <th>ClientID <span class='code'>clientID</span></th>
+ <th>BootmenuentryID <span class='code'>bootmenyentryID</span></th>
+ <th>BootOsID <span class='code'>bootosID</span></th>
+ <th>BootIsoID <span class='code'>bootisoID</span></th>
+ <th>MembershipID <span class='code'>membershipID</span></th>
+ <th>Time <span class='code'>time</span></th>
+ <th>IP <span class='code'>ip</span></th>
+ <th>IPv6 <span class='code'>ip6</span></th>
+</tr>
+<?php foreach ($this->sessions as $session): ?>
+ <tr class=entry>
+ <td><?php echo $this->escape($session->getID()) ?></td>
+ <td><?php echo $this->escape($session->getAlphasessionID()) ?></td>
+ <td><?php echo $this->escape($session->getClientID()) ?></td>
+ <td><?php echo $this->escape($session->getBootmenuentryID()) ?></td>
+ <td><?php echo $this->escape($session->getBootosID()) ?></td>
+ <td><?php echo $this->escape($session->getBootisoID()) ?></td>
+ <td><?php echo $this->escape($session->getMembershipID()) ?></td>
+ <td><?php echo date('d.m.Y H:i',$this->escape($session->getTime())) ?></td>
+ <td><?php echo $this->escape($session->getIp()) ?></td>
+ <td><?php echo $this->escape($session->getIp6()) ?></td>
+ </tr>
+<?php endforeach ?>
+</table>
+<?php echo $this->pagination; ?>
diff --git a/library/Pbs/Search.php b/library/Pbs/Search.php
index 971bdab..eb9d198 100644
--- a/library/Pbs/Search.php
+++ b/library/Pbs/Search.php
@@ -6,6 +6,8 @@ class Pbs_Search{
private $searcha;
private $searchb;
private $module;
+ private $countall;
+ private $countresult;
public function searchForm(){
$str = "<form style='float:left;' action='/user/".$this->module."/search'>
@@ -13,8 +15,9 @@ class Pbs_Search{
<button type='submit' class='searchbutton' value='search'> Search</button>";
$highlight = array();
if($this->searchTerm != ''){
- $str .= "<a href='/user/".$this->module."/'><img src='/media/img/delete.png' alt='Delete Client'/></a>
- <script type='text/javascript' src='/media/js/jquery.highlight-3.js'></script>";
+ $str .= "<a href='/user/".$this->module."/'><img src='/media/img/delete.png' alt='Delete Client'/></a>";
+ $str .= "<div>$this->countresult results found in $this->countall</div>";
+ $str .="<script type='text/javascript' src='/media/js/jquery.highlight-3.js'></script>";
foreach($this->getSearchTerms() as $term){
$highlight[] = "$('table').highlight('".$term."');";
}
@@ -80,7 +83,7 @@ class Pbs_Search{
return $beta;
}
public function search($array){
-
+ $this->countall = count($array);
foreach($array as $counter => $cig){
if(is_object($cig)){
$cig = $cig->toArray();
@@ -111,6 +114,7 @@ class Pbs_Search{
}
foreach( $data as $c)
$ges[] = $array[$c];
+ $this->countresult = count($ges);
return $ges;
}
}