public function __construct(RecordCollection $contacts, RecordCollectionPagination $pagination, $tableOnly = false) { $pagination->setNumResultsPerPage($this->getResultsPerPage()); $this->pager = $pagination->getPager(); $this->pagerInfo = $pagination->getInfo(); $this->contacts = $pagination->getPaginatedResults(); $this->requireJsPackage("typeahead"); $this->contactsSearch = new TypeAheadSearchFormView(TypeAheadEnum::CONTACTS(), "Search Contacts..."); $this->_tableOnly = (bool) $tableOnly; }
/** * Show a paginated list of contacts * * @param int $page * * @return \Qubes\Defero\Applications\Defero\Views\Contacts\ContactsView */ public function renderIndex($page = 1) { $contacts = (new RecordCollection(new Contact()))->setOrderBy("id"); $pagination = new RecordCollectionPagination($contacts, $page); $pagination->setUri("/contacts/page"); return new ContactsView($contacts, $pagination); }