summaryrefslogtreecommitdiffstats
path: root/application/controllers/FilterController.php
diff options
context:
space:
mode:
authorSimon2011-03-08 18:37:35 +0100
committerSimon2011-03-08 18:37:35 +0100
commitc113eb1ddd0263664b6ddaa22291469b56867a6c (patch)
tree184e95b7aba712149f0c4bb6f7adb459a6fa4024 /application/controllers/FilterController.php
parentMerge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff)
downloadpbs2-c113eb1ddd0263664b6ddaa22291469b56867a6c.tar.gz
pbs2-c113eb1ddd0263664b6ddaa22291469b56867a6c.tar.xz
pbs2-c113eb1ddd0263664b6ddaa22291469b56867a6c.zip
filtertypes implementiert
Diffstat (limited to 'application/controllers/FilterController.php')
-rw-r--r--application/controllers/FilterController.php94
1 files changed, 69 insertions, 25 deletions
diff --git a/application/controllers/FilterController.php b/application/controllers/FilterController.php
index df8db07..a8a1636 100644
--- a/application/controllers/FilterController.php
+++ b/application/controllers/FilterController.php
@@ -262,11 +262,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 +288,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 +313,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;