summaryrefslogtreecommitdiff
path: root/core/models/item.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/models/item.php')
-rw-r--r--core/models/item.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/core/models/item.php b/core/models/item.php
index b8957911..8b08b699 100644
--- a/core/models/item.php
+++ b/core/models/item.php
@@ -20,4 +20,22 @@
class Item_Model extends MPTT {
protected $left_column = "left";
protected $right_column = "right";
+
+ public function is_album() {
+ return $this->type == 'album';
+ }
+
+ public function is_photo() {
+ return $this->type == 'photo';
+ }
+
+ // MPTT::get_children returns null if there are no children; change that to an empty array for
+ // consistency.
+ public function get_children() {
+ $children = parent::get_children();
+ if (empty($children)) {
+ $children = array();
+ }
+ return $children;
+ }
}