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