_messageTemplates[self::MSG_SELECT_CLASS] = 'Please select the classes and year 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 (($class = Qs_Request::getGetValue('class')) && ($year = Qs_Request::getGetValue('year'))) { $this->_getDataObj()->addFilter(array('class' => $class, 'year' => (int) $year)); } else { $this->_doc->display404(); } } return $this; } protected function _getDefaultLinks() { $links = parent::_getDefaultLinks(); $this->_prepareReorderLink($links); return $links; } protected function _prepareReorderLink(array &$links) { $links['reorder'] = array('title' => 'Reorder ' . $this->getConfig('itemsName')); if (($class = $this->_getDataObj()->getFilter('class')) && ($year = $this->_getDataObj()->getFilter('year'))) { $links['reorder']['url'] = $this->url(array( 'action' => 'reorder', 'class' => $class, 'year' => (int) $year )); } else { $msg = htmlentities($this->_createMessage(self::MSG_SELECT_CLASS)); $links['reorder']['attribs'] = array( 'class' => 'warning', 'onclick' => "alert('{$msg}'); return false;" ); $links['reorder']['url'] = '#'; } return $links; } protected function _getReorderForm(array $options = array()) { $form = parent::_getReorderForm($options); if (($class = $this->_getDataObj()->getFilter('class') && $year = $this->_getDataObj()->getFilter('year'))) { $form->setAction($this->url(array('action' => 'updateOrder', 'class' => $class, 'year' => $year))); } return $form; } }