aboutsummaryrefslogtreecommitdiff
path: root/views/default/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/widgets')
-rw-r--r--views/default/widgets/tasks/content.php38
-rw-r--r--views/default/widgets/tasks/edit.php24
2 files changed, 62 insertions, 0 deletions
diff --git a/views/default/widgets/tasks/content.php b/views/default/widgets/tasks/content.php
new file mode 100644
index 000000000..bdc694653
--- /dev/null
+++ b/views/default/widgets/tasks/content.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Elgg tasks widget
+ *
+ * @package ElggTasks
+ */
+
+elgg_load_library("elgg:tasks");
+
+$num = (int) $vars['entity']->tasks_num;
+
+// We show active first
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'task',
+ 'relationship_guid' => $vars['entity']->owner_guid,
+ 'relationship' => 'subscribes',
+ 'metadata_name' => 'status',
+ 'metadata_value' => array('assigned', 'active'),
+ 'limit' => $num,
+ 'full_view' => FALSE,
+ 'pagination' => FALSE,
+);
+$content = elgg_get_entities_from_relationship($options);
+
+echo elgg_view_entity_list($content, $options);
+
+if ($content) {
+ $url = "tasks/owner/" . elgg_get_page_owner_entity()->username;
+ $more_link = elgg_view('output/url', array(
+ 'href' => $url,
+ 'text' => elgg_echo('tasks:more'),
+ 'is_trusted' => true,
+ ));
+ echo "<span class=\"elgg-widget-more\">$more_link</span>";
+} else {
+ echo elgg_echo('tasks:none');
+}
diff --git a/views/default/widgets/tasks/edit.php b/views/default/widgets/tasks/edit.php
new file mode 100644
index 000000000..8d0cdbdd9
--- /dev/null
+++ b/views/default/widgets/tasks/edit.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Elgg tasks widget edit
+ *
+ * @package ElggTasks
+ */
+
+// set default value
+if (!isset($vars['entity']->tasks_num)) {
+ $vars['entity']->tasks_num = 4;
+}
+
+$params = array(
+ 'name' => 'params[tasks_num]',
+ 'value' => $vars['entity']->tasks_num,
+ 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
+);
+$dropdown = elgg_view('input/dropdown', $params);
+
+?>
+<div>
+ <?php echo elgg_echo('tasks:num'); ?>:
+ <?php echo $dropdown; ?>
+</div>