Determine Current View Mode ?

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
primitive_man
AppGini Super Hero
AppGini Super Hero
Posts: 54
Joined: 2014-03-09 20:20

Determine Current View Mode ?

Post by primitive_man » 2014-05-29 18:13

Anyone know of a way to determine the current View Mode, ie, List, Detail View, Print ?

primitive_man
AppGini Super Hero
AppGini Super Hero
Posts: 54
Joined: 2014-03-09 20:20

Re: Determine Current View Mode ?

Post by primitive_man » 2014-06-02 11:17

No answers to this either, huh?
I seem to have a gift for asking questions that gain no reply... yet other people must be curious as the posts get visited enough.

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: Determine Current View Mode ?

Post by a.gneady » 2014-06-02 19:44

Try this:

Code: Select all

	function get_current_view(){
		$view = 'TV';
		if($_REQUEST['Print_x'] != '' || $_REQUEST['PrintTV'] != '')
			$view = 'TVP';
		elseif($_REQUEST['dvprint_x'] != '' || $_REQUEST['PrintDV'] != '')
			$view = 'DVP';
		elseif($_REQUEST['Filter_x'] != '')
			$view = 'Filters';
		elseif(($_REQUEST['SelectedID'] && !$_REQUEST['deselect_x'] && !$_REQUEST['delete_x']) || $_REQUEST['addNew_x'] != '')
			$view = 'DV';

		return $view;
	}
To use it, just check the value returned from get_current_view():
TV = table view
TVP: print preview of table view
DVP: print preview of detail view
Filters: filters!
DV: detail view
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

primitive_man
AppGini Super Hero
AppGini Super Hero
Posts: 54
Joined: 2014-03-09 20:20

Re: Determine Current View Mode ?

Post by primitive_man » 2014-06-04 12:46

Thank you - this worked perfectly.

betopark60
Posts: 2
Joined: 2013-10-23 21:47

Re: Determine Current View Mode ?

Post by betopark60 » 2014-07-06 15:45

Where do i insert that code?

I want to change the view. For example:

I have a Detail View of a table and i print that to my client, but i want to print another view without the amounts to my employee.

Is possible to use diferent templates with the same information? and how do i do that.

Best Regards

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: Determine Current View Mode ?

Post by a.gneady » 2014-07-08 11:40

betopark60 wrote:Where do i insert that code?
the get_current_view() code above you mean? You could insert it into the "hooks/__global.php" file.
betopark60 wrote:I have a Detail View of a table and i print that to my client, but i want to print another view without the amounts to my employee.
Hmm .. currently it's not possible to have different print views for different users without manually editing the generated code. But we plan to add support for this in hooks in future releases.
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

Post Reply