summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorSimon2011-03-14 13:18:21 +0100
committerSimon2011-03-14 13:18:21 +0100
commitc4ab2b2f9a88409fbd78325a4d2c19fcb4ed340c (patch)
treea2e6fe7eaa589ad71b4df87d74809c03ff80e403 /application
parentResource an alphasession angepasst (diff)
downloadpbs2-c4ab2b2f9a88409fbd78325a4d2c19fcb4ed340c.tar.gz
pbs2-c4ab2b2f9a88409fbd78325a4d2c19fcb4ed340c.tar.xz
pbs2-c4ab2b2f9a88409fbd78325a4d2c19fcb4ed340c.zip
Membership in Session eingefügt, Filtertypes nur einmal per Script einfügen, auskommentierten Code entfernt
Diffstat (limited to 'application')
-rw-r--r--application/controllers/ResourceController.php28
-rw-r--r--application/controllers/SessionController.php18
-rw-r--r--application/forms/Session.php15
-rw-r--r--application/models/Session.php10
-rw-r--r--application/models/SessionMapper.php3
-rw-r--r--application/views/scripts/session/index.phtml4
6 files changed, 51 insertions, 27 deletions
diff --git a/application/controllers/ResourceController.php b/application/controllers/ResourceController.php
index fe564fc..aef8649 100644
--- a/application/controllers/ResourceController.php
+++ b/application/controllers/ResourceController.php
@@ -3,8 +3,6 @@
class ResourceController extends Zend_Controller_Action
{
- private $startval = 878923467;
- private $pass = array('lsfks_!$fks', 'un!fr€iburg', '0pen$lx_rulez', 'rand0mText');
public function init()
{
@@ -20,12 +18,8 @@ class ResourceController extends Zend_Controller_Action
public function getinitramfsAction()
{
$this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
- /*
- $bootosID = $this->_request->getParam('bootosID');
- $bootosID = $this->alphaID($bootosID, true, false, $this->pass[0]);
- $bootosID -= $this->startval;
- */
+ $this->_helper->viewRenderer->setNoRender();
+
$alphasessionID = $this->_request->getParam('alpha');
$session = new Application_Model_Session();
$sm = new Application_Model_SessionMapper();
@@ -53,11 +47,7 @@ class ResourceController extends Zend_Controller_Action
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
- /*
- $configID = $this->_request->getParam('configID');
- $configID = $this->alphaID($configID, true, false, $this->pass[1]);
- $configID -= $this->startval;
- */
+
$alphasessionID = $this->_request->getParam('alpha');
$session = new Application_Model_Session();
$sm = new Application_Model_SessionMapper();
@@ -89,11 +79,7 @@ class ResourceController extends Zend_Controller_Action
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
- /*
- $bootosID = $this->_request->getParam('bootosID');
- $bootosID = $this->alphaID($bootosID, true, false, $this->pass[2]);
- $bootosID -= $this->startval;
- */
+
$alphasessionID = $this->_request->getParam('alpha');
$session = new Application_Model_Session();
$sm = new Application_Model_SessionMapper();
@@ -121,11 +107,7 @@ class ResourceController extends Zend_Controller_Action
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
- /*
- $bmeID = $this->_request->getParam('bootmenuentryID');
- $bmeID = $this->alphaID($bmeID, true, false, $this->pass[3]);
- $bmeID -= $this->startval;
- */
+
$alphasessionID = $this->_request->getParam('alpha');
$session = new Application_Model_Session();
$sm = new Application_Model_SessionMapper();
diff --git a/application/controllers/SessionController.php b/application/controllers/SessionController.php
index bf318a0..ddb6fac 100644
--- a/application/controllers/SessionController.php
+++ b/application/controllers/SessionController.php
@@ -35,9 +35,12 @@ class SessionController extends Zend_Controller_Action
$bmem = new Application_Model_BootMenuEntriesMapper();
$bootmenuentries = $bmem->fetchAll();
+ $mm = new Application_Model_MembershipMapper();
+ $memberships = $mm->fetchAll();
+
if (!isset($_POST["add"])){
- $createsession = new Application_Form_Session(array('buttontext' => 'Create Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos));
+ $createsession = new Application_Form_Session(array('buttontext' => 'Create Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos,'memberships'=>$memberships));
$this->view->createsession = $createsession;
}else {
// TODO extend with normal function not only with post
@@ -67,6 +70,9 @@ class SessionController extends Zend_Controller_Action
if($session->getBootmenuentryID() == ''){
$session->setBootmenuentryID(null);
}
+ if($session->getMembershipID() == ''){
+ $session->setMembershipID(null);
+ }
$sessionmapper = new Application_Model_SessionMapper();
$sessionmapper->save($session);
@@ -93,6 +99,9 @@ class SessionController extends Zend_Controller_Action
$bmem = new Application_Model_BootMenuEntriesMapper();
$bootmenuentries = $bmem->fetchAll();
+
+ $mm = new Application_Model_MembershipMapper();
+ $memberships = $mm->fetchAll();
if (!isset($_POST["add"])){
// TODO: ACL implementieren ob er editieren darf
@@ -106,7 +115,7 @@ class SessionController extends Zend_Controller_Action
$session2 = $session->toArray();
#print_a($session2);
- $editsession = new Application_Form_Session(array('buttontext' => 'Edit Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos));
+ $editsession = new Application_Form_Session(array('buttontext' => 'Edit Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos,'memberships'=>$memberships));
$editsession->populate($session2);
$this->view->editsession = $editsession;
}catch (Zend_Exception $e) {
@@ -117,7 +126,7 @@ class SessionController extends Zend_Controller_Action
try{
$sessionID = $this->_request->getParam('sessionID');
- $editsession = new Application_Form_Session(array('buttontext' => 'Edit Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos),$_POST);
+ $editsession = new Application_Form_Session(array('buttontext' => 'Edit Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos,'memberships'=>$memberships),$_POST);
if ($editsession->isValid($_POST)) {
$session = new Application_Model_Session($_POST);
@@ -132,6 +141,9 @@ class SessionController extends Zend_Controller_Action
if($session->getBootmenuentryID() == ''){
$session->setBootmenuentryID(null);
}
+ if($session->getMembershipID() == ''){
+ $session->setMembershipID(null);
+ }
$sessionmapper = new Application_Model_SessionMapper();
$sessionmapper->save($session);
echo 'valid';
diff --git a/application/forms/Session.php b/application/forms/Session.php
index d3e0c3f..8603f75 100644
--- a/application/forms/Session.php
+++ b/application/forms/Session.php
@@ -7,6 +7,7 @@ class Application_Form_Session extends Zend_Form
private $bootos;
private $bootisos;
private $bootmenuentries;
+ private $memberships;
public function init()
{
@@ -66,6 +67,17 @@ class Application_Form_Session extends Zend_Form
}
$bootisofield->setRegisterInArrayValidator(false);
$this->addElement($bootisofield);
+
+ $membershipfield = $this->createElement('select','membershipID');
+ $membershipfield ->setLabel('Membership:');
+ $membershipfield ->addMultiOption('','');
+ if(count($this->memberships)>0){
+ foreach($this->memberships as $id => $g){
+ $membershipfield->addMultiOption($g->getID(), $g->getPersonID());
+ }
+ }
+ $membershipfield->setRegisterInArrayValidator(false);
+ $this->addElement($membershipfield);
$this->addElement('text', 'time', array(
'filters' => array('StringTrim'),
@@ -114,6 +126,9 @@ $this->addElement('text', 'ip6', array(
function setBootmenuentries($v){
$this->bootmenuentries = $v;
}
+ function setMemberships($v){
+ $this->memberships = $v;
+ }
private $buttontext = 'Save';
function setButtontext($v){
$this->buttontext = $v;
diff --git a/application/models/Session.php b/application/models/Session.php
index 7ae7fe8..8c130b5 100644
--- a/application/models/Session.php
+++ b/application/models/Session.php
@@ -8,6 +8,7 @@ class Application_Model_Session
protected $_bootmenuentryID;
protected $_bootosID;
protected $_bootisoID;
+ protected $_membershipID;
protected $_time;
protected $_ip;
protected $_ip6;
@@ -104,6 +105,15 @@ class Application_Model_Session
$this->_bootisoID = $_bootisoID;
return $this;
}
+ public function getMembershipID()
+ {
+ return $this->_membershipID;
+ }
+ public function setMembershipID($_membershipID)
+ {
+ $this->_membershipID = $_membershipID;
+ return $this;
+ }
public function getTime()
{
return $this->_time;
diff --git a/application/models/SessionMapper.php b/application/models/SessionMapper.php
index cbff958..3638f07 100644
--- a/application/models/SessionMapper.php
+++ b/application/models/SessionMapper.php
@@ -53,6 +53,7 @@ class Application_Model_SessionMapper
'bootmenuentryID'=> $session->getBootmenuentryID(),
'bootosID'=> $session->getBootosID() ,
'bootisoID'=> $session->getBootisoID() ,
+ 'membershipID'=> $session->getMembershipID() ,
'time'=> $session->getTime() ,
'ip'=> $session->getIp() ,
'ip6'=> $session->getIp6() );
@@ -88,6 +89,7 @@ class Application_Model_SessionMapper
->setBootmenuentryID($row->bootmenuentryID)
->setBootosID($row->bootosID)
->setBootisoID($row->bootisoID)
+ ->setMembershipID($row->membershipID)
->setTime($row->time)
->setIp($row->ip)
->setIp6($row->ip6);
@@ -106,6 +108,7 @@ class Application_Model_SessionMapper
->setBootmenuentryID($row->bootmenuentryID)
->setBootosID($row->bootosID)
->setBootisoID($row->bootisoID)
+ ->setMembershipID($row->membershipID)
->setTime($row->time)
->setIp($row->ip)
->setIp6($row->ip6);
diff --git a/application/views/scripts/session/index.phtml b/application/views/scripts/session/index.phtml
index bb3b28e..c9f726b 100644
--- a/application/views/scripts/session/index.phtml
+++ b/application/views/scripts/session/index.phtml
@@ -10,6 +10,7 @@
<th>BootmenuentryID</th>
<th>BootOsID</th>
<th>BootIsoID</th>
+ <th>MembershipID</th>
<th>Time</th>
<th>IP</th>
<th>IPv6</th>
@@ -22,7 +23,8 @@
<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->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>