4 if (empty($conf) || !is_object($conf))
6 print "Error, template page can't be called as URL";
11 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
12 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
16 $userstatic =
new User($db);
17 $varpage = empty($contextpage) ?
$_SERVER[
"PHP_SELF"] : $contextpage;
22 print '<div id="comment">';
23 print '<form method="POST" action="'.$varpage.
'?id='.$object->id.
'">';
24 print '<input type="hidden" name="token" value="'.newToken().
'">';
25 print '<input type="hidden" name="action" value="addcomment">';
26 print '<input type="hidden" name="id" value="'.$object->id.
'">';
27 print '<input type="hidden" name="comment_element_type" value="'.$object->element.
'">';
28 print '<input type="hidden" name="withproject" value="'.$withproject.
'">';
30 print '<table class="noborder nohover centpercent">';
32 print '<tr class="liste_titre">';
33 print '<td width="25%">'.$langs->trans(
"Comments").
'</td>';
34 print '<td width="25%"></td>';
35 print '<td width="25%"></td>';
36 print '<td width="25%"></td>';
39 if ($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', 0,
true,
true, ROWS_3,
'100%');
49 print $doleditor->Create(1);
53 print '<td class="center">';
54 print '<input type="submit" class="button" value="'.$langs->trans(
"Add").
'">';
58 print '</table></form>';
61 if (!empty($object->comments))
64 $TColors = array($user->id => array(
'bgcolor'=>
'efefef',
'color'=>
'555'));
66 foreach ($object->comments as $comment)
68 $fk_user = $comment->fk_user_author;
69 $userstatic->fetch($fk_user);
71 if (empty($TColors[$fk_user]))
74 if (!empty($userstatic->color))
76 $bgcolor = $userstatic->color;
79 $TColors[$fk_user] = array(
'bgcolor'=>$bgcolor,
'color'=>$color);
81 print '<div class="width100p" style="color:#'.$TColors[$fk_user][
'color'].
'">';
82 if ($fk_user != $user->id) {
83 print '<div class="width25p float"> </div>';
86 print '<div class="width75p float comment comment-table" style="background-color:#'.$TColors[$fk_user][
'bgcolor'].
'">';
87 print '<div class="comment-info comment-cell">';
88 if (!empty($user->photo))
92 print $langs->trans(
'User').
' : '.$userstatic->getNomUrl().
'<br/>';
96 print '<div class="comment-cell comment-right">';
97 print '<div class="comment-table width100p">';
99 if ($action ===
'editcomment' && $comment->id == $idcomment)
101 print '<form method="POST" action="'.$varpage.
'?id='.$object->id.
'">';
102 print '<input type="hidden" name="token" value="'.newToken().
'">';
103 print '<input type="hidden" name="action" value="updatecomment">';
104 print '<input type="hidden" name="id" value="'.$object->id.
'">';
105 print '<input type="hidden" name="idcomment" value="'.$idcomment.
'">';
106 print '<input type="hidden" name="withproject" value="'.$withproject.
'">';
109 print '<div class="comment-description comment-cell">';
110 if ($action ===
'editcomment' && $comment->id == $idcomment)
112 $doleditor =
new DolEditor(
'comment_description', $comment->description,
'', 80,
'dolibarr_notes',
'In', 0,
true,
true, ROWS_3,
'100%');
113 print $doleditor->Create(1);
115 print $comment->description;
119 if ($action ===
'editcomment' && $comment->id == $idcomment)
121 print '<input name="update" type="submit" class="button" value="'.$langs->trans(
"Update").
'">';
122 print '<input name="cancel" type="submit" class="button button-cancel" value="'.$langs->trans(
"Cancel").
'">';
126 if ($fk_user == $user->id || $user->admin == 1)
128 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').
'">';
132 if (($first && $fk_user == $user->id) || $user->admin == 1) {
133 print '<a class="comment-delete comment-cell" href="'.$varpage.
'?action=deletecomment&token='.
newToken().
'&id='.$id.
'&withproject=1&idcomment='.$comment->id.
'" title="'.$langs->trans(
'Delete').
'">';
143 if ($fk_user == $user->id) {
144 print '<div class="width25p float"> </div>';
146 print '<div class="clearboth"></div>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage Dolibarr users.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
randomColor($min=0, $max=255)
Return hexadecimal color randomly.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $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'.
Class to manage a WYSIWYG editor.
colorIsLight($stringcolor)
Return true if the color is light.