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