dolibarr 21.0.0-beta
propallist.controller.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2023-2024 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2023-2024 Lionel Vessiller <lvessiller@easya.solutions>
4 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26require_once DOL_DOCUMENT_ROOT . '/webportal/class/html.formlistwebportal.class.php';
27
32{
36 protected $formList;
37
38
44 public function checkAccess()
45 {
46 $this->accessRight = isModEnabled('propal') && getDolGlobalInt('WEBPORTAL_PROPAL_LIST_ACCESS');
47
48 return parent::checkAccess();
49 }
50
57 public function action()
58 {
59 global $langs;
60
62 if (!$context->controllerInstance->checkAccess()) {
63 return -1;
64 }
65
66 // Load translation files required by the page
67 $langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'products', 'deliveries', 'categories'));
68 if (isModEnabled('shipping')) {
69 $langs->loadLangs(array('sendings'));
70 }
71
72 $context->title = $langs->trans('WebPortalPropalListTitle');
73 $context->desc = $langs->trans('WebPortalPropalListDesc');
74 $context->menu_active[] = 'propal_list';
75
76 // set form list
77 $formListWebPortal = new FormListWebPortal($this->db);
78 $formListWebPortal->init('propal');
79
80 // hook for action
81 $hookRes = $this->hookDoAction();
82 if (empty($hookRes)) {
83 $formListWebPortal->doActions();
84 }
85
86 $this->formList = $formListWebPortal;
87
88 return 1;
89 }
90
96 public function display()
97 {
99 if (!$context->controllerInstance->checkAccess()) {
100 $this->display404();
101 return;
102 }
103
104 $this->loadTemplate('header');
105 $this->loadTemplate('menu');
106 $this->loadTemplate('hero-header-banner');
107
108 $hookRes = $this->hookPrintPageView();
109 if (empty($hookRes)) {
110 print '<main class="container">';
111 //print '<figure>';
112 print $this->formList->elementList($context);
113 //print '</figure>';
114 print '</main>';
115 }
116
117 $this->loadTemplate('footer');
118 }
119}
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 to manage generation of HTML components Only common components for WebPortal must be here.
Class for PropalListController.
checkAccess()
Check current access to controller.
action()
Action method is called before html output can be used to manage security and change context.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
$context
@method int call_trigger(string $triggerName, User $user)
Definition logout.php:42