From ac14a5a1fdc982868a1c7f889190be777ab5be50 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 8 Dec 2009 22:36:43 +0000 Subject: [PATCH] Implement options so link_query() can be limited --- calendar/inc/class.calendar_bo.inc.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/calendar/inc/class.calendar_bo.inc.php b/calendar/inc/class.calendar_bo.inc.php index c9cc66f916..0afb5359af 100644 --- a/calendar/inc/class.calendar_bo.inc.php +++ b/calendar/inc/class.calendar_bo.inc.php @@ -1500,13 +1500,21 @@ class calendar_bo * @param string $pattern pattern to search * @return array with cal_id - title pairs of the matching entries */ - function link_query($pattern) + function link_query($pattern, Array &$options = array()) { $result = array(); - foreach((array) $this->search(array('query' => $pattern)) as $event) + $query = array( + 'query' => $pattern, + 'offset' => $options['start'], + ); + if($options['num_rows']) { + $query['num_rows'] = $options['num_rows']; + } + foreach((array) $this->search($query) as $event) { $result[$event['id']] = $this->link_title($event); } + $options['total'] = $this->total; return $result; }