I have a few different "Dashboard" reports created in PHP Reportmaker and I want to display the reports based on user level access as the default page.
I appreciate any input.
Thank You
I have a few different "Dashboard" reports created in PHP Reportmaker and I want to display the reports based on user level access as the default page.
I appreciate any input.
Thank You
Can´t you use CurrentUserLevel() and Page_Terminate() in switch to make this happen?
Ex:
switch (CurrentUserLevel()) {
case 1:
CurrentPage()->Page_Terminate("dashpage_1.php");
break;
case 2:
CurrentPage()->Page_Terminate("dashpage_2.php");
break;
case 3:
CurrentPage()->Page_Terminate("dashpage_3.php");
break;
default:
CurrentPage()->Page_Terminate("dashpage_0.php");
break;
}
or even simpler: CurrentPage()->Page_Terminate("dashpage_".CurrentUserLevel().".php");
@riverman,
No. You cannot use that code in the "Page_Redirecting" server event from "Server Events" -> "Other" -> "Default Page" I mentioned above. It will raise an fatal error if you put your code in that event.
You only need to assign the only param in that event ($url), for example from your code above, it become:
if (IsLoggedIn())
$url = "dashpage_".CurrentUserLevel().".php";
@riverman,
No. You cannot use that code in the "Page_Redirecting" server event from "Server Events" -> "Other" -> "Default Page" I mentioned above. It will raise a fatal error if you put your code in that event.
You only need to assign the only param in that event ($url), for example from your code above, it become:
if (IsLoggedIn())
$url = "dashpage_".CurrentUserLevel().".php";
For v2022, basically is the same as v2021. This should help: viewtopic.php?p=159546#p159546
riverman wrote:
Can´t you use CurrentUserLevel() and Page_Terminate() in switch to make this happen?
Ex:
switch (CurrentUserLevel()) {
case 1:
CurrentPage()->Page_Terminate("dashpage_1.php");
break;
................
I use something very similar with success to do what you are trying.
In ServerEvents-> Other -> Login Page -> UserLoggedIn
switch ($cul) { //current user level
case 6: //if owner
$this->terminate("page1");
break;
case 1: // if supervisor
$this->terminate("page2");
break;
case 2: // if accounting
$this->terminate("page3");
break;
default: // timecard users, all others
$this->terminate("pagedefault");
}
brianheim wrote:
I use something very similar with success to do what you are trying.
In ServerEvents-> Other -> Login Page -> UserLoggedIn
switch ($cul) { //current user level case 6: //if owner $this->terminate("page1"); break; case 1: // if supervisor $this->terminate("page2"); break; case 2: // if accounting $this->terminate("page3"); break; default: // timecard users, all others $this->terminate("pagedefault"); }
I think will not works with last versions of phpmaker if Multiuserlevels is enabled.
maybe you have to use:
$cUL_arr = explode (",", CurrentUserLevel());