summaryrefslogtreecommitdiffstats
path: root/application/controllers/FilterController.php
diff options
context:
space:
mode:
authormichael pereira2011-03-08 19:41:07 +0100
committermichael pereira2011-03-08 19:41:07 +0100
commit6a917fa16d4aabd8e69e1db08867899c860424e1 (patch)
tree5aee03f6bf1810ec340110df55fd1edacf44f592 /application/controllers/FilterController.php
parentBootOs Name anzeigen & Reihenfolge im BootMenu (diff)
parentansehnlichere oberfläche && Controller auflistung (diff)
downloadpbs2-6a917fa16d4aabd8e69e1db08867899c860424e1.tar.gz
pbs2-6a917fa16d4aabd8e69e1db08867899c860424e1.tar.xz
pbs2-6a917fa16d4aabd8e69e1db08867899c860424e1.zip
Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2
Diffstat (limited to 'application/controllers/FilterController.php')
-rw-r--r--application/controllers/FilterController.php98
1 files changed, 70 insertions, 28 deletions
diff --git a/application/controllers/FilterController.php b/application/controllers/FilterController.php
index df8db07..1ebb35e 100644
--- a/application/controllers/FilterController.php
+++ b/application/controllers/FilterController.php
@@ -42,8 +42,7 @@ class FilterController extends Zend_Controller_Action
// TODO: Ändere mit ACL
$newfilter->setGroupID('1');
- $newfilter->setMembershipID('1');
- $newfilter->setBootmenuID('1');
+ $newfilter->setMembershipID('1');
$newfilter2 = new Application_Model_FilterMapper();
$newfilter2->save($newfilter);
@@ -95,7 +94,6 @@ class FilterController extends Zend_Controller_Action
//TODO: ACL integrieren
$_POST['groupID'] = 1;
$_POST['membershipID'] = 1;
- $_POST['bootmenuID'] = 1;
$_POST['created'] = time();
if ($editfilterform->isValid($_POST)) {
@@ -262,11 +260,18 @@ class FilterController extends Zend_Controller_Action
$db = $this->db;
$showPartResults = false;
try{
+
+ $mysession = '1';
+
+ $filtertypID = 8;
+ $session = new Application_Model_Session();
+ $sessionmapper = new Application_Model_SessionMapper();
+ $sessionmapper->find($mysession,$session);
#########################################################
// IP Adress
$filtertypID = 1;
// get it from session_table with session_id from the session
- $ipAdress = "111.10.10.10";
+ $ipAdress = $session->getIp();
$ipAdress = str_replace(".","",$this->fillIP($ipAdress));
$select = $db->select()
->from(array('pbs_filterentries')
@@ -281,13 +286,16 @@ class FilterController extends Zend_Controller_Action
$set[$filtertypID][] = $r['filterID'];
}
if($showPartResults)
- print_a('ipAdress',$result,$set[$filtertypID]);
-
+ print_a('ipAdress',$result,$set[$filtertypID]);
#########################################################
// Mac range
$filtertypID = 2;
// get it from session_table with session_id from the session
- $macAdress = "00:1e:0b:27:f4:99";
+ $client = new Application_Model_Client();
+ $clientmapper = new Application_Model_ClientMapper();
+ $clientmapper->find($session->getClientID(),$client);
+
+ $macAdress = $client->getMacadress();
$macAdress = str_replace(":","",$this->fillMac($ipAdress));
$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
filtertypeID = ".$filtertypID." AND
@@ -303,47 +311,81 @@ class FilterController extends Zend_Controller_Action
// PoolID
$filtertypID = 3;
// get PoolID from client_ID from session_id from the session
- $poolid = 1;
+ $poolentry = new Application_Model_PoolEntries();
+ $poolentrymapper = new Application_Model_PoolEntriesMapper();
+ $poolentry = $poolentrymapper->findby('clientID',$client->getID());
+ $poolentry = $poolentry[0];
+
+ $poolID = $poolentry['poolID'];
+ print_a($poolentry);
$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
filtertypeID = ".$filtertypID." AND
- filtervalue = '.$poolid.' ");
+ filtervalue = ".$poolID." ");
$result = $stmt->fetchAll();
foreach($result as $r){
$set[$filtertypID][] = $r['filterID'];
}
if($showPartResults)
print_a('poolID',$result,$set[$filtertypID]);
- /*
- If client comes from a specific pool
- */
#########################################################
- // ClientID
- $filtertypID = 8;
- // get client_ID from session_id from the session
- /*
- If client is a specific client
- */
+ // ClientID
+ $filtertypID = 8;
+ // get client_ID from session_id from the session
+ $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
+ filtertypeID = ".$filtertypID." AND
+ filtervalue = ".$session->getClientID()." ");
+ $result = $stmt->fetchAll();
+ foreach($result as $r){
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ if($showPartResults)
+ print_a('clientID',$result,$set[$filtertypID]);
#########################################################
// BootIsoID
$filtertypID = 4;
- // get BootIsoID from client_ID from session_id from the session
- /*
- WHERE bootiso = bootiso
- */
+ // get BootIsoID from client_ID from session_id from the session
+ $bootisoID = $session->getBootisoID();
+ $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
+ filtertypeID = ".$filtertypID." AND
+ filtervalue = ".$bootisoID." ");
+ $result = $stmt->fetchAll();
+ foreach($result as $r){
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ if($showPartResults)
+ print_a('bootisoID',$result,$set[$filtertypID]);
#########################################################
// MembershipID
$filtertypID = 5;
// get membership from the session
- /*
- user is in a defined membership
- */
+ //TODO: GET MEMBERSHIP from SESSION
+ $membershipID = 1;
+
+ $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
+ filtertypeID = ".$filtertypID." AND
+ filtervalue = ".$membershipID." ");
+ $result = $stmt->fetchAll();
+ foreach($result as $r){
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ if($showPartResults)
+ print_a('membership',$result,$set[$filtertypID]);
#########################################################
// GroupID
$filtertypID = 6;
// get membership from the session
- /*
- user is in a defined groupID
- */
+ //TODO: GET GROUP from SESSION
+ $groupID = 1;
+
+ $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
+ filtertypeID = ".$filtertypID." AND
+ filtervalue = ".$groupID." ");
+ $result = $stmt->fetchAll();
+ foreach($result as $r){
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ if($showPartResults)
+ print_a('membership',$result,$set[$filtertypID]);
#########################################################
// Time
$filtertypID = 7;