Go to the documentation of this file.
25 require
'../../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
27 require_once DOL_DOCUMENT_ROOT.
"/core/lib/files.lib.php";
28 require_once DOL_DOCUMENT_ROOT.
"/opensurvey/lib/opensurvey.lib.php";
31 if (!$user->rights->opensurvey->write) {
41 $arrayofchoices =
GETPOST(
'choix',
'array');
42 $arrayoftypecolumn =
GETPOST(
'typecolonne',
'array');
45 if (isset($_SESSION[
"nbrecases"])) {
46 for ($i = 0; $i < $_SESSION[
"nbrecases"]; $i++) {
47 if (isset($arrayofchoices[$i])) {
48 $_SESSION[
"choix".$i] = $arrayofchoices[$i];
50 if (isset($arrayoftypecolumn[$i])) {
51 $_SESSION[
"typecolonne".$i] = $arrayoftypecolumn[$i];
55 $_SESSION[
"nbrecases"] = 5;
59 $_SESSION[
"nbrecases"] = $_SESSION[
"nbrecases"] + 5;
66 for ($i = 0; $i < $_SESSION[
"nbrecases"] + 1; $i++) {
67 if (!empty($arrayofchoices[$i])) {
69 $toutchoix .= str_replace(array(
",",
"@"),
" ", $arrayofchoices[$i]).(empty($arrayoftypecolumn[$i]) ?
'' :
'@'.$arrayoftypecolumn[$i]);
73 $toutchoix = substr(
"$toutchoix", 1);
74 $_SESSION[
"toutchoix"] = $toutchoix;
77 $testremplissage =
'';
78 for ($i = 0; $i < $_SESSION[
"nbrecases"]; $i++) {
79 if (isset($arrayofchoices[$i])) {
80 $testremplissage =
"ok";
85 if ($testremplissage !=
"ok" || (!$toutchoix)) {
89 $_SESSION[
"formatsondage"] =
"A";
102 $arrayofjs = array();
103 $arrayofcss = array(
'/opensurvey/css/style.css');
104 llxHeader(
'', $langs->trans(
"OpenSurvey"),
"",
'', 0, 0, $arrayofjs, $arrayofcss);
106 if (empty($_SESSION[
'title'])) {
116 print
'<form name="formulaire" action="#bas" method="POST">'.
"\n";
117 print
'<input type="hidden" name="token" value="'.newToken().
'">';
122 print
'<br>'.$langs->trans(
"PollOnChoice").
'<br><br>'.
"\n";
124 print
'<div class=corps>'.
"\n";
125 print
'<table>'.
"\n";
128 for ($i = 0; $i < $_SESSION[
"nbrecases"]; $i++) {
130 if (isset($_SESSION[
"choix$i"]) ===
false) {
131 $_SESSION[
"choix$i"] =
'';
133 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.
'">';
134 $tmparray = array(
'checkbox'=>$langs->trans(
"CheckBox"),
'yesno'=>$langs->trans(
"YesNoList"),
'foragainst'=>$langs->trans(
"PourContreList"));
135 print
' '.$langs->trans(
"Type").
' '.
$form->selectarray(
"typecolonne[]", $tmparray, $_SESSION[
"typecolonne$i"]);
136 print
'</td></tr>'.
"\n";
139 print
'</table>'.
"\n";
142 print
'<table><tr>'.
"\n";
143 print
'<td>'.$langs->trans(
"5MoreChoices").
'</td><td><input type="image" name="ajoutcases" src="../img/add-16.png"></td>'.
"\n";
144 print
'</tr></table>'.
"\n";
147 print
'<table><tr>'.
"\n";
148 print
'<td></td><td><input type="submit" class="button" name="confirmecreation" value="'.dol_escape_htmltag($langs->trans(
"CreatePoll")).
'"></td>'.
"\n";
149 print
'</tr></table>'.
"\n";
152 print
'</form>'.
"\n";
155 print
'<a name=bas></a>'.
"\n";
156 print
'<br><br><br>'.
"\n";
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.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.