18 print
"Error, template page can't be called as URL";
23require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
24require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
28$userstatic =
new User($db);
29$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
34print
'<div id="comment">';
35print
'<form method="POST" action="'.$varpage.
'?id='.
$object->id.
'">';
36print
'<input type="hidden" name="token" value="'.newToken().
'">';
37print
'<input type="hidden" name="action" value="addcomment">';
38print
'<input type="hidden" name="id" value="'.$object->id.
'">';
39print
'<input type="hidden" name="comment_element_type" value="'.$object->element.
'">';
40print
'<input type="hidden" name="withproject" value="'.$withproject.
'">';
42print
'<table class="noborder nohover centpercent">';
44print
'<tr class="liste_titre">';
45print
'<td width="25%">'.$langs->trans(
"Comments").
'</td>';
46print
'<td width="25%"></td>';
47print
'<td width="25%"></td>';
48print
'<td width="25%"></td>';
51if ($action !==
'editcomment') {
52 print
'<tr class="oddeven">';
55 print
'<td colspan="3">';
57 $desc =
GETPOST(
'comment_description');
59 $doleditor =
new DolEditor(
'comment_description', $desc,
'', 80,
'dolibarr_notes',
'In',
false,
true,
true, ROWS_3,
'100%');
60 print $doleditor->Create(1);
64 print
'<td class="center">';
65 print
'<input type="submit" class="button button-add" value="'.$langs->trans(
"Add").
'">';
69print
'</table></form>';
74 $TColors = array($user->id => array(
'bgcolor'=>
'efefef',
'color'=>
'555'));
76 foreach (
$object->comments as $comment) {
77 $fk_user = $comment->fk_user_author;
78 $userstatic->fetch($fk_user);
80 if (empty($TColors[$fk_user])) {
82 if (!empty($userstatic->color)) {
83 $bgcolor = $userstatic->color;
86 $TColors[$fk_user] = array(
'bgcolor'=>$bgcolor,
'color'=>$color);
88 print
'<div class="width100p" style="color:#'.$TColors[$fk_user][
'color'].
'">';
89 if ($fk_user != $user->id) {
90 print
'<div class="width25p float"> </div>';
93 print
'<div class="width75p float comment comment-table" style="background-color:#'.$TColors[$fk_user][
'bgcolor'].
'">';
94 print
'<div class="comment-info comment-cell">';
95 if (!empty($user->photo)) {
96 print
Form::showphoto(
'userphoto', $userstatic, 80, 0, 0,
'',
'small', 0, 1).
'<br>';
98 print $langs->trans(
'User').
' : '.$userstatic->getNomUrl().
'<br>';
99 print $langs->trans(
'Date').
' : '.
dol_print_date($comment->datec,
'dayhoursec');
102 print
'<div class="comment-cell comment-right">';
103 print
'<div class="comment-table width100p">';
105 if ($action ===
'editcomment' && $comment->id == $idcomment) {
106 print
'<form method="POST" action="'.$varpage.
'?id='.
$object->id.
'">';
107 print
'<input type="hidden" name="token" value="'.newToken().
'">';
108 print
'<input type="hidden" name="action" value="updatecomment">';
109 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
110 print
'<input type="hidden" name="idcomment" value="'.$idcomment.
'">';
111 print
'<input type="hidden" name="withproject" value="'.$withproject.
'">';
114 print
'<div class="comment-description comment-cell">';
115 if ($action ===
'editcomment' && $comment->id == $idcomment) {
116 $doleditor =
new DolEditor(
'comment_description', $comment->description,
'', 80,
'dolibarr_notes',
'In',
false,
true,
true, ROWS_3,
'100%');
117 print $doleditor->Create(1);
119 print $comment->description;
123 if ($action ===
'editcomment' && $comment->id == $idcomment) {
124 print
'<input name="update" type="submit" class="button" value="'.$langs->trans(
"Update").
'">';
125 print
'<input name="cancel" type="submit" class="button button-cancel" value="'.$langs->trans(
"Cancel").
'">';
129 if ($fk_user == $user->id || $user->admin == 1) {
130 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').
'">';
134 if (($first && $fk_user == $user->id) || $user->admin == 1) {
135 print
'<a class="comment-delete comment-cell" href="'.$varpage.
'?action=deletecomment&token='.
newToken().
'&id='.
$id.
'&withproject=1&idcomment='.$comment->id.
'" title="'.$langs->trans(
'Delete').
'">';
145 if ($fk_user == $user->id) {
146 print
'<div class="width25p float"> </div>';
148 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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...