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";
43if (!$user->hasRight(
'opensurvey',
'read')) {
48$action =
GETPOST(
'action',
'aZ09');
49$numsondage =
GETPOST(
"id",
'alphanohtml');
52$result =
$object->fetch(0, $numsondage);
57$nblines =
$object->fetch_lines();
67 header(
'Location: results.php?id='.(GETPOSTISSET(
'id_sondage') ?
GETPOST(
'id_sondage',
'aZ09') :
GETPOST(
'id',
'alphanohtml')));
71$nbcolonnes = substr_count(
$object->sujet,
',') + 1;
76 $erreur_prenom =
false;
79 for ($i = 0; $i < $nbcolonnes; $i++) {
80 if (GETPOSTISSET(
"choix$i") &&
GETPOST(
"choix$i") ==
'1') {
82 } elseif (GETPOSTISSET(
"choix$i") &&
GETPOST(
"choix$i") ==
'2') {
89 $nom = substr(
GETPOST(
"nom",
'alphanohtml'), 0, 64);
92 $sql =
'SELECT id_users, nom as name';
93 $sql .=
' FROM '.MAIN_DB_PREFIX.
'opensurvey_user_studs';
94 $sql .=
" WHERE id_sondage='".$db->escape($numsondage).
"' AND nom = '".$db->escape($nom).
"'";
95 $sql .=
' ORDER BY id_users';
96 $resql = $db->query($sql);
97 $num_rows = $db->num_rows($resql);
102 $sql =
'INSERT INTO '.MAIN_DB_PREFIX.
'opensurvey_user_studs (nom, id_sondage, reponses, date_creation)';
103 $sql .=
" VALUES ('".$db->escape($nom).
"', '".$db->escape($numsondage).
"', '".$db->escape($nouveauchoix).
"', '".$db->idate(
dol_now()).
"')";
104 $resql = $db->query($sql);
113$testmodifier =
false;
114$testligneamodifier =
false;
116for ($i = 0; $i < $nblines; $i++) {
117 if (GETPOSTISSET(
'modifierligne'.$i)) {
118 $ligneamodifier = $i;
119 $testligneamodifier =
true;
123 if (GETPOSTISSET(
'validermodifier'.$i)) {
125 $testmodifier =
true;
130 if (!$user->hasRight(
'opensurvey',
'write')) {
135 for ($i = 0; $i < $nbcolonnes; $i++) {
136 if (GETPOSTISSET(
"choix$i") &&
GETPOST(
"choix$i") ==
'1') {
137 $nouveauchoix .=
"1";
138 } elseif (GETPOSTISSET(
"choix$i") &&
GETPOST(
"choix$i") ==
'2') {
139 $nouveauchoix .=
"2";
141 $nouveauchoix .=
"0";
145 $idtomodify =
GETPOST(
"idtomodify".$modifier);
146 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_user_studs";
147 $sql .=
" SET reponses = '".$db->escape($nouveauchoix).
"'";
148 $sql .=
" WHERE id_users = '".$db->escape($idtomodify).
"'";
150 $resql = $db->query($sql);
159 if (!$user->hasRight(
'opensurvey',
'write')) {
163 $nouveauxsujets =
$object->sujet;
166 $nouveauxsujets .=
',';
167 $nouveauxsujets .= str_replace(array(
",",
"@"),
" ",
GETPOST(
"nouvellecolonne")).(!
GETPOST(
"typecolonne") ?
'' :
'@'.GETPOST(
"typecolonne"));
170 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_sondage";
171 $sql .=
" SET sujet = '".$db->escape($nouveauxsujets).
"'";
172 $sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
173 $resql = $db->query($sql);
177 header(
'Location: results.php?id='.
$object->id_sondage);
183if (GETPOSTISSET(
"ajoutercolonne") &&
$object->format ==
"D") {
185 if (!$user->hasRight(
'opensurvey',
'write')) {
189 $nouveauxsujets =
$object->sujet;
191 if (GETPOSTISSET(
"nouveaujour") &&
GETPOST(
"nouveaujour") !=
"vide" &&
192 GETPOSTISSET(
"nouveaumois") &&
GETPOST(
"nouveaumois") !=
"vide" &&
193 GETPOSTISSET(
"nouvelleannee") &&
GETPOST(
"nouvelleannee") !=
"vide") {
196 if (GETPOSTISSET(
"nouvelleheuredebut") &&
GETPOST(
"nouvelleheuredebut") !=
"vide") {
197 $nouvelledate .=
"@";
198 $nouvelledate .=
GETPOST(
"nouvelleheuredebut");
199 $nouvelledate .=
"h";
201 if (
GETPOST(
"nouvelleminutedebut") !=
"vide") {
202 $nouvelledate .=
GETPOST(
"nouvelleminutedebut");
206 if (GETPOSTISSET(
"nouvelleheurefin") &&
GETPOST(
"nouvelleheurefin") !=
"vide") {
207 $nouvelledate .=
"-";
208 $nouvelledate .=
GETPOST(
"nouvelleheurefin");
209 $nouvelledate .=
"h";
211 if (
GETPOST(
"nouvelleminutefin") !=
"vide") {
212 $nouvelledate .=
GETPOST(
"nouvelleminutefin");
216 if (
GETPOST(
"nouvelleheuredebut") ==
"vide" || (GETPOSTISSET(
"nouvelleheuredebut") && GETPOSTISSET(
"nouvelleheurefin")
218 && (
GETPOST(
"nouvelleminutedebut") <
GETPOST(
"nouvelleminutefin")))))) {
219 $erreur_ajout_date =
false;
221 $erreur_ajout_date =
"yes";
225 $datesbase = explode(
",",
$object->sujet);
226 $taillebase = count($datesbase);
229 if ($nouvelledate < $datesbase[0]) {
231 } elseif ($nouvelledate > $datesbase[$taillebase - 1]) {
232 $cleinsertion = count($datesbase);
234 $nbdatesbase = count($datesbase);
235 for ($i = 0; $i < $nbdatesbase; $i++) {
237 if ($nouvelledate > $datesbase[$i] && $nouvelledate < $datesbase[$j]) {
243 array_splice($datesbase, $cleinsertion, 0, $nouvelledate);
244 $cle = array_search($nouvelledate, $datesbase);
246 $nbofdates = count($datesbase);
247 for ($i = 0; $i < $nbofdates; $i++) {
248 $dateinsertion .=
",";
249 $dateinsertion .= $datesbase[$i];
252 $dateinsertion = substr(
"$dateinsertion", 1);
255 if (isset($erreur_ajout_date) && empty($erreur_ajout_date)) {
256 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_sondage";
257 $sql .=
" SET sujet = '".$db->escape($dateinsertion).
"'";
258 $sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
259 $resql = $db->query($sql);
263 header(
'Location: results.php?id='.
$object->id_sondage);
266 if ($cleinsertion >= 0) {
267 $sql =
'SELECT s.reponses';
268 $sql .=
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs as s";
269 $sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
270 $resql = $db->query($sql);
274 $num = $db->num_rows($resql);
276 while ($compteur < $num) {
277 $obj = $db->fetch_object($resql);
278 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_user_studs";
279 if ($cleinsertion == 0) {
280 $sql .=
" SET reponses = '0".$db->escape($obj->reponses).
"'";
282 $reponsesadd = str_split($obj->reponses);
283 $lengthresponses = count($reponsesadd);
284 for ($cpt = $lengthresponses; $cpt > $cleinsertion; $cpt--) {
285 $reponsesadd[$cpt] = $reponsesadd[$cpt - 1];
287 $reponsesadd[$cleinsertion] =
'0';
288 $reponsesadd = implode($reponsesadd);
289 $sql .=
" SET reponses = '".$db->escape($reponsesadd).
"'";
291 $sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
292 $resql = $db->query($sql);
300 $adresseadmin =
$object->mail_admin;
302 $erreur_ajout_date =
"yes";
307for ($i = 0; $i < $nblines; $i++) {
310 if (!$user->hasRight(
'opensurvey',
'write')) {
318 $sql =
"SELECT id_users, nom as name, id_sondage, reponses";
319 $sql .=
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs";
320 $sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
321 $resql = $db->query($sql);
325 $num = $db->num_rows($resql);
326 while ($compteur < $num) {
327 $obj = $db->fetch_object($resql);
329 if ($compteur == $i) {
330 $sql2 =
'DELETE FROM '.MAIN_DB_PREFIX.
'opensurvey_user_studs';
331 $sql2 .=
" WHERE id_users = ".((int) $obj->id_users);
332 $resql2 = $db->query($sql2);
341for ($i = 0; $i < $nbcolonnes; $i++) {
342 if ((
GETPOST(
"effacecolonne".$i) ||
GETPOST(
"effacecolonne".$i.
"_x") ||
GETPOST(
"effacecolonne".$i.
".x"))
343 && $nbcolonnes > 1) {
345 if (!$user->hasRight(
'opensurvey',
'write')) {
351 $toutsujet = explode(
",",
$object->sujet);
353 $nouveauxsujets =
'';
356 while (isset($toutsujet[$j])) {
359 if (!empty($nouveauxsujets)) {
360 $nouveauxsujets .=
',';
362 $nouveauxsujets .= $toutsujet[$j];
369 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_sondage";
370 $sql .=
" SET sujet = '".$db->escape($nouveauxsujets).
"' WHERE id_sondage = '".$db->escape($numsondage).
"'";
371 $resql = $db->query($sql);
378 $sql =
"SELECT id_users, nom as name, id_sondage, reponses";
379 $sql .=
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs";
380 $sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
382 $resql = $db->query($sql);
387 $num = $db->num_rows($resql);
388 while ($compteur < $num) {
389 $obj = $db->fetch_object($resql);
392 $ensemblereponses = $obj->reponses;
395 for ($j = 0; $j < $nbcolonnes; $j++) {
396 $car = substr($ensemblereponses, $j, 1);
404 $sql2 =
'UPDATE '.MAIN_DB_PREFIX.
'opensurvey_user_studs';
405 $sql2 .=
" SET reponses = '".$db->escape($newcar).
"'";
406 $sql2 .=
" WHERE id_users = '".$db->escape($obj->id_users).
"'";
409 $resql2 = $db->query($sql2);
424$form =
new Form($db);
427 $userstatic =
new User($db);
428 $userstatic->fetch(
$object->fk_user_creat);
431$result =
$object->fetch(0, $numsondage);
437$title =
$object->title.
" - ".$langs->trans(
'Card');
440$arrayofcss = array(
'/opensurvey/css/style.css');
442llxHeader(
'', $title, $helpurl,
'', 0, 0, $arrayofjs, $arrayofcss);
446$toutsujet = explode(
",",
$object->sujet);
447$listofanswers = array();
448foreach ($toutsujet as $value) {
449 $tmp = explode(
'@', $value);
450 $listofanswers[] = array(
'label' => $tmp[0],
'format' => (!empty($tmp[1]) ? $tmp[1] :
'checkbox'));
452$toutsujet = str_replace(
"@",
"<br>", $toutsujet);
453$toutsujet = str_replace(
"°",
"'", $toutsujet);
456print
'<form name="formulaire4" action="#" method="POST">'.
"\n";
457print
'<input type="hidden" name="token" value="'.newToken().
'">';
458print
'<input type="hidden" name="id" value="'.GETPOST(
'id').
'">';
466$linkback =
'<a href="'.DOL_URL_ROOT.
'/opensurvey/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
468dol_banner_tab($object,
'id', $linkback, 1,
'id_sondage',
'id_sondage', $morehtmlref);
471print
'<div class="fichecenter">';
473print
'<div class="fichehalfleft">';
474print
'<div class="underbanner clearboth"></div>';
475print
'<table class="border tableforfield centpercent">';
478$type = (
$object->format ==
"A") ?
'classic' :
'date';
479print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td>';
480print
img_picto(
'',
dol_buildpath(
'/opensurvey/img/'.($type ==
'classic' ?
'chart-32.png' :
'calendar-32.png'), 1),
'width="16"', 1);
481print
' '.$langs->trans($type ==
'classic' ?
"TypeClassic" :
"TypeDate").
'</td></tr>';
485$adresseadmin =
$object->mail_admin;
486print $langs->trans(
"Title").
'</td><td>';
487if ($action ==
'edit') {
488 print
'<input type="text" name="nouveautitre" size="40" value="'.dol_escape_htmltag(
$object->title).
'">';
495print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td class="wordbreak">';
496if ($action ==
'edit') {
497 $doleditor =
new DolEditor(
'nouveauxcommentaires',
$object->description,
'', 120,
'dolibarr_notes',
'In',
true, 1, 1, ROWS_7,
'90%');
498 $doleditor->Create(0,
'');
507 print
'<tr><td>'.$langs->trans(
"EMail").
'</td><td>';
508 if ($action ==
'edit') {
509 print
'<input type="text" name="nouvelleadresse" class="minwidth200" value="'.$object->mail_admin.
'">';
519print
'<div class="fichehalfright">';
520print
'<div class="underbanner clearboth"></div>';
522print
'<table class="border tableforfield centpercent">';
525print
'<tr><td>'.$langs->trans(
'ExpireDate').
'</td><td>';
526if ($action ==
'edit') {
527 print $form->selectDate($expiredate ? $expiredate :
$object->date_fin,
'expire', 0, 0, 0,
'', 1, 0);
538print $langs->trans(
"Author").
'</td><td>';
540 print $userstatic->getLoginUrl(-1);
547print
'<tr><td>'.$langs->trans(
"UrlForSurvey",
'').
'</td><td>';
550$urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
551$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
554$url = $urlwithouturlroot.dol_buildpath(
'/public/opensurvey/studs.php', 1).
'?sondage='.
$object->id_sondage;
555$urllink =
'<input type="text" class="quatrevingtpercent" '.($action ==
'edit' ?
'disabled' :
'').
' id="opensurveyurl" name="opensurveyurl" value="'.$url.
'">';
557if ($action !=
'edit') {
567print
'<div class="clearboth"></div>';
576print
'<div class="tabsAction">';
578print
'<a class="butAction" href="exportcsv.php?id='.urlencode($numsondage).
'">'.$langs->trans(
"ExportSpreadsheet").
' (.CSV)</a>';
586 if (!$user->hasRight(
'opensurvey',
'write')) {
590 print
'<form name="formulaire" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
591 print
'<input type="hidden" name="token" value="'.newToken().
'">';
592 print
'<input type="hidden" name="backtopage" value="'.GETPOST(
'backtopage',
'alpha').
'">';
593 print
'<input type="hidden" name="id" value="'.GETPOST(
'id',
'alpha').
'">';
594 print
'<input type="hidden" name="ajoutsujet" value="1">';
596 print
'<div class="center">'.
"\n";
601 print $langs->trans(
"AddNewColumn").
':<br><br>';
602 print $langs->trans(
"Title").
' <input type="text" name="nouvellecolonne" size="40"><br>';
603 $tmparray = array(
'checkbox' => $langs->trans(
"CheckBox"),
'yesno' => $langs->trans(
"YesNoList"),
'foragainst' => $langs->trans(
"PourContreList"));
604 print $langs->trans(
"Type").
' '.$form->selectarray(
"typecolonne", $tmparray,
GETPOST(
'typecolonne')).
'<br><br>';
605 print
'<input type="submit" class="button" name="ajoutercolonne" value="'.dol_escape_htmltag($langs->trans(
"Add")).
'">';
606 print
'<input type="hidden" name="id_sondage" value="'.dol_escape_htmltag(
$object->id_sondage).
'">';
607 print
' ';
608 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
609 print
'<br><br>'.
"\n";
611 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
615 print $langs->trans(
"AddADate").
':<br><br>'.
"\n";
616 print
'<select name="nouveaujour"> '.
"\n";
617 print
'<OPTION VALUE="vide"> </OPTION>'.
"\n";
618 for ($i = 1; $i < 32; $i++) {
619 print
'<OPTION VALUE="'.$i.
'">'.$i.
'</OPTION>'.
"\n";
621 print
'</select>'.
"\n";
623 print $formother->select_month(
'',
'nouveaumois', 1);
627 print $formother->selectyear(
'',
'nouvelleannee', 1, 0, 5, 0, 1);
629 print
'<br><br>'.$langs->trans(
"AddStartHour").
': <br><br>'.
"\n";
630 print
'<select name="nouvelleheuredebut"> '.
"\n";
631 print
'<OPTION VALUE="vide"> </OPTION>'.
"\n";
632 for ($i = 0; $i < 24; $i++) {
633 print
'<OPTION VALUE="'.$i.
'">'.$i.
' H</OPTION>'.
"\n";
635 print
'</select>'.
"\n";
636 print
'<select name="nouvelleminutedebut"> '.
"\n";
637 print
'<OPTION VALUE="vide"> </OPTION>'.
"\n";
638 print
'<OPTION VALUE="00">00</OPTION>'.
"\n";
639 print
'<OPTION VALUE="15">15</OPTION>'.
"\n";
640 print
'<OPTION VALUE="30">30</OPTION>'.
"\n";
641 print
'<OPTION VALUE="45">45</OPTION>'.
"\n";
642 print
'</select>'.
"\n";
643 print
'<br><br>'.$langs->trans(
"AddEndHour").
': <br><br>'.
"\n";
644 print
'<select name="nouvelleheurefin"> '.
"\n";
645 print
'<OPTION VALUE="vide"> </OPTION>'.
"\n";
646 for ($i = 0; $i < 24; $i++) {
647 print
'<OPTION VALUE="'.$i.
'">'.$i.
' H</OPTION>'.
"\n";
649 print
'</SELECT>'.
"\n";
650 print
'<select name="nouvelleminutefin"> '.
"\n";
651 print
'<OPTION VALUE="vide"> </OPTION>'.
"\n";
652 print
'<OPTION VALUE="00">00</OPTION>'.
"\n";
653 print
'<OPTION VALUE="15">15</OPTION>'.
"\n";
654 print
'<OPTION VALUE="30">30</OPTION>'.
"\n";
655 print
'<OPTION VALUE="45">45</OPTION>'.
"\n";
656 print
'</select>'.
"\n";
659 print
' <input type="submit" class="button" name="ajoutercolonne" value="'.dol_escape_htmltag($langs->trans(
"Add")).
'">'.
"\n";
660 print
' ';
661 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
664 print
'</form>'.
"\n";
665 print
'<br><br><br><br>'.
"\n";
671if ($user->hasRight(
'opensurvey',
'write')) {
672 print
'<span class="opacitymedium">';
673 $s = $langs->trans(
"PollAdminDesc",
'{s1}', $langs->trans(
"Add"));
674 print str_replace(
'{s1}',
img_picto(
'',
'delete'), $s);
678$nbcolonnes = substr_count(
$object->sujet,
',') + 1;
680print
'<form name="formulaire" action="" method="POST">'.
"\n";
681print
'<input type="hidden" name="token" value="'.newToken().
'">';
682print
'<input type="hidden" name="page_y" value="">';
684print
'<div class="cadre div-table-responsive-no-min"> '.
"\n";
687print
'<table class="resultats margintoponly">'.
"\n";
690$toutsujet = explode(
",",
$object->sujet);
691$toutsujet = str_replace(
"°",
"'", $toutsujet);
694print
'<td></td>'.
"\n";
695print
'<td></td>'.
"\n";
698if ($user->hasRight(
'opensurvey',
'write')) {
699 for ($i = 0; isset($toutsujet[$i]); $i++) {
700 print
'<td class=somme><input type="image" class="buttonwebsite" name="effacecolonne'.$i.
'" src="'.
img_picto(
'',
'delete.png',
'', 0, 1).
'"></td>'.
"\n";
711 print
'<td></td>'.
"\n";
712 print
'<td></td>'.
"\n";
716 $nbofsujet = count($toutsujet);
717 for ($i = 0; $i < $nbofsujet; $i++) {
718 if (isset($toutsujet[$i + 1]) && date(
'Y', intval($toutsujet[$i])) == date(
'Y', intval($toutsujet[$i + 1]))) {
721 print
'<td colspan='.$colspan.
' class="annee">'.date(
'Y', intval($toutsujet[$i])).
'</td>'.
"\n";
726 if ($user->hasRight(
'opensurvey',
'write')) {
727 print
'<td class="annee">';
728 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?ajoutsujet=1&id='.
$object->id_sondage.
'">'.$langs->trans(
"Add").
'</a></td>'.
"\n";
733 print
'<td></td>'.
"\n";
734 print
'<td></td>'.
"\n";
738 for ($i = 0; $i < $nbofsujet; $i++) {
739 $cur = intval($toutsujet[$i]);
741 if (!isset($toutsujet[$i + 1])) {
744 $next = intval($toutsujet[$i + 1]);
750 print
'<td colspan='.$colspan.
' class="mois">'.
dol_print_date($cur,
"%B").
'</td>'.
"\n";
756 if ($user->hasRight(
'opensurvey',
'write')) {
757 print
'<td class="mois"><a href="'.$_SERVER[
"PHP_SELF"].
'?ajoutsujet=1&id='.
$object->id_sondage.
'">'.$langs->trans(
"Add").
'</a></td>'.
"\n";
762 print
'<td></td>'.
"\n";
763 print
'<td></td>'.
"\n";
767 for ($i = 0; $i < $nbofsujet; $i++) {
768 $cur = intval($toutsujet[$i]);
769 if (!isset($toutsujet[$i + 1])) {
772 $next = intval($toutsujet[$i + 1]);
777 print
'<td colspan='.$colspan.
' class="jour">'.
dol_print_date($cur,
"%a %d").
'</td>'.
"\n";
783 if ($user->hasRight(
'opensurvey',
'write')) {
784 print
'<td class="jour"><a href="'.$_SERVER[
"PHP_SELF"].
'?ajoutsujet=1&id='.
$object->id_sondage.
'">'.$langs->trans(
"Add").
'</a></td>'.
"\n";
789 if (strpos(
$object->sujet,
'@') !==
false) {
791 print
'<td></td>'.
"\n";
792 print
'<td></td>'.
"\n";
794 for ($i = 0; isset($toutsujet[$i]); $i++) {
795 $heures = explode(
'@', $toutsujet[$i]);
796 if (isset($heures[1])) {
797 print
'<td class="heure">'.dol_htmlentities($heures[1]).
'</td>'.
"\n";
799 print
'<td class="heure"></td>'.
"\n";
803 if ($user->hasRight(
'opensurvey',
'write')) {
804 print
'<td class="heure"><a href="'.$_SERVER[
"PHP_SELF"].
'?ajoutsujet=1&id='.
$object->id_sondage.
'">'.$langs->trans(
"Add").
'</a></td>'.
"\n";
812 print
'<td></td>'.
"\n";
813 print
'<td></td>'.
"\n";
815 for ($i = 0; isset($toutsujet[$i]); $i++) {
816 $tmp = explode(
'@', $toutsujet[$i]);
817 print
'<td class="sujet">'.dol_htmlentities($tmp[0]).
'</td>'.
"\n";
820 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";
827$sumagainst = array();
829$sql =
"SELECT id_users, nom as name, id_sondage, reponses";
830$sql .=
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs";
831$sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
833$resql = $db->query($sql);
838$num = $db->num_rows($resql);
839while ($compteur < $num) {
840 $obj = $db->fetch_object($resql);
842 $ensemblereponses = $obj->reponses;
844 print
'<tr><td>'.
"\n";
846 if ($user->hasRight(
'opensurvey',
'write')) {
847 print
'<input type="image" class="reposition" name="effaceligne'.$compteur.
'" src="'.
img_picto(
'',
'delete.png',
'', 0, 1).
'">'.
"\n";
851 print
'</td><td class="nom">'.dol_htmlentities($obj->name).
'</td>'.
"\n";
854 if (!$testligneamodifier) {
855 for ($i = 0; $i < $nbcolonnes; $i++) {
856 $car = substr($ensemblereponses, $i, 1);
859 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
860 if (((
string) $car) ==
"1") {
861 print
'<td class="ok">OK</td>'.
"\n";
863 print
'<td class="non">KO</td>'.
"\n";
866 if (!isset($sumfor[$i])) {
869 if (((
string) $car) ==
"1") {
873 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
874 if (((
string) $car) ==
"1") {
875 print
'<td class="ok">'.$langs->trans(
"Yes").
'</td>'.
"\n";
876 } elseif (((
string) $car) ==
"0") {
877 print
'<td class="non">'.$langs->trans(
"No").
'</td>'.
"\n";
879 print
'<td class="vide"> </td>'.
"\n";
882 if (!isset($sumfor[$i])) {
885 if (!isset($sumagainst[$i])) {
888 if (((
string) $car) ==
"1") {
891 if (((
string) $car) ==
"0") {
895 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
896 if (((
string) $car) ==
"1") {
897 print
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
898 } elseif (((
string) $car) ==
"0") {
899 print
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
901 print
'<td class="vide"> </td>'.
"\n";
904 if (!isset($sumfor[$i])) {
907 if (!isset($sumagainst[$i])) {
910 if (((
string) $car) ==
"1") {
913 if (((
string) $car) ==
"0") {
920 if ($compteur == $ligneamodifier) {
921 for ($i = 0; $i < $nbcolonnes; $i++) {
922 $car = substr($ensemblereponses, $i, 1);
923 print
'<td class="vide">';
924 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
925 print
'<input type="checkbox" name="choix'.$i.
'" value="1" ';
931 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
932 $arraychoice = array(
'2' =>
' ',
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
933 print $form->selectarray(
"choix".$i, $arraychoice, $car);
935 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
936 $arraychoice = array(
'2' =>
' ',
'0' => $langs->trans(
"Against"),
'1' => $langs->trans(
"For"));
937 print $form->selectarray(
"choix".$i, $arraychoice, $car);
942 for ($i = 0; $i < $nbcolonnes; $i++) {
943 $car = substr($ensemblereponses, $i, 1);
944 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
945 if (((
string) $car) ==
"1") {
946 print
'<td class="ok">OK</td>'.
"\n";
948 print
'<td class="non">KO</td>'.
"\n";
951 if (!isset($sumfor[$i])) {
954 if (((
string) $car) ==
"1") {
958 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
959 if (((
string) $car) ==
"1") {
960 print
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
961 } elseif (((
string) $car) ==
"0") {
962 print
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
964 print
'<td class="vide"> </td>'.
"\n";
967 if (!isset($sumfor[$i])) {
970 if (!isset($sumagainst[$i])) {
973 if (((
string) $car) ==
"1") {
976 if (((
string) $car) ==
"0") {
980 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
981 if (((
string) $car) ==
"1") {
982 print
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
983 } elseif (((
string) $car) ==
"0") {
984 print
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
986 print
'<td class="vide"> </td>'.
"\n";
989 if (!isset($sumfor[$i])) {
992 if (!isset($sumagainst[$i])) {
995 if (((
string) $car) ==
"1") {
998 if (((
string) $car) ==
"0") {
1007 if ($compteur != $ligneamodifier && ($user->hasRight(
'opensurvey',
'write'))) {
1008 print
'<td class="casevide"><input type="submit" class="button reposition" name="modifierligne'.$compteur.
'" value="'.
dol_escape_htmltag($langs->trans(
"Edit")).
'"></td>'.
"\n";
1012 for ($i = 0; $i < $nblines; $i++) {
1013 if (GETPOSTISSET(
"modifierligne".$i)) {
1014 if ($compteur == $i) {
1015 print
'<td class="casevide">';
1016 print
'<input type="hidden" name="idtomodify'.$compteur.
'" value="'.$obj->id_users.
'">';
1017 print
'<input type="submit" class="button button-save reposition" name="validermodifier'.$compteur.
'" value="'.
dol_escape_htmltag($langs->trans(
"Save")).
'">';
1028if (empty($testligneamodifier)) {
1030 print
'<td></td>'.
"\n";
1031 print
'<td class="nom">'.
"\n";
1032 print
'<input type="text" class="maxwidthonsmartphone" placeholder="'.dol_escape_htmltag($langs->trans(
"Name")).
'" name="nom" maxlength="64">'.
"\n";
1035 for ($i = 0; $i < $nbcolonnes; $i++) {
1036 print
'<td class="vide">';
1037 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
1038 print
'<input type="checkbox" name="choix'.$i.
'" value="1"';
1039 if (GETPOSTISSET(
'choix'.$i) &&
GETPOST(
'choix'.$i) ==
'1') {
1044 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
1045 $arraychoice = array(
'2' =>
' ',
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
1046 print $form->selectarray(
"choix".$i, $arraychoice);
1048 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
1049 $arraychoice = array(
'2' =>
' ',
'0' => $langs->trans(
"Against"),
'1' => $langs->trans(
"For"));
1050 print $form->selectarray(
"choix".$i, $arraychoice);
1056 print
'<td><input type="image" name="boutonp" class="borderimp" value="'.$langs->trans(
"Vote").
'" src="'.
img_picto(
'',
'edit_add',
'', 0, 1).
'"></td>'.
"\n";
1062for ($i = 0; $i < $nbcolonnes + 1; $i++) {
1063 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
1066 if (isset($sumfor[$i])) {
1068 $meilleurecolonne = $sumfor[$i];
1070 if (isset($sumfor[$i]) && $sumfor[$i] > $meilleurecolonne) {
1071 $meilleurecolonne = $sumfor[$i];
1079print
'<td></td>'.
"\n";
1080print
'<td class="center">'.$langs->trans(
"Total").
'</td>'.
"\n";
1081for ($i = 0; $i < $nbcolonnes; $i++) {
1082 $showsumfor = isset($sumfor[$i]) ? $sumfor[$i] :
'';
1083 $showsumagainst = isset($sumagainst[$i]) ? $sumagainst[$i] :
'';
1084 if (empty($showsumfor)) {
1087 if (empty($showsumagainst)) {
1088 $showsumagainst = 0;
1092 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
1095 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
1096 print $langs->trans(
"Yes").
': '.$showsumfor.
'<br>'.$langs->trans(
"No").
': '.$showsumagainst;
1098 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
1099 print $langs->trans(
"For").
': '.$showsumfor.
'<br>'.$langs->trans(
"Against").
': '.$showsumagainst;
1105if ($nbofcheckbox >= 2) {
1107 print
'<td></td>'.
"\n";
1108 print
'<td></td>'.
"\n";
1109 for ($i = 0; $i < $nbcolonnes; $i++) {
1110 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst')) && isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) {
1111 print
'<td class="somme"><img src="'.dol_buildpath(
'/opensurvey/img/medaille.png', 1).
'"></td>'.
"\n";
1113 print
'<td class="somme"></td>'.
"\n";
1120if (GETPOSTISSET(
"boutonp") &&
GETPOST(
"nom") ==
"") {
1121 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Name")),
null,
'errors');
1124if (isset($erreur_prenom) && $erreur_prenom) {
1128if (isset($erreur_ajout_date) && $erreur_ajout_date) {
1133print
'</table>'.
"\n";
1137$toutsujet = explode(
",",
$object->sujet);
1141for ($i = 0; $i < $nbcolonnes; $i++) {
1142 if (isset($sumfor[$i]) && isset($meilleurecolonne) && ($sumfor[$i] == $meilleurecolonne)) {
1143 $meilleursujet .= ($meilleursujet ?
", " :
"");
1147 if (strpos($toutsujet[$i],
'@') !==
false) {
1148 $toutsujetdate = explode(
"@", $toutsujet[$i]);
1149 $meilleursujet .=
dol_print_date($toutsujetdate[0],
'daytext').($toutsujetdate[0] ?
' ('.dol_print_date($toutsujetdate[0],
'%A').
')' :
'').
' - '.$toutsujetdate[1];
1151 $meilleursujet .=
dol_print_date((empty($toutsujet[$i]) ? 0 : $toutsujet[$i]),
'daytext').
' ('.
dol_print_date((empty($toutsujet[$i]) ? 0 : $toutsujet[$i]),
'%A').
')';
1154 $tmps = explode(
'@', $toutsujet[$i]);
1162$meilleursujet = str_replace(
"°",
"'", $meilleursujet);
1165if ($nbofcheckbox >= 2) {
1166 $vote_str = $langs->trans(
'votes');
1167 print
'<p class="affichageresultats">'.
"\n";
1169 if (isset($meilleurecolonne) && $compteursujet ==
"1") {
1170 print
'<img src="'.DOL_URL_ROOT.
'/opensurvey/img/medaille.png"> '.$langs->trans(
'TheBestChoice').
": <b>".$meilleursujet.
"</b> - <b>".$meilleurecolonne.
"</b> ".$vote_str.
".\n";
1171 } elseif (isset($meilleurecolonne)) {
1172 print
'<img src="'.DOL_URL_ROOT.
'/opensurvey/img/medaille.png"> '.$langs->trans(
'TheBestChoices').
": <b>".$meilleursujet.
"</b> - <b>".$meilleurecolonne.
"</b> ".$vote_str.
".\n";
1174 print
'<br></p><br>'.
"\n";
1177print
'</form>'.
"\n";
1179print
'<a name="bas"></a>'.
"\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
dol_now($mode='auto')
Return date for now.
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_htmlentities($string, $flags=ENT_QUOTES|ENT_SUBSTITUTE, $encoding='UTF-8', $double_encode=false)
Replace htmlentities functions.
dol_print_email($email, $cid=0, $socid=0, $addlink=0, $max=64, $showinvalid=1, $withpicto=0, $morecss='paddingrightonly')
Show EMail link formatted for HTML output.
dol_textishtml($msg, $option=0)
Return if a text is a html content.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
opensurvey_prepare_head(Opensurveysondage $object)
Returns an array with the tabs for the "Opensurvey poll" section It loads tabs from modules looking f...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.