dolibarr 23.0.3
eventorganization_public.php
1<?php
2/* Copyright (C) 2021 Florian Henry <florian.henry@scopen.fr>
3 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
4 * Copyright (C) 2024-2025 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// Load Dolibarr environment
27require '../main.inc.php';
28
29// Libraries
30require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
31require_once DOL_DOCUMENT_ROOT.'/core/lib/eventorganization.lib.php';
32require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
33
44// Translations
45$langs->loadLangs(array("admin", "eventorganization", "categories"));
46
47// Parameters
48$action = GETPOST('action', 'aZ09');
49$cancel = GETPOST('cancel', 'alpha');
50$backtopage = GETPOST('backtopage', 'alpha');
51
52$value = GETPOST('value', 'alpha');
53$label = GETPOST('label', 'alpha');
54$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
55
56$scandir = GETPOST('scan_dir', 'alpha');
57$type = 'myobject';
58
59$arrayofparameters = array(
60 'EVENTORGANIZATION_SECUREKEY' => array('type' => 'securekey', 'enabled' => 1, 'css' => ''),
61);
62
63$error = 0;
64$setupnotempty = 0;
65
66$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
67
68// Access control
69if (empty($user->admin)) {
71}
72
73if (empty($action)) {
74 $action = 'edit';
75}
76
77
78/*
79 * Actions
80 */
81
82if ($cancel) {
83 $action = '';
84}
85
86include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
87
88
89
90/*
91 * View
92 */
93
94$form = new Form($db);
95
96$page_name = "EventOrganizationSetup";
97
98llxHeader('', $langs->trans($page_name), '', '', 0, 0, '', '', '', 'mod-admin page-eventorganization');
99
100// Subheader
101$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').'<span class="hideonsmartphone">'.$langs->trans("BackToModuleList").'</span></a>';
102
103print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
104
105// Configuration header
107print dol_get_fiche_head($head, 'public', $langs->trans($page_name), -1, 'eventorganization');
108
109// Setup page goes here
110// print '<span class="opacitymedium">'.$langs->trans("EventOrganizationSetupPage").'</span><br>';
111print '<br>';
112
113if ($action == 'edit') {
114 print '<form method="POST" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
115 print '<input type="hidden" name="token" value="'.newToken().'">';
116 print '<input type="hidden" name="action" value="update">';
117
118 print '<table class="noborder centpercent">';
119 print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td></td></tr>';
120
121 foreach ($arrayofparameters as $constname => $val) {
122 // @phpstan-ignore-next-line
123 if ($val['enabled'] == 1) {
124 $setupnotempty++;
125 print '<tr class="oddeven"><td><!-- '.$constname.' -->';
126 $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
127 $tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '<br><br>'."\n".$langs->trans($constname . 'Tooltip2') : '');
128 print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>';
129 print '</td><td>';
130
131 /*if ($val['type'] == 'textarea') {
132 print '<textarea class="flat" name="'.$constname.'" id="'.$constname.'" cols="50" rows="5" wrap="soft">' . "\n";
133 print getDolGlobalString($constname);
134 print "</textarea>\n";
135 } elseif ($val['type'] == 'html') {
136 require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
137 $doleditor = new DolEditor($constname, getDolGlobalString($constname), '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%');
138 $doleditor->Create();
139 } elseif ($val['type'] == 'yesno') {
140 print $form->selectyesno($constname, getDolGlobalString($constname), 1);
141 } elseif (preg_match('/emailtemplate:/', $val['type'])) {
142 include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
143 $formmail = new FormMail($db);
144
145 $tmp = explode(':', $val['type']);
146 $nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, 1); // We set lang=null to get in priority record with no lang
147 //$arraydefaultmessage = $formmail->getEMailTemplate($db, $tmp[1], $user, null, 0, 1, '');
148 $arrayofmessagename = array();
149 if (is_array($formmail->lines_model)) {
150 foreach ($formmail->lines_model as $modelmail) {
151 //var_dump($modelmail);
152 $moreonlabel = '';
153 if (!empty($arrayofmessagename[$modelmail->label])) {
154 $moreonlabel = ' <span class="opacitymedium">(' . $langs->trans("SeveralLangugeVariatFound") . ')</span>';
155 }
156 // The 'label' is the key that is unique if we exclude the language
157 $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\‍(|\‍)/', '', $modelmail->label)) . $moreonlabel;
158 }
159 }
160 print $form->selectarray($constname, $arrayofmessagename, getDolGlobalString($constname), 'None', 0, 0, '', 0, 0, 0, '', '', 1);
161 } elseif (preg_match('/category:/', $val['type'])) {
162 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
163 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
164 $formother = new FormOther($db);
165
166 $tmp = explode(':', $val['type']);
167 print img_picto('', 'category', 'class="pictofixedwidth"');
168 print $formother->select_categories($tmp[1], getDolGlobalInt($constname), $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
169 } elseif (preg_match('/thirdparty_type/', $val['type'])) {
170 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
171 $formcompany = new FormCompany($db);
172 print $formcompany->selectProspectCustomerType(getDolGlobalString($constname), $constname, 'customerorprospect', 'form', '', '1');
173 } elseif ($val['type'] == 'securekey') { */
174 print '<input type="text" class="flat" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ? GETPOST($constname, 'alpha') : getDolGlobalString($constname)).'" size="40">';
175 if (!empty($conf->use_javascript_ajax)) {
176 print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token'.$constname.'" class="linkobject"');
177 }
178
179 // Add button to autosuggest a key
180 include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
181 print dolJSToSetRandomPassword($constname, 'generate_token'.$constname);
182 /* } elseif ($val['type'] == 'product') {
183 if (isModEnabled("product") || isModEnabled("service")) {
184 $selected = getDolGlobalInt($constname);
185 print img_picto('', 'product', 'class="pictofixedwidth"');
186 print $form->select_produits($selected, $constname, '', 0, 0, 1, 2, '', 0, array(), 0, '1', 0, 'maxwidth500 widthcentpercentminusx', 0, '', null, 1);
187 }
188 } else {
189 print '<input name="' . $constname . '" class="flat ' . (empty($val['css']) ? 'minwidth200' : $val['css']) . '" value="' . getDolGlobalString($constname) . '">';
190 }*/
191 print '</td></tr>';
192 }
193 }
194 print '</table>';
195
196 print $form->buttonsSaveCancel('Save', '');
197
198 print '</form>';
199 print '<br>';
200} else {
201 print '<table class="noborder centpercent">';
202 print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td></td></tr>';
203
204 foreach ($arrayofparameters as $constname => $val) {
205 $setupnotempty++;
206 print '<tr class="oddeven">';
207 print '<td><!-- '.$constname.' -->';
208 $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
209 $tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '<br><br>'."\n".$langs->trans($constname . 'Tooltip2') : '');
210 print $form->textwithpicto($langs->trans($constname), $tooltiphelp);
211 print '</td><td>';
212 print getDolGlobalString($constname);
213 print '</td>';
214
215 print '</tr>';
216 }
217
218 print '</table>';
219
220 print '<div class="tabsAction">';
221 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
222 print '</div>';
223}
224
225
226// Page end
227print dol_get_fiche_end();
228
229
230//if (getDolGlobalString('EVENTORGANIZATION_ENABLE_PUBLIC')) {
231 print '<br>';
232 //print $langs->trans('FollowingLinksArePublic').'<br>';
233 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
234if (isModEnabled('multicompany')) {
235 $entity_qr = '?entity='.$conf->entity;
236} else {
237 $entity_qr = '';
238}
239
240 // Define $urlwithroot
241 $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
242 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
243 //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
244
245 print '<div class="urllink">';
246 print $langs->trans("TheLinkIsAvailableOnTheProjectEventCard");
247 //print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/project/index.php'.$entity_qr.'">';
248 //print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/project/index.php'.$entity_qr.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
249 print '</div>';
250 print ajax_autoselect('publicurlmember');
251//}
252
253
254llxFooter();
255$db->close();
global $dolibarr_main_url_root
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage generation of HTML components Only common components must be here.
eventorganizationAdminPrepareHead()
Prepare admin pages header.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dolJSToSetRandomPassword($htmlname, $htmlnameofbutton='generate_token', $generic=1)
Output javascript to autoset a generated password using default module into a HTML element.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.