getRestParam(0)) { $this->redirect($this->finalUrl() . '/' . reset($this->_roles)); } return parent::exec(); } protected function _initAction() { parent::_initAction(); if ('list' == $this->_action) { $this->_initRole(); $this->_initFilter(); $this->_initPageHeader(); } return $this; } protected function _doList() { parent::_doList(); $alias = \App_Admin_View::getPage('fullAlias'); $this->_setBackUrl($this->_getBackUrl(), $alias); $alias = \App\TribalAccount\Admin\View::getPage('fullAlias'); $this->_setBackUrl($this->_getBackUrl(), $alias); return $this; } protected function _initRole() { $this->_role = $this->getRestParam(0); if (in_array($this->_role, $this->_roles)) { $this->_getDataObj()->setFilter('role', $this->_role); } else { $this->_doc->display404(); } return $this; } protected function _initFilter() { if ($this->_role == App_ViewControllerLog_Admin_Obj::ROLE_USER) { array_push($this->_filterFields, 'IP Address'); $this->_getDataObj()->appendFilterFields('INET_NTOA(ip)'); } $filter = []; if (null !== ($roleId = Qs_Request::getGetValue('roleId'))) { $filter['roleId'] = $roleId; } $this->_getDataObj()->addFilter($filter); return $this; } protected function _initPageHeader() { if ($this->_role == App_ViewControllerLog_Admin_Obj::ROLE_USER) { $this->_doc->setHeader('User\'s Login Activity'); } return $this; } protected function _getListOptions() { $options = parent::_getListOptions(); $options['role'] = $this->_getDataObj()->getFilter('role'); return $options; } protected function _getFilterFormOptions() { $options = parent::_getFilterFormOptions(); $options['roleOptions'] = $this->_getDataObj()->getRoleOptions(); $options['defaults'] = Qs_Request::getGet(); return $options; } }