add option to get last modified date instead of creation date
This commit is contained in:
parent
49f1259c42
commit
0a5eed2dd3
@ -687,6 +687,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
|
|||||||
* @param string $terms Search terms separated by spaces
|
* @param string $terms Search terms separated by spaces
|
||||||
* @param string $sortOrder One of the following values:
|
* @param string $sortOrder One of the following values:
|
||||||
* "date_asc", "date_desc",
|
* "date_asc", "date_desc",
|
||||||
|
* "modified_asc", "modified_desc"
|
||||||
* "title_desc", "title_asc",
|
* "title_desc", "title_asc",
|
||||||
* "url_desc", "url_asc",
|
* "url_desc", "url_asc",
|
||||||
* "voting_asc", "voting_desc"
|
* "voting_asc", "voting_desc"
|
||||||
@ -814,6 +815,12 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
|
|||||||
case 'url_asc':
|
case 'url_asc':
|
||||||
$query_5 .= ' ORDER BY B.bAddress ASC ';
|
$query_5 .= ' ORDER BY B.bAddress ASC ';
|
||||||
break;
|
break;
|
||||||
|
case 'modified_desc':
|
||||||
|
$query_5 .= ' ORDER BY B.bModified DESC ';
|
||||||
|
break;
|
||||||
|
case 'modified_asc':
|
||||||
|
$query_5 .= ' ORDER BY B.bModified ASC ';
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$query_5 .= ' ORDER BY B.' . $GLOBALS['dateOrderField'] . ' DESC ';
|
$query_5 .= ' ORDER BY B.' . $GLOBALS['dateOrderField'] . ' DESC ';
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,11 @@
|
|||||||
* that too, so we are as close at the API as possible,
|
* that too, so we are as close at the API as possible,
|
||||||
* not breaking delicious clients.
|
* not breaking delicious clients.
|
||||||
*
|
*
|
||||||
|
* SemanticScuttle supports an extra parameter:
|
||||||
|
* - ?datemode=modified
|
||||||
|
* - sorts by modified date and returns modification time
|
||||||
|
* instead of creation time
|
||||||
|
*
|
||||||
* SemanticScuttle - your social bookmark manager.
|
* SemanticScuttle - your social bookmark manager.
|
||||||
*
|
*
|
||||||
* PHP version 5.
|
* PHP version 5.
|
||||||
@ -27,18 +32,27 @@
|
|||||||
$httpContentType = 'text/xml';
|
$httpContentType = 'text/xml';
|
||||||
require_once 'httpauth.inc.php';
|
require_once 'httpauth.inc.php';
|
||||||
|
|
||||||
|
// parameter "datemode=modified" will get last modified date
|
||||||
|
// instead of last created date
|
||||||
|
$orderby = null;
|
||||||
|
$timeField = 'bDatetime';
|
||||||
|
if (isset($_GET['datemode']) && $_GET['datemode'] == 'modified') {
|
||||||
|
$orderby = 'modified_desc';
|
||||||
|
$timeField = 'bModified';
|
||||||
|
}
|
||||||
|
|
||||||
$bs = SemanticScuttle_Service_Factory::get('Bookmark');
|
$bs = SemanticScuttle_Service_Factory::get('Bookmark');
|
||||||
|
|
||||||
$bookmarks = $bs->getBookmarks(0, 1, $userservice->getCurrentUserId());
|
$bookmarks = $bs->getBookmarks(0, 1, $userservice->getCurrentUserId(), null, null, $orderby);
|
||||||
|
|
||||||
// Set up the XML file and output all the tags.
|
// Set up the XML file and output all the tags.
|
||||||
echo '<?xml version="1.0" standalone="yes" ?' . ">\r\n";
|
echo '<?xml version="1.0" standalone="yes" ?' . ">\r\n";
|
||||||
//foreach is used in case there are no bookmarks
|
//foreach is used in case there are no bookmarks
|
||||||
foreach ($bookmarks['bookmarks'] as $row) {
|
foreach ($bookmarks['bookmarks'] as $row) {
|
||||||
echo '<update time="'
|
echo '<update time="'
|
||||||
. gmdate('Y-m-d\TH:i:s\Z', strtotime($row['bDatetime']))
|
. gmdate('Y-m-d\TH:i:s\Z', strtotime($row[$timeField]))
|
||||||
. '"'
|
. '"'
|
||||||
. ' inboxnew="0"'
|
. ' inboxnew="0"'
|
||||||
. ' />';
|
. ' />';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user