Default implementation of Hubleto controller.
'Controller' is fundamendal class for generating HTML content of each call. Controllers can be rendered using Twig template or using custom render() method.
\Hubleto\Framework\Controller
| Parent class | \Hubleto\Framework\Core |
| Implements | \Hubleto\Framework\Interfaces\ControllerInterface |
Constants
| Constant | Visibility | Type | Value |
|---|---|---|---|
RETURN_TYPE_VIEW |
public | 0 | |
RETURN_TYPE_JSON |
public | 1 | |
RETURN_TYPE_STRING |
public | 2 | |
RETURN_TYPE_NONE |
public | 3 |
Properties
gtp
Shorthand for "global table prefix"
protected string $gtp
params
DEPRECATED Array of parameters (arguments) passed to the controller
public array $params
permissionsByUserRole
TRUE/FALSE array with permissions for the user role
public static array $permissionsByUserRole
- This property is static.
requiresAuthenticatedUser
If set to FALSE, the rendered content of controller is available to public
public bool $requiresAuthenticatedUser
permittedForAllUsers
If set to TRUE, the controller's permissions is not checked.
public bool $permittedForAllUsers
hideDefaultDesktop
If set to TRUE, the default desktop will not be added to the rendered content
public bool $hideDefaultDesktop
cliSAPIEnabled
If set to FALSE, the controller will not be rendered in CLI
public static bool $cliSAPIEnabled
- This property is static.
webSAPIEnabled
If set to FALSE, the controller will not be rendered in WEB
public static bool $webSAPIEnabled
- This property is static.
dictionary
public array $dictionary
viewParams
protected array $viewParams
name
public string $name
shortName
public string $shortName
fullName
public string $fullName
permission
public string $permission
view
public string $view
returnType
public int $returnType
Methods
__construct
public __construct(): mixed
validateInputs
Validates inputs used for the TWIG template.
public validateInputs(): bool
return bool True if inputs are valid, otherwise false.
preInit
1st phase of controller's initialization phase.
public preInit(): void
Throws:
Should throw an exception on error.
init
2nd phase of controller's initialization phase.
public init(): void
Throws:
Should throw an exception on error.
postInit
3rd phase of controller's initialization phase.
public postInit(): void
Throws:
Should throw an exception on error.
run
public run(): mixed
renderString
public renderString(): string
renderJson
If the controller shall only return JSON, this method must be overriden.
public renderJson(): array
Return Value:
Array to be returned as a JSON.
prepareViewParams
If the controller shall return the HTML of the view, this method must be overriden.
public prepareViewParams(): array
Return Value:
View to be used to render the HTML.
prepareView
[Description for prepareView]
public prepareView(): void
setView
[Description for setView]
public setView(string $view): void
Parameters:
| Parameter | Type | Description |
|---|---|---|
$view |
string |
getView
[Description for getView]
public getView(): string
getViewParams
[Description for getViewParams]
public getViewParams(): array
render
[Description for render]
public render(): string
Inherited methods
__construct
public __construct(): mixed
getServiceStatic
Shortcut for the dependency injection.
public static getServiceStatic(string $service): mixed
- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$service |
string |
getService
[Description for getService]
public getService(string $service): mixed
Parameters:
| Parameter | Type | Description |
|---|---|---|
$service |
string |
env
Shortcut for the env service.
public env(): \Hubleto\Framework\Env
authProvider
Shortcut for the authentication service.
public authProvider(): \Hubleto\Framework\Interfaces\AuthInterface
db
Shortcut for the database service.
public db(): \Hubleto\Framework\Db
appManager
Shortcut for the app manager service.
public appManager(): \Hubleto\Framework\Interfaces\AppManagerInterface
router
Shortcut for the router service.
public router(): \Hubleto\Framework\Router
hookManager
Shortcut for the hook manager service.
public hookManager(): \Hubleto\Framework\HookManager
sessionManager
Shortcut for the session manager service.
public sessionManager(): \Hubleto\Framework\SessionManager
permissionsManager
Shortcut for the permissions manager service.
public permissionsManager(): \Hubleto\Framework\PermissionsManager
cronManager
Shortcut for the cron manager service.
public cronManager(): \Hubleto\Framework\CronManager
emailProvider
Shortcut for the email provider service.
public emailProvider(): \Hubleto\Framework\EmailProvider
config
Shortcut for the config service.
public config(): \Hubleto\Framework\Interfaces\ConfigManagerInterface
logger
Shortcut for the logger service.
public logger(): \Hubleto\Framework\Logger
locale
Shortcut for the locale service.
public locale(): \Hubleto\Framework\Locale
renderer
Shortcut for the renderer service.
public renderer(): \Hubleto\Framework\Renderer
translator
Shortcut for the translator service.
public translator(): \Hubleto\Framework\Interfaces\TranslatorInterface
getModel
[Description for getModel]
public getModel(string $model): \Hubleto\Framework\Models\Model
Parameters:
| Parameter | Type | Description |
|---|---|---|
$model |
string |
getController
[Description for getController]
public getController(string $controller): \Hubleto\Framework\Controller
Parameters:
| Parameter | Type | Description |
|---|---|---|
$controller |
string |
translate
Shorthand for core translate() function. Uses own language dictionary.
public translate(string $string, array $vars = []): string
Parameters:
| Parameter | Type | Description |
|---|---|---|
$string |
string | String to be translated |
$vars |
array |
Return Value:
Translated string.
