25if (!defined(
'NOLOGIN')) {
28if (!defined(
'NOCSRFCHECK')) {
29 define(
"NOCSRFCHECK", 1);
31if (!defined(
'NOBROWSERNOTIF')) {
32 define(
'NOBROWSERNOTIF',
'1');
34if (!defined(
'NOIPCHECK')) {
35 define(
'NOIPCHECK',
'1');
39require
'../../main.inc.php';
40require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
41require_once DOL_DOCUMENT_ROOT.
"/core/lib/files.lib.php";
42require_once DOL_DOCUMENT_ROOT.
"/opensurvey/class/opensurveysondage.class.php";
43require_once DOL_DOCUMENT_ROOT.
"/opensurvey/lib/opensurvey.lib.php";
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
48$action =
GETPOST(
'action',
'aZ09');
51 $numsondage =
GETPOST(
'sondage',
'alpha');
55$result = $object->fetch(0, $numsondage);
57$nblines = $object->fetch_lines();
63if (empty($conf->opensurvey->enabled)) {
72$nbcolonnes = substr_count($object->sujet,
',') + 1;
74$listofvoters = explode(
',', $_SESSION[
"savevoter"]);
77if (
GETPOST(
'ajoutcomment',
'alpha')) {
78 if (!$canbemodified) {
84 $comment =
GETPOST(
"comment",
'alphanohtml');
85 $comment_user =
GETPOST(
'commentuser',
'alphanohtml');
89 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Comment")),
null,
'errors');
93 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Name")),
null,
'errors');
96 if (!in_array($comment_user, $listofvoters)) {
97 setEventMessages($langs->trans(
"UserMustBeSameThanUserUsedToVote"),
null,
'errors');
102 $nb_post_max =
getDolGlobalInt(
"MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
107 if ($nb_post_max > 0) {
108 $sql =
"SELECT COUNT(id_comment) as nb_comments";
109 $sql .=
" FROM ".MAIN_DB_PREFIX.
"opensurvey_comments";
110 $sql .=
" WHERE ip = '".$db->escape($user_ip).
"'";
111 $sql .=
" AND date_creation > '".$db->idate($minmonthpost).
"'";
112 $resql = $db->query($sql);
114 $num = $db->num_rows($resql);
118 $obj = $db->fetch_object($resql);
119 $nb_post_ip = $obj->nb_comments;
124 if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
125 setEventMessages($langs->trans(
"AlreadyTooMuchPostOnThisIPAdress"),
null,
'errors');
130 $resql = $object->addComment($comment, $comment_user, $user_ip);
140 if (!$canbemodified) {
145 if (
GETPOST(
'nom',
'alphanohtml')) {
147 for ($i = 0; $i < $nbcolonnes; $i++) {
148 if (GETPOSTISSET(
"choix".$i) &&
GETPOST(
"choix".$i) ==
'1') {
149 $nouveauchoix .=
"1";
150 } elseif (GETPOSTISSET(
"choix".$i) &&
GETPOST(
"choix".$i) ==
'2') {
151 $nouveauchoix .=
"2";
153 $nouveauchoix .=
"0";
158 $nb_post_max =
getDolGlobalInt(
"MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
163 if ($nb_post_max > 0) {
164 $sql =
"SELECT COUNT(id_users) as nb_records";
165 $sql .=
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs";
166 $sql .=
" WHERE ip = '".$db->escape($user_ip).
"'";
167 $sql .=
" AND date_creation > '".$db->idate($minmonthpost).
"'";
168 $resql = $db->query($sql);
170 $num = $db->num_rows($resql);
174 $obj = $db->fetch_object($resql);
175 $nb_post_ip = $obj->nb_records;
181 $nom = substr(
GETPOST(
"nom",
'alphanohtml'), 0, 64);
184 $sql =
'SELECT id_users, nom as name';
185 $sql .=
' FROM '.MAIN_DB_PREFIX.
'opensurvey_user_studs';
186 $sql .=
" WHERE id_sondage='".$db->escape($numsondage).
"' AND nom = '".$db->escape($nom).
"' ORDER BY id_users";
187 $resql = $db->query($sql);
192 $num_rows = $db->num_rows($resql);
197 } elseif ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
198 setEventMessages($langs->trans(
"AlreadyTooMuchPostOnThisIPAdress"),
null,
'errors');
202 $sql =
'INSERT INTO '.MAIN_DB_PREFIX.
'opensurvey_user_studs (nom, id_sondage, reponses, ip, date_creation)';
203 $sql .=
" VALUES ('".$db->escape($nom).
"', '".$db->escape($numsondage).
"','".$db->escape($nouveauchoix).
"', '".$db->escape($user_ip).
"', '".$db->idate($now).
"')";
204 $resql = $db->query($sql);
208 $_SESSION[
"savevoter"] = $nom.
','.(empty($_SESSION[
"savevoter"]) ?
'' : $_SESSION[
"savevoter"]);
209 $listofvoters = explode(
',', $_SESSION[
"savevoter"]);
211 if ($object->mailsonde) {
212 if ($object->fk_user_creat) {
213 $userstatic =
new User($db);
214 $userstatic->fetch($object->fk_user_creat);
216 $email = $userstatic->email;
218 $email = $object->mail_admin;
223 include_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
225 $application = ($conf->global->MAIN_APPLICATION_TITLE ? $conf->global->MAIN_APPLICATION_TITLE :
'Dolibarr ERP/CRM');
227 $link = getUrlSondage($numsondage,
true);
228 $link =
'<a href="'.$link.
'">'.$link.
'</a>';
229 $body = str_replace(
'\n',
'<br>', $langs->transnoentities(
'EmailSomeoneVoted', $nom, $link));
232 $cmailfile =
new CMailFile(
"[".$application.
"] ".$langs->trans(
"Poll").
': '.$object->title, $email, $conf->global->MAIN_MAIL_EMAIL_FROM, $body,
null,
null,
null,
'',
'', 0, -1);
233 $result = $cmailfile->sendfile();
241 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Name")),
null,
'errors');
247$testmodifier =
false;
248$testligneamodifier =
false;
250for ($i = 0; $i < $nblines; $i++) {
251 if (GETPOSTISSET(
'modifierligne'.$i)) {
252 $ligneamodifier = $i;
253 $testligneamodifier =
true;
257 if (GETPOSTISSET(
'validermodifier'.$i)) {
259 $testmodifier =
true;
265 for ($i = 0; $i < $nbcolonnes; $i++) {
266 if (GETPOSTISSET(
"choix".$i) &&
GETPOST(
"choix".$i) ==
'1') {
267 $nouveauchoix .=
"1";
268 } elseif (GETPOSTISSET(
"choix".$i) &&
GETPOST(
"choix".$i) ==
'2') {
269 $nouveauchoix .=
"2";
271 $nouveauchoix .=
"0";
275 if (!$canbemodified) {
279 $idtomodify =
GETPOST(
"idtomodify".$modifier);
280 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_user_studs";
281 $sql .=
" SET reponses = '".$db->escape($nouveauchoix).
"'";
282 $sql .=
" WHERE id_users = '".$db->escape($idtomodify).
"'";
284 $resql = $db->query($sql);
291$idcomment =
GETPOST(
'deletecomment',
'int');
293 if (!$canbemodified) {
297 $resql = $object->deleteComment($idcomment);
306$form =
new Form($db);
309$arrayofcss = array(
'/opensurvey/css/style.css');
311llxHeaderSurvey($object->title,
"", 0, 0, $arrayofjs, $arrayofcss, $numsondage);
313if (empty($object->ref)) {
314 $langs->load(
"errors");
315 print $langs->trans(
"ErrorRecordNotFound");
324$toutsujet = explode(
",", $object->sujet);
325$listofanswers = array();
326foreach ($toutsujet as $value) {
327 $tmp = explode(
'@', $value);
328 $listofanswers[] = array(
'label'=>$tmp[0],
'format'=>(!empty($tmp[1]) ? $tmp[1] :
'checkbox'));
330$toutsujet = str_replace(
"°",
"'", $toutsujet);
333print
'<div class="survey_intro">';
334print
'<div class="survey_invitation">'.$langs->trans(
"YouAreInivitedToVote").
'</div>';
335print
'<span class="opacitymedium">'.$langs->trans(
"OpenSurveyHowTo").
'</span><br>';
336if (empty($object->allow_spy)) {
337 print
'<span class="opacitymedium">'.$langs->trans(
"YourVoteIsPrivate").
'</span><br>';
339 print $form->textwithpicto(
'<span class="opacitymedium">'.$langs->trans(
"YourVoteIsPublic").
'</span>', $langs->trans(
"CanSeeOthersVote")).
'<br>';
344if (empty($object->description)) {
345 print
'<div class="corps">'.
"\n";
351$titre = str_replace(
"\\",
"", $object->title);
352print
'<div class="survey_title">'.img_picto(
'',
'poll',
'class="size15x paddingright"').
' <strong>'.
dol_htmlentities($titre).
'</strong></div>';
354if (!empty($object->description)) {
355 print
'<br><div class="corps">'.
"\n";
359if ($object->description) {
366if (!$canbemodified) {
367 print
'<br><center><div class="quatrevingtpercent center warning">'.$langs->trans(
'SurveyExpiredInfo').
'</div></center>';
374print
'<div class="cadre"> '.
"\n";
375print
'<br><br>'.
"\n";
378print
'<div class="div-table-responsive">';
379print
'<table class="resultats">'.
"\n";
382if ($object->format ==
"D") {
385 print
'<td></td>'.
"\n";
389 $nbofsujet = count($toutsujet);
390 for ($i = 0; $i < $nbofsujet; $i++) {
391 if (isset($toutsujet[$i + 1]) && date(
'Y', intval($toutsujet[$i])) == date(
'Y', intval($toutsujet[$i + 1]))) {
394 print
'<td colspan='.$colspan.
' class="annee">'.date(
'Y', intval($toutsujet[$i])).
'</td>'.
"\n";
401 print
'<td></td>'.
"\n";
405 for ($i = 0; $i < $nbofsujet; $i++) {
406 $cur = intval($toutsujet[$i]);
408 if (isset($toutsujet[$i + 1]) ===
false) {
411 $next = intval($toutsujet[$i + 1]);
417 print
'<td colspan='.$colspan.
' class="mois">'.
dol_print_date($cur,
"%B").
'</td>'.
"\n";
424 print
'<td></td>'.
"\n";
428 for ($i = 0; $i < $nbofsujet; $i++) {
429 $cur = intval($toutsujet[$i]);
430 if (isset($toutsujet[$i + 1]) ===
false) {
433 $next = intval($toutsujet[$i + 1]);
438 print
'<td colspan="'.$colspan.
'" class="jour">'.
dol_print_date($cur,
"%a %d").
'</td>'.
"\n";
446 if (strpos($object->sujet,
'@') !==
false) {
448 print
'<td></td>'.
"\n";
450 for ($i = 0; isset($toutsujet[$i]); $i++) {
451 $heures = explode(
'@', $toutsujet[$i]);
452 if (isset($heures[1])) {
453 print
'<td class="heure">'.dol_htmlentities($heures[1]).
'</td>'.
"\n";
455 print
'<td class="heure"></td>'.
"\n";
464 print
'<td></td>'.
"\n";
466 for ($i = 0; isset($toutsujet[$i]); $i++) {
467 $tmp = explode(
'@', $toutsujet[$i]);
468 print
'<td class="sujet">'.dol_escape_htmltag($tmp[0]).
'</td>'.
"\n";
476$currentusername =
'';
478$sumagainst = array();
480$sql =
"SELECT id_users, nom as name, id_sondage, reponses";
481$sql .=
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs";
482$sql .=
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
483$resql = $db->query($sql);
488$num = $db->num_rows($resql);
489while ($compteur < $num) {
490 $obj = $db->fetch_object($resql);
492 $ensemblereponses = $obj->reponses;
495 $mod_ok = (in_array($obj->name, $listofvoters));
497 if (!$mod_ok && !$object->allow_spy) {
505 print
'<td class="nom">'.img_picto($obj->name,
'user',
'class="pictofixedwidth"').dol_htmlentities($obj->name).
'</td>'.
"\n";
508 if (!$testligneamodifier) {
509 for ($i = 0; $i < $nbcolonnes; $i++) {
510 $car = substr($ensemblereponses, $i, 1);
513 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
514 if (((
string) $car) ==
"1") {
515 print
'<td class="ok">OK</td>'.
"\n";
517 print
'<td class="non">KO</td>'.
"\n";
520 if (!isset($sumfor[$i])) {
523 if (((
string) $car) ==
"1") {
527 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
528 if (((
string) $car) ==
"1") {
529 print
'<td class="ok">'.$langs->trans(
"Yes").
'</td>'.
"\n";
530 } elseif (((
string) $car) ==
"0") {
531 print
'<td class="non">'.$langs->trans(
"No").
'</td>'.
"\n";
533 print
'<td class="vide"> </td>'.
"\n";
536 if (!isset($sumfor[$i])) {
539 if (!isset($sumagainst[$i])) {
542 if (((
string) $car) ==
"1") {
545 if (((
string) $car) ==
"0") {
549 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
550 if (((
string) $car) ==
"1") {
551 print
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
552 } elseif (((
string) $car) ==
"0") {
553 print
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
555 print
'<td class="vide"> </td>'.
"\n";
558 if (!isset($sumfor[$i])) {
561 if (!isset($sumagainst[$i])) {
564 if (((
string) $car) ==
"1") {
567 if (((
string) $car) ==
"0") {
574 if ($compteur == $ligneamodifier) {
575 for ($i = 0; $i < $nbcolonnes; $i++) {
576 $car = substr($ensemblereponses, $i, 1);
577 print
'<td class="vide">';
578 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
579 print
'<input type="checkbox" name="choix'.$i.
'" value="1" ';
585 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
586 $arraychoice = array(
'2'=>
' ',
'0'=>$langs->trans(
"No"),
'1'=>$langs->trans(
"Yes"));
587 print $form->selectarray(
"choix".$i, $arraychoice, $car);
589 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
590 $arraychoice = array(
'2'=>
' ',
'0'=>$langs->trans(
"Against"),
'1'=>$langs->trans(
"For"));
591 print $form->selectarray(
"choix".$i, $arraychoice, $car);
596 for ($i = 0; $i < $nbcolonnes; $i++) {
597 $car = substr($ensemblereponses, $i, 1);
598 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
599 if (((
string) $car) ==
"1") {
600 print
'<td class="ok">OK</td>'.
"\n";
602 print
'<td class="non">KO</td>'.
"\n";
605 if (!isset($sumfor[$i])) {
608 if (((
string) $car) ==
"1") {
612 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
613 if (((
string) $car) ==
"1") {
614 print
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
615 } elseif (((
string) $car) ==
"0") {
616 print
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
618 print
'<td class="vide"> </td>'.
"\n";
621 if (!isset($sumfor[$i])) {
624 if (!isset($sumagainst[$i])) {
627 if (((
string) $car) ==
"1") {
630 if (((
string) $car) ==
"0") {
634 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
635 if (((
string) $car) ==
"1") {
636 print
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
637 } elseif (((
string) $car) ==
"0") {
638 print
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
640 print
'<td class="vide"> </td>'.
"\n";
643 if (!isset($sumfor[$i])) {
646 if (!isset($sumagainst[$i])) {
649 if (((
string) $car) ==
"1") {
652 if (((
string) $car) ==
"0") {
661 if ($compteur != $ligneamodifier && $mod_ok) {
662 $currentusername = $obj->name;
663 print
'<td class="casevide"><input type="submit" class="button small" name="modifierligne'.$compteur.
'" value="'.
dol_escape_htmltag($langs->trans(
"Edit")).
'"></td>'.
"\n";
667 for ($i = 0; $i < $nblines; $i++) {
668 if (GETPOSTISSET(
"modifierligne".$i)) {
669 if ($compteur == $i) {
670 print
'<td class="casevide">';
671 print
'<input type="hidden" name="idtomodify'.$compteur.
'" value="'.$obj->id_users.
'">';
672 print
'<input type="submit" class="button button-save small" name="validermodifier'.$compteur.
'" value="'.
dol_escape_htmltag($langs->trans(
"Save")).
'">';
683if ($ligneamodifier < 0 && (!isset($_SESSION[
'nom']))) {
685 print
'<td class="nom">'.
"\n";
686 if (isset($_SESSION[
'nom'])) {
687 print
'<input type=hidden name="nom" value="'.$_SESSION[
'nom'].
'">'.$_SESSION[
'nom'].
"\n";
689 print
'<input type="text" name="nom" placeholder="'.dol_escape_htmltag($langs->trans(
"Name")).
'" maxlength="64" class=" minwidth175" value="">'.
"\n";
694 for ($i = 0; $i < $nbcolonnes; $i++) {
695 print
'<td class="vide">';
696 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
697 print
'<input type="checkbox" name="choix'.$i.
'" value="1"';
698 if (GETPOSTISSET(
'choix'.$i) &&
GETPOST(
'choix'.$i) ==
'1') {
703 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
704 $arraychoice = array(
'2'=>
' ',
'0'=>$langs->trans(
"No"),
'1'=>$langs->trans(
"Yes"));
705 print $form->selectarray(
"choix".$i, $arraychoice,
GETPOST(
'choix'.$i));
707 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
708 $arraychoice = array(
'2'=>
' ',
'0'=>$langs->trans(
"Against"),
'1'=>$langs->trans(
"For"));
709 print $form->selectarray(
"choix".$i, $arraychoice,
GETPOST(
'choix'.$i));
715 print
'<td><input type="image" class="borderimp" name="boutonp" value="'.$langs->trans(
"Vote").
'" src="'.
img_picto(
'',
'edit_add',
'',
false, 1).
'"></td>'.
"\n";
721for ($i = 0; $i < $nbcolonnes; $i++) {
722 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
725 if (isset($sumfor[$i])) {
727 $meilleurecolonne = $sumfor[$i];
729 if (!isset($meilleurecolonne) || $sumfor[$i] > $meilleurecolonne) {
730 $meilleurecolonne = $sumfor[$i];
735if ($object->allow_spy) {
738 print
'<td class="center">'.$langs->trans(
"Total").
'</td>'.
"\n";
739 for ($i = 0; $i < $nbcolonnes; $i++) {
740 $showsumfor = isset($sumfor[$i]) ? $sumfor[$i] :
'';
741 $showsumagainst = isset($sumagainst[$i]) ? $sumagainst[$i] :
'';
742 if (empty($showsumfor)) {
745 if (empty($showsumagainst)) {
750 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst'))) {
753 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'yesno') {
754 print $langs->trans(
"Yes").
': '.$showsumfor.
'<br>'.$langs->trans(
"No").
': '.$showsumagainst;
756 if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] ==
'foragainst') {
757 print $langs->trans(
"For").
': '.$showsumfor.
'<br>'.$langs->trans(
"Against").
': '.$showsumagainst;
763 if ($nbofcheckbox >= 2) {
765 print
'<td class="somme"></td>'.
"\n";
766 for ($i = 0; $i < $nbcolonnes; $i++) {
768 if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno',
'foragainst')) && isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) {
769 print
'<td class="somme"><img src="'.dol_buildpath(
'/opensurvey/img/medaille.png', 1).
'"></td>'.
"\n";
771 print
'<td class="somme"></td>'.
"\n";
777print
'</table>'.
"\n";
782if ($object->allow_spy) {
783 $toutsujet = explode(
",", $object->sujet);
784 $toutsujet = str_replace(
"°",
"'", $toutsujet);
789 for ($i = 0; $i < $nbcolonnes; $i++) {
790 if (isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) {
791 $meilleursujet .= ($meilleursujet ?
", " :
"");
792 if ($object->format ==
"D") {
793 if (strpos($toutsujet[$i],
'@') !==
false) {
794 $toutsujetdate = explode(
"@", $toutsujet[$i]);
797 $meilleursujet .=
dol_print_date((empty($toutsujet[$i]) ? 0 : $toutsujet[$i]),
'daytext').
' ('.
dol_print_date((empty($toutsujet[$i]) ? 0 : $toutsujet[$i]),
'%A').
')';
800 $tmps = explode(
'@', $toutsujet[$i]);
809 $meilleursujet = str_replace(
"°",
"'", $meilleursujet);
812 if ($nbofcheckbox >= 2) {
813 $vote_str = $langs->trans(
'votes');
814 print
'<p class="affichageresultats">'.
"\n";
816 if (isset($meilleurecolonne) && $compteursujet ==
"1") {
817 print
'<img src="'.dol_buildpath(
'/opensurvey/img/medaille.png', 1).
'"> '.$langs->trans(
'TheBestChoice').
": <b>".$meilleursujet.
"</b> - <b>".$meilleurecolonne.
"</b> ".$vote_str.
".\n";
818 } elseif (isset($meilleurecolonne)) {
819 print
'<img src="'.dol_buildpath(
'/opensurvey/img/medaille.png', 1).
'"> '.$langs->trans(
'TheBestChoices').
": <b>".$meilleursujet.
"</b> - <b>".$meilleurecolonne.
"</b> ".$vote_str.
".\n";
822 print
'</p><br>'.
"\n";
830$comments = $object->getComments();
833 print
'<br>'.img_picto(
'',
'note',
'class="pictofixedwidth"').
'<span class="bold opacitymedium">'.$langs->trans(
"CommentsOfVoters").
':</span><br>'.
"\n";
835 foreach ($comments as $obj) {
839 print
'<div class="comment"><span class="usercomment">';
840 if (in_array($obj->usercomment, $listofvoters)) {
841 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?deletecomment='.$obj->id_comment.
'&sondage='.$numsondage.
'"> '.
img_picto(
'',
'delete.png',
'',
false, 0, 0,
'',
'nomarginleft').
'</a> ';
844 print
img_picto(
'',
'user',
'class="pictofixedwidth"').dol_htmlentities($obj->usercomment).
':</span> <span class="comment">'.
dol_nl2br(
dol_htmlentities($obj->comment)).
"</span></div>";
849if ($object->allow_comments && $currentusername) {
850 print
'<br><div class="addcomment"><span class="opacitymedium">'.$langs->trans(
"AddACommentForPoll").
"</span><br>\n";
852 print
'<textarea name="comment" rows="'.ROWS_2.
'" class="quatrevingtpercent">'.
dol_escape_htmltag(
GETPOST(
'comment',
'alphanohtml'), 0, 1).
'</textarea><br>'.
"\n";
853 print $langs->trans(
"Name").
': ';
854 print
'<input type="text" name="commentuser" maxlength="64" value="'.dol_escape_htmltag(GETPOSTISSET(
'commentuser') ?
GETPOST(
'commentuser',
'alphanohtml') : (empty($_SESSION[
'nom']) ? $currentusername : $_SESSION[
'nom'])).
'"> '.
"\n";
855 print
'<input type="submit" class="button smallpaddingimp" name="ajoutcomment" value="'.dol_escape_htmltag($langs->trans(
"AddComment")).
'"><br>'.
"\n";
856 print
'</form>'.
"\n";
863print
'<a name="bas"></a>'.
"\n";
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_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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...
getUserRemoteIP()
Return the IP of remote user.
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...
httponly_accessforbidden($message=1, $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.