/** * Reference list action * */ public function referencesAction() { $this->_setMetaTitle('My HomeLet | References'); $this->_setBreadcrumbs(array('/' => 'Home', '/my-homelet' => 'My HomeLet', '/my-homelet/references' => 'My References')); // Get the customer session $customerSession = $this->auth->getStorage()->read(); $request = $this->getRequest(); // Search and ordering $filteredOrderBy = array(); $orderBy = $request->getParam('order'); $refnoSearch = $request->getParam('id'); // Validate order by to restricted fields to those displayed on the front end if (is_array($orderBy)) { foreach ($orderBy as $orderByField => $orderByDirection) { if (in_array($orderByField, array('start_date', 'lastname', 'address1', 'externalrefno', 'status'))) { // Copy field into new array $filteredOrderBy[$orderByField] = $orderByDirection; } } } // Get list of external reference numbers $referencesAndReports = array(); $referenceManager = new Manager_Referencing_Reference(); $referenceIds = $referenceManager->getAllReferenceIds($customerSession->id); // Get all reference details $legacyRefManager = new Manager_ReferencingLegacy_Munt(); $references = $legacyRefManager->getAllReferences($referenceIds, $refnoSearch, $filteredOrderBy); foreach ($references as $reference) { $report = $legacyRefManager->getLatestReport($reference->externalId); array_push($referencesAndReports, array('reference' => $reference, 'report' => $report)); } $this->view->references = $referencesAndReports; }