Beispiel #1
0
 public function executeDelete(sfWebRequest $request)
 {
     $request->checkCSRFProtection();
     $this->forward404Unless($users = Doctrine_Core::getTable('Users')->find(array($request->getParameter('id'))), sprintf('Object users does not exist (%s).', $request->getParameter('id')));
     if ($users->getId() == $this->getUser()->getAttribute('id')) {
         $this->getUser()->setFlash('userNotices', array('type' => 'warning', 'text' => t::__('You can\'t delete yourself.')));
     } elseif (Users::countRelatedItemsByUsersId($users->getId()) == 0) {
         ExtraFieldsList::deleteFieldsByBindId($users->getId(), 'users');
         $users->delete();
         $this->getUser()->setFlash('userNotices', t::__('User Deleted'));
     } else {
         $users->setActive(0);
         $users->save();
         $this->getUser()->setFlash('userNotices', array('type' => 'warning', 'text' => t::__("User can't be  Deleted because it has related items. Currently user status set to Inactive and user can't login to the system.")));
     }
     $this->redirect('users/index');
 }
Beispiel #2
0
 public function executeDelete(sfWebRequest $request)
 {
     $this->forward404Unless($events = Doctrine_Core::getTable('Events')->find(array($request->getParameter('id'))), sprintf('Object events does not exist (%s).', $request->getParameter('id')));
     $this->checkAccess($request->getParameter('users_id'), 'manage');
     Attachments::deleteAttachmentsByBindId($events->getEventId(), 'events');
     ExtraFieldsList::deleteFieldsByBindId($events->getEventId(), 'events');
     $events->delete();
     if ($request->getParameter('users_id') > 0) {
         $this->redirect('scheduler/personal');
     } else {
         $this->redirect('scheduler/index');
     }
 }