_messageTemplates[self::MSG_SELECT_PAGE] = 'Please select one of the Leadership Groups in the "Search" ' . 'dropdown above to reorder its %itemsName%.'; return parent::_init(); } protected function _initAction() { parent::_initAction(); if ('reorder' === $this->_action || 'updateOrder' === $this->_action) { if (App_User_Admin_Obj::SORTER_LEADERSHIP == Qs_Request::getGetValue('type') && ($leadership = Qs_Request::getGetValue('leadership')) ) { $this->_getDataObj()->addFilter(array('groupId' => (int) $leadership)); } else { $this->_doc->display404(); } } return $this; } protected function _doGetUser4Json() { $this->_doGetUser4JsonAjax(); } protected function _doGetUser4JsonAjax() { $this->_displayJson($this->_getDataObj()->getUser4Json(\Qs_Request::getGetValue('term'))); } public static function getUrl4UserJson() { return static::getPage('url') . '?action=getUser4Json'; } public static function getAutocompleteNameEmailUrl() { if (($url = static::getPage('url'))) { $url .= '?action=autocompleteNameEmail'; } return $url; } protected function _doAutocompleteNameEmail() { exit; } /** * get param: string $term */ protected function _doAutocompleteNameEmailAjax() { $term = \Qs_Request::getGetValue('term'); $data = $this->_getDataObj()->getAutocompleteNameEmail($term); $this->_displayJson($data); } protected function _getDefaultLinks() { $links = parent::_getDefaultLinks(); $this->_prepareReorderLink($links); return $links; } protected function _prepareReorderLink(array &$links) { $links['reorder'] = array('title' => 'Reorder ' . $this->getConfig('itemsName') . ' in Leadership Group'); if (($leadership = $this->_getDataObj()->getFilter('leadership'))) { $links['reorder']['url'] = $this->url( array( 'action' => 'reorder', 'leadership' => (int) $leadership, 'type' => App_User_Admin_Obj::SORTER_LEADERSHIP ) ); } else { $msg = htmlentities($this->_createMessage(self::MSG_SELECT_PAGE)); $links['reorder']['attribs'] = array( 'class' => 'warning', 'onclick' => "alert('{$msg}'); return false;" ); $links['reorder']['url'] = '#'; } return $links; } protected function _getReorderForm(array $options = array()) { $query = Qs_Request::getGet(); $query['action'] = 'updateOrder'; $options['action'] = $this->url($query); return parent::_getReorderForm($options); } /** * @param int|null $params - committeeId * @return string */ public static function getFilterByCommitteeListUrl($params) { $id = ctype_digit($params) ? $params : ''; return static::getPage('url') . '?committeeId=' . $id; } }