summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authormichael pereira2011-03-08 19:41:07 +0100
committermichael pereira2011-03-08 19:41:07 +0100
commit6a917fa16d4aabd8e69e1db08867899c860424e1 (patch)
tree5aee03f6bf1810ec340110df55fd1edacf44f592 /application
parentBootOs Name anzeigen & Reihenfolge im BootMenu (diff)
parentansehnlichere oberfläche && Controller auflistung (diff)
downloadpbs2-6a917fa16d4aabd8e69e1db08867899c860424e1.tar.gz
pbs2-6a917fa16d4aabd8e69e1db08867899c860424e1.tar.xz
pbs2-6a917fa16d4aabd8e69e1db08867899c860424e1.zip
Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2
Diffstat (limited to 'application')
-rw-r--r--application/Bootstrap.php12
-rw-r--r--application/configs/application.ini.dist2
-rw-r--r--application/controllers/AuthController.php180
-rw-r--r--application/controllers/FilterController.php98
-rw-r--r--application/controllers/IndexController.php5
-rw-r--r--application/controllers/PoolController.php28
-rw-r--r--application/controllers/SessionController.php105
-rw-r--r--application/forms/FilterAdd.php10
-rw-r--r--application/forms/Session.php70
-rw-r--r--application/layouts/main.phtml45
-rw-r--r--application/models/Session.php10
-rw-r--r--application/models/SessionMapper.php24
-rw-r--r--application/views/scripts/filter/index.phtml8
-rw-r--r--application/views/scripts/pool/index.phtml28
-rw-r--r--application/views/scripts/session/createsession.phtml5
-rw-r--r--application/views/scripts/session/deletesession.phtml1
-rw-r--r--application/views/scripts/session/editsession.phtml5
-rw-r--r--application/views/scripts/session/index.phtml48
18 files changed, 547 insertions, 137 deletions
diff --git a/application/Bootstrap.php b/application/Bootstrap.php
index 224ffcb..7f24b84 100644
--- a/application/Bootstrap.php
+++ b/application/Bootstrap.php
@@ -14,6 +14,18 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$view->headTitle('pbs2')
->setSeparator(' :: ');
}
+ function _initViewHelpers()
+ {
+ $this->bootstrap('layout');
+ $layout = $this->getResource('layout');
+ $view = $layout->getView();
+
+ $view->doctype('XHTML1_STRICT');
+ $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
+ $view->headLink()->appendStylesheet('/media/css/styles.css');
+ $view->headTitle()->setSeparator(' - ');
+ $view->headTitle('pbs2');
+ }
}
function print_a(){
$numargs = func_num_args();
diff --git a/application/configs/application.ini.dist b/application/configs/application.ini.dist
index 48e29e5..b19bac8 100644
--- a/application/configs/application.ini.dist
+++ b/application/configs/application.ini.dist
@@ -14,6 +14,8 @@ resources.db.params.password =
resources.db.params.dbname = pbs
resources.db.isDefaultTableAdapter = true
resources.view[] = ""
+resources.layout.layoutPath = APPLICATION_PATH "/layouts"
+resources.layout.layout = "main"
[staging : production]
diff --git a/application/controllers/AuthController.php b/application/controllers/AuthController.php
index fd30d82..c43e5a9 100644
--- a/application/controllers/AuthController.php
+++ b/application/controllers/AuthController.php
@@ -5,82 +5,86 @@ class AuthController extends Zend_Controller_Action
public function init()
{
- $db = Zend_Db_Table::getDefaultAdapter();
-
+ $db = Zend_Db_Table::getDefaultAdapter();
}
-
+
+ public function indexAction()
+ {
+ $this->_redirect('/auth/login');
+ }
+
public function loginAction()
- {
- if (!isset($_POST["login"])){
- $loginForm = new Application_Form_AuthLogin();
- } else {
- $loginForm = new Application_Form_AuthLogin($_POST);
-
- if ($loginForm->isValid($_POST)) {
-
- $auth = Zend_Auth::getInstance();
-
- $adapter = new Zend_Auth_Adapter_DbTable(
- $db,
- 'pbs_person',
- 'email',
- 'password',
- 'MD5(CONCAT(?, password_salt))'
- );
-
-
- $adapter->setIdentity($loginForm->getValue('email'));
- $adapter->setCredential($loginForm->getValue('password'));
-
- $result = $auth->authenticate($adapter);
-
- // TODO: erweiterte fehlerbeschreibung des Users
-
- if ($result->isValid()) {
- $this->_redirect('/');
- return;
- } else {
- echo "Falsche Email oder Passwort";
- }
- }
- }
-
- $this->view->loginForm = $loginForm;
+ {
+ if (!isset($_POST["login"])){
+ $loginForm = new Application_Form_AuthLogin();
+ } else {
+ $loginForm = new Application_Form_AuthLogin($_POST);
+
+ if ($loginForm->isValid($_POST)) {
+
+ $auth = Zend_Auth::getInstance();
+
+ $adapter = new Zend_Auth_Adapter_DbTable(
+ $db,
+ 'pbs_person',
+ 'email',
+ 'password',
+ 'MD5(CONCAT(?, password_salt))'
+ );
+
+
+ $adapter->setIdentity($loginForm->getValue('email'));
+ $adapter->setCredential($loginForm->getValue('password'));
+
+ $result = $auth->authenticate($adapter);
+
+ // TODO: erweiterte fehlerbeschreibung des Users
+
+ if ($result->isValid()) {
+ $this->_redirect('/');
+ return;
+ } else {
+ echo "Falsche Email oder Passwort";
+ }
+ }
+ }
+
+ $this->view->loginForm = $loginForm;
}
public function registerAction()
- {
- if (!isset($_POST["register"])){
- $registerForm = new Application_Form_AuthRegister();
- } else {
- $registerForm = new Application_Form_AuthRegister($_POST);
-
- if ($registerForm->isValid($_POST)) {
-
- $person = new Application_Model_Person($_POST);
- $personmapper = new Application_Model_PersonMapper();
-
- $date = new DateTime();
- $person->setRegisterdate($date->getTimestamp());
- $person->setPasswordSalt(MD5($date->getTimestamp()));
- $person->setPassword(MD5($person->getPassword() . $person->getPasswordSalt()));
-
- try {
- $personmapper->save($person);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- echo "Email Adresse bereits vorhanden.";
- return;
- }
- echo "Erfolgreich registriert. <br/>";
- echo "Weiter zum Login: <a href=\""."/auth/login"."\">Login</a>";
- return;
- }
- }
-
- $this->view->registerForm = $registerForm;
+ {
+ if (!isset($_POST["register"])){
+ $registerForm = new Application_Form_AuthRegister();
+ } else {
+ $registerForm = new Application_Form_AuthRegister($_POST);
+
+ if ($registerForm->isValid($_POST)) {
+
+ $person = new Application_Model_Person($_POST);
+ $personmapper = new Application_Model_PersonMapper();
+
+ $date = new DateTime();
+ $person->setRegisterdate($date->getTimestamp());
+ $person->setPasswordSalt(MD5($date->getTimestamp()));
+ $person->setPassword(MD5($person->getPassword() . $person->getPasswordSalt()));
+
+ try {
+ $personmapper->save($person);
+ }catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ echo "Email Adresse bereits vorhanden.";
+ return;
+ }
+ echo "Erfolgreich registriert. <br/>";
+ echo "Weiter zum Login: <a href=\""."/auth/login"."\">Login</a>";
+ return;
+ }
+ }
+
+ $this->view->registerForm = $registerForm;
}
public function logoutAction()
@@ -96,23 +100,23 @@ class AuthController extends Zend_Controller_Action
public function deleteAction()
{
if (!isset($_POST["delete"])){
- $deleteForm = new Application_Form_AuthDelete();
- } else {
- $deleteForm = new Application_Form_AuthDelete($_POST);
-
- if ($deleteForm->isValid($_POST)) {
-
- $person = new Application_Model_Person($_POST);
- $personmapper = new Application_Model_PersonMapper();
-
-
- $personmapper->delete($person);
- }
- }
-
- $this->view->deleteForm = $deleteForm;
-
+ $deleteForm = new Application_Form_AuthDelete();
+ } else {
+ $deleteForm = new Application_Form_AuthDelete($_POST);
+
+ if ($deleteForm->isValid($_POST)) {
+
+ $person = new Application_Model_Person($_POST);
+ $personmapper = new Application_Model_PersonMapper();
+
+
+ $personmapper->delete($person);
+ }
+ }
+
+ $this->view->deleteForm = $deleteForm;
}
+
}
@@ -122,3 +126,5 @@ class AuthController extends Zend_Controller_Action
+
+
diff --git a/application/controllers/FilterController.php b/application/controllers/FilterController.php
index df8db07..1ebb35e 100644
--- a/application/controllers/FilterController.php
+++ b/application/controllers/FilterController.php
@@ -42,8 +42,7 @@ class FilterController extends Zend_Controller_Action
// TODO: Ändere mit ACL
$newfilter->setGroupID('1');
- $newfilter->setMembershipID('1');
- $newfilter->setBootmenuID('1');
+ $newfilter->setMembershipID('1');
$newfilter2 = new Application_Model_FilterMapper();
$newfilter2->save($newfilter);
@@ -95,7 +94,6 @@ class FilterController extends Zend_Controller_Action
//TODO: ACL integrieren
$_POST['groupID'] = 1;
$_POST['membershipID'] = 1;
- $_POST['bootmenuID'] = 1;
$_POST['created'] = time();
if ($editfilterform->isValid($_POST)) {
@@ -262,11 +260,18 @@ class FilterController extends Zend_Controller_Action
$db = $this->db;
$showPartResults = false;
try{
+
+ $mysession = '1';
+
+ $filtertypID = 8;
+ $session = new Application_Model_Session();
+ $sessionmapper = new Application_Model_SessionMapper();
+ $sessionmapper->find($mysession,$session);
#########################################################
// IP Adress
$filtertypID = 1;
// get it from session_table with session_id from the session
- $ipAdress = "111.10.10.10";
+ $ipAdress = $session->getIp();
$ipAdress = str_replace(".","",$this->fillIP($ipAdress));
$select = $db->select()
->from(array('pbs_filterentries')
@@ -281,13 +286,16 @@ class FilterController extends Zend_Controller_Action
$set[$filtertypID][] = $r['filterID'];
}
if($showPartResults)
- print_a('ipAdress',$result,$set[$filtertypID]);
-
+ print_a('ipAdress',$result,$set[$filtertypID]);
#########################################################
// Mac range
$filtertypID = 2;
// get it from session_table with session_id from the session
- $macAdress = "00:1e:0b:27:f4:99";
+ $client = new Application_Model_Client();
+ $clientmapper = new Application_Model_ClientMapper();
+ $clientmapper->find($session->getClientID(),$client);
+
+ $macAdress = $client->getMacadress();
$macAdress = str_replace(":","",$this->fillMac($ipAdress));
$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
filtertypeID = ".$filtertypID." AND
@@ -303,47 +311,81 @@ class FilterController extends Zend_Controller_Action
// PoolID
$filtertypID = 3;
// get PoolID from client_ID from session_id from the session
- $poolid = 1;
+ $poolentry = new Application_Model_PoolEntries();
+ $poolentrymapper = new Application_Model_PoolEntriesMapper();
+ $poolentry = $poolentrymapper->findby('clientID',$client->getID());
+ $poolentry = $poolentry[0];
+
+ $poolID = $poolentry['poolID'];
+ print_a($poolentry);
$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
filtertypeID = ".$filtertypID." AND
- filtervalue = '.$poolid.' ");
+ filtervalue = ".$poolID." ");
$result = $stmt->fetchAll();
foreach($result as $r){
$set[$filtertypID][] = $r['filterID'];
}
if($showPartResults)
print_a('poolID',$result,$set[$filtertypID]);
- /*
- If client comes from a specific pool
- */
#########################################################
- // ClientID
- $filtertypID = 8;
- // get client_ID from session_id from the session
- /*
- If client is a specific client
- */
+ // ClientID
+ $filtertypID = 8;
+ // get client_ID from session_id from the session
+ $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
+ filtertypeID = ".$filtertypID." AND
+ filtervalue = ".$session->getClientID()." ");
+ $result = $stmt->fetchAll();
+ foreach($result as $r){
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ if($showPartResults)
+ print_a('clientID',$result,$set[$filtertypID]);
#########################################################
// BootIsoID
$filtertypID = 4;
- // get BootIsoID from client_ID from session_id from the session
- /*
- WHERE bootiso = bootiso
- */
+ // get BootIsoID from client_ID from session_id from the session
+ $bootisoID = $session->getBootisoID();
+ $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
+ filtertypeID = ".$filtertypID." AND
+ filtervalue = ".$bootisoID." ");
+ $result = $stmt->fetchAll();
+ foreach($result as $r){
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ if($showPartResults)
+ print_a('bootisoID',$result,$set[$filtertypID]);
#########################################################
// MembershipID
$filtertypID = 5;
// get membership from the session
- /*
- user is in a defined membership
- */
+ //TODO: GET MEMBERSHIP from SESSION
+ $membershipID = 1;
+
+ $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
+ filtertypeID = ".$filtertypID." AND
+ filtervalue = ".$membershipID." ");
+ $result = $stmt->fetchAll();
+ foreach($result as $r){
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ if($showPartResults)
+ print_a('membership',$result,$set[$filtertypID]);
#########################################################
// GroupID
$filtertypID = 6;
// get membership from the session
- /*
- user is in a defined groupID
- */
+ //TODO: GET GROUP from SESSION
+ $groupID = 1;
+
+ $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
+ filtertypeID = ".$filtertypID." AND
+ filtervalue = ".$groupID." ");
+ $result = $stmt->fetchAll();
+ foreach($result as $r){
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ if($showPartResults)
+ print_a('membership',$result,$set[$filtertypID]);
#########################################################
// Time
$filtertypID = 7;
diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php
index 1ff6319..df2f91c 100644
--- a/application/controllers/IndexController.php
+++ b/application/controllers/IndexController.php
@@ -11,11 +11,12 @@ class IndexController extends Zend_Controller_Action
public function indexAction()
{
// action body
- }
-
+ }
}
+
+
diff --git a/application/controllers/PoolController.php b/application/controllers/PoolController.php
index 28bde8e..cb38a80 100644
--- a/application/controllers/PoolController.php
+++ b/application/controllers/PoolController.php
@@ -13,8 +13,21 @@ class PoolController extends Zend_Controller_Action
$poolMapper = new Application_Model_PoolMapper();
$this->view->pools = $poolMapper->fetchAll();
- $poolentriesMapper = new Application_Model_PoolEntriesMapper();
- #print_a($poolentriesMapper->findBy('poolID',1));
+ $clientmapper = new Application_Model_ClientMapper();
+ $clients = $clientmapper->fetchAll();
+ foreach($clients as $c){
+ #$client = new Application_Model_Client($c);
+ $clientsArray[] = $c->toArray();
+ }
+ $assignedclientmapper = new Application_Model_PoolEntriesMapper();
+ $assignedclients = $assignedclientmapper->fetchAll();
+ foreach($assignedclients as $c){
+ $assignedclientsArray[] = $c->toArray();
+ }
+ $freeclients = $this->arrayDiff($clientsArray,$assignedclientsArray);
+ #print_a($freeclients);
+
+ $this->view->freeclients = $freeclients;
}
@@ -84,12 +97,15 @@ class PoolController extends Zend_Controller_Action
public function linkclientAction()
{
- if(!isset($_POST['clientID'])){
+ $clientID = $this->_request->getParam('clientID');
+ $poolID = $this->_request->getParam('poolID');
+ print_a($clientID,$poolID);
+
+ if(!isset($_POST['clientID']) && ($clientID == '' && $poolID == '')){
print_a($_POST);
$clientmapper = new Application_Model_ClientMapper();
$clients = $clientmapper->fetchAll();
foreach($clients as $c){
- #$client = new Application_Model_Client($c);
$clientsArray[] = $c->toArray();
}
$assignedclientmapper = new Application_Model_PoolEntriesMapper();
@@ -108,7 +124,9 @@ class PoolController extends Zend_Controller_Action
try{
$pool = new Application_Model_PoolEntries($_POST);
$pool->setPoolID($this->_request->getParam('poolID'));
-
+ if($pool->getClientID() == ''){
+ $pool->setClientID($this->_request->getParam('clientID'));
+ }
$poolmapper = new Application_Model_PoolEntriesMapper();
$poolmapper->save($pool);
$this->_redirect('/pool');
diff --git a/application/controllers/SessionController.php b/application/controllers/SessionController.php
new file mode 100644
index 0000000..fc3b962
--- /dev/null
+++ b/application/controllers/SessionController.php
@@ -0,0 +1,105 @@
+<?php
+
+class SessionController extends Zend_Controller_Action
+{
+
+ public function init()
+ {
+ /* Initialize action controller here */
+ }
+
+ public function indexAction()
+ {
+ $mapper = new Application_Model_SessionMapper();
+ $this->view->sessions = $mapper->fetchAll();
+ }
+
+ public function createsessionAction()
+ {
+ if (!isset($_POST["add"])){
+ $createsession = new Application_Form_Session();
+ $this->view->createsession = $createsession;
+ }else {
+ $createsession = new Application_Form_Session($_POST);
+ print_a($_POST);
+ if ($createsession->isValid($_POST)) {
+ try{
+ $session = new Application_Model_Session($_POST);
+ $sessionmapper = new Application_Model_SessionMapper();
+ $sessionmapper->save($session);
+
+ $this->_redirect('/session');
+
+ }catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ print_a('saved');
+ $this->_redirect('/session');
+ }
+ else{
+ print_a('not saved');
+ }
+ }
+ }
+
+ public function editsessionAction()
+ {
+ if (!isset($_POST["add"])){
+ // TODO: ACL implementieren ob er editieren darf
+ $sessionID = $this->_request->getParam('sessionID');
+ $session = new Application_Model_Session();
+
+
+ $sessionmapper = new Application_Model_SessionMapper();
+ $sessionmapper->find($sessionID,$session);
+ $session2 = $session->toArray();
+
+ $editsession = new Application_Form_Session();
+ $editsession->populate($session2);
+ $this->view->editsession = $editsession;
+
+ } else{
+ try{
+ $sessionID = $this->_request->getParam('sessionID');
+
+ $editsession = new Application_Form_Session($_POST);
+
+ if ($editsession->isValid($_POST)) {
+ $session = new Application_Model_Session($_POST);
+ $session->setID($this->_request->getParam('sessionID'));
+ $sessionmapper = new Application_Model_SessionMapper();
+ $sessionmapper->save($session);
+ echo 'valid';
+ }
+ else
+ {
+ echo 'not valid';
+ }
+ }catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ $this->_redirect('/session');
+ }
+ }
+
+ public function deletesessionAction()
+ {
+ $sessionID = $this->_request->getParam('sessionID');
+ if(is_numeric($sessionID)){
+ $deletesession = new Application_Model_Session();
+ $deletesession->setID($sessionID);
+ $sessionmapper = new Application_Model_SessionMapper();
+ $sessionmapper->delete($deletesession);
+ }
+ $this->_redirect('/session');
+ }
+
+
+}
+
+
+
+
+
+
+
diff --git a/application/forms/FilterAdd.php b/application/forms/FilterAdd.php
index 931bfee..af4f9b2 100644
--- a/application/forms/FilterAdd.php
+++ b/application/forms/FilterAdd.php
@@ -21,7 +21,15 @@ class Application_Form_FilterAdd extends Zend_Form
'required' => false,
'label' => 'Description:',
));
- // TODO: Add target of Filter
+
+ $this->addElement('text', 'bootmenuID', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'bootmenuID:',
+ ));
$this->addElement('text', 'priority', array(
'filters' => array('StringTrim'),
diff --git a/application/forms/Session.php b/application/forms/Session.php
new file mode 100644
index 0000000..f094676
--- /dev/null
+++ b/application/forms/Session.php
@@ -0,0 +1,70 @@
+<?php
+
+class Application_Form_Session extends Zend_Form
+{
+
+ public function init()
+ {
+ $this->setName("session");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'clientID', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'clientID:',
+ ));
+
+ $this->addElement('text', 'bootosID', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'bootosID:',
+ ));
+$this->addElement('text', 'bootisoID', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'bootisoID:',
+ ));
+$this->addElement('text', 'time', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'time:',
+ ));
+$this->addElement('text', 'ip', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'ip:',
+ ));
+$this->addElement('text', 'ip6', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'ip6:',
+ ));
+
+ $this->addElement('submit', 'add', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Save',
+ ));
+ }
+
+
+}
+
diff --git a/application/layouts/main.phtml b/application/layouts/main.phtml
new file mode 100644
index 0000000..80147b9
--- /dev/null
+++ b/application/layouts/main.phtml
@@ -0,0 +1,45 @@
+<?php echo $this->doctype(); ?>
+
+<html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de">
+<head>
+
+<?php
+echo $this->headTitle();
+echo $this->headMeta();
+echo $this->headStyle();
+echo $this->headLink();
+echo $this->headScript();
+?>
+<style>
+ html{background-color:#E5F3FF}
+ #wrapper{width:800px;margin:10px auto;border:1px solid black;background-color:#FFF;}
+ #innerwrapper{padding:20px;}
+ #nav{border-bottom:1px solid #000;background-color:#CCE7FF;padding:5px 10px;}
+ #nav ul {margin:2px;}
+ #nav li{ display: inline;list-style-type: none;padding-right: 10px;font-family:verdana;font-size:11px;}
+ #nav li a{color:#000;}
+ h1{display:block;width:400px;margin:5px auto;text-align:center;}
+ table{width:100%;}
+</style>
+</head>
+<body>
+ <div id='wrapper'>
+ <div id='nav'>
+ <ul>
+ <li>Controller:</li>
+ <li><a href='/bootiso'>BootIso</a></li>
+ <li><a href='/bootmenu'>BootMenu</a></li>
+ <li><a href='/config'>Config</a></li>
+ <li><a href='/bootos'>BootOs</a></li>
+ <li><a href='/client'>Client</a></li>
+ <li><a href='/filter'>Filter</a></li>
+ <li><a href='/pool'>Pool</a></li>
+ <li><a href='/session'>Session</a></li>
+ <li><a href='/auth'>Auth</a></li>
+ </ul>
+ </div>
+ <div id='innerwrapper'>
+ <?php echo $this->layout()->content; ?>
+ </div>
+ </div>
+</body></html>
diff --git a/application/models/Session.php b/application/models/Session.php
index b042c17..ca07ccb 100644
--- a/application/models/Session.php
+++ b/application/models/Session.php
@@ -5,6 +5,7 @@ class Application_Model_Session
protected $_sessionID;
protected $_clientID;
protected $_bootosID;
+ protected $_bootisoID;
protected $_time;
protected $_ip;
protected $_ip6;
@@ -74,6 +75,15 @@ class Application_Model_Session
$this->_bootosID = $_bootosID;
return $this;
}
+ public function getBootisoID()
+ {
+ return $this->_bootisoID;
+ }
+ public function setBootisoID($_bootisoID)
+ {
+ $this->_bootisoID = $_bootisoID;
+ return $this;
+ }
public function getTime()
{
return $this->_time;
diff --git a/application/models/SessionMapper.php b/application/models/SessionMapper.php
index 57b2fdf..f836643 100644
--- a/application/models/SessionMapper.php
+++ b/application/models/SessionMapper.php
@@ -44,16 +44,22 @@ class Application_Model_SessionMapper
return $this->_dbTable;
}
- public function save(Application_Model_Session $sesion)
+ public function save(Application_Model_Session $session)
{
- $data = array('sessionID'=> $sesion->getSessionID() ,'clientID'=> $sesion->getClientID() ,'bootosID'=> $sesion->getBootosID() ,'time'=> $sesion->getTime() ,'ip'=> $sesion->getIp() ,'ip6'=> $sesion->getIp6() );
-
- if (null === ($id = $sesion->getID()) ) {
- unset($data['sesionID']);
+ $data = array( 'sessionID'=> $session->getID() ,
+ 'clientID'=> $session->getClientID() ,
+ 'bootosID'=> $session->getBootosID() ,
+ 'bootisoID'=> $session->getBootisoID() ,
+ 'time'=> $session->getTime() ,
+ 'ip'=> $session->getIp() ,
+ 'ip6'=> $session->getIp6() );
+ print_a($data);
+ if (null === ($id = $session->getID()) ) {
+ unset($data['sessionID']);
$this->getDbTable()->insert($data);
} else {
- $this->getDbTable()->update($data, array('sesionID = ?' => $id));
+ $this->getDbTable()->update($data, array('sessionID = ?' => $id));
}
}
@@ -62,7 +68,7 @@ class Application_Model_SessionMapper
if (null === ($id = $sesion->getID()) ) {
return;
} else {
- $this->getDbTable()->delete(array('sesionID = ?' => $id));
+ $this->getDbTable()->delete(array('sessionID = ?' => $id));
}
}
@@ -75,7 +81,7 @@ class Application_Model_SessionMapper
$row = $result->current();
- $sesion->setSessionID($row->sessionID)->setClientID($row->clientID)->setBootosID($row->bootosID)->setTime($row->time)->setIp($row->ip)->setIp6($row->ip6);
+ $sesion->setID($row->sessionID)->setClientID($row->clientID)->setBootosID($row->bootosID)->setBootisoID($row->bootisoID)->setTime($row->time)->setIp($row->ip)->setIp6($row->ip6);
}
public function fetchAll()
@@ -85,7 +91,7 @@ class Application_Model_SessionMapper
foreach ($resultSet as $row) {
$entry = new Application_Model_Session();
- $entry->setSessionID($row->sessionID)->setClientID($row->clientID)->setBootosID($row->bootosID)->setTime($row->time)->setIp($row->ip)->setIp6($row->ip6);
+ $entry->setID($row->sessionID)->setClientID($row->clientID)->setBootosID($row->bootosID)->setBootisoID($row->bootisoID)->setTime($row->time)->setIp($row->ip)->setIp6($row->ip6);
$entries[] = $entry;
}
diff --git a/application/views/scripts/filter/index.phtml b/application/views/scripts/filter/index.phtml
index a3e6f25..5d70735 100644
--- a/application/views/scripts/filter/index.phtml
+++ b/application/views/scripts/filter/index.phtml
@@ -1,4 +1,3 @@
-<?php echo $this->headTitle() ?>
<h1>Filters</h1>
<style>
@@ -83,7 +82,7 @@ tr.filter{background-color:#DDD;}
array(
'controller' => 'filter',
'action' => 'editfilterentry',
- 'filterentriesID' => $filterentry['filtertypeID']
+ 'filterentriesID' => $filterentry['filterentriesID']
),
'default',
true) ?>">edit filterentry</a>
@@ -91,7 +90,7 @@ tr.filter{background-color:#DDD;}
array(
'controller' => 'filter',
'action' => 'removefilterentry',
- 'filterentriesID' => $filterentry['filtertypeID']
+ 'filterentriesID' => $filterentry['filterentriesID']
),
'default',
true) ?>">remove filterentry</a>
@@ -103,7 +102,8 @@ tr.filter{background-color:#DDD;}
</tr>
<?php endforeach ?>
</table>
-
+
+
<?php else: ?>
<p>There are no filters to display.</p>
diff --git a/application/views/scripts/pool/index.phtml b/application/views/scripts/pool/index.phtml
index 25f1528..c3a6be9 100644
--- a/application/views/scripts/pool/index.phtml
+++ b/application/views/scripts/pool/index.phtml
@@ -79,7 +79,33 @@
</table>
<?php endforeach ?>
</table>
-
+<h2>Free clients</h2>
+<table border=1 >
+<tr><th>ClientID</th><th>MacAdress</th><th>Hardwarehash</th>
+<?php foreach ($this->pools as $pool): ?>
+ <th><?php echo $this->escape($pool->getTitle()) ?></th>
+ <?php endforeach ?>
+</tr>
+<?php
+foreach ($this->freeclients as $client): ?>
+ <tr>
+ <td><?php echo $client['clientID']; ?></td>
+ <td><?php echo $client['macadress']; ?></td>
+ <td><?php echo $client['hardwarehash']; ?></td>
+ <?php foreach ($this->pools as $pool): ?>
+ <td><a href='<?php echo $this->url(
+ array(
+ 'controller' => 'pool',
+ 'action' => 'linkclient',
+ 'clientID' => $client['clientID'],
+ 'poolID' => $pool->getID(),
+ ),
+ 'default',
+ true) ?>'>link</a></td>
+ <?php endforeach ?>
+ </tr>
+<?php endforeach ?>
+</table>
<?php else: ?>
diff --git a/application/views/scripts/session/createsession.phtml b/application/views/scripts/session/createsession.phtml
new file mode 100644
index 0000000..11fe7ce
--- /dev/null
+++ b/application/views/scripts/session/createsession.phtml
@@ -0,0 +1,5 @@
+<h1>create session</h1>
+
+<?php
+echo $this->createsession;
+?>
diff --git a/application/views/scripts/session/deletesession.phtml b/application/views/scripts/session/deletesession.phtml
new file mode 100644
index 0000000..57f8698
--- /dev/null
+++ b/application/views/scripts/session/deletesession.phtml
@@ -0,0 +1 @@
+<br /><br /><center>View script for controller <b>Session</b> and script/action name <b>deletesession</b></center> \ No newline at end of file
diff --git a/application/views/scripts/session/editsession.phtml b/application/views/scripts/session/editsession.phtml
new file mode 100644
index 0000000..88fb273
--- /dev/null
+++ b/application/views/scripts/session/editsession.phtml
@@ -0,0 +1,5 @@
+<h1>edit session</h1>
+
+<?php
+echo $this->editsession;
+?>
diff --git a/application/views/scripts/session/index.phtml b/application/views/scripts/session/index.phtml
new file mode 100644
index 0000000..d26e818
--- /dev/null
+++ b/application/views/scripts/session/index.phtml
@@ -0,0 +1,48 @@
+<h1>Session</h1>
+
+<p><a href="<?php echo $this->url(
+ array(
+ 'controller' => 'session',
+ 'action' => 'createsession'
+ ),
+ 'default',
+ true) ?>">create new session</a></p>
+
+<table border=1>
+<tr>
+ <th>SessionID</th>
+ <th>ClientID</th>
+ <th>BootosID</th>
+ <th>BootIsoID</th>
+ <th>Time</th>
+ <th>IP</th>
+ <th>IPv6</th>
+</tr>
+<?php foreach ($this->sessions as $session): ?>
+ <tr>
+ <td><?php echo $this->escape($session->getID()) ?></td>
+ <td><?php echo $this->escape($session->getClientID()) ?></td>
+ <td><?php echo $this->escape($session->getBootosID()) ?></td>
+ <td><?php echo $this->escape($session->getBootisoID()) ?></td>
+ <td><?php echo $this->escape($session->getTime()) ?></td>
+ <td><?php echo $this->escape($session->getIp()) ?></td>
+ <td><?php echo $this->escape($session->getIp6()) ?></td>
+ <td><a href="<?php echo $this->url(
+ array(
+ 'controller' => 'session',
+ 'action' => 'editsession',
+ 'sessionID' => $session->getID()
+ ),
+ 'default',
+ true) ?>">edit filter</a></td>
+ <td><a href="<?php echo $this->url(
+ array(
+ 'controller' => 'session',
+ 'action' => 'deletesession',
+ 'sessionID' => $session->getID()
+ ),
+ 'default',
+ true) ?>">delete filter</a></td>
+ </tr>
+<?php endforeach ?>
+</table>