summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
Diffstat (limited to 'application')
-rw-r--r--application/controllers/SessionController.php20
-rw-r--r--application/forms/Session.php8
-rw-r--r--application/models/SessionMapper.php22
-rw-r--r--application/views/scripts/session/index.phtml4
4 files changed, 43 insertions, 11 deletions
diff --git a/application/controllers/SessionController.php b/application/controllers/SessionController.php
index f21335d..bf318a0 100644
--- a/application/controllers/SessionController.php
+++ b/application/controllers/SessionController.php
@@ -12,7 +12,7 @@ class SessionController extends Zend_Controller_Action
{
$mapper = new Application_Model_SessionMapper();
$this->view->sessions = $mapper->fetchAll();
- print_a($_SESSION);
+ #print_a($_SESSION);
}
private function getUniqueCode($length = "")
{
@@ -32,7 +32,7 @@ class SessionController extends Zend_Controller_Action
$bi = new Application_Model_BootIsoMapper();
$bootisos = $bi->fetchAll();
- $bmem = new Application_Model_SessionMapper();
+ $bmem = new Application_Model_BootMenuEntriesMapper();
$bootmenuentries = $bmem->fetchAll();
@@ -42,7 +42,7 @@ class SessionController extends Zend_Controller_Action
}else {
// TODO extend with normal function not only with post
$createsession = new Application_Form_Session(array('buttontext' => 'Create Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos),$_POST);
- print_a($_POST);
+ #print_a($_POST);
if ($createsession->isValid($_POST)) {
try{
$uniqid = $this->getUniqueCode(10);
@@ -64,6 +64,9 @@ class SessionController extends Zend_Controller_Action
if($session->getBootosID() == ''){
$session->setBootosID(null);
}
+ if($session->getBootmenuentryID() == ''){
+ $session->setBootmenuentryID(null);
+ }
$sessionmapper = new Application_Model_SessionMapper();
$sessionmapper->save($session);
@@ -88,23 +91,27 @@ class SessionController extends Zend_Controller_Action
$bi = new Application_Model_BootIsoMapper();
$bootisos = $bi->fetchAll();
- $bmem = new Application_Model_SessionMapper();
+ $bmem = new Application_Model_BootMenuEntriesMapper();
$bootmenuentries = $bmem->fetchAll();
if (!isset($_POST["add"])){
// TODO: ACL implementieren ob er editieren darf
$sessionID = $this->_request->getParam('sessionID');
$session = new Application_Model_Session();
-
+ try{
$sessionmapper = new Application_Model_SessionMapper();
$sessionmapper->find($sessionID,$session);
$session->setTime(date('d.m.Y H:i',$session->getTime()));
$session2 = $session->toArray();
+ #print_a($session2);
$editsession = new Application_Form_Session(array('buttontext' => 'Edit Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos));
$editsession->populate($session2);
$this->view->editsession = $editsession;
+ }catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
} else{
try{
@@ -122,6 +129,9 @@ class SessionController extends Zend_Controller_Action
if($session->getBootosID() == ''){
$session->setBootosID(null);
}
+ if($session->getBootmenuentryID() == ''){
+ $session->setBootmenuentryID(null);
+ }
$sessionmapper = new Application_Model_SessionMapper();
$sessionmapper->save($session);
echo 'valid';
diff --git a/application/forms/Session.php b/application/forms/Session.php
index 34edd46..d3e0c3f 100644
--- a/application/forms/Session.php
+++ b/application/forms/Session.php
@@ -12,8 +12,8 @@ class Application_Form_Session extends Zend_Form
{
$this->setName("session");
$this->setMethod('post');
-
- $this->addElement('text', 'aphasessionID', array(
+
+ $this->addElement('text', 'alphasessionID', array(
'filters' => array('StringTrim'),
'validators' => array(
array('StringLength', false, array(0, 16)),
@@ -33,6 +33,7 @@ class Application_Form_Session extends Zend_Form
$clientfield->setRegisterInArrayValidator(false);
$this->addElement($clientfield);
+
$bootmenuentrieyfield = $this->createElement('select','bootmenuentryID');
$bootmenuentrieyfield->setLabel('BootmenuentryID:');
$bootmenuentrieyfield->addMultiOption('','');
@@ -110,6 +111,9 @@ $this->addElement('text', 'ip6', array(
function setBootisos($v){
$this->bootisos = $v;
}
+ function setBootmenuentries($v){
+ $this->bootmenuentries = $v;
+ }
private $buttontext = 'Save';
function setButtontext($v){
$this->buttontext = $v;
diff --git a/application/models/SessionMapper.php b/application/models/SessionMapper.php
index 04496a2..cbff958 100644
--- a/application/models/SessionMapper.php
+++ b/application/models/SessionMapper.php
@@ -82,7 +82,15 @@ class Application_Model_SessionMapper
$row = $result->current();
- $sesion->setID($row->sessionID)->setAlphasessionID($row->alphasessionID)->setClientID($row->clientID)->setBootmenuentryID($row->bootmenuentryID)->setBootosID($row->bootosID)->setBootisoID($row->bootisoID)->setTime($row->time)->setIp($row->ip)->setIp6($row->ip6);
+ $sesion->setID($row->sessionID)
+ ->setAlphasessionID($row->alphasessionID)
+ ->setClientID($row->clientID)
+ ->setBootmenuentryID($row->bootmenuentryID)
+ ->setBootosID($row->bootosID)
+ ->setBootisoID($row->bootisoID)
+ ->setTime($row->time)
+ ->setIp($row->ip)
+ ->setIp6($row->ip6);
}
public function fetchAll()
@@ -92,8 +100,16 @@ class Application_Model_SessionMapper
foreach ($resultSet as $row) {
$entry = new Application_Model_Session();
- $entry->setID($row->sessionID)->setAlphasessionID($row->alphasessionID)->setClientID($row->clientID)->setBootmenuentryID($row->bootmenuentryID)->setBootosID($row->bootosID)->setBootisoID($row->bootisoID)->setTime($row->time)->setIp($row->ip)->setIp6($row->ip6);
-
+ $entry->setID($row->sessionID)
+ ->setAlphasessionID($row->alphasessionID)
+ ->setClientID($row->clientID)
+ ->setBootmenuentryID($row->bootmenuentryID)
+ ->setBootosID($row->bootosID)
+ ->setBootisoID($row->bootisoID)
+ ->setTime($row->time)
+ ->setIp($row->ip)
+ ->setIp6($row->ip6);
+
$entries[] = $entry;
}
return $entries;
diff --git a/application/views/scripts/session/index.phtml b/application/views/scripts/session/index.phtml
index 8d50dd2..f0df609 100644
--- a/application/views/scripts/session/index.phtml
+++ b/application/views/scripts/session/index.phtml
@@ -5,7 +5,9 @@
<table>
<tr>
<th>ID</th>
+ <th>alphasessionID</th>
<th>ClientID</th>
+ <th>BootmenuentryID</th>
<th>BootosID</th>
<th>BootIsoID</th>
<th>Time</th>
@@ -16,7 +18,7 @@
<?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->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>