/** * Delete a Group * * @access public * @todo FIXME: somehow the App_Form_Delete Form is gone, not working ATM! */ public function deleteAction() { $groupRow = new Admin_Model_DbRow_Group($this->dbGroups->find($this->checkGroupIdParam())); $linkedUsers = $this->dbGroups->fetchUsersAssignedToGroup($groupRow->get('id')); $form = new App_Form_Delete($groupRow); //FIXME: File is gone, rewrite if ($linkedUsers->count() > 0) { $this->view->message = 'There are users linked to this group. Cannot delete!'; $this->renderScript('error/deletenotpossible.phtml'); } else { if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getParams()) && $form->getElement('del_checkbox')->isChecked() === TRUE) { $this->dbGroups->deleteById($groupRow->get('id')); $this->_redirect('admin/group/index'); } else { $form->setDescription('Failed to delete group. Unknown error occured.'); } } } $this->view->form = $form; $this->view->group = $groupRow; }
/** * Delete a user (soft delete) * * @view /views/scripts/user/delete.phtml * @access public * @todo FIXME: The App_Form_Delete is missing somehow, this does not work * @todo DB Cols in the Controller, remove them through the DbRow_User class */ public function deleteAction() { $userRow = new Admin_Model_DbRow_User($this->dbUser->find($this->checkUserIdParam())); $form = new App_Form_Delete($userRow); //FIXME: this file is missing if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getParams()) && $form->getElement('del_checkbox')->isChecked() === TRUE) { //FIXME: Here we have some DB Columns in the controller // Find a solution with the DbRow_User Class $this->dbUser->update(array('uu_deleted' => date('Y-m-d H:i:s', time())), $this->dbUser->getAdapter()->quoteInto('uu_id = ?', $userRow->get('id'), Zend_Db::PARAM_INT)); $this->_redirect('admin/user/index'); } else { $form->setDescription('Failed to delete the user'); } } $this->view->form = $form; $this->view->user = $userRow; }