function onThisStepProcessPage()
 {
     if ($this->request->request->get('action') == 'nogroup') {
         $this->draftEvent->setDetailsValue('group.none', true);
         $this->draftEvent->setDetailsValue('group.new', false);
         $this->isAllInformationGathered = true;
         return true;
     }
     if ($this->request->request->get('action') == 'selectgroup') {
         $gr = new GroupRepository();
         $group = $gr->loadBySlug($this->site, $this->request->request->get('group'));
         if ($group) {
             $this->draftEvent->setDetailsValue('group.new', false);
             $this->draftEvent->setDetailsValue('group.id', $group->getId());
             $this->draftEvent->setDetailsValue('group.title', $group->getTitle());
             $this->isAllInformationGathered = true;
             return true;
         }
     }
     if ($this->request->request->get('action') == 'selectnewgroup' && $this->request->request->get('newgrouptitle')) {
         $this->draftEvent->setDetailsValue('group.new', true);
         $this->draftEvent->setDetailsValue('group.title', $this->request->request->get('newgrouptitle'));
         $this->isAllInformationGathered = true;
         return true;
     }
 }
 function test1()
 {
     $user = new UserAccountModel();
     $user->setEmail("*****@*****.**");
     $user->setUsername("test");
     $user->setPassword("password");
     $userRepo = new UserAccountRepository();
     $userRepo->create($user);
     $site = new SiteModel();
     $site->setTitle("Test");
     $site->setSlug("test");
     $siteRepo = new SiteRepository();
     $siteRepo->create($site, $user, array(), $this->getSiteQuotaUsedForTesting());
     $group = new GroupModel();
     $group->setTitle("test");
     $group->setDescription("test test");
     $group->setUrl("http://www.group.com");
     $groupRepo = new GroupRepository();
     $groupRepo->create($group, $site, $user);
     $this->checkGroupInTest1($groupRepo->loadById($group->getId()));
     $this->checkGroupInTest1($groupRepo->loadBySlug($site, $group->getSlug()));
     $grb = new GroupRepositoryBuilder();
     $grb->setFreeTextsearch('test');
     $this->assertEquals(1, count($grb->fetchAll()));
     $grb = new GroupRepositoryBuilder();
     $grb->setFreeTextsearch('cats');
     $this->assertEquals(0, count($grb->fetchAll()));
 }
 protected function build($slug, Request $request, Application $app)
 {
     global $CONFIG;
     $this->parameters = array('currentUserWatchesGroup' => false, 'groupIsDuplicateOf' => null);
     if (strpos($slug, "-")) {
         $slug = array_shift(explode("-", $slug, 2));
     }
     $gr = new GroupRepository();
     $this->parameters['group'] = $gr->loadBySlug($app['currentSite'], $slug);
     if (!$this->parameters['group']) {
         return false;
     }
     if ($app['currentUser']) {
         $uwgr = new UserWatchesGroupRepository();
         $uwg = $uwgr->loadByUserAndGroup($app['currentUser'], $this->parameters['group']);
         $this->parameters['currentUserWatchesGroup'] = $uwg && $uwg->getIsWatching();
     }
     if ($this->parameters['group']->getIsDuplicateOfId()) {
         $this->parameters['groupIsDuplicateOf'] = $gr->loadByID($this->parameters['group']->getIsDuplicateOfId());
     }
     $app['currentUserActions']->set("org.openacalendar", "groupHistory", true);
     $app['currentUserActions']->set("org.openacalendar", "groupEditDetails", $app['currentUserPermissions']->hasPermission("org.openacalendar", "GROUPS_CHANGE") && $app['currentSite']->getIsFeatureGroup() && !$this->parameters['group']->getIsDeleted());
     $app['currentUserActions']->set("org.openacalendar", "groupEditMedia", $CONFIG->isFileStore() && $app['currentUserPermissions']->hasPermission("org.openacalendar", "GROUPS_CHANGE") && $app['currentSite']->getIsFeatureGroup() && !$this->parameters['group']->getIsDeleted());
     // There is curatedListGeneralEdit but we want to check details on this group to
     $app['currentUserActions']->set("org.openacalendar", "groupEditCuratedLists", $app['currentUserActions']->has("org.openacalendar", "curatedListGeneralEdit") && !$this->parameters['group']->getIsDeleted());
     $app['currentUserActions']->set("org.openacalendar", "groupNewEvent", $app['currentUserPermissions']->hasPermission("org.openacalendar", "EVENTS_CHANGE") && $app['currentSite']->getIsFeatureGroup() && !$this->parameters['group']->getIsDeleted());
     return true;
 }
 function newEvent(Request $request, Application $app)
 {
     /////////////////////////////////////////////////////// Set up incoming vars
     $newEventDraft = new NewEventDraftModel();
     $newEventDraft->setSiteId($app['currentSite']->getId());
     $newEventDraft->setUserAccountId($app['currentUser'] ? $app['currentUser']->getId() : null);
     $incomingData = array();
     // check for incoming date
     if (isset($_GET['date']) && trim($_GET['date'])) {
         $bits = explode("-", $_GET['date']);
         if (count($bits) == 3 && intval($bits[0]) && intval($bits[1]) && intval($bits[2])) {
             $incomingData['event.start_at'] = \TimeSource::getDateTime();
             $incomingData['event.start_at']->setTimezone(new \DateTimeZone($app['currentTimeZone']));
             $incomingData['event.start_at']->setDate($bits[0], $bits[1], $bits[2]);
             $incomingData['event.start_at']->setTime(9, 0, 0);
             $incomingData['event.end_at'] = clone $incomingData['event.start_at'];
             $incomingData['event.end_at']->setTime(17, 0, 0);
         }
     }
     // check for incoming area
     if (isset($_GET['area']) && trim($_GET['area'])) {
         $ar = new AreaRepository();
         $area = $ar->loadBySlug($app['currentSite'], $request->query->get('area'));
         if ($area) {
             $incomingData['area.id'] = $area->getId();
             $incomingData['area.title'] = $area->getTitle();
         }
     }
     // check for incoming group
     if (isset($_GET['group']) && trim($_GET['group'])) {
         $gr = new GroupRepository();
         $group = $gr->loadBySlug($app['currentSite'], $request->query->get('group'));
         if ($group) {
             $newEventDraft->setDetailsValue('group.id', $group->getId());
             $newEventDraft->setDetailsValue('group.title', $group->getTitle());
         }
     }
     /////////////////////////////////////////////////////// Check Permissions and Prompt IF NEEDED
     if (!$app['currentUser'] && !$app['currentUserActions']->has("org.openacalendar", "eventNew") && $app['anyVerifiedUserActions']->has("org.openacalendar", "eventNew")) {
         return $app['twig']->render('site/eventnew/new.useraccountneeded.html.twig', array('incomingData' => $incomingData));
     }
     if (!$app['currentUser']) {
         $app->abort(403, "Not allowed");
     }
     /////////////////////////////////////////////////////// Set up draft and start!
     foreach ($incomingData as $k => $v) {
         $newEventDraft->setDetailsValue('incoming.' . $k, $v);
     }
     $repo = new NewEventDraftRepository();
     $repo->create($newEventDraft);
     $steps = $this->getSteps($request, $app, $newEventDraft);
     $firstStepIdx = 0;
     // The first step is WHO but if group is already set we already know, and we want to jump straight to the next step!
     $steps[0]->processIsAllInformationGathered();
     if ($steps[0]->getIsAllInformationGathered()) {
         $firstStepIdx = 1;
     }
     return $app->redirect('/event/new/' . $newEventDraft->getSlug() . "/" . $steps[$firstStepIdx]->getStepID());
 }
 protected function build($slug, Request $request, Application $app)
 {
     $repo = new GroupRepository();
     $this->group = $repo->loadBySlug($app['currentSite'], $slug);
     if (!$this->group) {
         return false;
     }
     return true;
 }
 protected function build($slug, Request $request, Application $app)
 {
     $this->parameters = array();
     if (strpos($slug, "-") > 0) {
         $slugBits = explode("-", $slug, 2);
         $slug = $slugBits[0];
     }
     $gr = new GroupRepository();
     $this->parameters['group'] = $gr->loadBySlug($app['currentSite'], $slug);
     if (!$this->parameters['group']) {
         return false;
     }
     return true;
 }
 protected function build($slug, $gslug, Request $request, Application $app)
 {
     $this->parameters = array();
     $curatedlistRepository = new CuratedListRepository();
     $this->parameters['curatedlist'] = $curatedlistRepository->loadBySlug($app['currentSite'], $slug);
     if (!$this->parameters['curatedlist']) {
         return false;
     }
     $groupRepository = new GroupRepository();
     $this->parameters['group'] = $groupRepository->loadBySlug($app['currentSite'], $gslug);
     if (!$this->parameters['group']) {
         return false;
     }
     $this->parameters['currentUserCanEditCuratedList'] = $this->parameters['curatedlist']->canUserEdit($app['currentUser']);
     return true;
 }
 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);
 }
 public function setFromJSON($json)
 {
     if (isset($json->event)) {
         if (isset($json->event->summary)) {
             $this->summary = $json->event->summary;
         }
         if (isset($json->event->description)) {
             $this->description = $json->event->description;
         }
         if (isset($json->event->url)) {
             $this->url = $json->event->url;
         }
         $timezone = new \DateTimeZone($this->timezone);
         if (isset($json->event->start->str)) {
             $this->start_at = new \DateTime($json->event->start->str, $timezone);
         }
         if (isset($json->event->end->str)) {
             $this->end_at = new \DateTime($json->event->end->str, $timezone);
         }
         if (isset($json->event->country) && isset($json->event->country->code) && $json->event->country->code) {
             $countryRepo = new CountryRepository();
             // Delibrately setting NULL on failure so user gets an error message.
             $this->country = $countryRepo->loadByTwoCharCode($json->event->country->code);
             // TODO check allowed in this site
         }
         if (isset($json->event->timezone)) {
             // Delibrately setting NULL on failure so user gets an error message.
             $this->timezone = $this->country && in_array($json->event->timezone, $this->country->getTimezonesAsList()) ? $json->event->timezone : null;
         }
     }
     if (isset($json->site)) {
         $siteRepo = new SiteRepository();
         if (isset($json->site->id)) {
             $this->site = $siteRepo->loadById($json->site->id);
         }
         if (isset($json->site->slug)) {
             $this->site = $siteRepo->loadBySlug($json->site->slug);
         }
     }
     if (isset($json->user)) {
         $userRepo = new UserAccountRepository();
         if (isset($json->user->email)) {
             $this->user = $userRepo->loadByEmail($json->user->email);
         } else {
             if (isset($json->user->username)) {
                 $this->user = $userRepo->loadByUserName($json->user->username);
             }
         }
     }
     if (isset($json->group)) {
         $groupRepo = new GroupRepository();
         if (isset($json->group->slug) && $this->site) {
             $this->group = $groupRepo->loadBySlug($this->site, $json->group->slug);
         } else {
             if (isset($json->group->id)) {
                 $this->group = $groupRepo->loadById($json->group->id);
             }
         }
     }
 }
 function build(Application $app)
 {
     $this->paramaters = array('daysAheadInNextBox' => 3, 'showCharsOfDescription' => 0, 'refreshInMinutes' => 0, 'MAX_EVENT_QUERIES_ON_EVENT_BOARD' => self::$MAX_EVENT_QUERIES_ON_EVENT_BOARD, 'configParameters' => array());
     if (isset($_GET['daysAheadInNextBox']) && intval($_GET['daysAheadInNextBox']) >= 0) {
         $this->paramaters['daysAheadInNextBox'] = intval($_GET['daysAheadInNextBox']);
         $this->paramaters['configParameters']['daysAheadInNextBox'] = $_GET['daysAheadInNextBox'];
     }
     if (isset($_GET['showCharsOfDescription']) && intval($_GET['showCharsOfDescription']) >= 0) {
         $this->paramaters['showCharsOfDescription'] = intval($_GET['showCharsOfDescription']);
         $this->paramaters['configParameters']['showCharsOfDescription'] = $_GET['showCharsOfDescription'];
     }
     if (isset($_GET['refreshInMinutes']) && intval($_GET['refreshInMinutes']) >= 0) {
         $this->paramaters['refreshInMinutes'] = intval($_GET['refreshInMinutes']);
         $this->paramaters['configParameters']['refreshInMinutes'] = $_GET['refreshInMinutes'];
     }
     $areaRepository = new AreaRepository();
     $groupRepository = new GroupRepository();
     $venueRepository = new VenueRepository();
     $this->paramaters['data'] = array();
     for ($i = 0; $i <= self::$MAX_EVENT_QUERIES_ON_EVENT_BOARD; $i++) {
         $area = null;
         if (isset($_GET['eventArea' . $i])) {
             $area = $this->getIdFromPassedVariable($_GET['eventArea' . $i]);
             $this->paramaters['configParameters']['eventArea' . $i] = $_GET['eventArea' . $i];
         }
         $group = null;
         if (isset($_GET['eventGroup' . $i])) {
             $group = $this->getIdFromPassedVariable($_GET['eventGroup' . $i]);
             $this->paramaters['configParameters']['eventGroup' . $i] = $_GET['eventGroup' . $i];
         }
         $venue = null;
         if (isset($_GET['eventVenue' . $i])) {
             $venue = $this->getIdFromPassedVariable($_GET['eventVenue' . $i]);
             $this->paramaters['configParameters']['eventVenue' . $i] = $_GET['eventVenue' . $i];
         }
         if ($area || $group || $venue) {
             $queryData = array('area' => null, 'group' => null, 'venue' => null, 'minorImportance' => false, 'query' => new EventRepositoryBuilder());
             $queryData['query']->setSite($app['currentSite']);
             $queryData['query']->setAfterNow();
             $queryData['query']->setIncludeDeleted(false);
             if ($area) {
                 $areaObj = $areaRepository->loadBySlug($app['currentSite'], $area);
                 if ($areaObj) {
                     $queryData['area'] = $areaObj;
                     $queryData['query']->setArea($areaObj);
                 }
             }
             if ($group) {
                 $groupObj = $groupRepository->loadBySlug($app['currentSite'], $group);
                 if ($groupObj) {
                     $queryData['group'] = $groupObj;
                     $queryData['query']->setGroup($groupObj);
                 }
             }
             if ($venue) {
                 $venueObj = $venueRepository->loadBySlug($app['currentSite'], $venue);
                 if ($venueObj) {
                     $queryData['venue'] = $venueObj;
                     $queryData['query']->setVenue($venueObj);
                 }
             }
             if (isset($_GET['eventMinorImportance' . $i]) && $_GET['eventMinorImportance' . $i] == 'yes') {
                 $queryData['minorImportance'] = true;
                 $this->paramaters['configParameters']['eventMinorImportance' . $i] = 'yes';
             }
             $this->paramaters['data'][] = $queryData;
         }
     }
     if (count($this->paramaters['data']) == 0) {
         $queryData = array('area' => null, 'group' => null, 'venue' => null, 'minorImportance' => false, 'query' => new EventRepositoryBuilder());
         $queryData['query']->setSite($app['currentSite']);
         $queryData['query']->setAfterNow();
         $queryData['query']->setIncludeDeleted(false);
         $this->paramaters['data'][] = $queryData;
     }
 }
 function editGroups($slug, Request $request, Application $app)
 {
     if (!$this->build($slug, $request, $app)) {
         $app->abort(404, "Event does not exist.");
     }
     $groupRepo = new GroupRepository();
     if ('POST' == $request->getMethod() && $request->request->get('CSFRToken') == $app['websession']->getCSFRToken()) {
         if ($request->request->get('addGroup')) {
             $group = $groupRepo->loadBySlug($app['currentSite'], $request->request->get('addGroup'));
             if ($group) {
                 $groupRepo->addEventToGroup($this->parameters['event'], $group, $app['currentUser']);
                 // Need to redirect here so other parts of page are correct when shown
                 return $app->redirect("/event/" . $this->parameters['event']->getSlugForURL() . '/edit/groups');
             }
         } elseif ($request->request->get('removeGroup')) {
             $group = $groupRepo->loadBySlug($app['currentSite'], $request->request->get('removeGroup'));
             if ($group) {
                 $groupRepo->removeEventFromGroup($this->parameters['event'], $group, $app['currentUser']);
                 // Need to redirect here so other parts of page are correct when shown
                 return $app->redirect("/event/" . $this->parameters['event']->getSlugForURL() . '/edit/groups');
             }
         }
     }
     $this->parameters['groupListFilterParams'] = new GroupFilterParams();
     $this->parameters['groupListFilterParams']->set($_GET);
     $this->parameters['groupListFilterParams']->getGroupRepositoryBuilder()->setSite($app['currentSite']);
     $this->parameters['groupListFilterParams']->getGroupRepositoryBuilder()->setIncludeDeleted(false);
     $this->parameters['groupListFilterParams']->getGroupRepositoryBuilder()->setLimit(30);
     $this->parameters['groupListFilterParams']->getGroupRepositoryBuilder()->setNotEvent($this->parameters['event']);
     $this->parameters['groupsToAdd'] = $this->parameters['groupListFilterParams']->getGroupRepositoryBuilder()->fetchAll();
     return $app['twig']->render('site/event/edit.groups.html.twig', $this->parameters);
 }
 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() == 'addgroup') {
                 $gr = new GroupRepository();
                 $group = $gr->loadBySlug($this->parameters['site'], $action->getParam(0));
                 if ($group) {
                     $gr->addEventToGroup($this->parameters['event'], $group, $app['currentUser']);
                     return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId() . '/event/' . $this->parameters['event']->getSlug());
                 }
             } else {
                 if ($action->getCommand() == 'removegroup') {
                     $gr = new GroupRepository();
                     $group = $gr->loadBySlug($this->parameters['site'], $action->getParam(0));
                     if ($group) {
                         $gr->removeEventFromGroup($this->parameters['event'], $group, $app['currentUser']);
                         return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId() . '/event/' . $this->parameters['event']->getSlug());
                     }
                 } else {
                     if ($action->getCommand() == 'maingroup') {
                         $gr = new GroupRepository();
                         $group = $gr->loadBySlug($this->parameters['site'], $action->getParam(0));
                         if ($group) {
                             $gr->setMainGroupForEvent($group, $this->parameters['event'], $app['currentUser']);
                             return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId() . '/event/' . $this->parameters['event']->getSlug());
                         }
                     } else {
                         if ($action->getCommand() == 'delete' && !$this->parameters['event']->getIsDeleted()) {
                             $er = new EventRepository();
                             $er->delete($this->parameters['event'], $app['currentUser']);
                             return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId() . '/event/' . $this->parameters['event']->getSlug());
                         } else {
                             if ($action->getCommand() == 'undelete' && $this->parameters['event']->getIsDeleted()) {
                                 $this->parameters['event']->setIsDeleted(false);
                                 $er = new EventRepository();
                                 $er->undelete($this->parameters['event'], $app['currentUser']);
                                 return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId() . '/event/' . $this->parameters['event']->getSlug());
                             } else {
                                 if ($action->getCommand() == 'cancel' && !$this->parameters['event']->getIsDeleted()) {
                                     $er = new EventRepository();
                                     $er->cancel($this->parameters['event'], $app['currentUser']);
                                     return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId() . '/event/' . $this->parameters['event']->getSlug());
                                 } else {
                                     if ($action->getCommand() == 'uncancel' && $this->parameters['event']->getIsCancelled()) {
                                         $er = new EventRepository();
                                         $er->uncancel($this->parameters['event'], $app['currentUser']);
                                         return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId() . '/event/' . $this->parameters['event']->getSlug());
                                     } else {
                                         if ($action->getCommand() == 'addcuratedlist') {
                                             $clr = new CuratedListRepository();
                                             $curatedList = $clr->loadBySlug($this->parameters['site'], $action->getParam(0));
                                             if ($curatedList) {
                                                 $clr->addEventtoCuratedList($this->parameters['event'], $curatedList, $app['currentUser']);
                                                 return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId() . '/curatedlist/' . $curatedList->getSlug());
                                             }
                                         } else {
                                             if ($action->getCommand() == 'removecuratedlist') {
                                                 $clr = new CuratedListRepository();
                                                 $curatedList = $clr->loadBySlug($this->parameters['site'], $action->getParam(0));
                                                 if ($curatedList) {
                                                     $clr->removeEventFromCuratedList($this->parameters['event'], $curatedList, $app['currentUser']);
                                                     return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId() . '/curatedlist/' . $curatedList->getSlug());
                                                 }
                                             } else {
                                                 if ($action->getCommand() == 'isduplicateof') {
                                                     $er = new EventRepository();
                                                     $originalEvent = $er->loadBySlug($this->parameters['site'], $action->getParam(0));
                                                     if ($originalEvent && $originalEvent->getId() != $this->parameters['event']->getId()) {
                                                         $er->markDuplicate($this->parameters['event'], $originalEvent, $app['currentUser']);
                                                         return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId() . '/event/' . $this->parameters['event']->getSlug());
                                                     }
                                                 } else {
                                                     if ($action->getCommand() == 'isnotduplicate') {
                                                         $er = new EventRepository();
                                                         $eventEditMetaData = new EventEditMetaDataModel();
                                                         $eventEditMetaData->setUserAccount($app['currentUser']);
                                                         $eventEditMetaData->setFromRequest($request);
                                                         $er->markNotDuplicateWithMetaData($this->parameters['event'], $eventEditMetaData);
                                                         return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId() . '/event/' . $this->parameters['event']->getSlug());
                                                     } else {
                                                         if ($action->getCommand() == 'purge' && $CONFIG->sysAdminExtraPurgeEventPassword && $CONFIG->sysAdminExtraPurgeEventPassword == $action->getParam(0)) {
                                                             $er = new EventRepository();
                                                             $er->purge($this->parameters['event']);
                                                             return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId() . '/event/');
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $groupRB = new GroupRepositoryBuilder();
     $groupRB->setEvent($this->parameters['event']);
     $this->parameters['groups'] = $groupRB->fetchAll();
     $this->parameters['form'] = $form->createView();
     return $app['twig']->render('sysadmin/event/index.html.twig', $this->parameters);
 }