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(0, $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) {
 
   92  $comment = 
GETPOST(
"comment", 
'alphanohtml');
 
   93  $comment_user = 
GETPOST(
'commentuser', 
'alphanohtml');
 
   97    setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Comment")), 
null, 
'errors');
 
  101    setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Name")), 
null, 
'errors');
 
  104  if (!in_array($comment_user, $listofvoters)) {
 
  105    setEventMessages($langs->trans(
"UserMustBeSameThanUserUsedToVote"), 
null, 
'errors');
 
  110  $nb_post_max = 
getDolGlobalInt(
"MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
 
  115  if ($nb_post_max > 0) { 
 
  116    $sql = 
"SELECT COUNT(id_comment) as nb_comments";
 
  117    $sql .= 
" FROM ".MAIN_DB_PREFIX.
"opensurvey_comments";
 
  118    $sql .= 
" WHERE ip = '".$db->escape($user_ip).
"'";
 
  119    $sql .= 
" AND date_creation > '".$db->idate($minmonthpost).
"'";
 
  120    $resql = $db->query($sql);
 
  122      $num = $db->num_rows($resql);
 
  126        $obj = $db->fetch_object($resql);
 
  127        $nb_post_ip = $obj->nb_comments;
 
  132  if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
 
  133    setEventMessages($langs->trans(
"AlreadyTooMuchPostOnThisIPAdress"), 
null, 
'errors');
 
  138    $resql = 
$object->addComment($comment, $comment_user, $user_ip);
 
  148  if (!$canbemodified) {
 
  153  if (
GETPOST(
'nom', 
'alphanohtml')) {
 
  155    for ($i = 0; $i < $nbcolonnes; $i++) {
 
  156      if (GETPOSTISSET(
"choix".$i) && 
GETPOST(
"choix".$i) == 
'1') {
 
  157        $nouveauchoix .= 
"1";
 
  158      } elseif (GETPOSTISSET(
"choix".$i) && 
GETPOST(
"choix".$i) == 
'2') {
 
  159        $nouveauchoix .= 
"2";
 
  161        $nouveauchoix .= 
"0";
 
  166    $nb_post_max = 
getDolGlobalInt(
"MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
 
  171    if ($nb_post_max > 0) { 
 
  172      $sql = 
"SELECT COUNT(id_users) as nb_records";
 
  173      $sql .= 
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs";
 
  174      $sql .= 
" WHERE ip = '".$db->escape($user_ip).
"'";
 
  175      $sql .= 
" AND date_creation > '".$db->idate($minmonthpost).
"'";
 
  176      $resql = $db->query($sql);
 
  178        $num = $db->num_rows($resql);
 
  182          $obj = $db->fetch_object($resql);
 
  183          $nb_post_ip = $obj->nb_records;
 
  189    $nom = substr(
GETPOST(
"nom", 
'alphanohtml'), 0, 64);
 
  192    $sql = 
'SELECT id_users, nom as name';
 
  193    $sql .= 
' FROM '.MAIN_DB_PREFIX.
'opensurvey_user_studs';
 
  194    $sql .= 
" WHERE id_sondage = '".$db->escape($numsondage).
"' AND nom = '".$db->escape($nom).
"' ORDER BY id_users";
 
  195    $resql = $db->query($sql);
 
  200    $num_rows = $db->num_rows($resql);
 
  205    } elseif ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
 
  206      setEventMessages($langs->trans(
"AlreadyTooMuchPostOnThisIPAdress"), 
null, 
'errors');
 
  210      $sql = 
'INSERT INTO '.MAIN_DB_PREFIX.
'opensurvey_user_studs (nom, id_sondage, reponses, ip, date_creation)';
 
  211      $sql .= 
" VALUES ('".$db->escape($nom).
"', '".$db->escape($numsondage).
"','".$db->escape($nouveauchoix).
"', '".$db->escape($user_ip).
"', '".$db->idate($now).
"')";
 
  212      $resql = $db->query($sql);
 
  216        $_SESSION[
"savevoter"] = $nom.
','.(empty($_SESSION[
"savevoter"]) ? 
'' : $_SESSION[
"savevoter"]); 
 
  217        $listofvoters = explode(
',', $_SESSION[
"savevoter"]);
 
  221            $userstatic = 
new User($db);
 
  222            $userstatic->fetch(
$object->fk_user_creat);
 
  224            $email = $userstatic->email;
 
  231            include_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
 
  233            $application = (
$conf->global->MAIN_APPLICATION_TITLE ? 
$conf->global->MAIN_APPLICATION_TITLE : 
'Dolibarr ERP/CRM');
 
  236            $link = 
'<a href="'.$link.
'">'.$link.
'</a>';
 
  237            $body = str_replace(
'\n', 
'<br>', $langs->transnoentities(
'EmailSomeoneVoted', $nom, $link));
 
  240            $cmailfile = 
new CMailFile(
"[".$application.
"] ".$langs->trans(
"Poll").
': '.
$object->title, $email, 
$conf->global->MAIN_MAIL_EMAIL_FROM, $body, 
null, 
null, 
null, 
'', 
'', 0, -1);
 
  241            $result = $cmailfile->sendfile();
 
  249    setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Name")), 
null, 
'errors');
 
  255$testmodifier = 
false;
 
  256$testligneamodifier = 
false;
 
  258for ($i = 0; $i < $nblines; $i++) {
 
  259  if (GETPOSTISSET(
'modifierligne'.$i)) {
 
  260    $ligneamodifier = $i;
 
  261    $testligneamodifier = 
true;
 
  265  if (GETPOSTISSET(
'validermodifier'.$i)) {
 
  267    $testmodifier = 
true;
 
  273  for ($i = 0; $i < $nbcolonnes; $i++) {
 
  274    if (GETPOSTISSET(
"choix".$i) && 
GETPOST(
"choix".$i) == 
'1') {
 
  275      $nouveauchoix .= 
"1";
 
  276    } elseif (GETPOSTISSET(
"choix".$i) && 
GETPOST(
"choix".$i) == 
'2') {
 
  277      $nouveauchoix .= 
"2";
 
  279      $nouveauchoix .= 
"0";
 
  283  if (!$canbemodified) {
 
  287  $idtomodify = 
GETPOST(
"idtomodify".$modifier);
 
  288  $sql = 
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_user_studs";
 
  289  $sql .= 
" SET reponses = '".$db->escape($nouveauchoix).
"'";
 
  290  $sql .= 
" WHERE id_users = '".$db->escape($idtomodify).
"'";
 
  292  $resql = $db->query($sql);
 
  301  if (!$canbemodified) {
 
  305  $resql = 
$object->deleteComment($idcomment);
 
  314$form = 
new Form($db);
 
  317$arrayofcss = array(
'/opensurvey/css/style.css');
 
  322  $langs->load(
"errors");
 
  323  print $langs->trans(
"ErrorRecordNotFound");
 
  332$toutsujet = explode(
",", 
$object->sujet);
 
  333$listofanswers = array();
 
  334foreach ($toutsujet as $value) {
 
  335  $tmp = explode(
'@', $value);
 
  336  $listofanswers[] = array(
'label' => $tmp[0], 
'format' => (!empty($tmp[1]) ? $tmp[1] : 
'checkbox'));
 
  338$toutsujet = str_replace(
"°", 
"'", $toutsujet);
 
  341print 
'<div class="survey_intro">';
 
  342print 
'<div class="survey_invitation">'.$langs->trans(
"YouAreInivitedToVote").
'</div>';
 
  343print 
'<span class="opacitymedium">'.$langs->trans(
"OpenSurveyHowTo").
'</span><br>';
 
  344if (empty(
$object->allow_spy)) {
 
  345  print 
'<span class="opacitymedium">'.$langs->trans(
"YourVoteIsPrivate").
'</span><br>';
 
  347  print $form->textwithpicto(
'<span class="opacitymedium">'.$langs->trans(
"YourVoteIsPublic").
'</span>', $langs->trans(
"CanSeeOthersVote")).
'<br>';
 
  352if (empty(
$object->description)) {
 
  353  print 
'<div class="corps">'.
"\n";
 
  359$titre = str_replace(
"\\", 
"", 
$object->title);
 
  360print 
'<div class="survey_title">'.img_picto(
'', 
'poll', 
'class="size15x paddingright"').
' <strong>'.
dol_htmlentities($titre).
'</strong></div>';
 
  362if (!empty(
$object->description)) {
 
  363  print 
'<br><div class="corps">'.
"\n";
 
  374if (!$canbemodified) {
 
  375  print 
'<br><center><div class="quatrevingtpercent center warning">'.$langs->trans(
'SurveyExpiredInfo').
'</div></center>';
 
  382print 
'<div class="cadre"> '.
"\n";
 
  383print 
'<br><br>'.
"\n";
 
  386print 
'<div class="div-table-responsive">';
 
  387print 
'<table class="resultats">'.
"\n";
 
  393  print 
'<td></td>'.
"\n";
 
  397  $nbofsujet = count($toutsujet);
 
  398  for ($i = 0; $i < $nbofsujet; $i++) {
 
  399    if (isset($toutsujet[$i + 1]) && date(
'Y', intval($toutsujet[$i])) == date(
'Y', intval($toutsujet[$i + 1]))) {
 
  402      print 
'<td colspan='.$colspan.
' class="annee">'.date(
'Y', intval($toutsujet[$i])).
'</td>'.
"\n";
 
  409  print 
'<td></td>'.
"\n";
 
  413  for ($i = 0; $i < $nbofsujet; $i++) {
 
  414    $cur = intval($toutsujet[$i]); 
 
  416    if (!isset($toutsujet[$i + 1])) {
 
  419      $next = intval($toutsujet[$i + 1]);
 
  425      print 
'<td colspan='.$colspan.
' class="mois">'.
dol_print_date($cur, 
"%B").
'</td>'.
"\n";
 
  432  print 
'<td></td>'.
"\n";
 
  436  for ($i = 0; $i < $nbofsujet; $i++) {
 
  437    $cur = intval($toutsujet[$i]);
 
  438    if (!isset($toutsujet[$i + 1])) {
 
  441      $next = intval($toutsujet[$i + 1]);
 
  446      print 
'<td colspan="'.$colspan.
'" class="jour">'.
dol_print_date($cur, 
"%a %d").
'</td>'.
"\n";
 
  454  if (strpos(
$object->sujet, 
'@') !== 
false) {
 
  456    print 
'<td></td>'.
"\n";
 
  458    for ($i = 0; isset($toutsujet[$i]); $i++) {
 
  459      $heures = explode(
'@', $toutsujet[$i]);
 
  460      if (isset($heures[1])) {
 
  461        print 
'<td class="heure">'.dol_htmlentities($heures[1]).
'</td>'.
"\n";
 
  463        print 
'<td class="heure"></td>'.
"\n";
 
  472  print 
'<td></td>'.
"\n";
 
  474  for ($i = 0; isset($toutsujet[$i]); $i++) {
 
  475    $tmp = explode(
'@', $toutsujet[$i]);
 
  476    print 
'<td class="sujet">'.dol_escape_htmltag($tmp[0]).
'</td>'.
"\n";
 
  484$currentusername = 
'';
 
  486$sumagainst = array();
 
  488$sql = 
"SELECT id_users, nom as name, id_sondage, reponses";
 
  489$sql .= 
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs";
 
  490$sql .= 
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
 
  491$resql = $db->query($sql);
 
  496$num = $db->num_rows($resql);
 
  497while ($compteur < $num) {
 
  498  $obj = $db->fetch_object($resql);
 
  500  $ensemblereponses = $obj->reponses;
 
  503  $mod_ok = (in_array($obj->name, $listofvoters));
 
  505  if (!$mod_ok && !
$object->allow_spy) {
 
  513  print 
'<td class="nom">'.img_picto($obj->name, 
'user', 
'class="pictofixedwidth"').dol_htmlentities($obj->name).
'</td>'.
"\n";
 
  516  if (!$testligneamodifier) {
 
  517    for ($i = 0; $i < $nbcolonnes; $i++) {
 
  518      $car = substr($ensemblereponses, $i, 1);
 
  521      if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno', 
'foragainst'))) {
 
  522        if (((
string) $car) == 
"1") {
 
  523          print 
'<td class="ok">OK</td>'.
"\n";
 
  525          print 
'<td class="non">KO</td>'.
"\n";
 
  528        if (!isset($sumfor[$i])) {
 
  531        if (((
string) $car) == 
"1") {
 
  535      if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] == 
'yesno') {
 
  536        if (((
string) $car) == 
"1") {
 
  537          print 
'<td class="ok">'.$langs->trans(
"Yes").
'</td>'.
"\n";
 
  538        } elseif (((
string) $car) == 
"0") {
 
  539          print 
'<td class="non">'.$langs->trans(
"No").
'</td>'.
"\n";
 
  541          print 
'<td class="vide"> </td>'.
"\n";
 
  544        if (!isset($sumfor[$i])) {
 
  547        if (!isset($sumagainst[$i])) {
 
  550        if (((
string) $car) == 
"1") {
 
  553        if (((
string) $car) == 
"0") {
 
  557      if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] == 
'foragainst') {
 
  558        if (((
string) $car) == 
"1") {
 
  559          print 
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
 
  560        } elseif (((
string) $car) == 
"0") {
 
  561          print 
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
 
  563          print 
'<td class="vide"> </td>'.
"\n";
 
  566        if (!isset($sumfor[$i])) {
 
  569        if (!isset($sumagainst[$i])) {
 
  572        if (((
string) $car) == 
"1") {
 
  575        if (((
string) $car) == 
"0") {
 
  582    if ($compteur == $ligneamodifier) {
 
  583      for ($i = 0; $i < $nbcolonnes; $i++) {
 
  584        $car = substr($ensemblereponses, $i, 1);
 
  585        print 
'<td class="vide">';
 
  586        if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno', 
'foragainst'))) {
 
  587          print 
'<input type="checkbox" name="choix'.$i.
'" value="1" ';
 
  593        if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] == 
'yesno') {
 
  594          $arraychoice = array(
'2' => 
' ', 
'0' => $langs->trans(
"No"), 
'1' => $langs->trans(
"Yes"));
 
  595          print $form->selectarray(
"choix".$i, $arraychoice, $car);
 
  597        if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] == 
'foragainst') {
 
  598          $arraychoice = array(
'2' => 
' ', 
'0' => $langs->trans(
"Against"), 
'1' => $langs->trans(
"For"));
 
  599          print $form->selectarray(
"choix".$i, $arraychoice, $car);
 
  604      for ($i = 0; $i < $nbcolonnes; $i++) {
 
  605        $car = substr($ensemblereponses, $i, 1);
 
  606        if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno', 
'foragainst'))) {
 
  607          if (((
string) $car) == 
"1") {
 
  608            print 
'<td class="ok">OK</td>'.
"\n";
 
  610            print 
'<td class="non">KO</td>'.
"\n";
 
  613          if (!isset($sumfor[$i])) {
 
  616          if (((
string) $car) == 
"1") {
 
  620        if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] == 
'yesno') {
 
  621          if (((
string) $car) == 
"1") {
 
  622            print 
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
 
  623          } elseif (((
string) $car) == 
"0") {
 
  624            print 
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
 
  626            print 
'<td class="vide"> </td>'.
"\n";
 
  629          if (!isset($sumfor[$i])) {
 
  632          if (!isset($sumagainst[$i])) {
 
  635          if (((
string) $car) == 
"1") {
 
  638          if (((
string) $car) == 
"0") {
 
  642        if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] == 
'foragainst') {
 
  643          if (((
string) $car) == 
"1") {
 
  644            print 
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
 
  645          } elseif (((
string) $car) == 
"0") {
 
  646            print 
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
 
  648            print 
'<td class="vide"> </td>'.
"\n";
 
  651          if (!isset($sumfor[$i])) {
 
  654          if (!isset($sumagainst[$i])) {
 
  657          if (((
string) $car) == 
"1") {
 
  660          if (((
string) $car) == 
"0") {
 
  669  if ($compteur != $ligneamodifier && $mod_ok) {
 
  670    $currentusername = $obj->name;
 
  671    print 
'<td class="casevide"><input type="submit" class="button small" name="modifierligne'.$compteur.
'" value="'.
dol_escape_htmltag($langs->trans(
"Edit")).
'"></td>'.
"\n";
 
  675  for ($i = 0; $i < $nblines; $i++) {
 
  676    if (GETPOSTISSET(
"modifierligne".$i)) {
 
  677      if ($compteur == $i) {
 
  678        print 
'<td class="casevide">';
 
  679        print 
'<input type="hidden" name="idtomodify'.$compteur.
'" value="'.$obj->id_users.
'">';
 
  680        print 
'<input type="submit" class="button button-save small" name="validermodifier'.$compteur.
'" value="'.
dol_escape_htmltag($langs->trans(
"Save")).
'">';
 
  691if ($ligneamodifier < 0 && (!isset($_SESSION[
'nom']))) {
 
  693  print 
'<td class="nom">'.
"\n";
 
  694  if (isset($_SESSION[
'nom'])) {
 
  695    print 
'<input type=hidden name="nom" value="'.$_SESSION[
'nom'].
'">'.$_SESSION[
'nom'].
"\n";
 
  697    print 
'<input type="text" name="nom" placeholder="'.dol_escape_htmltag($langs->trans(
"Name")).
'" maxlength="64" class=" minwidth175" value="">'.
"\n";
 
  702  for ($i = 0; $i < $nbcolonnes; $i++) {
 
  703    print 
'<td class="vide">';
 
  704    if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno', 
'foragainst'))) {
 
  705      print 
'<input type="checkbox" name="choix'.$i.
'" value="1"';
 
  706      if (GETPOSTISSET(
'choix'.$i) && 
GETPOST(
'choix'.$i) == 
'1') {
 
  711    if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] == 
'yesno') {
 
  712      $arraychoice = array(
'2' => 
' ', 
'0' => $langs->trans(
"No"), 
'1' => $langs->trans(
"Yes"));
 
  713      print $form->selectarray(
"choix".$i, $arraychoice, 
GETPOST(
'choix'.$i));
 
  715    if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] == 
'foragainst') {
 
  716      $arraychoice = array(
'2' => 
' ', 
'0' => $langs->trans(
"Against"), 
'1' => $langs->trans(
"For"));
 
  717      print $form->selectarray(
"choix".$i, $arraychoice, 
GETPOST(
'choix'.$i));
 
  723  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";
 
  729for ($i = 0; $i < $nbcolonnes; $i++) {
 
  730  if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno', 
'foragainst'))) {
 
  733  if (isset($sumfor[$i])) {
 
  735      $meilleurecolonne = $sumfor[$i];
 
  737    if (!isset($meilleurecolonne) || $sumfor[$i] > $meilleurecolonne) {
 
  738      $meilleurecolonne = $sumfor[$i];
 
  746  print 
'<td class="center">'.$langs->trans(
"Total").
'</td>'.
"\n";
 
  747  for ($i = 0; $i < $nbcolonnes; $i++) {
 
  748    $showsumfor = isset($sumfor[$i]) ? $sumfor[$i] : 
'';
 
  749    $showsumagainst = isset($sumagainst[$i]) ? $sumagainst[$i] : 
'';
 
  750    if (empty($showsumfor)) {
 
  753    if (empty($showsumagainst)) {
 
  758    if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno', 
'foragainst'))) {
 
  761    if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] == 
'yesno') {
 
  762      print $langs->trans(
"Yes").
': '.$showsumfor.
'<br>'.$langs->trans(
"No").
': '.$showsumagainst;
 
  764    if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] == 
'foragainst') {
 
  765      print $langs->trans(
"For").
': '.$showsumfor.
'<br>'.$langs->trans(
"Against").
': '.$showsumagainst;
 
  771  if ($nbofcheckbox >= 2) {
 
  773    print 
'<td class="somme"></td>'.
"\n";
 
  774    for ($i = 0; $i < $nbcolonnes; $i++) {
 
  776      if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno', 
'foragainst')) && isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) {
 
  777        print 
'<td class="somme"><img src="'.dol_buildpath(
'/opensurvey/img/medaille.png', 1).
'"></td>'.
"\n";
 
  779        print 
'<td class="somme"></td>'.
"\n";
 
  785print 
'</table>'.
"\n";
 
  791  $toutsujet = explode(
",", 
$object->sujet);
 
  792  $toutsujet = str_replace(
"°", 
"'", $toutsujet);
 
  797  for ($i = 0; $i < $nbcolonnes; $i++) {
 
  798    if (isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) {
 
  799      $meilleursujet .= ($meilleursujet ? 
", " : 
"");
 
  801        if (strpos($toutsujet[$i], 
'@') !== 
false) {
 
  802          $toutsujetdate = explode(
"@", $toutsujet[$i]);
 
  805          $meilleursujet .= 
dol_print_date((empty($toutsujet[$i]) ? 0 : $toutsujet[$i]), 
'daytext').
' ('.
dol_print_date((empty($toutsujet[$i]) ? 0 : $toutsujet[$i]), 
'%A').
')';
 
  808        $tmps = explode(
'@', $toutsujet[$i]);
 
  817  $meilleursujet = str_replace(
"°", 
"'", $meilleursujet);
 
  820  if ($nbofcheckbox >= 2) {
 
  821    $vote_str = $langs->trans(
'votes');
 
  822    print 
'<p class="affichageresultats">'.
"\n";
 
  824    if (isset($meilleurecolonne) && $compteursujet == 
"1") {
 
  825      print 
'<img src="'.dol_buildpath(
'/opensurvey/img/medaille.png', 1).
'"> '.$langs->trans(
'TheBestChoice').
": <b>".$meilleursujet.
"</b> - <b>".$meilleurecolonne.
"</b> ".$vote_str.
".\n";
 
  826    } elseif (isset($meilleurecolonne)) {
 
  827      print 
'<img src="'.dol_buildpath(
'/opensurvey/img/medaille.png', 1).
'"> '.$langs->trans(
'TheBestChoices').
": <b>".$meilleursujet.
"</b> - <b>".$meilleurecolonne.
"</b> ".$vote_str.
".\n";
 
  830    print 
'</p><br>'.
"\n";
 
  838$comments = 
$object->getComments();
 
  841  print 
'<br>'.img_picto(
'', 
'note', 
'class="pictofixedwidth"').
'<span class="bold opacitymedium">'.$langs->trans(
"CommentsOfVoters").
':</span><br>'.
"\n";
 
  843  foreach ($comments as $obj) {
 
  847    print 
'<div class="comment"><span class="usercomment">';
 
  848    if (in_array($obj->usercomment, $listofvoters)) {
 
  849      print 
'<a href="'.$_SERVER[
"PHP_SELF"].
'?deletecomment='.$obj->id_comment.
'&sondage='.$numsondage.
'"> '.
img_picto(
'', 
'delete.png', 
'', 0, 0, 0, 
'', 
'nomarginleft').
'</a> ';
 
  852    print 
img_picto(
'', 
'user', 
'class="pictofixedwidth"').dol_htmlentities($obj->usercomment).
':</span> <span class="comment">'.
dol_nl2br(
dol_htmlentities($obj->comment)).
"</span></div>";
 
  857if (
$object->allow_comments && $currentusername) {
 
  858  print 
'<br><div class="addcomment"><span class="opacitymedium">'.$langs->trans(
"AddACommentForPoll").
"</span><br>\n";
 
  860  print 
'<textarea name="comment" rows="'.ROWS_2.
'" class="quatrevingtpercent">'.
dol_escape_htmltag(
GETPOST(
'comment', 
'alphanohtml'), 0, 1).
'</textarea><br>'.
"\n";
 
  861  print $langs->trans(
"Name").
': ';
 
  862  print 
'<input type="text" name="commentuser" maxlength="64" value="'.dol_escape_htmltag(GETPOSTISSET(
'commentuser') ? 
GETPOST(
'commentuser', 
'alphanohtml') : (empty($_SESSION[
'nom']) ? $currentusername : $_SESSION[
'nom'])).
'">   '.
"\n";
 
  863  print 
'<input type="submit" class="button smallpaddingimp" name="ajoutcomment" value="'.dol_escape_htmltag($langs->trans(
"AddComment")).
'"><br>'.
"\n";
 
  864  print 
'</form>'.
"\n";
 
  871print 
'<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)
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.
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...
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...
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.