dolibarr 21.0.0-alpha
invoicelist.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 *
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{
33 protected $formList;
34
35
41 public function checkAccess()
42 {
43 $this->accessRight = isModEnabled('invoice') && getDolGlobalInt('WEBPORTAL_INVOICE_LIST_ACCESS');
44
45 return parent::checkAccess();
46 }
47
54 public function action()
55 {
56 global $langs;
57
59 if (!$context->controllerInstance->checkAccess()) {
60 return -1;
61 }
62
63 dol_include_once('/webportal/class/html.formlistwebportal.class.php');
64
65 // Load translation files required by the page
66 $langs->loadLangs(array('bills', 'companies', 'products', 'categories'));
67
68 $context->title = $langs->trans('WebPortalInvoiceListTitle');
69 $context->desc = $langs->trans('WebPortalInvoiceListDesc');
70 $context->menu_active[] = 'invoice_list';
71
72 // set form list
73 $formListWebPortal = new FormListWebPortal($this->db);
74 $formListWebPortal->init('invoice');
75
76 // hook for action
77 $hookRes = $this->hookDoAction();
78 if (empty($hookRes)) {
79 $formListWebPortal->doActions();
80 }
81
82 $this->formList = $formListWebPortal;
83
84 return 1;
85 }
86
92 public function display()
93 {
95 if (!$context->controllerInstance->checkAccess()) {
96 $this->display404();
97 return;
98 }
99
100 $this->loadTemplate('header');
101 $this->loadTemplate('menu');
102 $this->loadTemplate('hero-header-banner');
103
104 $hookRes = $this->hookPrintPageView();
105 if (empty($hookRes)) {
106 print '<main class="container">';
107 //print '<figure>';
108 print $this->formList->elementList($context);
109 //print '</figure>';
110 print '</main>';
111 }
112
113 $this->loadTemplate('footer');
114 }
115}
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 InvoiceListController.
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.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
$context
@method int call_trigger(string $triggerName, User $user)
Definition logout.php:42