Go to the documentation of this file.
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.
"/core/class/doleditor.class.php";
31 require_once DOL_DOCUMENT_ROOT.
"/opensurvey/lib/opensurvey.lib.php";
34 if (!$user->rights->opensurvey->write) {
38 $langs->load(
"opensurvey");
41 $description =
GETPOST(
'description',
'restricthtml');
42 $mailsonde =
GETPOST(
'mailsonde');
43 $creation_sondage_date =
GETPOST(
'creation_sondage_date');
44 $creation_sondage_autre =
GETPOST(
'creation_sondage_autre');
47 $session_var = array(
'title',
'description',
'mailsonde');
48 foreach ($session_var as $var) {
49 if (isset($_SESSION[$var])) {
50 $_SESSION[$var] =
null;
59 if (!empty($creation_sondage_date) || !empty($creation_sondage_autre)) {
60 $_SESSION[
"title"] = $title;
61 $_SESSION[
"description"] = $description;
63 if (
GETPOST(
'mailsonde') ==
'on') {
64 $_SESSION[
"mailsonde"] =
true;
66 $_SESSION[
"mailsonde"] =
false;
69 if (
GETPOST(
'allow_comments') ==
'on') {
70 $_SESSION[
'allow_comments'] =
true;
72 $_SESSION[
'allow_comments'] =
false;
75 if (
GETPOST(
'allow_spy') ==
'on') {
76 $_SESSION[
'allow_spy'] =
true;
78 $_SESSION[
'allow_spy'] =
false;
84 if ($champdatefin && ($champdatefin > 0)) {
86 if ($champdatefin >=
dol_now()) {
88 $_SESSION[
'champdatefin'] =
dol_print_date($champdatefin,
'dayrfc');
91 $_SESSION[
'champdatefin'] =
dol_print_date($champdatefin,
'dayrfc');
99 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
"ExpireDate")),
null,
'errors');
102 if ($title && $testdate) {
103 if (!empty($creation_sondage_date)) {
104 header(
"Location: choix_date.php");
108 if (!empty($creation_sondage_autre)) {
109 header(
"Location: choix_autre.php");
124 $arrayofjs = array();
125 $arrayofcss = array(
'/opensurvey/css/style.css');
126 llxHeader(
'', $langs->trans(
"OpenSurvey"),
'',
"", 0, 0, $arrayofjs, $arrayofcss);
131 print
'<form name="formulaire" action="" method="POST">'.
"\n";
132 print
'<input type="hidden" name="token" value="'.newToken().
'">';
137 print
'<table class="border centpercent">'.
"\n";
139 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"PollTitle").
'</td><td><input type="text" name="title" class="minwidth300" maxlength="80" value="'.$_SESSION[
"title"].
'"></td>'.
"\n";
140 if (!$_SESSION[
"title"] && (
GETPOST(
'creation_sondage_date') ||
GETPOST(
'creation_sondage_autre'))) {
141 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"PollTitle")),
null,
'errors');
145 print
'<tr><td>'.$langs->trans(
"Description").
'</td><td>';
146 $doleditor =
new DolEditor(
'description', $_SESSION[
"description"],
'', 120,
'dolibarr_notes',
'In', 1, 1, 1, ROWS_7,
'90%');
147 $doleditor->Create(0,
'');
151 print
'<tr><td class="fieldrequired">'.$langs->trans(
"ExpireDate").
'</td><td>';
153 print
$form->selectDate($champdatefin ? $champdatefin : -1,
'champdatefin',
'',
'',
'',
"add", 1, 0);
156 print
'</table>'.
"\n";
161 print
'<script type="text/javascript">'.
"\n";
162 print
'document.formulaire.title.focus();'.
"\n";
163 print
'</script>'.
"\n";
169 if ($_SESSION[
"mailsonde"]) {
170 $cochemail =
"checked";
173 print
'<input type="checkbox" id="mailsonde" name="mailsonde" '.$cochemail.
'> <label for="mailsonde">'.$langs->trans(
"ToReceiveEMailForEachVote").
'</label><br>'.
"\n";
175 if ($_SESSION[
'allow_comments']) {
176 $allow_comments =
'checked';
179 $allow_comments =
GETPOST(
'allow_comments') ?
'checked' :
'';
181 print
'<input type="checkbox" id="allow_comments" name="allow_comments" '.$allow_comments.
'"> <label for="allow_comments">'.$langs->trans(
'CanComment').
'</label><br>'.
"\n";
183 if ($_SESSION[
'allow_spy']) {
184 $allow_spy =
'checked';
187 $allow_spy =
GETPOST(
'allow_spy') ?
'checked' :
'';
189 print
'<input type="checkbox" id="allow_spy" name="allow_spy" '.$allow_spy.
'> <label for="allow_spy">'.$langs->trans(
'CanSeeOthersVote').
'</label><br>'.
"\n";
191 if (
GETPOST(
'choix_sondage')) {
192 if (
GETPOST(
'choix_sondage') ==
'date') {
193 print
'<input type="hidden" name="creation_sondage_date" value="date">';
195 print
'<input type="hidden" name="creation_sondage_autre" value="autre">';
197 print
'<input type="hidden" name="choix_sondage" value="'.GETPOST(
'choix_sondage').
'">';
198 print
'<br><input type="submit" class="button" name="submit" value="'.$langs->trans(
"CreatePoll").
' ('.(
GETPOST(
'choix_sondage') ==
'date' ? $langs->trans(
"TypeDate") : $langs->trans(
"TypeClassic")).
')">';
201 print
'<br><table>'.
"\n";
202 print
'<tr><td>'.$langs->trans(
"CreateSurveyDate").
'</td><td></td> '.
"\n";
203 print
'<td><input type="image" name="creation_sondage_date" value="'.$langs->trans(
'CreateSurveyDate').
'" src="../img/calendar-32.png"></td></tr>'.
"\n";
204 print
'<tr><td>'.$langs->trans(
"CreateSurveyStandard").
'</td><td></td> '.
"\n";
205 print
'<td><input type="image" name="creation_sondage_autre" value="'.$langs->trans(
'CreateSurveyStandard').
'" src="../img/chart-32.png"></td></tr>'.
"\n";
206 print
'</table>'.
"\n";
208 print
'<br><br><br>'.
"\n";
209 print
'</form>'.
"\n";
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.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
dol_now($mode='auto')
Return date for now.
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 ...
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...
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage a WYSIWYG editor.