* Copyright (C) 2014 Marcos García * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/public/opensurvey/studs.php * \ingroup opensurvey * \brief Page to list surveys */ if (!defined('NOLOGIN')) { define("NOLOGIN", 1); // This means this output page does not require to be logged. } if (!defined('NOCSRFCHECK')) { define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. } if (!defined('NOBROWSERNOTIF')) { define('NOBROWSERNOTIF', '1'); } if (!defined('NOIPCHECK')) { define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip } // Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; require_once DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php"; require_once DOL_DOCUMENT_ROOT."/opensurvey/lib/opensurvey.lib.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; // Init vars $action = GETPOST('action', 'aZ09'); $numsondage = ''; if (GETPOST('sondage')) { $numsondage = GETPOST('sondage', 'alpha'); } $object = new Opensurveysondage($db); $result = $object->fetch(0, $numsondage); $nblines = $object->fetch_lines(); //If the survey has not yet finished, then it can be modified $canbemodified = ((empty($object->date_fin) || $object->date_fin > dol_now()) && $object->status != Opensurveysondage::STATUS_CLOSED); // Security check if (empty($conf->opensurvey->enabled)) { httponly_accessforbidden('Module Survey not enabled'); } /* * Actions */ $nbcolonnes = substr_count($object->sujet, ',') + 1; $listofvoters = explode(',', $_SESSION["savevoter"]); // Add comment if (GETPOST('ajoutcomment', 'alpha')) { if (!$canbemodified) { httponly_accessforbidden('ErrorForbidden'); } $error = 0; $comment = GETPOST("comment", 'alphanohtml'); $comment_user = GETPOST('commentuser', 'alphanohtml'); if (!$comment) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Comment")), null, 'errors'); } if (!$comment_user) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")), null, 'errors'); } if (!in_array($comment_user, $listofvoters)) { setEventMessages($langs->trans("UserMustBeSameThanUserUsedToVote"), null, 'errors'); $error++; } $user_ip = getUserRemoteIP(); $nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200); $now = dol_now(); $minmonthpost = dol_time_plus_duree($now, -1, "m"); // Calculate nb of post for IP $nb_post_ip = 0; if ($nb_post_max > 0) { // Calculate only if there is a limit to check $sql = "SELECT COUNT(id_comment) as nb_comments"; $sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_comments"; $sql .= " WHERE ip = '".$db->escape($user_ip)."'"; $sql .= " AND date_creation > '".$db->idate($minmonthpost)."'"; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; while ($i < $num) { $i++; $obj = $db->fetch_object($resql); $nb_post_ip = $obj->nb_comments; } } } if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) { setEventMessages($langs->trans("AlreadyTooMuchPostOnThisIPAdress"), null, 'errors'); $error++; } if (!$error) { $resql = $object->addComment($comment, $comment_user, $user_ip); if (!$resql) { dol_print_error($db); } } } // Add vote if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) { // boutonp for chrome, boutonp_x for firefox if (!$canbemodified) { httponly_accessforbidden('ErrorForbidden'); } //Si le nom est bien entré if (GETPOST('nom', 'alphanohtml')) { $nouveauchoix = ''; for ($i = 0; $i < $nbcolonnes; $i++) { if (GETPOSTISSET("choix".$i) && GETPOST("choix".$i) == '1') { $nouveauchoix .= "1"; } elseif (GETPOSTISSET("choix".$i) && GETPOST("choix".$i) == '2') { $nouveauchoix .= "2"; } else { $nouveauchoix .= "0"; } } $user_ip = getUserRemoteIP(); $nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200); $now = dol_now(); $minmonthpost = dol_time_plus_duree($now, -1, "m"); // Calculate nb of post for IP $nb_post_ip = 0; if ($nb_post_max > 0) { // Calculate only if there is a limit to check $sql = "SELECT COUNT(id_users) as nb_records"; $sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; $sql .= " WHERE ip = '".$db->escape($user_ip)."'"; $sql .= " AND date_creation > '".$db->idate($minmonthpost)."'"; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; while ($i < $num) { $i++; $obj = $db->fetch_object($resql); $nb_post_ip = $obj->nb_records; } } } $nom = substr(GETPOST("nom", 'alphanohtml'), 0, 64); // Check if vote already exists $sql = 'SELECT id_users, nom as name'; $sql .= ' FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs'; $sql .= " WHERE id_sondage='".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."' ORDER BY id_users"; $resql = $db->query($sql); if (!$resql) { dol_print_error($db); } $num_rows = $db->num_rows($resql); if ($num_rows > 0) { setEventMessages($langs->trans("VoteNameAlreadyExists"), null, 'errors'); $error++; } elseif ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) { setEventMessages($langs->trans("AlreadyTooMuchPostOnThisIPAdress"), null, 'errors'); $error++; } else { $now = dol_now(); $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_user_studs (nom, id_sondage, reponses, ip, date_creation)'; $sql .= " VALUES ('".$db->escape($nom)."', '".$db->escape($numsondage)."','".$db->escape($nouveauchoix)."', '".$db->escape($user_ip)."', '".$db->idate($now)."')"; $resql = $db->query($sql); if ($resql) { // Add voter to session $_SESSION["savevoter"] = $nom.','.(empty($_SESSION["savevoter"]) ? '' : $_SESSION["savevoter"]); // Save voter $listofvoters = explode(',', $_SESSION["savevoter"]); if ($object->mailsonde) { if ($object->fk_user_creat) { $userstatic = new User($db); $userstatic->fetch($object->fk_user_creat); $email = $userstatic->email; } else { $email = $object->mail_admin; } //Linked user may not have an email set if ($email) { include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; $application = ($conf->global->MAIN_APPLICATION_TITLE ? $conf->global->MAIN_APPLICATION_TITLE : 'Dolibarr ERP/CRM'); $link = getUrlSondage($numsondage, true); $link = ''.$link.''; $body = str_replace('\n', '
', $langs->transnoentities('EmailSomeoneVoted', $nom, $link)); //var_dump($body);exit; $cmailfile = new CMailFile("[".$application."] ".$langs->trans("Poll").': '.$object->title, $email, $conf->global->MAIN_MAIL_EMAIL_FROM, $body, null, null, null, '', '', 0, -1); $result = $cmailfile->sendfile(); } } } else { dol_print_error($db); } } } else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")), null, 'errors'); } } // Update vote $testmodifier = false; $testligneamodifier = false; $ligneamodifier = -1; for ($i = 0; $i < $nblines; $i++) { if (GETPOSTISSET('modifierligne'.$i)) { $ligneamodifier = $i; $testligneamodifier = true; } //test to see if a line is to be modified if (GETPOSTISSET('validermodifier'.$i)) { $modifier = $i; $testmodifier = true; } } if ($testmodifier) { $nouveauchoix = ''; for ($i = 0; $i < $nbcolonnes; $i++) { if (GETPOSTISSET("choix".$i) && GETPOST("choix".$i) == '1') { $nouveauchoix .= "1"; } elseif (GETPOSTISSET("choix".$i) && GETPOST("choix".$i) == '2') { $nouveauchoix .= "2"; } else { $nouveauchoix .= "0"; } } if (!$canbemodified) { httponly_accessforbidden('ErrorForbidden'); } $idtomodify = GETPOST("idtomodify".$modifier); $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_user_studs"; $sql .= " SET reponses = '".$db->escape($nouveauchoix)."'"; $sql .= " WHERE id_users = '".$db->escape($idtomodify)."'"; $resql = $db->query($sql); if (!$resql) { dol_print_error($db); } } // Delete comment $idcomment = GETPOST('deletecomment', 'int'); if ($idcomment) { if (!$canbemodified) { httponly_accessforbidden('ErrorForbidden'); } $resql = $object->deleteComment($idcomment); } /* * View */ $form = new Form($db); $arrayofjs = array(); $arrayofcss = array('/opensurvey/css/style.css'); llxHeaderSurvey($object->title, "", 0, 0, $arrayofjs, $arrayofcss, $numsondage); if (empty($object->ref)) { // For survey, id is a hex string $langs->load("errors"); print $langs->trans("ErrorRecordNotFound"); llxFooterSurvey(); $db->close(); exit(); } // Define format of choices $toutsujet = explode(",", $object->sujet); $listofanswers = array(); foreach ($toutsujet as $value) { $tmp = explode('@', $value); $listofanswers[] = array('label'=>$tmp[0], 'format'=>(!empty($tmp[1]) ? $tmp[1] : 'checkbox')); } $toutsujet = str_replace("°", "'", $toutsujet); print '
'.$langs->trans("YouAreInivitedToVote").'
'; print $langs->trans("OpenSurveyHowTo").'
'; if (empty($object->allow_spy)) { print ''.$langs->trans("YourVoteIsPrivate").'
'; } else { print $form->textwithpicto(''.$langs->trans("YourVoteIsPublic").'', $langs->trans("CanSeeOthersVote")).'
'; } print '
'; print '
'."\n"; // show title of survey $titre = str_replace("\\", "", $object->title); print ''.dol_htmlentities($titre).''; // show description of survey if ($object->description) { print '

'."\n"; print dol_htmlentitiesbr($object->description); print '
'."\n"; } print '
'."\n"; //The survey has expired, users can't vote or do any action if (!$canbemodified) { print '
'.$langs->trans('SurveyExpiredInfo').'
'; llxFooterSurvey(); $db->close(); exit; } print '
'."\n"; print '

'."\n"; // Start to show survey result print ''."\n"; // Show choice titles if ($object->format == "D") { //display of survey topics print ''."\n"; print ''."\n"; //display of years $colspan = 1; $nbofsujet = count($toutsujet); for ($i = 0; $i < $nbofsujet; $i++) { if (isset($toutsujet[$i + 1]) && date('Y', intval($toutsujet[$i])) == date('Y', intval($toutsujet[$i + 1]))) { $colspan++; } else { print ''."\n"; $colspan = 1; } } print ''."\n"; print ''."\n"; print ''."\n"; //display of months $colspan = 1; for ($i = 0; $i < $nbofsujet; $i++) { $cur = intval($toutsujet[$i]); // intval() est utiliser pour supprimer le suffixe @* qui déplaît logiquement à strftime() if (isset($toutsujet[$i + 1]) === false) { $next = false; } else { $next = intval($toutsujet[$i + 1]); } if ($next && dol_print_date($cur, "%B") == dol_print_date($next, "%B") && dol_print_date($cur, "%Y") == dol_print_date($next, "%Y")) { $colspan++; } else { print ''."\n"; $colspan = 1; } } print ''."\n"; print ''."\n"; print ''."\n"; //display of days $colspan = 1; for ($i = 0; $i < $nbofsujet; $i++) { $cur = intval($toutsujet[$i]); if (isset($toutsujet[$i + 1]) === false) { $next = false; } else { $next = intval($toutsujet[$i + 1]); } if ($next && dol_print_date($cur, "%a %e") == dol_print_date($next, "%a %e") && dol_print_date($cur, "%B") == dol_print_date($next, "%B")) { $colspan++; } else { print ''."\n"; $colspan = 1; } } print ''."\n"; //Display schedules if (strpos($object->sujet, '@') !== false) { print ''."\n"; print ''."\n"; for ($i = 0; isset($toutsujet[$i]); $i++) { $heures = explode('@', $toutsujet[$i]); if (isset($heures[1])) { print ''."\n"; } else { print ''."\n"; } } print ''."\n"; } } else { //display of survey topics print ''."\n"; print ''."\n"; for ($i = 0; isset($toutsujet[$i]); $i++) { $tmp = explode('@', $toutsujet[$i]); print ''."\n"; } print ''."\n"; } // Loop on each answer $sumfor = array(); $sumagainst = array(); $compteur = 0; $sql = "SELECT id_users, nom as name, id_sondage, reponses"; $sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'"; $resql = $db->query($sql); if (!$resql) { dol_print_error($db); exit; } $num = $db->num_rows($resql); while ($compteur < $num) { $obj = $db->fetch_object($resql); $ensemblereponses = $obj->reponses; // ligne d'un usager pré-authentifié $mod_ok = (in_array($obj->name, $listofvoters)); if (!$mod_ok && !$object->allow_spy) { $compteur++; continue; } print ''."\n"; // Name print ''."\n"; // si la ligne n'est pas a changer, on affiche les données if (!$testligneamodifier) { for ($i = 0; $i < $nbcolonnes; $i++) { $car = substr($ensemblereponses, $i, 1); //print 'xx'.$i."-".$car.'-'.$listofanswers[$i]['format'].'zz'; if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) { if (((string) $car) == "1") { print ''."\n"; } else { print ''."\n"; } // Total if (!isset($sumfor[$i])) { $sumfor[$i] = 0; } if (((string) $car) == "1") { $sumfor[$i]++; } } if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') { if (((string) $car) == "1") { print ''."\n"; } elseif (((string) $car) == "0") { print ''."\n"; } else { print ''."\n"; } // Total if (!isset($sumfor[$i])) { $sumfor[$i] = 0; } if (!isset($sumagainst[$i])) { $sumagainst[$i] = 0; } if (((string) $car) == "1") { $sumfor[$i]++; } if (((string) $car) == "0") { $sumagainst[$i]++; } } if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') { if (((string) $car) == "1") { print ''."\n"; } elseif (((string) $car) == "0") { print ''."\n"; } else { print ''."\n"; } // Total if (!isset($sumfor[$i])) { $sumfor[$i] = 0; } if (!isset($sumagainst[$i])) { $sumagainst[$i] = 0; } if (((string) $car) == "1") { $sumfor[$i]++; } if (((string) $car) == "0") { $sumagainst[$i]++; } } } } else { //sinon on remplace les choix de l'utilisateur par une ligne de checkbox pour recuperer de nouvelles valeurs if ($compteur == $ligneamodifier) { for ($i = 0; $i < $nbcolonnes; $i++) { $car = substr($ensemblereponses, $i, 1); print ''."\n"; } } else { for ($i = 0; $i < $nbcolonnes; $i++) { $car = substr($ensemblereponses, $i, 1); if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) { if (((string) $car) == "1") { print ''."\n"; } else { print ''."\n"; } // Total if (!isset($sumfor[$i])) { $sumfor[$i] = 0; } if (((string) $car) == "1") { $sumfor[$i]++; } } if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') { if (((string) $car) == "1") { print ''."\n"; } elseif (((string) $car) == "0") { print ''."\n"; } else { print ''."\n"; } // Total if (!isset($sumfor[$i])) { $sumfor[$i] = 0; } if (!isset($sumagainst[$i])) { $sumagainst[$i] = 0; } if (((string) $car) == "1") { $sumfor[$i]++; } if (((string) $car) == "0") { $sumagainst[$i]++; } } if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') { if (((string) $car) == "1") { print ''."\n"; } elseif (((string) $car) == "0") { print ''."\n"; } else { print ''."\n"; } // Total if (!isset($sumfor[$i])) { $sumfor[$i] = 0; } if (!isset($sumagainst[$i])) { $sumagainst[$i] = 0; } if (((string) $car) == "1") { $sumfor[$i]++; } if (((string) $car) == "0") { $sumagainst[$i]++; } } } } } // Button edit at end of line if ($compteur != $ligneamodifier && $mod_ok) { print ''."\n"; } //demande de confirmation pour modification de ligne for ($i = 0; $i < $nblines; $i++) { if (GETPOSTISSET("modifierligne".$i)) { if ($compteur == $i) { print ''."\n"; } } } $compteur++; print ''."\n"; } // Add line to add new record if ($ligneamodifier < 0 && (!isset($_SESSION['nom']))) { print ''."\n"; print ''."\n"; // affichage des cases de formulaire checkbox pour un nouveau choix for ($i = 0; $i < $nbcolonnes; $i++) { print ''."\n"; } // Affichage du bouton de formulaire pour inscrire un nouvel utilisateur dans la base print ''."\n"; print ''."\n"; } // Select value of best choice (for checkbox columns only) $nbofcheckbox = 0; for ($i = 0; $i < $nbcolonnes; $i++) { if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) { $nbofcheckbox++; } if (isset($sumfor[$i])) { if ($i == 0) { $meilleurecolonne = $sumfor[$i]; } if (!isset($meilleurecolonne) || $sumfor[$i] > $meilleurecolonne) { $meilleurecolonne = $sumfor[$i]; } } } if ($object->allow_spy) { // Show line total print ''."\n"; print ''."\n"; for ($i = 0; $i < $nbcolonnes; $i++) { $showsumfor = isset($sumfor[$i]) ? $sumfor[$i] : ''; $showsumagainst = isset($sumagainst[$i]) ? $sumagainst[$i] : ''; if (empty($showsumfor)) { $showsumfor = 0; } if (empty($showsumagainst)) { $showsumagainst = 0; } print ''."\n"; } print ''; // Show picto winner if ($nbofcheckbox >= 2) { print ''."\n"; print ''."\n"; for ($i = 0; $i < $nbcolonnes; $i++) { //print 'xx'.(!empty($listofanswers[$i]['format'])).'-'.$sumfor[$i].'-'.$meilleurecolonne; if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst')) && isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) { print ''."\n"; } else { print ''."\n"; } } print ''."\n"; } } print '
'.date('Y', intval($toutsujet[$i])).'
'.dol_print_date($cur, "%B").'
'.dol_print_date($cur, "%a %e").'
'.dol_htmlentities($heures[1]).'
'.dol_escape_htmltag($tmp[0]).'
'.dol_htmlentities($obj->name).'OKKO'.$langs->trans("Yes").''.$langs->trans("No").' '.$langs->trans("For").''.$langs->trans("Against").' '; if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) { print ''; } if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') { $arraychoice = array('2'=>' ', '0'=>$langs->trans("No"), '1'=>$langs->trans("Yes")); print $form->selectarray("choix".$i, $arraychoice, $car); } if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') { $arraychoice = array('2'=>' ', '0'=>$langs->trans("Against"), '1'=>$langs->trans("For")); print $form->selectarray("choix".$i, $arraychoice, $car); } print 'OKKO'.$langs->trans("For").''.$langs->trans("Against").' '.$langs->trans("For").''.$langs->trans("Against").' '; print ''; print ''; print '
'."\n"; if (isset($_SESSION['nom'])) { print ''.$_SESSION['nom']."\n"; } else { print ''."\n"; } print ''; if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) { print ''; } if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') { $arraychoice = array('2'=>' ', '0'=>$langs->trans("No"), '1'=>$langs->trans("Yes")); print $form->selectarray("choix".$i, $arraychoice, GETPOST('choix'.$i)); } if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') { $arraychoice = array('2'=>' ', '0'=>$langs->trans("Against"), '1'=>$langs->trans("For")); print $form->selectarray("choix".$i, $arraychoice, GETPOST('choix'.$i)); } print '
'.$langs->trans("Total").''; if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) { print $showsumfor; } if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') { print $langs->trans("Yes").': '.$showsumfor.'
'.$langs->trans("No").': '.$showsumagainst; } if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') { print $langs->trans("For").': '.$showsumfor.'
'.$langs->trans("Against").': '.$showsumagainst; } print '
'."\n"; print '
'."\n"; if ($object->allow_spy) { $toutsujet = explode(",", $object->sujet); $toutsujet = str_replace("°", "'", $toutsujet); $compteursujet = 0; $meilleursujet = ''; for ($i = 0; $i < $nbcolonnes; $i++) { if (isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) { $meilleursujet .= ($meilleursujet ? ", " : ""); if ($object->format == "D") { $meilleursujetexport = $toutsujet[$i]; if (strpos($toutsujet[$i], '@') !== false) { $toutsujetdate = explode("@", $toutsujet[$i]); $meilleursujet .= dol_print_date($toutsujetdate[0], 'daytext').' ('.dol_print_date($toutsujetdate[0], '%A').') - '.$toutsujetdate[1]; } else { $meilleursujet .= dol_print_date((empty($toutsujet[$i]) ? 0 : $toutsujet[$i]), 'daytext').' ('.dol_print_date((empty($toutsujet[$i]) ? 0 : $toutsujet[$i]), '%A').')'; } } else { $tmps = explode('@', $toutsujet[$i]); $meilleursujet .= dol_htmlentities($tmps[0]); } $compteursujet++; } } $meilleursujet = substr("$meilleursujet", 1); $meilleursujet = str_replace("°", "'", $meilleursujet); // Show best choice if ($nbofcheckbox >= 2) { $vote_str = $langs->trans('votes'); print '

'."\n"; if (isset($meilleurecolonne) && $compteursujet == "1") { print ' '.$langs->trans('TheBestChoice').": ".$meilleursujet." ".$langs->trans('with')." ".$meilleurecolonne."".$vote_str.".\n"; } elseif (isset($meilleurecolonne)) { print ' '.$langs->trans('TheBestChoices').": ".$meilleursujet." ".$langs->trans('with')." ".$meilleurecolonne."".$vote_str.".\n"; } print '


'."\n"; } } print '
'; // Comment list $comments = $object->getComments(); if ($comments) { print '
'.$langs->trans("CommentsOfVoters").':
'."\n"; foreach ($comments as $obj) { // ligne d'un usager pré-authentifié //$mod_ok = (in_array($obj->name, $listofvoters)); print '
'; if (in_array($obj->usercomment, $listofvoters)) { print ' '.img_picto('', 'delete.png', '', false, 0, 0, '', 'nomarginleft').' '; } //else print img_picto('', 'ellipsis-h', '', false, 0, 0, '', 'nomarginleft').' '; print dol_htmlentities($obj->usercomment).': '.dol_nl2br(dol_htmlentities($obj->comment))."
"; } } // Form to add comment if ($object->allow_comments) { print '
'.$langs->trans("AddACommentForPoll")."
\n"; print '
'."\n"; print $langs->trans("Name").': '; print '   '."\n"; print '
'."\n"; print ''."\n"; print '
'."\n"; // div add comment } print '

'; print ''."\n"; llxFooterSurvey(); $db->close();