dolibarr
21.0.0-alpha
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
*
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
MemberCardController
extends
Controller
32
{
36
protected
$formCard;
37
43
public
function
checkAccess
()
44
{
45
$context
=
Context::getInstance
();
46
$cardAccess =
getDolGlobalString
(
'WEBPORTAL_MEMBER_CARD_ACCESS'
);
47
$this->accessRight = isModEnabled(
'member'
) && in_array($cardAccess, array(
'visible'
,
'edit'
)) &&
$context
->logged_member &&
$context
->logged_member->id > 0;
48
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(
'companies'
,
'bills'
,
'members'
,
'users'
,
'other'
,
'paypal'
));
69
70
$context
->title = $langs->trans(
'WebPortalMemberCardTitle'
);
71
$context
->desc = $langs->trans(
'WebPortalMemberCardDesc'
);
72
$context
->menu_active[] =
'member_card'
;
73
74
// set form card
75
$cardAccess =
getDolGlobalString
(
'WEBPORTAL_MEMBER_CARD_ACCESS'
);
76
$permissiontoread = (int) isModEnabled(
'member'
) && in_array($cardAccess, array(
'visible'
,
'edit'
));
77
$permissiontoadd = (int) isModEnabled(
'member'
) && in_array($cardAccess, array(
'edit'
));
78
$permissiontodelete = 0;
79
$permissionnote = 0;
80
$permissiondellink = 0;
81
$formCardWebPortal =
new
FormCardWebPortal
($this->db);
82
$formCardWebPortal->init(
'member'
,
$context
->logged_member->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:219
Controller
Class to manage pages.
Definition
controller.class.php:29
Controller\hookPrintPageView
hookPrintPageView($parameters=array())
Execute hook PrintPageView.
Definition
controller.class.php:170
Controller\display404
display404()
Display error template.
Definition
controller.class.php:134
Controller\hookDoAction
hookDoAction($parameters=array())
Execute hook doActions.
Definition
controller.class.php:147
Controller\loadTemplate
loadTemplate($templateName, $vars=false)
Load a template .tpl file.
Definition
controller.class.php:194
FormCardWebPortal
Class to manage generation of HTML components Only common components for WebPortal must be here.
Definition
html.formcardwebportal.class.php:36
MemberCardController
Class for MemberCardController.
Definition
membercard.controller.class.php:32
MemberCardController\display
display()
Display.
Definition
membercard.controller.class.php:100
MemberCardController\action
action()
Action method is called before html output can be used to manage security and change context.
Definition
membercard.controller.class.php:58
MemberCardController\checkAccess
checkAccess()
Check current access to controller.
Definition
membercard.controller.class.php:43
getDolGlobalString
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
Definition
functions.lib.php:217
$context
$context
@method int call_trigger(string $triggerName, User $user)
Definition
logout.php:42
Generated on Fri Nov 1 2024 01:00:34 for
dolibarr
by Doxygen 1.11.0