dolibarr/htdocs/webportal/controllers/default.controller.class.php

70 lines
1.3 KiB
PHP
Raw Normal View History

2023-09-12 15:12:30 +02:00
<?php
2023-09-12 16:05:24 +02:00
/**
* Class for DefaultController
*/
2023-09-12 15:12:30 +02:00
class DefaultController extends Controller
{
/**
* Check current access to controller
*
* @return bool
*/
2023-09-12 15:26:12 +02:00
public function checkAccess()
{
$this->accessRight = true;
2023-09-12 15:12:30 +02:00
2023-09-12 15:26:12 +02:00
return parent::checkAccess();
}
2023-09-12 15:12:30 +02:00
/**
* Action method is called before html output
* can be used to manage security and change context
*
2024-02-08 14:11:54 +01:00
* @return int Return integer < 0 on error, > 0 on success
2023-09-12 15:12:30 +02:00
*/
2023-09-12 15:26:12 +02:00
public function action()
{
global $langs;
$context = Context::getInstance();
if (!$context->controllerInstance->checkAccess()) {
2024-02-08 14:11:54 +01:00
return -1;
2023-09-12 15:26:12 +02:00
}
2023-09-12 15:12:30 +02:00
2023-09-12 15:26:12 +02:00
$hookRes = $this->hookDoAction();
if (empty($hookRes)) {
$context->title = $langs->trans('WebPortalHomeTitle');
$context->desc = $langs->trans('WebPortalHomeDesc');
//$context->doNotDisplayHeaderBar=1;// hide default header
}
2024-02-08 14:11:54 +01:00
return 1;
2023-09-12 15:26:12 +02:00
}
2023-09-12 15:12:30 +02:00
2023-09-12 15:26:12 +02:00
/**
* Display
*
2023-09-12 17:08:19 +02:00
* @return void
2023-09-12 15:26:12 +02:00
*/
public function display()
{
$context = Context::getInstance();
if (!$context->controllerInstance->checkAccess()) {
$this->display404();
return;
}
2023-09-12 15:12:30 +02:00
2023-09-12 15:26:12 +02:00
$this->loadTemplate('header');
$this->loadTemplate('menu');
2023-09-28 10:44:22 +02:00
$this->loadTemplate('hero-header-banner');
2023-09-12 15:12:30 +02:00
2023-09-12 15:26:12 +02:00
$hookRes = $this->hookPrintPageView();
2023-09-12 15:12:30 +02:00
2023-09-12 15:26:12 +02:00
if (empty($hookRes)) {
$this->loadTemplate('home');
}
2023-09-12 15:12:30 +02:00
2023-09-12 15:26:12 +02:00
$this->loadTemplate('footer');
}
2023-09-12 15:12:30 +02:00
}