6if (empty($conf) || !is_object($conf)) {
7 print
"Error, template page can't be called as URL";
12require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
13require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
17$userstatic =
new User($db);
18$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
23print
'<div id="comment">';
24print
'<form method="POST" action="'.$varpage.
'?id='.
$object->id.
'">';
25print
'<input type="hidden" name="token" value="'.newToken().
'">';
26print
'<input type="hidden" name="action" value="addcomment">';
27print
'<input type="hidden" name="id" value="'.$object->id.
'">';
28print
'<input type="hidden" name="comment_element_type" value="'.$object->element.
'">';
29print
'<input type="hidden" name="withproject" value="'.$withproject.
'">';
31print
'<table class="noborder nohover centpercent">';
33print
'<tr class="liste_titre">';
34print
'<td width="25%">'.$langs->trans(
"Comments").
'</td>';
35print
'<td width="25%"></td>';
36print
'<td width="25%"></td>';
37print
'<td width="25%"></td>';
40if ($action !==
'editcomment') {
41 print
'<tr class="oddeven">';
44 print
'<td colspan="3">';
46 $desc =
GETPOST(
'comment_description');
48 $doleditor =
new DolEditor(
'comment_description', $desc,
'', 80,
'dolibarr_notes',
'In',
false,
true,
true, ROWS_3,
'100%');
49 print $doleditor->Create(1);
53 print
'<td class="center">';
54 print
'<input type="submit" class="button button-add" value="'.$langs->trans(
"Add").
'">';
58print
'</table></form>';
63 $TColors = array($user->id => array(
'bgcolor'=>
'efefef',
'color'=>
'555'));
65 foreach (
$object->comments as $comment) {
66 $fk_user = $comment->fk_user_author;
67 $userstatic->fetch($fk_user);
69 if (empty($TColors[$fk_user])) {
71 if (!empty($userstatic->color)) {
72 $bgcolor = $userstatic->color;
75 $TColors[$fk_user] = array(
'bgcolor'=>$bgcolor,
'color'=>$color);
77 print
'<div class="width100p" style="color:#'.$TColors[$fk_user][
'color'].
'">';
78 if ($fk_user != $user->id) {
79 print
'<div class="width25p float"> </div>';
82 print
'<div class="width75p float comment comment-table" style="background-color:#'.$TColors[$fk_user][
'bgcolor'].
'">';
83 print
'<div class="comment-info comment-cell">';
84 if (!empty($user->photo)) {
85 print
Form::showphoto(
'userphoto', $userstatic, 80, 0, 0,
'',
'small', 0, 1).
'<br>';
87 print $langs->trans(
'User').
' : '.$userstatic->getNomUrl().
'<br>';
88 print $langs->trans(
'Date').
' : '.
dol_print_date($comment->datec,
'dayhoursec');
91 print
'<div class="comment-cell comment-right">';
92 print
'<div class="comment-table width100p">';
94 if ($action ===
'editcomment' && $comment->id == $idcomment) {
95 print
'<form method="POST" action="'.$varpage.
'?id='.
$object->id.
'">';
96 print
'<input type="hidden" name="token" value="'.newToken().
'">';
97 print
'<input type="hidden" name="action" value="updatecomment">';
98 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
99 print
'<input type="hidden" name="idcomment" value="'.$idcomment.
'">';
100 print
'<input type="hidden" name="withproject" value="'.$withproject.
'">';
103 print
'<div class="comment-description comment-cell">';
104 if ($action ===
'editcomment' && $comment->id == $idcomment) {
105 $doleditor =
new DolEditor(
'comment_description', $comment->description,
'', 80,
'dolibarr_notes',
'In',
false,
true,
true, ROWS_3,
'100%');
106 print $doleditor->Create(1);
108 print $comment->description;
112 if ($action ===
'editcomment' && $comment->id == $idcomment) {
113 print
'<input name="update" type="submit" class="button" value="'.$langs->trans(
"Update").
'">';
114 print
'<input name="cancel" type="submit" class="button button-cancel" value="'.$langs->trans(
"Cancel").
'">';
118 if ($fk_user == $user->id || $user->admin == 1) {
119 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').
'">';
123 if (($first && $fk_user == $user->id) || $user->admin == 1) {
124 print
'<a class="comment-delete comment-cell" href="'.$varpage.
'?action=deletecomment&token='.
newToken().
'&id='.
$id.
'&withproject=1&idcomment='.$comment->id.
'" title="'.$langs->trans(
'Delete').
'">';
134 if ($fk_user == $user->id) {
135 print
'<div class="width25p float"> </div>';
137 print
'<div class="clearboth"></div>';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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)
Show picto whatever it's its name (generic function)
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
colorIsLight($stringcolor)
Return true if the color is light.