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).
"'";
412 $resql2 =
$db->query($sql2);
432 $userstatic->fetch(
$object->fk_user_creat);
435$result =
$object->fetch(
'', $numsondage);
441$title =
$object->title.
" - ".$langs->trans(
'Card');
444$arrayofcss = array(
'/opensurvey/css/style.css');
446llxHeader(
'', $title, $helpurl,
'', 0, 0, $arrayofjs, $arrayofcss);
450$toutsujet = explode(
",",
$object->sujet);
451$listofanswers = array();
452foreach ($toutsujet as $value) {
453 $tmp = explode(
'@', $value);
454 $listofanswers[] = array(
'label' => $tmp[0],
'format' => (!empty($tmp[1]) ? $tmp[1] :
'checkbox'));
456$toutsujet = str_replace(
"@",
"<br>", $toutsujet);
457$toutsujet = str_replace(
"°",
"'", $toutsujet);
460print
'<form name="formulaire4" action="#" method="POST">'.
"\n";
461print
'<input type="hidden" name="token" value="'.newToken().
'">';
462print
'<input type="hidden" name="id" value="'.GETPOST(
'id').
'">';
470$linkback =
'<a href="'.DOL_URL_ROOT.
'/opensurvey/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
472dol_banner_tab($object,
'id', $linkback, 1,
'id_sondage',
'id_sondage', $morehtmlref);
475print
'<div class="fichecenter">';
477print
'<div class="fichehalfleft">';
478print
'<div class="underbanner clearboth"></div>';
479print
'<table class="border tableforfield centpercent">';
482$type = (
$object->format ==
"A") ?
'classic' :
'date';
483print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td>';
484print
img_picto(
'',
dol_buildpath(
'/opensurvey/img/'.($type ==
'classic' ?
'chart-32.png' :
'calendar-32.png'), 1),
'width="16"', 1);
485print
' '.$langs->trans($type ==
'classic' ?
"TypeClassic" :
"TypeDate").
'</td></tr>';
489$adresseadmin =
$object->mail_admin;
490print $langs->trans(
"Title").
'</td><td>';
491if ($action ==
'edit') {
492 print
'<input type="text" name="nouveautitre" size="40" value="'.dol_escape_htmltag(
$object->title).
'">';
499print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td class="wordbreak">';
500if ($action ==
'edit') {
501 $doleditor =
new DolEditor(
'nouveauxcommentaires',
$object->description,
'', 120,
'dolibarr_notes',
'In',
true, 1, 1, ROWS_7,
'90%');
502 $doleditor->Create(0,
'');
511 print
'<tr><td>'.$langs->trans(
"EMail").
'</td><td>';
512 if ($action ==
'edit') {
513 print
'<input type="text" name="nouvelleadresse" class="minwidth200" value="'.$object->mail_admin.
'">';
523print
'<div class="fichehalfright">';
524print
'<div class="underbanner clearboth"></div>';
526print
'<table class="border tableforfield centpercent">';
529print
'<tr><td>'.$langs->trans(
'ExpireDate').
'</td><td>';
530if ($action ==
'edit') {
531 print $form->selectDate($expiredate ? $expiredate :
$object->date_fin,
'expire', 0, 0, 0,
'', 1, 0);
542print $langs->trans(
"Author").
'</td><td>';
543if (
$object->fk_user_creat && $userstatic !==
null) {
544 print $userstatic->getLoginUrl(-1);
551print
'<tr><td>'.$langs->trans(
"UrlForSurvey",
'').
'</td><td>';
555$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
558$url = $urlwithouturlroot.dol_buildpath(
'/public/opensurvey/studs.php', 1).
'?sondage='.
$object->id_sondage;
559$urllink =
'<input type="text" class="quatrevingtpercent" '.($action ==
'edit' ?
'disabled' :
'').
' id="opensurveyurl" name="opensurveyurl" value="'.$url.
'" spellcheck="false">';
561if ($action !=
'edit') {
562 print ajax_autoselect(
"opensurveyurl", $url,
'image');
571print
'<div class="clearboth"></div>';
580print
'<div class="tabsAction">';
582print
'<a class="butAction" href="exportcsv.php?id='.urlencode($numsondage).
'">'.$langs->trans(
"ExportSpreadsheet").
' (.CSV)</a>';
590 if (!$user->hasRight(
'opensurvey',
'write')) {
594 print
'<form name="formulaire" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
595 print
'<input type="hidden" name="token" value="'.newToken().
'">';
596 print
'<input type="hidden" name="backtopage" value="'.GETPOST(
'backtopage',
'alpha').
'">';
597 print
'<input type="hidden" name="id" value="'.GETPOST(
'id',
'alpha').
'">';
598 print
'<input type="hidden" name="ajoutsujet" value="1">';
600 print
'<div class="center">'.
"\n";
605 print $langs->trans(
"AddNewColumn").
':<br><br>';
606 print $langs->trans(
"Title").
' <input type="text" name="nouvellecolonne" size="40"><br>';
607 $tmparray = array(
'checkbox' => $langs->trans(
"CheckBox"),
'yesno' => $langs->trans(
"YesNoList"),
'foragainst' => $langs->trans(
"PourContreList"));
608 print $langs->trans(
"Type").
' '.$form->selectarray(
"typecolonne", $tmparray,
GETPOST(
'typecolonne')).
'<br><br>';
609 print
'<input type="submit" class="button" name="ajoutercolonne" value="'.dol_escape_htmltag($langs->trans(
"Add")).
'">';
610 print
'<input type="hidden" name="id_sondage" value="'.dol_escape_htmltag(
$object->id_sondage).
'">';
611 print
' ';
612 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
613 print
'<br><br>'.
"\n";
615 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
619 print $langs->trans(
"AddADate").
':<br><br>'.
"\n";
620 print
'<select name="nouveaujour"> '.
"\n";
621 print
'<option value="vide"> </option>'.
"\n";
622 for ($i = 1; $i < 32; $i++) {
623 print
'<option value="'.$i.
'">'.$i.
'</option>'.
"\n";
625 print
'</select>'.
"\n";
627 print $formother->select_month(
'',
'nouveaumois', 1);
631 print $formother->selectyear(
'',
'nouvelleannee', 1, 0, 5, 0, 1);
633 print
'<br><br>'.$langs->trans(
"AddStartHour").
': <br><br>'.
"\n";
634 print
'<select name="nouvelleheuredebut"> '.
"\n";
635 print
'<option value="vide"> </option>'.
"\n";
636 for ($i = 0; $i < 24; $i++) {
637 print
'<option value="'.$i.
'">'.$i.
' H</option>'.
"\n";
639 print
'</select>'.
"\n";
640 print
'<select name="nouvelleminutedebut"> '.
"\n";
641 print
'<option value="vide"> </option>'.
"\n";
642 print
'<option value="00">00</option>'.
"\n";
643 print
'<option value="15">15</option>'.
"\n";
644 print
'<option value="30">30</option>'.
"\n";
645 print
'<option value="45">45</option>'.
"\n";
646 print
'</select>'.
"\n";
647 print
'<br><br>'.$langs->trans(
"AddEndHour").
': <br><br>'.
"\n";
648 print
'<select name="nouvelleheurefin"> '.
"\n";
649 print
'<option value="vide"> </option>'.
"\n";
650 for ($i = 0; $i < 24; $i++) {
651 print
'<option value="'.$i.
'">'.$i.
' H</option>'.
"\n";
653 print
'</SELECT>'.
"\n";
654 print
'<select name="nouvelleminutefin"> '.
"\n";
655 print
'<option value="vide"> </option>'.
"\n";
656 print
'<option value="00">00</option>'.
"\n";
657 print
'<option value="15">15</option>'.
"\n";
658 print
'<option value="30">30</option>'.
"\n";
659 print
'<option value="45">45</option>'.
"\n";
660 print
'</select>'.
"\n";
663 print
' <input type="submit" class="button" name="ajoutercolonne" value="'.dol_escape_htmltag($langs->trans(
"Add")).
'">'.
"\n";
664 print
' ';
665 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
668 print
'</form>'.
"\n";
669 print
'<br><br><br><br>'.
"\n";
675if ($user->hasRight(
'opensurvey',
'write')) {
676 print
'<span class="opacitymedium">';
677 $s = $langs->trans(
"PollAdminDesc",
'{s1}', $langs->trans(
"Add"));
678 print str_replace(
'{s1}',
img_picto(
'',
'delete'), $s);
682$nbcolonnes = substr_count(
$object->sujet,
',') + 1;
684print
'<form name="formulaire" action="" method="POST">'.
"\n";
685print
'<input type="hidden" name="token" value="'.newToken().
'">';
686print
'<input type="hidden" name="page_y" value="">';
688print
'<div class="cadre div-table-responsive-no-min"> '.
"\n";
691print
'<table class="resultats margintoponly">'.
"\n";
694$toutsujet = explode(
",",
$object->sujet);
695$toutsujet = str_replace(
"°",
"'", $toutsujet);
698print
'<td></td>'.
"\n";
699print
'<td></td>'.
"\n";
702if ($user->hasRight(
'opensurvey',
'write')) {
703 for ($i = 0; isset($toutsujet[$i]); $i++) {
704 print
'<td class=somme><input type="image" class="buttonwebsite" name="effacecolonne'.$i.
'" src="'.
img_picto(
'',
'delete',
'', 0, 1).
'"></td>'.
"\n";
715 print
'<td></td>'.
"\n";
716 print
'<td></td>'.
"\n";
720 $nbofsujet = count($toutsujet);
721 for ($i = 0; $i < $nbofsujet; $i++) {
722 if (isset($toutsujet[$i + 1]) &&
date(
'Y', intval($toutsujet[$i])) ==
date(
'Y', intval($toutsujet[$i + 1]))) {
725 print
'<td colspan='.$colspan.
' class="annee">'.
date(
'Y', intval($toutsujet[$i])).
'</td>'.
"\n";
730 if ($user->hasRight(
'opensurvey',
'write')) {
731 print
'<td class="annee">';
732 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?ajoutsujet=1&id='.
$object->id_sondage.
'">'.$langs->trans(
"Add").
'</a></td>'.
"\n";
737 print
'<td></td>'.
"\n";
738 print
'<td></td>'.
"\n";
742 for ($i = 0; $i < $nbofsujet; $i++) {
743 $cur = intval($toutsujet[$i]);
745 if (!isset($toutsujet[$i + 1])) {
748 $next = intval($toutsujet[$i + 1]);
754 print
'<td colspan='.$colspan.
' class="mois">'.
dol_print_date($cur,
"%B").
'</td>'.
"\n";
760 if ($user->hasRight(
'opensurvey',
'write')) {
761 print
'<td class="mois"><a href="'.$_SERVER[
"PHP_SELF"].
'?ajoutsujet=1&id='.
$object->id_sondage.
'">'.$langs->trans(
"Add").
'</a></td>'.
"\n";
766 print
'<td></td>'.
"\n";
767 print
'<td></td>'.
"\n";
771 for ($i = 0; $i < $nbofsujet; $i++) {
772 $cur = intval($toutsujet[$i]);
773 if (!isset($toutsujet[$i + 1])) {
776 $next = intval($toutsujet[$i + 1]);
781 print
'<td colspan='.$colspan.
' class="jour">'.
dol_print_date($cur,
"%a %d").
'</td>'.
"\n";
787 if ($user->hasRight(
'opensurvey',
'write')) {
788 print
'<td class="jour"><a href="'.$_SERVER[
"PHP_SELF"].
'?ajoutsujet=1&id='.
$object->id_sondage.
'">'.$langs->trans(
"Add").
'</a></td>'.
"\n";
793 if (strpos(
$object->sujet,
'@') !==
false) {
795 print
'<td></td>'.
"\n";
796 print
'<td></td>'.
"\n";
798 for ($i = 0; isset($toutsujet[$i]); $i++) {
799 $heures = explode(
'@', $toutsujet[$i]);
800 if (isset($heures[1])) {
801 print
'<td class="heure">'.dol_htmlentities($heures[1]).
'</td>'.
"\n";
803 print
'<td class="heure"></td>'.
"\n";
807 if ($user->hasRight(
'opensurvey',
'write')) {
808 print
'<td class="heure"><a href="'.$_SERVER[
"PHP_SELF"].
'?ajoutsujet=1&id='.
$object->id_sondage.
'">'.$langs->trans(
"Add").
'</a></td>'.
"\n";
816 print
'<td></td>'.
"\n";
817 print
'<td></td>'.
"\n";
819 for ($i = 0; isset($toutsujet[$i]); $i++) {
820 $tmp = explode(
'@', $toutsujet[$i]);
821 print
'<td class="sujet">'.dol_htmlentities($tmp[0]).
'</td>'.
"\n";
824 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";
831$sumagainst = array();
833$sql =
"SELECT id_users, nom as name, id_sondage, reponses, tms, date_creation";
834$sql .=
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs";
835$sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
837$resql =
$db->query($sql);
842$num =
$db->num_rows($resql);
843while ($compteur < $num) {
844 $obj =
$db->fetch_object($resql);
846 $ensemblereponses = $obj->reponses;
848 print
'<tr><td>'.
"\n";
850 if ($user->hasRight(
'opensurvey',
'write')) {
851 print
'<input type="image" class="reposition" name="effaceligne'.$compteur.
'" src="'.
img_picto(
'',
'delete',
'', 0, 1).
'">'.
"\n";
855 $tooltip = $obj->name.
'<br>'.$langs->trans(
"DateCreation").
': '.
dol_print_date($obj->date_creation,
'dayhour');
856 print
'</td><td class="nom classfortooltip" title="'.dolPrintHTMLForAttribute($tooltip).
'">';
861 if (!$testligneamodifier) {
862 for ($i = 0; $i < $nbcolonnes; $i++) {
863 $car = substr($ensemblereponses, $i, 1);
866 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
867 if (((
string) $car) ==
"1") {
868 print
'<td class="ok">OK</td>'.
"\n";
870 print
'<td class="non">KO</td>'.
"\n";
873 if (!isset($sumfor[$i])) {
876 if (((
string) $car) ==
"1") {
880 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
881 if (((
string) $car) ==
"1") {
882 print
'<td class="ok">'.$langs->trans(
"Yes").
'</td>'.
"\n";
883 } elseif (((
string) $car) ==
"0") {
884 print
'<td class="non">'.$langs->trans(
"No").
'</td>'.
"\n";
886 print
'<td class="vide"> </td>'.
"\n";
889 if (!isset($sumfor[$i])) {
892 if (!isset($sumagainst[$i])) {
895 if (((
string) $car) ==
"1") {
898 if (((
string) $car) ==
"0") {
902 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
903 if (((
string) $car) ==
"1") {
904 print
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
905 } elseif (((
string) $car) ==
"0") {
906 print
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
908 print
'<td class="vide"> </td>'.
"\n";
911 if (!isset($sumfor[$i])) {
914 if (!isset($sumagainst[$i])) {
917 if (((
string) $car) ==
"1") {
920 if (((
string) $car) ==
"0") {
927 if ($compteur == $ligneamodifier) {
928 for ($i = 0; $i < $nbcolonnes; $i++) {
929 $car = substr($ensemblereponses, $i, 1);
930 print
'<td class="vide">';
931 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
932 print
'<input type="checkbox" name="choix'.$i.
'" value="1" ';
938 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
939 $arraychoice = array(
'2' =>
' ',
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
940 print $form->selectarray(
"choix".$i, $arraychoice, $car);
942 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
943 $arraychoice = array(
'2' =>
' ',
'0' => $langs->trans(
"Against"),
'1' => $langs->trans(
"For"));
944 print $form->selectarray(
"choix".$i, $arraychoice, $car);
949 for ($i = 0; $i < $nbcolonnes; $i++) {
950 $car = substr($ensemblereponses, $i, 1);
951 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
952 if (((
string) $car) ==
"1") {
953 print
'<td class="ok">OK</td>'.
"\n";
955 print
'<td class="non">KO</td>'.
"\n";
958 if (!isset($sumfor[$i])) {
961 if (((
string) $car) ==
"1") {
965 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
966 if (((
string) $car) ==
"1") {
967 print
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
968 } elseif (((
string) $car) ==
"0") {
969 print
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
971 print
'<td class="vide"> </td>'.
"\n";
974 if (!isset($sumfor[$i])) {
977 if (!isset($sumagainst[$i])) {
980 if (((
string) $car) ==
"1") {
983 if (((
string) $car) ==
"0") {
987 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
988 if (((
string) $car) ==
"1") {
989 print
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
990 } elseif (((
string) $car) ==
"0") {
991 print
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
993 print
'<td class="vide"> </td>'.
"\n";
996 if (!isset($sumfor[$i])) {
999 if (!isset($sumagainst[$i])) {
1000 $sumagainst[$i] = 0;
1002 if (((
string) $car) ==
"1") {
1005 if (((
string) $car) ==
"0") {
1014 if ($compteur != $ligneamodifier && ($user->hasRight(
'opensurvey',
'write'))) {
1015 print
'<td class="casevide"><input type="submit" class="button reposition" name="modifierligne'.$compteur.
'" value="'.
dol_escape_htmltag($langs->trans(
"Edit")).
'"></td>'.
"\n";
1019 for ($i = 0; $i < $nblines; $i++) {
1020 if (GETPOSTISSET(
"modifierligne".$i)) {
1021 if ($compteur == $i) {
1022 print
'<td class="casevide">';
1023 print
'<input type="hidden" name="idtomodify'.$compteur.
'" value="'.$obj->id_users.
'">';
1024 print
'<input type="submit" class="button button-save reposition" name="validermodifier'.$compteur.
'" value="'.
dol_escape_htmltag($langs->trans(
"Save")).
'">';
1035if (empty($testligneamodifier)) {
1037 print
'<td></td>'.
"\n";
1038 print
'<td class="nom">'.
"\n";
1039 print
'<input type="text" class="maxwidthonsmartphone" placeholder="'.dol_escape_htmltag($langs->trans(
"Name")).
'" name="nom" maxlength="64">'.
"\n";
1042 for ($i = 0; $i < $nbcolonnes; $i++) {
1043 print
'<td class="vide">';
1044 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
1045 print
'<input type="checkbox" name="choix'.$i.
'" value="1"';
1046 if (GETPOSTISSET(
'choix'.$i) &&
GETPOST(
'choix'.$i) ==
'1') {
1051 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
1052 $arraychoice = array(
'2' =>
' ',
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
1053 print $form->selectarray(
"choix".$i, $arraychoice);
1055 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
1056 $arraychoice = array(
'2' =>
' ',
'0' => $langs->trans(
"Against"),
'1' => $langs->trans(
"For"));
1057 print $form->selectarray(
"choix".$i, $arraychoice);
1063 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";
1069$meilleurecolonne =
null;
1070for ($i = 0; $i < $nbcolonnes + 1; $i++) {
1071 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
1074 if (isset($sumfor[$i])) {
1076 $meilleurecolonne = $sumfor[$i];
1077 } elseif ($sumfor[$i] > $meilleurecolonne) {
1078 $meilleurecolonne = $sumfor[$i];
1086print
'<td></td>'.
"\n";
1087print
'<td class="center">'.$langs->trans(
"Total").
'</td>'.
"\n";
1088for ($i = 0; $i < $nbcolonnes; $i++) {
1089 $showsumfor = isset($sumfor[$i]) ? $sumfor[$i] :
'';
1090 $showsumagainst = isset($sumagainst[$i]) ? $sumagainst[$i] :
'';
1091 if (empty($showsumfor)) {
1094 if (empty($showsumagainst)) {
1095 $showsumagainst = 0;
1099 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
1102 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
1103 print $langs->trans(
"Yes").
': '.$showsumfor.
'<br>'.$langs->trans(
"No").
': '.$showsumagainst;
1105 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
1106 print $langs->trans(
"For").
': '.$showsumfor.
'<br>'.$langs->trans(
"Against").
': '.$showsumagainst;
1112if ($nbofcheckbox >= 2) {
1114 print
'<td></td>'.
"\n";
1115 print
'<td></td>'.
"\n";
1116 for ($i = 0; $i < $nbcolonnes; $i++) {
1117 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst')) && isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) {
1118 print
'<td class="somme"><img src="'.dol_buildpath(
'/opensurvey/img/medaille.png', 1).
'"></td>'.
"\n";
1120 print
'<td class="somme"></td>'.
"\n";
1127if (GETPOSTISSET(
"boutonp") &&
GETPOST(
"nom") ==
"") {
1128 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Name")),
null,
'errors');
1131if (isset($erreur_prenom) && $erreur_prenom) {
1135if (isset($erreur_ajout_date) && $erreur_ajout_date) {
1140print
'</table>'.
"\n";
1144$toutsujet = explode(
",",
$object->sujet);
1148for ($i = 0; $i < $nbcolonnes; $i++) {
1149 if (isset($sumfor[$i]) && isset($meilleurecolonne) && ($sumfor[$i] == $meilleurecolonne)) {
1150 $meilleursujet .= ($meilleursujet ?
", " :
"");
1154 if (strpos($toutsujet[$i],
'@') !==
false) {
1155 $toutsujetdate = explode(
"@", $toutsujet[$i]);
1156 $meilleursujet .=
dol_print_date($toutsujetdate[0],
'daytext').($toutsujetdate[0] ?
' ('.dol_print_date($toutsujetdate[0],
'%A').
')' :
'').
' - '.$toutsujetdate[1];
1158 $meilleursujet .=
dol_print_date((empty($toutsujet[$i]) ? 0 : $toutsujet[$i]),
'daytext').
' ('.
dol_print_date((empty($toutsujet[$i]) ? 0 : $toutsujet[$i]),
'%A').
')';
1161 $tmps = explode(
'@', $toutsujet[$i]);
1169$meilleursujet = str_replace(
"°",
"'", $meilleursujet);
1172if ($nbofcheckbox >= 2) {
1173 $vote_str = $langs->trans(
'votes');
1174 print
'<p class="affichageresultats">'.
"\n";
1176 if (isset($meilleurecolonne) && $compteursujet ==
"1") {
1177 print
'<img src="'.DOL_URL_ROOT.
'/opensurvey/img/medaille.png"> '.$langs->trans(
'TheBestChoice').
": <b>".$meilleursujet.
"</b> - <b>".$meilleurecolonne.
"</b> ".$vote_str.
".\n";
1178 } elseif (isset($meilleurecolonne)) {
1179 print
'<img src="'.DOL_URL_ROOT.
'/opensurvey/img/medaille.png"> '.$langs->trans(
'TheBestChoices').
": <b>".$meilleursujet.
"</b> - <b>".$meilleurecolonne.
"</b> ".$vote_str.
".\n";
1181 print
'<br></p><br>'.
"\n";
1184print
'</form>'.
"\n";
1186print
'<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.
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
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.
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_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...
print $langs trans('Date')." left Ref 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 Paid 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.