4if (empty($conf) || !is_object($conf)) {
5 print
"Error, template page can't be called as URL";
10require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
11require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
15$userstatic =
new User($db);
16$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
21print
'<div id="comment">';
22print
'<form method="POST" action="'.$varpage.
'?id='.
$object->id.
'">';
23print
'<input type="hidden" name="token" value="'.newToken().
'">';
24print
'<input type="hidden" name="action" value="addcomment">';
25print
'<input type="hidden" name="id" value="'.$object->id.
'">';
26print
'<input type="hidden" name="comment_element_type" value="'.$object->element.
'">';
27print
'<input type="hidden" name="withproject" value="'.$withproject.
'">';
29print
'<table class="noborder nohover centpercent">';
31print
'<tr class="liste_titre">';
32print
'<td width="25%">'.$langs->trans(
"Comments").
'</td>';
33print
'<td width="25%"></td>';
34print
'<td width="25%"></td>';
35print
'<td width="25%"></td>';
38if ($action !==
'editcomment') {
39 print
'<tr class="oddeven">';
42 print
'<td colspan="3">';
44 $desc =
GETPOST(
'comment_description');
46 $doleditor =
new DolEditor(
'comment_description', $desc,
'', 80,
'dolibarr_notes',
'In', 0,
true,
true, ROWS_3,
'100%');
47 print $doleditor->Create(1);
51 print
'<td class="center">';
52 print
'<input type="submit" class="button button-add" value="'.$langs->trans(
"Add").
'">';
56print
'</table></form>';
61 $TColors = array($user->id => array(
'bgcolor'=>
'efefef',
'color'=>
'555'));
63 foreach (
$object->comments as $comment) {
64 $fk_user = $comment->fk_user_author;
65 $userstatic->fetch($fk_user);
67 if (empty($TColors[$fk_user])) {
69 if (!empty($userstatic->color)) {
70 $bgcolor = $userstatic->color;
73 $TColors[$fk_user] = array(
'bgcolor'=>$bgcolor,
'color'=>$color);
75 print
'<div class="width100p" style="color:#'.$TColors[$fk_user][
'color'].
'">';
76 if ($fk_user != $user->id) {
77 print
'<div class="width25p float"> </div>';
80 print
'<div class="width75p float comment comment-table" style="background-color:#'.$TColors[$fk_user][
'bgcolor'].
'">';
81 print
'<div class="comment-info comment-cell">';
82 if (!empty($user->photo)) {
83 print
Form::showphoto(
'userphoto', $userstatic, 80, 0, 0,
'',
'small', 0, 1).
'<br>';
85 print $langs->trans(
'User').
' : '.$userstatic->getNomUrl().
'<br>';
86 print $langs->trans(
'Date').
' : '.
dol_print_date($comment->datec,
'dayhoursec');
89 print
'<div class="comment-cell comment-right">';
90 print
'<div class="comment-table width100p">';
92 if ($action ===
'editcomment' && $comment->id == $idcomment) {
93 print
'<form method="POST" action="'.$varpage.
'?id='.
$object->id.
'">';
94 print
'<input type="hidden" name="token" value="'.newToken().
'">';
95 print
'<input type="hidden" name="action" value="updatecomment">';
96 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
97 print
'<input type="hidden" name="idcomment" value="'.$idcomment.
'">';
98 print
'<input type="hidden" name="withproject" value="'.$withproject.
'">';
101 print
'<div class="comment-description comment-cell">';
102 if ($action ===
'editcomment' && $comment->id == $idcomment) {
103 $doleditor =
new DolEditor(
'comment_description', $comment->description,
'', 80,
'dolibarr_notes',
'In', 0,
true,
true, ROWS_3,
'100%');
104 print $doleditor->Create(1);
106 print $comment->description;
110 if ($action ===
'editcomment' && $comment->id == $idcomment) {
111 print
'<input name="update" type="submit" class="button" value="'.$langs->trans(
"Update").
'">';
112 print
'<input name="cancel" type="submit" class="button button-cancel" value="'.$langs->trans(
"Cancel").
'">';
116 if ($fk_user == $user->id || $user->admin == 1) {
117 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').
'">';
121 if (($first && $fk_user == $user->id) || $user->admin == 1) {
122 print
'<a class="comment-delete comment-cell" href="'.$varpage.
'?action=deletecomment&token='.
newToken().
'&id='.$id.
'&withproject=1&idcomment='.$comment->id.
'" title="'.$langs->trans(
'Delete').
'">';
132 if ($fk_user == $user->id) {
133 print
'<div class="width25p float"> </div>';
135 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.