dolibarr 21.0.0-alpha
default.controller.class.php
Go to the documentation of this file.
1<?php
2/*
3 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
29{
35 public function checkAccess()
36 {
37 $this->accessRight = true;
38
39 return parent::checkAccess();
40 }
41
48 public function action()
49 {
50 global $langs;
52 if (!$context->controllerInstance->checkAccess()) {
53 return -1;
54 }
55
56 $hookRes = $this->hookDoAction();
57 if (empty($hookRes)) {
58 $context->title = $langs->trans('WebPortalHomeTitle');
59 $context->desc = $langs->trans('WebPortalHomeDesc');
60 //$context->doNotDisplayHeaderBar=1;// hide default header
61 }
62
63 return 1;
64 }
65
71 public function display()
72 {
74 if (!$context->controllerInstance->checkAccess()) {
75 $this->display404();
76 return;
77 }
78
79 $this->loadTemplate('header');
80 $this->loadTemplate('menu');
81 $this->loadTemplate('hero-header-banner');
82
83 $hookRes = $this->hookPrintPageView();
84
85 if (empty($hookRes)) {
86 $this->loadTemplate('home');
87 }
88
89 $this->loadTemplate('footer');
90 }
91}
static getInstance()
Singleton method to create one instance of this object.
Class to manage pages.
hookPrintPageView($parameters=array())
Execute hook PrintPageView.
display404()
Display error template.
hookDoAction($parameters=array())
Execute hook doActions.
loadTemplate($templateName, $vars=false)
Load a template .tpl file.
Class for DefaultController.
checkAccess()
Check current access to controller.
action()
Action method is called before html output can be used to manage security and change context.
$context
@method int call_trigger(string $triggerName, User $user)
Definition logout.php:42