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; }
public function createSection($codeSection, $name, $informations, Country $country) { $section = new Section(); $section->setCodeSection($codeSection); $section->setName($name); $section->setAddress(isset($informations[0]) ? $informations[0] : null); $section->setPhone(isset($informations[1]) ? $informations[1] : null); $section->setWebsite(isset($informations[2]) ? $informations[2] : null); $section->setEmail(isset($informations[3]) ? $informations[3] : null); $section->setUniversity(isset($informations[4]) ? $informations[4] : null); $section->setCountry($country); return $section; }
/** * @param Section $section * * @return bool */ public function changeStatus(Section $section) { $section->isGalaxyImport() ? $section->setGalaxyImport(false) : $section->setGalaxyImport(true); $this->em->flush(); return $section->isGalaxyImport(); }
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(); }