public function executeDelete(sfWebRequest $request) { $request->checkCSRFProtection(); $this->forward404Unless($projects = Doctrine_Core::getTable('Projects')->createQuery()->addWhere('id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object projects does not exist (%s).', $request->getParameter('projects_id'))); $this->checkProjectsAccess($projects); Users::checkAccess($this, 'delete', 'projectsComments', $this->getUser(), $projects->getId()); $this->forward404Unless($projects_comments = Doctrine_Core::getTable('ProjectsComments')->find(array($request->getParameter('id'))), sprintf('Object projects_comments does not exist (%s).', $request->getParameter('id'))); $this->checkViewOwnAccess($projects_comments, $projects); $projects_comments->delete(); Attachments::resetAttachments(); $this->redirect('projectsComments/index?projects_id=' . $projects_comments->getProjectsId()); }
public function executeDoMultipleDelete(sfWebRequest $request) { $access = Users::getAccessSchema($request->getParameter('table'), $this->getUser()); if (!$access['delete']) { $this->redirect('accessForbidden/index'); } if ($selected_items = $request->getParameter('selected_items')) { if (strlen($selected_items) > 0) { Doctrine_Query::create()->delete()->from($request->getParameter('table'))->whereIn('id', explode(',', $selected_items))->execute(); Attachments::resetAttachments(); } } $this->redirect($request->getParameter('table') . '/index' . (($projects_id = $request->getParameter('projects_id')) > 0 ? '?projects_id=' . $projects_id : '')); }
public function executeDelete(sfWebRequest $request) { if ($request->getParameter('projects_id') > 0) { $this->forward404Unless($projects = Doctrine_Core::getTable('Projects')->createQuery()->addWhere('id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object projects does not exist (%s).', $request->getParameter('projects_id'))); $this->forward404Unless($tickets = Doctrine_Core::getTable('Tickets')->createQuery()->addWhere('id=?', $request->getParameter('id'))->addWhere('projects_id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object tickets does not exist (%s).', $request->getParameter('id'))); $this->checkProjectsAccess($projects); $this->checkTicketsAccess('delete', $tickets, $projects); } else { $this->forward404Unless($tickets = Doctrine_Core::getTable('Tickets')->find(array($request->getParameter('id'))), sprintf('Object tickets does not exist (%s).', $request->getParameter('id'))); $this->checkTicketsAccess('delete', $tickets); } $tickets->delete(); Attachments::resetAttachments(); $this->redirect_to($request->getParameter('redirect_to'), $tickets->getProjectsId(), $tickets->getId(), $request); }
public function executeDelete(sfWebRequest $request) { $this->forward404Unless($projects = Doctrine_Core::getTable('Projects')->createQuery()->addWhere('id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object projects does not exist (%s).', $request->getParameter('projects_id'))); $this->forward404Unless($discussions = Doctrine_Core::getTable('Discussions')->createQuery()->addWhere('id=?', $request->getParameter('id'))->addWhere('projects_id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object discussions does not exist (%s).', $request->getParameter('id'))); $this->checkProjectsAccess($projects); $this->checkDiscussionsAccess('delete', $discussions, $projects); $discussions->delete(); Attachments::resetAttachments(); $this->redirect_to($request->getParameter('redirect_to'), $discussions->getProjectsId(), $discussions->getId()); }
public function executeDelete(sfWebRequest $request) { $request->checkCSRFProtection(); $this->forward404Unless($projects = Doctrine_Core::getTable('Projects')->find(array($request->getParameter('id'))), sprintf('Object projects does not exist (%s).', $request->getParameter('id'))); $this->checkProjectsAccess('delete', $projects); $projects->delete(); Attachments::resetAttachments(); $this->redirect('projects/index'); }
public function executeDelete(sfWebRequest $request) { $this->forward404Unless($projects = Doctrine_Core::getTable('Projects')->createQuery()->addWhere('id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object projects does not exist (%s).', $request->getParameter('projects_id'))); $this->forward404Unless($tasks = Doctrine_Core::getTable('Tasks')->createQuery()->addWhere('id=?', $request->getParameter('id'))->addWhere('projects_id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object tasks does not exist (%s).', $request->getParameter('id'))); $this->checkProjectsAccess($projects); $this->checkTasksAccess('delete', $tasks, $projects); $tasks->delete(); Attachments::resetAttachments(); $this->redirect('tasks/index' . $this->add_pid($request)); }
public function executeDelete(sfWebRequest $request) { $request->checkCSRFProtection(); if ($request->getParameter('projects_id') > 0) { $this->forward404Unless($this->projects = Doctrine_Core::getTable('Projects')->createQuery()->addWhere('id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object projects does not exist (%s).', $request->getParameter('projects_id'))); $this->forward404Unless($this->tickets = Doctrine_Core::getTable('Tickets')->createQuery()->addWhere('id=?', $request->getParameter('tickets_id'))->addWhere('projects_id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object tasks does not exist (%s).', $request->getParameter('tickets_id'))); $this->checkProjectsAccess($this->projects); $this->checkTicketsAccess('view', $this->tickets, $this->projects); } else { $this->forward404Unless($this->tickets = Doctrine_Core::getTable('Tickets')->find($request->getParameter('tickets_id')), sprintf('Object tasks does not exist (%s).', $request->getParameter('tickets_id'))); $this->checkTicketsAccess('view', $this->tickets); } Users::checkAccess($this, 'delete', 'ticketsComments', $this->getUser(), $request->getParameter('projects_id')); $this->forward404Unless($tickets_comments = Doctrine_Core::getTable('TicketsComments')->find(array($request->getParameter('id'))), sprintf('Object tickets_comments does not exist (%s).', $request->getParameter('id'))); $tickets_comments->delete(); Attachments::resetAttachments(); $this->redirect('ticketsComments/index?tickets_id=' . $request->getParameter('tickets_id') . ($request->getParameter('projects_id') > 0 ? '&projects_id=' . $request->getParameter('projects_id') : '')); }