protected function getSelectionChoices() { $choices = []; foreach ($this->sectionService->loadSections() as $section) { $choices[$section->id] = $section->name; } return $choices; }
/** * 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()); }
/** * 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]); }
/** * 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(); }
/** * 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'))]); }