27 require 
'../main.inc.php';
 
   28 require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
 
   29 require_once DOL_DOCUMENT_ROOT.
"/core/lib/files.lib.php";
 
   30 require_once DOL_DOCUMENT_ROOT.
"/opensurvey/class/opensurveysondage.class.php";
 
   31 require_once DOL_DOCUMENT_ROOT.
"/opensurvey/lib/opensurvey.lib.php";
 
   34 if (empty($user->rights->opensurvey->read)) {
 
   39 $action = 
GETPOST(
'action', 
'aZ09');
 
   43 $result = $object->fetch(0, $numsondage);
 
   48 $nblines = $object->fetch_lines();
 
   61 $nbcolonnes = substr_count($object->sujet, 
',') + 1;
 
   66     $erreur_prenom = 
false;
 
   69     for ($i = 0; $i < $nbcolonnes; $i++) {
 
   79     $nom = substr(
GETPOST(
"nom", 
'alphanohtml'), 0, 64);
 
   82     $sql = 
'SELECT id_users, nom as name';
 
   83     $sql .= 
' FROM '.MAIN_DB_PREFIX.
'opensurvey_user_studs';
 
   84     $sql .= 
" WHERE id_sondage='".$db->escape($numsondage).
"' AND nom = '".$db->escape($nom).
"'";
 
   85     $sql .= 
' ORDER BY id_users';
 
   87     $num_rows = $db->num_rows(
$resql);
 
   92       $sql = 
'INSERT INTO '.MAIN_DB_PREFIX.
'opensurvey_user_studs (nom, id_sondage, reponses)';
 
   93       $sql .= 
" VALUES ('".$db->escape($nom).
"', '".$db->escape($numsondage).
"','".$db->escape($nouveauchoix).
"')";
 
  103 $testmodifier = 
false;
 
  104 $testligneamodifier = 
false;
 
  105 $ligneamodifier = -1;
 
  106 for ($i = 0; $i < $nblines; $i++) {
 
  108     $ligneamodifier = $i;
 
  109     $testligneamodifier = 
true;
 
  115     $testmodifier = 
true;
 
  120   if (!$user->rights->opensurvey->write) {
 
  125   for ($i = 0; $i < $nbcolonnes; $i++) {
 
  127       $nouveauchoix .= 
"1";
 
  129       $nouveauchoix .= 
"2";
 
  131       $nouveauchoix .= 
"0";
 
  135   $idtomodify = 
GETPOST(
"idtomodify".$modifier);
 
  136   $sql = 
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_user_studs";
 
  137   $sql .= 
" SET reponses = '".$db->escape($nouveauchoix).
"'";
 
  138   $sql .= 
" WHERE id_users = '".$db->escape($idtomodify).
"'";
 
  140   $resql = $db->query($sql);
 
  147 if (
GETPOST(
"ajoutercolonne") && 
GETPOST(
'nouvellecolonne') && $object->format == 
"A") {
 
  149   if (!$user->rights->opensurvey->write) {
 
  153   $nouveauxsujets = $object->sujet;
 
  156   $nouveauxsujets .= 
',';
 
  157   $nouveauxsujets .= str_replace(array(
",", 
"@"), 
" ", 
GETPOST(
"nouvellecolonne")).(!
GETPOST(
"typecolonne") ? 
'' : 
'@'.GETPOST(
"typecolonne"));
 
  160   $sql = 
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_sondage";
 
  161   $sql .= 
" SET sujet = '".$db->escape($nouveauxsujets).
"'";
 
  162   $sql .= 
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
 
  163   $resql = $db->query($sql);
 
  167     header(
'Location: results.php?id='.$object->id_sondage);
 
  172 if (
GETPOSTISSET(
"ajoutercolonne") && $object->format == 
"D") {
 
  174   if (!$user->rights->opensurvey->write) {
 
  178   $nouveauxsujets = $object->sujet;
 
  186       $nouvelledate .= 
"@";
 
  187       $nouvelledate .= 
GETPOST(
"nouvelleheuredebut");
 
  188       $nouvelledate .= 
"h";
 
  190       if (
GETPOST(
"nouvelleminutedebut") != 
"vide") {
 
  191         $nouvelledate .= 
GETPOST(
"nouvelleminutedebut");
 
  196       $nouvelledate .= 
"-";
 
  197       $nouvelledate .= 
GETPOST(
"nouvelleheurefin");
 
  198       $nouvelledate .= 
"h";
 
  200       if (
GETPOST(
"nouvelleminutefin") != 
"vide") {
 
  201         $nouvelledate .= 
GETPOST(
"nouvelleminutefin");
 
  207         && (
GETPOST(
"nouvelleminutedebut") < 
GETPOST(
"nouvelleminutefin")))))) {
 
  208       $erreur_ajout_date = 
false;
 
  210       $erreur_ajout_date = 
"yes";
 
  214     $datesbase = explode(
",", $object->sujet);
 
  215     $taillebase = count($datesbase);
 
  218     if ($nouvelledate < $datesbase[0]) {
 
  220     } elseif ($nouvelledate > $datesbase[$taillebase - 1]) {
 
  221       $cleinsertion = count($datesbase);
 
  223       $nbdatesbase = count($datesbase);
 
  224       for ($i = 0; $i < $nbdatesbase; $i++) {
 
  226         if ($nouvelledate > $datesbase[$i] && $nouvelledate < $datesbase[$j]) {
 
  232     array_splice($datesbase, $cleinsertion, 0, $nouvelledate);
 
  233     $cle = array_search($nouvelledate, $datesbase);
 
  235     $nbofdates = count($datesbase);
 
  236     for ($i = 0; $i < $nbofdates; $i++) {
 
  237       $dateinsertion .= 
",";
 
  238       $dateinsertion .= $datesbase[$i];
 
  241     $dateinsertion = substr(
"$dateinsertion", 1);
 
  244     if (isset($erreur_ajout_date) && empty($erreur_ajout_date)) {
 
  245       $sql = 
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_sondage";
 
  246       $sql .= 
" SET sujet = '".$db->escape($dateinsertion).
"'";
 
  247       $sql .= 
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
 
  248       $resql = $db->query($sql);
 
  252         header(
'Location: results.php?id='.$object->id_sondage);
 
  255     if ($cleinsertion >= 0) {
 
  256       $sql = 
'SELECT s.reponses';
 
  257       $sql .= 
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs as s";
 
  258       $sql .= 
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
 
  259       $resql = $db->query($sql);
 
  263         $num = $db->num_rows(
$resql);
 
  265         while ($compteur < $num) {
 
  266           $obj = $db->fetch_object(
$resql);
 
  267           $sql = 
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_user_studs";
 
  268           if ($cleinsertion == 0) {
 
  269             $sql .= 
" SET reponses = '0".$db->escape($obj->reponses).
"'";
 
  271             $reponsesadd = str_split($obj->reponses);
 
  272             $lengthresponses = count($reponsesadd);
 
  273             for ($cpt = $lengthresponses; $cpt > $cleinsertion; $cpt--) {
 
  274               $reponsesadd[$cpt] = $reponsesadd[$cpt-1];
 
  276             $reponsesadd[$cleinsertion] = 
'0';
 
  277             $reponsesadd = implode($reponsesadd);
 
  278             $sql .= 
" SET reponses = '".$db->escape($reponsesadd).
"'";
 
  280           $sql .= 
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
 
  281           $resql = $db->query($sql);
 
  289     $adresseadmin = $object->mail_admin;
 
  291     $erreur_ajout_date = 
"yes";
 
  296 for ($i = 0; $i < $nblines; $i++) {
 
  299     if (!$user->rights->opensurvey->write) {
 
  307     $sql = 
"SELECT id_users, nom as name, id_sondage, reponses";
 
  308     $sql .= 
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs";
 
  309     $sql .= 
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
 
  310     $resql = $db->query($sql);
 
  314     $num = $db->num_rows(
$resql);
 
  315     while ($compteur < $num) {
 
  316       $obj = $db->fetch_object(
$resql);
 
  318       if ($compteur == $i) {
 
  319         $sql2 = 
'DELETE FROM '.MAIN_DB_PREFIX.
'opensurvey_user_studs';
 
  320         $sql2 .= 
" WHERE id_users = ".((int) $obj->id_users);
 
  321         $resql2 = $db->query($sql2);
 
  330 for ($i = 0; $i < $nbcolonnes; $i++) {
 
  331   if ((
GETPOST(
"effacecolonne".$i) || 
GETPOST(
"effacecolonne".$i.
"_x") || 
GETPOST(
"effacecolonne".$i.
".x"))
 
  332     && $nbcolonnes > 1) { 
 
  334     if (!$user->rights->opensurvey->write) {
 
  340     $toutsujet = explode(
",", $object->sujet);
 
  342     $nouveauxsujets = 
'';
 
  345     while (isset($toutsujet[$j])) {
 
  348         if (!empty($nouveauxsujets)) {
 
  349           $nouveauxsujets .= 
',';
 
  351         $nouveauxsujets .= $toutsujet[$j];
 
  358     $sql = 
'UPDATE '.MAIN_DB_PREFIX.
"opensurvey_sondage";
 
  359     $sql .= 
" SET sujet = '".$db->escape($nouveauxsujets).
"' WHERE id_sondage = '".$db->escape($numsondage).
"'";
 
  360     $resql = $db->query($sql);
 
  367     $sql = 
"SELECT id_users, nom as name, id_sondage, reponses";
 
  368     $sql .= 
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs";
 
  369     $sql .= 
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
 
  371     $resql = $db->query($sql);
 
  376     $num = $db->num_rows(
$resql);
 
  377     while ($compteur < $num) {
 
  378       $obj = $db->fetch_object(
$resql);
 
  381       $ensemblereponses = $obj->reponses;
 
  384       for ($j = 0; $j < $nbcolonnes; $j++) {
 
  385         $car = substr($ensemblereponses, $j, 1);
 
  393       $sql2 = 
'UPDATE '.MAIN_DB_PREFIX.
'opensurvey_user_studs';
 
  394       $sql2 .= 
" SET reponses = '".$db->escape($newcar).
"'";
 
  395       $sql2 .= 
" WHERE id_users = '".$db->escape($obj->id_users).
"'";
 
  398       $resql2 = $db->query($sql2);
 
  415 if ($object->fk_user_creat) {
 
  416   $userstatic = 
new User($db);
 
  417   $userstatic->fetch($object->fk_user_creat);
 
  420 $result = $object->fetch(0, $numsondage);
 
  426 $title = $object->title.
" - ".$langs->trans(
'Card');
 
  428 $arrayofjs = array();
 
  429 $arrayofcss = array(
'/opensurvey/css/style.css');
 
  430 llxHeader(
'', $title, $helpurl, 0, 0, 0, $arrayofjs, $arrayofcss);
 
  434 $toutsujet = explode(
",", $object->sujet);
 
  435 $listofanswers = array();
 
  436 foreach ($toutsujet as $value) {
 
  437   $tmp = explode(
'@', $value);
 
  438   $listofanswers[] = array(
'label'=>$tmp[0], 
'format'=>(!empty($tmp[1]) ? $tmp[1] : 
'checkbox'));
 
  440 $toutsujet = str_replace(
"@", 
"<br>", $toutsujet);
 
  441 $toutsujet = str_replace(
"°", 
"'", $toutsujet);
 
  444 print 
'<form name="formulaire4" action="#" method="POST">'.
"\n";
 
  445 print 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
  447 $head = opensurvey_prepare_head($object);
 
  453 $linkback = 
'<a href="'.DOL_URL_ROOT.
'/opensurvey/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
 
  455 dol_banner_tab($object, 
'id', $linkback, 1, 
'id_sondage', 
'id_sondage', $morehtmlref);
 
  458 print 
'<div class="fichecenter">';
 
  460 print 
'<div class="fichehalfleft">';
 
  461 print 
'<div class="underbanner clearboth"></div>';
 
  462 print 
'<table class="border tableforfield centpercent">';
 
  465 $type = ($object->format == 
"A") ? 
'classic' : 
'date';
 
  466 print 
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td>';
 
  467 print 
img_picto(
'', 
dol_buildpath(
'/opensurvey/img/'.($type == 
'classic' ? 
'chart-32.png' : 
'calendar-32.png'), 1), 
'width="16"', 1);
 
  468 print 
' '.$langs->trans($type == 
'classic' ? 
"TypeClassic" : 
"TypeDate").
'</td></tr>';
 
  472 $adresseadmin = $object->mail_admin;
 
  473 print $langs->trans(
"Title").
'</td><td>';
 
  474 if ($action == 
'edit') {
 
  475   print 
'<input type="text" name="nouveautitre" size="40" value="'.dol_escape_htmltag($object->title).
'">';
 
  482 print 
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td>';
 
  483 if ($action == 
'edit') {
 
  484   $doleditor = 
new DolEditor(
'nouveauxcommentaires', $object->description, 
'', 120, 
'dolibarr_notes', 
'In', 1, 1, 1, ROWS_7, 
'90%');
 
  485   $doleditor->Create(0, 
'');
 
  487   print (
dol_textishtml($object->description) ? $object->description : 
dol_nl2br($object->description, 1, 
true));
 
  493 if (!$object->fk_user_creat) {
 
  494   print 
'<tr><td>'.$langs->trans(
"EMail").
'</td><td>';
 
  495   if ($action == 
'edit') {
 
  496     print 
'<input type="text" name="nouvelleadresse" class="minwith200" value="'.$object->mail_admin.
'">';
 
  506 print 
'<div class="fichehalfright">';
 
  507 print 
'<div class="underbanner clearboth"></div>';
 
  509 print 
'<table class="border tableforfield centpercent">';
 
  513 print 
'<tr><td>'.$langs->trans(
'ExpireDate').
'</td><td>';
 
  514 if ($action == 
'edit') {
 
  515   print 
$form->selectDate($expiredate ? $expiredate : $object->date_fin, 
'expire', 0, 0, 0, 
'', 1, 0);
 
  526 print $langs->trans(
"Author").
'</td><td>';
 
  527 if ($object->fk_user_creat) {
 
  528   print $userstatic->getLoginUrl(1);
 
  535 print 
'<tr><td>'.$langs->trans(
"UrlForSurvey", 
'').
'</td><td>';
 
  538 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT, 
'/').
'$/i', 
'', trim($dolibarr_main_url_root));
 
  539 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; 
 
  542 $url = $urlwithouturlroot.dol_buildpath(
'/public/opensurvey/studs.php', 1).
'?sondage='.$object->id_sondage;
 
  543 $urllink = 
'<input type="text" class="quatrevingtpercent" '.($action == 
'edit' ? 
'disabled' : 
'').
' id="opensurveyurl" name="opensurveyurl" value="'.$url.
'">';
 
  545 if ($action != 
'edit') {
 
  555 print 
'<div class="clearboth"></div>';
 
  559 print 
'</form>'.
"\n";
 
  564 print 
'<div class="tabsAction">';
 
  566 print 
'<a class="butAction" href="exportcsv.php?id='.urlencode($numsondage).
'">'.$langs->trans(
"ExportSpreadsheet").
' (.CSV)</a>';
 
  574   if (!$user->rights->opensurvey->write) {
 
  578   print 
'<form name="formulaire" action="" method="POST">'.
"\n";
 
  579   print 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
  580   print 
'<input type="hidden" name="backtopage" value="'.GETPOST(
'backtopage', 
'alpha').
'">';
 
  582   print 
'<div class="center">'.
"\n";
 
  586   if ($object->format == 
"A") {
 
  587     print $langs->trans(
"AddNewColumn").
':<br><br>';
 
  588     print $langs->trans(
"Title").
' <input type="text" name="nouvellecolonne" size="40"><br>';
 
  589     $tmparray = array(
'checkbox'=>$langs->trans(
"CheckBox"), 
'yesno'=>$langs->trans(
"YesNoList"), 
'foragainst'=>$langs->trans(
"PourContreList"));
 
  590     print $langs->trans(
"Type").
' '.
$form->selectarray(
"typecolonne", $tmparray, 
GETPOST(
'typecolonne')).
'<br><br>';
 
  591     print 
'<input type="submit" class="button" name="ajoutercolonne" value="'.dol_escape_htmltag($langs->trans(
"Add")).
'">';
 
  592     print 
'<input type="hidden" name="id_sondage" value="'.dol_escape_htmltag($object->id_sondage).
'">';
 
  593     print 
'     ';
 
  594     print 
'<input type="submit" class="button button-cancel" name="retoursondage" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
 
  595     print 
'<br><br>'.
"\n";
 
  597     require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
 
  601     print $langs->trans(
"AddADate").
':<br><br>'.
"\n";
 
  602     print 
'<select name="nouveaujour"> '.
"\n";
 
  603     print 
'<OPTION VALUE="vide"> </OPTION>'.
"\n";
 
  604     for ($i = 1; $i < 32; $i++) {
 
  605       print 
'<OPTION VALUE="'.$i.
'">'.$i.
'</OPTION>'.
"\n";
 
  607     print 
'</select>'.
"\n";
 
  609     print $formother->select_month(
'', 
'nouveaumois', 1);
 
  613     print $formother->selectyear(
'', 
'nouvelleannee', 1, 0, 5, 0, 1);
 
  615     print 
'<br><br>'.$langs->trans(
"AddStartHour").
': <br><br>'.
"\n";
 
  616     print 
'<select name="nouvelleheuredebut"> '.
"\n";
 
  617     print 
'<OPTION VALUE="vide"> </OPTION>'.
"\n";
 
  618     for ($i = 0; $i < 24; $i++) {
 
  619       print 
'<OPTION VALUE="'.$i.
'">'.$i.
' H</OPTION>'.
"\n";
 
  621     print 
'</select>'.
"\n";
 
  622     print 
'<select name="nouvelleminutedebut"> '.
"\n";
 
  623     print 
'<OPTION VALUE="vide"> </OPTION>'.
"\n";
 
  624     print 
'<OPTION VALUE="00">00</OPTION>'.
"\n";
 
  625     print 
'<OPTION VALUE="15">15</OPTION>'.
"\n";
 
  626     print 
'<OPTION VALUE="30">30</OPTION>'.
"\n";
 
  627     print 
'<OPTION VALUE="45">45</OPTION>'.
"\n";
 
  628     print 
'</select>'.
"\n";
 
  629     print 
'<br><br>'.$langs->trans(
"AddEndHour").
': <br><br>'.
"\n";
 
  630     print 
'<select name="nouvelleheurefin"> '.
"\n";
 
  631     print 
'<OPTION VALUE="vide"> </OPTION>'.
"\n";
 
  632     for ($i = 0; $i < 24; $i++) {
 
  633       print 
'<OPTION VALUE="'.$i.
'">'.$i.
' H</OPTION>'.
"\n";
 
  635     print 
'</SELECT>'.
"\n";
 
  636     print 
'<select name="nouvelleminutefin"> '.
"\n";
 
  637     print 
'<OPTION VALUE="vide"> </OPTION>'.
"\n";
 
  638     print 
'<OPTION VALUE="00">00</OPTION>'.
"\n";
 
  639     print 
'<OPTION VALUE="15">15</OPTION>'.
"\n";
 
  640     print 
'<OPTION VALUE="30">30</OPTION>'.
"\n";
 
  641     print 
'<OPTION VALUE="45">45</OPTION>'.
"\n";
 
  642     print 
'</select>'.
"\n";
 
  645     print
' <input type="submit" class="button" name="ajoutercolonne" value="'.dol_escape_htmltag($langs->trans(
"Add")).
'">'.
"\n";
 
  646     print 
'   ';
 
  647     print 
'<input type="submit" class="button button-cancel" name="retoursondage" value="'.$langs->trans(
"Cancel").
'">';
 
  650   print 
'</form>'.
"\n";
 
  651   print 
'<br><br><br><br>'.
"\n";
 
  657 if ($user->rights->opensurvey->write) {
 
  658   print 
'<span class="opacitymedium">';
 
  659   $s = $langs->trans(
"PollAdminDesc", 
'{s1}', $langs->trans(
"Add"));
 
  660   print str_replace(
'{s1}', 
img_picto(
'', 
'delete'), $s);
 
  664 $nbcolonnes = substr_count($object->sujet, 
',') + 1;
 
  666 print 
'<form name="formulaire" action="" method="POST">'.
"\n";
 
  667 print 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
  668 print 
'<input type="hidden" name="page_y" value="">';
 
  670 print 
'<div class="cadre div-table-responsive-no-min"> '.
"\n";
 
  673 print 
'<table class="resultats">'.
"\n";
 
  676 $toutsujet = explode(
",", $object->sujet);
 
  677 $toutsujet = str_replace(
"°", 
"'", $toutsujet);
 
  680 print 
'<td></td>'.
"\n";
 
  681 print 
'<td></td>'.
"\n";
 
  684 if ($user->rights->opensurvey->write) {
 
  685   for ($i = 0; isset($toutsujet[$i]); $i++) {
 
  686     print 
'<td class=somme><input type="image" name="effacecolonne'.$i.
'" src="'.
img_picto(
'', 
'delete.png', 
'', 
false, 1).
'"></td>'.
"\n";
 
  694 if ($object->format == 
"D") {
 
  697   print 
'<td></td>'.
"\n";
 
  698   print 
'<td></td>'.
"\n";
 
  702   $nbofsujet = count($toutsujet);
 
  703   for ($i = 0; $i < $nbofsujet; $i++) {
 
  704     if (isset($toutsujet[$i + 1]) && date(
'Y', intval($toutsujet[$i])) == date(
'Y', intval($toutsujet[$i + 1]))) {
 
  707       print 
'<td colspan='.$colspan.
' class="annee">'.date(
'Y', intval($toutsujet[$i])).
'</td>'.
"\n";
 
  712   if ($user->rights->opensurvey->write) {
 
  713     print 
'<td class="annee">';
 
  714     print 
'<a href="'.$_SERVER[
"PHP_SELF"].
'?ajoutsujet=1&id='.$object->id_sondage.
'">'.$langs->trans(
"Add").
'</a></td>'.
"\n";
 
  719   print 
'<td></td>'.
"\n";
 
  720   print 
'<td></td>'.
"\n";
 
  724   for ($i = 0; $i < $nbofsujet; $i++) {
 
  725     $cur = intval($toutsujet[$i]); 
 
  727     if (isset($toutsujet[$i + 1]) === 
false) {
 
  730       $next = intval($toutsujet[$i + 1]);
 
  736       print 
'<td colspan='.$colspan.
' class="mois">'.
dol_print_date($cur, 
"%B").
'</td>'.
"\n";
 
  742   if ($user->rights->opensurvey->write) {
 
  743     print 
'<td class="mois"><a href="'.$_SERVER[
"PHP_SELF"].
'?ajoutsujet=1&id='.$object->id_sondage.
'">'.$langs->trans(
"Add").
'</a></td>'.
"\n";
 
  748   print 
'<td></td>'.
"\n";
 
  749   print 
'<td></td>'.
"\n";
 
  753   for ($i = 0; $i < $nbofsujet; $i++) {
 
  754     $cur = intval($toutsujet[$i]);
 
  755     if (isset($toutsujet[$i + 1]) === 
false) {
 
  758       $next = intval($toutsujet[$i + 1]);
 
  763       print 
'<td colspan='.$colspan.
' class="jour">'.
dol_print_date($cur, 
"%a %e").
'</td>'.
"\n";
 
  769   if ($user->rights->opensurvey->write) {
 
  770     print 
'<td class="jour"><a href="'.$_SERVER[
"PHP_SELF"].
'?ajoutsujet=1&id='.$object->id_sondage.
'">'.$langs->trans(
"Add").
'</a></td>'.
"\n";
 
  775   if (strpos($object->sujet, 
'@') !== 
false) {
 
  777     print 
'<td></td>'.
"\n";
 
  778     print 
'<td></td>'.
"\n";
 
  780     for ($i = 0; isset($toutsujet[$i]); $i++) {
 
  781       $heures = explode(
'@', $toutsujet[$i]);
 
  782       if (isset($heures[1])) {
 
  783         print 
'<td class="heure">'.dol_htmlentities($heures[1]).
'</td>'.
"\n";
 
  785         print 
'<td class="heure"></td>'.
"\n";
 
  789     if ($user->rights->opensurvey->write) {
 
  790       print 
'<td class="heure"><a href="'.$_SERVER[
"PHP_SELF"].
'?ajoutsujet=1&id='.$object->id_sondage.
'">'.$langs->trans(
"Add").
'</a></td>'.
"\n";
 
  798   print 
'<td></td>'.
"\n";
 
  799   print 
'<td></td>'.
"\n";
 
  801   for ($i = 0; isset($toutsujet[$i]); $i++) {
 
  802     $tmp = explode(
'@', $toutsujet[$i]);
 
  803     print 
'<td class="sujet">'.dol_htmlentities($tmp[0]).
'</td>'.
"\n";
 
  806   print 
'<td class="sujet"><a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$numsondage.
'&ajoutsujet=1&backtopage='.urlencode($_SERVER[
"PHP_SELF"]).
'"><span class="fa fa-plus-circle valignmiddle btnTitle-icon"></span></a></td>'.
"\n";
 
  813 $sumagainst = array();
 
  815 $sql = 
"SELECT id_users, nom as name, id_sondage, reponses";
 
  816 $sql .= 
" FROM ".MAIN_DB_PREFIX.
"opensurvey_user_studs";
 
  817 $sql .= 
" WHERE id_sondage = '".$db->escape($numsondage).
"'";
 
  819 $resql = $db->query($sql);
 
  824 $num = $db->num_rows(
$resql);
 
  825 while ($compteur < $num) {
 
  826   $obj = $db->fetch_object(
$resql);
 
  828   $ensemblereponses = $obj->reponses;
 
  830   print 
'<tr><td>'.
"\n";
 
  832   if ($user->rights->opensurvey->write) {
 
  833     print 
'<input type="image" class="reposition" name="effaceligne'.$compteur.
'" src="'.
img_picto(
'', 
'delete.png', 
'', 
false, 1).
'">'.
"\n";
 
  837   print 
'</td><td class="nom">'.dol_htmlentities($obj->name).
'</td>'.
"\n";
 
  840   if (!$testligneamodifier) {
 
  841     for ($i = 0; $i < $nbcolonnes; $i++) {
 
  842       $car = substr($ensemblereponses, $i, 1);
 
  845       if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno', 
'foragainst'))) {
 
  846         if (((
string) $car) == 
"1") {
 
  847           print 
'<td class="ok">OK</td>'.
"\n";
 
  849           print 
'<td class="non">KO</td>'.
"\n";
 
  852         if (!isset($sumfor[$i])) {
 
  855         if (((
string) $car) == 
"1") {
 
  859       if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] == 
'yesno') {
 
  860         if (((
string) $car) == 
"1") {
 
  861           print 
'<td class="ok">'.$langs->trans(
"Yes").
'</td>'.
"\n";
 
  862         } elseif (((
string) $car) == 
"0") {
 
  863           print 
'<td class="non">'.$langs->trans(
"No").
'</td>'.
"\n";
 
  865           print 
'<td class="vide"> </td>'.
"\n";
 
  868         if (!isset($sumfor[$i])) {
 
  871         if (!isset($sumagainst[$i])) {
 
  874         if (((
string) $car) == 
"1") {
 
  877         if (((
string) $car) == 
"0") {
 
  881       if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] == 
'foragainst') {
 
  882         if (((
string) $car) == 
"1") {
 
  883           print 
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
 
  884         } elseif (((
string) $car) == 
"0") {
 
  885           print 
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
 
  887           print 
'<td class="vide"> </td>'.
"\n";
 
  890         if (!isset($sumfor[$i])) {
 
  893         if (!isset($sumagainst[$i])) {
 
  896         if (((
string) $car) == 
"1") {
 
  899         if (((
string) $car) == 
"0") {
 
  906     if ($compteur == $ligneamodifier) {
 
  907       for ($i = 0; $i < $nbcolonnes; $i++) {
 
  908         $car = substr($ensemblereponses, $i, 1);
 
  909         print 
'<td class="vide">';
 
  910         if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno', 
'foragainst'))) {
 
  911           print 
'<input type="checkbox" name="choix'.$i.
'" value="1" ';
 
  917         if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] == 
'yesno') {
 
  918           $arraychoice = array(
'2'=>
' ', 
'0'=>$langs->trans(
"No"), 
'1'=>$langs->trans(
"Yes"));
 
  919           print 
$form->selectarray(
"choix".$i, $arraychoice, $car);
 
  921         if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] == 
'foragainst') {
 
  922           $arraychoice = array(
'2'=>
' ', 
'0'=>$langs->trans(
"Against"), 
'1'=>$langs->trans(
"For"));
 
  923           print 
$form->selectarray(
"choix".$i, $arraychoice, $car);
 
  928       for ($i = 0; $i < $nbcolonnes; $i++) {
 
  929         $car = substr($ensemblereponses, $i, 1);
 
  930         if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno', 
'foragainst'))) {
 
  931           if (((
string) $car) == 
"1") {
 
  932             print 
'<td class="ok">OK</td>'.
"\n";
 
  934             print 
'<td class="non">KO</td>'.
"\n";
 
  937           if (!isset($sumfor[$i])) {
 
  940           if (((
string) $car) == 
"1") {
 
  944         if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] == 
'yesno') {
 
  945           if (((
string) $car) == 
"1") {
 
  946             print 
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
 
  947           } elseif (((
string) $car) == 
"0") {
 
  948             print 
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
 
  950             print 
'<td class="vide"> </td>'.
"\n";
 
  953           if (!isset($sumfor[$i])) {
 
  956           if (!isset($sumagainst[$i])) {
 
  959           if (((
string) $car) == 
"1") {
 
  962           if (((
string) $car) == 
"0") {
 
  966         if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] == 
'foragainst') {
 
  967           if (((
string) $car) == 
"1") {
 
  968             print 
'<td class="ok">'.$langs->trans(
"For").
'</td>'.
"\n";
 
  969           } elseif (((
string) $car) == 
"0") {
 
  970             print 
'<td class="non">'.$langs->trans(
"Against").
'</td>'.
"\n";
 
  972             print 
'<td class="vide"> </td>'.
"\n";
 
  975           if (!isset($sumfor[$i])) {
 
  978           if (!isset($sumagainst[$i])) {
 
  981           if (((
string) $car) == 
"1") {
 
  984           if (((
string) $car) == 
"0") {
 
  993   if ($compteur != $ligneamodifier && ($user->rights->opensurvey->write)) {
 
  994     print 
'<td class="casevide"><input type="submit" class="button reposition" name="modifierligne'.$compteur.
'" value="'.
dol_escape_htmltag($langs->trans(
"Edit")).
'"></td>'.
"\n";
 
  998   for ($i = 0; $i < $nblines; $i++) {
 
 1000       if ($compteur == $i) {
 
 1001         print 
'<td class="casevide">';
 
 1002         print 
'<input type="hidden" name="idtomodify'.$compteur.
'" value="'.$obj->id_users.
'">';
 
 1003         print 
'<input type="submit" class="button button-save reposition" name="validermodifier'.$compteur.
'" value="'.
dol_escape_htmltag($langs->trans(
"Save")).
'">';
 
 1014 if (empty($testligneamodifier)) {
 
 1016   print 
'<td></td>'.
"\n";
 
 1017   print 
'<td class="nom">'.
"\n";
 
 1018   print 
'<input type="text" class="maxwidthonsmartphone" placeholder="'.dol_escape_htmltag($langs->trans(
"Name")).
'" name="nom" maxlength="64">'.
"\n";
 
 1021   for ($i = 0; $i < $nbcolonnes; $i++) {
 
 1022     print 
'<td class="vide">';
 
 1023     if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno', 
'foragainst'))) {
 
 1024       print 
'<input type="checkbox" name="choix'.$i.
'" value="1"';
 
 1030     if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] == 
'yesno') {
 
 1031       $arraychoice = array(
'2'=>
' ', 
'0'=>$langs->trans(
"No"), 
'1'=>$langs->trans(
"Yes"));
 
 1032       print 
$form->selectarray(
"choix".$i, $arraychoice);
 
 1034     if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] == 
'foragainst') {
 
 1035       $arraychoice = array(
'2'=>
' ', 
'0'=>$langs->trans(
"Against"), 
'1'=>$langs->trans(
"For"));
 
 1036       print 
$form->selectarray(
"choix".$i, $arraychoice);
 
 1042   print 
'<td><input type="image" name="boutonp" class="borderimp" value="'.$langs->trans(
"Vote").
'" src="'.
img_picto(
'', 
'edit_add', 
'', 
false, 1).
'"></td>'.
"\n";
 
 1048 for ($i = 0; $i < $nbcolonnes + 1; $i++) {
 
 1049   if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno', 
'foragainst'))) {
 
 1052   if (isset($sumfor[$i])) {
 
 1054       $meilleurecolonne = $sumfor[$i];
 
 1056     if (isset($sumfor[$i]) && $sumfor[$i] > $meilleurecolonne) {
 
 1057       $meilleurecolonne = $sumfor[$i];
 
 1065 print 
'<td></td>'.
"\n";
 
 1066 print 
'<td class="center">'.$langs->trans(
"Total").
'</td>'.
"\n";
 
 1067 for ($i = 0; $i < $nbcolonnes; $i++) {
 
 1068   $showsumfor = isset($sumfor[$i]) ? $sumfor[$i] : 
'';
 
 1069   $showsumagainst = isset($sumagainst[$i]) ? $sumagainst[$i] : 
'';
 
 1070   if (empty($showsumfor)) {
 
 1073   if (empty($showsumagainst)) {
 
 1074     $showsumagainst = 0;
 
 1078   if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno', 
'foragainst'))) {
 
 1081   if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] == 
'yesno') {
 
 1082     print $langs->trans(
"Yes").
': '.$showsumfor.
'<br>'.$langs->trans(
"No").
': '.$showsumagainst;
 
 1084   if (!empty($listofanswers[$i][
'format']) && $listofanswers[$i][
'format'] == 
'foragainst') {
 
 1085     print $langs->trans(
"For").
': '.$showsumfor.
'<br>'.$langs->trans(
"Against").
': '.$showsumagainst;
 
 1091 if ($nbofcheckbox >= 2) {
 
 1093   print 
'<td></td>'.
"\n";
 
 1094   print 
'<td></td>'.
"\n";
 
 1095   for ($i = 0; $i < $nbcolonnes; $i++) {
 
 1096     if (empty($listofanswers[$i][
'format']) || !in_array($listofanswers[$i][
'format'], array(
'yesno', 
'foragainst')) && isset($sumfor[$i]) && isset($meilleurecolonne) && $sumfor[$i] == $meilleurecolonne) {
 
 1097       print 
'<td class="somme"><img src="'.dol_buildpath(
'/opensurvey/img/medaille.png', 1).
'"></td>'.
"\n";
 
 1099       print 
'<td class="somme"></td>'.
"\n";
 
 1107   setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Name")), 
null, 
'errors');
 
 1110 if (isset($erreur_prenom) && $erreur_prenom) {
 
 1114 if (isset($erreur_ajout_date) && $erreur_ajout_date) {
 
 1119 print 
'</table>'.
"\n";
 
 1120 print 
'</div>'.
"\n";
 
 1123 $toutsujet = explode(
",", $object->sujet); 
 
 1126 $meilleursujet = 
'';
 
 1127 for ($i = 0; $i < $nbcolonnes; $i++) {
 
 1128   if (isset($sumfor[$i]) === 
true && isset($meilleurecolonne) === 
true && $sumfor[$i] == $meilleurecolonne) {
 
 1129     $meilleursujet .= ($meilleursujet ? 
", " : 
"");
 
 1131     if ($object->format == 
"D") {
 
 1132       $meilleursujetexport = $toutsujet[$i];
 
 1134       if (strpos($toutsujet[$i], 
'@') !== 
false) {
 
 1135         $toutsujetdate = explode(
"@", $toutsujet[$i]);
 
 1136         $meilleursujet .= 
dol_print_date($toutsujetdate[0], 
'daytext').($toutsujetdate[0] ? 
' ('.dol_print_date($toutsujetdate[0], 
'%A').
')' : 
'').
' - '.$toutsujetdate[1];
 
 1138         $meilleursujet .= 
dol_print_date((empty($toutsujet[$i]) ? 0 : $toutsujet[$i]), 
'daytext').
' ('.
dol_print_date((empty($toutsujet[$i]) ? 0 : $toutsujet[$i]), 
'%A').
')';
 
 1141       $tmps = explode(
'@', $toutsujet[$i]);
 
 1148 $meilleursujet = substr($meilleursujet, 1);
 
 1149 $meilleursujet = str_replace(
"°", 
"'", $meilleursujet);
 
 1152 if ($nbofcheckbox >= 2) {
 
 1153   $vote_str = $langs->trans(
'votes');
 
 1154   print 
'<p class="affichageresultats">'.
"\n";
 
 1156   if (isset($meilleurecolonne) && $compteursujet == 
"1") {
 
 1157     print 
"<img src=\"".DOL_URL_ROOT.
'/opensurvey/img/medaille.png'.
"\"> ".$langs->trans(
'TheBestChoice').
": <b>".$meilleursujet.
" </b>".$langs->trans(
"with").
" <b>".$meilleurecolonne.
"</b> ".$vote_str.
".\n";
 
 1158   } elseif (isset($meilleurecolonne)) {
 
 1159     print 
"<img src=\"".DOL_URL_ROOT.
'/opensurvey/img/medaille.png'.
"\"> ".$langs->trans(
'TheBestChoices').
": <b>".$meilleursujet.
" </b>".$langs->trans(
"with").
" <b>".$meilleurecolonne.
"</b> ".$vote_str.
".\n";
 
 1161   print 
'<br></p><br>'.
"\n";
 
 1164 print 
'</form>'.
"\n";
 
 1166 print 
'<a name="bas"></a>'.
"\n";
 
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
 
Class to manage a WYSIWYG editor.
 
Put here description of your class.
 
const STATUS_VALIDATED
Validated/Opened status.
 
Class to manage Dolibarr users.
 
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
 
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
 
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
 
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
 
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
 
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
 
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
 
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
 
dol_get_fiche_end($notab=0)
Return tab footer of a card.
 
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
 
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
 
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_print_email($email, $cid=0, $socid=0, $addlink=0, $max=64, $showinvalid=1, $withpicto=0)
Show EMail link formatted for HTML output.
 
dol_now($mode='auto')
Return date for now.
 
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
 
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
 
dol_htmlentities($string, $flags=ENT_QUOTES|ENT_SUBSTITUTE, $encoding='UTF-8', $double_encode=false)
Replace htmlentities functions.
 
dol_textishtml($msg, $option=0)
Return if a text is a html content.
 
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
 
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
 
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
 
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
 
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
 
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.