Show filering

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
kbarrett
Veteran Member
Posts: 50
Joined: 2019-02-24 16:35
Location: Calgary Alberta

Show filering

Post by kbarrett » 2019-04-02 21:08

Hello All,

Using AppGini 5.75 in and working in MyTable.php in Hooks.

I am trying to limit the ability to filter tables by position. I have added Position as memberInfo['custom'][1]. The problem I have is being able to add multiple positions. I used the code below in the function MyTable_init(&$options, $memberInfo, &$args){

if($memberInfo['custom'][1]== 'Manager'){
$options->AllowFilters=1;
}else{
$options->AllowFilters=0;
}
and tried to include multiple positions as the variables to if($memberInfo['custom'][1]== 'Manager') something like if($memberInfo['custom'][1]== 'Manager' or 'Director') and other variations. Any input is appreciated.

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Show filering

Post by pbottcher » 2019-04-02 21:23

Hi,

maybe you can use something like

switch($memberInfo['custom'][1]) {
case "Manager": $options->AllowFilters=1; break;
case "Director": SET OTHER OPTION; break;
default: $options->AllowFilters=0; break;
}
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

kbarrett
Veteran Member
Posts: 50
Joined: 2019-02-24 16:35
Location: Calgary Alberta

Re: Show filering

Post by kbarrett » 2019-04-02 22:22

Hi,

Tried the code:

switch($memberInfo['custom'][1]) {
case "Manager": $options->AllowFilters=1; break;
case "Director": SET OTHER OPTION; break;
default: $options->AllowFilters=0; break;
}

but the following error string was returned:

Parse error: syntax error, unexpected 'OPTION' (T_STRING) in C:\xampp\htdocs\project\hooks\MyTable.php Did I miss something?

kbarrett
Veteran Member
Posts: 50
Joined: 2019-02-24 16:35
Location: Calgary Alberta

Re: Show filtering

Post by kbarrett » 2019-04-03 00:50

BAH!
Colour me thick! I figured it out! Many thanks again!

Kevin

Post Reply