mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
+ added feeds of completed tasks and changed tasks
This commit is contained in:
parent
2327ff72e0
commit
4073c51250
3 changed files with 26 additions and 7 deletions
25
src/feed.php
25
src/feed.php
|
|
@ -21,12 +21,27 @@ if(!$listData) {
|
|||
die("No such list");
|
||||
}
|
||||
|
||||
$listData['_feed_title'] = sprintf($lang->get('feed_title'), $listData['name']);
|
||||
$listData['_feed_descr'] = sprintf($lang->get('feed_description'), $listData['name']);
|
||||
$feedType = _get('feed');
|
||||
$sqlWhere = '';
|
||||
if($feedType == 'completed') {
|
||||
$listData['_uid_field'] = 'd_completed';
|
||||
$listData['_feed_descr'] = $lang->get('feed_completed_tasks');
|
||||
$sqlWhere = 'AND compl=1';
|
||||
}
|
||||
elseif($feedType == 'modified') {
|
||||
$listData['_uid_field'] = 'd_edited';
|
||||
$listData['_feed_descr'] = $lang->get('feed_modified_tasks');
|
||||
}
|
||||
else {
|
||||
$listData['_uid_field'] = 'd_created';
|
||||
$listData['_feed_descr'] = $lang->get('feed_new_tasks');
|
||||
}
|
||||
|
||||
$listData['_feed_title'] = sprintf($lang->get('feed_title'), $listData['name']) . ' - '. $listData['_feed_descr'];
|
||||
htmlarray_ref($listData);
|
||||
|
||||
$data = array();
|
||||
$q = $db->dq("SELECT * FROM {$db->prefix}todolist WHERE list_id=$listId ORDER BY d_created DESC LIMIT 100");
|
||||
$q = $db->dq("SELECT * FROM {$db->prefix}todolist WHERE list_id=$listId $sqlWhere ORDER BY ". $listData['_uid_field'] ." DESC LIMIT 100");
|
||||
while($r = $q->fetch_assoc($q))
|
||||
{
|
||||
if($r['prio'] > 0) $r['prio'] = '+'.$r['prio'];
|
||||
|
|
@ -57,8 +72,8 @@ function printRss($listData, $data)
|
|||
|
||||
foreach($data as $v)
|
||||
{
|
||||
$d = gmdate('r', $v['d_created']);
|
||||
$guid = $listData['id'].'-'.$v['id'].'-'.$v['d_created'];
|
||||
$d = gmdate('r', $v[$listData['_uid_field']]);
|
||||
$guid = $listData['id'].'-'.$v['id'].'-'.$v[$listData['_uid_field']];
|
||||
|
||||
$s .= "<item>\n<title><![CDATA[". str_replace("]]>", "]]]]><![CDATA[>", $v['title']). "]]></title>\n".
|
||||
"<link>$link</link>\n".
|
||||
|
|
|
|||
|
|
@ -95,7 +95,9 @@ class DefaultLang
|
|||
'a_settings' => "Settings",
|
||||
'rss_feed' => "RSS Feed",
|
||||
'feed_title' => "%s",
|
||||
'feed_description' => "New tasks in %s",
|
||||
'feed_completed_tasks' => "Completed tasks",
|
||||
'feed_modified_tasks' => "Modified tasks",
|
||||
'feed_new_tasks' => "New tasks",
|
||||
|
||||
/* Settings */
|
||||
'set_header' => "Settings",
|
||||
|
|
|
|||
|
|
@ -97,7 +97,9 @@ class Lang extends DefaultLang
|
|||
'a_settings' => "Settings",
|
||||
'rss_feed' => "RSS Feed",
|
||||
'feed_title' => "%s",
|
||||
'feed_description' => "New tasks in %s",
|
||||
'feed_completed_tasks' => "Completed tasks",
|
||||
'feed_modified_tasks' => "Modified tasks",
|
||||
'feed_new_tasks' => "New tasks",
|
||||
|
||||
/* Settings */
|
||||
'set_header' => "Settings",
|
||||
|
|
|
|||
Loading…
Reference in a new issue