From f755b6a457f96e9489a8dc89e35dea6882927f42 Mon Sep 17 00:00:00 2001
From: Simon
Date: Fri, 11 Mar 2011 08:57:39 +0100
Subject: MacAdressenFilterung gefixxt, Fomular Buttons eingebaut, debug code
entfernt
---
application/forms/Client.php | 4 ++++
1 file changed, 4 insertions(+)
(limited to 'application/forms/Client.php')
diff --git a/application/forms/Client.php b/application/forms/Client.php
index 1378349..d1d4382 100644
--- a/application/forms/Client.php
+++ b/application/forms/Client.php
@@ -29,6 +29,10 @@ class Application_Form_Client extends Zend_Form
'required' => false,
'ignore' => true,
'label' => 'Save',
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/client"'
));
}
--
cgit v1.2.3-55-g7522
From abda64d32457744695f91a20feafde3431f9e9e2 Mon Sep 17 00:00:00 2001
From: Simon
Date: Fri, 11 Mar 2011 10:00:40 +0100
Subject: AddClientToPool über Formular gefixxt, Buttonbeschriftungen anhand
der Action beschriftet
---
application/controllers/ClientController.php | 8 ++++----
application/controllers/FilterController.php | 19 ++++++++++---------
application/controllers/PoolController.php | 19 +++++++++----------
application/controllers/SessionController.php | 12 +++++-------
application/forms/Client.php | 6 +++++-
application/forms/FilterAdd.php | 6 +++++-
application/forms/FilterEntriesAdd.php | 6 +++++-
application/forms/Pool.php | 6 +++++-
application/forms/PoolClient.php | 1 +
application/forms/Session.php | 6 +++++-
10 files changed, 54 insertions(+), 35 deletions(-)
(limited to 'application/forms/Client.php')
diff --git a/application/controllers/ClientController.php b/application/controllers/ClientController.php
index 580eb6e..affa780 100644
--- a/application/controllers/ClientController.php
+++ b/application/controllers/ClientController.php
@@ -20,11 +20,11 @@ class ClientController extends Zend_Controller_Action
$hh = $this->_request->getParam('hh');
if (!isset($_POST["add"])){
- $addclient = new Application_Form_Client();
+ $addclient = new Application_Form_Client(array('buttontext' => 'Create Client'));
$this->view->addclient = $addclient;
}
else{
- $addfilterform = new Application_Form_Client($_POST);
+ $addfilterform = new Application_Form_Client(array('buttontext' => 'Create Client'),$_POST);
if ($addfilterform->isValid($_POST) || ($mac != '' && $hh != '') ) {
$client = new Application_Model_Client();
$mac = ($mac!='')?$mac:$_POST['macadress'];
@@ -61,12 +61,12 @@ class ClientController extends Zend_Controller_Action
$mapper = new Application_Model_ClientMapper();
$mapper->find($clientID,$data);
- $editclient = new Application_Form_Client();
+ $editclient = new Application_Form_Client(array('buttontext' => 'Edit Client'));
$editclient->populate($data->toArray());
$this->view->editclient = $editclient;
}
else{
- $editclient = new Application_Form_Client($_POST);
+ $editclient = new Application_Form_Client(array('buttontext' => 'Edit Client'),$_POST);
if ($editclient->isValid($_POST) || ($mac != '' && $hh != '') ) {
$client = new Application_Model_Client($_POST);
$client->setID($this->_request->getParam('clientID'));
diff --git a/application/controllers/FilterController.php b/application/controllers/FilterController.php
index 5fb149c..7b05b0e 100644
--- a/application/controllers/FilterController.php
+++ b/application/controllers/FilterController.php
@@ -34,10 +34,10 @@ class FilterController extends Zend_Controller_Action
//TODO get bootmenu by group
$bootmenus = $bmmapper->fetchAll();
if (!isset($_POST["add"])){
- $addfilterform = new Application_Form_FilterAdd(array('bootmenus'=>$bootmenus));
+ $addfilterform = new Application_Form_FilterAdd(array('buttontext' => 'Create Filter','bootmenus'=>$bootmenus));
$this->view->addfilterform = $addfilterform;
}else {
- $addfilterform = new Application_Form_FilterAdd(array('bootmenus'=>$bootmenus),$_POST);
+ $addfilterform = new Application_Form_FilterAdd(array('buttontext' => 'Create Filter','bootmenus'=>$bootmenus),$_POST);
if ($addfilterform->isValid($_POST)) {
try{
$newfilter = new Application_Model_Filter($_POST);
@@ -88,7 +88,7 @@ class FilterController extends Zend_Controller_Action
$filtermapper->find($filterID,$filter);
$filter2 = $filter->toArray();
- $editfilterform = new Application_Form_FilterAdd(array('bootmenus'=>$bootmenus));
+ $editfilterform = new Application_Form_FilterAdd(array('buttontext' => 'Edit Filter','bootmenus'=>$bootmenus));
$editfilterform->populate($filter2);
$this->view->editfilterform = $editfilterform;
@@ -96,7 +96,7 @@ class FilterController extends Zend_Controller_Action
try{
$filterID = $this->_request->getParam('filterID');
- $editfilterform = new Application_Form_FilterAdd(array('bootmenus'=>$bootmenus),$_POST);
+ $editfilterform = new Application_Form_FilterAdd(array('buttontext' => 'Edit Filter','bootmenus'=>$bootmenus),$_POST);
//TODO: ACL integrieren
$_POST['groupID'] = 1;
$_POST['membershipID'] = 1;
@@ -122,13 +122,13 @@ class FilterController extends Zend_Controller_Action
// TODO: ACL implementieren ob er editieren darf
if (!isset($_POST["add"])){
try{
- $editfilterform = new Application_Form_FilterEntriesAdd(array('filterID' => $this->_request->getParam('filterID')));
+ $editfilterform = new Application_Form_FilterEntriesAdd(array('buttontext' => 'Add Filterentry','filterID' => $this->_request->getParam('filterID')));
$this->view->editfilterform = $editfilterform;
}catch (Zend_Exception $e) {
echo "Error message 2: " . $e->getMessage() . "\n";
}
} else{
- $editfilterform = new Application_Form_FilterEntriesAdd($_POST);
+ $editfilterform = new Application_Form_FilterEntriesAdd(array('buttontext' => 'Add Filterentry'),$_POST);
if ($editfilterform->isValid($_POST)) {
$newfilterenty = new Application_Model_FilterEntries();
$newfilterenty->setFilterID($_POST['filterID']);
@@ -164,7 +164,7 @@ class FilterController extends Zend_Controller_Action
$filterentriesmapper->find($filterentriesID,$filterentry);
- $editfilterform = new Application_Form_FilterEntriesAdd();
+ $editfilterform = new Application_Form_FilterEntriesAdd(array('buttontext' => 'Edit Filterentry'));
$editfilterform->populate($filterentry->toArray());
$editfilterform->setFilterID($filterID);
$this->view->editfilterform = $editfilterform;
@@ -175,7 +175,7 @@ class FilterController extends Zend_Controller_Action
} else{
try{
$filterentriesID = $this->_request->getParam('filterentriesID');
- $editfilterform = new Application_Form_FilterEntriesAdd($_POST);
+ $editfilterform = new Application_Form_FilterEntriesAdd(array('buttontext' => 'Edit Filterentry'),$_POST);
if ($editfilterform->isValid($_POST)) {
$newfilterenty = new Application_Model_FilterEntries($_POST);
$newfilterenty->setID($filterentriesID);
@@ -529,7 +529,7 @@ class FilterController extends Zend_Controller_Action
$bm = new Application_Model_BootMenu();
$bmmapper = new Application_Model_BootMenuMapper();
$bmmapper->find($bootmenuID,$bm);
- echo "
";
+ echo "";
}
else{
echo "No Result :-(
";
@@ -567,6 +567,7 @@ class FilterController extends Zend_Controller_Action
));
$filterevaluate->populate(array(
+ 'ip' => '132.230.5.6',
'mac' => '08:00:20:ae:fd:7e',
'time'=>date('d.m.Y H:i'))
);
diff --git a/application/controllers/PoolController.php b/application/controllers/PoolController.php
index 7c5092e..f27ee45 100644
--- a/application/controllers/PoolController.php
+++ b/application/controllers/PoolController.php
@@ -33,10 +33,10 @@ class PoolController extends Zend_Controller_Action
public function createpoolAction()
{
if (!isset($_POST["add"])){
- $addfilterform = new Application_Form_Pool();
+ $addfilterform = new Application_Form_Pool(array('buttontext' => 'Create Pool'));
$this->view->addpool = $addfilterform;
}else {
- $addpoolform = new Application_Form_Pool($_POST);
+ $addpoolform = new Application_Form_Pool(array('buttontext' => 'Create Pool'),$_POST);
if ($addpoolform->isValid($_POST)) {
try{
$pool = new Application_Model_Pool($_POST);
@@ -75,12 +75,12 @@ class PoolController extends Zend_Controller_Action
$poolmapper->find($poolID,$pool);
$poolArray = $pool->toArray();
- $editpool = new Application_Form_Pool();
+ $editpool = new Application_Form_Pool(array('buttontext' => 'Edit Pool'));
$editpool->populate($poolArray);
$this->view->editpoolform = $editpool;
}else {
- $editpoolform = new Application_Form_Pool($_POST);
+ $editpoolform = new Application_Form_Pool(array('buttontext' => 'Edit Pool'),$_POST);
if ($editpoolform->isValid($_POST)) {
try{
$pool = new Application_Model_Pool($_POST);
@@ -100,24 +100,23 @@ class PoolController extends Zend_Controller_Action
{
$clientID = $this->_request->getParam('clientID');
$poolID = $this->_request->getParam('poolID');
-
- if(!isset($_POST['clientID']) && ($clientID == '' && $poolID == '')){
+ if(!isset($_POST['clientID']) && ($clientID == '')){
$clientmapper = new Application_Model_ClientMapper();
$clients = $clientmapper->fetchAll();
foreach($clients as $c){
$clientsArray[] = $c->toArray();
- }
+ }
$assignedclientmapper = new Application_Model_PoolEntriesMapper();
$assignedclients = $assignedclientmapper->fetchAll();
foreach($assignedclients as $c){
$assignedclientsArray[] = $c->toArray();
}
$freeclients = $this->arrayDiff($clientsArray,$assignedclientsArray);
-
- $poolclient = new Application_Form_PoolClient(array('clients'=> $freeclients));
+
+ $poolclient = new Application_Form_PoolClient(array('buttontext' => 'Link Client','clients'=> $freeclients));
$this->view->poolclient = $poolclient;
}else {
- $poolclient = new Application_Form_PoolClient($_POST);
+ $poolclient = new Application_Form_PoolClient(array('buttontext' => 'Link Client'),$_POST);
try{
$pool = new Application_Model_PoolEntries($_POST);
$pool->setPoolID($this->_request->getParam('poolID'));
diff --git a/application/controllers/SessionController.php b/application/controllers/SessionController.php
index 09eadc9..6d0a873 100644
--- a/application/controllers/SessionController.php
+++ b/application/controllers/SessionController.php
@@ -26,11 +26,11 @@ class SessionController extends Zend_Controller_Action
$bootisos = $bi->fetchAll();
if (!isset($_POST["add"])){
- $createsession = new Application_Form_Session(array('clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos));
+ $createsession = new Application_Form_Session(array('buttontext' => 'Create Session','clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos));
$this->view->createsession = $createsession;
}else {
// TODO extend with normal function not only with post
- $createsession = new Application_Form_Session(array('clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos),$_POST);
+ $createsession = new Application_Form_Session(array('buttontext' => 'Create Session','clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos),$_POST);
print_a($_POST);
if ($createsession->isValid($_POST)) {
try{
@@ -49,9 +49,7 @@ class SessionController extends Zend_Controller_Action
}catch (Zend_Exception $e) {
echo "Error message 2: " . $e->getMessage() . "\n";
- }
- print_a('saved');
- #$this->_redirect('/session');
+ }
}
$this->view->createsession = $createsession;
}
@@ -78,7 +76,7 @@ class SessionController extends Zend_Controller_Action
$session->setTime(date('d.m.Y H:i',$session->getTime()));
$session2 = $session->toArray();
- $editsession = new Application_Form_Session(array('clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos));
+ $editsession = new Application_Form_Session(array('buttontext' => 'Edit Session','clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos));
$editsession->populate($session2);
$this->view->editsession = $editsession;
@@ -86,7 +84,7 @@ class SessionController extends Zend_Controller_Action
try{
$sessionID = $this->_request->getParam('sessionID');
- $editsession = new Application_Form_Session(array('clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos),$_POST);
+ $editsession = new Application_Form_Session(array('buttontext' => 'Edit Session','clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos),$_POST);
if ($editsession->isValid($_POST)) {
$session = new Application_Model_Session($_POST);
diff --git a/application/forms/Client.php b/application/forms/Client.php
index d1d4382..83df97e 100644
--- a/application/forms/Client.php
+++ b/application/forms/Client.php
@@ -28,13 +28,17 @@ class Application_Form_Client extends Zend_Form
$this->addElement('submit', 'add', array(
'required' => false,
'ignore' => true,
- 'label' => 'Save',
+ 'label' => $this->buttontext,
));
$this->addElement('button', 'Cancel', array(
'onclick' => 'self.location="/client"'
));
}
+ private $buttontext = 'Save';
+ function setButtontext($v){
+ $this->buttontext = $v;
+ }
}
diff --git a/application/forms/FilterAdd.php b/application/forms/FilterAdd.php
index 43a4aca..b720089 100644
--- a/application/forms/FilterAdd.php
+++ b/application/forms/FilterAdd.php
@@ -45,7 +45,7 @@ class Application_Form_FilterAdd extends Zend_Form
$this->addElement('submit', 'add', array(
'required' => false,
'ignore' => true,
- 'label' => 'Save',
+ 'label' => $this->buttontext,
));
$this->addElement('button', 'Cancel', array(
@@ -56,6 +56,10 @@ class Application_Form_FilterAdd extends Zend_Form
$this->bootmenus = $val;
return;
}
+ private $buttontext = 'Save';
+ function setButtontext($v){
+ $this->buttontext = $v;
+ }
}
diff --git a/application/forms/FilterEntriesAdd.php b/application/forms/FilterEntriesAdd.php
index 2646484..3b051f5 100644
--- a/application/forms/FilterEntriesAdd.php
+++ b/application/forms/FilterEntriesAdd.php
@@ -35,7 +35,7 @@ class Application_Form_FilterEntriesAdd extends Zend_Form
$this->addElement('submit', 'add', array(
'required' => false,
'ignore' => true,
- 'label' => 'Save',
+ 'label' => $this->buttontext,
));
$this->addElement('button', 'Cancel', array(
@@ -50,6 +50,10 @@ class Application_Form_FilterEntriesAdd extends Zend_Form
{
$this->filterID = $id;
}
+ private $buttontext = 'Save';
+ function setButtontext($v){
+ $this->buttontext = $v;
+ }
}
diff --git a/application/forms/Pool.php b/application/forms/Pool.php
index 2fcdf78..be30444 100644
--- a/application/forms/Pool.php
+++ b/application/forms/Pool.php
@@ -35,13 +35,17 @@ class Application_Form_Pool extends Zend_Form
$this->addElement('submit', 'add', array(
'required' => false,
'ignore' => true,
- 'label' => 'Save',
+ 'label' => $this->buttontext,
));
$this->addElement('button', 'Cancel', array(
'onclick' => 'self.location="/pool"'
));
}
+ private $buttontext = 'Save';
+ function setButtontext($v){
+ $this->buttontext = $v;
+ }
}
diff --git a/application/forms/PoolClient.php b/application/forms/PoolClient.php
index 7bacae0..0c4ef6a 100644
--- a/application/forms/PoolClient.php
+++ b/application/forms/PoolClient.php
@@ -11,6 +11,7 @@ class Application_Form_PoolClient extends Zend_Form
$clientfield = $this->createElement('select','clientID');
$clientfield ->setLabel('Client:');
+ print_a($this->clients);
foreach($this->clients as $c){
$clientfield->addMultiOption($c['clientID'],$c['macadress']." - ".$c['hardwarehash']);
}
diff --git a/application/forms/Session.php b/application/forms/Session.php
index b74ca43..f2175a7 100644
--- a/application/forms/Session.php
+++ b/application/forms/Session.php
@@ -73,7 +73,7 @@ $this->addElement('text', 'ip6', array(
$this->addElement('submit', 'add', array(
'required' => false,
'ignore' => true,
- 'label' => 'Save',
+ 'label' => $this->buttontext,
));
$this->addElement('button', 'Cancel', array(
@@ -89,6 +89,10 @@ $this->addElement('text', 'ip6', array(
function setBootisos($v){
$this->bootisos = $v;
}
+ private $buttontext = 'Save';
+ function setButtontext($v){
+ $this->buttontext = $v;
+ }
}
--
cgit v1.2.3-55-g7522