public function generateLogoInserterLinkAction(Section $section)
 {
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, sprintf('http://logoinserter.esnlille.fr/api/%s', $section->getCodeSection()));
     curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     $response = curl_exec($ch);
     return $response;
 }
 private function canAccess(Section $section, User $user)
 {
     return $user->getSection()->getCodeSection() === $section->getCodeSection() || $user->hasRole(User::ROLE_ADMIN);
 }
 /**
  * Check the token for a section.
  *
  * @param Section $section
  * @param $token
  *
  * @return Section
  */
 public function checkSectionToken(Section $section, $token)
 {
     return $this->entityManager->getRepository('MainBundle:Section')->findOneBy(array('codeSection' => $section->getCodeSection(), 'token' => $token));
 }
 /**
  * Returns the guide of the section.
  *
  * @param Section $section
  *
  * @return Guide
  */
 public function getGuide(Section $section)
 {
     $query = $this->createQueryBuilder('g')->select('g')->where('g.section = :section')->setParameter(":section", $section->getCodeSection());
     return $query->getQuery()->getOneOrNullResult();
 }