dolibarr 24.0.0-beta
results.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2013-2020 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
4 * Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
5 * Copyright (C) 2024-2026 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// Load Dolibarr environment
28require '../main.inc.php';
29require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
30require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
31require_once DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php";
32require_once DOL_DOCUMENT_ROOT."/opensurvey/lib/opensurvey.lib.php";
33
44// Security check
45if (!$user->hasRight('opensurvey', 'read')) {
47}
48
49// Init vars
50$action = GETPOST('action', 'aZ09');
51$numsondage = GETPOST("id", 'alphanohtml');
52
54$result = $object->fetch('', $numsondage);
55if ($result <= 0) {
56 dol_print_error(null, 'Failed to get survey id '.$numsondage);
57}
58
59$nblines = $object->fetch_lines();
60
61
62/*
63 * Actions
64 */
65$error = 0;
66
67// Return to the results
68if (GETPOST('cancel')) {
69 header('Location: results.php?id='.(GETPOSTISSET('id_sondage') ? GETPOST('id_sondage', 'aZ09') : GETPOST('id', 'alphanohtml')));
70 exit;
71}
72
73$nbcolonnes = substr_count($object->sujet, ',') + 1;
74
75// Add vote
76if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) { // boutonp for chrome, boutonp.x for firefox
77 if (GETPOST('nom')) {
78 $erreur_prenom = false;
79
80 $nouveauchoix = '';
81 for ($i = 0; $i < $nbcolonnes; $i++) {
82 if (GETPOSTISSET("choix$i") && GETPOST("choix$i") == '1') {
83 $nouveauchoix .= "1";
84 } elseif (GETPOSTISSET("choix$i") && GETPOST("choix$i") == '2') {
85 $nouveauchoix .= "2";
86 } else { // else it's zéro
87 $nouveauchoix .= "0";
88 }
89 }
90
91 $nom = substr(GETPOST("nom", 'alphanohtml'), 0, 64);
92
93 // Check if vote already exists
94 $sql = 'SELECT id_users, nom as name';
95 $sql .= ' FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs';
96 $sql .= " WHERE id_sondage='".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."'";
97 $sql .= ' ORDER BY id_users';
98 $resql = $db->query($sql);
99 $num_rows = $db->num_rows($resql);
100 if ($num_rows > 0) {
101 setEventMessages($langs->trans("VoteNameAlreadyExists"), null, 'errors');
102 $error++;
103 } else {
104 $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_user_studs (nom, id_sondage, reponses, date_creation)';
105 $sql .= " VALUES ('".$db->escape($nom)."', '".$db->escape($numsondage)."', '".$db->escape($nouveauchoix)."', '".$db->idate(dol_now())."')";
106 $resql = $db->query($sql);
107 if (!$resql) {
109 }
110 }
111 }
112}
113
114// Update vote
115$testmodifier = false;
116$testligneamodifier = false;
117$ligneamodifier = -1;
118$modifier = '';
119for ($i = 0; $i < $nblines; $i++) {
120 if (GETPOSTISSET('modifierligne'.$i)) {
121 $ligneamodifier = $i;
122 $testligneamodifier = true;
123 }
124
125 // test to check if a line needs to be updated
126 if (GETPOSTISSET('validermodifier'.$i)) {
127 $modifier = $i;
128 $testmodifier = true;
129 }
130}
131if ($testmodifier) {
132 // Security check
133 if (!$user->hasRight('opensurvey', 'write')) {
135 }
136
137 $nouveauchoix = '';
138 for ($i = 0; $i < $nbcolonnes; $i++) {
139 if (GETPOSTISSET("choix$i") && GETPOST("choix$i") == '1') {
140 $nouveauchoix .= "1";
141 } elseif (GETPOSTISSET("choix$i") && GETPOST("choix$i") == '2') {
142 $nouveauchoix .= "2";
143 } else { // else it's zero
144 $nouveauchoix .= "0";
145 }
146 }
147
148 $idtomodify = GETPOST("idtomodify".$modifier);
149 $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_user_studs";
150 $sql .= " SET reponses = '".$db->escape($nouveauchoix)."'";
151 $sql .= " WHERE id_users = '".$db->escape($idtomodify)."'";
152
153 $resql = $db->query($sql);
154 if (!$resql) {
156 }
157}
158
159// Add column (not for date)
160if (GETPOST("ajoutercolonne") && GETPOST('nouvellecolonne') && $object->format == "A") {
161 // Security check
162 if (!$user->hasRight('opensurvey', 'write')) {
164 }
165
166 $nouveauxsujets = $object->sujet;
167
168 // We add the value to the end of all subjects already entered
169 $nouveauxsujets .= ',';
170 $nouveauxsujets .= str_replace(array(",", "@"), " ", GETPOST("nouvellecolonne")).(!GETPOST("typecolonne") ? '' : '@'.GETPOST("typecolonne"));
171
172 // update with new subjects in database
173 $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage";
174 $sql .= " SET sujet = '".$db->escape($nouveauxsujets)."'";
175 $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'";
176 $resql = $db->query($sql);
177 if (!$resql) {
179 } else {
180 header('Location: results.php?id='.$object->id_sondage);
181 exit;
182 }
183}
184
185// Add column (with format date)
186if (GETPOSTISSET("ajoutercolonne") && $object->format == "D") {
187 // Security check
188 if (!$user->hasRight('opensurvey', 'write')) {
190 }
191
192 $nouveauxsujets = $object->sujet;
193
194 if (GETPOSTISSET("nouveaujour") && GETPOST("nouveaujour") != "vide" &&
195 GETPOSTISSET("nouveaumois") && GETPOST("nouveaumois") != "vide" &&
196 GETPOSTISSET("nouvelleannee") && GETPOST("nouvelleannee") != "vide") {
197 $nouvelledate = dol_mktime(0, 0, 0, GETPOSTINT("nouveaumois"), GETPOSTINT("nouveaujour"), GETPOSTINT("nouvelleannee"));
198
199 if (GETPOSTISSET("nouvelleheuredebut") && GETPOST("nouvelleheuredebut") != "vide") {
200 $nouvelledate .= "@";
201 $nouvelledate .= GETPOST("nouvelleheuredebut");
202 $nouvelledate .= "h";
203
204 if (GETPOST("nouvelleminutedebut") != "vide") {
205 $nouvelledate .= GETPOST("nouvelleminutedebut");
206 }
207 }
208
209 if (GETPOSTISSET("nouvelleheurefin") && GETPOST("nouvelleheurefin") != "vide") {
210 $nouvelledate .= "-";
211 $nouvelledate .= GETPOST("nouvelleheurefin");
212 $nouvelledate .= "h";
213
214 if (GETPOST("nouvelleminutefin") != "vide") {
215 $nouvelledate .= GETPOST("nouvelleminutefin");
216 }
217 }
218
219 if (GETPOST("nouvelleheuredebut") == "vide" || (GETPOSTISSET("nouvelleheuredebut") && GETPOSTISSET("nouvelleheurefin")
220 && (GETPOST("nouvelleheuredebut") < GETPOST("nouvelleheurefin") || (GETPOST("nouvelleheuredebut") == GETPOST("nouvelleheurefin")
221 && (GETPOST("nouvelleminutedebut") < GETPOST("nouvelleminutefin")))))) {
222 $erreur_ajout_date = false;
223 } else {
224 $erreur_ajout_date = "yes";
225 }
226
227 // we add the value to the values
228 $datesbase = explode(",", $object->sujet);
229 $taillebase = count($datesbase);
230 $cleinsertion = -1;
231
232 // Searching for the insertion point of the new date within the dates already entered in the table
233 if ($nouvelledate < $datesbase[0]) {
234 $cleinsertion = 0;
235 } elseif ($nouvelledate > $datesbase[$taillebase - 1]) {
236 $cleinsertion = count($datesbase);
237 } else {
238 $nbdatesbase = count($datesbase);
239 for ($i = 0; $i < $nbdatesbase; $i++) {
240 $j = $i + 1;
241 if ($nouvelledate > $datesbase[$i] && $nouvelledate < $datesbase[$j]) {
242 $cleinsertion = $j;
243 }
244 }
245 }
246
247 array_splice($datesbase, $cleinsertion, 0, $nouvelledate);
248 $cle = array_search($nouvelledate, $datesbase);
249 $dateinsertion = '';
250 $nbofdates = count($datesbase);
251 for ($i = 0; $i < $nbofdates; $i++) {
252 $dateinsertion .= ",";
253 $dateinsertion .= $datesbase[$i];
254 }
255
256 $dateinsertion = substr("$dateinsertion", 1);
257
258 // update with new topics into database
259 if (isset($erreur_ajout_date) && empty($erreur_ajout_date)) {
260 $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage";
261 $sql .= " SET sujet = '".$db->escape($dateinsertion)."'";
262 $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'";
263 $resql = $db->query($sql);
264 if (!$resql) {
266 } else {
267 header('Location: results.php?id='.$object->id_sondage);
268 }
269 }
270 if ($cleinsertion >= 0) {
271 $sql = 'SELECT s.reponses';
272 $sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_user_studs as s";
273 $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'";
274 $resql = $db->query($sql);
275 if (!$resql) {
277 } else {
278 $num = $db->num_rows($resql);
279 $compteur = 0;
280 while ($compteur < $num) {
281 $obj = $db->fetch_object($resql);
282 $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_user_studs";
283 if ($cleinsertion == 0) {
284 $sql .= " SET reponses = '0".$db->escape($obj->reponses)."'";
285 } else {
286 $reponsesadd = str_split($obj->reponses);
287 $lengthresponses = count($reponsesadd);
288 for ($cpt = $lengthresponses; $cpt > $cleinsertion; $cpt--) {
289 $reponsesadd[$cpt] = $reponsesadd[$cpt - 1];
290 }
291 $reponsesadd[$cleinsertion] = '0';
292 $reponsesadd = implode($reponsesadd);
293 $sql .= " SET reponses = '".$db->escape($reponsesadd)."'";
294 }
295 $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'";
296 $resql = $db->query($sql);
297 if (!$resql) {
299 }
300 $compteur++;
301 }
302 }
303 }
304 $adresseadmin = $object->mail_admin;
305 } else {
306 $erreur_ajout_date = "yes";
307 }
308}
309
310// Delete line
311for ($i = 0; $i < $nblines; $i++) {
312 if (GETPOST("effaceligne".$i) || GETPOST("effaceligne".$i."_x") || GETPOST("effaceligne".$i.".x")) { // effacelignei for chrome, effacelignei_x for firefox
313 // Security check
314 if (!$user->hasRight('opensurvey', 'write')) {
316 }
317
318 $compteur = 0;
319
320 // Loop on each answer
321 $compteur = 0;
322 $sql = "SELECT id_users, nom as name, id_sondage, reponses";
323 $sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_user_studs";
324 $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'";
325 $resql = $db->query($sql);
326 if (!$resql) {
328 }
329 $num = $db->num_rows($resql);
330 while ($compteur < $num) {
331 $obj = $db->fetch_object($resql);
332
333 if ($compteur == $i) {
334 $sql2 = 'DELETE FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs';
335 $sql2 .= " WHERE id_users = ".((int) $obj->id_users);
336 $resql2 = $db->query($sql2);
337 }
338
339 $compteur++;
340 }
341 }
342}
343
344// Delete column
345for ($i = 0; $i < $nbcolonnes; $i++) {
346 if ((GETPOST("effacecolonne".$i) || GETPOST("effacecolonne".$i."_x") || GETPOST("effacecolonne".$i.".x"))
347 && $nbcolonnes > 1) { // effacecolonnei for chrome, effacecolonnei_x for firefox
348 // Security check
349 if (!$user->hasRight('opensurvey', 'write')) {
351 }
352
353 $db->begin();
354
355 $toutsujet = explode(",", $object->sujet);
356 $j = 0;
357 $nouveauxsujets = '';
358
359 // review of all current subjects
360 while (isset($toutsujet[$j])) {
361 // If the subject is not the deleted subject, then concatenate the current subject
362 if ($i != $j) {
363 if (!empty($nouveauxsujets)) {
364 $nouveauxsujets .= ',';
365 }
366 $nouveauxsujets .= $toutsujet[$j];
367 }
368
369 $j++;
370 }
371
372 // Update subjects in database
373 $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage";
374 $sql .= " SET sujet = '".$db->escape($nouveauxsujets)."' WHERE id_sondage = '".$db->escape($numsondage)."'";
375 $resql = $db->query($sql);
376 if (!$resql) {
378 }
379
380 // Clean current answer to remove deleted columns
381 $compteur = 0;
382 $sql = "SELECT id_users, nom as name, id_sondage, reponses";
383 $sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_user_studs";
384 $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'";
385 dol_syslog('sql='.$sql);
386 $resql = $db->query($sql);
387 if (!$resql) {
389 exit;
390 }
391 $num = $db->num_rows($resql);
392 while ($compteur < $num) {
393 $obj = $db->fetch_object($resql);
394
395 $newcar = '';
396 $ensemblereponses = $obj->reponses;
397
398 // Review of all current answers
399 for ($j = 0; $j < $nbcolonnes; $j++) {
400 $car = substr($ensemblereponses, $j, 1);
401 // If the answers do not concern the erased column, we concatenate
402 if ($i != $j) {
403 $newcar .= $car;
404 }
405 }
406
407 // Update user's answers in database
408 $sql2 = 'UPDATE '.MAIN_DB_PREFIX.'opensurvey_user_studs';
409 $sql2 .= " SET reponses = '".$db->escape($newcar)."'";
410 $sql2 .= " WHERE id_users = '".$db->escape($obj->id_users)."'";
411 dol_syslog('sql='.$sql2);
412 $resql2 = $db->query($sql2);
413
414 $compteur++;
415 }
416
417 $db->commit();
418 }
419}
420
421
422
423/*
424 * View
425 */
426
427$form = new Form($db);
428$userstatic = null;
429
430if ($object->fk_user_creat) {
431 $userstatic = new User($db);
432 $userstatic->fetch($object->fk_user_creat);
433}
434
435$result = $object->fetch('', $numsondage);
436if ($result <= 0) {
437 dol_print_error($db, $object->error);
438 exit;
439}
440
441$title = $object->title." - ".$langs->trans('Card');
442$helpurl = '';
443$arrayofjs = array();
444$arrayofcss = array('/opensurvey/css/style.css');
445
446llxHeader('', $title, $helpurl, '', 0, 0, $arrayofjs, $arrayofcss);
447
448
449// Define format of choices
450$toutsujet = explode(",", $object->sujet);
451$listofanswers = array();
452foreach ($toutsujet as $value) {
453 $tmp = explode('@', $value);
454 $listofanswers[] = array('label' => $tmp[0], 'format' => (!empty($tmp[1]) ? $tmp[1] : 'checkbox'));
455}
456$toutsujet = str_replace("@", "<br>", $toutsujet);
457$toutsujet = str_replace("°", "'", $toutsujet);
458
459
460print '<form name="formulaire4" action="#" method="POST">'."\n";
461print '<input type="hidden" name="token" value="'.newToken().'">';
462print '<input type="hidden" name="id" value="'.GETPOST('id').'">';
463
464$head = opensurvey_prepare_head($object);
465
466print dol_get_fiche_head($head, 'preview', $langs->trans("Survey"), -1, $object->picto);
467
468$morehtmlref = '';
469
470$linkback = '<a href="'.DOL_URL_ROOT.'/opensurvey/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
471
472dol_banner_tab($object, 'id', $linkback, 1, 'id_sondage', 'id_sondage', $morehtmlref);
473
474
475print '<div class="fichecenter">';
476
477print '<div class="fichehalfleft">';
478print '<div class="underbanner clearboth"></div>';
479print '<table class="border tableforfield centpercent">';
480
481// Type
482$type = ($object->format == "A") ? 'classic' : 'date';
483print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td>';
484print img_picto('', dol_buildpath('/opensurvey/img/'.($type == 'classic' ? 'chart-32.png' : 'calendar-32.png'), 1), 'width="16"', 1);
485print ' '.$langs->trans($type == 'classic' ? "TypeClassic" : "TypeDate").'</td></tr>';
486
487// Title
488print '<tr><td>';
489$adresseadmin = $object->mail_admin;
490print $langs->trans("Title").'</td><td>';
491if ($action == 'edit') {
492 print '<input type="text" name="nouveautitre" size="40" value="'.dol_escape_htmltag($object->title).'">';
493} else {
494 print dol_htmlentities($object->title);
495}
496print '</td></tr>';
497
498// Description
499print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td class="wordbreak">';
500if ($action == 'edit') {
501 $doleditor = new DolEditor('nouveauxcommentaires', $object->description, '', 120, 'dolibarr_notes', 'In', true, 1, 1, ROWS_7, '90%');
502 $doleditor->Create(0, '');
503} else {
504 print(dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true));
505}
506print '</td></tr>';
507
508// EMail
509//If linked user, then emails are going to be sent to users' email
510if (!$object->fk_user_creat) {
511 print '<tr><td>'.$langs->trans("EMail").'</td><td>';
512 if ($action == 'edit') {
513 print '<input type="text" name="nouvelleadresse" class="minwidth200" value="'.$object->mail_admin.'">';
514 } else {
515 print dol_print_email($object->mail_admin, 0, 0, 1, 0, 1, 1);
516 }
517 print '</td></tr>';
518}
519
520print '</table>';
521
522print '</div>';
523print '<div class="fichehalfright">';
524print '<div class="underbanner clearboth"></div>';
525
526print '<table class="border tableforfield centpercent">';
527
528// Expire date
529print '<tr><td>'.$langs->trans('ExpireDate').'</td><td>';
530if ($action == 'edit') {
531 print $form->selectDate($expiredate ? $expiredate : $object->date_fin, 'expire', 0, 0, 0, '', 1, 0);
532} else {
533 print dol_print_date($object->date_fin, 'day');
534 if ($object->date_fin && $object->date_fin < dol_now() && $object->status == Opensurveysondage::STATUS_VALIDATED) {
535 print img_warning($langs->trans("Expired"));
536 }
537}
538print '</td></tr>';
539
540// Author
541print '<tr><td>';
542print $langs->trans("Author").'</td><td>';
543if ($object->fk_user_creat && $userstatic !== null) {
544 print $userstatic->getLoginUrl(-1);
545} else {
546 print dol_htmlentities($object->nom_admin);
547}
548print '</td></tr>';
549
550// Link
551print '<tr><td>'.$langs->trans("UrlForSurvey", '').'</td><td>';
552
553// Define $urlwithroot
554$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
555$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
556//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
557
558$url = $urlwithouturlroot.dol_buildpath('/public/opensurvey/studs.php', 1).'?sondage='.$object->id_sondage;
559$urllink = '<input type="text" class="quatrevingtpercent" '.($action == 'edit' ? 'disabled' : '').' id="opensurveyurl" name="opensurveyurl" value="'.$url.'" spellcheck="false">';
560print $urllink;
561if ($action != 'edit') {
562 print ajax_autoselect("opensurveyurl", $url, 'image');
563}
564
565print '</td></tr>';
566
567print '</table>';
568print '</div>';
569
570print '</div>';
571print '<div class="clearboth"></div>';
572
573print dol_get_fiche_end();
574
575print '</form>'."\n";
576
577
578// Buttons
579
580print '<div class="tabsAction">';
581
582print '<a class="butAction" href="exportcsv.php?id='.urlencode($numsondage).'">'.$langs->trans("ExportSpreadsheet").' (.CSV)</a>';
583
584print '</div>';
585
586
587// Show form to add a new field/column
588if (GETPOST('ajoutsujet')) {
589 // Security check
590 if (!$user->hasRight('opensurvey', 'write')) {
592 }
593
594 print '<form name="formulaire" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
595 print '<input type="hidden" name="token" value="'.newToken().'">';
596 print '<input type="hidden" name="backtopage" value="'.GETPOST('backtopage', 'alpha').'">';
597 print '<input type="hidden" name="id" value="'.GETPOST('id', 'alpha').'">';
598 print '<input type="hidden" name="ajoutsujet" value="1">';
599
600 print '<div class="center">'."\n";
601 print "<br><br>\n";
602
603 // Add new column
604 if ($object->format == "A") {
605 print $langs->trans("AddNewColumn").':<br><br>';
606 print $langs->trans("Title").' <input type="text" name="nouvellecolonne" size="40"><br>';
607 $tmparray = array('checkbox' => $langs->trans("CheckBox"), 'yesno' => $langs->trans("YesNoList"), 'foragainst' => $langs->trans("PourContreList"));
608 print $langs->trans("Type").' '.$form->selectarray("typecolonne", $tmparray, GETPOST('typecolonne')).'<br><br>';
609 print '<input type="submit" class="button" name="ajoutercolonne" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
610 print '<input type="hidden" name="id_sondage" value="'.dol_escape_htmltag($object->id_sondage).'">';
611 print ' &nbsp; &nbsp; ';
612 print '<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
613 print '<br><br>'."\n";
614 } else {
615 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
616
617 $formother = new FormOther($db);
618 // Adding a date with a time slot
619 print $langs->trans("AddADate").':<br><br>'."\n";
620 print '<select name="nouveaujour"> '."\n";
621 print '<option value="vide">&nbsp;</option>'."\n";
622 for ($i = 1; $i < 32; $i++) {
623 print '<option value="'.$i.'">'.$i.'</option>'."\n";
624 }
625 print '</select>'."\n";
626
627 print $formother->select_month('', 'nouveaumois', 1);
628
629 print '&nbsp;';
630
631 print $formother->selectyear('', 'nouvelleannee', 1, 0, 5, 0, 1);
632
633 print '<br><br>'.$langs->trans("AddStartHour").': <br><br>'."\n";
634 print '<select name="nouvelleheuredebut"> '."\n";
635 print '<option value="vide">&nbsp;</option>'."\n";
636 for ($i = 0; $i < 24; $i++) {
637 print '<option value="'.$i.'">'.$i.' H</option>'."\n";
638 }
639 print '</select>'."\n";
640 print '<select name="nouvelleminutedebut"> '."\n";
641 print '<option value="vide">&nbsp;</option>'."\n";
642 print '<option value="00">00</option>'."\n";
643 print '<option value="15">15</option>'."\n";
644 print '<option value="30">30</option>'."\n";
645 print '<option value="45">45</option>'."\n";
646 print '</select>'."\n";
647 print '<br><br>'.$langs->trans("AddEndHour").': <br><br>'."\n";
648 print '<select name="nouvelleheurefin"> '."\n";
649 print '<option value="vide">&nbsp;</option>'."\n";
650 for ($i = 0; $i < 24; $i++) {
651 print '<option value="'.$i.'">'.$i.' H</option>'."\n";
652 }
653 print '</SELECT>'."\n";
654 print '<select name="nouvelleminutefin"> '."\n";
655 print '<option value="vide">&nbsp;</option>'."\n";
656 print '<option value="00">00</option>'."\n";
657 print '<option value="15">15</option>'."\n";
658 print '<option value="30">30</option>'."\n";
659 print '<option value="45">45</option>'."\n";
660 print '</select>'."\n";
661
662 print '<br><br>';
663 print' <input type="submit" class="button" name="ajoutercolonne" value="'.dol_escape_htmltag($langs->trans("Add")).'">'."\n";
664 print '&nbsp; &nbsp;';
665 print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
666 }
667
668 print '</form>'."\n";
669 print '<br><br><br><br>'."\n";
670 print '</div>'."\n";
671
672 exit;
673}
674
675if ($user->hasRight('opensurvey', 'write')) {
676 print '<span class="opacitymedium">';
677 $s = $langs->trans("PollAdminDesc", '{s1}', $langs->trans("Add"));
678 print str_replace('{s1}', img_picto('', 'delete'), $s);
679 print '</span><br>';
680}
681
682$nbcolonnes = substr_count($object->sujet, ',') + 1;
683
684print '<form name="formulaire" action="" method="POST">'."\n";
685print '<input type="hidden" name="token" value="'.newToken().'">';
686print '<input type="hidden" name="page_y" value="">';
687
688print '<div class="cadre div-table-responsive-no-min"> '."\n";
689
690// Start to show survey result
691print '<table class="resultats margintoponly">'."\n";
692
693// Reformatting the survey subject data
694$toutsujet = explode(",", $object->sujet);
695$toutsujet = str_replace("°", "'", $toutsujet);
696
697print '<tr>'."\n";
698print '<td></td>'."\n";
699print '<td></td>'."\n";
700
701// loop to show the delete link
702if ($user->hasRight('opensurvey', 'write')) {
703 for ($i = 0; isset($toutsujet[$i]); $i++) {
704 print '<td class=somme><input type="image" class="buttonwebsite" name="effacecolonne'.$i.'" src="'.img_picto('', 'delete', '', 0, 1).'"></td>'."\n";
705 }
706}
707
708print '</tr>'."\n";
709
710
711// Show choice titles
712if ($object->format == "D") {
713 // Displaying the survey subjects
714 print '<tr>'."\n";
715 print '<td></td>'."\n";
716 print '<td></td>'."\n";
717
718 // Displaying the years
719 $colspan = 1;
720 $nbofsujet = count($toutsujet);
721 for ($i = 0; $i < $nbofsujet; $i++) {
722 if (isset($toutsujet[$i + 1]) && date('Y', intval($toutsujet[$i])) == date('Y', intval($toutsujet[$i + 1]))) {
723 $colspan++;
724 } else {
725 print '<td colspan='.$colspan.' class="annee">'.date('Y', intval($toutsujet[$i])).'</td>'."\n";
726 $colspan = 1;
727 }
728 }
729
730 if ($user->hasRight('opensurvey', 'write')) {
731 print '<td class="annee">';
732 print '<a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&id='.$object->id_sondage.'">'.$langs->trans("Add").'</a></td>'."\n";
733 }
734
735 print '</tr>'."\n";
736 print '<tr>'."\n";
737 print '<td></td>'."\n";
738 print '<td></td>'."\n";
739
740 // Displaying the months
741 $colspan = 1;
742 for ($i = 0; $i < $nbofsujet; $i++) {
743 $cur = intval($toutsujet[$i]); // intval() est utilisé pour supprimer le suffixe @* qui déplaît logiquement à strftime()
744
745 if (!isset($toutsujet[$i + 1])) {
746 $next = false;
747 } else {
748 $next = intval($toutsujet[$i + 1]);
749 }
750
751 if ($next && dol_print_date($cur, "%B") == dol_print_date($next, "%B") && dol_print_date($cur, "%Y") == dol_print_date($next, "%Y")) {
752 $colspan++;
753 } else {
754 print '<td colspan='.$colspan.' class="mois">'.dol_print_date($cur, "%B").'</td>'."\n";
755
756 $colspan = 1;
757 }
758 }
759
760 if ($user->hasRight('opensurvey', 'write')) {
761 print '<td class="mois"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&id='.$object->id_sondage.'">'.$langs->trans("Add").'</a></td>'."\n";
762 }
763
764 print '</tr>'."\n";
765 print '<tr>'."\n";
766 print '<td></td>'."\n";
767 print '<td></td>'."\n";
768
769 // Displaying the days
770 $colspan = 1;
771 for ($i = 0; $i < $nbofsujet; $i++) {
772 $cur = intval($toutsujet[$i]);
773 if (!isset($toutsujet[$i + 1])) {
774 $next = false;
775 } else {
776 $next = intval($toutsujet[$i + 1]);
777 }
778 if ($next && dol_print_date($cur, "%a %d") == dol_print_date($next, "%a %d") && dol_print_date($cur, "%B") == dol_print_date($next, "%B")) {
779 $colspan++;
780 } else {
781 print '<td colspan='.$colspan.' class="jour">'.dol_print_date($cur, "%a %d").'</td>'."\n";
782
783 $colspan = 1;
784 }
785 }
786
787 if ($user->hasRight('opensurvey', 'write')) {
788 print '<td class="jour"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&id='.$object->id_sondage.'">'.$langs->trans("Add").'</a></td>'."\n";
789 }
790 print '</tr>'."\n";
791
792 // Displaying time slots
793 if (strpos($object->sujet, '@') !== false) {
794 print '<tr>'."\n";
795 print '<td></td>'."\n";
796 print '<td></td>'."\n";
797
798 for ($i = 0; isset($toutsujet[$i]); $i++) {
799 $heures = explode('@', $toutsujet[$i]);
800 if (isset($heures[1])) {
801 print '<td class="heure">'.dol_htmlentities($heures[1]).'</td>'."\n";
802 } else {
803 print '<td class="heure"></td>'."\n";
804 }
805 }
806
807 if ($user->hasRight('opensurvey', 'write')) {
808 print '<td class="heure"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&id='.$object->id_sondage.'">'.$langs->trans("Add").'</a></td>'."\n";
809 }
810
811 print '</tr>'."\n";
812 }
813} else {
814 // Show titles
815 print '<tr>'."\n";
816 print '<td></td>'."\n";
817 print '<td></td>'."\n";
818
819 for ($i = 0; isset($toutsujet[$i]); $i++) {
820 $tmp = explode('@', $toutsujet[$i]);
821 print '<td class="sujet">'.dol_htmlentities($tmp[0]).'</td>'."\n";
822 }
823
824 print '<td class="sujet"><a href="'.$_SERVER["PHP_SELF"].'?id='.$numsondage.'&ajoutsujet=1&backtopage='.urlencode($_SERVER["PHP_SELF"]).'"><span class="fa fa-plus-circle valignmiddle btnTitle-icon"></span></a></td>'."\n";
825 print '</tr>'."\n";
826}
827
828
829// Loop on each answer
830$sumfor = array();
831$sumagainst = array();
832$compteur = 0;
833$sql = "SELECT id_users, nom as name, id_sondage, reponses, tms, date_creation";
834$sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_user_studs";
835$sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'";
836dol_syslog('sql='.$sql);
837$resql = $db->query($sql);
838if (!$resql) {
840 exit;
841}
842$num = $db->num_rows($resql);
843while ($compteur < $num) {
844 $obj = $db->fetch_object($resql);
845
846 $ensemblereponses = $obj->reponses;
847
848 print '<tr><td>'."\n";
849
850 if ($user->hasRight('opensurvey', 'write')) {
851 print '<input type="image" class="reposition" name="effaceligne'.$compteur.'" src="'.img_picto('', 'delete', '', 0, 1).'">'."\n";
852 }
853
854 // Name
855 $tooltip = $obj->name.'<br>'.$langs->trans("DateCreation").': '.dol_print_date($obj->date_creation, 'dayhour');
856 print '</td><td class="nom classfortooltip" title="'.dolPrintHTMLForAttribute($tooltip).'">';
857 print dolPrintHTML($obj->name);
858 print '</td>'."\n";
859
860 // If the line is not to be changed, we display the data
861 if (!$testligneamodifier) {
862 for ($i = 0; $i < $nbcolonnes; $i++) {
863 $car = substr($ensemblereponses, $i, 1);
864 //print 'xx'.$i."-".$car.'-'.$listofanswers[$i]['format'].'zz';
865
866 if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) {
867 if (((string) $car) == "1") {
868 print '<td class="ok">OK</td>'."\n";
869 } else {
870 print '<td class="non">KO</td>'."\n";
871 }
872 // Total
873 if (!isset($sumfor[$i])) {
874 $sumfor[$i] = 0;
875 }
876 if (((string) $car) == "1") {
877 $sumfor[$i]++;
878 }
879 }
880 if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') {
881 if (((string) $car) == "1") {
882 print '<td class="ok">'.$langs->trans("Yes").'</td>'."\n";
883 } elseif (((string) $car) == "0") {
884 print '<td class="non">'.$langs->trans("No").'</td>'."\n";
885 } else {
886 print '<td class="vide">&nbsp;</td>'."\n";
887 }
888 // Total
889 if (!isset($sumfor[$i])) {
890 $sumfor[$i] = 0;
891 }
892 if (!isset($sumagainst[$i])) {
893 $sumagainst[$i] = 0;
894 }
895 if (((string) $car) == "1") {
896 $sumfor[$i]++;
897 }
898 if (((string) $car) == "0") {
899 $sumagainst[$i]++;
900 }
901 }
902 if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') {
903 if (((string) $car) == "1") {
904 print '<td class="ok">'.$langs->trans("For").'</td>'."\n";
905 } elseif (((string) $car) == "0") {
906 print '<td class="non">'.$langs->trans("Against").'</td>'."\n";
907 } else {
908 print '<td class="vide">&nbsp;</td>'."\n";
909 }
910 // Total
911 if (!isset($sumfor[$i])) {
912 $sumfor[$i] = 0;
913 }
914 if (!isset($sumagainst[$i])) {
915 $sumagainst[$i] = 0;
916 }
917 if (((string) $car) == "1") {
918 $sumfor[$i]++;
919 }
920 if (((string) $car) == "0") {
921 $sumagainst[$i]++;
922 }
923 }
924 }
925 } else {
926 // Else, replace the user's choices with a line of checkboxes to retrieve new values
927 if ($compteur == $ligneamodifier) {
928 for ($i = 0; $i < $nbcolonnes; $i++) {
929 $car = substr($ensemblereponses, $i, 1);
930 print '<td class="vide">';
931 if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) {
932 print '<input type="checkbox" name="choix'.$i.'" value="1" ';
933 if ($car == '1') {
934 print 'checked';
935 }
936 print '>';
937 }
938 if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') {
939 $arraychoice = array('2' => '&nbsp;', '0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
940 print $form->selectarray("choix".$i, $arraychoice, $car);
941 }
942 if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') {
943 $arraychoice = array('2' => '&nbsp;', '0' => $langs->trans("Against"), '1' => $langs->trans("For"));
944 print $form->selectarray("choix".$i, $arraychoice, $car);
945 }
946 print '</td>'."\n";
947 }
948 } else {
949 for ($i = 0; $i < $nbcolonnes; $i++) {
950 $car = substr($ensemblereponses, $i, 1);
951 if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) {
952 if (((string) $car) == "1") {
953 print '<td class="ok">OK</td>'."\n";
954 } else {
955 print '<td class="non">KO</td>'."\n";
956 }
957 // Total
958 if (!isset($sumfor[$i])) {
959 $sumfor[$i] = 0;
960 }
961 if (((string) $car) == "1") {
962 $sumfor[$i]++;
963 }
964 }
965 if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') {
966 if (((string) $car) == "1") {
967 print '<td class="ok">'.$langs->trans("For").'</td>'."\n";
968 } elseif (((string) $car) == "0") {
969 print '<td class="non">'.$langs->trans("Against").'</td>'."\n";
970 } else {
971 print '<td class="vide">&nbsp;</td>'."\n";
972 }
973 // Total
974 if (!isset($sumfor[$i])) {
975 $sumfor[$i] = 0;
976 }
977 if (!isset($sumagainst[$i])) {
978 $sumagainst[$i] = 0;
979 }
980 if (((string) $car) == "1") {
981 $sumfor[$i]++;
982 }
983 if (((string) $car) == "0") {
984 $sumagainst[$i]++;
985 }
986 }
987 if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') {
988 if (((string) $car) == "1") {
989 print '<td class="ok">'.$langs->trans("For").'</td>'."\n";
990 } elseif (((string) $car) == "0") {
991 print '<td class="non">'.$langs->trans("Against").'</td>'."\n";
992 } else {
993 print '<td class="vide">&nbsp;</td>'."\n";
994 }
995 // Total
996 if (!isset($sumfor[$i])) {
997 $sumfor[$i] = 0;
998 }
999 if (!isset($sumagainst[$i])) {
1000 $sumagainst[$i] = 0;
1001 }
1002 if (((string) $car) == "1") {
1003 $sumfor[$i]++;
1004 }
1005 if (((string) $car) == "0") {
1006 $sumagainst[$i]++;
1007 }
1008 }
1009 }
1010 }
1011 }
1012
1013 // Button edit at end of line
1014 if ($compteur != $ligneamodifier && ($user->hasRight('opensurvey', 'write'))) {
1015 print '<td class="casevide"><input type="submit" class="button reposition" name="modifierligne'.$compteur.'" value="'.dol_escape_htmltag($langs->trans("Edit")).'"></td>'."\n";
1016 }
1017
1018 // Ask confirmation to modify the line
1019 for ($i = 0; $i < $nblines; $i++) {
1020 if (GETPOSTISSET("modifierligne".$i)) {
1021 if ($compteur == $i) {
1022 print '<td class="casevide">';
1023 print '<input type="hidden" name="idtomodify'.$compteur.'" value="'.$obj->id_users.'">';
1024 print '<input type="submit" class="button button-save reposition" name="validermodifier'.$compteur.'" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
1025 print '</td>'."\n";
1026 }
1027 }
1028 }
1029
1030 $compteur++;
1031 print '</tr>'."\n";
1032}
1033
1034// Add line to add new record
1035if (empty($testligneamodifier)) {
1036 print '<tr>'."\n";
1037 print '<td></td>'."\n";
1038 print '<td class="nom">'."\n";
1039 print '<input type="text" class="maxwidthonsmartphone" placeholder="'.dol_escape_htmltag($langs->trans("Name")).'" name="nom" maxlength="64">'."\n";
1040 print '</td>'."\n";
1041
1042 for ($i = 0; $i < $nbcolonnes; $i++) {
1043 print '<td class="vide">';
1044 if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) {
1045 print '<input type="checkbox" name="choix'.$i.'" value="1"';
1046 if (GETPOSTISSET('choix'.$i) && GETPOST('choix'.$i) == '1') {
1047 print ' checked';
1048 }
1049 print '>';
1050 }
1051 if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') {
1052 $arraychoice = array('2' => '&nbsp;', '0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
1053 print $form->selectarray("choix".$i, $arraychoice);
1054 }
1055 if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') {
1056 $arraychoice = array('2' => '&nbsp;', '0' => $langs->trans("Against"), '1' => $langs->trans("For"));
1057 print $form->selectarray("choix".$i, $arraychoice);
1058 }
1059 print '</td>'."\n";
1060 }
1061
1062 // Display of the form button to register a new user in the database
1063 print '<td><input type="image" name="boutonp" class="borderimp classfortooltip" title="'.dolPrintHTML($langs->trans("AddTheVote")).'" value="'.$langs->trans("Vote").'" src="'.img_picto('', 'edit_add', '', 0, 1).'"></td>'."\n";
1064 print '</tr>'."\n";
1065}
1066
1067// Select value of best choice (for checkbox columns only)
1068$nbofcheckbox = 0;
1069$meilleurecolonne = null;
1070for ($i = 0; $i < $nbcolonnes + 1; $i++) {
1071 if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) {
1072 $nbofcheckbox++;
1073 }
1074 if (isset($sumfor[$i])) {
1075 if ($i == 0) {
1076 $meilleurecolonne = $sumfor[$i];
1077 } elseif ($sumfor[$i] > $meilleurecolonne) {
1078 $meilleurecolonne = $sumfor[$i];
1079 }
1080 }
1081}
1082
1083
1084// Show line total
1085print '<tr>'."\n";
1086print '<td></td>'."\n";
1087print '<td class="center">'.$langs->trans("Total").'</td>'."\n";
1088for ($i = 0; $i < $nbcolonnes; $i++) {
1089 $showsumfor = isset($sumfor[$i]) ? $sumfor[$i] : '';
1090 $showsumagainst = isset($sumagainst[$i]) ? $sumagainst[$i] : '';
1091 if (empty($showsumfor)) {
1092 $showsumfor = 0;
1093 }
1094 if (empty($showsumagainst)) {
1095 $showsumagainst = 0;
1096 }
1097
1098 print '<td>';
1099 if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) {
1100 print $showsumfor;
1101 }
1102 if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') {
1103 print $langs->trans("Yes").': '.$showsumfor.'<br>'.$langs->trans("No").': '.$showsumagainst;
1104 }
1105 if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') {
1106 print $langs->trans("For").': '.$showsumfor.'<br>'.$langs->trans("Against").': '.$showsumagainst;
1107 }
1108 print '</td>'."\n";
1109}
1110print '</tr>';
1111// Show picto winner
1112if ($nbofcheckbox >= 2) {
1113 print '<tr>'."\n";
1114 print '<td></td>'."\n";
1115 print '<td></td>'."\n";
1116 for ($i = 0; $i < $nbcolonnes; $i++) {
1117 if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')) && isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) {
1118 print '<td class="somme"><img src="'.dol_buildpath('/opensurvey/img/medaille.png', 1).'"></td>'."\n";
1119 } else {
1120 print '<td class="somme"></td>'."\n";
1121 }
1122 }
1123 print '</tr>'."\n";
1124}
1125
1126// S'il a oublié de remplir un nom
1127if (GETPOSTISSET("boutonp") && GETPOST("nom") == "") {
1128 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")), null, 'errors');
1129}
1130
1131if (isset($erreur_prenom) && $erreur_prenom) {
1132 setEventMessages($langs->trans('VoteNameAlreadyExists'), null, 'errors');
1133}
1134
1135if (isset($erreur_ajout_date) && $erreur_ajout_date) {
1136 setEventMessages($langs->trans("ErrorWrongDate"), null, 'errors');
1137}
1138
1139//fin du tableau
1140print '</table>'."\n";
1141print '</div>'."\n";
1142
1143
1144$toutsujet = explode(",", $object->sujet); // With old versions, this field was not set
1145
1146$compteursujet = 0;
1147$meilleursujet = '';
1148for ($i = 0; $i < $nbcolonnes; $i++) {
1149 if (isset($sumfor[$i]) && isset($meilleurecolonne) && ($sumfor[$i] == $meilleurecolonne)) {
1150 $meilleursujet .= ($meilleursujet ? ", " : "");
1151
1152 if ($object->format == "D") {
1153 //var_dump($toutsujet);
1154 if (strpos($toutsujet[$i], '@') !== false) {
1155 $toutsujetdate = explode("@", $toutsujet[$i]);
1156 $meilleursujet .= dol_print_date($toutsujetdate[0], 'daytext').($toutsujetdate[0] ? ' ('.dol_print_date($toutsujetdate[0], '%A').')' : '').' - '.$toutsujetdate[1];
1157 } else {
1158 $meilleursujet .= dol_print_date((empty($toutsujet[$i]) ? 0 : $toutsujet[$i]), 'daytext').' ('.dol_print_date((empty($toutsujet[$i]) ? 0 : $toutsujet[$i]), '%A').')';
1159 }
1160 } else {
1161 $tmps = explode('@', $toutsujet[$i]);
1162 $meilleursujet .= dol_htmlentities($tmps[0]);
1163 }
1164
1165 $compteursujet++;
1166 }
1167}
1168//$meilleursujet = substr($meilleursujet, 1);
1169$meilleursujet = str_replace("°", "'", $meilleursujet);
1170
1171// Show best choice
1172if ($nbofcheckbox >= 2) {
1173 $vote_str = $langs->trans('votes');
1174 print '<p class="affichageresultats">'."\n";
1175
1176 if (isset($meilleurecolonne) && $compteursujet == "1") {
1177 print '<img src="'.DOL_URL_ROOT.'/opensurvey/img/medaille.png"> '.$langs->trans('TheBestChoice').": <b>".$meilleursujet."</b> - <b>".$meilleurecolonne."</b> ".$vote_str.".\n";
1178 } elseif (isset($meilleurecolonne)) {
1179 print '<img src="'.DOL_URL_ROOT.'/opensurvey/img/medaille.png"> '.$langs->trans('TheBestChoices').": <b>".$meilleursujet."</b> - <b>".$meilleurecolonne."</b> ".$vote_str.".\n";
1180 }
1181 print '<br></p><br>'."\n";
1182}
1183
1184print '</form>'."\n";
1185
1186print '<a name="bas"></a>'."\n";
1187
1188llxFooter();
1189
1190$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
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 a WYSIWYG editor.
Class to manage generation of HTML components Only common components must be here.
Class to help generate other html components Only common components are here.
Put here description of your class.
const STATUS_VALIDATED
Validated/Opened status.
Class to manage Dolibarr users.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
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.
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
dol_htmlentities($string, $flags=ENT_QUOTES|ENT_SUBSTITUTE, $encoding='UTF-8', $double_encode=false)
Replace htmlentities functions.
dol_print_email($email, $contactid=0, $socid=0, $addlink=0, $max=0, $showinvalid=1, $withpicto=0, $morecss='paddingrightonly')
Show EMail link formatted for HTML output.
dol_textishtml($msg, $option=0)
Return if a text is a html content.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
opensurvey_prepare_head(Opensurveysondage $object)
Returns an array with the tabs for the "Opensurvey poll" section It loads tabs from modules looking f...
print $langs trans('Date')." left Ref Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right Paid right PaymentTypeShortLIQ right SELECT p pos_change as p datep as date
Definition receipt.php:487
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.