Beispiel #1
0
function prepareTaskRow($r, $lists)
{
    $lang = Lang::instance();
    $dueA = prepare_duedate($r['duedate']);
    $formatCreatedInline = $formatCompletedInline = Config::get('dateformatshort');
    if (date('Y') != date('Y', $r['d_created'])) {
        $formatCreatedInline = Config::get('dateformat2');
    }
    if ($r['d_completed'] && date('Y') != date('Y', $r['d_completed'])) {
        $formatCompletedInline = Config::get('dateformat2');
    }
    $dCreated = timestampToDatetime($r['d_created']);
    $dCompleted = $r['d_completed'] ? timestampToDatetime($r['d_completed']) : '';
    return array('id' => $r['id'], 'title' => escapeTags($r['title']), 'listId' => $r['list_id'], 'listName' => $lists['list'][$r['list_id']]['name'], 'date' => htmlarray($dCreated), 'dateInt' => (int) $r['d_created'], 'dateInline' => htmlarray(formatTime($formatCreatedInline, $r['d_created'])), 'dateInlineTitle' => htmlarray(sprintf($lang->get('taskdate_inline_created'), $dCreated)), 'dateEditedInt' => (int) $r['d_edited'], 'dateCompleted' => htmlarray($dCompleted), 'dateCompletedInline' => $r['d_completed'] ? htmlarray(formatTime($formatCompletedInline, $r['d_completed'])) : '', 'dateCompletedInlineTitle' => htmlarray(sprintf($lang->get('taskdate_inline_completed'), $dCompleted)), 'compl' => (int) $r['compl'], 'prio' => $r['prio'], 'note' => nl2br(escapeTags($r['note'])), 'noteText' => (string) $r['note'], 'ow' => (int) $r['ow'], 'tags' => htmlarray($r['tags']), 'tags_ids' => htmlarray($r['tags_ids']), 'duedate' => $dueA['formatted'], 'dueClass' => $dueA['class'], 'dueStr' => htmlarray($r['compl'] && $dueA['timestamp'] ? formatTime($formatCompletedInline, $dueA['timestamp']) : $dueA['str']), 'dueInt' => date2int($r['duedate']), 'dueTitle' => htmlarray(sprintf($lang->get('taskdate_inline_duedate'), $dueA['formatted'])));
}
Beispiel #2
0
    $a = array();
    if ($r['prio']) {
        $a[] = $lang->get('priority') . ": {$r['prio']}";
    }
    if ($r['duedate'] != '') {
        $ad = explode('-', $r['duedate']);
        $a[] = $lang->get('due') . ": " . formatDate3(Config::get('dateformat'), (int) $ad[0], (int) $ad[1], (int) $ad[2], $lang);
    }
    if ($r['tags'] != '') {
        $a[] = $lang->get('tags') . ": " . str_replace(',', ', ', $r['tags']);
    }
    if ($r['compl']) {
        $a[] = $lang->get('taskdate_completed') . ": " . timestampToDatetime($r['d_completed']);
    }
    $r['title'] = strip_tags($r['title']);
    $r['note'] = escapeTags($r['note']);
    $r['_descr'] = nl2br($r['note']) . ($a && $r['note'] != '' ? "<br/><br/>" : "") . implode("<br/>", htmlarray($a));
    $data[] = $r;
}
printRss($listData, $data);
function printRss($listData, $data)
{
    $link = get_mttinfo('url') . "?list=" . $listData['id'];
    $buildDate = gmdate('r');
    $s = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n<channel>\n" . "<title>{$listData['_feed_title']}</title>\n<link>{$link}</link>\n<description>{$listData['_feed_descr']}</description>\n" . "<lastBuildDate>{$buildDate}</lastBuildDate>\n\n";
    foreach ($data as $v) {
        $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" . "<pubDate>{$d}</pubDate>\n" . "<description><![CDATA[" . $v['_descr'] . "]]></description>\n" . "<guid isPermaLink=\"false\">{$guid}</guid>\n" . "</item>\n";
    }
    $s .= "</channel>\n</rss>";
Beispiel #3
0
function prepareTaskRow($r)
{
    $lang = Lang::instance();
    $dueA = prepare_duedate($r['duedate']);
    $formatCreatedInline = $formatCompletedInline = Config::get('dateformatshort');
    if (date('Y') != date('Y', $r['d_created'])) {
        $formatCreatedInline = Config::get('dateformat2');
    }
    if ($r['d_completed'] && date('Y') != date('Y', $r['d_completed'])) {
        $formatCompletedInline = Config::get('dateformat2');
    }
    $dCreated = timestampToDatetime($r['d_created']);
    $dCompleted = $r['d_completed'] ? timestampToDatetime($r['d_completed']) : '';
    $db = DBConnection::instance();
    $current_user_id = (int) $_SESSION['userid'];
    $notification_id = (int) $db->sq("SELECT id FROM {$db->prefix}notification_listeners WHERE type = 'list' AND value = " . $r['id'] . " AND user_id=" . $current_user_id);
    $progress = '';
    $progress_current = '';
    $progress_total = '';
    if (!empty($r['duration'])) {
        $progress = ceil(TimeTracker::getTaskTotal($r['id']) * 100 / ($r['duration'] * 60));
        $progress_current = TimeTracker::getTaskTotal($r['id']) / 60;
        $progress_total = $r['duration'];
    }
    return array('id' => $r['id'], 'title' => escapeTags($r['title']), 'listId' => $r['list_id'], 'date' => htmlarray($dCreated), 'dateInt' => (int) $r['d_created'], 'dateInline' => htmlarray(formatTime($formatCreatedInline, $r['d_created'])), 'dateInlineTitle' => htmlarray(sprintf($lang->get('taskdate_inline_created'), $dCreated)), 'dateEditedInt' => (int) $r['d_edited'], 'dateCompleted' => htmlarray($dCompleted), 'dateCompletedInline' => $r['d_completed'] ? htmlarray(formatTime($formatCompletedInline, $r['d_completed'])) : '', 'dateCompletedInlineTitle' => htmlarray(sprintf($lang->get('taskdate_inline_completed'), $dCompleted)), 'compl' => (int) $r['compl'], 'notification' => $notification_id > 0 ? 1 : 0, 'prio' => $r['prio'], 'note' => nl2br(escapeTags($r['note'])), 'noteText' => (string) $r['note'], 'ow' => (int) $r['ow'], 'tags' => htmlarray($r['tags']), 'tags_ids' => htmlarray($r['tags_ids']), 'duedate' => $dueA['formatted'], 'dueClass' => $dueA['class'], 'dueStr' => htmlarray($r['compl'] && $dueA['timestamp'] ? formatTime($formatCompletedInline, $dueA['timestamp']) : $dueA['str']), 'dueInt' => date2int($r['duedate']), 'dueTitle' => htmlarray(sprintf($lang->get('taskdate_inline_duedate'), $dueA['formatted'])), 'duration' => empty($r['duration']) ? '' : $r['duration'], 'progress' => $progress, 'progress_current' => $progress_current, 'progress_total' => $progress_total, 'comments' => getTaskComments($r['id']));
}
Beispiel #4
0
    $dateCompleted = $compl ? time() : 0;
    $db->dq("UPDATE {$db->prefix}todolist SET compl={$compl},ow={$ow},d_completed=?,d_edited=? WHERE id={$id}", array($dateCompleted, time()));
    $t = array();
    $t['total'] = 1;
    $r = $db->sqa("SELECT * FROM {$db->prefix}todolist WHERE id={$id}");
    $t['list'][] = prepareTaskRow($r, loadLists($db, ''));
    jsonExit($t);
} elseif (isset($_GET['editNote'])) {
    check_write_access();
    $id = (int) _post('id');
    stop_gpc($_POST);
    $note = str_replace("\r\n", "\n", trim(_post('note')));
    $db->dq("UPDATE {$db->prefix}todolist SET note=?,d_edited=? WHERE id={$id}", array($note, time()));
    $t = array();
    $t['total'] = 1;
    $t['list'][] = array('id' => $id, 'note' => nl2br(escapeTags($note)), 'noteText' => (string) $note);
    jsonExit($t);
} elseif (isset($_GET['editTask'])) {
    check_write_access();
    $id = (int) _post('id');
    stop_gpc($_POST);
    $title = trim(_post('title'));
    $note = str_replace("\r\n", "\n", trim(_post('note')));
    $prio = (int) _post('prio');
    if ($prio < -1) {
        $prio = -1;
    } elseif ($prio > 2) {
        $prio = 2;
    }
    $duedate = parse_duedate(trim(_post('duedate')));
    $t = array();
Beispiel #5
0
    if ($r['prio']) {
        $a[] = $lang->get('priority') . ": {$r['prio']}";
    }
    if ($r['duedate'] != '') {
        $ad = explode('-', $r['duedate']);
        $a[] = $lang->get('due') . ": " . formatDate3(Config::get('dateformat'), (int) $ad[0], (int) $ad[1], (int) $ad[2], $lang);
    }
    if ($r['tags'] != '') {
        $a[] = $lang->get('tags') . ": " . str_replace(',', ', ', $r['tags']);
    }
    if ($r['compl']) {
        $a[] = $lang->get('taskdate_completed') . ": " . timestampToDatetime($r['d_completed']);
    }
    $r['title'] = strip_tags($r['title']);
    $contact = $r['c_contact'] . " - " . $r['c_date'] . " - " . $r['c_type'] . "<br />";
    $r['note'] = $contact . escapeTags($r['note']);
    $r['_descr'] = nl2br($r['note']) . ($a && $r['note'] != '' ? "<br/><br/>" : "") . implode("<br/>", htmlarray($a));
    $data[] = $r;
}
printRss($listData, $data);
function printRss($listData, $data)
{
    global $base_url;
    $field_id = (int) $_GET['fid'];
    $link = url("node/{$field_id}", array('absolute' => true));
    $buildDate = gmdate('r');
    $s = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n<channel>\n" . "<title>{$listData['_feed_title']}</title>\n<link>{$link}</link>\n<description>{$listData['_feed_descr']}</description>\n" . "<lastBuildDate>{$buildDate}</lastBuildDate>\n\n";
    foreach ($data as $v) {
        $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" . "<pubDate>{$d}</pubDate>\n" . "<description><![CDATA[" . $v['_descr'] . "]]></description>\n" . "<guid isPermaLink=\"false\">{$guid}</guid>\n" . "</item>\n";
Beispiel #6
0
function prepareTaskRow($r)
{
    $lang = Lang::instance();
    $dueA = prepare_duedate($r['duedate']);
    $c_date = prepare_duedate($r['c_date']);
    //$reminderformat = Config::get('dateformat2');
    //$reminderdate = formatTime($reminderformat, $r['r_date']);
    //From query
    //'reminderdate' => $reminderdate,
    //'reminderemail' => $r['r_email'],
    //'remindernote' => $r['r_note'],
    $formatCreatedInline = $formatCompletedInline = Config::get('dateformatshort');
    if (date('Y') != date('Y', $r['d_created'])) {
        $formatCreatedInline = Config::get('dateformat2');
    }
    if ($r['d_completed'] && date('Y') != date('Y', $r['d_completed'])) {
        $formatCompletedInline = Config::get('dateformat2');
    }
    $dCreated = timestampToDatetime($r['d_created']);
    $dCompleted = $r['d_completed'] ? timestampToDatetime($r['d_completed']) : '';
    $return = array('id' => $r['id'], 'title' => escapeTags($r['title']), 'listId' => $r['list_id'], 'date' => htmlarray($dCreated), 'dateInt' => (int) $r['d_created'], 'dateInline' => htmlarray(formatTime($formatCreatedInline, $r['d_created'])), 'dateInlineTitle' => htmlarray(sprintf($lang->get('taskdate_inline_created'), $dCreated)), 'dateEditedInt' => (int) $r['d_edited'], 'dateCompleted' => htmlarray($dCompleted), 'dateCompletedInline' => $r['d_completed'] ? htmlarray(formatTime($formatCompletedInline, $r['d_completed'])) : '', 'dateCompletedInlineTitle' => htmlarray(sprintf($lang->get('taskdate_inline_completed'), $dCompleted)), 'compl' => (int) $r['compl'], 'prio' => $r['prio'], 'contact' => $r['c_contact'], 'contactdate' => $c_date['formatted'], 'contacttype' => $r['c_type'], 'note' => nl2br(escapeTags($r['note'])), 'noteText' => (string) $r['note'], 'ow' => (int) $r['ow'], 'tags' => htmlarray($r['tags']), 'tags_ids' => htmlarray($r['tags_ids']), 'duedate' => $dueA['formatted'], 'dueClass' => $dueA['class'], 'dueStr' => htmlarray($r['compl'] && $dueA['timestamp'] ? formatTime($formatCompletedInline, $dueA['timestamp']) : $dueA['str']), 'dueInt' => date2int($r['duedate']), 'dueTitle' => htmlarray(sprintf($lang->get('taskdate_inline_duedate'), $dueA['formatted'])));
    return $return;
}