dolibarr  13.0.2
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 Frédéric France <frederic.france@netlogic.fr>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <https://www.gnu.org/licenses/>.
18  */
19 
26 require '../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
28 require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
29 require_once DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php";
30 require_once DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php";
31 
32 
33 // Security check
34 if (!$user->rights->opensurvey->read) accessforbidden();
35 
36 
37 // Init vars
38 $action = GETPOST('action', 'aZ09');
39 $numsondage = GETPOST("id");
40 
41 $object = new Opensurveysondage($db);
42 $result = $object->fetch(0, $numsondage);
43 if ($result <= 0) dol_print_error('', 'Failed to get survey id '.$numsondage);
44 
45 $nblines = $object->fetch_lines();
46 
47 
48 /*
49  * Actions
50  */
51 
52 // Return to the results
53 if (GETPOST('retoursondage')) {
54  header('Location: results.php?id='.$_GET['id']);
55  exit;
56 }
57 
58 $nbcolonnes = substr_count($object->sujet, ',') + 1;
59 
60 // Add vote
61 if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // boutonp for chrome, boutonp.x for firefox
62 {
63  if (GETPOST('nom'))
64  {
65  $erreur_prenom = false;
66 
67  $nouveauchoix = '';
68  for ($i = 0; $i < $nbcolonnes; $i++)
69  {
70  if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '1')
71  {
72  $nouveauchoix .= "1";
73  } elseif (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2')
74  {
75  $nouveauchoix .= "2";
76  } else { // sinon c'est 0
77  $nouveauchoix .= "0";
78  }
79  }
80 
81  $nom = substr(GETPOST("nom", 'nohtml'), 0, 64);
82 
83  // Check if vote already exists
84  $sql = 'SELECT id_users, nom as name';
85  $sql .= ' FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs';
86  $sql .= " WHERE id_sondage='".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."'";
87  $sql .= ' ORDER BY id_users';
88  $resql = $db->query($sql);
89  $num_rows = $db->num_rows($resql);
90  if ($num_rows > 0)
91  {
92  setEventMessages($langs->trans("VoteNameAlreadyExists"), null, 'errors');
93  $error++;
94  } else {
95  $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_user_studs (nom, id_sondage, reponses)';
96  $sql .= " VALUES ('".$db->escape($nom)."', '".$db->escape($numsondage)."','".$db->escape($nouveauchoix)."')";
97  $resql = $db->query($sql);
98  if (!$resql) dol_print_error($db);
99  }
100  }
101 }
102 
103 // Update vote
104 $testmodifier = false;
105 $testligneamodifier = false;
106 $ligneamodifier = -1;
107 for ($i = 0; $i < $nblines; $i++)
108 {
109  if (isset($_POST['modifierligne'.$i]))
110  {
111  $ligneamodifier = $i;
112  $testligneamodifier = true;
113  }
114 
115  //test pour voir si une ligne est a modifier
116  if (isset($_POST['validermodifier'.$i]))
117  {
118  $modifier = $i;
119  $testmodifier = true;
120  }
121 }
122 if ($testmodifier)
123 {
124  // Security check
125  if (!$user->rights->opensurvey->write) accessforbidden();
126 
127  $nouveauchoix = '';
128  for ($i = 0; $i < $nbcolonnes; $i++)
129  {
130  //var_dump($_POST["choix$i"]);
131  if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '1')
132  {
133  $nouveauchoix .= "1";
134  } elseif (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2')
135  {
136  $nouveauchoix .= "2";
137  } else { // sinon c'est 0
138  $nouveauchoix .= "0";
139  }
140  }
141 
142  $idtomodify = $_POST["idtomodify".$modifier];
143  $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_user_studs";
144  $sql .= " SET reponses = '".$db->escape($nouveauchoix)."'";
145  $sql .= " WHERE id_users = '".$db->escape($idtomodify)."'";
146 
147  $resql = $db->query($sql);
148  if (!$resql) dol_print_error($db);
149 }
150 
151 // Add column (not for date)
152 if (GETPOST("ajoutercolonne") && GETPOST('nouvellecolonne') && $object->format == "A")
153 {
154  // Security check
155  if (!$user->rights->opensurvey->write) accessforbidden();
156 
157  $nouveauxsujets = $object->sujet;
158 
159  //on rajoute la valeur a la fin de tous les sujets deja entrés
160  $nouveauxsujets .= ',';
161  $nouveauxsujets .= str_replace(array(",", "@"), " ", GETPOST("nouvellecolonne")).(empty($_POST["typecolonne"]) ? '' : '@'.GETPOST("typecolonne"));
162 
163  //mise a jour avec les nouveaux sujets dans la base
164  $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage";
165  $sql .= " SET sujet = '".$db->escape($nouveauxsujets)."'";
166  $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'";
167  $resql = $db->query($sql);
168  if (!$resql) dol_print_error($db);
169  else {
170  header('Location: results.php?id='.$object->id_sondage);
171  }
172 }
173 
174 // Add column (with format date)
175 if (isset($_POST["ajoutercolonne"]) && $object->format == "D")
176 {
177  // Security check
178  if (!$user->rights->opensurvey->write) accessforbidden();
179 
180  $nouveauxsujets = $object->sujet;
181 
182  if (isset($_POST["nouveaujour"]) && $_POST["nouveaujour"] != "vide" &&
183  isset($_POST["nouveaumois"]) && $_POST["nouveaumois"] != "vide" &&
184  isset($_POST["nouvelleannee"]) && $_POST["nouvelleannee"] != "vide") {
185  $nouvelledate = dol_mktime(0, 0, 0, $_POST["nouveaumois"], $_POST["nouveaujour"], $_POST["nouvelleannee"]);
186 
187  if (isset($_POST["nouvelleheuredebut"]) && $_POST["nouvelleheuredebut"] != "vide") {
188  $nouvelledate .= "@";
189  $nouvelledate .= GETPOST("nouvelleheuredebut");
190  $nouvelledate .= "h";
191 
192  if ($_POST["nouvelleminutedebut"] != "vide") {
193  $nouvelledate .= GETPOST("nouvelleminutedebut");
194  }
195  }
196 
197  if (isset($_POST["nouvelleheurefin"]) && $_POST["nouvelleheurefin"] != "vide") {
198  $nouvelledate .= "-";
199  $nouvelledate .= GETPOST("nouvelleheurefin");
200  $nouvelledate .= "h";
201 
202  if ($_POST["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  {
228  $j = $i + 1;
229  if ($nouvelledate > $datesbase[$i] && $nouvelledate < $datesbase[$j]) {
230  $cleinsertion = $j;
231  }
232  }
233  }
234 
235  array_splice($datesbase, $cleinsertion, 0, $nouvelledate);
236  $cle = array_search($nouvelledate, $datesbase);
237  $dateinsertion = '';
238  $nbofdates = count($datesbase);
239  for ($i = 0; $i < $nbofdates; $i++) {
240  $dateinsertion .= ",";
241  $dateinsertion .= $datesbase[$i];
242  }
243 
244  $dateinsertion = substr("$dateinsertion", 1);
245 
246  // update with new topics into database
247  if (isset($erreur_ajout_date) && empty($erreur_ajout_date))
248  {
249  $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage";
250  $sql .= " SET sujet = '".$db->escape($dateinsertion)."'";
251  $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'";
252  $resql = $db->query($sql);
253  if (!$resql) dol_print_error($db);
254  else {
255  header('Location: results.php?id='.$object->id_sondage);
256  }
257  }
258 
259  $adresseadmin = $object->mail_admin;
260  } else {
261  $erreur_ajout_date = "yes";
262  }
263 }
264 
265 // Delete line
266 for ($i = 0; $i < $nblines; $i++)
267 {
268  if (GETPOST("effaceligne".$i) || GETPOST("effaceligne".$i."_x") || GETPOST("effaceligne".$i.".x")) // effacelignei for chrome, effacelignei_x for firefox
269  {
270  // Security check
271  if (!$user->rights->opensurvey->write) accessforbidden();
272 
273  $compteur = 0;
274 
275  // Loop on each answer
276  $compteur = 0;
277  $sql = "SELECT id_users, nom as name, id_sondage, reponses";
278  $sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_user_studs";
279  $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'";
280  $resql = $db->query($sql);
281  if (!$resql) dol_print_error($db);
282  $num = $db->num_rows($resql);
283  while ($compteur < $num)
284  {
285  $obj = $db->fetch_object($resql);
286 
287  if ($compteur == $i)
288  {
289  $sql2 = 'DELETE FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs';
290  $sql2 .= ' WHERE id_users = '.$db->escape($obj->id_users);
291  $resql2 = $db->query($sql2);
292  }
293 
294  $compteur++;
295  }
296  }
297 }
298 
299 // Delete column
300 for ($i = 0; $i < $nbcolonnes; $i++)
301 {
302  if ((GETPOST("effacecolonne".$i) || GETPOST("effacecolonne".$i."_x") || GETPOST("effacecolonne".$i.".x"))
303  && $nbcolonnes > 1) // effacecolonnei for chrome, effacecolonnei_x for firefox
304  {
305  // Security check
306  if (!$user->rights->opensurvey->write) accessforbidden();
307 
308  $db->begin();
309 
310  $toutsujet = explode(",", $object->sujet);
311  $j = 0;
312  $nouveauxsujets = '';
313 
314  //parcours de tous les sujets actuels
315  while (isset($toutsujet[$j]))
316  {
317  //si le sujet n'est pas celui qui a été effacé alors on concatene
318  if ($i != $j)
319  {
320  if (!empty($nouveauxsujets)) $nouveauxsujets .= ',';
321  $nouveauxsujets .= $toutsujet[$j];
322  }
323 
324  $j++;
325  }
326 
327  // Mise a jour des sujets dans la base
328  $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage";
329  $sql .= " SET sujet = '".$db->escape($nouveauxsujets)."' WHERE id_sondage = '".$db->escape($numsondage)."'";
330  $resql = $db->query($sql);
331  if (!$resql) dol_print_error($db);
332 
333  // Clean current answer to remove deleted columns
334  $compteur = 0;
335  $sql = "SELECT id_users, nom as name, id_sondage, reponses";
336  $sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_user_studs";
337  $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'";
338  dol_syslog('sql='.$sql);
339  $resql = $db->query($sql);
340  if (!$resql)
341  {
342  dol_print_error($db);
343  exit;
344  }
345  $num = $db->num_rows($resql);
346  while ($compteur < $num)
347  {
348  $obj = $db->fetch_object($resql);
349 
350  $newcar = '';
351  $ensemblereponses = $obj->reponses;
352 
353  // parcours de toutes les réponses actuelles
354  for ($j = 0; $j < $nbcolonnes; $j++)
355  {
356  $car = substr($ensemblereponses, $j, 1);
357  //si les reponses ne concerne pas la colonne effacée, on concatene
358  if ($i != $j) {
359  $newcar .= $car;
360  }
361  }
362 
363  // mise a jour des reponses utilisateurs dans la base
364  $sql2 = 'UPDATE '.MAIN_DB_PREFIX.'opensurvey_user_studs';
365  $sql2 .= " SET reponses = '".$db->escape($newcar)."'";
366  $sql2 .= " WHERE id_users = '".$db->escape($obj->id_users)."'";
367  //print $sql2;
368  dol_syslog('sql='.$sql2);
369  $resql2 = $db->query($sql2);
370 
371  $compteur++;
372  }
373 
374  $db->commit();
375  }
376 }
377 
378 
379 
380 /*
381  * View
382  */
383 
384 $form = new Form($db);
385 
386 if ($object->fk_user_creat) {
387  $userstatic = new User($db);
388  $userstatic->fetch($object->fk_user_creat);
389 }
390 
391 $result = $object->fetch(0, $numsondage);
392 if ($result <= 0)
393 {
394  dol_print_error($db, $object->error);
395  exit;
396 }
397 
398 $title = $object->title." - ".$langs->trans('Card');
399 $helpurl = '';
400 $arrayofjs = array();
401 $arrayofcss = array('/opensurvey/css/style.css');
402 llxHeader('', $title, $helpurl, 0, 0, 0, $arrayofjs, $arrayofcss);
403 
404 
405 // Define format of choices
406 $toutsujet = explode(",", $object->sujet);
407 $listofanswers = array();
408 foreach ($toutsujet as $value)
409 {
410  $tmp = explode('@', $value);
411  $listofanswers[] = array('label'=>$tmp[0], 'format'=>($tmp[1] ? $tmp[1] : 'checkbox'));
412 }
413 $toutsujet = str_replace("@", "<br>", $toutsujet);
414 $toutsujet = str_replace("°", "'", $toutsujet);
415 
416 
417 print '<form name="formulaire4" action="#" method="POST">'."\n";
418 print '<input type="hidden" name="token" value="'.newToken().'">';
419 
420 $head = opensurvey_prepare_head($object);
421 
422 print dol_get_fiche_head($head, 'preview', $langs->trans("Survey"), -1, 'poll');
423 
424 $morehtmlref = '';
425 
426 $linkback = '<a href="'.DOL_URL_ROOT.'/opensurvey/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
427 
428 dol_banner_tab($object, 'id', $linkback, 1, 'id_sondage', 'id_sondage', $morehtmlref);
429 
430 
431 print '<div class="fichecenter">';
432 print '<div class="underbanner clearboth"></div>';
433 
434 print '<table class="border tableforfield centpercent">';
435 
436 // Type
437 $type = ($object->format == "A") ? 'classic' : 'date';
438 print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td colspan="2">';
439 print img_picto('', dol_buildpath('/opensurvey/img/'.($type == 'classic' ? 'chart-32.png' : 'calendar-32.png'), 1), 'width="16"', 1);
440 print ' '.$langs->trans($type == 'classic' ? "TypeClassic" : "TypeDate").'</td></tr>';
441 
442 // Title
443 print '<tr><td>';
444 $adresseadmin = $object->mail_admin;
445 print $langs->trans("Title").'</td><td colspan="2">';
446 if ($action == 'edit') {
447  print '<input type="text" name="nouveautitre" size="40" value="'.dol_escape_htmltag(dol_htmlentities($object->title)).'">';
448 } else {
449  print dol_htmlentities($object->title);
450 }
451 print '</td></tr>';
452 
453 // Expire date
454 print '<tr><td>'.$langs->trans('ExpireDate').'</td><td colspan="2">';
455 if ($action == 'edit') print $form->selectDate($expiredate ? $expiredate : $object->date_fin, 'expire', 0, 0, 0, '', 1, 0);
456 else {
457  print dol_print_date($object->date_fin, 'day');
458  if ($object->date_fin && $object->date_fin < dol_now() && $object->status == Opensurveysondage::STATUS_VALIDATED) print img_warning($langs->trans("Expired"));
459 }
460 print '</td></tr>';
461 
462 // Author
463 print '<tr><td>';
464 print $langs->trans("Author").'</td><td colspan="2">';
465 if ($object->fk_user_creat) {
466  print $userstatic->getLoginUrl(1);
467 } else {
468  print dol_htmlentities($object->nom_admin);
469 }
470 print '</td></tr>';
471 
472 // Link
473 print '<tr><td>'.img_picto('', 'globe').' '.$langs->trans("UrlForSurvey", '').'</td><td colspan="2">';
474 
475 // Define $urlwithroot
476 $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
477 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
478 //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
479 
480 $url = $urlwithouturlroot.dol_buildpath('/public/opensurvey/studs.php', 1).'?sondage='.$object->id_sondage;
481 $urllink = '<input type="text" style="width: 60%" '.($action == 'edit' ? 'disabled' : '').' id="opensurveyurl" name="opensurveyurl" value="'.$url.'">';
482 print $urllink;
483 if ($action != 'edit')
484 {
485  print '<script type="text/javascript">
486  jQuery(document).ready(function () {
487  jQuery("#opensurveyurl").click(function() { jQuery(this).select(); } );
488  });
489  </script>';
490  print ' <a href="'.$url.'" target="_blank">'.$langs->trans("Link").'</a>';
491 }
492 
493 print '</td></tr>';
494 
495 print '</table>';
496 
497 print '</div>';
498 
500 
501 print '</form>'."\n";
502 
503 
504 // Buttons
505 
506 print '<div class="tabsAction">';
507 
508 print '<a class="butAction" href="exportcsv.php?id='.urlencode($numsondage).'">'.$langs->trans("ExportSpreadsheet").' (.CSV)</a>';
509 
510 print '</div>';
511 
512 
513 // Show form to add a new field/column
514 if (GETPOST('ajoutsujet'))
515 {
516  // Security check
517  if (!$user->rights->opensurvey->write) accessforbidden();
518 
519  print '<form name="formulaire" action="" method="POST">'."\n";
520  print '<input type="hidden" name="token" value="'.newToken().'">';
521  print '<input type="hidden" name="backtopage" value="'.GETPOST('backtopage', 'alpha').'">';
522 
523  print '<div class="center">'."\n";
524  print "<br><br>\n";
525 
526  // Add new column
527  if ($object->format == "A")
528  {
529  print $langs->trans("AddNewColumn").':<br><br>';
530  print $langs->trans("Title").' <input type="text" name="nouvellecolonne" size="40"><br>';
531  $tmparray = array('checkbox'=>$langs->trans("CheckBox"), 'yesno'=>$langs->trans("YesNoList"), 'foragainst'=>$langs->trans("PourContreList"));
532  print $langs->trans("Type").' '.$form->selectarray("typecolonne", $tmparray, GETPOST('typecolonne')).'<br><br>';
533  print '<input type="submit" class="button" name="ajoutercolonne" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
534  print ' &nbsp; &nbsp; ';
535  print '<input type="submit" class="button button-cancel" name="retoursondage" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
536  print '<br><br>'."\n";
537  } else {
538  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
539 
540  $formother = new FormOther($db);
541  //ajout d'une date avec creneau horaire
542  print $langs->trans("AddADate").':<br><br>'."\n";
543  print '<select name="nouveaujour"> '."\n";
544  print '<OPTION VALUE="vide">&nbsp;</OPTION>'."\n";
545  for ($i = 1; $i < 32; $i++) {
546  print '<OPTION VALUE="'.$i.'">'.$i.'</OPTION>'."\n";
547  }
548  print '</select>'."\n";
549 
550  print $formother->select_month('', 'nouveaumois', 1);
551 
552  print '&nbsp;';
553 
554  print $formother->select_year('', 'nouvelleannee', 1, 0, 5, 0, 1);
555 
556  print '<br><br>'.$langs->trans("AddStartHour").': <br><br>'."\n";
557  print '<select name="nouvelleheuredebut"> '."\n";
558  print '<OPTION VALUE="vide">&nbsp;</OPTION>'."\n";
559  for ($i = 0; $i < 24; $i++) {
560  print '<OPTION VALUE="'.$i.'">'.$i.' H</OPTION>'."\n";
561  }
562  print '</select>'."\n";
563  print '<select name="nouvelleminutedebut"> '."\n";
564  print '<OPTION VALUE="vide">&nbsp;</OPTION>'."\n";
565  print '<OPTION VALUE="00">00</OPTION>'."\n";
566  print '<OPTION VALUE="15">15</OPTION>'."\n";
567  print '<OPTION VALUE="30">30</OPTION>'."\n";
568  print '<OPTION VALUE="45">45</OPTION>'."\n";
569  print '</select>'."\n";
570  print '<br><br>'.$langs->trans("AddEndHour").': <br><br>'."\n";
571  print '<select name="nouvelleheurefin"> '."\n";
572  print '<OPTION VALUE="vide">&nbsp;</OPTION>'."\n";
573  for ($i = 0; $i < 24; $i++) {
574  print '<OPTION VALUE="'.$i.'">'.$i.' H</OPTION>'."\n";
575  }
576  print '</SELECT>'."\n";
577  print '<select name="nouvelleminutefin"> '."\n";
578  print '<OPTION VALUE="vide">&nbsp;</OPTION>'."\n";
579  print '<OPTION VALUE="00">00</OPTION>'."\n";
580  print '<OPTION VALUE="15">15</OPTION>'."\n";
581  print '<OPTION VALUE="30">30</OPTION>'."\n";
582  print '<OPTION VALUE="45">45</OPTION>'."\n";
583  print '</select>'."\n";
584 
585  print '<br><br>';
586  print' <input type="submit" class="button" name="ajoutercolonne" value="'.dol_escape_htmltag($langs->trans("Add")).'">'."\n";
587  print '&nbsp; &nbsp;';
588  print '<input type="submit" class="button button-cancel" name="retoursondage" value="'.$langs->trans("Cancel").'">';
589  }
590 
591  print '</form>'."\n";
592  print '<br><br><br><br>'."\n";
593  print '</div>'."\n";
594 
595  exit;
596 }
597 
598 if ($user->rights->opensurvey->write) {
599  print '<span class="opacitymedium">'.$langs->trans("PollAdminDesc", img_picto('', 'delete'), $langs->trans("Add")).'</span><br>';
600 }
601 
602 $nbcolonnes = substr_count($object->sujet, ',') + 1;
603 
604 print '<form name="formulaire" action="" method="POST">'."\n";
605 print '<input type="hidden" name="token" value="'.newToken().'">';
606 
607 print '<div class="cadre"> '."\n";
608 
609 // Start to show survey result
610 print '<table class="resultats">'."\n";
611 
612 //reformatage des données des sujets du sondage
613 $toutsujet = explode(",", $object->sujet);
614 $toutsujet = str_replace("°", "'", $toutsujet);
615 
616 print '<tr>'."\n";
617 print '<td></td>'."\n";
618 print '<td></td>'."\n";
619 
620 // loop to show the delete link
621 if ($user->rights->opensurvey->write) {
622  for ($i = 0; isset($toutsujet[$i]); $i++) {
623  print '<td class=somme><input type="image" name="effacecolonne'.$i.'" src="'.img_picto('', 'delete.png', '', false, 1).'"></td>'."\n";
624  }
625 }
626 
627 print '</tr>'."\n";
628 
629 
630 // Show choice titles
631 if ($object->format == "D")
632 {
633  //affichage des sujets du sondage
634  print '<tr>'."\n";
635  print '<td></td>'."\n";
636  print '<td></td>'."\n";
637 
638  //affichage des années
639  $colspan = 1;
640  $nbofsujet = count($toutsujet);
641  for ($i = 0; $i < $nbofsujet; $i++)
642  {
643  $current = $toutsujet[$i];
644 
645  if (strpos($toutsujet[$i], '@') !== false) {
646  $current = substr($toutsujet[$i], 0, strpos($toutsujet[$i], '@'));
647  }
648 
649  if (isset($toutsujet[$i + 1]) && strpos($toutsujet[$i + 1], '@') !== false) {
650  $next = substr($toutsujet[$i + 1], 0, strpos($toutsujet[$i + 1], '@'));
651  } elseif (isset($toutsujet[$i + 1])) {
652  $next = $toutsujet[$i + 1];
653  }
654 
655  $currenty = 0;
656  if ($current) $currenty = strftime("%Y", $current);
657  $next = 0;
658  if ($next) $nexty = strftime("%Y", $next);
659  if (isset($toutsujet[$i + 1]) && ($currenty == $nexty))
660  {
661  $colspan++;
662  } else {
663  print '<td colspan='.$colspan.' class="annee">';
664  if ($current) print strftime("%Y", $current);
665  print '</td>'."\n";
666  $colspan = 1;
667  }
668  }
669 
670  if ($user->rights->opensurvey->write) {
671  print '<td class="annee">';
672  print '<a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&id='.$object->id_sondage.'">'.$langs->trans("Add").'</a></td>'."\n";
673  }
674 
675  print '</tr>'."\n";
676  print '<tr>'."\n";
677  print '<td></td>'."\n";
678  print '<td></td>'."\n";
679 
680  //affichage des mois
681  $colspan = 1;
682  for ($i = 0; $i < $nbofsujet; $i++) {
683  $cur = intval($toutsujet[$i]); // intval() est utiliser pour supprimer le suffixe @* qui déplaît logiquement à strftime()
684 
685  if (isset($toutsujet[$i + 1]) === false) {
686  $next = false;
687  } else {
688  $next = intval($toutsujet[$i + 1]);
689  }
690 
691  if ($next && dol_print_date($cur, "%B") == dol_print_date($next, "%B") && dol_print_date($cur, "%Y") == dol_print_date($next, "%Y")) {
692  $colspan++;
693  } else {
694  print '<td colspan='.$colspan.' class="mois">'.dol_print_date($cur, "%B").'</td>'."\n";
695 
696  $colspan = 1;
697  }
698  }
699 
700  if ($user->rights->opensurvey->write) {
701  print '<td class="mois"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&id='.$object->id_sondage.'">'.$langs->trans("Add").'</a></td>'."\n";
702  }
703 
704  print '</tr>'."\n";
705  print '<tr>'."\n";
706  print '<td></td>'."\n";
707  print '<td></td>'."\n";
708 
709  //affichage des jours
710  $colspan = 1;
711  for ($i = 0; $i < $nbofsujet; $i++) {
712  $cur = intval($toutsujet[$i]);
713  if (isset($toutsujet[$i + 1]) === false) {
714  $next = false;
715  } else {
716  $next = intval($toutsujet[$i + 1]);
717  }
718  if ($next && dol_print_date($cur, "%a %e") == dol_print_date($next, "%a %e") && dol_print_date($cur, "%B") == dol_print_date($next, "%B")) {
719  $colspan++;
720  } else {
721  print '<td colspan='.$colspan.' class="jour">'.dol_print_date($cur, "%a %e").'</td>'."\n";
722 
723  $colspan = 1;
724  }
725  }
726 
727  if ($user->rights->opensurvey->write) {
728  print '<td class="jour"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&id='.$object->id_sondage.'">'.$langs->trans("Add").'</a></td>'."\n";
729  }
730  print '</tr>'."\n";
731 
732  //affichage des horaires
733  if (strpos($object->sujet, '@') !== false) {
734  print '<tr>'."\n";
735  print '<td></td>'."\n";
736  print '<td></td>'."\n";
737 
738  for ($i = 0; isset($toutsujet[$i]); $i++) {
739  $heures = explode('@', $toutsujet[$i]);
740  if (isset($heures[1])) {
741  print '<td class="heure">'.dol_htmlentities($heures[1]).'</td>'."\n";
742  } else {
743  print '<td class="heure"></td>'."\n";
744  }
745  }
746 
747  if ($user->rights->opensurvey->write) {
748  print '<td class="heure"><a href="'.$_SERVER["PHP_SELF"].'?ajoutsujet=1&id='.$object->id_sondage.'">'.$langs->trans("Add").'</a></td>'."\n";
749  }
750 
751  print '</tr>'."\n";
752  }
753 } else {
754  // Show titles
755  print '<tr>'."\n";
756  print '<td></td>'."\n";
757  print '<td></td>'."\n";
758 
759  for ($i = 0; isset($toutsujet[$i]); $i++)
760  {
761  $tmp = explode('@', $toutsujet[$i]);
762  print '<td class="sujet">'.dol_htmlentities($tmp[0]).'</td>'."\n";
763  }
764 
765  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";
766  print '</tr>'."\n";
767 }
768 
769 
770 // Loop on each answer
771 $sumfor = array();
772 $sumagainst = array();
773 $compteur = 0;
774 $sql = "SELECT id_users, nom as name, id_sondage, reponses";
775 $sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_user_studs";
776 $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'";
777 dol_syslog('sql='.$sql);
778 $resql = $db->query($sql);
779 if (!$resql)
780 {
781  dol_print_error($db);
782  exit;
783 }
784 $num = $db->num_rows($resql);
785 while ($compteur < $num)
786 {
787  $obj = $db->fetch_object($resql);
788 
789  $ensemblereponses = $obj->reponses;
790 
791  print '<tr><td>'."\n";
792 
793  if ($user->rights->opensurvey->write) {
794  print '<input type="image" name="effaceligne'.$compteur.'" src="'.img_picto('', 'delete.png', '', false, 1).'">'."\n";
795  }
796 
797  // Name
798  print '</td><td class="nom">'.dol_htmlentities($obj->name).'</td>'."\n";
799 
800  // si la ligne n'est pas a changer, on affiche les données
801  if (!$testligneamodifier)
802  {
803  for ($i = 0; $i < $nbcolonnes; $i++)
804  {
805  $car = substr($ensemblereponses, $i, 1);
806  //print 'xx'.$i."-".$car.'-'.$listofanswers[$i]['format'].'zz';
807 
808  if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')))
809  {
810  if (((string) $car) == "1") print '<td class="ok">OK</td>'."\n";
811  else print '<td class="non">KO</td>'."\n";
812  // Total
813  if (!isset($sumfor[$i])) $sumfor[$i] = 0;
814  if (((string) $car) == "1") $sumfor[$i]++;
815  }
816  if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
817  {
818  if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("Yes").'</td>'."\n";
819  elseif (((string) $car) == "0") print '<td class="non">'.$langs->trans("No").'</td>'."\n";
820  else print '<td class="vide">&nbsp;</td>'."\n";
821  // Total
822  if (!isset($sumfor[$i])) $sumfor[$i] = 0;
823  if (!isset($sumagainst[$i])) $sumagainst[$i] = 0;
824  if (((string) $car) == "1") $sumfor[$i]++;
825  if (((string) $car) == "0") $sumagainst[$i]++;
826  }
827  if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst')
828  {
829  if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n";
830  elseif (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n";
831  else print '<td class="vide">&nbsp;</td>'."\n";
832  // Total
833  if (!isset($sumfor[$i])) $sumfor[$i] = 0;
834  if (!isset($sumagainst[$i])) $sumagainst[$i] = 0;
835  if (((string) $car) == "1") $sumfor[$i]++;
836  if (((string) $car) == "0") $sumagainst[$i]++;
837  }
838  }
839  } else {
840  //sinon on remplace les choix de l'utilisateur par une ligne de checkbox pour recuperer de nouvelles valeurs
841  if ($compteur == $ligneamodifier)
842  {
843  for ($i = 0; $i < $nbcolonnes; $i++)
844  {
845  $car = substr($ensemblereponses, $i, 1);
846  print '<td class="vide">';
847  if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')))
848  {
849  print '<input type="checkbox" name="choix'.$i.'" value="1" ';
850  if ($car == '1') print 'checked';
851  print '>';
852  }
853  if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
854  {
855  $arraychoice = array('2'=>'&nbsp;', '0'=>$langs->trans("No"), '1'=>$langs->trans("Yes"));
856  print $form->selectarray("choix".$i, $arraychoice, $car);
857  }
858  if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst')
859  {
860  $arraychoice = array('2'=>'&nbsp;', '0'=>$langs->trans("Against"), '1'=>$langs->trans("For"));
861  print $form->selectarray("choix".$i, $arraychoice, $car);
862  }
863  print '</td>'."\n";
864  }
865  } else {
866  for ($i = 0; $i < $nbcolonnes; $i++)
867  {
868  $car = substr($ensemblereponses, $i, 1);
869  if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')))
870  {
871  if (((string) $car) == "1") print '<td class="ok">OK</td>'."\n";
872  else print '<td class="non">KO</td>'."\n";
873  // Total
874  if (!isset($sumfor[$i])) $sumfor[$i] = 0;
875  if (((string) $car) == "1") $sumfor[$i]++;
876  }
877  if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
878  {
879  if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n";
880  elseif (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n";
881  else print '<td class="vide">&nbsp;</td>'."\n";
882  // Total
883  if (!isset($sumfor[$i])) $sumfor[$i] = 0;
884  if (!isset($sumagainst[$i])) $sumagainst[$i] = 0;
885  if (((string) $car) == "1") $sumfor[$i]++;
886  if (((string) $car) == "0") $sumagainst[$i]++;
887  }
888  if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst')
889  {
890  if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n";
891  elseif (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n";
892  else print '<td class="vide">&nbsp;</td>'."\n";
893  // Total
894  if (!isset($sumfor[$i])) $sumfor[$i] = 0;
895  if (!isset($sumagainst[$i])) $sumagainst[$i] = 0;
896  if (((string) $car) == "1") $sumfor[$i]++;
897  if (((string) $car) == "0") $sumagainst[$i]++;
898  }
899  }
900  }
901  }
902 
903  // Button edit at end of line
904  if ($compteur != $ligneamodifier && ($user->rights->opensurvey->write))
905  {
906  print '<td class="casevide"><input type="submit" class="button" name="modifierligne'.$compteur.'" value="'.dol_escape_htmltag($langs->trans("Edit")).'"></td>'."\n";
907  }
908 
909  //demande de confirmation pour modification de ligne
910  for ($i = 0; $i < $nblines; $i++)
911  {
912  if (GETPOSTISSET("modifierligne".$i))
913  {
914  if ($compteur == $i)
915  {
916  print '<td class="casevide">';
917  print '<input type="hidden" name="idtomodify'.$compteur.'" value="'.$obj->id_users.'">';
918  print '<input type="submit" class="button button-save" name="validermodifier'.$compteur.'" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
919  print '</td>'."\n";
920  }
921  }
922  }
923 
924  $compteur++;
925  print '</tr>'."\n";
926 }
927 
928 // Add line to add new record
929 if (empty($testligneamodifier))
930 {
931  print '<tr>'."\n";
932  print '<td></td>'."\n";
933  print '<td class="nom">'."\n";
934  print '<input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Name")).'" name="nom" maxlength="64" size="24">'."\n";
935  print '</td>'."\n";
936 
937  for ($i = 0; $i < $nbcolonnes; $i++)
938  {
939  print '<td class="vide">';
940  if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')))
941  {
942  print '<input type="checkbox" name="choix'.$i.'" value="1"';
943  if (GETPOSTISSET('choix'.$i) && GETPOST('choix'.$i) == '1')
944  {
945  print ' checked';
946  }
947  print '>';
948  }
949  if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
950  {
951  $arraychoice = array('2'=>'&nbsp;', '0'=>$langs->trans("No"), '1'=>$langs->trans("Yes"));
952  print $form->selectarray("choix".$i, $arraychoice);
953  }
954  if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst')
955  {
956  $arraychoice = array('2'=>'&nbsp;', '0'=>$langs->trans("Against"), '1'=>$langs->trans("For"));
957  print $form->selectarray("choix".$i, $arraychoice);
958  }
959  print '</td>'."\n";
960  }
961 
962  // Affichage du bouton de formulaire pour inscrire un nouvel utilisateur dans la base
963  print '<td><input type="image" name="boutonp" class="borderimp" value="'.$langs->trans("Vote").'" src="'.img_picto('', 'edit_add', '', false, 1).'"></td>'."\n";
964  print '</tr>'."\n";
965 }
966 
967 // Select value of best choice (for checkbox columns only)
968 $nbofcheckbox = 0;
969 for ($i = 0; $i < $nbcolonnes + 1; $i++)
970 {
971  if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')))
972  $nbofcheckbox++;
973  if (isset($sumfor[$i]))
974  {
975  if ($i == 0)
976  {
977  $meilleurecolonne = $sumfor[$i];
978  }
979  if (isset($sumfor[$i]) && $sumfor[$i] > $meilleurecolonne)
980  {
981  $meilleurecolonne = $sumfor[$i];
982  }
983  }
984 }
985 
986 
987 // Show line total
988 print '<tr>'."\n";
989 print '<td></td>'."\n";
990 print '<td class="center">'.$langs->trans("Total").'</td>'."\n";
991 for ($i = 0; $i < $nbcolonnes; $i++)
992 {
993  $showsumfor = isset($sumfor[$i]) ? $sumfor[$i] : '';
994  $showsumagainst = isset($sumagainst[$i]) ? $sumagainst[$i] : '';
995  if (empty($showsumfor)) $showsumfor = 0;
996  if (empty($showsumagainst)) $showsumagainst = 0;
997 
998  print '<td>';
999  if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) print $showsumfor;
1000  if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') print $langs->trans("Yes").': '.$showsumfor.'<br>'.$langs->trans("No").': '.$showsumagainst;
1001  if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') print $langs->trans("For").': '.$showsumfor.'<br>'.$langs->trans("Against").': '.$showsumagainst;
1002  print '</td>'."\n";
1003 }
1004 print '</tr>';
1005 // Show picto winner
1006 if ($nbofcheckbox >= 2)
1007 {
1008  print '<tr>'."\n";
1009  print '<td></td>'."\n";
1010  print '<td></td>'."\n";
1011  for ($i = 0; $i < $nbcolonnes; $i++) {
1012  if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')) && isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne)
1013  {
1014  print '<td class="somme"><img src="'.dol_buildpath('/opensurvey/img/medaille.png', 1).'"></td>'."\n";
1015  } else {
1016  print '<td class="somme"></td>'."\n";
1017  }
1018  }
1019  print '</tr>'."\n";
1020 }
1021 
1022 // S'il a oublié de remplir un nom
1023 if (GETPOSTISSET("boutonp") && GETPOST("nom") == "") {
1024  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")), null, 'errors');
1025 }
1026 
1027 if (isset($erreur_prenom) && $erreur_prenom) {
1028  setEventMessages($langs->trans('VoteNameAlreadyExists'), null, 'errors');
1029 }
1030 
1031 if (isset($erreur_ajout_date) && $erreur_ajout_date) {
1032  setEventMessages($langs->trans("ErrorWrongDate"), null, 'errors');
1033 }
1034 
1035 //fin du tableau
1036 print '</table>'."\n";
1037 print '</div>'."\n";
1038 
1039 
1040 $toutsujet = explode(",", $object->sujet); // With old versions, this field was not set
1041 
1042 $compteursujet = 0;
1043 $meilleursujet = '';
1044 for ($i = 0; $i < $nbcolonnes; $i++)
1045 {
1046  if (isset($sumfor[$i]) === true && isset($meilleurecolonne) === true && $sumfor[$i] == $meilleurecolonne)
1047  {
1048  $meilleursujet .= ", ";
1049 
1050  if ($object->format == "D") {
1051  $meilleursujetexport = $toutsujet[$i];
1052  //var_dump($toutsujet);
1053  if (strpos($toutsujet[$i], '@') !== false) {
1054  $toutsujetdate = explode("@", $toutsujet[$i]);
1055  $meilleursujet .= dol_print_date($toutsujetdate[0], 'daytext').($toutsujetdate[0] ? ' ('.dol_print_date($toutsujetdate[0], '%A').')' : '').' - '.$toutsujetdate[1];
1056  } else {
1057  $meilleursujet .= dol_print_date($toutsujet[$i], 'daytext').($toutsujet[$i] ? ' ('.dol_print_date($toutsujet[$i], '%A').')' : '');
1058  }
1059  } else {
1060  $tmps = explode('@', $toutsujet[$i]);
1061  $meilleursujet .= dol_htmlentities($tmps[0]);
1062  }
1063 
1064  $compteursujet++;
1065  }
1066 }
1067 $meilleursujet = substr($meilleursujet, 1);
1068 $meilleursujet = str_replace("°", "'", $meilleursujet);
1069 
1070 // Show best choice
1071 if ($nbofcheckbox >= 2)
1072 {
1073  $vote_str = $langs->trans('votes');
1074  print '<p class="affichageresultats">'."\n";
1075 
1076  if (isset($meilleurecolonne) && $compteursujet == "1") {
1077  print "<img src=\"".DOL_URL_ROOT.'/opensurvey/img/medaille.png'."\"> ".$langs->trans('TheBestChoice').": <b>".$meilleursujet." </b>".$langs->trans("with")." <b>".$meilleurecolonne."</b> ".$vote_str.".\n";
1078  } elseif (isset($meilleurecolonne)) {
1079  print "<img src=\"".DOL_URL_ROOT.'/opensurvey/img/medaille.png'."\"> ".$langs->trans('TheBestChoices').": <b>".$meilleursujet." </b>".$langs->trans("with")." <b>".$meilleurecolonne."</b> ".$vote_str.".\n";
1080  }
1081  print '<br></p><br>'."\n";
1082 }
1083 
1084 print '</form>'."\n";
1085 
1086 print '<a name="bas"></a>'."\n";
1087 
1088 llxFooter();
1089 
1090 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_now($mode= 'auto')
Return date for now.
Class to manage Dolibarr users.
Definition: user.class.php:44
dol_htmlentities($string, $flags=null, $encoding= 'UTF-8', $double_encode=false)
Replace htmlentities functions.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
llxHeader()
Empty header.
Definition: wrapper.php:45
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage generation of HTML components Only common components must be here.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it&#39;s its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
Classe permettant la generation de composants html autre Only common components are here...
const STATUS_VALIDATED
Validated/Opened status.
if(!GETPOST('transkey', 'alphanohtml')&&!GETPOST('transphrase', 'alphanohtml')) else
View.
Definition: notice.php:44
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Put here description of your class.
print $_SERVER["PHP_SELF"]
Edit parameters.
opensurvey_prepare_head(Opensurveysondage $object)
Returns an array with the tabs for the &quot;Opensurvey poll&quot; section It loads tabs from modules looking f...
Definition: fonctions.php:32
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
Definition: index.php:89
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1232
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
print $_SERVER["PHP_SELF"] n
Edit parameters.
Definition: categories.php:101
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.
llxFooter()
Empty footer.
Definition: wrapper.php:59
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...