27 require_once DOL_DOCUMENT_ROOT.
'/core/class/comment.class.php';
29 $varpage = empty($contextpage) ?
$_SERVER[
"PHP_SELF"] : $contextpage;
36 if ($action ==
'addcomment')
38 $description =
GETPOST(
'comment_description',
'restricthtml');
39 if (!empty($description))
41 $comment->description = $description;
42 $comment->datec = time();
43 $comment->fk_element =
GETPOST(
'id',
'int');
44 $comment->element_type =
GETPOST(
'comment_element_type',
'alpha');
45 $comment->fk_user_author = $user->id;
46 $comment->entity = $conf->entity;
47 if ($comment->create($user) > 0)
50 header(
'Location: '.$varpage.
'?id='.$id.($withproject ?
'&withproject=1' :
''));
58 if ($action ===
'updatecomment')
60 if ($comment->fetch($idcomment) >= 0)
62 $comment->description =
GETPOST(
'comment_description',
'restricthtml');
63 if ($comment->update($user) > 0)
66 header(
'Location: '.$varpage.
'?id='.$id.($withproject ?
'&withproject=1#comment' :
''));
74 if ($action ==
'deletecomment')
76 if ($comment->fetch($idcomment) >= 0)
78 if ($comment->delete($user) > 0)
81 header(
'Location: '.$varpage.
'?id='.$id.($withproject ?
'&withproject=1' :
''));
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= '')
Set event messages in dol_events session object.
print $_SERVER["PHP_SELF"]
Edit parameters.