diff options
| author | michael pereira | 2011-03-16 16:35:20 +0100 |
|---|---|---|
| committer | michael pereira | 2011-03-16 16:35:20 +0100 |
| commit | b09352fc9ec322ea0ae744077a66fcaf61465ed5 (patch) | |
| tree | b9e45999ce4d1eaa08035601bfd8f14f91547d30 /application/modules/dev | |
| parent | KCLAppend hinzugefuegt, KCL fertig :-) (diff) | |
| parent | ClientController geändert, Forms können in FBGui und User nicht benutzt werden (diff) | |
| download | pbs2-b09352fc9ec322ea0ae744077a66fcaf61465ed5.tar.gz pbs2-b09352fc9ec322ea0ae744077a66fcaf61465ed5.tar.xz pbs2-b09352fc9ec322ea0ae744077a66fcaf61465ed5.zip | |
Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2
Diffstat (limited to 'application/modules/dev')
| -rw-r--r-- | application/modules/dev/controllers/ClientController.php | 18 | ||||
| -rw-r--r-- | application/modules/dev/forms/Client.php | 18 | ||||
| -rw-r--r-- | application/modules/dev/layouts/dev.phtml | 2 | ||||
| -rw-r--r-- | application/modules/dev/views/scripts/client/index.phtml | 2 |
4 files changed, 32 insertions, 8 deletions
diff --git a/application/modules/dev/controllers/ClientController.php b/application/modules/dev/controllers/ClientController.php index d73379c..aa66a96 100644 --- a/application/modules/dev/controllers/ClientController.php +++ b/application/modules/dev/controllers/ClientController.php @@ -18,15 +18,19 @@ class dev_ClientController extends Zend_Controller_Action { $mac = $this->_request->getParam('mac'); $hh = $this->_request->getParam('hh'); + + $groupMapper = new Application_Model_GroupMapper(); + $groups = $groupMapper->fetchAll(); + #print_a($groups);die(); if (!isset($_POST["add"])){ - $addclient = new dev_Form_Client(array('buttontext' => 'Create Client')); + $addclient = new dev_Form_Client(array('buttontext' => 'Create Client','groups'=>$groups)); $this->view->addclient = $addclient; } else{ - $addfilterform = new dev_Form_Client(array('buttontext' => 'Create Client'),$_POST); + $addfilterform = new dev_Form_Client(array('buttontext' => 'Create Client','groups'=>$groups),$_POST); if ($addfilterform->isValid($_POST) || ($mac != '' && $hh != '') ) { - $client = new Application_Model_Client(); + $client = new Application_Model_Client($_POST); $mac = ($mac!='')?$mac:$_POST['macadress']; $hh = ($hh!='')?$hh:$_POST['hardwarehash']; $client->setMacadress($mac); @@ -55,18 +59,22 @@ class dev_ClientController extends Zend_Controller_Action public function editclientAction() { + $groupMapper = new Application_Model_GroupMapper(); + $groups = $groupMapper->fetchAll(); + # print_a($this);die(); + if (!isset($_POST["add"])){ $clientID = $this->_request->getParam('clientID'); $data = new Application_Model_Client(); $mapper = new Application_Model_ClientMapper(); $mapper->find($clientID,$data); - $editclient = new dev_Form_Client(array('buttontext' => 'Edit Client')); + $editclient = new dev_Form_Client(array('buttontext' => 'Edit Client', 'groups'=>$groups)); $editclient->populate($data->toArray()); $this->view->editclient = $editclient; } else{ - $editclient = new dev_Form_Client(array('buttontext' => 'Edit Client'),$_POST); + $editclient = new dev_Form_Client(array('buttontext' => 'Edit Client','groups'=>$groups),$_POST); if ($editclient->isValid($_POST) || ($mac != '' && $hh != '') ) { $client = new Application_Model_Client($_POST); $client->setID($this->_request->getParam('clientID')); diff --git a/application/modules/dev/forms/Client.php b/application/modules/dev/forms/Client.php index f09f720..1e62877 100644 --- a/application/modules/dev/forms/Client.php +++ b/application/modules/dev/forms/Client.php @@ -7,7 +7,16 @@ class dev_Form_Client extends Zend_Form { $this->setName("pool"); $this->setMethod('post'); - + + $groupfield = $this->createElement('select','groupID'); + $groupfield ->setLabel('Group:'); + + foreach($this->groups as $c){ + $groupfield->addMultiOption($c->getID(),$c->getTitle()); + } + $this->addElement($groupfield); + + $this->addElement('text', 'macadress', array( 'filters' => array('StringTrim'), 'validators' => array( @@ -32,13 +41,18 @@ class dev_Form_Client extends Zend_Form )); $this->addElement('button', 'Cancel', array( - 'onclick' => 'self.location="/client"' + 'onclick' => 'self.location="/dev/client"' )); } private $buttontext = 'Save'; + private $groups; function setButtontext($v){ $this->buttontext = $v; } + public function setGroups($groups){ + $this->groups = $groups; + return $this; + } } diff --git a/application/modules/dev/layouts/dev.phtml b/application/modules/dev/layouts/dev.phtml index 2c7f6f0..b911944 100644 --- a/application/modules/dev/layouts/dev.phtml +++ b/application/modules/dev/layouts/dev.phtml @@ -22,7 +22,7 @@ echo $this->headScript()."\n"; <div id='sidepannel'> <div id="logo"><div id="logo-bar-gray"></div></div> <div id="sidepannel-top"> - <h1>dev</h1> + <h1><a href=/><</a> <a href=/dev/>dev</a></h1> <ul> <li>Controller: <ul> diff --git a/application/modules/dev/views/scripts/client/index.phtml b/application/modules/dev/views/scripts/client/index.phtml index fa12ed7..612e23b 100644 --- a/application/modules/dev/views/scripts/client/index.phtml +++ b/application/modules/dev/views/scripts/client/index.phtml @@ -7,6 +7,7 @@ <table> <tr> <th>ID</th> + <th>GroupID</th> <th>MAC</th> <th>Hardwarehash</th> <th colspan=2>Actions</th> @@ -14,6 +15,7 @@ <?php foreach ($this->clients as $client): ?> <tr class=entry> <td><?php echo $this->escape($client->getID()) ?></td> + <td><?php echo $this->escape($client->getGroupID()) ?></td> <td class='monospace'><?php echo $this->escape($client->getMacadress()) ?></td> <td class='monospace'><?php echo $this->escape($client->getHardwarehash()) ?></td> <td class='action'><a href="<?php echo $this->url( |
