From 808ead24b977e01204a93e4c5b98ce24a832eb69 Mon Sep 17 00:00:00 2001 From: marcus Date: Tue, 29 Jul 2008 16:11:38 +0000 Subject: Count support added git-svn-id: https://code.elgg.org/elgg/trunk@1575 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/system_log.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/engine/lib/system_log.php b/engine/lib/system_log.php index fbf0b073a..85087219b 100644 --- a/engine/lib/system_log.php +++ b/engine/lib/system_log.php @@ -59,8 +59,9 @@ * @param string $class The class of object it effects. * @param int $limit Maximum number of responses to return. * @param int $offset Offset of where to start. + * @param bool $count Return count or not */ - function get_system_log($by_user = "", $event = "", $class = "", $limit = 10, $offset = 0) + function get_system_log($by_user = "", $event = "", $class = "", $limit = 10, $offset = 0, $count = false) { global $CONFIG; @@ -88,12 +89,14 @@ if ($class!=="") $where[] = "object_class='$class'"; - $query = "SELECT * from {$CONFIG->dbprefix}system_log where 1 "; + $select = "*"; + if ($count) $select = "count(*)"; + $query = "SELECT $select; from {$CONFIG->dbprefix}system_log where 1 "; foreach ($where as $w) $query .= " and $w"; $query .= " order by time_created desc"; - $query .= " limit $offset, $limit"; // Add order and limit + if (!$count) $query .= " limit $offset, $limit"; // Add order and limit return get_data($query); } -- cgit v1.2.3