From c31d8e9959efade437fb0a661f6f44329cc74664 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 19 Apr 2011 15:43:00 +0200 Subject: Code autoformatiert --- .../modules/user/controllers/PoolController.php | 58 +++++++++++----------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'application/modules/user/controllers/PoolController.php') diff --git a/application/modules/user/controllers/PoolController.php b/application/modules/user/controllers/PoolController.php index b793d80..3d6c0a7 100644 --- a/application/modules/user/controllers/PoolController.php +++ b/application/modules/user/controllers/PoolController.php @@ -14,7 +14,7 @@ class User_PoolController extends Zend_Controller_Action { private $membership; protected $page; - + public function init() { if (Zend_Auth::getInstance()->hasIdentity()) { @@ -30,14 +30,14 @@ class User_PoolController extends Zend_Controller_Action } else { $this->_helper->redirector('login', 'auth'); } - $this->page = $this->_request->getParam('page'); + $this->page = $this->_request->getParam('page'); } public function indexAction() { // ACL: is he allowed to see the pools of a group if(!Pbs_Acl::checkRight('poo')) - $this->_redirect('/user'); + $this->_redirect('/user'); $result = $this->_request->getParam('deleteresult'); if($result != ""){ @@ -74,30 +74,30 @@ class User_PoolController extends Zend_Controller_Action $ff->setID($pool['poolID']); $yourpools[] = $ff; } - - // Search + + // Search $search = $this->_request->getParam('search'); $mySearch = new Pbs_Search(); $mySearch->setSearchTerm($search); $mySearch->setModule('pool'); if($search != ''){ - $this->view->search = $mySearch->getSearchTerm(); - $yourpools = $mySearch->search($yourpools); + $this->view->search = $mySearch->getSearchTerm(); + $yourpools = $mySearch->search($yourpools); } $this->view->searchform = $mySearch->searchForm(); - + // Pagination - $pagination = new Pbs_Pagination(); - $pagination->setPerPage(10); + $pagination = new Pbs_Pagination(); + $pagination->setPerPage(10); $pagination->setElement($yourpools); - $pagination->setRequestPage($this->_request->getParam('page')); + $pagination->setRequestPage($this->_request->getParam('page')); $pagination->setPageUrl('/user/pool/index'.((isset($this->view->search))?'/search/'.$this->view->search:'')); - $yourpools = $pagination->getElements(); - + $yourpools = $pagination->getElements(); + $this->view->pagination = $pagination->pagination(); $this->view->page = $pagination->getRequestPage(); - $this->view->pools = $yourpools; - + $this->view->pools = $yourpools; + // Get all Clients from this group $clientmapper = new Application_Model_ClientMapper(); @@ -113,11 +113,11 @@ class User_PoolController extends Zend_Controller_Action // extract the un-assigned clients from the clientlist of the group $freeclients = $this->arrayDiff($clientsArray,$assignedclientsArray); - if(Pbs_Acl::checkRight('posuc')) - $this->view->freeclients = $freeclients; + if(Pbs_Acl::checkRight('posuc')) + $this->view->freeclients = $freeclients; } - - public function searchAction(){ + + public function searchAction(){ $this->_redirect('/user/pool/index/search/'.($_GET['search'])); } @@ -125,8 +125,8 @@ class User_PoolController extends Zend_Controller_Action { // ACL: is he allowed to create a pool? if(!Pbs_Acl::checkRight('poc')) - $this->_redirect('/user'); - + $this->_redirect('/user'); + if (!isset($_POST["add"])){ $addfilterform = new user_Form_Pool(array( 'buttontext' => 'Create Pool', @@ -155,10 +155,10 @@ class User_PoolController extends Zend_Controller_Action public function deletepoolAction() { $poolID = $this->_request->getParam('poolID'); - + // ACL: is he allowed to delete a pool? if(!Pbs_Acl::checkRight('pod')) - $this->_redirect('/user'); + $this->_redirect('/user'); if(is_numeric($poolID)){ $poolmapper = new Application_Model_PoolMapper(); @@ -181,10 +181,10 @@ class User_PoolController extends Zend_Controller_Action { // ACL: is he allowed to edit a pool? if(!Pbs_Acl::checkRight('poe')) - $this->_redirect('/user'); - + $this->_redirect('/user'); + if (!isset($_POST["add"])){ - $poolID = $this->_request->getParam('poolID'); + $poolID = $this->_request->getParam('poolID'); $pool = new Application_Model_Pool(); $poolmapper = new Application_Model_PoolMapper(); $poolmapper->find($poolID,$pool); @@ -236,8 +236,8 @@ class User_PoolController extends Zend_Controller_Action // ACL: Is he allowed to link clients to pools? if(!Pbs_Acl::checkRight('polc')) - $this->_redirect('/user'); - + $this->_redirect('/user'); + if(!isset($_POST['clientID']) && ($clientID == '')){ $clientmapper = new Application_Model_ClientMapper(); $clients = $clientmapper->findBy(array('groupID',$this->membership->getGroupID()),true); @@ -293,7 +293,7 @@ class User_PoolController extends Zend_Controller_Action // ACL: Is he allowed to unlink clients from pools? if(!Pbs_Acl::checkRight('pouc')) - $this->_redirect('/user'); + $this->_redirect('/user'); if(is_numeric($poolentriesID)){ $poolentriesMapper = new Application_Model_PoolEntriesMapper(); -- cgit v1.2.3-55-g7522 From 156abd0d614adfffed22e1d4de3168c22bf611c6 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 20 Apr 2011 18:00:20 +0200 Subject: Created bei Client hinzugefĆ¼gt --- application/models/Client.php | 10 ++++++++++ application/models/ClientMapper.php | 15 ++++++++++++--- .../modules/fbgui/controllers/IndexController.php | 1 + .../modules/user/controllers/ClientController.php | 12 ++++++++++-- application/modules/user/controllers/PoolController.php | 7 ++++++- .../modules/user/views/scripts/client/index.phtml | 3 +++ application/modules/user/views/scripts/pool/index.phtml | 8 +++++--- setup/pbs-newdata.sql | 17 +++++++++-------- setup/pbs.sql | 1 + 9 files changed, 57 insertions(+), 17 deletions(-) (limited to 'application/modules/user/controllers/PoolController.php') diff --git a/application/models/Client.php b/application/models/Client.php index a63e8ba..e8108ef 100644 --- a/application/models/Client.php +++ b/application/models/Client.php @@ -16,6 +16,7 @@ class Application_Model_Client protected $_groupID; protected $_macadress; protected $_hardwarehash; + protected $_created; public function __construct(array $options = null) { @@ -91,6 +92,15 @@ class Application_Model_Client $this->_hardwarehash = $_hardwarehash; return $this; } + public function getCreated() + { + return $this->_created; + } + public function setCreated($_created) + { + $this->_created = $_created; + return $this; + } /** * Returns current data as associative array using ReflectionClass * diff --git a/application/models/ClientMapper.php b/application/models/ClientMapper.php index d727352..bcb3286 100644 --- a/application/models/ClientMapper.php +++ b/application/models/ClientMapper.php @@ -87,7 +87,8 @@ class Application_Model_ClientMapper $data = array('clientID'=> $client->getID() , 'groupID' => $client->getGroupID(), 'macadress'=> $client->getMacadress() , - 'hardwarehash'=> $client->getHardwarehash() + 'hardwarehash'=> $client->getHardwarehash(), + 'created'=> $client->getCreated() ); if (null === ($id = $client->getID()) ) { @@ -116,7 +117,11 @@ class Application_Model_ClientMapper $row = $result->current(); - $client->setID($row->clientID)->setGroupID($row->groupID)->setMacadress($row->macadress)->setHardwarehash($row->hardwarehash); + $client->setID($row->clientID) + ->setGroupID($row->groupID) + ->setMacadress($row->macadress) + ->setHardwarehash($row->hardwarehash) + ->setCreated($row->created); } public function fetchAll() @@ -126,7 +131,11 @@ class Application_Model_ClientMapper foreach ($resultSet as $row) { $entry = new Application_Model_Client(); - $entry->setID($row->clientID)->setGroupID($row->groupID)->setMacadress($row->macadress)->setHardwarehash($row->hardwarehash); + $entry->setID($row->clientID) + ->setGroupID($row->groupID) + ->setMacadress($row->macadress) + ->setHardwarehash($row->hardwarehash) + ->setCreated($row->created); $entries[] = $entry; } diff --git a/application/modules/fbgui/controllers/IndexController.php b/application/modules/fbgui/controllers/IndexController.php index 150f1c5..d2b21be 100644 --- a/application/modules/fbgui/controllers/IndexController.php +++ b/application/modules/fbgui/controllers/IndexController.php @@ -75,6 +75,7 @@ class Fbgui_IndexController extends Zend_Controller_Action $client->setMacadress($mySession->postdata['mac']); $client->setHardwarehash($mySession->postdata['hardwarehash']); $client->setGroupID($groupID); + $client->setCreated(time()); $client = $n->createClient($client); $clientID = $client->getID(); diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php index 687e910..589fcdc 100644 --- a/application/modules/user/controllers/ClientController.php +++ b/application/modules/user/controllers/ClientController.php @@ -69,7 +69,12 @@ class User_ClientController extends Zend_Controller_Action $clientsInGroup = $mySearch->search($clientsInGroup); } $this->view->searchform = $mySearch->searchForm(); - + + // Format Time-String + foreach($clientsInGroup as $k=>$cig){ + $clientsInGroup[$k]['created'] = date(Zend_Registry::get('dateformat'),$cig['created']); + } + // Pagination $pagination = new Pbs_Pagination(); $pagination->setPerPage(10); @@ -111,7 +116,8 @@ class User_ClientController extends Zend_Controller_Action $mac = ($mac!='')?$mac:$_POST['macadress']; $hh = ($hh!='')?$hh:$_POST['hardwarehash']; $client->setMacadress($mac); - $client->setHardwarehash($hh); + $client->setHardwarehash($hh); + $client->setCreated(time()); $client->setGroupID($this->membership->getGroupID()); $clientmapper = new Application_Model_ClientMapper(); $clientmapper->save($client); @@ -178,6 +184,8 @@ class User_ClientController extends Zend_Controller_Action $dbclient = new Application_Model_Client(); $clientMapper = new Application_Model_ClientMapper(); $clientMapper->find($this->_request->getParam('clientID'),$dbclient); + + $client->setCreated($dbclient->getCreated()); if($dbclient->getGroupID() == $this->membership->getGroupID()){ $client->setGroupID($this->membership->getGroupID()); diff --git a/application/modules/user/controllers/PoolController.php b/application/modules/user/controllers/PoolController.php index 3d6c0a7..3d6a0f5 100644 --- a/application/modules/user/controllers/PoolController.php +++ b/application/modules/user/controllers/PoolController.php @@ -112,7 +112,12 @@ class User_PoolController extends Zend_Controller_Action // extract the un-assigned clients from the clientlist of the group $freeclients = $this->arrayDiff($clientsArray,$assignedclientsArray); - + + // Format Time-String + foreach($freeclients as $k=>$cig){ + $freeclients[$k]['created'] = date(Zend_Registry::get('dateformat'),$cig['created']); + } + if(Pbs_Acl::checkRight('posuc')) $this->view->freeclients = $freeclients; } diff --git a/application/modules/user/views/scripts/client/index.phtml b/application/modules/user/views/scripts/client/index.phtml index b519140..6f7a806 100644 --- a/application/modules/user/views/scripts/client/index.phtml +++ b/application/modules/user/views/scripts/client/index.phtml @@ -11,6 +11,7 @@
clientID
macadress
hardwarehash
+
created
@@ -55,6 +56,8 @@
escape($client['macadress']) ?>
escape($client['hardwarehash']) ?>
+ +
escape($client['created']) ?>
diff --git a/application/modules/user/views/scripts/pool/index.phtml b/application/modules/user/views/scripts/pool/index.phtml index 56ae8d5..f78df6a 100644 --- a/application/modules/user/views/scripts/pool/index.phtml +++ b/application/modules/user/views/scripts/pool/index.phtml @@ -144,7 +144,7 @@
- pools as $pool): ?>