dolibarr
24.0.0-beta
Main Page
Related Pages
Topics
Classes
Files
File List
File Members
dolibarr_dev
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
require_once DOL_DOCUMENT_ROOT .
'/webportal/controllers/abstractcard.controller.class.php'
;
29
33
class
MemberCardController
extends
AbstractCardController
34
{
40
public
function
checkAccess
()
41
{
42
$context
=
Context::getInstance
();
43
$cardAccess =
getDolGlobalString
(
'WEBPORTAL_MEMBER_CARD_ACCESS'
);
44
$this->accessRight =
isModEnabled
(
'member'
) && in_array($cardAccess, array(
'visible'
,
'edit'
)) &&
$context
->logged_member &&
$context
->logged_member->id > 0;
45
46
return
parent::checkAccess();
47
}
48
55
public
function
action
()
56
{
57
global $langs;
58
59
$context
=
Context::getInstance
();
60
if
(!
$context
->controllerInstance->checkAccess()) {
61
return
-1;
62
}
63
64
// Load translation files required by the page
65
$langs->loadLangs(array(
'companies'
,
'bills'
,
'members'
,
'users'
,
'other'
,
'paypal'
));
66
67
$context
->title = $langs->trans(
'WebPortalMemberCardTitle'
);
68
$context
->desc = $langs->trans(
'WebPortalMemberCardDesc'
);
69
$context
->menu_active[] =
'member_card'
;
70
71
// set form card
72
$cardAccess =
getDolGlobalString
(
'WEBPORTAL_MEMBER_CARD_ACCESS'
);
73
$permissiontoread = (int)
isModEnabled
(
'member'
) && in_array($cardAccess, array(
'visible'
,
'edit'
));
74
$permissiontoadd = (int)
isModEnabled
(
'member'
) && in_array($cardAccess, array(
'edit'
));
75
$permissiontodelete = 0;
76
$permissionnote = 0;
77
$permissiondellink = 0;
78
$formCardWebPortal =
new
FormCardWebPortal
($this->db);
79
$formCardWebPortal->init(
'member'
,
$context
->logged_member->id, (
int
) $permissiontoread, (
int
) $permissiontoadd, $permissiontodelete, $permissionnote, $permissiondellink);
80
81
// hook for action
82
$hookRes = $this->
hookDoAction
();
83
if
(empty($hookRes)) {
84
$formCardWebPortal->doActions();
85
}
86
87
$this->formCard = $formCardWebPortal;
88
89
return
1;
90
}
91
}
AbstractCardController
Class for AbstractCardController.
Definition
abstractcard.controller.class.php:31
Context\getInstance
static getInstance()
Singleton method to create one instance of this object.
Definition
context.class.php:228
Controller\hookDoAction
hookDoAction($parameters=array())
Execute hook doActions.
Definition
controller.class.php:162
FormCardWebPortal
Class to manage generation of HTML components Only common components for WebPortal must be here.
Definition
html.formcardwebportal.class.php:37
MemberCardController
Class for MemberCardController.
Definition
membercard.controller.class.php:34
MemberCardController\action
action()
Action method is called before html output can be used to manage security and change context.
Definition
membercard.controller.class.php:55
MemberCardController\checkAccess
checkAccess()
Check current access to controller.
Definition
membercard.controller.class.php:40
getDolGlobalString
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
Definition
functions.lib.php:286
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition
functions.lib.php:489
$context
$context
@method int call_trigger(string $triggerName, ?User $user)
Definition
logout.php:42
Generated on Mon Jun 22 2026 21:04:50 for
dolibarr
by Doxygen 1.11.0