Page 1 of 1

[SOLVED] How to figure out that I am in admin panel?

Posted: Sat Aug 23, 2008 3:10 pm
by Sonya
Hello,

The question above.  :) While loading module I need to figure out if I it is called from admin panel or from the front end to execute different tasks. Something like this
class MyClass extends CMSModule
{
function __construct() {
parent::__construct();
if (in_admin_panel) {
do this;
} else {
do that;
}
}
...
}
My question is how to realize this condition if (in_admin_panel)?

Thank you for your help,
Sonya

Re: How to figure out that I am in admin panel?

Posted: Sat Aug 23, 2008 3:53 pm
by Sonya
I have just figured it out:
class MyClass extends CMSModule
{
function __construct() {
parent::__construct();
global $CMS_ADMIN_PAGE;
if (!isset($CMS_ADMIN_PAGE)) {
do this;
} else {
do that;
}
}
...
}

Re: [SOLVED] How to figure out that I am in admin panel?

Posted: Sat Aug 23, 2008 5:26 pm
by calguy1000
Or, in any action, if the returnid is empty, then you are in an admin page.

Re: [SOLVED] How to figure out that I am in admin panel?

Posted: Sat Aug 23, 2008 5:27 pm
by Sonya
calguy1000 wrote: Or, in any action, if the returnid is empty, then you are in an admin page.
Thank you! :)