Page 1 of 1

Determine Current View Mode ?

Posted: 2014-05-29 18:13
by primitive_man
Anyone know of a way to determine the current View Mode, ie, List, Detail View, Print ?

Re: Determine Current View Mode ?

Posted: 2014-06-02 11:17
by primitive_man
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.

Re: Determine Current View Mode ?

Posted: 2014-06-02 19:44
by a.gneady
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

Re: Determine Current View Mode ?

Posted: 2014-06-04 12:46
by primitive_man
Thank you - this worked perfectly.

Re: Determine Current View Mode ?

Posted: 2014-07-06 15:45
by betopark60
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

Re: Determine Current View Mode ?

Posted: 2014-07-08 11:40
by a.gneady
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.