summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-07-23 11:57:34 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-07-23 11:57:34 -0700
commit67190412e6e3196eeb43aab4bb86b970cdf1595c (patch)
treeb1861868bdca4433d6a3277c35005eaeebfc0ff9 /modules
parent070884d9e248ba692e49949851099e4d79285ef2 (diff)
Respect the $type parameter on Tag_Model::items_count()
Diffstat (limited to 'modules')
-rw-r--r--modules/tag/models/tag.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/modules/tag/models/tag.php b/modules/tag/models/tag.php
index 7a85dbab..e910a8ee 100644
--- a/modules/tag/models/tag.php
+++ b/modules/tag/models/tag.php
@@ -44,10 +44,14 @@ class Tag_Model extends ORM {
* @return integer
*/
public function items_count($type=null) {
- return ORM::factory("item")
+ $model = ORM::factory("item")
->viewable()
->join("items_tags", "items.id", "items_tags.item_id")
- ->where("items_tags.tag_id", $this->id)
- ->count_all();
+ ->where("items_tags.tag_id", $this->id);
+
+ if ($type) {
+ $model->where("items.type", $type);
+ }
+ return $model->count_all();
}
} \ No newline at end of file