public function indexAction() { if (!Zend_Auth::getInstance()->hasIdentity()) { return $this->_redirect('/'); } $user = new Zend_Session_Namespace('user'); $user_id = $user->user['id']; $history_array = array(); if ($this->_store_url) { $history_url_mapper = new Application_Model_HistoryUrlMapper(); $params = array('where' => 'user_id = ' . $user_id, 'order' => 'created DESC'); $history_url = $history_url_mapper->select($params); if ($history_url) { $history_array = $history_url; } } else { $history_mapper = new Application_Model_HistoryMapper(); $params = array('where' => 'user_id = ' . $user_id, 'order' => 'created DESC'); $history = $history_mapper->select($params); if ($history) { $controller_mapper = new Application_Model_ControllerMapper(); $action_mapper = new Application_Model_ActionMapper(); foreach ($history as $row) { $controller = $controller_mapper->find($row->getController_id()); $action = $action_mapper->find($row->getAction_id()); if ($controller && $action) { $controller = $controller->getController(); $action = $action->getAction(); $url = '/' . ($controller != 'index' ? $controller : ''); $url .= $action != 'index' ? '/' . $action : ''; $history_array[] = array('controller' => $controller, 'action' => $action, 'url' => $url, 'created' => $row->getCreated()); } } } } $this->view->store_url = $this->_store_url; $this->view->history = $history_array; }