dolibarr
22.0.5
Main Page
Related Pages
Topics
Classes
Files
File List
File Members
dolibarr_22.0
htdocs
webportal
controllers
membercard.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
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
6
*
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 3 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <https://www.gnu.org/licenses/>.
19
*/
20
27
require_once DOL_DOCUMENT_ROOT .
'/webportal/class/html.formcardwebportal.class.php'
;
28
32
class
MemberCardController
extends
Controller
33
{
37
protected
$formCard;
38
44
public
function
checkAccess
()
45
{
46
$context
=
Context::getInstance
();
47
$cardAccess =
getDolGlobalString
(
'WEBPORTAL_MEMBER_CARD_ACCESS'
);
48
$this->accessRight = isModEnabled(
'member'
) && in_array($cardAccess, array(
'visible'
,
'edit'
)) &&
$context
->logged_member &&
$context
->logged_member->id > 0;
49
50
return
parent::checkAccess();
51
}
52
59
public
function
action
()
60
{
61
global $langs;
62
63
$context
=
Context::getInstance
();
64
if
(!
$context
->controllerInstance->checkAccess()) {
65
return
-1;
66
}
67
68
// Load translation files required by the page
69
$langs->loadLangs(array(
'companies'
,
'bills'
,
'members'
,
'users'
,
'other'
,
'paypal'
));
70
71
$context
->title = $langs->trans(
'WebPortalMemberCardTitle'
);
72
$context
->desc = $langs->trans(
'WebPortalMemberCardDesc'
);
73
$context
->menu_active[] =
'member_card'
;
74
75
// set form card
76
$cardAccess =
getDolGlobalString
(
'WEBPORTAL_MEMBER_CARD_ACCESS'
);
77
$permissiontoread = (int) isModEnabled(
'member'
) && in_array($cardAccess, array(
'visible'
,
'edit'
));
78
$permissiontoadd = (int) isModEnabled(
'member'
) && in_array($cardAccess, array(
'edit'
));
79
$permissiontodelete = 0;
80
$permissionnote = 0;
81
$permissiondellink = 0;
82
$formCardWebPortal =
new
FormCardWebPortal
($this->db);
83
$formCardWebPortal->init(
'member'
,
$context
->logged_member->id, (
int
) $permissiontoread, (
int
) $permissiontoadd, $permissiontodelete, $permissionnote, $permissiondellink);
84
85
// hook for action
86
$hookRes = $this->
hookDoAction
();
87
if
(empty($hookRes)) {
88
$formCardWebPortal->doActions();
89
}
90
91
$this->formCard = $formCardWebPortal;
92
93
return
1;
94
}
95
101
public
function
display
()
102
{
103
$context
=
Context::getInstance
();
104
if
(!
$context
->controllerInstance->checkAccess()) {
105
$this->
display404
();
106
return
;
107
}
108
109
$this->
loadTemplate
(
'header'
);
110
$this->
loadTemplate
(
'menu'
);
111
$this->
loadTemplate
(
'hero-header-banner'
);
112
113
$hookRes = $this->
hookPrintPageView
();
114
if
(empty($hookRes)) {
115
print
'<main class="container">'
;
116
print $this->formCard->elementCard(
$context
);
117
print
'</main>'
;
118
}
119
120
$this->
loadTemplate
(
'footer'
);
121
}
122
}
Context\getInstance
static getInstance()
Singleton method to create one instance of this object.
Definition
context.class.php:219
Controller
Class to manage pages.
Definition
controller.class.php:30
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:35
MemberCardController
Class for MemberCardController.
Definition
membercard.controller.class.php:33
MemberCardController\display
display()
Display.
Definition
membercard.controller.class.php:101
MemberCardController\action
action()
Action method is called before html output can be used to manage security and change context.
Definition
membercard.controller.class.php:59
MemberCardController\checkAccess
checkAccess()
Check current access to controller.
Definition
membercard.controller.class.php:44
getDolGlobalString
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
Definition
functions.lib.php:229
$context
$context
@method int call_trigger(string $triggerName, User $user)
Definition
logout.php:42
Generated on Sun Jun 7 2026 01:00:27 for
dolibarr
by Doxygen 1.11.0