26require
'../../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
28require_once DOL_DOCUMENT_ROOT.
"/core/lib/files.lib.php";
29require_once DOL_DOCUMENT_ROOT.
"/opensurvey/lib/opensurvey.lib.php";
32if (!$user->rights->opensurvey->write) {
42$arrayofchoices =
GETPOST(
'choix',
'array');
43$arrayoftypecolumn =
GETPOST(
'typecolonne',
'array');
46if (isset($_SESSION[
"nbrecases"])) {
47 for ($i = 0; $i < $_SESSION[
"nbrecases"]; $i++) {
48 if (isset($arrayofchoices[$i])) {
49 $_SESSION[
"choix".$i] = $arrayofchoices[$i];
51 if (isset($arrayoftypecolumn[$i])) {
52 $_SESSION[
"typecolonne".$i] = $arrayoftypecolumn[$i];
56 $_SESSION[
"nbrecases"] = 5;
60 $_SESSION[
"nbrecases"] = $_SESSION[
"nbrecases"] + 5;
64if (GETPOSTISSET(
"confirmecreation")) {
67 for ($i = 0; $i < $_SESSION[
"nbrecases"] + 1; $i++) {
68 if (!empty($arrayofchoices[$i])) {
70 $toutchoix .= str_replace(array(
",",
"@"),
" ", $arrayofchoices[$i]).(empty($arrayoftypecolumn[$i]) ?
'' :
'@'.$arrayoftypecolumn[$i]);
74 $toutchoix = substr(
"$toutchoix", 1);
75 $_SESSION[
"toutchoix"] = $toutchoix;
78 $testremplissage =
'';
79 for ($i = 0; $i < $_SESSION[
"nbrecases"]; $i++) {
80 if (isset($arrayofchoices[$i])) {
81 $testremplissage =
"ok";
86 if ($testremplissage !=
"ok" || (!$toutchoix)) {
90 $_SESSION[
"formatsondage"] =
"A";
101$form =
new Form($db);
104$arrayofcss = array(
'/opensurvey/css/style.css');
105llxHeader(
'', $langs->trans(
"OpenSurvey"),
"",
'', 0, 0, $arrayofjs, $arrayofcss);
107if (empty($_SESSION[
'title'])) {
117print
'<form name="formulaire" action="#bas" method="POST">'.
"\n";
118print
'<input type="hidden" name="token" value="'.newToken().
'">';
123print
'<br>'.$langs->trans(
"PollOnChoice").
'<br><br>'.
"\n";
125print
'<div class=corps>'.
"\n";
129for ($i = 0; $i < $_SESSION[
"nbrecases"]; $i++) {
131 if (isset($_SESSION[
"choix$i"]) ===
false) {
132 $_SESSION[
"choix$i"] =
'';
134 print
'<tr><td>'.$langs->trans(
"TitleChoice").
' '.$j.
': </td><td><input type="text" name="choix[]" size="40" maxlength="40" value="'.
dol_escape_htmltag($_SESSION[
"choix$i"]).
'" id="choix'.$i.
'">';
135 $tmparray = array(
'checkbox'=>$langs->trans(
"CheckBox"),
'yesno'=>$langs->trans(
"YesNoList"),
'foragainst'=>$langs->trans(
"PourContreList"));
136 print
' '.$langs->trans(
"Type").
' '.$form->selectarray(
"typecolonne[]", $tmparray, $_SESSION[
"typecolonne$i"]);
137 print
'</td></tr>'.
"\n";
140print
'</table>'.
"\n";
143print
'<table><tr>'.
"\n";
144print
'<td>'.$langs->trans(
"5MoreChoices").
'</td><td><input type="image" name="ajoutcases" src="../img/add-16.png"></td>'.
"\n";
145print
'</tr></table>'.
"\n";
148print
'<table><tr>'.
"\n";
149print
'<td></td><td><input type="submit" class="button" name="confirmecreation" value="'.dol_escape_htmltag($langs->trans(
"CreatePoll")).
'"></td>'.
"\n";
150print
'</tr></table>'.
"\n";
156print
'<a name=bas></a>'.
"\n";
157print
'<br><br><br>'.
"\n";
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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_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...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.