aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/objects.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-01 13:31:07 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-01 13:31:07 +0000
commit9e047bce2e2f5523c164aa2e09a12dfb3a206091 (patch)
tree2bea8e13da21a78bfb605687f8b85b7d010dadec /engine/lib/objects.php
parent43abdcbe55e3a041add586982fbf3f806d6f482f (diff)
downloadelgg-9e047bce2e2f5523c164aa2e09a12dfb3a206091.tar.gz
elgg-9e047bce2e2f5523c164aa2e09a12dfb3a206091.tar.bz2
Group class, refs #106
git-svn-id: https://code.elgg.org/elgg/trunk@1231 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/objects.php')
-rw-r--r--engine/lib/objects.php78
1 files changed, 1 insertions, 77 deletions
diff --git a/engine/lib/objects.php b/engine/lib/objects.php
index 015a0eb72..5cccccc72 100644
--- a/engine/lib/objects.php
+++ b/engine/lib/objects.php
@@ -378,81 +378,5 @@
return get_entities_from_relationship("member_of_site", $object_guid, false, "site", "", 0, "time_created desc", $limit, $offset);
}
-
- /**
- * Return an array of objects in a given container.
- * @see get_entities()
- *
- * @param string $subtype The subtype
- * @param int $owner_guid Owner
- * @param int $site_guid The site
- * @param int $container_guid The container (defaults to current page owner)
- * @param string $order_by Order
- * @param unknown_type $limit Limit on number of elements to return, by default 10.
- * @param unknown_type $offset Where to start, by default 0.
- * @param unknown_type $count Whether to return the entities or a count of them.
- */
- function get_objects_in_container($subtype = "", $owner_guid = 0, $site_guid = 0, $container_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false)
- {
- global $CONFIG;
-
- if ($subtype === false || $subtype === null || $subtype === 0)
- return false;
-
- $subtype = get_subtype_id('object', $subtype);
-
- if ($order_by == "") $order_by = "e.time_created desc";
- $order_by = sanitise_string($order_by);
- $limit = (int)$limit;
- $offset = (int)$offset;
- $site_guid = (int) $site_guid;
- if ($site_guid == 0)
- $site_guid = $CONFIG->site_guid;
-
- $container_guid = (int)$container_guid;
- if ($container_guid == 0)
- $container_guid = page_owner();
-
- $where = array();
-
- $where[] = "e.type='object'";
- if ($subtype!=="")
- $where[] = "e.subtype=$subtype";
- if ($owner_guid != "") {
- if (!is_array($owner_guid)) {
- $owner_guid = (int) $owner_guid;
- $where[] = "e.owner_guid = '$owner_guid'";
- } else if (sizeof($owner_guid) > 0) {
- // Cast every element to the owner_guid array to int
- $owner_guid = array_map("sanitise_int", $owner_guid);
- $owner_guid = implode(",",$owner_guid);
- $where[] = "e.owner_guid in ({$owner_guid})";
- }
- }
- if ($site_guid > 0)
- $where[] = "e.site_guid = {$site_guid}";
-
- if ($container_guid > 0)
- $where[] = "o.container_guid = {$container_guid}";
-
- if (!$count) {
- $query = "SELECT * from {$CONFIG->dbprefix}entities e join {$CONFIG->dbprefix}objects_entity o on e.guid=o.guid where ";
- } else {
- $query = "select count(e.guid) as total from {$CONFIG->dbprefix}entities e join {$CONFIG->dbprefix}objects_entity o on e.guid=o.guid where ";
- }
- foreach ($where as $w)
- $query .= " $w and ";
- $query .= get_access_sql_suffix('e'); // Add access controls
- if (!$count) {
- $query .= " order by $order_by";
- if ($limit) $query .= " limit $offset, $limit"; // Add order and limit
-
- $dt = get_data($query, "entity_row_to_elggstar");
- return $dt;
- } else {
- $total = get_data_row($query);
- return $total->total;
- }
-
- }
+
?> \ No newline at end of file