diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-11-28 01:40:55 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-11-28 01:40:55 +0000 |
commit | 88b35c1182326790e16746ed5d62461631f1425d (patch) | |
tree | 75f080cfca6078ecbffd2118a103f142c8d8c20d /modules/tag/models | |
parent | fd519082e1164bd3a92e541ad969c6151050f966 (diff) |
Tags_Model::items() now lets you filter by item type
Diffstat (limited to 'modules/tag/models')
-rw-r--r-- | modules/tag/models/tag.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/modules/tag/models/tag.php b/modules/tag/models/tag.php index 59dd8d54..de892db2 100644 --- a/modules/tag/models/tag.php +++ b/modules/tag/models/tag.php @@ -25,14 +25,18 @@ class Tag_Model extends ORM { /** * Return all items associated with this tag. + * @param string $type the type of item (album, photo) * @param integer $limit number of rows to limit result to * @param integer $offset offset in result to start returning rows from * @return ORM_Iterator */ - public function items($limit=null, $offset=0) { - return ORM::factory("item") + public function items($limit=null, $offset=0, $type=null) { + $model = ORM::factory("item") ->join("items_tags", "items.id", "items_tags.item_id") - ->where("items_tags.tag_id", $this->id) - ->find_all($limit, $offset); + ->where("items_tags.tag_id", $this->id); + if ($type) { + $model->where("items.type", $type); + } + return $model->find_all($limit, $offset); } }
\ No newline at end of file |