aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-08-20 18:43:01 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-08-20 18:43:01 -0700
commitafbbc9cd72e48a9eb4fb035eb01cd6e742d0088e (patch)
tree7b059c8ae935238f472fb02aa859a020bd08499f /include
parent05bec13bdc59713c89f0545d3a2955d886969dba (diff)
downloadvolse-hubzilla-afbbc9cd72e48a9eb4fb035eb01cd6e742d0088e.tar.gz
volse-hubzilla-afbbc9cd72e48a9eb4fb035eb01cd6e742d0088e.tar.bz2
volse-hubzilla-afbbc9cd72e48a9eb4fb035eb01cd6e742d0088e.zip
more work on tasks
Diffstat (limited to 'include')
-rw-r--r--include/event.php24
-rw-r--r--include/widgets.php21
2 files changed, 45 insertions, 0 deletions
diff --git a/include/event.php b/include/event.php
index 95808452d..fad852dfc 100644
--- a/include/event.php
+++ b/include/event.php
@@ -918,3 +918,27 @@ function todo_stat() {
'CANCELLED' => t('Cancelled')
);
}
+
+
+function tasks_fetch($arr) {
+
+ if(! local_channel())
+ return;
+
+ $ret = array();
+ $sql_extra = " and event_status != 'COMPLETED' ";
+ if(argc() > 1 && argv(1) === 'all')
+ $sql_extra = '';
+
+ $r = q("select * from event where type = 'task' and uid = %d $sql_extra ",
+ intval(local_channel())
+ );
+
+ $ret['success'] = (($r) ? true : false);
+ if($r) {
+ $ret['tasks'] = $r;
+ }
+
+ return $ret;
+
+} \ No newline at end of file
diff --git a/include/widgets.php b/include/widgets.php
index e735f5b2f..7433a1ec8 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -1042,3 +1042,24 @@ function widget_forums($arr) {
}
+
+function widget_tasklist($arr) {
+
+
+ require_once('include/event.php');
+ $o .= '<script>$("#tasklist-new-summary").keyup(function(e) { if (e.keyCode == 13) { $.post( "tasks/new", $("#tasklist-new").serialize() ); return false; } });</script>';
+ $o .= '<script>function taskComplete(id) { $.post("tasks/complete/"+id); }</script>';
+ $o .= '<div class="widget">' . '<h3>' . t('Tasks') . '</h3>';
+ $x = tasks_fetch(array());
+
+ if($x['success']) {
+ foreach($x['tasks'] as $y) {
+ $o .= '<div class="tasklist-item"><input type="checkbox" onchange="taskComplete(' . $y['id'] . '); return false;" /> ' . $y['summary'] . '</div>';
+ }
+ }
+ $o .= '<form id="tasklist-new" action="tasks/new" method="post"><input id="tasklist-new-summary" type="text" name="summary" value="" /></form>';
+ $o .= '</div>';
+ return $o;
+
+}
+