Implement options so link_query() can be limited

This commit is contained in:
Nathan Gray 2009-12-08 22:36:43 +00:00
parent 1524b6670f
commit ac14a5a1fd

View File

@ -1500,13 +1500,21 @@ class calendar_bo
* @param string $pattern pattern to search * @param string $pattern pattern to search
* @return array with cal_id - title pairs of the matching entries * @return array with cal_id - title pairs of the matching entries
*/ */
function link_query($pattern) function link_query($pattern, Array &$options = array())
{ {
$result = 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); $result[$event['id']] = $this->link_title($event);
} }
$options['total'] = $this->total;
return $result; return $result;
} }