we can retrieve system tags now
This commit is contained in:
parent
587674b355
commit
c1528d1c5b
@ -271,10 +271,11 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
|||||||
* Retrieves all tags for a given bookmark except system tags.
|
* Retrieves all tags for a given bookmark except system tags.
|
||||||
*
|
*
|
||||||
* @param integer $bookmarkid ID of the bookmark
|
* @param integer $bookmarkid ID of the bookmark
|
||||||
|
* @param boolean $systemTags Return "system:*" tags or not
|
||||||
*
|
*
|
||||||
* @return array Array of tags
|
* @return array Array of tags
|
||||||
*/
|
*/
|
||||||
public function getTagsForBookmark($bookmarkid)
|
public function getTagsForBookmark($bookmarkid, $systemTags = false)
|
||||||
{
|
{
|
||||||
if (!is_numeric($bookmarkid)) {
|
if (!is_numeric($bookmarkid)) {
|
||||||
message_die(
|
message_die(
|
||||||
@ -285,9 +286,11 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$query = 'SELECT tag FROM ' . $this->getTableName()
|
$query = 'SELECT tag FROM ' . $this->getTableName()
|
||||||
. ' WHERE bId = ' . intval($bookmarkid)
|
. ' WHERE bId = ' . intval($bookmarkid);
|
||||||
. ' AND LEFT(tag, 7) <> "system:"'
|
if (!$systemTags) {
|
||||||
. ' ORDER BY id ASC';
|
$query .= ' AND LEFT(tag, 7) <> "system:"';
|
||||||
|
}
|
||||||
|
$query .= ' ORDER BY id ASC';
|
||||||
|
|
||||||
if (!($dbresult = $this->db->sql_query($query))) {
|
if (!($dbresult = $this->db->sql_query($query))) {
|
||||||
message_die(
|
message_die(
|
||||||
|
@ -71,6 +71,17 @@ class Bookmark2TagTest extends TestBase
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function testAttachTagsWithoutTagsAddsSystemUnfiled()
|
||||||
|
{
|
||||||
|
$bid = $this->addBookmark(null, null, 0, array());
|
||||||
|
$this->assertEquals(
|
||||||
|
array('system:unfiled'),
|
||||||
|
$this->b2ts->getTagsForBookmark($bid, true)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test getTagsForBookmark() when the bookmark has no tags
|
* Test getTagsForBookmark() when the bookmark has no tags
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user