/**
  * 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;
 }
 /**
  * Update the User informations in the Database
  *
  * @return array
  */
 public function saveEditUserAction()
 {
     $validate = new App_Validate_Ajax();
     $groupModel = new Admin_Model_DbTable_Groups();
     $userModel = new Admin_Model_DbTable_Users();
     $groupRow = new Admin_Model_DbRow_Group($groupModel->find($this->request->getParam('groupid', 0)));
     $userRow = new Admin_Model_DbRow_User($userModel->find($this->request->getParam('id', 0)));
     $errors = array();
     // create the validator map
     $validatorMap = array('name' => array('validators' => array(), 'message' => 'Fullname cannot be emtpy'), 'username' => array('validators' => array(), 'message' => 'Username cannot be emtpy'), 'email' => array('validators' => array('EmailAddress'), 'message' => 'E-Mailaddress is empty or not valid'), 'group' => array('validators' => array(), 'message' => 'Please select a group'));
     if (!$userRow->get('id')) {
         $errors[] = 'Unknown UserId';
     } else {
         if ($userRow->get('username') !== $this->request->getParam('username', '')) {
             $dubUserName = $userModel->fetchRowByUserName($this->request->getParam('username', ''));
             if ($dubUserName) {
                 $errors[] = 'Username already exists';
             }
         }
     }
     if (!$groupRow->get('id')) {
         $errors[] = 'Unknown or no group selected';
     }
     if ($validate->isValid($this->request->getParams(), $validatorMap, TRUE) == FALSE || count($errors) > 0) {
         return $this->responseFailure('Failed Saving informations', array_merge($errors, $validate->getMessages()));
     } else {
         $user = new Admin_Model_DbRow_User($this->request->getParams());
         $userModel->update($user->toDbArray(), $user->get('id'));
         return $this->responseSuccess(array('users' => array($user->toJsonArray())));
     }
 }