/** Display list of rulers * @access public * @return void */ public function rulersAction() { $rulers = new Rulers(); $rulerList = $rulers->getRulerList($this->getAllParams()); if (in_array($this->_helper->contextSwitch()->getCurrentContext(), $this->_contexts)) { $data = array('pageNumber' => $rulerList->getCurrentPageNumber(), 'total' => number_format($rulerList->getTotalItemCount(), 0), 'itemsReturned' => $rulerList->getCurrentItemCount(), 'totalPages' => number_format($rulerList->getTotalItemCount() / $rulerList->getCurrentItemCount(), 0)); $this->view->data = $data; $rulers = null; foreach ($rulerList as $k) { $action = $k['term']; switch ($action) { case $action == strtoupper('Roman'): $actionset = 'emperor'; $module = 'romancoins'; break; case $action == strtoupper('Byzantine'): $module = 'byzantinecoins'; $actionset = 'ruler'; break; case $action == strtoupper('Greek and Roman Provincial'): $module = 'greekromancoins'; $actionset = 'ruler'; break; case $action == strtoupper('Post Medieval'): $module = 'postmedievalcoins'; $actionset = 'ruler'; break; case $action == strtoupper('Early Medieval'): $module = 'earlymedievalcoins'; $actionset = 'ruler'; break; case $action == strtoupper('Iron Age'): $module = 'ironagecoins'; $actionset = 'ruler'; break; case $action == strtoupper('medieval'): $module = 'medievalcoins'; $actionset = 'ruler'; break; default: $actionset = 'ruler'; $module = 'medievalcoins'; } if ($k['term'] == 'ROMAN') { $id = $k['pasID']; } else { $id = $k['id']; } $rulers[] = array('id' => $id, 'name' => $k['issuer'], 'period' => $k['term'], 'dateFrom' => $k['date1'], 'dateTo' => $k['date2'], 'pasID' => $k['pasID'], 'url' => $this->view->serverUrl() . $this->view->url(array('module' => $module, 'controller' => $actionset . 's', 'action' => $actionset, 'id' => $id), null, true)); } $this->view->rulers = $rulers; } else { $this->view->rulers = $rulerList; } }