aboutsummaryrefslogtreecommitdiffstats
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
parent05bec13bdc59713c89f0545d3a2955d886969dba (diff)
downloadvolse-hubzilla-afbbc9cd72e48a9eb4fb035eb01cd6e742d0088e.tar.gz
volse-hubzilla-afbbc9cd72e48a9eb4fb035eb01cd6e742d0088e.tar.bz2
volse-hubzilla-afbbc9cd72e48a9eb4fb035eb01cd6e742d0088e.zip
more work on tasks
-rwxr-xr-xboot.php1
-rw-r--r--include/event.php24
-rw-r--r--include/widgets.php21
-rwxr-xr-xmod/events.php22
-rw-r--r--mod/tasks.php12
5 files changed, 71 insertions, 9 deletions
diff --git a/boot.php b/boot.php
index d8b4fa686..29f62a346 100755
--- a/boot.php
+++ b/boot.php
@@ -2002,6 +2002,7 @@ function load_pdl(&$a) {
$a->pdl = $s;
}
}
+
}
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;
+
+}
+
diff --git a/mod/events.php b/mod/events.php
index 56c4ece54..15fed9df2 100755
--- a/mod/events.php
+++ b/mod/events.php
@@ -391,8 +391,18 @@ function events_content(&$a) {
intval(local_channel()),
intval($_GET['id'])
);
- } else {
-
+ } elseif($export) {
+ $r = q("SELECT * from event where uid = %d
+ AND (( `adjust` = 0 AND ( `finish` >= '%s' or nofinish = 1 ) AND `start` <= '%s' )
+ OR ( `adjust` = 1 AND ( `finish` >= '%s' or nofinish = 1 ) AND `start` <= '%s' )) ",
+ intval(local_channel()),
+ dbesc($start),
+ dbesc($finish),
+ dbesc($adjust_start),
+ dbesc($adjust_finish)
+ );
+ }
+ else {
// fixed an issue with "nofinish" events not showing up in the calendar.
// There's still an issue if the finish date crosses the end of month.
// Noting this for now - it will need to be fixed here and in Friendica.
@@ -400,7 +410,7 @@ function events_content(&$a) {
$r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan
from event left join item on event_hash = resource_id
- where resource_type in ( 'event', 'birthday' ) and event.uid = %d $ignored
+ where resource_type = 'event' and event.uid = %d $ignored
AND (( `adjust` = 0 AND ( `finish` >= '%s' or nofinish = 1 ) AND `start` <= '%s' )
OR ( `adjust` = 1 AND ( `finish` >= '%s' or nofinish = 1 ) AND `start` <= '%s' )) ",
intval(local_channel()),
@@ -411,14 +421,17 @@ function events_content(&$a) {
);
}
+
$links = array();
- if($r) {
+ if($r && ! $export) {
xchan_query($r);
$r = fetch_post_tags($r,true);
$r = sort_by_date($r);
+ }
+ if($r) {
foreach($r as $rr) {
$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j'));
if(! x($links,$j))
@@ -426,7 +439,6 @@ function events_content(&$a) {
}
}
-
$events=array();
$last_date = '';
diff --git a/mod/tasks.php b/mod/tasks.php
index 8220b9962..869d9b3cd 100644
--- a/mod/tasks.php
+++ b/mod/tasks.php
@@ -75,18 +75,22 @@ function tasks_content(&$a) {
$sql_extra = " and event_status != 'COMPLETED' ";
if(argc() > 1 && argv(1) === 'all')
$sql_extra = '';
-
-
+dbg(1);
$r = q("select * from event where type = 'task' and uid = %d $sql_extra ",
intval(local_channel())
);
+dbg(0);
$ret['success'] = (($r) ? true : false);
if($r) {
$ret['tasks'] = $r;
}
-
- json_return_and_die($r);
+
+// return $ret;
+
+ return json_encode($ret);
+
+// json_return_and_die($ret);