summaryrefslogtreecommitdiff
path: root/modules/tag/models
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2008-11-26 17:02:27 +0000
committerTim Almdal <tnalmdal@shaw.ca>2008-11-26 17:02:27 +0000
commite77fd34175a5d7bef5f1561bdbeea8ef253db1d2 (patch)
treeb5fb026d7bfe15d1c17865e25f8024fa646066f0 /modules/tag/models
parentaf9a27216d25bcb390413c7848e26d3cd5e1b15f (diff)
Duh, i have the count in the tag model... why do i need to do a query to count?
Added text to the description instead of return an empty string
Diffstat (limited to 'modules/tag/models')
-rw-r--r--modules/tag/models/tag.php17
1 files changed, 2 insertions, 15 deletions
diff --git a/modules/tag/models/tag.php b/modules/tag/models/tag.php
index b25afc58..d086013d 100644
--- a/modules/tag/models/tag.php
+++ b/modules/tag/models/tag.php
@@ -32,7 +32,7 @@ class Tag_Model extends ORM {
if ($function == "children") {
return $this->_get_tag_children($args[0], $args[1]);
} else if ($function == "children_count") {
- return $this->_get_children_count();
+ return $this->count;
} else if ($function == "parents") {
return ORM::factory("item", 1);
} else {
@@ -47,7 +47,7 @@ class Tag_Model extends ORM {
if ($property == "title" || $property == "title_edit" || $property == "name_edit") {
return $this->name;
} else if ($property == "description_edit") {
- return "";
+ return "There are {$this->count} items tagged.";
} else if ($property == "owner") {
return null;
} else {
@@ -77,17 +77,4 @@ class Tag_Model extends ORM {
->where($this->foreign_key(NULL, $join_table), $this->object[$this->primary_key])
->find_all($limit, $offset);
}
-
- /**
- * Get the total number of children.
- * @return int
- */
- private function _get_children_count() {
- return Database::instance()
- ->select("COUNT(*) AS count")
- ->from("items_tags")
- ->where("tag_id", $this->id)
- ->get()
- ->current()->count;
- }
} \ No newline at end of file