summaryrefslogtreecommitdiff
path: root/modules/gallery/libraries
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-08-05 10:45:38 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-08-05 10:45:38 -0700
commitfb4bfa5711f6db61205b58628ec978b68c3d36df (patch)
tree7f079a6e7e934fa302cd8bca19e80f8d7a44a3dd /modules/gallery/libraries
parent63f3efef37839ffba8cd75b9098d56cd03b06376 (diff)
parente8c57290a2e98e3cbb7cf47875e6e5dae2e41fa2 (diff)
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/gallery/libraries')
-rw-r--r--modules/gallery/libraries/ORM_MPTT.php69
1 files changed, 28 insertions, 41 deletions
diff --git a/modules/gallery/libraries/ORM_MPTT.php b/modules/gallery/libraries/ORM_MPTT.php
index cde049cd..9d716d8b 100644
--- a/modules/gallery/libraries/ORM_MPTT.php
+++ b/modules/gallery/libraries/ORM_MPTT.php
@@ -146,35 +146,30 @@ class ORM_MPTT_Core extends ORM {
* @chainable
* @param integer SQL limit
* @param integer SQL offset
- * @param string type to return
+ * @param array additional where clauses
* @param array orderby
* @return array ORM
*/
- function children($limit=null, $offset=0, $type=null, $orderby=null) {
- $this->where("parent_id", $this->id);
- if ($type) {
- $this->where("type", $type);
- }
- if (empty($orderby)) {
- $this->orderby("id", "ASC");
- } else {
- $this->orderby($orderby);
- }
- return $this->find_all($limit, $offset);
+ function children($limit=null, $offset=0, $where=array(), $orderby=array("id", "ASC")) {
+ return $this
+ ->where("parent_id", $this->id)
+ ->where($where)
+ ->orderby($orderby)
+ ->find_all($limit, $offset);
}
/**
* Return all of the children of this node, ordered by id.
*
* @chainable
- * @param string type to return
+ * @param array additional where clauses
* @return array ORM
*/
- function children_count($type=null) {
- if ($type) {
- $this->where("type", $type);
- }
- return $this->where("parent_id", $this->id)->count_all();
+ function children_count($where=array()) {
+ return $this
+ ->where($where)
+ ->where("parent_id", $this->id)
+ ->count_all();
}
/**
@@ -182,39 +177,31 @@ class ORM_MPTT_Core extends ORM {
*
* @param integer SQL limit
* @param integer SQL offset
- * @param string type to return
+ * @param array additional where clauses
* @param array orderby
* @return object ORM_Iterator
*/
- function descendants($limit=null, $offset=0, $type=null, $orderby=null) {
- $this->where("left_ptr >", $this->left_ptr)
- ->where("right_ptr <=", $this->right_ptr);
- if ($type) {
- $this->where("type", $type);
- }
-
- if (empty($orderby)) {
- $this->orderby("id", "ASC");
- } else {
- $this->orderby($orderby);
- }
-
- return $this->find_all($limit, $offset);
+ function descendants($limit=null, $offset=0, $where=array(), $orderby=array("id", "ASC")) {
+ return $this
+ ->where("left_ptr >", $this->left_ptr)
+ ->where("right_ptr <=", $this->right_ptr)
+ ->where($where)
+ ->orderby($orderby)
+ ->find_all($limit, $offset);
}
/**
* Return the count of all the children of the specified type.
*
- * @param string type to count
+ * @param array additional where clauses
* @return integer child count
*/
- function descendants_count($type=null) {
- $this->where("left_ptr >", $this->left_ptr)
- ->where("right_ptr <=", $this->right_ptr);
- if ($type) {
- $this->where("type", $type);
- }
- return $this->count_all();
+ function descendants_count($where=array()) {
+ return $this
+ ->where("left_ptr >", $this->left_ptr)
+ ->where("right_ptr <=", $this->right_ptr)
+ ->where($where)
+ ->count_all();
}
/**