dolibarr
21.0.0-alpha
Main Page
Related Pages
Topics
Classes
Files
File List
File Members
dolibarr_dev
htdocs
webportal
controllers
partnershipcard.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
26
require_once DOL_DOCUMENT_ROOT .
'/webportal/class/html.formcardwebportal.class.php'
;
27
31
class
PartnershipCardController
extends
Controller
32
{
36
protected
$formCard;
37
38
44
public
function
checkAccess
()
45
{
46
$context =
Context::getInstance
();
47
$cardAccess =
getDolGlobalString
(
'WEBPORTAL_PARTNERSHIP_CARD_ACCESS'
);
48
$this->accessRight = isModEnabled(
'partnership'
) && in_array($cardAccess, array(
'visible'
,
'edit'
)) && $context->logged_partnership && $context->logged_partnership->id > 0;
49
return
parent::checkAccess();
50
}
51
58
public
function
action
()
59
{
60
global $langs;
61
62
$context =
Context::getInstance
();
63
if
(!$context->controllerInstance->checkAccess()) {
64
return
-1;
65
}
66
67
// Load translation files required by the page
68
$langs->loadLangs(array(
'partnership'
));
69
70
$context->title = $langs->trans(
'WebPortalPartnershipCardTitle'
);
71
$context->desc = $langs->trans(
'WebPortalPartnershipCardDesc'
);
72
$context->menu_active[] =
'partnership_card'
;
73
74
// set form card
75
$cardAccess =
getDolGlobalString
(
'WEBPORTAL_PARTNERSHIP_CARD_ACCESS'
);
76
$permissiontoread = (int) isModEnabled(
'partnership'
) && in_array($cardAccess, array(
'visible'
,
'edit'
));
77
$permissiontoadd = (int) isModEnabled(
'partnership'
) && in_array($cardAccess, array(
'edit'
));
78
$permissiontodelete = 0;
79
$permissionnote = 0;
80
$permissiondellink = 0;
81
$formCardWebPortal =
new
FormCardWebPortal
($this->db);
82
$formCardWebPortal->init(
'partnership'
, $context->logged_partnership->id, $permissiontoread, $permissiontoadd, $permissiontodelete, $permissionnote, $permissiondellink);
83
84
// hook for action
85
$hookRes = $this->
hookDoAction
();
86
if
(empty($hookRes)) {
87
$formCardWebPortal->doActions();
88
}
89
90
$this->formCard = $formCardWebPortal;
91
92
return
1;
93
}
94
100
public
function
display
()
101
{
102
$context =
Context::getInstance
();
103
if
(!$context->controllerInstance->checkAccess()) {
104
$this->
display404
();
105
return
;
106
}
107
108
$this->
loadTemplate
(
'header'
);
109
$this->
loadTemplate
(
'menu'
);
110
$this->
loadTemplate
(
'hero-header-banner'
);
111
112
$hookRes = $this->
hookPrintPageView
();
113
if
(empty($hookRes)) {
114
print
'<main class="container">'
;
115
print $this->formCard->elementCard($context);
116
print
'</main>'
;
117
}
118
119
$this->
loadTemplate
(
'footer'
);
120
}
121
}
Context\getInstance
static getInstance()
Singleton method to create one instance of this object.
Definition
context.class.php:197
Controller
Class to manage pages.
Definition
controller.class.php:29
Controller\hookPrintPageView
hookPrintPageView($parameters=array())
Execute hook PrintPageView.
Definition
controller.class.php:171
Controller\display404
display404()
Display error template.
Definition
controller.class.php:135
Controller\hookDoAction
hookDoAction($parameters=array())
Execute hook doActions.
Definition
controller.class.php:148
Controller\loadTemplate
loadTemplate($templateName, $vars=false)
Load a template .tpl file.
Definition
controller.class.php:195
FormCardWebPortal
Class to manage generation of HTML components Only common components for WebPortal must be here.
Definition
html.formcardwebportal.class.php:36
PartnershipCardController
Class for PartnershipCardController.
Definition
partnershipcard.controller.class.php:32
PartnershipCardController\action
action()
Action method is called before html output can be used to manage security and change context.
Definition
partnershipcard.controller.class.php:58
PartnershipCardController\display
display()
Display.
Definition
partnershipcard.controller.class.php:100
PartnershipCardController\checkAccess
checkAccess()
Check current access to controller.
Definition
partnershipcard.controller.class.php:44
getDolGlobalString
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
Definition
functions.lib.php:215
Generated on Sun Sep 1 2024 01:00:34 for
dolibarr
by Doxygen 1.11.0