27require
'../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
29require_once DOL_DOCUMENT_ROOT.
"/core/lib/files.lib.php";
30require_once DOL_DOCUMENT_ROOT.
"/opensurvey/class/opensurveysondage.class.php";
31require_once DOL_DOCUMENT_ROOT.
"/opensurvey/lib/opensurvey.lib.php";
34if (empty($user->rights->opensurvey->read)) {
39$action =
GETPOST(
'action',
'aZ09');
40$numsondage =
GETPOST(
"id",
'alphanohtml');
43$result = $object->fetch(0, $numsondage);
48$nblines = $object->fetch_lines();
57 header(
'Location: results.php?id='.(GETPOSTISSET(
'id_sondage') ?
GETPOST(
'id_sondage',
'aZ09') :
GETPOST(
'id',
'alphanohtml')));
61$nbcolonnes = substr_count($object->sujet,
',') + 1;
66 $erreur_prenom =
false;
69 for ($i = 0; $i < $nbcolonnes; $i++) {
70 if (GETPOSTISSET(
"choix$i") &&
GETPOST(
"choix$i") ==
'1') {
72 } elseif (GETPOSTISSET(
"choix$i") &&
GETPOST(
"choix$i") ==
'2') {
79 $nom = substr(
GETPOST(
"nom",
'alphanohtml'), 0, 64);
82 $sql =
'SELECT id_users, nom as name';
83 $sql .=
' FROM '.MAIN_DB_PREFIX.
'opensurvey_user_studs';
84 $sql .=
" WHERE id_sondage='".$db->escape($numsondage).
"' AND nom = '".$db->escape($nom).
"'";
85 $sql .=
' ORDER BY id_users';
86 $resql = $db->query($sql);
87 $num_rows = $db->num_rows($resql);
92 $sql =
'INSERT INTO '.MAIN_DB_PREFIX.
'opensurvey_user_studs (nom, id_sondage, reponses)';
93 $sql .=
" VALUES ('".$db->escape($nom).
"', '".$db->escape($numsondage).
"','".$db->escape($nouveauchoix).
"')";
94 $resql = $db->query($sql);
103$testmodifier =
false;
104$testligneamodifier =
false;
106for ($i = 0; $i < $nblines; $i++) {
107 if (GETPOSTISSET(
'modifierligne'.$i)) {
108 $ligneamodifier = $i;
109 $testligneamodifier =
true;
113 if (GETPOSTISSET(
'validermodifier'.$i)) {
115 $testmodifier =
true;
120 if (!$user->rights->opensurvey->write) {
125 for ($i = 0; $i < $nbcolonnes; $i++) {
126 if (GETPOSTISSET(
"choix$i") &&
GETPOST(
"choix$i") ==
'1') {
127 $nouveauchoix .=
"1";
128 } elseif (GETPOSTISSET(
"choix$i") &&
GETPOST(
"choix$i") ==
'2') {
129 $nouveauchoix .=
"2";
131 $nouveauchoix .=
"0";
135 $idtomodify =
GETPOST(
"idtomodify".$modifier);
136 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_user_studs";
137 $sql .=
" SET reponses = '".$db->escape($nouveauchoix).
"'";
138 $sql .=
" WHERE id_users = '".$db->escape($idtomodify).
"'";
140 $resql = $db->query($sql);
147if (
GETPOST(
"ajoutercolonne") &&
GETPOST(
'nouvellecolonne') && $object->format ==
"A") {
149 if (!$user->rights->opensurvey->write) {
153 $nouveauxsujets = $object->sujet;
156 $nouveauxsujets .=
',';
157 $nouveauxsujets .= str_replace(array(
",",
"@"),
" ",
GETPOST(
"nouvellecolonne")).(!
GETPOST(
"typecolonne") ?
'' :
'@'.GETPOST(
"typecolonne"));
160 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_sondage";
161 $sql .=
" SET sujet = '".$db->escape($nouveauxsujets).
"'";
162 $sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
163 $resql = $db->query($sql);
167 header(
'Location: results.php?id='.$object->id_sondage);
172if (GETPOSTISSET(
"ajoutercolonne") && $object->format ==
"D") {
174 if (!$user->rights->opensurvey->write) {
178 $nouveauxsujets = $object->sujet;
180 if (GETPOSTISSET(
"nouveaujour") &&
GETPOST(
"nouveaujour") !=
"vide" &&
181 GETPOSTISSET(
"nouveaumois") &&
GETPOST(
"nouveaumois") !=
"vide" &&
182 GETPOSTISSET(
"nouvelleannee") &&
GETPOST(
"nouvelleannee") !=
"vide") {
185 if (GETPOSTISSET(
"nouvelleheuredebut") &&
GETPOST(
"nouvelleheuredebut") !=
"vide") {
186 $nouvelledate .=
"@";
187 $nouvelledate .=
GETPOST(
"nouvelleheuredebut");
188 $nouvelledate .=
"h";
190 if (
GETPOST(
"nouvelleminutedebut") !=
"vide") {
191 $nouvelledate .=
GETPOST(
"nouvelleminutedebut");
195 if (GETPOSTISSET(
"nouvelleheurefin") &&
GETPOST(
"nouvelleheurefin") !=
"vide") {
196 $nouvelledate .=
"-";
197 $nouvelledate .=
GETPOST(
"nouvelleheurefin");
198 $nouvelledate .=
"h";
200 if (
GETPOST(
"nouvelleminutefin") !=
"vide") {
201 $nouvelledate .=
GETPOST(
"nouvelleminutefin");
205 if (
GETPOST(
"nouvelleheuredebut") ==
"vide" || (GETPOSTISSET(
"nouvelleheuredebut") && GETPOSTISSET(
"nouvelleheurefin")
207 && (
GETPOST(
"nouvelleminutedebut") <
GETPOST(
"nouvelleminutefin")))))) {
208 $erreur_ajout_date =
false;
210 $erreur_ajout_date =
"yes";
214 $datesbase = explode(
",", $object->sujet);
215 $taillebase = count($datesbase);
218 if ($nouvelledate < $datesbase[0]) {
220 } elseif ($nouvelledate > $datesbase[$taillebase - 1]) {
221 $cleinsertion = count($datesbase);
223 $nbdatesbase = count($datesbase);
224 for ($i = 0; $i < $nbdatesbase; $i++) {
226 if ($nouvelledate > $datesbase[$i] && $nouvelledate < $datesbase[$j]) {
232 array_splice($datesbase, $cleinsertion, 0, $nouvelledate);
233 $cle = array_search($nouvelledate, $datesbase);
235 $nbofdates = count($datesbase);
236 for ($i = 0; $i < $nbofdates; $i++) {
237 $dateinsertion .=
",";
238 $dateinsertion .= $datesbase[$i];
241 $dateinsertion = substr(
"$dateinsertion", 1);
244 if (isset($erreur_ajout_date) && empty($erreur_ajout_date)) {
245 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_sondage";
246 $sql .=
" SET sujet = '".$db->escape($dateinsertion).
"'";
247 $sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
248 $resql = $db->query($sql);
252 header(
'Location: results.php?id='.$object->id_sondage);
255 if ($cleinsertion >= 0) {
256 $sql =
'SELECT s.reponses';
257 $sql .=
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs as s";
258 $sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
259 $resql = $db->query($sql);
263 $num = $db->num_rows($resql);
265 while ($compteur < $num) {
266 $obj = $db->fetch_object($resql);
267 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_user_studs";
268 if ($cleinsertion == 0) {
269 $sql .=
" SET reponses = '0".$db->escape($obj->reponses).
"'";
271 $reponsesadd = str_split($obj->reponses);
272 $lengthresponses = count($reponsesadd);
273 for ($cpt = $lengthresponses; $cpt > $cleinsertion; $cpt--) {
274 $reponsesadd[$cpt] = $reponsesadd[$cpt-1];
276 $reponsesadd[$cleinsertion] =
'0';
277 $reponsesadd = implode($reponsesadd);
278 $sql .=
" SET reponses = '".$db->escape($reponsesadd).
"'";
280 $sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
281 $resql = $db->query($sql);
289 $adresseadmin = $object->mail_admin;
291 $erreur_ajout_date =
"yes";
296for ($i = 0; $i < $nblines; $i++) {
299 if (!$user->rights->opensurvey->write) {
307 $sql =
"SELECT id_users, nom as name, id_sondage, reponses";
308 $sql .=
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs";
309 $sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
310 $resql = $db->query($sql);
314 $num = $db->num_rows($resql);
315 while ($compteur < $num) {
316 $obj = $db->fetch_object($resql);
318 if ($compteur == $i) {
319 $sql2 =
'DELETE FROM '.MAIN_DB_PREFIX.
'opensurvey_user_studs';
320 $sql2 .=
" WHERE id_users = ".((int) $obj->id_users);
321 $resql2 = $db->query($sql2);
330for ($i = 0; $i < $nbcolonnes; $i++) {
331 if ((
GETPOST(
"effacecolonne".$i) ||
GETPOST(
"effacecolonne".$i.
"_x") ||
GETPOST(
"effacecolonne".$i.
".x"))
332 && $nbcolonnes > 1) {
334 if (!$user->rights->opensurvey->write) {
340 $toutsujet = explode(
",", $object->sujet);
342 $nouveauxsujets =
'';
345 while (isset($toutsujet[$j])) {
348 if (!empty($nouveauxsujets)) {
349 $nouveauxsujets .=
',';
351 $nouveauxsujets .= $toutsujet[$j];
358 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_sondage";
359 $sql .=
" SET sujet = '".$db->escape($nouveauxsujets).
"' WHERE id_sondage = '".$db->escape($numsondage).
"'";
360 $resql = $db->query($sql);
367 $sql =
"SELECT id_users, nom as name, id_sondage, reponses";
368 $sql .=
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs";
369 $sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
371 $resql = $db->query($sql);
376 $num = $db->num_rows($resql);
377 while ($compteur < $num) {
378 $obj = $db->fetch_object($resql);
381 $ensemblereponses = $obj->reponses;
384 for ($j = 0; $j < $nbcolonnes; $j++) {
385 $car = substr($ensemblereponses, $j, 1);
393 $sql2 =
'UPDATE '.MAIN_DB_PREFIX.
'opensurvey_user_studs';
394 $sql2 .=
" SET reponses = '".$db->escape($newcar).
"'";
395 $sql2 .=
" WHERE id_users = '".$db->escape($obj->id_users).
"'";
398 $resql2 = $db->query($sql2);
413$form =
new Form($db);
415if ($object->fk_user_creat) {
416 $userstatic =
new User($db);
417 $userstatic->fetch($object->fk_user_creat);
420$result = $object->fetch(0, $numsondage);
426$title = $object->title.
" - ".$langs->trans(
'Card');
429$arrayofcss = array(
'/opensurvey/css/style.css');
431llxHeader(
'', $title, $helpurl, 0, 0, 0, $arrayofjs, $arrayofcss);
435$toutsujet = explode(
",", $object->sujet);
436$listofanswers = array();
437foreach ($toutsujet as $value) {
438 $tmp = explode(
'@', $value);
439 $listofanswers[] = array(
'label'=>$tmp[0],
'format'=>(!empty($tmp[1]) ? $tmp[1] :
'checkbox'));
441$toutsujet = str_replace(
"@",
"<br>", $toutsujet);
442$toutsujet = str_replace(
"°",
"'", $toutsujet);
445print
'<form name="formulaire4" action="#" method="POST">'.
"\n";
446print
'<input type="hidden" name="token" value="'.newToken().
'">';
447print
'<input type="hidden" name="id" value="'.GETPOST(
'id').
'">';
449$head = opensurvey_prepare_head($object);
455$linkback =
'<a href="'.DOL_URL_ROOT.
'/opensurvey/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
457dol_banner_tab($object,
'id', $linkback, 1,
'id_sondage',
'id_sondage', $morehtmlref);
460print
'<div class="fichecenter">';
462print
'<div class="fichehalfleft">';
463print
'<div class="underbanner clearboth"></div>';
464print
'<table class="border tableforfield centpercent">';
467$type = ($object->format ==
"A") ?
'classic' :
'date';
468print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td>';
469print
img_picto(
'',
dol_buildpath(
'/opensurvey/img/'.($type ==
'classic' ?
'chart-32.png' :
'calendar-32.png'), 1),
'width="16"', 1);
470print
' '.$langs->trans($type ==
'classic' ?
"TypeClassic" :
"TypeDate").
'</td></tr>';
474$adresseadmin = $object->mail_admin;
475print $langs->trans(
"Title").
'</td><td>';
476if ($action ==
'edit') {
477 print
'<input type="text" name="nouveautitre" size="40" value="'.dol_escape_htmltag($object->title).
'">';
484print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td class="wordbreak">';
485if ($action ==
'edit') {
486 $doleditor =
new DolEditor(
'nouveauxcommentaires', $object->description,
'', 120,
'dolibarr_notes',
'In', 1, 1, 1, ROWS_7,
'90%');
487 $doleditor->Create(0,
'');
495if (!$object->fk_user_creat) {
496 print
'<tr><td>'.$langs->trans(
"EMail").
'</td><td>';
497 if ($action ==
'edit') {
498 print
'<input type="text" name="nouvelleadresse" class="minwith200" value="'.$object->mail_admin.
'">';
508print
'<div class="fichehalfright">';
509print
'<div class="underbanner clearboth"></div>';
511print
'<table class="border tableforfield centpercent">';
514print
'<tr><td>'.$langs->trans(
'ExpireDate').
'</td><td>';
515if ($action ==
'edit') {
516 print $form->selectDate($expiredate ? $expiredate : $object->date_fin,
'expire', 0, 0, 0,
'', 1, 0);
527print $langs->trans(
"Author").
'</td><td>';
528if ($object->fk_user_creat) {
529 print $userstatic->getLoginUrl(-1);
536print
'<tr><td>'.$langs->trans(
"UrlForSurvey",
'').
'</td><td>';
539$urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
540$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
543$url = $urlwithouturlroot.dol_buildpath(
'/public/opensurvey/studs.php', 1).
'?sondage='.$object->id_sondage;
544$urllink =
'<input type="text" class="quatrevingtpercent" '.($action ==
'edit' ?
'disabled' :
'').
' id="opensurveyurl" name="opensurveyurl" value="'.$url.
'">';
546if ($action !=
'edit') {
556print
'<div class="clearboth"></div>';
565print
'<div class="tabsAction">';
567print
'<a class="butAction" href="exportcsv.php?id='.urlencode($numsondage).
'">'.$langs->trans(
"ExportSpreadsheet").
' (.CSV)</a>';
575 if (!$user->rights->opensurvey->write) {
579 print
'<form name="formulaire" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
580 print
'<input type="hidden" name="token" value="'.newToken().
'">';
581 print
'<input type="hidden" name="backtopage" value="'.GETPOST(
'backtopage',
'alpha').
'">';
582 print
'<input type="hidden" name="id" value="'.GETPOST(
'id',
'alpha').
'">';
583 print
'<input type="hidden" name="ajoutsujet" value="1">';
585 print
'<div class="center">'.
"\n";
589 if ($object->format ==
"A") {
590 print $langs->trans(
"AddNewColumn").
':<br><br>';
591 print $langs->trans(
"Title").
' <input type="text" name="nouvellecolonne" size="40"><br>';
592 $tmparray = array(
'checkbox'=>$langs->trans(
"CheckBox"),
'yesno'=>$langs->trans(
"YesNoList"),
'foragainst'=>$langs->trans(
"PourContreList"));
593 print $langs->trans(
"Type").
' '.$form->selectarray(
"typecolonne", $tmparray,
GETPOST(
'typecolonne')).
'<br><br>';
594 print
'<input type="submit" class="button" name="ajoutercolonne" value="'.dol_escape_htmltag($langs->trans(
"Add")).
'">';
595 print
'<input type="hidden" name="id_sondage" value="'.dol_escape_htmltag($object->id_sondage).
'">';
596 print
' ';
597 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
598 print
'<br><br>'.
"\n";
600 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
604 print $langs->trans(
"AddADate").
':<br><br>'.
"\n";
605 print
'<select name="nouveaujour"> '.
"\n";
606 print
'<OPTION VALUE="vide"> </OPTION>'.
"\n";
607 for ($i = 1; $i < 32; $i++) {
608 print
'<OPTION VALUE="'.$i.
'">'.$i.
'</OPTION>'.
"\n";
610 print
'</select>'.
"\n";
612 print $formother->select_month(
'',
'nouveaumois', 1);
616 print $formother->selectyear(
'',
'nouvelleannee', 1, 0, 5, 0, 1);
618 print
'<br><br>'.$langs->trans(
"AddStartHour").
': <br><br>'.
"\n";
619 print
'<select name="nouvelleheuredebut"> '.
"\n";
620 print
'<OPTION VALUE="vide"> </OPTION>'.
"\n";
621 for ($i = 0; $i < 24; $i++) {
622 print
'<OPTION VALUE="'.$i.
'">'.$i.
' H</OPTION>'.
"\n";
624 print
'</select>'.
"\n";
625 print
'<select name="nouvelleminutedebut"> '.
"\n";
626 print
'<OPTION VALUE="vide"> </OPTION>'.
"\n";
627 print
'<OPTION VALUE="00">00</OPTION>'.
"\n";
628 print
'<OPTION VALUE="15">15</OPTION>'.
"\n";
629 print
'<OPTION VALUE="30">30</OPTION>'.
"\n";
630 print
'<OPTION VALUE="45">45</OPTION>'.
"\n";
631 print
'</select>'.
"\n";
632 print
'<br><br>'.$langs->trans(
"AddEndHour").
': <br><br>'.
"\n";
633 print
'<select name="nouvelleheurefin"> '.
"\n";
634 print
'<OPTION VALUE="vide"> </OPTION>'.
"\n";
635 for ($i = 0; $i < 24; $i++) {
636 print
'<OPTION VALUE="'.$i.
'">'.$i.
' H</OPTION>'.
"\n";
638 print
'</SELECT>'.
"\n";
639 print
'<select name="nouvelleminutefin"> '.
"\n";
640 print
'<OPTION VALUE="vide"> </OPTION>'.
"\n";
641 print
'<OPTION VALUE="00">00</OPTION>'.
"\n";
642 print
'<OPTION VALUE="15">15</OPTION>'.
"\n";
643 print
'<OPTION VALUE="30">30</OPTION>'.
"\n";
644 print
'<OPTION VALUE="45">45</OPTION>'.
"\n";
645 print
'</select>'.
"\n";
648 print
' <input type="submit" class="button" name="ajoutercolonne" value="'.dol_escape_htmltag($langs->trans(
"Add")).
'">'.
"\n";
649 print
' ';
650 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
653 print
'</form>'.
"\n";
654 print
'<br><br><br><br>'.
"\n";
660if ($user->rights->opensurvey->write) {
661 print
'<span class="opacitymedium">';
662 $s = $langs->trans(
"PollAdminDesc",
'{s1}', $langs->trans(
"Add"));
663 print str_replace(
'{s1}',
img_picto(
'',
'delete'), $s);
667$nbcolonnes = substr_count($object->sujet,
',') + 1;
669print
'<form name="formulaire" action="" method="POST">'.
"\n";
670print
'<input type="hidden" name="token" value="'.newToken().
'">';
671print
'<input type="hidden" name="page_y" value="">';
673print
'<div class="cadre div-table-responsive-no-min"> '.
"\n";
676print
'<table class="resultats">'.
"\n";
679$toutsujet = explode(
",", $object->sujet);
680$toutsujet = str_replace(
"°",
"'", $toutsujet);
683print
'<td></td>'.
"\n";
684print
'<td></td>'.
"\n";
687if ($user->rights->opensurvey->write) {
688 for ($i = 0; isset($toutsujet[$i]); $i++) {
689 print
'<td class=somme><input type="image" name="effacecolonne'.$i.
'" src="'.
img_picto(
'',
'delete.png',
'',
false, 1).
'"></td>'.
"\n";
697if ($object->format ==
"D") {
700 print
'<td></td>'.
"\n";
701 print
'<td></td>'.
"\n";
705 $nbofsujet = count($toutsujet);
706 for ($i = 0; $i < $nbofsujet; $i++) {
707 if (isset($toutsujet[$i + 1]) && date(
'Y', intval($toutsujet[$i])) == date(
'Y', intval($toutsujet[$i + 1]))) {
710 print
'<td colspan='.$colspan.
' class="annee">'.date(
'Y', intval($toutsujet[$i])).
'</td>'.
"\n";
715 if ($user->rights->opensurvey->write) {
716 print
'<td class="annee">';
717 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?ajoutsujet=1&id='.$object->id_sondage.
'">'.$langs->trans(
"Add").
'</a></td>'.
"\n";
722 print
'<td></td>'.
"\n";
723 print
'<td></td>'.
"\n";
727 for ($i = 0; $i < $nbofsujet; $i++) {
728 $cur = intval($toutsujet[$i]);
730 if (isset($toutsujet[$i + 1]) ===
false) {
733 $next = intval($toutsujet[$i + 1]);
739 print
'<td colspan='.$colspan.
' class="mois">'.
dol_print_date($cur,
"%B").
'</td>'.
"\n";
745 if ($user->rights->opensurvey->write) {
746 print
'<td class="mois"><a href="'.$_SERVER[
"PHP_SELF"].
'?ajoutsujet=1&id='.$object->id_sondage.
'">'.$langs->trans(
"Add").
'</a></td>'.
"\n";
751 print
'<td></td>'.
"\n";
752 print
'<td></td>'.
"\n";
756 for ($i = 0; $i < $nbofsujet; $i++) {
757 $cur = intval($toutsujet[$i]);
758 if (isset($toutsujet[$i + 1]) ===
false) {
761 $next = intval($toutsujet[$i + 1]);
766 print
'<td colspan='.$colspan.
' class="jour">'.
dol_print_date($cur,
"%a %d").
'</td>'.
"\n";
772 if ($user->rights->opensurvey->write) {
773 print
'<td class="jour"><a href="'.$_SERVER[
"PHP_SELF"].
'?ajoutsujet=1&id='.$object->id_sondage.
'">'.$langs->trans(
"Add").
'</a></td>'.
"\n";
778 if (strpos($object->sujet,
'@') !==
false) {
780 print
'<td></td>'.
"\n";
781 print
'<td></td>'.
"\n";
783 for ($i = 0; isset($toutsujet[$i]); $i++) {
784 $heures = explode(
'@', $toutsujet[$i]);
785 if (isset($heures[1])) {
786 print
'<td class="heure">'.dol_htmlentities($heures[1]).
'</td>'.
"\n";
788 print
'<td class="heure"></td>'.
"\n";
792 if ($user->rights->opensurvey->write) {
793 print
'<td class="heure"><a href="'.$_SERVER[
"PHP_SELF"].
'?ajoutsujet=1&id='.$object->id_sondage.
'">'.$langs->trans(
"Add").
'</a></td>'.
"\n";
801 print
'<td></td>'.
"\n";
802 print
'<td></td>'.
"\n";
804 for ($i = 0; isset($toutsujet[$i]); $i++) {
805 $tmp = explode(
'@', $toutsujet[$i]);
806 print
'<td class="sujet">'.dol_htmlentities($tmp[0]).
'</td>'.
"\n";
809 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";
816$sumagainst = array();
818$sql =
"SELECT id_users, nom as name, id_sondage, reponses";
819$sql .=
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs";
820$sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
822$resql = $db->query($sql);
827$num = $db->num_rows($resql);
828while ($compteur < $num) {
829 $obj = $db->fetch_object($resql);
831 $ensemblereponses = $obj->reponses;
833 print
'<tr><td>'.
"\n";
835 if ($user->rights->opensurvey->write) {
836 print
'<input type="image" class="reposition" name="effaceligne'.$compteur.
'" src="'.
img_picto(
'',
'delete.png',
'',
false, 1).
'">'.
"\n";
840 print
'</td><td class="nom">'.dol_htmlentities($obj->name).
'</td>'.
"\n";
843 if (!$testligneamodifier) {
844 for ($i = 0; $i < $nbcolonnes; $i++) {
845 $car = substr($ensemblereponses, $i, 1);
848 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
849 if (((
string) $car) ==
"1") {
850 print
'<td class="ok">OK</td>'.
"\n";
852 print
'<td class="non">KO</td>'.
"\n";
855 if (!isset($sumfor[$i])) {
858 if (((
string) $car) ==
"1") {
862 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
863 if (((
string) $car) ==
"1") {
864 print
'<td class="ok">'.$langs->trans(
"Yes").
'</td>'.
"\n";
865 } elseif (((
string) $car) ==
"0") {
866 print
'<td class="non">'.$langs->trans(
"No").
'</td>'.
"\n";
868 print
'<td class="vide"> </td>'.
"\n";
871 if (!isset($sumfor[$i])) {
874 if (!isset($sumagainst[$i])) {
877 if (((
string) $car) ==
"1") {
880 if (((
string) $car) ==
"0") {
884 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
885 if (((
string) $car) ==
"1") {
886 print
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
887 } elseif (((
string) $car) ==
"0") {
888 print
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
890 print
'<td class="vide"> </td>'.
"\n";
893 if (!isset($sumfor[$i])) {
896 if (!isset($sumagainst[$i])) {
899 if (((
string) $car) ==
"1") {
902 if (((
string) $car) ==
"0") {
909 if ($compteur == $ligneamodifier) {
910 for ($i = 0; $i < $nbcolonnes; $i++) {
911 $car = substr($ensemblereponses, $i, 1);
912 print
'<td class="vide">';
913 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
914 print
'<input type="checkbox" name="choix'.$i.
'" value="1" ';
920 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
921 $arraychoice = array(
'2'=>
' ',
'0'=>$langs->trans(
"No"),
'1'=>$langs->trans(
"Yes"));
922 print $form->selectarray(
"choix".$i, $arraychoice, $car);
924 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
925 $arraychoice = array(
'2'=>
' ',
'0'=>$langs->trans(
"Against"),
'1'=>$langs->trans(
"For"));
926 print $form->selectarray(
"choix".$i, $arraychoice, $car);
931 for ($i = 0; $i < $nbcolonnes; $i++) {
932 $car = substr($ensemblereponses, $i, 1);
933 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
934 if (((
string) $car) ==
"1") {
935 print
'<td class="ok">OK</td>'.
"\n";
937 print
'<td class="non">KO</td>'.
"\n";
940 if (!isset($sumfor[$i])) {
943 if (((
string) $car) ==
"1") {
947 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
948 if (((
string) $car) ==
"1") {
949 print
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
950 } elseif (((
string) $car) ==
"0") {
951 print
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
953 print
'<td class="vide"> </td>'.
"\n";
956 if (!isset($sumfor[$i])) {
959 if (!isset($sumagainst[$i])) {
962 if (((
string) $car) ==
"1") {
965 if (((
string) $car) ==
"0") {
969 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
970 if (((
string) $car) ==
"1") {
971 print
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
972 } elseif (((
string) $car) ==
"0") {
973 print
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
975 print
'<td class="vide"> </td>'.
"\n";
978 if (!isset($sumfor[$i])) {
981 if (!isset($sumagainst[$i])) {
984 if (((
string) $car) ==
"1") {
987 if (((
string) $car) ==
"0") {
996 if ($compteur != $ligneamodifier && ($user->rights->opensurvey->write)) {
997 print
'<td class="casevide"><input type="submit" class="button reposition" name="modifierligne'.$compteur.
'" value="'.
dol_escape_htmltag($langs->trans(
"Edit")).
'"></td>'.
"\n";
1001 for ($i = 0; $i < $nblines; $i++) {
1002 if (GETPOSTISSET(
"modifierligne".$i)) {
1003 if ($compteur == $i) {
1004 print
'<td class="casevide">';
1005 print
'<input type="hidden" name="idtomodify'.$compteur.
'" value="'.$obj->id_users.
'">';
1006 print
'<input type="submit" class="button button-save reposition" name="validermodifier'.$compteur.
'" value="'.
dol_escape_htmltag($langs->trans(
"Save")).
'">';
1017if (empty($testligneamodifier)) {
1019 print
'<td></td>'.
"\n";
1020 print
'<td class="nom">'.
"\n";
1021 print
'<input type="text" class="maxwidthonsmartphone" placeholder="'.dol_escape_htmltag($langs->trans(
"Name")).
'" name="nom" maxlength="64">'.
"\n";
1024 for ($i = 0; $i < $nbcolonnes; $i++) {
1025 print
'<td class="vide">';
1026 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
1027 print
'<input type="checkbox" name="choix'.$i.
'" value="1"';
1028 if (GETPOSTISSET(
'choix'.$i) &&
GETPOST(
'choix'.$i) ==
'1') {
1033 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
1034 $arraychoice = array(
'2'=>
' ',
'0'=>$langs->trans(
"No"),
'1'=>$langs->trans(
"Yes"));
1035 print $form->selectarray(
"choix".$i, $arraychoice);
1037 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
1038 $arraychoice = array(
'2'=>
' ',
'0'=>$langs->trans(
"Against"),
'1'=>$langs->trans(
"For"));
1039 print $form->selectarray(
"choix".$i, $arraychoice);
1045 print
'<td><input type="image" name="boutonp" class="borderimp" value="'.$langs->trans(
"Vote").
'" src="'.
img_picto(
'',
'edit_add',
'',
false, 1).
'"></td>'.
"\n";
1051for ($i = 0; $i < $nbcolonnes + 1; $i++) {
1052 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
1055 if (isset($sumfor[$i])) {
1057 $meilleurecolonne = $sumfor[$i];
1059 if (isset($sumfor[$i]) && $sumfor[$i] > $meilleurecolonne) {
1060 $meilleurecolonne = $sumfor[$i];
1068print
'<td></td>'.
"\n";
1069print
'<td class="center">'.$langs->trans(
"Total").
'</td>'.
"\n";
1070for ($i = 0; $i < $nbcolonnes; $i++) {
1071 $showsumfor = isset($sumfor[$i]) ? $sumfor[$i] :
'';
1072 $showsumagainst = isset($sumagainst[$i]) ? $sumagainst[$i] :
'';
1073 if (empty($showsumfor)) {
1076 if (empty($showsumagainst)) {
1077 $showsumagainst = 0;
1081 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
1084 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
1085 print $langs->trans(
"Yes").
': '.$showsumfor.
'<br>'.$langs->trans(
"No").
': '.$showsumagainst;
1087 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
1088 print $langs->trans(
"For").
': '.$showsumfor.
'<br>'.$langs->trans(
"Against").
': '.$showsumagainst;
1094if ($nbofcheckbox >= 2) {
1096 print
'<td></td>'.
"\n";
1097 print
'<td></td>'.
"\n";
1098 for ($i = 0; $i < $nbcolonnes; $i++) {
1099 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst')) && isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) {
1100 print
'<td class="somme"><img src="'.dol_buildpath(
'/opensurvey/img/medaille.png', 1).
'"></td>'.
"\n";
1102 print
'<td class="somme"></td>'.
"\n";
1109if (GETPOSTISSET(
"boutonp") &&
GETPOST(
"nom") ==
"") {
1110 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Name")),
null,
'errors');
1113if (isset($erreur_prenom) && $erreur_prenom) {
1117if (isset($erreur_ajout_date) && $erreur_ajout_date) {
1122print
'</table>'.
"\n";
1126$toutsujet = explode(
",", $object->sujet);
1130for ($i = 0; $i < $nbcolonnes; $i++) {
1131 if (isset($sumfor[$i]) ===
true && isset($meilleurecolonne) ===
true && $sumfor[$i] == $meilleurecolonne) {
1132 $meilleursujet .= ($meilleursujet ?
", " :
"");
1134 if ($object->format ==
"D") {
1135 $meilleursujetexport = $toutsujet[$i];
1137 if (strpos($toutsujet[$i],
'@') !==
false) {
1138 $toutsujetdate = explode(
"@", $toutsujet[$i]);
1139 $meilleursujet .=
dol_print_date($toutsujetdate[0],
'daytext').($toutsujetdate[0] ?
' ('.dol_print_date($toutsujetdate[0],
'%A').
')' :
'').
' - '.$toutsujetdate[1];
1141 $meilleursujet .=
dol_print_date((empty($toutsujet[$i]) ? 0 : $toutsujet[$i]),
'daytext').
' ('.
dol_print_date((empty($toutsujet[$i]) ? 0 : $toutsujet[$i]),
'%A').
')';
1144 $tmps = explode(
'@', $toutsujet[$i]);
1151$meilleursujet = substr($meilleursujet, 1);
1152$meilleursujet = str_replace(
"°",
"'", $meilleursujet);
1155if ($nbofcheckbox >= 2) {
1156 $vote_str = $langs->trans(
'votes');
1157 print
'<p class="affichageresultats">'.
"\n";
1159 if (isset($meilleurecolonne) && $compteursujet ==
"1") {
1160 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";
1161 } elseif (isset($meilleurecolonne)) {
1162 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";
1164 print
'<br></p><br>'.
"\n";
1167print
'</form>'.
"\n";
1169print
'<a name="bas"></a>'.
"\n";
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage a WYSIWYG editor.
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_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.
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...
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
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_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.
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_email($email, $cid=0, $socid=0, $addlink=0, $max=64, $showinvalid=1, $withpicto=0)
Show EMail link formatted for HTML output.
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
dol_htmlentities($string, $flags=ENT_QUOTES|ENT_SUBSTITUTE, $encoding='UTF-8', $double_encode=false)
Replace htmlentities functions.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.