28require
'../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
"/core/class/doleditor.class.php";
39require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
40require_once DOL_DOCUMENT_ROOT.
"/core/lib/files.lib.php";
41require_once DOL_DOCUMENT_ROOT.
"/opensurvey/class/opensurveysondage.class.php";
42require_once DOL_DOCUMENT_ROOT.
"/opensurvey/lib/opensurvey.lib.php";
45if (!$user->hasRight(
'opensurvey',
'read')) {
50$action =
GETPOST(
'action',
'aZ09');
51$cancel =
GETPOST(
'cancel',
'alpha');
62$result =
$object->fetch(
'', $numsondage);
68$hookmanager->initHooks(array(
'surveycard',
'globalcard'));
72$permissiontoread = $user->hasRight(
'opensurvey',
'read');
73$permissiontoadd = $user->hasRight(
'opensurvey',
'write');
74$permissiontodelete = $user->hasRight(
'opensurvey',
'write');
81$parameters = array(
'id' => $numsondage);
82$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
93 if ($action ==
'delete_confirm' && $permissiontodelete) {
95 if (!$user->hasRight(
'opensurvey',
'write')) {
99 $result =
$object->delete($user, 0, $numsondage);
101 header(
'Location: '.
dol_buildpath(
'/opensurvey/list.php', 1));
106 if ($action ==
'close' && $permissiontoadd) {
112 if (($action ==
'reopen' || $action ==
'validate') && $permissiontoadd) {
118 if ($action ==
'update' && $permissiontoadd) {
120 if (!$user->hasRight(
'opensurvey',
'write')) {
126 if (!
GETPOST(
'nouveautitre')) {
127 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Title")),
null,
'errors');
136 $object->date_fin = $expiredate;
137 $object->allow_comments =
GETPOST(
'cancomment',
'aZ09') ==
'on' ? 1 : 0;
138 $object->allow_spy =
GETPOST(
'canseeothersvote',
'aZ09') ==
'on' ? 1 : 0;
139 $object->mailsonde =
GETPOST(
'mailsonde',
'aZ09') ==
'on' ? 1 : 0;
150 if (
GETPOST(
'ajoutcomment') && $permissiontoadd) {
153 if (!
GETPOST(
'comment',
"alphanohtml")) {
155 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Comment")),
null,
'errors');
157 if (!
GETPOST(
'commentuser',
"alphanohtml")) {
159 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"User")),
null,
'errors');
164 $comment_user = (
string)
GETPOST(
'commentuser',
"alphanohtml");
166 $resql =
$object->addComment($comment, $comment_user);
175 if ($action ==
'deletecomment' && $permissiontoadd) {
177 if ($idcomment > 0) {
179 if (!$user->hasRight(
'opensurvey',
'write')) {
183 $resql =
$object->deleteComment($idcomment);
187 if ($action ==
'edit' && $permissiontoadd) {
189 if (!$user->hasRight(
'opensurvey',
'write')) {
205 $userstatic->fetch(
$object->fk_user_creat);
208$title =
$object->title.
" - ".$langs->trans(
'Card');
211$arrayofcss = array(
'/opensurvey/css/style.css');
212llxHeader(
'', $title, $helpurl,
'', 0, 0, $arrayofjs, $arrayofcss);
216$toutsujet = explode(
",",
$object->sujet);
217$listofanswers = array();
218foreach ($toutsujet as $value) {
219 $tmp = explode(
'@', $value);
220 $listofanswers[] = array(
'label' => $tmp[0],
'format' => (!empty($tmp[1]) ? $tmp[1] :
'checkbox'));
222$toutsujet = str_replace(
"@",
"<br>", $toutsujet);
223$toutsujet = str_replace(
"°",
"'", $toutsujet);
225print
'<form name="updatesurvey" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$numsondage.
'" method="POST">'.
"\n";
226print
'<input type="hidden" name="token" value="'.newToken().
'">';
227print
'<input type="hidden" name="action" value="update">';
236$linkback =
'<a href="'.DOL_URL_ROOT.
'/opensurvey/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
238dol_banner_tab($object,
'id', $linkback, 1,
'id_sondage',
'id_sondage', $morehtmlref);
241print
'<div class="fichecenter">';
243print
'<div class="fichehalfleft">';
244print
'<div class="underbanner clearboth"></div>';
245print
'<table class="border tableforfield centpercent">';
248$type = (
$object->format ==
"A") ?
'classic' :
'date';
249print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Type").
'</td><td>';
250print
img_picto(
'',
dol_buildpath(
'/opensurvey/img/'.($type ==
'classic' ?
'chart-32.png' :
'calendar-32.png'), 1),
'width="16"', 1);
251print
' '.$langs->trans($type ==
'classic' ?
"TypeClassic" :
"TypeDate").
'</td></tr>';
255print $langs->trans(
"Title").
'</td><td>';
256if ($action ==
'edit') {
257 print
'<input class="width300" type="text" name="nouveautitre" value="'.dolPrintHTML(
$object->title).
'">';
264print
'<tr><td>'.$langs->trans(
'ToReceiveEMailForEachVote').
'</td><td>';
265if ($action ==
'edit') {
266 print
'<input type="checkbox" name="mailsonde" '.($object->mailsonde ?
'checked="checked"' :
'').
'">';
271 if (
$object->fk_user_creat &&
$object->mailsonde && $userstatic !==
null) {
272 if (!$userstatic->email) {
273 print
' '.img_warning($langs->trans(
'NoEMail'));
280print
'<tr><td>'.$langs->trans(
'CanComment').
'</td><td>';
281if ($action ==
'edit') {
282 print
'<input type="checkbox" name="cancomment" '.($object->allow_comments ?
'checked="checked"' :
'').
'">';
289print
'<tr><td>'.$langs->trans(
'CanSeeOthersVote').
'</td><td>';
290if ($action ==
'edit') {
291 print
'<input type="checkbox" name="canseeothersvote" '.($object->allow_spy ?
'checked="checked"' :
'').
'">';
298print
'<tr><td class="tdtop">'.$langs->trans(
"Description").
'</td><td class="wordbreak">';
299if ($action ==
'edit') {
300 $doleditor =
new DolEditor(
'nouveauxcommentaires',
$object->description,
'', 120,
'dolibarr_notes',
'In',
true, 1, 1, ROWS_7,
'100%');
301 $doleditor->Create(0,
'');
310print
'<div class="fichehalfright">';
311print
'<div class="underbanner clearboth"></div>';
313print
'<table class="border tableforfield centpercent">';
316print
'<tr><td>'.$langs->trans(
'ExpireDate').
'</td><td>';
317if ($action ==
'edit') {
318 print $form->selectDate($expiredate ? $expiredate :
$object->date_fin,
'expire', 0, 0, 0,
'', 1, 0);
329print $langs->trans(
"Author").
'</td><td>';
330if (
$object->fk_user_creat > 0 && $userstatic !==
null) {
331 print $userstatic->getLoginUrl(-1);
333 if ($action ==
'edit') {
334 print
'<input type="text" name="nouvelleadresse" class="minwidth200" value="'.$object->mail_admin.
'">';
342print
'<tr><td>'.$langs->trans(
"UrlForSurvey",
'').
'</td><td>';
346$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
349$url = $urlwithroot.
'/public/opensurvey/studs.php?sondage='.
$object->id_sondage;
350print
'<input type="text" class="quatrevingtpercent" '.($action ==
'edit' ?
'disabled' :
'').
' id="opensurveyurl" name="opensurveyurl" value="'.$url.
'" spellcheck="false">';
352print ajax_autoselect(
"opensurveyurl", $url,
'image');
358$parameters = array();
359$reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
360print $hookmanager->resPrint;
366print
'<div class="clearboth"></div>';
370if ($action ==
'edit') {
371 print $form->buttonsSaveCancel();
380print
'<div class="tabsAction">';
382if ($action !=
'edit' && $user->hasRight(
'opensurvey',
'write')) {
384 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.newToken().
'&id='.urlencode($numsondage).
'">'.$langs->trans(
"Modify").
'</a>';
388 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=validate&token='.newToken().
'&id='.urlencode($numsondage).
'">'.$langs->trans(
"Valid").
'</a>';
393 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=close&token='.newToken().
'&id='.urlencode($numsondage).
'">'.$langs->trans(
"Close").
'</a>';
397 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=reopen&token='.newToken().
'&id='.urlencode($numsondage).
'">'.$langs->trans(
"ReOpen").
'</a>';
401 print dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?suppressionsondage=1&id='.urlencode($numsondage).
'&action=delete&token='.newToken(),
'delete', $permissiontodelete);
406if ($action ==
'delete') {
407 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?&id='.urlencode($numsondage), $langs->trans(
"RemovePoll"), $langs->trans(
"ConfirmRemovalOfPoll", $id),
'delete_confirm',
'',
'', 1);
413print
'<form name="formulaire5" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
414print
'<input type="hidden" name="token" value="'.newToken().
'">';
415print
'<input type="hidden" name="action" value="addcomment">';
416print
'<input type="hidden" name="id" value="'.urlencode($numsondage).
'">';
417print
'<input type="hidden" name="page_y" value="">';
422$comments =
$object->getComments();
424if (!empty($comments)) {
425 foreach ($comments as $comment) {
426 if ($user->hasRight(
'opensurvey',
'write')) {
427 print
'<a class="reposition" href="'.DOL_URL_ROOT.
'/opensurvey/card.php?action=deletecomment&token='.newToken().
'&idcomment='.((int) $comment->id_comment).
'&id='.urlencode($numsondage).
'"> '.
img_picto(
'',
'delete',
'', 0, 0, 0,
'',
'', 0).
'</a> ';
433 print
'<span class="opacitymedium">'.$langs->trans(
"NoCommentYet").
'</span><br>';
440 print
'<br><textarea name="comment" rows="2" class="quatrevingtpercent" placeholder="'.$langs->trans(
"AddACommentForPoll").
'"></textarea><br>'.
"\n";
441 print $langs->trans(
"Name").
': <input type="text" class="minwidth300" name="commentuser" value="'.
dol_escape_htmltag($user->getFullName($langs)).
'"> '.
"\n";
442 print
'<input type="submit" class="button reposition smallpaddingimp" name="ajoutcomment" value="'.dol_escape_htmltag($langs->trans(
"AddComment")).
'"><br>'.
"\n";
if(! $sortfield) if(! $sortorder) $object
global $dolibarr_main_url_root
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage a WYSIWYG editor.
Put here description of your class.
const STATUS_VALIDATED
Validated/Opened status.
const STATUS_CLOSED
Closed.
const STATUS_DRAFT
Draft status (not used)
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...
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
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, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
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.
dol_htmlentities($string, $flags=ENT_QUOTES|ENT_SUBSTITUTE, $encoding='UTF-8', $double_encode=false)
Replace htmlentities functions.
dol_print_email($email, $contactid=0, $socid=0, $addlink=0, $max=0, $showinvalid=1, $withpicto=0, $morecss='paddingrightonly')
Show EMail link formatted for HTML output.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
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.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
opensurvey_prepare_head(Opensurveysondage $object)
Returns an array with the tabs for the "Opensurvey poll" section It loads tabs from modules looking f...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.