summaryrefslogtreecommitdiffstats
path: root/application/controllers
diff options
context:
space:
mode:
authorSimon2011-03-08 14:43:06 +0100
committerSimon2011-03-08 14:43:06 +0100
commit0954a80dac370c9fe8c66b8855d13acd3483e42a (patch)
tree07de0d71f8fe9125f8dffb2a7488d97f1dcea969 /application/controllers
parentapplication.ini entfernt (diff)
downloadpbs2-0954a80dac370c9fe8c66b8855d13acd3483e42a.tar.gz
pbs2-0954a80dac370c9fe8c66b8855d13acd3483e42a.tar.xz
pbs2-0954a80dac370c9fe8c66b8855d13acd3483e42a.zip
pools nun besser bearbeitbar
Diffstat (limited to 'application/controllers')
-rw-r--r--application/controllers/PoolController.php28
1 files changed, 23 insertions, 5 deletions
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');