public function findPanelsAfter(PanelFacet $panel) { $dql = ' SELECT pf FROM Claroline\\CoreBundle\\Entity\\Facet\\PanelFacet pf WHERE pf.facet = :facetId AND pf.position > :position '; $query = $this->_em->createQuery($dql); $query->setParameter('facetId', $panel->getFacet()->getId()); $query->setParameter('position', $panel->getPosition()); return $query->getResult(); }
/** * @param Facet $facet */ public function setPanelFacet(PanelFacet $panelFacet) { $panelFacet->addFieldFacet($this); $this->panelFacet = $panelFacet; }
/** * Order the fields of a panel according to the $ids order. * * @param array $ids * @param PanelFacet $facet */ public function orderFields(array $ids, PanelFacet $panel) { $fields = $panel->getFieldsFacet(); foreach ($fields as $field) { foreach ($ids as $key => $id) { if ($id === $field->getId()) { $field->setPosition($key); $this->om->persist($field); } } } $this->om->flush(); }
public function checkPanelEdit(TokenInterface $token, PanelFacet $panel) { $userRoles = array_map(function ($el) { return $el->getRole(); }, $token->getRoles()); $panelRoles = $panel->getPanelFacetsRole(); foreach ($panelRoles as $panelRole) { if (in_array($panelRole->getRole()->getName(), $userRoles)) { if ($panelRole->canEdit()) { return VoterInterface::ACCESS_GRANTED; } } } return VoterInterface::ACCESS_DENIED; }
public function setPanelFacet(PanelFacet $panelFacet) { $this->panelFacet = $panelFacet; $panelFacet->addPanelFacetRole($this); }
public function setPanelEditable(PanelFacet $panel, $bool) { $panel->setIsEditable($bool); $this->om->persist($panel); $this->om->flush(); }