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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
<?php
/**
* Edit a task
*
* @package ElggTasks
*/
gatekeeper();
$task_guid = (int)get_input('guid');
$task = get_entity($task_guid);
if (!$task) {
}
$container = $task->getContainerEntity();
if (!$container) {
}
$list = get_entity($task->list_guid);
if (!$list) {
}
elgg_set_page_owner_guid($container->getGUID());
if (elgg_instanceof($container, 'user')) {
elgg_push_breadcrumb($container->name, "tasks/owner/$container->username/");
} elseif (elgg_instanceof($container, 'group')) {
elgg_push_breadcrumb($container->name, "tasks/group/$container->guid/all");
}
if($list) {
elgg_push_breadcrumb($list->title, "tasks/view/$list->guid/$list->title");
}
elgg_push_breadcrumb($task->title, $task->getURL());
elgg_push_breadcrumb(elgg_echo('edit'));
$title = elgg_echo("tasks:edit");
if ($task->canEdit()) {
$vars = array(
'guid' => $task_guid,
'container_guid' => $container->guid,
);
foreach(array_keys(elgg_get_config('tasks')) as $variable){
$vars[$variable] = $task->$variable;
}
$content = elgg_view_form('tasks/edit', array(), $vars);
} else {
$content = elgg_echo("tasks:noaccess");
}
$body = elgg_view_layout('content', array(
'filter' => '',
'content' => $content,
'title' => $title,
));
echo elgg_view_page($title, $body);
|