I have a question regarding setSecurityFilter
How can I have multiple 'OfficeID' s in the array?
Situation now is:
In table1 I only see the records belonging to 1 office. Where table1.OfficeID = Offices.OfficeID
New situation:
In table1 I only want to see the records belonging to several offices. (in the table Offices a column: 'Belongs_To')
- Code: Select all
function getPreferences()
{
$table1 =& Dataface_Table::loadtable('table1');
$auth =& Dataface_AuthenticationTool::getInstance();
$user =& $auth -> getLoggedInUser();
if ($user and $user -> val('Role') == 'HeadOffice')
{
$this->app =& Dataface_Application::getInstance();
$result = mysql_query("SELECT OfficeID FROM Offices WHERE Belongs_To = '01' ", $this->app->db());
// Now I use '01' it will be replaced by the right value.
if($result)
{
while($row = mysql_fetch_array( $result )){
$arSecurity = array('OfficeID'=>$row['OfficeID']);
}
} else {
$arSecurity = array('OfficeID'=>'99');
}
$table1 -> setSecurityFilter($arSecurity);
}
Right now it only shows the last one (which is correct as it loops trough the results of the query and it does not add).
If I use: $arSecurity = array('OfficeID'=>'10..30');
It shows all the records between (and including) 10 and 30.
If I use: $arSecurity = array('OfficeID'=>'10&30');
It gives an error.
But I want it to show all the records from the query result.
Thanks in advance.
Brian