Need to disable the Show All button

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
mgain2013
Posts: 29
Joined: 2013-02-16 16:12

Need to disable the Show All button

Post by mgain2013 » 2013-05-08 16:56

Can any one tell be where I can find the "Show All" button. I have some filtered record that I don't want the end user to be able to see. Changing the permissions won't help as the end user is not the owner of these records. The record is filtered based on an id from another table. If I can remove the SHOW ALL Button, it will eliminate the end user from seeing records that they don't need to see.

I have looked through all the files and I can't seem to determine which line presents the SHOW ALL button.

Thanks in advance for any help you can previde.

User avatar
shasta59
AppGini Super Hero
AppGini Super Hero
Posts: 231
Joined: 2013-01-08 19:40
Location: Calgary, Alberta, Canada

Re: Need to disable the Show All button

Post by shasta59 » 2013-05-09 15:23

Hello

Go to your datalist.php file and comment out the following lines

// display Show All icon
if(($this->AllowFilters || ($this->QuickSearch>=1 && $this->QuickSearch<=3)) && $Print_x==''){
$this->HTML .= '<button onClick="document.myform.NoDV.value=1; '.$resetSelection.'" type="submit" name="NoFilter_x" id="NoFilter" value="1"><img src="cancel_search.gif" /> ' . $Translation['Reset Filters'] . '</button>';
$buttonsCount++;
}


This will then turn off the Show All button from now on. If you wish to have admin or others still have the Show All button there you will have to write a condition to allow it to show when the group is admin or whomever you wish. I would write the code as part of the if statement to look for what group the current user is in and allow/disallow based upon group.

Hope this helps.

Alan
Calgary, Alberta, Canada - Using Appgini 5.50 -

mgain2013
Posts: 29
Joined: 2013-02-16 16:12

Re: Need to disable the Show All button

Post by mgain2013 » 2013-05-10 04:57

Alan,

Thank you so much for your help! It worked Great!! I hope in the coming weeks and months I will be able to pay forward so to speak and help someone else that is stuck..

One last question, I am still pretty new with PHP, and I am not quite sure of the correct syntax adding the if statement to allow different groups to see the Show All button. If you have an opportunity to share that with Me I would greatly appreciate it.

Thanks,
Michael

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 352
Joined: 2013-03-21 04:37

Re: Need to disable the Show All button

Post by peebee » 2013-05-10 06:12

Whilst I haven't actually tried it, I think you could also achieve the desired result using the tablename_init() hook of the particular table concerned

see: http://bigprof.com/appgini/help/advance ... ename_init for how it is used. The example provided is exactly what you're after.

The DataList object concerned would be AllowFilters

see here: http://bigprof.com/appgini/help/advance ... s/DataList

So, this is what you'd need to enter to your tablename.php hook

Code: Select all

function tablename_init(&$options, $memberInfo, &$args){

	if($memberInfo['group']=='Admins'){
		$options->AllowFilters=1;
	}else{
		$options->AllowFilters=0;
	}
	
	return TRUE;
}
Hope that helps.

mgain2013
Posts: 29
Joined: 2013-02-16 16:12

Re: Need to disable the Show All button

Post by mgain2013 » 2013-05-11 05:37

Thank you for this information, I will try this also and see which works best for my purposes.

Best Regards,
Michael

Post Reply