getRestParams(); if (count($params) == 1) { if (is_numeric($params[0])) { $this->_setCategoryId($params[0]); $header = 'Manage ' . $this->getConfig('itemsName') . ' in "' . $this->_getDataObj()->categoryTitle . '" Album'; $this->_doc->setHeader($header); if (!isset($_REQUEST['action'])) { $this->_getDataObj()->addFilter(array('idCategory' => $params[0])); } } } else { $this->_do404(); } return parent::exec(); } protected function _setCategoryId($id) { if (!($this->_getDataObj()->setCategoryId($id))) { $this->_doc->display404(); } return $this; } protected function _getCategoryId() { if (!($categoryId = $this->_getDataObj()->categoryId)) { $this->_doc->display404(); } return $categoryId; } protected function _getNewForm(array $options = array()) { $form = parent::_getNewForm($options); $this->_setFormAlbumTitle($form); return $form; } protected function _getEditForm(array $options = array()) { $form = parent::_getEditForm($options); $this->_setFormAlbumTitle($form); return $form; } protected function _setFormAlbumTitle(\Qs_Form $form) { $form->setDefault('albumTitle', $this->_getDataObj()->categoryTitle); return $this; } protected function _getDefaultLinks() { $links = parent::_getDefaultLinks(); $fullAlias = \Qs_SiteMap::findFirst(null, array('type' => 'Gallery\\Category\\Admin\\'), null, 'fullAlias'); if (false !== $fullAlias) { $link = array('title' => 'Manage Albums', 'url' => $fullAlias); array_unshift($links, $link); } return $links; } protected function _initFromForm(\Qs_Form $form) { $data = $form->getValues(); $data['idCategory'] = $this->_getCategoryId(); $this->_getDataObj()->initFromForm($data); return $this; } }