dolibarr 20.0.0
orderlist.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('order') && getDolGlobalInt('WEBPORTAL_ORDER_LIST_ACCESS');
47
48 return parent::checkAccess();
49 }
50
57 public function action()
58 {
59 global $langs;
60
61 $context = Context::getInstance();
62 if (!$context->controllerInstance->checkAccess()) {
63 return -1;
64 }
65
66 // Load translation files required by the page
67 $langs->loadLangs(array('orders', 'sendings', 'deliveries', 'companies', 'compta', 'bills', 'stocks', 'products'));
68
69 $context->title = $langs->trans('WebPortalOrderListTitle');
70 $context->desc = $langs->trans('WebPortalOrderListDesc');
71 $context->menu_active[] = 'order_list';
72
73 // set form list
74 $formListWebPortal = new FormListWebPortal($this->db);
75 $formListWebPortal->init('order');
76
77 // hook for action
78 $hookRes = $this->hookDoAction();
79 if (empty($hookRes)) {
80 $formListWebPortal->doActions();
81 }
82
83 $this->formList = $formListWebPortal;
84
85 return 1;
86 }
87
93 public function display()
94 {
95 $context = Context::getInstance();
96 if (!$context->controllerInstance->checkAccess()) {
97 $this->display404();
98 return;
99 }
100
101 $this->loadTemplate('header');
102 $this->loadTemplate('menu');
103 $this->loadTemplate('hero-header-banner');
104
105 $hookRes = $this->hookPrintPageView();
106 if (empty($hookRes)) {
107 print '<main class="container">';
108 //print '<figure>';
109 print $this->formList->elementList($context);
110 //print '</figure>';
111 print '</main>';
112 }
113
114 $this->loadTemplate('footer');
115 }
116}
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 OrderListController.
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.