getRestParams(); if ($params) { if (count($params) > 1) { $this->_do404(); } $this->_getDataObj()->setPrimaryKeyByAlias($params[0]); $this->setDefaultAction('view'); } return parent::exec(); } public function preDispatch(&$items) { if (null != $this->_restAlias) { $htmlBlockIndex = null; foreach ($items as $index => $item) { if ($item['type'] == 'HtmlBlock_') { $htmlBlockIndex = $index; break; } } if (null !== $htmlBlockIndex) { unset($items[$htmlBlockIndex]); } } return $this; } protected function _prepareViewItem(array &$item) { $item['title'] = $item['name']; $item['config'] = $this->getConfig()->toArray(); $item['config']['itemName'] = 'Member Directory'; if ('y' == $item['pmEnabled'] && $item['id'] != $this->_doc->getAuthData('id')) { $item['sendMessageUrl'] = WebMailView::getPage('url') . '?action=new&toUserId={id}'; } return parent::_prepareViewItem($item); } protected function _initDetailsPage(array $item) { Qs_Navigation::append(['title' => $item['title']]); return parent::_initDetailsPage($item); } protected function getData() { return $this->_getDataObj()->getDataForView(); } protected function _isItemAccessible(array $item) { return parent::_isItemAccessible($item) && Entity::STATUS_ACTIVE == $item['status']; } public static function getViewUrl($id = null) { $url = static::getPage('url'); if ($id) { return $url . '/' . $id; } return $url . '/%s'; } protected function _getListItem() { $item = parent::_getListItem(); if (($filter = array_filter($this->_getDataObj()->getFilter()))) { if (array_key_exists('lastNameStart', $filter)) { unset($filter['lastNameStart']); } } $url = $this->url($filter) . ($filter ? '&' : '?') . 'lastNameStart={lastNameStart}'; $item['lastNameStartFilter'] = [ 'options' => ['' => 'All'] + (array) $this->_getDataObj()->getLastNameAlphabet(), 'value' => $this->_getDataObj()->getFilter('lastNameStart'), 'url' => $url, ]; return $item; } }