dolibarr 24.0.0-beta
eventorganization_public.php
Go to the documentation of this file.
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-2026 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';
37// Libraries
38require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
39require_once DOL_DOCUMENT_ROOT.'/core/lib/eventorganization.lib.php';
40require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
41
42// Translations
43$langs->loadLangs(array("admin", "eventorganization", "categories"));
44
45// Parameters
46$action = GETPOST('action', 'aZ09');
47$cancel = GETPOST('cancel', 'alpha');
48$backtopage = GETPOST('backtopage', 'alpha');
49
50$value = GETPOST('value', 'alpha');
51$label = GETPOST('label', 'alpha');
52$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
53
54$scandir = GETPOST('scan_dir', 'alpha');
55$type = 'myobject';
56
57$arrayofparameters = array(
58 'EVENTORGANIZATION_SECUREKEY' => array('type' => 'securekey', 'enabled' => 1, 'css' => ''),
59);
60
61$error = 0;
62$setupnotempty = 0;
63
64$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
65
66// Access control
67if (empty($user->admin)) {
69}
70
71if (empty($action)) {
72 $action = 'edit';
73}
74
75
76/*
77 * Actions
78 */
79
80if ($cancel) {
81 $action = 'edit';
82}
83
84include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
85
86
87/*
88 * View
89 */
90
91$form = new Form($db);
92
93$page_name = "EventOrganizationSetup";
94
95llxHeader('', $langs->trans($page_name), '', '', 0, 0, '', '', '', 'mod-admin page-eventorganization');
96
97// Subheader
98$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>';
99
100print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
101
102// Configuration header
104print dol_get_fiche_head($head, 'public', $langs->trans($page_name), -1, 'eventorganization');
105
106// Setup page goes here
107// print '<span class="opacitymedium">'.$langs->trans("EventOrganizationSetupPage").'</span><br>';
108print '<br>';
109
110if ($action == 'edit') {
111 print '<form method="POST" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
112 print '<input type="hidden" name="token" value="'.newToken().'">';
113 print '<input type="hidden" name="action" value="update">';
114
115 print '<table class="noborder centpercent">';
116 print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td></td></tr>';
117
118 foreach ($arrayofparameters as $constname => $val) {
119 // @phpstan-ignore-next-line
120 if ($val['enabled'] == 1) {
121 $setupnotempty++;
122 print '<tr class="oddeven"><td><!-- '.$constname.' -->';
123 $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
124 $tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '<br><br>'."\n".$langs->trans($constname . 'Tooltip2') : '');
125 print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>';
126 print '</td><td>';
127
128 /*if ($val['type'] == 'textarea') {
129 print '<textarea class="flat" name="'.$constname.'" id="'.$constname.'" cols="50" rows="5" wrap="soft">' . "\n";
130 print getDolGlobalString($constname);
131 print "</textarea>\n";
132 } elseif ($val['type'] == 'html') {
133 require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
134 $doleditor = new DolEditor($constname, getDolGlobalString($constname), '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%');
135 $doleditor->Create();
136 } elseif ($val['type'] == 'yesno') {
137 print $form->selectyesno($constname, getDolGlobalString($constname), 1);
138 } elseif (preg_match('/emailtemplate:/', $val['type'])) {
139 include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
140 $formmail = new FormMail($db);
141
142 $tmp = explode(':', $val['type']);
143 $nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, 1); // We set lang=null to get in priority record with no lang
144 //$arraydefaultmessage = $formmail->getEMailTemplate($db, $tmp[1], $user, null, 0, 1, '');
145 $arrayofmessagename = array();
146 if (is_array($formmail->lines_model)) {
147 foreach ($formmail->lines_model as $modelmail) {
148 //var_dump($modelmail);
149 $moreonlabel = '';
150 if (!empty($arrayofmessagename[$modelmail->label])) {
151 $moreonlabel = ' <span class="opacitymedium">(' . $langs->trans("SeveralLangugeVariatFound") . ')</span>';
152 }
153 // The 'label' is the key that is unique if we exclude the language
154 $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\‍(|\‍)/', '', $modelmail->label)) . $moreonlabel;
155 }
156 }
157 print $form->selectarray($constname, $arrayofmessagename, getDolGlobalString($constname), 'None', 0, 0, '', 0, 0, 0, '', '', 1);
158 } elseif (preg_match('/category:/', $val['type'])) {
159 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
160 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
161 $formother = new FormOther($db);
162
163 $tmp = explode(':', $val['type']);
164 print img_picto('', 'category', 'class="pictofixedwidth"');
165 print $formother->select_categories($tmp[1], getDolGlobalInt($constname), $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
166 } elseif (preg_match('/thirdparty_type/', $val['type'])) {
167 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
168 $formcompany = new FormCompany($db);
169 print $formcompany->selectProspectCustomerType(getDolGlobalString($constname), $constname, 'customerorprospect', 'form', '', '1');
170 } elseif ($val['type'] == 'securekey') { */
171 print '<input type="text" class="flat width500" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ? GETPOST($constname, 'alpha') : getDolGlobalString($constname)).'" spellcheck="false">';
172 if (!empty($conf->use_javascript_ajax)) {
173 print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token'.$constname.'" class="linkobject"');
174 }
175
176 // Add button to autosuggest a key
177 include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
178 print dolJSToSetRandomPassword($constname, 'generate_token'.$constname);
179 /* } elseif ($val['type'] == 'product') {
180 if (isModEnabled("product") || isModEnabled("service")) {
181 $selected = getDolGlobalInt($constname);
182 print img_picto('', 'product', 'class="pictofixedwidth"');
183 print $form->select_produits($selected, $constname, '', 0, 0, 1, 2, '', 0, array(), 0, '1', 0, 'maxwidth500 widthcentpercentminusx', 0, '', null, 1);
184 }
185 } else {
186 print '<input name="' . $constname . '" class="flat ' . (empty($val['css']) ? 'minwidth200' : $val['css']) . '" value="' . getDolGlobalString($constname) . '">';
187 }*/
188 print '</td></tr>';
189 }
190 }
191 print '</table>';
192
193 print $form->buttonsSaveCancel('Save', '');
194
195 print '</form>';
196 print '<br>';
197} else {
198 print '<table class="noborder centpercent">';
199 print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td></td></tr>';
200
201 foreach ($arrayofparameters as $constname => $val) {
202 $setupnotempty++;
203 print '<tr class="oddeven">';
204 print '<td><!-- '.$constname.' -->';
205 $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
206 $tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '<br><br>'."\n".$langs->trans($constname . 'Tooltip2') : '');
207 print $form->textwithpicto($langs->trans($constname), $tooltiphelp);
208 print '</td><td>';
209 print getDolGlobalString($constname);
210 print '</td>';
211
212 print '</tr>';
213 }
214
215 print '</table>';
216
217 print '<div class="tabsAction">';
218 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
219 print '</div>';
220}
221
222
223// Page end
224print dol_get_fiche_end();
225
226
227//if (getDolGlobalString('EVENTORGANIZATION_ENABLE_PUBLIC')) {
228 print '<br>';
229 //print $langs->trans('FollowingLinksArePublic').'<br>';
230 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
231if (isModEnabled('multicompany')) {
232 $entity_qr = '?entity='.$conf->entity;
233} else {
234 $entity_qr = '';
235}
236
237 // Define $urlwithroot
238 $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
239 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
240 //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
241
242 print '<div class="urllink">';
243 print $langs->trans("TheLinkIsAvailableOnTheProjectEventCard");
244 //print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/project/index.php'.$entity_qr.'">';
245 //print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/project/index.php'.$entity_qr.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
246 print '</div>';
247 print ajax_autoselect('publicurlmember');
248//}
249
250
251llxFooter();
252$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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
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.
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.