From 29224a1ccc162e457589210168c38529e81a572d Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 16 Mar 2011 14:42:40 +0100 Subject: Helper initialisiert, ClientController geadded --- .../modules/dev/controllers/ClientController.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'application/modules/dev/controllers/ClientController.php') diff --git a/application/modules/dev/controllers/ClientController.php b/application/modules/dev/controllers/ClientController.php index d73379c..27b8a08 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($groups);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')); -- cgit v1.2.3-55-g7522