Example #1
0
 /**
  * @EXT\Route(
  *     "/{groupId}",
  *     name="claro_admin_group_settings_form",
  *     requirements={"groupId"="^(?=.*[1-9].*$)\d*$"}
  * )
  * @EXT\ParamConverter(
  *      "group",
  *      class="ClarolineCoreBundle:Group",
  *      options={"id" = "groupId", "strictId" = true}
  * )
  * @EXT\Template
  *
  * Displays an edition form for a group.
  *
  * @param Group $group
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function settingsFormAction(Group $group)
 {
     $roles = $group->getPlatformRole();
     $form = $this->formFactory->create(FormFactory::TYPE_GROUP_SETTINGS, array('isAdmin' => true, 'roles' => $roles), $group);
     $unavailableRoles = [];
     $roles = $this->roleManager->getAllPlatformRoles();
     foreach ($roles as $role) {
         $isAvailable = $this->roleManager->validateRoleInsert($group, $role);
         if (!$isAvailable) {
             $unavailableRoles[] = $role;
         }
     }
     return array('group' => $group, 'form_settings' => $form->createView(), 'unavailableRoles' => $unavailableRoles);
 }