/** * Löscht eine CollectionRole. */ public function deleteAction() { try { $collectionRoleModel = new Admin_Model_CollectionRole($this->getRequest()->getParam('roleid', '')); $collectionRoleModel->delete(); $collectionRoleModel->getObject()->getDisplayName(); $message = $this->view->translate('admin_collectionroles_delete', $collectionRoleModel->getObject()->getName()); return $this->_redirectTo('index', $message); } catch (Application_Exception $e) { return $this->_redirectToAndExit('index', array('failure' => $e->getMessage())); } }
public function testMove() { $colRole = new Opus_CollectionRole(); $colRole->setName('MoveTestColRole-Name'); $colRole->setOaiName('MoveTestColRole-OaiName'); $colRole->setDisplayFrontdoor('Number'); $colRole->setDisplayBrowsing('Name'); $colRole->setPosition(100); $this->moveTestColId = $colRole->store(); $colRoles = Opus_CollectionRole::fetchAll(); $colRolesCount = count($colRoles); $this->assertEquals($this->moveTestColId, $colRoles[$colRolesCount - 1]->getId()); $this->assertEquals($this->collectionRoleId, $colRoles[$colRolesCount - 2]->getId()); $model = new Admin_Model_CollectionRole($this->collectionRoleId); $model->move(100); $colRoles = Opus_CollectionRole::fetchAll(); $colRolesCount = count($colRoles); // Reihenfolge ist jetzt vertauscht $this->assertEquals($this->collectionRoleId, $colRoles[$colRolesCount - 1]->getId()); $this->assertEquals($this->moveTestColId, $colRoles[$colRolesCount - 2]->getId()); }