Add new method to search tags and series. re #34

This commit is contained in:
Sébastien Lucas 2013-09-27 17:10:07 +02:00
parent 8390411a58
commit acea490e00
2 changed files with 36 additions and 0 deletions

18
tag.php
View file

@ -61,4 +61,22 @@ order by tags.name');
}
return $entryArray;
}
public static function getAllTagsByQuery($query) {
$result = parent::getDb ()->prepare('select tags.id as id, tags.name as name, count(*) as count
from tags, books_tags_link
where tags.id = tag and tags.name like ?
group by tags.id, tags.name
order by tags.name');
$entryArray = array();
$result->execute (array ('%' . $query . '%'));
while ($post = $result->fetchObject ())
{
$tag = new Tag ($post->id, $post->name);
array_push ($entryArray, new Entry ($tag->name, $tag->getEntryId (),
str_format (localize("bookword", $post->count), $post->count), "text",
array ( new LinkNavigation ($tag->getUri ()))));
}
return $entryArray;
}
}