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