27require_once DOL_DOCUMENT_ROOT.
'/core/class/comment.class.php';
29$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
36if ($action ==
'addcomment') {
37 $description =
GETPOST(
'comment_description',
'restricthtml');
38 if (!empty($description)) {
39 $comment->description = $description;
42 $comment->element_type =
GETPOST(
'comment_element_type',
'alpha');
43 $comment->fk_user_author = $user->id;
44 $comment->entity = $conf->entity;
45 if ($comment->create($user) > 0) {
47 header(
'Location: '.$varpage.
'?id='.$id.($withproject ?
'&withproject=1' :
''));
55if ($action ===
'updatecomment') {
56 if ($comment->fetch($idcomment) >= 0) {
57 $comment->description =
GETPOST(
'comment_description',
'restricthtml');
58 if ($comment->update($user) > 0) {
60 header(
'Location: '.$varpage.
'?id='.$id.($withproject ?
'&withproject=1#comment' :
''));
68if ($action ==
'deletecomment') {
69 if ($comment->fetch($idcomment) >= 0) {
70 if ($comment->delete($user) > 0) {
72 header(
'Location: '.$varpage.
'?id='.$id.($withproject ?
'&withproject=1' :
''));
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_now($mode='auto')
Return date for now.
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.