20@phan-var-force string $action
21@phan-var-force string $withproject
22@phan-var-force int $withproject
23@phan-var-force int $id
24@phan-var-force string $idcomment
29 print
"Error, template page can't be called as URL";
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
40$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
45print
'<div id="comment">';
46print
'<form method="POST" action="'.$varpage.
'?id='.
$object->id.
'">';
47print
'<input type="hidden" name="token" value="'.newToken().
'">';
48print
'<input type="hidden" name="action" value="addcomment">';
49print
'<input type="hidden" name="id" value="'.$object->id.
'">';
50print
'<input type="hidden" name="comment_element_type" value="'.$object->element.
'">';
51print
'<input type="hidden" name="withproject" value="'.$withproject.
'">';
53print
'<table class="noborder nohover centpercent">';
55print
'<tr class="liste_titre">';
56print
'<td width="25%">'.$langs->trans(
"Comments").
'</td>';
57print
'<td width="25%"></td>';
58print
'<td width="25%"></td>';
59print
'<td width="25%"></td>';
62if ($action !==
'editcomment') {
63 print
'<tr class="oddeven">';
66 print
'<td colspan="3">';
68 $desc =
GETPOST(
'comment_description');
70 $doleditor =
new DolEditor(
'comment_description', $desc,
'', 80,
'dolibarr_notes',
'In',
false,
true,
true, ROWS_3,
'100%');
71 print $doleditor->Create(1);
75 print
'<td class="center">';
76 print
'<input type="submit" class="button button-add" value="'.$langs->trans(
"Add").
'">';
80print
'</table></form>';
85 $TColors = array($user->id => array(
'bgcolor' =>
'efefef',
'color' =>
'555'));
87 foreach (
$object->comments as $comment) {
88 $fk_user = $comment->fk_user_author;
89 $userstatic->fetch($fk_user);
91 if (empty($TColors[$fk_user])) {
93 if (!empty($userstatic->color)) {
94 $bgcolor = $userstatic->color;
96 $color = (colorIsLight($bgcolor)) ?
'555' :
'fff';
97 $TColors[$fk_user] = array(
'bgcolor' => $bgcolor,
'color' => $color);
99 print
'<div class="width100p" style="color:#'.$TColors[$fk_user][
'color'].
'">';
100 if ($fk_user != $user->id) {
101 print
'<div class="width25p float"> </div>';
104 print
'<div class="width75p float comment comment-table" style="background-color:#'.$TColors[$fk_user][
'bgcolor'].
'">';
105 print
'<div class="comment-info comment-cell">';
106 if (!empty($user->photo)) {
107 print
Form::showphoto(
'userphoto', $userstatic, 80, 0, 0,
'',
'small', 0, 1).
'<br>';
109 print $langs->trans(
'User').
' : '.$userstatic->getNomUrl().
'<br>';
110 print $langs->trans(
'Date').
' : '.
dol_print_date($comment->datec,
'dayhoursec');
113 print
'<div class="comment-cell comment-right">';
114 print
'<div class="comment-table width100p">';
116 if ($action ===
'editcomment' && $comment->id == $idcomment) {
117 print
'<form method="POST" action="'.$varpage.
'?id='.
$object->id.
'">';
118 print
'<input type="hidden" name="token" value="'.newToken().
'">';
119 print
'<input type="hidden" name="action" value="updatecomment">';
120 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
121 print
'<input type="hidden" name="idcomment" value="'.$idcomment.
'">';
122 print
'<input type="hidden" name="withproject" value="'.$withproject.
'">';
125 print
'<div class="comment-description comment-cell">';
126 if ($action ===
'editcomment' && $comment->id == $idcomment) {
127 $doleditor =
new DolEditor(
'comment_description', $comment->description,
'', 80,
'dolibarr_notes',
'In',
false,
true,
true, ROWS_3,
'100%');
128 print $doleditor->Create(1);
130 print $comment->description;
134 if ($action ===
'editcomment' && $comment->id == $idcomment) {
135 print
'<input name="update" type="submit" class="button" value="'.$langs->trans(
"Update").
'">';
136 print
'<input name="cancel" type="submit" class="button button-cancel" value="'.$langs->trans(
"Cancel").
'">';
140 if ($fk_user == $user->id || $user->admin == 1) {
141 print
'<a class="comment-edit comment-cell" href="'.$varpage.
'?action=editcomment&token='.newToken().
'&id='.
$id.
'&withproject=1&idcomment='.$comment->id.
'#comment" title="'.$langs->trans(
'Edit').
'">';
145 if (($first && $fk_user == $user->id) || $user->admin == 1) {
146 print
'<a class="comment-delete comment-cell" href="'.$varpage.
'?action=deletecomment&token='.newToken().
'&id='.
$id.
'&withproject=1&idcomment='.$comment->id.
'" title="'.$langs->trans(
'Delete').
'">';
156 if ($fk_user == $user->id) {
157 print
'<div class="width25p float"> </div>';
159 print
'<div class="clearboth"></div>';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
Class to manage a WYSIWYG editor.
Class to manage Dolibarr users.
randomColor($min=0, $max=255)
Return hexadecimal color randomly.
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)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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).