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";
45if (!$user->hasRight(
'opensurvey',
'read')) {
50$action =
GETPOST(
'action',
'aZ09');
51$numsondage =
GETPOST(
"id",
'alphanohtml');
54$result =
$object->fetch(
'', $numsondage);
59$nblines =
$object->fetch_lines();
69 header(
'Location: results.php?id='.(GETPOSTISSET(
'id_sondage') ?
GETPOST(
'id_sondage',
'aZ09') :
GETPOST(
'id',
'alphanohtml')));
73$nbcolonnes = substr_count(
$object->sujet,
',') + 1;
78 $erreur_prenom =
false;
81 for ($i = 0; $i < $nbcolonnes; $i++) {
82 if (GETPOSTISSET(
"choix$i") &&
GETPOST(
"choix$i") ==
'1') {
84 } elseif (GETPOSTISSET(
"choix$i") &&
GETPOST(
"choix$i") ==
'2') {
91 $nom = substr(
GETPOST(
"nom",
'alphanohtml'), 0, 64);
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);
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);
115$testmodifier =
false;
116$testligneamodifier =
false;
119for ($i = 0; $i < $nblines; $i++) {
120 if (GETPOSTISSET(
'modifierligne'.$i)) {
121 $ligneamodifier = $i;
122 $testligneamodifier =
true;
126 if (GETPOSTISSET(
'validermodifier'.$i)) {
128 $testmodifier =
true;
133 if (!$user->hasRight(
'opensurvey',
'write')) {
138 for ($i = 0; $i < $nbcolonnes; $i++) {
139 if (GETPOSTISSET(
"choix$i") &&
GETPOST(
"choix$i") ==
'1') {
140 $nouveauchoix .=
"1";
141 } elseif (GETPOSTISSET(
"choix$i") &&
GETPOST(
"choix$i") ==
'2') {
142 $nouveauchoix .=
"2";
144 $nouveauchoix .=
"0";
148 $idtomodify =
GETPOST(
"idtomodify".$modifier);
149 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_user_studs";
150 $sql .=
" SET reponses = '".$db->escape($nouveauchoix).
"'";
151 $sql .=
" WHERE id_users = '".$db->escape($idtomodify).
"'";
153 $resql = $db->query($sql);
162 if (!$user->hasRight(
'opensurvey',
'write')) {
166 $nouveauxsujets =
$object->sujet;
169 $nouveauxsujets .=
',';
170 $nouveauxsujets .= str_replace(array(
",",
"@"),
" ",
GETPOST(
"nouvellecolonne")).(!
GETPOST(
"typecolonne") ?
'' :
'@'.GETPOST(
"typecolonne"));
173 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_sondage";
174 $sql .=
" SET sujet = '".$db->escape($nouveauxsujets).
"'";
175 $sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
176 $resql = $db->query($sql);
180 header(
'Location: results.php?id='.
$object->id_sondage);
186if (GETPOSTISSET(
"ajoutercolonne") &&
$object->format ==
"D") {
188 if (!$user->hasRight(
'opensurvey',
'write')) {
192 $nouveauxsujets =
$object->sujet;
194 if (GETPOSTISSET(
"nouveaujour") &&
GETPOST(
"nouveaujour") !=
"vide" &&
195 GETPOSTISSET(
"nouveaumois") &&
GETPOST(
"nouveaumois") !=
"vide" &&
196 GETPOSTISSET(
"nouvelleannee") &&
GETPOST(
"nouvelleannee") !=
"vide") {
199 if (GETPOSTISSET(
"nouvelleheuredebut") &&
GETPOST(
"nouvelleheuredebut") !=
"vide") {
200 $nouvelledate .=
"@";
201 $nouvelledate .=
GETPOST(
"nouvelleheuredebut");
202 $nouvelledate .=
"h";
204 if (
GETPOST(
"nouvelleminutedebut") !=
"vide") {
205 $nouvelledate .=
GETPOST(
"nouvelleminutedebut");
209 if (GETPOSTISSET(
"nouvelleheurefin") &&
GETPOST(
"nouvelleheurefin") !=
"vide") {
210 $nouvelledate .=
"-";
211 $nouvelledate .=
GETPOST(
"nouvelleheurefin");
212 $nouvelledate .=
"h";
214 if (
GETPOST(
"nouvelleminutefin") !=
"vide") {
215 $nouvelledate .=
GETPOST(
"nouvelleminutefin");
219 if (
GETPOST(
"nouvelleheuredebut") ==
"vide" || (GETPOSTISSET(
"nouvelleheuredebut") && GETPOSTISSET(
"nouvelleheurefin")
221 && (
GETPOST(
"nouvelleminutedebut") <
GETPOST(
"nouvelleminutefin")))))) {
222 $erreur_ajout_date =
false;
224 $erreur_ajout_date =
"yes";
228 $datesbase = explode(
",",
$object->sujet);
229 $taillebase = count($datesbase);
233 if ($nouvelledate < $datesbase[0]) {
235 } elseif ($nouvelledate > $datesbase[$taillebase - 1]) {
236 $cleinsertion = count($datesbase);
238 $nbdatesbase = count($datesbase);
239 for ($i = 0; $i < $nbdatesbase; $i++) {
241 if ($nouvelledate > $datesbase[$i] && $nouvelledate < $datesbase[$j]) {
247 array_splice($datesbase, $cleinsertion, 0, $nouvelledate);
248 $cle = array_search($nouvelledate, $datesbase);
250 $nbofdates = count($datesbase);
251 for ($i = 0; $i < $nbofdates; $i++) {
252 $dateinsertion .=
",";
253 $dateinsertion .= $datesbase[$i];
256 $dateinsertion = substr(
"$dateinsertion", 1);
259 if (isset($erreur_ajout_date) && empty($erreur_ajout_date)) {
260 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_sondage";
261 $sql .=
" SET sujet = '".$db->escape($dateinsertion).
"'";
262 $sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
263 $resql = $db->query($sql);
267 header(
'Location: results.php?id='.
$object->id_sondage);
270 if ($cleinsertion >= 0) {
271 $sql =
'SELECT s.reponses';
272 $sql .=
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs as s";
273 $sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
274 $resql = $db->query($sql);
278 $num = $db->num_rows($resql);
280 while ($compteur < $num) {
281 $obj = $db->fetch_object($resql);
282 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_user_studs";
283 if ($cleinsertion == 0) {
284 $sql .=
" SET reponses = '0".$db->escape($obj->reponses).
"'";
286 $reponsesadd = str_split($obj->reponses);
287 $lengthresponses = count($reponsesadd);
288 for ($cpt = $lengthresponses; $cpt > $cleinsertion; $cpt--) {
289 $reponsesadd[$cpt] = $reponsesadd[$cpt - 1];
291 $reponsesadd[$cleinsertion] =
'0';
292 $reponsesadd = implode($reponsesadd);
293 $sql .=
" SET reponses = '".$db->escape($reponsesadd).
"'";
295 $sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
296 $resql = $db->query($sql);
304 $adresseadmin =
$object->mail_admin;
306 $erreur_ajout_date =
"yes";
311for ($i = 0; $i < $nblines; $i++) {
314 if (!$user->hasRight(
'opensurvey',
'write')) {
322 $sql =
"SELECT id_users, nom as name, id_sondage, reponses";
323 $sql .=
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs";
324 $sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
325 $resql = $db->query($sql);
329 $num = $db->num_rows($resql);
330 while ($compteur < $num) {
331 $obj = $db->fetch_object($resql);
333 if ($compteur == $i) {
334 $sql2 =
'DELETE FROM '.MAIN_DB_PREFIX.
'opensurvey_user_studs';
335 $sql2 .=
" WHERE id_users = ".((int) $obj->id_users);
336 $resql2 = $db->query($sql2);
345for ($i = 0; $i < $nbcolonnes; $i++) {
346 if ((
GETPOST(
"effacecolonne".$i) ||
GETPOST(
"effacecolonne".$i.
"_x") ||
GETPOST(
"effacecolonne".$i.
".x"))
347 && $nbcolonnes > 1) {
349 if (!$user->hasRight(
'opensurvey',
'write')) {
355 $toutsujet = explode(
",",
$object->sujet);
357 $nouveauxsujets =
'';
360 while (isset($toutsujet[$j])) {
363 if (!empty($nouveauxsujets)) {
364 $nouveauxsujets .=
',';
366 $nouveauxsujets .= $toutsujet[$j];
373 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_sondage";
374 $sql .=
" SET sujet = '".$db->escape($nouveauxsujets).
"' WHERE id_sondage = '".$db->escape($numsondage).
"'";
375 $resql = $db->query($sql);
382 $sql =
"SELECT id_users, nom as name, id_sondage, reponses";
383 $sql .=
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs";
384 $sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
386 $resql = $db->query($sql);
391 $num = $db->num_rows($resql);
392 while ($compteur < $num) {
393 $obj = $db->fetch_object($resql);
396 $ensemblereponses = $obj->reponses;
399 for ($j = 0; $j < $nbcolonnes; $j++) {
400 $car = substr($ensemblereponses, $j, 1);
408 $sql2 =
'UPDATE '.MAIN_DB_PREFIX.
'opensurvey_user_studs';
409 $sql2 .=
" SET reponses = '".$db->escape($newcar).
"'";
410 $sql2 .=
" WHERE id_users = '".$db->escape($obj->id_users).
"'";
413 $resql2 = $db->query($sql2);
428$form =
new Form($db);
432 $userstatic =
new User($db);
433 $userstatic->fetch(
$object->fk_user_creat);
436$result =
$object->fetch(
'', $numsondage);
442$title =
$object->title.
" - ".$langs->trans(
'Card');
445$arrayofcss = array(
'/opensurvey/css/style.css');
447llxHeader(
'', $title, $helpurl,
'', 0, 0, $arrayofjs, $arrayofcss);
451$toutsujet = explode(
",",
$object->sujet);
452$listofanswers = array();
453foreach ($toutsujet as $value) {
454 $tmp = explode(
'@', $value);
455 $listofanswers[] = array(
'label' => $tmp[0],
'format' => (!empty($tmp[1]) ? $tmp[1] :
'checkbox'));
457$toutsujet = str_replace(
"@",
"<br>", $toutsujet);
458$toutsujet = str_replace(
"°",
"'", $toutsujet);
461print
'<form name="formulaire4" action="#" method="POST">'.
"\n";
462print
'<input type="hidden" name="token" value="'.newToken().
'">';
463print
'<input type="hidden" name="id" value="'.GETPOST(
'id').
'">';
471$linkback =
'<a href="'.DOL_URL_ROOT.
'/opensurvey/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
473dol_banner_tab($object,
'id', $linkback, 1,
'id_sondage',
'id_sondage', $morehtmlref);
476print
'<div class="fichecenter">';
478print
'<div class="fichehalfleft">';
479print
'<div class="underbanner clearboth"></div>';
480print
'<table class="border tableforfield centpercent">';
483$type = (
$object->format ==
"A") ?
'classic' :
'date';
484print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td>';
485print
img_picto(
'',
dol_buildpath(
'/opensurvey/img/'.($type ==
'classic' ?
'chart-32.png' :
'calendar-32.png'), 1),
'width="16"', 1);
486print
' '.$langs->trans($type ==
'classic' ?
"TypeClassic" :
"TypeDate").
'</td></tr>';
490$adresseadmin =
$object->mail_admin;
491print $langs->trans(
"Title").
'</td><td>';
492if ($action ==
'edit') {
493 print
'<input type="text" name="nouveautitre" size="40" value="'.dol_escape_htmltag(
$object->title).
'">';
500print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td class="wordbreak">';
501if ($action ==
'edit') {
502 $doleditor =
new DolEditor(
'nouveauxcommentaires',
$object->description,
'', 120,
'dolibarr_notes',
'In',
true, 1, 1, ROWS_7,
'90%');
503 $doleditor->Create(0,
'');
512 print
'<tr><td>'.$langs->trans(
"EMail").
'</td><td>';
513 if ($action ==
'edit') {
514 print
'<input type="text" name="nouvelleadresse" class="minwidth200" value="'.$object->mail_admin.
'">';
524print
'<div class="fichehalfright">';
525print
'<div class="underbanner clearboth"></div>';
527print
'<table class="border tableforfield centpercent">';
530print
'<tr><td>'.$langs->trans(
'ExpireDate').
'</td><td>';
531if ($action ==
'edit') {
532 print $form->selectDate($expiredate ? $expiredate :
$object->date_fin,
'expire', 0, 0, 0,
'', 1, 0);
543print $langs->trans(
"Author").
'</td><td>';
544if (
$object->fk_user_creat && $userstatic !==
null) {
545 print $userstatic->getLoginUrl(-1);
552print
'<tr><td>'.$langs->trans(
"UrlForSurvey",
'').
'</td><td>';
556$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
559$url = $urlwithouturlroot.dol_buildpath(
'/public/opensurvey/studs.php', 1).
'?sondage='.
$object->id_sondage;
560$urllink =
'<input type="text" class="quatrevingtpercent" '.($action ==
'edit' ?
'disabled' :
'').
' id="opensurveyurl" name="opensurveyurl" value="'.$url.
'">';
562if ($action !=
'edit') {
572print
'<div class="clearboth"></div>';
581print
'<div class="tabsAction">';
583print
'<a class="butAction" href="exportcsv.php?id='.urlencode($numsondage).
'">'.$langs->trans(
"ExportSpreadsheet").
' (.CSV)</a>';
591 if (!$user->hasRight(
'opensurvey',
'write')) {
595 print
'<form name="formulaire" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
596 print
'<input type="hidden" name="token" value="'.newToken().
'">';
597 print
'<input type="hidden" name="backtopage" value="'.GETPOST(
'backtopage',
'alpha').
'">';
598 print
'<input type="hidden" name="id" value="'.GETPOST(
'id',
'alpha').
'">';
599 print
'<input type="hidden" name="ajoutsujet" value="1">';
601 print
'<div class="center">'.
"\n";
606 print $langs->trans(
"AddNewColumn").
':<br><br>';
607 print $langs->trans(
"Title").
' <input type="text" name="nouvellecolonne" size="40"><br>';
608 $tmparray = array(
'checkbox' => $langs->trans(
"CheckBox"),
'yesno' => $langs->trans(
"YesNoList"),
'foragainst' => $langs->trans(
"PourContreList"));
609 print $langs->trans(
"Type").
' '.$form->selectarray(
"typecolonne", $tmparray,
GETPOST(
'typecolonne')).
'<br><br>';
610 print
'<input type="submit" class="button" name="ajoutercolonne" value="'.dol_escape_htmltag($langs->trans(
"Add")).
'">';
611 print
'<input type="hidden" name="id_sondage" value="'.dol_escape_htmltag(
$object->id_sondage).
'">';
612 print
' ';
613 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
614 print
'<br><br>'.
"\n";
616 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
620 print $langs->trans(
"AddADate").
':<br><br>'.
"\n";
621 print
'<select name="nouveaujour"> '.
"\n";
622 print
'<OPTION VALUE="vide"> </OPTION>'.
"\n";
623 for ($i = 1; $i < 32; $i++) {
624 print
'<OPTION VALUE="'.$i.
'">'.$i.
'</OPTION>'.
"\n";
626 print
'</select>'.
"\n";
628 print $formother->select_month(
'',
'nouveaumois', 1);
632 print $formother->selectyear(
'',
'nouvelleannee', 1, 0, 5, 0, 1);
634 print
'<br><br>'.$langs->trans(
"AddStartHour").
': <br><br>'.
"\n";
635 print
'<select name="nouvelleheuredebut"> '.
"\n";
636 print
'<OPTION VALUE="vide"> </OPTION>'.
"\n";
637 for ($i = 0; $i < 24; $i++) {
638 print
'<OPTION VALUE="'.$i.
'">'.$i.
' H</OPTION>'.
"\n";
640 print
'</select>'.
"\n";
641 print
'<select name="nouvelleminutedebut"> '.
"\n";
642 print
'<OPTION VALUE="vide"> </OPTION>'.
"\n";
643 print
'<OPTION VALUE="00">00</OPTION>'.
"\n";
644 print
'<OPTION VALUE="15">15</OPTION>'.
"\n";
645 print
'<OPTION VALUE="30">30</OPTION>'.
"\n";
646 print
'<OPTION VALUE="45">45</OPTION>'.
"\n";
647 print
'</select>'.
"\n";
648 print
'<br><br>'.$langs->trans(
"AddEndHour").
': <br><br>'.
"\n";
649 print
'<select name="nouvelleheurefin"> '.
"\n";
650 print
'<OPTION VALUE="vide"> </OPTION>'.
"\n";
651 for ($i = 0; $i < 24; $i++) {
652 print
'<OPTION VALUE="'.$i.
'">'.$i.
' H</OPTION>'.
"\n";
654 print
'</SELECT>'.
"\n";
655 print
'<select name="nouvelleminutefin"> '.
"\n";
656 print
'<OPTION VALUE="vide"> </OPTION>'.
"\n";
657 print
'<OPTION VALUE="00">00</OPTION>'.
"\n";
658 print
'<OPTION VALUE="15">15</OPTION>'.
"\n";
659 print
'<OPTION VALUE="30">30</OPTION>'.
"\n";
660 print
'<OPTION VALUE="45">45</OPTION>'.
"\n";
661 print
'</select>'.
"\n";
664 print
' <input type="submit" class="button" name="ajoutercolonne" value="'.dol_escape_htmltag($langs->trans(
"Add")).
'">'.
"\n";
665 print
' ';
666 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
669 print
'</form>'.
"\n";
670 print
'<br><br><br><br>'.
"\n";
676if ($user->hasRight(
'opensurvey',
'write')) {
677 print
'<span class="opacitymedium">';
678 $s = $langs->trans(
"PollAdminDesc",
'{s1}', $langs->trans(
"Add"));
679 print str_replace(
'{s1}',
img_picto(
'',
'delete'), $s);
683$nbcolonnes = substr_count(
$object->sujet,
',') + 1;
685print
'<form name="formulaire" action="" method="POST">'.
"\n";
686print
'<input type="hidden" name="token" value="'.newToken().
'">';
687print
'<input type="hidden" name="page_y" value="">';
689print
'<div class="cadre div-table-responsive-no-min"> '.
"\n";
692print
'<table class="resultats margintoponly">'.
"\n";
695$toutsujet = explode(
",",
$object->sujet);
696$toutsujet = str_replace(
"°",
"'", $toutsujet);
699print
'<td></td>'.
"\n";
700print
'<td></td>'.
"\n";
703if ($user->hasRight(
'opensurvey',
'write')) {
704 for ($i = 0; isset($toutsujet[$i]); $i++) {
705 print
'<td class=somme><input type="image" class="buttonwebsite" name="effacecolonne'.$i.
'" src="'.
img_picto(
'',
'delete',
'', 0, 1).
'"></td>'.
"\n";
716 print
'<td></td>'.
"\n";
717 print
'<td></td>'.
"\n";
721 $nbofsujet = count($toutsujet);
722 for ($i = 0; $i < $nbofsujet; $i++) {
723 if (isset($toutsujet[$i + 1]) &&
date(
'Y', intval($toutsujet[$i])) ==
date(
'Y', intval($toutsujet[$i + 1]))) {
726 print
'<td colspan='.$colspan.
' class="annee">'.
date(
'Y', intval($toutsujet[$i])).
'</td>'.
"\n";
731 if ($user->hasRight(
'opensurvey',
'write')) {
732 print
'<td class="annee">';
733 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?ajoutsujet=1&id='.
$object->id_sondage.
'">'.$langs->trans(
"Add").
'</a></td>'.
"\n";
738 print
'<td></td>'.
"\n";
739 print
'<td></td>'.
"\n";
743 for ($i = 0; $i < $nbofsujet; $i++) {
744 $cur = intval($toutsujet[$i]);
746 if (!isset($toutsujet[$i + 1])) {
749 $next = intval($toutsujet[$i + 1]);
755 print
'<td colspan='.$colspan.
' class="mois">'.
dol_print_date($cur,
"%B").
'</td>'.
"\n";
761 if ($user->hasRight(
'opensurvey',
'write')) {
762 print
'<td class="mois"><a href="'.$_SERVER[
"PHP_SELF"].
'?ajoutsujet=1&id='.
$object->id_sondage.
'">'.$langs->trans(
"Add").
'</a></td>'.
"\n";
767 print
'<td></td>'.
"\n";
768 print
'<td></td>'.
"\n";
772 for ($i = 0; $i < $nbofsujet; $i++) {
773 $cur = intval($toutsujet[$i]);
774 if (!isset($toutsujet[$i + 1])) {
777 $next = intval($toutsujet[$i + 1]);
782 print
'<td colspan='.$colspan.
' class="jour">'.
dol_print_date($cur,
"%a %d").
'</td>'.
"\n";
788 if ($user->hasRight(
'opensurvey',
'write')) {
789 print
'<td class="jour"><a href="'.$_SERVER[
"PHP_SELF"].
'?ajoutsujet=1&id='.
$object->id_sondage.
'">'.$langs->trans(
"Add").
'</a></td>'.
"\n";
794 if (strpos(
$object->sujet,
'@') !==
false) {
796 print
'<td></td>'.
"\n";
797 print
'<td></td>'.
"\n";
799 for ($i = 0; isset($toutsujet[$i]); $i++) {
800 $heures = explode(
'@', $toutsujet[$i]);
801 if (isset($heures[1])) {
802 print
'<td class="heure">'.dol_htmlentities($heures[1]).
'</td>'.
"\n";
804 print
'<td class="heure"></td>'.
"\n";
808 if ($user->hasRight(
'opensurvey',
'write')) {
809 print
'<td class="heure"><a href="'.$_SERVER[
"PHP_SELF"].
'?ajoutsujet=1&id='.
$object->id_sondage.
'">'.$langs->trans(
"Add").
'</a></td>'.
"\n";
817 print
'<td></td>'.
"\n";
818 print
'<td></td>'.
"\n";
820 for ($i = 0; isset($toutsujet[$i]); $i++) {
821 $tmp = explode(
'@', $toutsujet[$i]);
822 print
'<td class="sujet">'.dol_htmlentities($tmp[0]).
'</td>'.
"\n";
825 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";
832$sumagainst = array();
834$sql =
"SELECT id_users, nom as name, id_sondage, reponses, tms, date_creation";
835$sql .=
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs";
836$sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
838$resql = $db->query($sql);
843$num = $db->num_rows($resql);
844while ($compteur < $num) {
845 $obj = $db->fetch_object($resql);
847 $ensemblereponses = $obj->reponses;
849 print
'<tr><td>'.
"\n";
851 if ($user->hasRight(
'opensurvey',
'write')) {
852 print
'<input type="image" class="reposition" name="effaceligne'.$compteur.
'" src="'.
img_picto(
'',
'delete',
'', 0, 1).
'">'.
"\n";
856 $tooltip = $obj->name.
'<br>'.$langs->trans(
"DateCreation").
': '.
dol_print_date($obj->date_creation,
'dayhour');
857 print
'</td><td class="nom classfortooltip" title="'.dolPrintHTMLForAttribute($tooltip).
'">';
862 if (!$testligneamodifier) {
863 for ($i = 0; $i < $nbcolonnes; $i++) {
864 $car = substr($ensemblereponses, $i, 1);
867 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
868 if (((
string) $car) ==
"1") {
869 print
'<td class="ok">OK</td>'.
"\n";
871 print
'<td class="non">KO</td>'.
"\n";
874 if (!isset($sumfor[$i])) {
877 if (((
string) $car) ==
"1") {
881 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
882 if (((
string) $car) ==
"1") {
883 print
'<td class="ok">'.$langs->trans(
"Yes").
'</td>'.
"\n";
884 } elseif (((
string) $car) ==
"0") {
885 print
'<td class="non">'.$langs->trans(
"No").
'</td>'.
"\n";
887 print
'<td class="vide"> </td>'.
"\n";
890 if (!isset($sumfor[$i])) {
893 if (!isset($sumagainst[$i])) {
896 if (((
string) $car) ==
"1") {
899 if (((
string) $car) ==
"0") {
903 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
904 if (((
string) $car) ==
"1") {
905 print
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
906 } elseif (((
string) $car) ==
"0") {
907 print
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
909 print
'<td class="vide"> </td>'.
"\n";
912 if (!isset($sumfor[$i])) {
915 if (!isset($sumagainst[$i])) {
918 if (((
string) $car) ==
"1") {
921 if (((
string) $car) ==
"0") {
928 if ($compteur == $ligneamodifier) {
929 for ($i = 0; $i < $nbcolonnes; $i++) {
930 $car = substr($ensemblereponses, $i, 1);
931 print
'<td class="vide">';
932 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
933 print
'<input type="checkbox" name="choix'.$i.
'" value="1" ';
939 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
940 $arraychoice = array(
'2' =>
' ',
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
941 print $form->selectarray(
"choix".$i, $arraychoice, $car);
943 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
944 $arraychoice = array(
'2' =>
' ',
'0' => $langs->trans(
"Against"),
'1' => $langs->trans(
"For"));
945 print $form->selectarray(
"choix".$i, $arraychoice, $car);
950 for ($i = 0; $i < $nbcolonnes; $i++) {
951 $car = substr($ensemblereponses, $i, 1);
952 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
953 if (((
string) $car) ==
"1") {
954 print
'<td class="ok">OK</td>'.
"\n";
956 print
'<td class="non">KO</td>'.
"\n";
959 if (!isset($sumfor[$i])) {
962 if (((
string) $car) ==
"1") {
966 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
967 if (((
string) $car) ==
"1") {
968 print
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
969 } elseif (((
string) $car) ==
"0") {
970 print
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
972 print
'<td class="vide"> </td>'.
"\n";
975 if (!isset($sumfor[$i])) {
978 if (!isset($sumagainst[$i])) {
981 if (((
string) $car) ==
"1") {
984 if (((
string) $car) ==
"0") {
988 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
989 if (((
string) $car) ==
"1") {
990 print
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
991 } elseif (((
string) $car) ==
"0") {
992 print
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
994 print
'<td class="vide"> </td>'.
"\n";
997 if (!isset($sumfor[$i])) {
1000 if (!isset($sumagainst[$i])) {
1001 $sumagainst[$i] = 0;
1003 if (((
string) $car) ==
"1") {
1006 if (((
string) $car) ==
"0") {
1015 if ($compteur != $ligneamodifier && ($user->hasRight(
'opensurvey',
'write'))) {
1016 print
'<td class="casevide"><input type="submit" class="button reposition" name="modifierligne'.$compteur.
'" value="'.
dol_escape_htmltag($langs->trans(
"Edit")).
'"></td>'.
"\n";
1020 for ($i = 0; $i < $nblines; $i++) {
1021 if (GETPOSTISSET(
"modifierligne".$i)) {
1022 if ($compteur == $i) {
1023 print
'<td class="casevide">';
1024 print
'<input type="hidden" name="idtomodify'.$compteur.
'" value="'.$obj->id_users.
'">';
1025 print
'<input type="submit" class="button button-save reposition" name="validermodifier'.$compteur.
'" value="'.
dol_escape_htmltag($langs->trans(
"Save")).
'">';
1036if (empty($testligneamodifier)) {
1038 print
'<td></td>'.
"\n";
1039 print
'<td class="nom">'.
"\n";
1040 print
'<input type="text" class="maxwidthonsmartphone" placeholder="'.dol_escape_htmltag($langs->trans(
"Name")).
'" name="nom" maxlength="64">'.
"\n";
1043 for ($i = 0; $i < $nbcolonnes; $i++) {
1044 print
'<td class="vide">';
1045 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
1046 print
'<input type="checkbox" name="choix'.$i.
'" value="1"';
1047 if (GETPOSTISSET(
'choix'.$i) &&
GETPOST(
'choix'.$i) ==
'1') {
1052 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
1053 $arraychoice = array(
'2' =>
' ',
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
1054 print $form->selectarray(
"choix".$i, $arraychoice);
1056 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
1057 $arraychoice = array(
'2' =>
' ',
'0' => $langs->trans(
"Against"),
'1' => $langs->trans(
"For"));
1058 print $form->selectarray(
"choix".$i, $arraychoice);
1064 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";
1070$meilleurecolonne =
null;
1071for ($i = 0; $i < $nbcolonnes + 1; $i++) {
1072 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
1075 if (isset($sumfor[$i])) {
1077 $meilleurecolonne = $sumfor[$i];
1079 if (isset($sumfor[$i]) && $sumfor[$i] > $meilleurecolonne) {
1080 $meilleurecolonne = $sumfor[$i];
1088print
'<td></td>'.
"\n";
1089print
'<td class="center">'.$langs->trans(
"Total").
'</td>'.
"\n";
1090for ($i = 0; $i < $nbcolonnes; $i++) {
1091 $showsumfor = isset($sumfor[$i]) ? $sumfor[$i] :
'';
1092 $showsumagainst = isset($sumagainst[$i]) ? $sumagainst[$i] :
'';
1093 if (empty($showsumfor)) {
1096 if (empty($showsumagainst)) {
1097 $showsumagainst = 0;
1101 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
1104 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
1105 print $langs->trans(
"Yes").
': '.$showsumfor.
'<br>'.$langs->trans(
"No").
': '.$showsumagainst;
1107 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
1108 print $langs->trans(
"For").
': '.$showsumfor.
'<br>'.$langs->trans(
"Against").
': '.$showsumagainst;
1114if ($nbofcheckbox >= 2) {
1116 print
'<td></td>'.
"\n";
1117 print
'<td></td>'.
"\n";
1118 for ($i = 0; $i < $nbcolonnes; $i++) {
1119 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst')) && isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) {
1120 print
'<td class="somme"><img src="'.dol_buildpath(
'/opensurvey/img/medaille.png', 1).
'"></td>'.
"\n";
1122 print
'<td class="somme"></td>'.
"\n";
1129if (GETPOSTISSET(
"boutonp") &&
GETPOST(
"nom") ==
"") {
1130 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Name")),
null,
'errors');
1133if (isset($erreur_prenom) && $erreur_prenom) {
1137if (isset($erreur_ajout_date) && $erreur_ajout_date) {
1142print
'</table>'.
"\n";
1146$toutsujet = explode(
",",
$object->sujet);
1150for ($i = 0; $i < $nbcolonnes; $i++) {
1151 if (isset($sumfor[$i]) && isset($meilleurecolonne) && ($sumfor[$i] == $meilleurecolonne)) {
1152 $meilleursujet .= ($meilleursujet ?
", " :
"");
1156 if (strpos($toutsujet[$i],
'@') !==
false) {
1157 $toutsujetdate = explode(
"@", $toutsujet[$i]);
1158 $meilleursujet .=
dol_print_date($toutsujetdate[0],
'daytext').($toutsujetdate[0] ?
' ('.dol_print_date($toutsujetdate[0],
'%A').
')' :
'').
' - '.$toutsujetdate[1];
1160 $meilleursujet .=
dol_print_date((empty($toutsujet[$i]) ? 0 : $toutsujet[$i]),
'daytext').
' ('.
dol_print_date((empty($toutsujet[$i]) ? 0 : $toutsujet[$i]),
'%A').
')';
1163 $tmps = explode(
'@', $toutsujet[$i]);
1171$meilleursujet = str_replace(
"°",
"'", $meilleursujet);
1174if ($nbofcheckbox >= 2) {
1175 $vote_str = $langs->trans(
'votes');
1176 print
'<p class="affichageresultats">'.
"\n";
1178 if (isset($meilleurecolonne) && $compteursujet ==
"1") {
1179 print
'<img src="'.DOL_URL_ROOT.
'/opensurvey/img/medaille.png"> '.$langs->trans(
'TheBestChoice').
": <b>".$meilleursujet.
"</b> - <b>".$meilleurecolonne.
"</b> ".$vote_str.
".\n";
1180 } elseif (isset($meilleurecolonne)) {
1181 print
'<img src="'.DOL_URL_ROOT.
'/opensurvey/img/medaille.png"> '.$langs->trans(
'TheBestChoices').
": <b>".$meilleursujet.
"</b> - <b>".$meilleurecolonne.
"</b> ".$vote_str.
".\n";
1183 print
'<br></p><br>'.
"\n";
1186print
'</form>'.
"\n";
1188print
'<a name="bas"></a>'.
"\n";
if(! $sortfield) if(! $sortorder) $object
global $dolibarr_main_url_root
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
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_now($mode='gmt')
Return date for now.
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_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
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, $morecssdiv='')
Show tabs of a record.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
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.
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_print_email($email, $contactid=0, $socid=0, $addlink=0, $max=0, $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_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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...
if(getDolGlobalString( 'TAKEPOS_SHOW_CUSTOMER')) print $langs trans('Date')." left Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right PaymentTypeShortLIQ right SELECT p pos_change as p datep as date
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.