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; }