function index($siteid, $slug, Request $request, Application $app) { global $CONFIG; $this->build($siteid, $slug, $request, $app); $form = $app['form.factory']->create(new ActionForm()); if ('POST' == $request->getMethod()) { $form->bind($request); if ($form->isValid()) { $data = $form->getData(); $action = new ActionParser($data['action']); if ($action->getCommand() == 'delete' && !$this->parameters['group']->getIsDeleted()) { $gr = new GroupRepository(); $gr->delete($this->parameters['group'], $app['currentUser']); return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId() . '/group/' . $this->parameters['group']->getSlug()); } else { if ($action->getCommand() == 'undelete' && $this->parameters['group']->getIsDeleted()) { $this->parameters['group']->setIsDeleted(false); $gr = new GroupRepository(); $gr->undelete($this->parameters['group'], $app['currentUser']); return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId() . '/group/' . $this->parameters['group']->getSlug()); } else { if ($action->getCommand() == 'isduplicateof') { $gr = new GroupRepository(); $originalGroup = $gr->loadBySlug($this->parameters['site'], $action->getParam(0)); if ($originalGroup && $originalGroup->getId() != $this->parameters['group']->getId()) { $gr->markDuplicate($this->parameters['group'], $originalGroup, $app['currentUser']); return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId() . '/group/' . $this->parameters['group']->getSlug()); } } else { if ($action->getCommand() == 'purge' && $CONFIG->sysAdminExtraPurgeGroupPassword && $CONFIG->sysAdminExtraPurgeGroupPassword == $action->getParam(0)) { $gr = new GroupRepository(); $gr->purge($this->parameters['group']); return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId() . '/group/'); } } } } } } $this->parameters['form'] = $form->createView(); return $app['twig']->render('sysadmin/group/index.html.twig', $this->parameters); }