Context
class Context (View source)
Class Context
Properties
| DoliDB | $db | ||
| string | $title | ||
| string | $desc | ||
| string | $meta_title | ||
| string | $meta_desc | ||
| string | $appliName | The application name |
|
| string | $controller | ||
| bool | $controller_found | ||
| Controller | $controllerInstance | ||
| string | $error | for internal error msg |
|
| string[] | $errors | ||
| string | $action | ||
| string | $tplDir | ||
| string | $tplPath | ||
| stdClass | $topMenu | ||
| string | $rootUrl | ||
| string | $cdnUrl | ||
| string[] | $menu_active | ||
| array{mesgs: string[], warnings: string[], errors: string[]}|array{} | $eventMessages | ||
| string | $tokenKey | ||
| object | $object | Current object of page |
|
| User | $logged_user | ||
| Societe | $logged_thirdparty | ||
| WebPortalMember | $logged_member | ||
| WebPortalPartnership | $logged_partnership | ||
| WebPortalTheme | $theme |
Methods
Singleton method to create one instance of this object
Init controller
Add controller definition
Set controller found
Get WebPortal root url
Get root url
Get controller url according to context
Generate public controller URL Used for external link (like email or web page) so remove token and contextual behavior associate with current user
Url origin
Check if user is logged
Is menu enabled ?
Set errors
Get errors
Clear errors
Set event messages in dol_events session object. Will be output by calling dol_htmloutput_events.
Set event messages in dol_events session object. Will be output by calling dol_htmloutput_events.
Load event messages
Clear event messages
Return the value of token currently saved into session with name 'newToken'.
Get token url
Get token input for form
Try to find the third-party account id from
Try to find the member account id from
Details
static Context
getInstance()
Singleton method to create one instance of this object
void
initController(bool $init_theme = true)
Init controller
bool
addControllerDefinition(string $controller, string $path, string $className)
Add controller definition
void
setControllerFound()
Set controller found
static string
getRootConfigUrl()
Get WebPortal root url
string
getRootUrl(string $controller = '', string|array<string, mixed> $moreParams = '', bool $addToken = true)
deprecated
deprecated
Get root url
string
getControllerUrl(string $controller = '', string|array<string, mixed> $moreParams = '', bool $addToken = true)
Get controller url according to context
static string
getPublicControllerUrl(string $controller = '', string|array<string, mixed> $moreParams = '', array<string, mixed> $Tparams = array())
Generate public controller URL Used for external link (like email or web page) so remove token and contextual behavior associate with current user
static string
urlOrigin(bool $withRequestUri = true, bool $use_forwarded_host = false)
Url origin
bool
userIsLog()
Check if user is logged
bool
menuIsActive(string $menuName)
Is menu enabled ?
void
setError(string|string[] $errors)
Set errors
int
getErrors()
Get errors
void
clearErrors()
Clear errors
void
setEventMessage(string|string[] $mesgs, string $style = 'mesgs')
Set event messages in dol_events session object. Will be output by calling dol_htmloutput_events.
Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function.
void
setEventMessages(string $mesg, string[]|null $mesgs, string $style = 'mesgs')
Set event messages in dol_events session object. Will be output by calling dol_htmloutput_events.
Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function.
int
loadEventMessages()
Load event messages
void
clearEventMessages()
Clear event messages
string
newToken()
Return the value of token currently saved into session with name 'newToken'.
This token must be sent by any POST as it will be used by next page for comparison with value in session. This token depends on controller
protected string
generateNewToken()
deprecated
deprecated
Generate new token.
string|null
getUrlToken()
Get token url
string|null
getFormToken()
Get token input for form
int
getThirdPartyAccountFromLogin(string $login, string $pass)
Try to find the third-party account id from
int
getMemberAccountFromLogin(string $login, string $pass)
Try to find the member account id from