summaryrefslogtreecommitdiff
path: root/core/libraries
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2008-11-19 18:23:30 +0000
committerTim Almdal <tnalmdal@shaw.ca>2008-11-19 18:23:30 +0000
commitb3314fc1dcfd73c36c4bab82a5ebabca629845c8 (patch)
tree0f2a53f914302f59a7c8215884b0a6482abbd1b2 /core/libraries
parent161998dde6d976c45cfcea31f1128147acc3d64f (diff)
Update the media rss template to include the resize and the fullsize
added descendants by type method to the item model to allow for the selection of children by type
Diffstat (limited to 'core/libraries')
-rw-r--r--core/libraries/ORM_MPTT.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/core/libraries/ORM_MPTT.php b/core/libraries/ORM_MPTT.php
index f79ea910..023960e3 100644
--- a/core/libraries/ORM_MPTT.php
+++ b/core/libraries/ORM_MPTT.php
@@ -137,6 +137,32 @@ class ORM_MPTT_Core extends ORM {
}
/**
+ * Return all of the children of the specified type, ordered by id.
+ *
+ * @chainable
+ * @param string type to return
+ * @param integer SQL limit
+ * @param integer SQL offset
+ * @param boolean flag to return all grandchildren as well
+ * @return array ORM
+ */
+ function decendents_by_type($type="photo", $limit=NULL, $offset=0, $grand_children=false) {
+ if (!isset($this->children)) {
+ if (!empty($grandchildren)) {
+ $this->where("left >=", $this->left)
+ ->where("right <=", $this->right);
+ } else {
+ $this->where("parent_id", $this->id);
+ }
+ $this->children =
+ $this->where("type", $type)
+ ->orderby("id", "ASC")
+ ->find_all($limit, $offset);
+ }
+ return $this->children;
+ }
+
+ /**
* @see ORM::reload
*/
function reload() {