aboutsummaryrefslogtreecommitdiff
path: root/mod/tasks/views/default/tasks/page/elements/comments.php
blob: ef1737a6350d7d9444d590a2cbfe1aa536392380 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
 * List comments with optional add form
 *
 * @uses $vars['entity']        ElggEntity
 * @uses $vars['show_add_form'] Display add form or not
 * @uses $vars['id']            Optional id for the div
 * @uses $vars['class']         Optional additional class for the div
 */

$show_add_form = elgg_extract('show_add_form', $vars, true);

$id = '';
if (isset($vars['id'])) {
	$id = "id =\"{$vars['id']}\"";
}

$class = 'elgg-comments';
if (isset($vars['class'])) {
	$class = "$class {$vars['class']}";
}

// work around for deprecation code in elgg_view()
unset($vars['internalid']);

echo "<div $id class=\"$class\">";

$options = array(
	'guid' => $vars['entity']->getGUID(),
	'annotation_names' => array('generic_comment', 'task_state_changed'),
);
$html = elgg_list_annotations($options);
if ($html) {
	echo '<h3>' . elgg_echo('tasks:changehistory') . '</h3>';
	echo $html;
}

if ($show_add_form) {
	$form_vars = array('name' => 'elgg_add_comment');
	echo elgg_view_form('tasks/comments/add', $form_vars, $vars);
}

echo '</div>';