/** * Initialize this result set scroller. This should only be called * prior to displaying the results of a new search. * * @param \VuFind\Search\Base\Results $searchObject The search object that was * used to execute the last search. * * @return bool */ public function init($searchObject) { // Do nothing if disabled: if (!$this->enabled) { return false; } // Save the details of this search in the session $this->data->searchId = $searchObject->getSearchId(); $this->data->page = $searchObject->getParams()->getPage(); $this->data->limit = $searchObject->getParams()->getLimit(); $this->data->total = $searchObject->getResultTotal(); // save the IDs of records on the current page to the session // so we can "slide" from one record to the next/previous records // spanning 2 consecutive pages $this->data->currIds = $this->fetchPage($searchObject); // clear the previous/next page unset($this->data->prevIds); unset($this->data->nextIds); return (bool) $this->data->currIds; }