27if (!defined(
'NOLOGIN')) {
30if (!defined(
'NOCSRFCHECK')) {
31 define(
"NOCSRFCHECK", 1);
33if (!defined(
'NOBROWSERNOTIF')) {
34 define(
'NOBROWSERNOTIF',
'1');
36if (!defined(
'NOIPCHECK')) {
37 define(
'NOIPCHECK',
'1');
41require
'../../main.inc.php';
42require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
43require_once DOL_DOCUMENT_ROOT.
"/core/lib/files.lib.php";
44require_once DOL_DOCUMENT_ROOT.
"/opensurvey/class/opensurveysondage.class.php";
45require_once DOL_DOCUMENT_ROOT.
"/opensurvey/lib/opensurvey.lib.php";
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
56$action =
GETPOST(
'action',
'aZ09');
59 $numsondage =
GETPOST(
'sondage',
'alpha');
63$result =
$object->fetch(
'', $numsondage);
65$nblines =
$object->fetch_lines();
71if (!isModEnabled(
'opensurvey')) {
80$nbcolonnes = substr_count(
$object->sujet,
',') + 1;
82$listofvoters = explode(
',', $_SESSION[
"savevoter"]);
87if (
GETPOST(
'ajoutcomment',
'alpha')) {
88 if (!$canbemodified || empty(
$object->allow_comments)) {
94 $comment =
GETPOST(
"comment",
'alphanohtml');
95 $comment_user =
GETPOST(
'commentuser',
'alphanohtml');
99 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Comment")),
null,
'errors');
101 if (!$comment_user) {
103 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Name")),
null,
'errors');
106 if (!in_array($comment_user, $listofvoters)) {
107 setEventMessages($langs->trans(
"UserMustBeSameThanUserUsedToVote"),
null,
'errors');
112 $nb_post_max =
getDolGlobalInt(
"MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
117 if ($nb_post_max > 0) {
118 $sql =
"SELECT COUNT(id_comment) as nb_comments";
119 $sql .=
" FROM ".MAIN_DB_PREFIX.
"opensurvey_comments";
120 $sql .=
" WHERE ip = '".$db->escape($user_ip).
"'";
121 $sql .=
" AND date_creation > '".$db->idate($minmonthpost).
"'";
122 $resql = $db->query($sql);
124 $num = $db->num_rows($resql);
128 $obj = $db->fetch_object($resql);
129 $nb_post_ip = $obj->nb_comments;
134 if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
135 setEventMessages($langs->trans(
"AlreadyTooMuchPostOnThisIPAdress"),
null,
'errors');
140 $resql =
$object->addComment($comment, $comment_user, $user_ip);
150 if (!$canbemodified) {
155 if (
GETPOST(
'nom',
'alphanohtml')) {
157 for ($i = 0; $i < $nbcolonnes; $i++) {
158 if (GETPOSTISSET(
"choix".$i) &&
GETPOST(
"choix".$i) ==
'1') {
159 $nouveauchoix .=
"1";
160 } elseif (GETPOSTISSET(
"choix".$i) &&
GETPOST(
"choix".$i) ==
'2') {
161 $nouveauchoix .=
"2";
163 $nouveauchoix .=
"0";
168 $nb_post_max =
getDolGlobalInt(
"MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
173 if ($nb_post_max > 0) {
174 $sql =
"SELECT COUNT(id_users) as nb_records";
175 $sql .=
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs";
176 $sql .=
" WHERE ip = '".$db->escape($user_ip).
"'";
177 $sql .=
" AND date_creation > '".$db->idate($minmonthpost).
"'";
178 $resql = $db->query($sql);
180 $num = $db->num_rows($resql);
184 $obj = $db->fetch_object($resql);
185 $nb_post_ip = $obj->nb_records;
191 $nom = substr(
GETPOST(
"nom",
'alphanohtml'), 0, 64);
194 $sql =
'SELECT id_users, nom as name';
195 $sql .=
' FROM '.MAIN_DB_PREFIX.
'opensurvey_user_studs';
196 $sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"' AND nom = '".$db->escape($nom).
"' ORDER BY id_users";
197 $resql = $db->query($sql);
202 $num_rows = $db->num_rows($resql);
207 } elseif ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
208 setEventMessages($langs->trans(
"AlreadyTooMuchPostOnThisIPAdress"),
null,
'errors');
212 $sql =
'INSERT INTO '.MAIN_DB_PREFIX.
'opensurvey_user_studs (nom, id_sondage, reponses, ip, date_creation)';
213 $sql .=
" VALUES ('".$db->escape($nom).
"', '".$db->escape($numsondage).
"','".$db->escape($nouveauchoix).
"', '".$db->escape($user_ip).
"', '".$db->idate($now).
"')";
214 $resql = $db->query($sql);
218 $_SESSION[
"savevoter"] = $nom.
','.(empty($_SESSION[
"savevoter"]) ?
'' : $_SESSION[
"savevoter"]);
219 $listofvoters = explode(
',', $_SESSION[
"savevoter"]);
223 $userstatic =
new User($db);
224 $userstatic->fetch(
$object->fk_user_creat);
226 $email = $userstatic->email;
233 include_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
235 $application = (
$conf->global->MAIN_APPLICATION_TITLE ?
$conf->global->MAIN_APPLICATION_TITLE :
'Dolibarr ERP/CRM');
238 $link =
'<a href="'.$link.
'">'.$link.
'</a>';
239 $body = str_replace(
'\n',
'<br>', $langs->transnoentities(
'EmailSomeoneVoted', $nom, $link));
242 $cmailfile =
new CMailFile(
"[".$application.
"] ".$langs->trans(
"Poll").
': '.
$object->title, $email,
$conf->global->MAIN_MAIL_EMAIL_FROM, $body,
null,
null,
null,
'',
'', 0, -1);
243 $result = $cmailfile->sendfile();
251 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Name")),
null,
'errors');
257$testmodifier =
false;
258$testligneamodifier =
false;
261for ($i = 0; $i < $nblines; $i++) {
262 if (GETPOSTISSET(
'modifierligne'.$i)) {
263 $ligneamodifier = $i;
264 $testligneamodifier =
true;
268 if (GETPOSTISSET(
'validermodifier'.$i)) {
270 $testmodifier =
true;
276 for ($i = 0; $i < $nbcolonnes; $i++) {
277 if (GETPOSTISSET(
"choix".$i) &&
GETPOST(
"choix".$i) ==
'1') {
278 $nouveauchoix .=
"1";
279 } elseif (GETPOSTISSET(
"choix".$i) &&
GETPOST(
"choix".$i) ==
'2') {
280 $nouveauchoix .=
"2";
282 $nouveauchoix .=
"0";
286 if (!$canbemodified) {
291 $idtomodify =
GETPOSTINT(
"idtomodify".$modifier);
292 $sql =
"SELECT nom FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs";
293 $sql .=
" WHERE id_users = ".((int) $idtomodify);
294 $sql .=
" AND id_sondage = '".$db->escape(
$object->id_sondage).
"'";
295 $resql = $db->query($sql);
296 $objvote = ($resql ? $db->fetch_object($resql) :
null);
297 if (!$objvote || !in_array($objvote->nom, $listofvoters)) {
301 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_user_studs";
302 $sql .=
" SET reponses = '".$db->escape($nouveauchoix).
"'";
303 $sql .=
" WHERE id_users = ".((int) $idtomodify);
304 $sql .=
" AND id_sondage = '".$db->escape(
$object->id_sondage).
"'";
306 $resql = $db->query($sql);
315 if (!$canbemodified) {
320 $commentofvoter =
false;
321 foreach (
$object->getComments() as $commentline) {
322 if ($commentline->id_comment == $idcomment && in_array($commentline->usercomment, $listofvoters)) {
323 $commentofvoter =
true;
327 if (!$commentofvoter) {
331 $resql =
$object->deleteComment($idcomment);
340$form =
new Form($db);
343$arrayofcss = array(
'/opensurvey/css/style.css');
348 $langs->load(
"errors");
349 print $langs->trans(
"ErrorRecordNotFound");
358$toutsujet = explode(
",",
$object->sujet);
359$listofanswers = array();
360foreach ($toutsujet as $value) {
361 $tmp = explode(
'@', $value);
362 $listofanswers[] = array(
'label' => $tmp[0],
'format' => (!empty($tmp[1]) ? $tmp[1] :
'checkbox'));
364$toutsujet = str_replace(
"°",
"'", $toutsujet);
367print
'<div class="survey_intro">';
368print
'<div class="survey_invitation">'.$langs->trans(
"YouAreInivitedToVote").
'</div>';
369print
'<span class="opacitymedium">'.$langs->trans(
"OpenSurveyHowTo").
'</span><br>';
370if (empty(
$object->allow_spy)) {
371 print
'<span class="opacitymedium">'.$langs->trans(
"YourVoteIsPrivate").
'</span><br>';
373 print $form->textwithpicto(
'<span class="opacitymedium">'.$langs->trans(
"YourVoteIsPublic").
'</span>', $langs->trans(
"CanSeeOthersVote")).
'<br>';
378if (empty(
$object->description)) {
379 print
'<div class="corps">'.
"\n";
385$titre = str_replace(
"\\",
"",
$object->title);
386print
'<div class="survey_title">'.img_picto(
'',
'poll',
'class="size15x paddingright"').
' <strong>'.
dol_htmlentities($titre).
'</strong></div>';
388if (!empty(
$object->description)) {
389 print
'<br><div class="corps">'.
"\n";
400if (!$canbemodified) {
401 print
'<br><center><div class="quatrevingtpercent center warning">'.$langs->trans(
'SurveyExpiredInfo').
'</div></center>';
408print
'<div class="cadre"> '.
"\n";
409print
'<br><br>'.
"\n";
412print
'<div class="div-table-responsive">';
413print
'<table class="resultats">'.
"\n";
419 print
'<td></td>'.
"\n";
423 $nbofsujet = count($toutsujet);
424 for ($i = 0; $i < $nbofsujet; $i++) {
425 if (isset($toutsujet[$i + 1]) && date(
'Y', intval($toutsujet[$i])) == date(
'Y', intval($toutsujet[$i + 1]))) {
428 print
'<td colspan='.$colspan.
' class="annee">'.date(
'Y', intval($toutsujet[$i])).
'</td>'.
"\n";
435 print
'<td></td>'.
"\n";
439 for ($i = 0; $i < $nbofsujet; $i++) {
440 $cur = intval($toutsujet[$i]);
442 if (!isset($toutsujet[$i + 1])) {
445 $next = intval($toutsujet[$i + 1]);
451 print
'<td colspan='.$colspan.
' class="mois">'.
dol_print_date($cur,
"%B").
'</td>'.
"\n";
458 print
'<td></td>'.
"\n";
462 for ($i = 0; $i < $nbofsujet; $i++) {
463 $cur = intval($toutsujet[$i]);
464 if (!isset($toutsujet[$i + 1])) {
467 $next = intval($toutsujet[$i + 1]);
472 print
'<td colspan="'.$colspan.
'" class="jour">'.
dol_print_date($cur,
"%a %d").
'</td>'.
"\n";
480 if (strpos(
$object->sujet,
'@') !==
false) {
482 print
'<td></td>'.
"\n";
484 for ($i = 0; isset($toutsujet[$i]); $i++) {
485 $heures = explode(
'@', $toutsujet[$i]);
486 if (isset($heures[1])) {
487 print
'<td class="heure">'.dol_htmlentities($heures[1]).
'</td>'.
"\n";
489 print
'<td class="heure"></td>'.
"\n";
498 print
'<td></td>'.
"\n";
500 for ($i = 0; isset($toutsujet[$i]); $i++) {
501 $tmp = explode(
'@', $toutsujet[$i]);
502 print
'<td class="sujet">'.dol_escape_htmltag($tmp[0]).
'</td>'.
"\n";
510$currentusername =
'';
512$sumagainst = array();
514$sql =
"SELECT id_users, nom as name, id_sondage, reponses";
515$sql .=
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs";
516$sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
517$resql = $db->query($sql);
522$num = $db->num_rows($resql);
523while ($compteur < $num) {
524 $obj = $db->fetch_object($resql);
526 $ensemblereponses = $obj->reponses;
529 $mod_ok = (in_array($obj->name, $listofvoters));
531 if (!$mod_ok && !
$object->allow_spy) {
539 print
'<td class="nom">'.img_picto($obj->name,
'user',
'class="pictofixedwidth"').dol_htmlentities($obj->name).
'</td>'.
"\n";
542 if (!$testligneamodifier) {
543 for ($i = 0; $i < $nbcolonnes; $i++) {
544 $car = substr($ensemblereponses, $i, 1);
547 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
548 if (((
string) $car) ==
"1") {
549 print
'<td class="ok">OK</td>'.
"\n";
551 print
'<td class="non">KO</td>'.
"\n";
554 if (!isset($sumfor[$i])) {
557 if (((
string) $car) ==
"1") {
561 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
562 if (((
string) $car) ==
"1") {
563 print
'<td class="ok">'.$langs->trans(
"Yes").
'</td>'.
"\n";
564 } elseif (((
string) $car) ==
"0") {
565 print
'<td class="non">'.$langs->trans(
"No").
'</td>'.
"\n";
567 print
'<td class="vide"> </td>'.
"\n";
570 if (!isset($sumfor[$i])) {
573 if (!isset($sumagainst[$i])) {
576 if (((
string) $car) ==
"1") {
579 if (((
string) $car) ==
"0") {
583 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
584 if (((
string) $car) ==
"1") {
585 print
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
586 } elseif (((
string) $car) ==
"0") {
587 print
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
589 print
'<td class="vide"> </td>'.
"\n";
592 if (!isset($sumfor[$i])) {
595 if (!isset($sumagainst[$i])) {
598 if (((
string) $car) ==
"1") {
601 if (((
string) $car) ==
"0") {
608 if ($compteur == $ligneamodifier) {
609 for ($i = 0; $i < $nbcolonnes; $i++) {
610 $car = substr($ensemblereponses, $i, 1);
611 print
'<td class="vide">';
612 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
613 print
'<input type="checkbox" name="choix'.$i.
'" value="1" ';
619 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
620 $arraychoice = array(
'2' =>
' ',
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
621 print $form->selectarray(
"choix".$i, $arraychoice, $car);
623 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
624 $arraychoice = array(
'2' =>
' ',
'0' => $langs->trans(
"Against"),
'1' => $langs->trans(
"For"));
625 print $form->selectarray(
"choix".$i, $arraychoice, $car);
630 for ($i = 0; $i < $nbcolonnes; $i++) {
631 $car = substr($ensemblereponses, $i, 1);
632 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
633 if (((
string) $car) ==
"1") {
634 print
'<td class="ok">OK</td>'.
"\n";
636 print
'<td class="non">KO</td>'.
"\n";
639 if (!isset($sumfor[$i])) {
642 if (((
string) $car) ==
"1") {
646 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
647 if (((
string) $car) ==
"1") {
648 print
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
649 } elseif (((
string) $car) ==
"0") {
650 print
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
652 print
'<td class="vide"> </td>'.
"\n";
655 if (!isset($sumfor[$i])) {
658 if (!isset($sumagainst[$i])) {
661 if (((
string) $car) ==
"1") {
664 if (((
string) $car) ==
"0") {
668 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
669 if (((
string) $car) ==
"1") {
670 print
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
671 } elseif (((
string) $car) ==
"0") {
672 print
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
674 print
'<td class="vide"> </td>'.
"\n";
677 if (!isset($sumfor[$i])) {
680 if (!isset($sumagainst[$i])) {
683 if (((
string) $car) ==
"1") {
686 if (((
string) $car) ==
"0") {
695 if ($compteur != $ligneamodifier && $mod_ok) {
696 $currentusername = $obj->name;
697 print
'<td class="casevide"><input type="submit" class="button small" name="modifierligne'.$compteur.
'" value="'.
dol_escape_htmltag($langs->trans(
"Edit")).
'"></td>'.
"\n";
701 for ($i = 0; $i < $nblines; $i++) {
702 if (GETPOSTISSET(
"modifierligne".$i)) {
703 if ($compteur == $i) {
704 print
'<td class="casevide">';
705 print
'<input type="hidden" name="idtomodify'.$compteur.
'" value="'.$obj->id_users.
'">';
706 print
'<input type="submit" class="button button-save small" name="validermodifier'.$compteur.
'" value="'.
dol_escape_htmltag($langs->trans(
"Save")).
'">';
717if ($ligneamodifier < 0 && (!isset($_SESSION[
'nom']))) {
719 print
'<td class="nom">'.
"\n";
720 if (isset($_SESSION[
'nom'])) {
721 print
'<input type=hidden name="nom" value="'.$_SESSION[
'nom'].
'">'.$_SESSION[
'nom'].
"\n";
723 print
'<input type="text" name="nom" placeholder="'.dol_escape_htmltag($langs->trans(
"Name")).
'" maxlength="64" class=" minwidth175" value="">'.
"\n";
728 for ($i = 0; $i < $nbcolonnes; $i++) {
729 print
'<td class="vide">';
730 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
731 print
'<input type="checkbox" name="choix'.$i.
'" value="1"';
732 if (GETPOSTISSET(
'choix'.$i) &&
GETPOST(
'choix'.$i) ==
'1') {
737 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
738 $arraychoice = array(
'2' =>
' ',
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
739 print $form->selectarray(
"choix".$i, $arraychoice,
GETPOST(
'choix'.$i));
741 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
742 $arraychoice = array(
'2' =>
' ',
'0' => $langs->trans(
"Against"),
'1' => $langs->trans(
"For"));
743 print $form->selectarray(
"choix".$i, $arraychoice,
GETPOST(
'choix'.$i));
749 print
'<td><input type="image" class="borderimp classfortooltip" title="'.dolPrintHTML($langs->trans(
"AddTheVote")).
'" name="boutonp" value="'.$langs->trans(
"Vote").
'" src="'.
img_picto(
'',
'edit_add',
'', 0, 1).
'"></td>'.
"\n";
755$meilleurecolonne =
null;
756for ($i = 0; $i < $nbcolonnes; $i++) {
757 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
760 if (isset($sumfor[$i])) {
762 $meilleurecolonne = $sumfor[$i];
764 if (!isset($meilleurecolonne) || $sumfor[$i] > $meilleurecolonne) {
765 $meilleurecolonne = $sumfor[$i];
773 print
'<td class="center">'.$langs->trans(
"Total").
'</td>'.
"\n";
774 for ($i = 0; $i < $nbcolonnes; $i++) {
775 $showsumfor = isset($sumfor[$i]) ? $sumfor[$i] :
'';
776 $showsumagainst = isset($sumagainst[$i]) ? $sumagainst[$i] :
'';
777 if (empty($showsumfor)) {
780 if (empty($showsumagainst)) {
785 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
788 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
789 print $langs->trans(
"Yes").
': '.$showsumfor.
'<br>'.$langs->trans(
"No").
': '.$showsumagainst;
791 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
792 print $langs->trans(
"For").
': '.$showsumfor.
'<br>'.$langs->trans(
"Against").
': '.$showsumagainst;
798 if ($nbofcheckbox >= 2) {
800 print
'<td class="somme"></td>'.
"\n";
801 for ($i = 0; $i < $nbcolonnes; $i++) {
803 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst')) && isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) {
804 print
'<td class="somme"><img src="'.dol_buildpath(
'/opensurvey/img/medaille.png', 1).
'"></td>'.
"\n";
806 print
'<td class="somme"></td>'.
"\n";
812print
'</table>'.
"\n";
818 $toutsujet = explode(
",",
$object->sujet);
819 $toutsujet = str_replace(
"°",
"'", $toutsujet);
824 for ($i = 0; $i < $nbcolonnes; $i++) {
825 if (isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) {
826 $meilleursujet .= ($meilleursujet ?
", " :
"");
828 if (strpos($toutsujet[$i],
'@') !==
false) {
829 $toutsujetdate = explode(
"@", $toutsujet[$i]);
832 $meilleursujet .=
dol_print_date((empty($toutsujet[$i]) ? 0 : $toutsujet[$i]),
'daytext').
' ('.
dol_print_date((empty($toutsujet[$i]) ? 0 : $toutsujet[$i]),
'%A').
')';
835 $tmps = explode(
'@', $toutsujet[$i]);
844 $meilleursujet = str_replace(
"°",
"'", $meilleursujet);
847 if ($nbofcheckbox >= 2) {
848 $vote_str = $langs->trans(
'votes');
849 print
'<p class="affichageresultats">'.
"\n";
851 if (isset($meilleurecolonne) && $compteursujet ==
"1") {
852 print
'<img src="'.dol_buildpath(
'/opensurvey/img/medaille.png', 1).
'"> '.$langs->trans(
'TheBestChoice').
": <b>".$meilleursujet.
"</b> - <b>".$meilleurecolonne.
"</b> ".$vote_str.
".\n";
853 } elseif (isset($meilleurecolonne)) {
854 print
'<img src="'.dol_buildpath(
'/opensurvey/img/medaille.png', 1).
'"> '.$langs->trans(
'TheBestChoices').
": <b>".$meilleursujet.
"</b> - <b>".$meilleurecolonne.
"</b> ".$vote_str.
".\n";
857 print
'</p><br>'.
"\n";
865$comments =
$object->getComments();
868 print
'<br>'.img_picto(
'',
'note',
'class="pictofixedwidth"').
'<span class="bold opacitymedium">'.$langs->trans(
"CommentsOfVoters").
':</span><br>'.
"\n";
870 foreach ($comments as $obj) {
874 print
'<div class="comment"><span class="usercomment">';
875 if (in_array($obj->usercomment, $listofvoters)) {
876 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?deletecomment='.$obj->id_comment.
'&sondage='.$numsondage.
'"> '.
img_picto(
'',
'delete.png',
'', 0, 0, 0,
'',
'nomarginleft').
'</a> ';
879 print
img_picto(
'',
'user',
'class="pictofixedwidth"').dol_htmlentities($obj->usercomment).
':</span> <span class="comment">'.
dol_nl2br(
dol_htmlentities($obj->comment)).
"</span></div>";
884if (
$object->allow_comments && $currentusername) {
885 print
'<br><div class="addcomment"><span class="opacitymedium">'.$langs->trans(
"AddACommentForPoll").
"</span><br>\n";
887 print
'<textarea name="comment" rows="'.ROWS_2.
'" class="quatrevingtpercent">'.
dol_escape_htmltag(
GETPOST(
'comment',
'alphanohtml'), 0, 1).
'</textarea><br>'.
"\n";
888 print $langs->trans(
"Name").
': ';
889 print
'<input type="text" name="commentuser" maxlength="64" value="'.dol_escape_htmltag(GETPOSTISSET(
'commentuser') ?
GETPOST(
'commentuser',
'alphanohtml') : (empty($_SESSION[
'nom']) ? $currentusername : $_SESSION[
'nom'])).
'"> '.
"\n";
890 print
'<input type="submit" class="button smallpaddingimp" name="ajoutcomment" value="'.dol_escape_htmltag($langs->trans(
"AddComment")).
'"><br>'.
"\n";
891 print
'</form>'.
"\n";
898print
'<a name="bas"></a>'.
"\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Put here description of your class.
const STATUS_CLOSED
Closed.
Class to manage Dolibarr users.
dol_get_last_hour($date, $gm='tzserver')
Return GMT time for last hour of a given GMT date (it replaces hours, min and second part to 23:59:59...
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
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)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getUserRemoteIP($trusted=0)
Return the real IP of remote user.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
llxFooterSurvey()
Show footer for new member.
getUrlSondage($id, $admin=false)
Fonction permettant de générer les URL pour les sondage.
llxHeaderSurvey($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs=[], $arrayofcss=[], $numsondage='')
Show header for new member.
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.