From 9e047bce2e2f5523c164aa2e09a12dfb3a206091 Mon Sep 17 00:00:00 2001 From: marcus Date: Tue, 1 Jul 2008 13:31:07 +0000 Subject: Group class, refs #106 git-svn-id: https://code.elgg.org/elgg/trunk@1231 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/objects.php | 78 +------------------------------------------------- 1 file changed, 1 insertion(+), 77 deletions(-) (limited to 'engine/lib/objects.php') 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 -- cgit v1.2.3