protected function getSelectionChoices()
 {
     $choices = [];
     foreach ($this->sectionService->loadSections() as $section) {
         $choices[$section->id] = $section->name;
     }
     return $choices;
 }
Пример #2
0
 /**
  * List sections.
  *
  * @return \eZ\Publish\Core\REST\Server\Values\SectionList
  */
 public function listSections(Request $request)
 {
     if ($request->query->has('identifier')) {
         $sections = array($this->loadSectionByIdentifier($request));
     } else {
         $sections = $this->sectionService->loadSections();
     }
     return new Values\SectionList($sections, $request->getPathInfo());
 }
Пример #3
0
 /**
  * Renders the section list.
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function listAction()
 {
     $sectionList = $this->sectionService->loadSections();
     $contentCountBySectionId = [];
     $deleteFormsBySectionId = [];
     foreach ($sectionList as $section) {
         $sectionId = $section->id;
         $contentCountBySectionId[$sectionId] = $this->sectionService->countAssignedContents($section);
         $deleteFormsBySectionId[$sectionId] = $this->createForm(new SectionDeleteType($this->sectionService), ['sectionId' => $sectionId])->createView();
     }
     return $this->render('eZPlatformUIBundle:Section:list.html.twig', ['canEdit' => $this->isGranted(new Attribute('section', 'edit')), 'canAssign' => $this->isGranted(new Attribute('section', 'assign')), 'sectionList' => $sectionList, 'contentCountBySection' => $contentCountBySectionId, 'deleteFormsBySectionId' => $deleteFormsBySectionId]);
 }
Пример #4
0
 /**
  * Loads all sections.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user user is not allowed to read a section
  *
  * @return array of {@link \eZ\Publish\API\Repository\Values\Content\Section}
  */
 public function loadSections()
 {
     return $this->service->loadSections();
 }
Пример #5
0
 /**
  * Lets you select a section which will be used as limitation when assigning the role.
  *
  * @param Request $request
  * @param int $roleId Role ID
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function assignRoleBySectionLimitationAction(Request $request, $roleId)
 {
     return $this->render('eZPlatformUIBundle:Role:assign_role_by_section.html.twig', ['role' => $this->roleService->loadRole($roleId), 'sections' => $this->sectionService->loadSections(), 'can_assign' => $this->isGranted(new Attribute('role', 'assign'))]);
 }