diff --git a/app/Resources/views/base.html.twig b/app/Resources/views/base.html.twig index 3aca63d8aea4662c9cbd9bec2107796a8d59b189..c49bc6d9a0ee72b3049de7af4197df6015019bd3 100644 --- a/app/Resources/views/base.html.twig +++ b/app/Resources/views/base.html.twig @@ -192,7 +192,7 @@ <li><a href="{{ path('peoplepage')}}">{{ 'Utilisateurs' | trans }}</a></li> {% endif %} {% if is_granted('ROLE_USER') %} - <li><a href="#">{{ 'Rencontres' | trans }}</a></li> + <li><a href="{{ path('meetingspage')}}">{{ 'Rencontres' | trans }}</a></li> {% endif %} {% endblock %} </ul> diff --git a/app/config/config.yml b/app/config/config.yml index 00fb9c12d4816cb415fb3c2f53432b707901f1e1..6637a7b1c6122528e445439591c3b89d9d00e99c 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -66,7 +66,7 @@ doctrine: charset: UTF8 orm: - auto_generate_proxy_classes: %kernel.debug% + auto_generate_proxy_classes: '%kernel.debug%' default_entity_manager: default entity_managers: default: diff --git a/src/ClassCodeBundle/Command/ImportMeetingsCommand.php b/src/ClassCodeBundle/Command/ImportMeetingsCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..89e18ab0ae4fb1348ffa1c4173b133ab71eec21b --- /dev/null +++ b/src/ClassCodeBundle/Command/ImportMeetingsCommand.php @@ -0,0 +1,215 @@ +<?php + +namespace ClassCodeBundle\Command; + + + +use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; + +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; + +//Import des utilitaires pour les opérations sur le système de fichiers +use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\Filesystem\Exception\IOException; + +//Import Entity +use ClassCodeBundle\Entity\People; +use ClassCodeBundle\Entity\Meeting; + +class ImportMeetingsCommand extends ContainerAwareCommand +{ + protected function configure() + { + $this + ->setName('classcodeadmin:importMeetings') + ->setDescription('Import datas from legacy classcode plugin') + ->addArgument('email', InputArgument::OPTIONAL, 'valid email, mandatory to use nominatim API to complete the meeting address') + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + + include 'app/Resources/lib/time_computation_lib.php'; + $em = $this->getContainer()->get('doctrine')->getManager(); + $emp = $this->getContainer()->get('doctrine')->getManager('pixees'); + $nominatimEmail=$input->getArgument('email'); + $userName = "Import"; // pour le updatedBy + // desactiver les logs sql + $this->getContainer()->get('doctrine')->getConnection()->getConfiguration()->setSQLLogger(null); + + // Path vers les logs + $log_dir = 'var/logs/'.$today = date("Y_m_d"); + + if(!is_dir($log_dir)){ + mkdir($log_dir); + } + + $log_file_path = $log_dir.'/importMeetings.log'; + $log_file_path_error = $log_dir.'/importMeetings.errors.log'; + $log_msg = ""; + $log_msg_error = ""; + + $log_msg .= "Import Meetings from posts ... \n"; + $old_time = time(); + //on vide les anciennes réunions + $old_meetings = $em->getRepository('ClassCodeBundle:Meeting')->findBy(array('updated_by' => $userName)); + foreach ($old_meetings as $m) { + $em->remove($m); + $em->flush(); + } + + //on recupère les posts de type rencontre et leur loc + $rawSql = "SELECT p.*, g.* FROM wp_posts p left join wp_places_locator g on g.post_id = p.id WHERE p.post_type='rencontre' ;"; + $stmt = $emp->getConnection()->prepare($rawSql); + $stmt->execute(); + $meetings = $stmt->fetchAll(); + + foreach ($meetings as $m) { + //cleaning + if((!$m['lat']) || ($m['lat']=='NULL') || ($m['lat'] =='')){ + $m['lat'] = 0; + } + if((!$m['long']) || ($m['long']=='NULL') || ($m['long'] =='')){ + $m['long'] = 0; + } + + //on recupère ses metas données + $rawSql = "SELECT meta_key,meta_value FROM wp_postmeta WHERE post_id='".$m['ID']."' ;"; + $stmt = $emp->getConnection()->prepare($rawSql); + $stmt->execute(); + $meetingMeta = $stmt->fetchAll(); + + //on récupère le propriétaire + $owner = $em->getRepository('ClassCodeBundle:People')->findOneBy(array('userId' => $m['post_author'])); + + if($owner){ + $meeting = new Meeting(); + $meeting->setOwner($owner); + + foreach ($meetingMeta as $data) { + switch($data['meta_key']){ + case "rencontre_date_1": + $meeting->setDate($data['meta_value']); + break; + case "rencontre_heure_1": + $meeting->setTime($data['meta_value']); + break; + case "structure": + $meeting->setStructure($data['meta_value']); + break; + case "capacity": + $meeting->setCapacity($data['meta_value']); + break; + case "rencontre_hangout": + $meeting->setHangoutLink($data['meta_value']); + break; + case "precisions": + $meeting->setPrecisions($data['meta_value']); + break; + case "rencontre_module": + $meeting->setSubject($data['meta_value']); + break; + case "sujet_precisions": + $meeting->setMore($data['meta_value']); + break; + case "rencontre_participants": + //Subscribers + $participants = explode('|', $data['meta_value']); + foreach($participants as $participant_id){ + $participant = $em->getRepository('ClassCodeBundle:People')->findOneBy(array('userId' => $participant_id)); + if($participant){ + $meeting->addSubscriber($participant); + } + } + break; + } + } + + + + + //recuperation des données de geoloc + if($nominatimEmail && (($m['lat']!=0)||($m['long']!=0))){ + //on complete les données d'adresse à partir de la geoloc + //on dort 1s pour respecter la policy https://operations.osmfoundation.org/policies/nominatim/ + sleep(1); + $json_address = file_get_contents("https://nominatim.openstreetmap.org/reverse.php?email=".$nominatimEmail."&format=json&lat=".$m['lat']."&lon=".$m['long']); + $json_obj = json_decode($json_address); + if(property_exists($json_obj, "address")){ + $nominatimAddress = $json_obj->address; + $nominatimStreet = ""; + if(property_exists($nominatimAddress, "house_number")){ + $nominatimStreet .= $nominatimAddress->house_number; + } + if(property_exists($nominatimAddress, "road")){ + $nominatimStreet .= $nominatimAddress->road; + } + $nominatimCity=""; + if(property_exists($nominatimAddress, "village")){ + $nominatimCity .= $nominatimAddress->village; + } + $nominatimZipcode=""; + if(property_exists($nominatimAddress, "postcode")){ + $nominatimZipcode .= $nominatimAddress->postcode; + } + $nominatimState=""; + if(property_exists($nominatimAddress, "state")){ + $nominatimState .= $nominatimAddress->state; + } + $nominatimCountry=""; + if(property_exists($nominatimAddress, "country")){ + $nominatimCountry .= $nominatimAddress->country; + } + if($m['street'] == ''){ + $m['street']=$nominatimStreet; + } + if($m['city'] == ''){ + $m['city']=$nominatimCity; + } + if($m['state'] == ''){ + $m['state']=$nominatimState; + } + if($m['zipcode'] == ''){ + $m['zipcode']=$nominatimZipcode; + } + if($m['country_long'] == ''){ + $m['country_long']=$nominatimCountry; + } + } + } + $meeting->setStreet($m['street']); + $meeting->setCity($m['city']); + $meeting->setState($m['state']); + $meeting->setZipcode($m['zipcode']); + $meeting->setCountry($m['country_long']); + $meeting->setFormattedAddress($m['formatted_address']); + $meeting->setLatitude($m['lat']); + $meeting->setLongitude($m['long']); + + $meeting->setUpdatedAt(new \DateTime()); + $meeting->setUpdatedBy($userName); + $em->persist($meeting); + $em->flush(); + + } + + + } + + $em->clear(); + $log_msg .= "Imports finished !\n"; + $new_time = time(); + $log_msg .= "Execution time : ".time_elapsed($new_time-$old_time)."\n"; + $log_msg .= "Done, exiting ! \n"; + + file_put_contents($log_file_path, $log_msg); + file_put_contents($log_file_path_error, $log_msg_error); + print "Execution ok ! \n"; + } +} + + \ No newline at end of file diff --git a/src/ClassCodeBundle/Command/ImportPeopleCommand.php b/src/ClassCodeBundle/Command/ImportPeopleCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..c9b566e99790e41f9477c73449c1e7b62db4c185 --- /dev/null +++ b/src/ClassCodeBundle/Command/ImportPeopleCommand.php @@ -0,0 +1,161 @@ +<?php + +namespace ClassCodeBundle\Command; + + + +use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; + +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; + +//Import des utilitaires pour les opérations sur le système de fichiers +use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\Filesystem\Exception\IOException; + +//Import Entity +use ClassCodeBundle\Entity\People; + +class ImportPeopleCommand extends ContainerAwareCommand +{ + protected function configure() + { + $this + ->setName('classcodeadmin:importPeople') + ->setDescription('Import datas about people from wordpress and legacy classcode plugin') + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + + include 'app/Resources/lib/time_computation_lib.php'; + $em = $this->getContainer()->get('doctrine')->getManager(); + $emp = $this->getContainer()->get('doctrine')->getManager('pixees'); + $userName = "Import"; // pour le updatedBy + // desactiver les logs sql + $this->getContainer()->get('doctrine')->getConnection()->getConfiguration()->setSQLLogger(null); + + // Path vers les logs + $log_dir = 'var/logs/'.$today = date("Y_m_d"); + + if(!is_dir($log_dir)){ + mkdir($log_dir); + } + + $log_file_path = $log_dir.'/importPeople.log'; + $log_file_path_error = $log_dir.'/importPeople.errors.log'; + $log_msg = ""; + $log_msg_error = ""; + + $log_msg .= "Import People ... \n"; + $old_time = time(); + + $rawSql = "SELECT p.id,p.user_login,p.user_nicename,p.user_email,g.street,g.city, g.state, g.zipcode,g.country_long, g.formatted_address, g.lat, g.long FROM wp_users p left join wppl_friends_locator g on g.member_id = p.id ;"; + $stmt = $emp->getConnection()->prepare($rawSql); + $stmt->execute(); + $people_in_wp = $stmt->fetchAll(); + + foreach ($people_in_wp as $p) { + //cleaning + if((!$p['lat']) || ($p['lat']=='NULL') || ($p['lat'] =='')){ + $p['lat'] = 0; + } + if((!$p['long']) || ($p['long']=='NULL') || ($p['long'] =='')){ + $p['long'] = 0; + } + $people = $em->getRepository('ClassCodeBundle:People')->findOneBy(array('userId' => $p['id'])); + if(!$people){ + $people = new People(); + } + $people->setUserId($p['id']); + $people->setUsername($p['user_login']); + $people->setDisplayname($p['user_nicename']); + $people->setEmail($p['user_email']); + + //recuperation des donnnées de profil budypress + $rawSql = "SELECT f.name,d.value FROM wp_bp_xprofile_data d inner join wp_bp_xprofile_fields f WHERE f.id = d.field_id and user_id = ".$p['id'].";"; + $stmt = $emp->getConnection()->prepare($rawSql); + $stmt->execute(); + $profileData = $stmt->fetchAll(); + foreach ($profileData as $data) { + switch($data['name']){ + case "Avatar": + $people->setAvatar($data['value']); + break; + case "AvatarImg": + $people->setAvatarImg($data['value']); + break; + case "Prénom": + $people->setFirstname($data['value']); + break; + case "Nom": + $people->setLastname($data['value']); + break; + case "Pseudo": + $people->setNickname($data['value']); + break; + case "Structure": + $people->setStructure($data['value']); + break; + case "Cadre": + $people->setContext($data['value']); + break; + case "Profil": + $people->setProfile($data['value']); + break; + case "Matière enseignée": + $people->setTeaching($data['value']); + break; + case "Facilitateur": + $facTab = unserialize($data['value']); + $facilitator = 0; + if((sizeof($facTab)>0) && ($facTab[0] == "Je veux bien être facilitateur")){ + $facilitator = 1; + } + $people->setFacilitator($facilitator); + break; + case "Chercheur Etudiant Industriel Precision": + $people->setComputerJob($data['value']); + break; + case "Matière suivie": + $people->setLearning($data['value']); + break; + case "Mes compétences": + $people->setSkills($data['value']); + break; + } + } + + //recuperation des données de geoloc + $people->setStreet($p['street']); + $people->setCity($p['city']); + $people->setState($p['state']); + $people->setZipcode($p['zipcode']); + $people->setCountry($p['country_long']); + $people->setFormattedAddress($p['formatted_address']); + $people->setLatitude($p['lat']); + $people->setLongitude($p['long']); + + $people->setUpdatedAt(new \DateTime()); + $people->setUpdatedBy($userName); + $em->persist($people); + $em->flush(); + + } + + $em->clear(); + $log_msg .= "Imports finished !\n"; + $new_time = time(); + $log_msg .= "Execution time : ".time_elapsed($new_time-$old_time)."\n"; + $log_msg .= "Done, exiting ! \n"; + + file_put_contents($log_file_path, $log_msg); + file_put_contents($log_file_path_error, $log_msg_error); + print "Execution ok ! \n"; + } +} + + \ No newline at end of file diff --git a/src/ClassCodeBundle/Command/ImportPeopleGeoLocCommand.php b/src/ClassCodeBundle/Command/ImportPeopleGeoLocCommand.php deleted file mode 100644 index 9c63a243bfe20e093b89a4bbadce26e5a6561901..0000000000000000000000000000000000000000 --- a/src/ClassCodeBundle/Command/ImportPeopleGeoLocCommand.php +++ /dev/null @@ -1,92 +0,0 @@ -<?php - -namespace ClassCodeBundle\Command; - - - -use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; - -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; - -//Import des utilitaires pour les opérations sur le système de fichiers -use Symfony\Component\Filesystem\Filesystem; -use Symfony\Component\Filesystem\Exception\IOException; - -//Import Entity -use PixeesBundle\Entity\People; -use PixeesBundle\Entity\GeoLoc; - -class ImportPeopleGeoLocCommand extends ContainerAwareCommand -{ - protected function configure() - { - $this - ->setName('classcodeadmin:importPeopleGeoLoc') - ->setDescription('Import datas from legacy classcode plugin') - ; - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - - include 'app/Resources/lib/time_computation_lib.php'; - $em = $this->getContainer()->get('doctrine')->getManager('pixees'); - $userName = "Import"; // pour le updatedBy - // desactiver les logs sql - $this->getContainer()->get('doctrine')->getConnection()->getConfiguration()->setSQLLogger(null); - - // Path vers les logs - $log_dir = 'var/logs/'.$today = date("Y_m_d"); - - if(!is_dir($log_dir)){ - mkdir($log_dir); - } - - $log_file_path = $log_dir.'/importPeopleGeoLoc.log'; - $log_file_path_error = $log_dir.'/importPeopleGeoLoc.errors.log'; - $log_msg = ""; - $log_msg_error = ""; - - $log_msg .= "Import People GeoLoc ... \n"; - $old_time = time(); - - $rawSql = "SELECT p.id, g.lat, g.long FROM wp_users p inner join `wppl_friends_locator` g WHERE g.member_id = p.id;"; - $stmt = $em->getConnection()->prepare($rawSql); - $stmt->execute(); - $people_with_geoloc = $stmt->fetchAll(); - - foreach ($people_with_geoloc as $p) { - - $people = $em->getRepository('PixeesBundle:People')->find($p['id']); - if($people){ - $geoloc = $em->getRepository('PixeesBundle:GeoLoc')->findOneBy(array('userId' => $p['id'])); - if(!$geoloc){ - $geoloc = new GeoLoc(); - $geoloc->setPeople($people); - } - $geoloc->setLatitude($p['lat']); - $geoloc->setLongitude($p['long']); - $geoloc->setUpdatedAt(new \DateTime()); - $geoloc->setUpdatedBy($userName); - $em->persist($geoloc); - $em->flush(); - } - - } - - $em->clear(); - $log_msg .= "Imports finished !\n"; - $new_time = time(); - $log_msg .= "Execution time : ".time_elapsed($new_time-$old_time)."\n"; - $log_msg .= "Done, exiting ! \n"; - - file_put_contents($log_file_path, $log_msg); - file_put_contents($log_file_path_error, $log_msg_error); - print "Execution ok ! \n"; - } -} - - \ No newline at end of file diff --git a/src/ClassCodeBundle/Controller/MeetingController.php b/src/ClassCodeBundle/Controller/MeetingController.php new file mode 100644 index 0000000000000000000000000000000000000000..175c59aec9d0902012b0252def550f992f528310 --- /dev/null +++ b/src/ClassCodeBundle/Controller/MeetingController.php @@ -0,0 +1,29 @@ +<?php + +namespace ClassCodeBundle\Controller; + +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\HttpFoundation\Response; +use ClassCodeBundle\Entity\Meeting; + + +class MeetingController extends Controller +{ + /** + * @Route("/people", name="meetingspage") + */ + public function indexAction(Request $request) + { + $em = $this->getDoctrine()->getManager(); + + $meeting = $em->getRepository('ClassCodeBundle:Meeting')->findAll(); + $meetingWithGeoloc = $em->getRepository('ClassCodeBundle:Meeting')->findAllWithGeoLoc(); + return $this->render('@ClassCode/Meeting/list.html.twig', array( + 'meeting' => $meeting, + 'meetingWithGeoloc' => $meetingWithGeoloc, + )); + } +} diff --git a/src/ClassCodeBundle/Controller/PeopleController.php b/src/ClassCodeBundle/Controller/PeopleController.php index 7d4725447d6a802a5edaba47e803d5225bacc8dd..e48b8d5fa582b6dcee46fc6f1833311f7bb08546 100644 --- a/src/ClassCodeBundle/Controller/PeopleController.php +++ b/src/ClassCodeBundle/Controller/PeopleController.php @@ -7,7 +7,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpFoundation\Response; -use PixeesBundle\Entity\People; +use ClassCodeBundle\Entity\People; class PeopleController extends Controller @@ -17,7 +17,8 @@ class PeopleController extends Controller */ public function indexAction(Request $request) { - $emp = $this->getDoctrine()->getManager('pixees'); + //$emp = $this->getDoctrine()->getManager('pixees'); + $em = $this->getDoctrine()->getManager(); // $ninassi = $emp->getRepository('PixeesBundle:People')->findWithGeoLocBy(265); //$ninassi = $emp->getRepository('PixeesBundle:People')->find(265); @@ -25,10 +26,12 @@ class PeopleController extends Controller // $geoloc = $ninassi->getGeoLoc(); // var_dump($ninassi); - $people = $emp->getRepository('PixeesBundle:People')->findAllWithGeoLoc(); - //$people = $emp->getRepository('PixeesBundle:People')->findAll(); + //$people = $emp->getRepository('PixeesBundle:People')->findAllWithGeoLoc(); + $people = $em->getRepository('ClassCodeBundle:People')->findAll(); + $peopleWithGeoloc = $em->getRepository('ClassCodeBundle:People')->findAllWithGeoLoc(); return $this->render('@ClassCode/People/list.html.twig', array( 'people' => $people, + 'peopleWithGeoloc' => $peopleWithGeoloc, )); } } diff --git a/src/ClassCodeBundle/Entity/Coordination.php b/src/ClassCodeBundle/Entity/Coordination.php index 9f9b0cee07dc9e6e2c00ab2e5b367efe60941f41..bc0d87eca28a3fd3adc1a38b76530ec7a8fb1aa6 100644 --- a/src/ClassCodeBundle/Entity/Coordination.php +++ b/src/ClassCodeBundle/Entity/Coordination.php @@ -456,7 +456,7 @@ class Coordination /** * Get latitude * - * @return string + * @return float */ public function getLatitude() { diff --git a/src/ClassCodeBundle/Entity/Meeting.php b/src/ClassCodeBundle/Entity/Meeting.php new file mode 100644 index 0000000000000000000000000000000000000000..35b9c4edd0ef93a66126552a169b8a7b62ebfdbe --- /dev/null +++ b/src/ClassCodeBundle/Entity/Meeting.php @@ -0,0 +1,669 @@ +<?php + +namespace ClassCodeBundle\Entity; + +use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Validator\Constraints as Assert ; +use Doctrine\Common\Collections\ArrayCollection; +use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; + +/** + * ClassCodeBundle\Entity\Meeting + * + * @ORM\Table(name="meeting") + * @ORM\Entity(repositoryClass="ClassCodeBundle\Entity\MeetingRepository") + */ +class Meeting +{ + /** + * @var integer $id + * + * @ORM\Column(name="id", type="integer") + * @ORM\Id + * @ORM\GeneratedValue(strategy="AUTO") + */ + private $id; + + /** + * @var integer $ownerId + * * + * @ORM\ManyToOne(targetEntity="People", inversedBy="ownedMeetings") + * @ORM\JoinColumn(name="ownerId", referencedColumnName="id", nullable=false) + * @Assert\Type(type="ClassCodeBundle\Entity\People") + * + */ + protected $ownerId; + + /** + * @var string $date + * + * @ORM\Column(name="date", type="string", length=10 , nullable=true) + */ + private $date; + + /** + * @var string $time + * + * @ORM\Column(name="time", type="string", length=5 , nullable=true) + */ + private $time; + + /** + * @var string $structure + * + * @ORM\Column(name="structure", type="string", length=255,nullable=true) + * + */ + private $structure; + + /** + * @var string $street + * + * @ORM\Column(name="street", type="string", length=255,nullable=true) + * + */ + private $street; + + /** + * @var string $city + * + * @ORM\Column(name="city", type="string", length=255,nullable=true) + * + * + */ + private $city; + + /** + * @var string $zipcode + * + * @ORM\Column(name="zipcode", type="string", length=255,nullable=true) + * + * + */ + private $zipcode; + + /** + * @var string $country + * + * @ORM\Column(name="country", type="string", length=255,nullable=true) + * + */ + private $country; + + /** + * @var string $state + * + * @ORM\Column(name="state", type="string", length=255,nullable=true) + * + */ + private $state; + + /** + * @var string $formattedAddress + * + * @ORM\Column(name="formattedAddress", type="string", length=255,nullable=true) + * + */ + private $formattedAddress; + + /** + * @var string $capacity + * + * @ORM\Column(name="capacity", type="string", length=255,nullable=true) + * + * + */ + private $capacity; + + /** + * @var string $hangoutLink + * + * @ORM\Column(name="hangoutLink", type="string", length=255,nullable=true) + * + * + */ + private $hangoutLink; + + /** + * @var string $more + * + * @ORM\Column(name="more", type="string", length=255,nullable=true) + * + * + */ + private $more; + + /** + * @var string $subject + * + * @ORM\Column(name="subject", type="string", length=255,nullable=true) + * + * + */ + private $subject; + + /** + * @var string $precisions + * + * @ORM\Column(name="precisions", type="string", length=255,nullable=true) + * + * + */ + private $precisions; + + /** + * @ORM\ManyToMany(targetEntity="People", inversedBy="meetings",cascade={"persist"}) + * @ORM\JoinTable(name="meetings_subscribers") + **/ + private $subscribers; + + + /** + * @var float $latitude + * + * @ORM\Column(name="latitude", type="float", length=255) + * + * + */ + private $latitude = 0; + + /** + * @var float $longitude + * + * @ORM\Column(name="longitude", type="float", length=255) + * + * + */ + private $longitude = 0; + + /** + * @var \DateTime $updated_at + * + * @ORM\Column(name="updated_at", type="datetime", nullable=true) + */ + private $updated_at; + + /** + * @var string $updated_by + * + * @ORM\Column(name="updated_by", type="text", type="string", length=255, nullable=true) + */ + private $updated_by; + + public function __construct() { + $this->subscribers = new ArrayCollection(); + } + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + + /** + * Set people + * + * @param \ClassCodeBundle\Entity\People $people + * @return GeoLoc + */ + public function setOwner(\ClassCodeBundle\Entity\People $people) + { + $this->ownerId = $people; + return $this; + } + + /** + * Get people + * + * @return \ClassCodeBundle\Entity\People + */ + public function getOwner() + { + return $this->ownerId; + } + + /** + * Get date + * + * @return string + */ + public function getDate() + { + return $this->date; + } + + /** + * Set date + * + * @param string $date + * @return Meeting + */ + public function setDate($date) + { + $this->date = $date; + return $this; + } + + /** + * Get time + * + * @return string + */ + public function getTime() + { + return $this->time; + } + + /** + * Set time + * + * @param string $time + * @return Meeting + */ + public function setTime($time) + { + $this->time = $time; + return $this; + } + + /** + * Set structure + * + * @param string $structure + * @return Meeting + */ + public function setStructure($structure) + { + $this->structure = $structure; + return $this; + } + + /** + * Get structure + * + * @return string + */ + public function getStructure() + { + return $this->structure; + } + + /** + * Set street + * + * @param string $street + * @return Meeting + */ + public function setStreet($street) + { + $this->street = $street; + return $this; + } + + /** + * Get street + * + * @return string + */ + public function getStreet() + { + return $this->street; + } + + /** + * Get city + * + * @return string + */ + public function getCity() + { + return $this->city; + } + + /** + * Set town + * + * @param string $city + * @return Meeting + */ + public function setCity($city) + { + $this->city = $city; + return $this; + } + + /** + * Set state + * + * @param string $state + * @return Meeting + */ + public function setState($state) + { + $this->state = $state; + return $this; + } + + /** + * Get state + * + * @return state + */ + public function getState() + { + return $this->state; + } + + /** + * Set zipcode + * + * @param string $zipcode + * @return Meeting + */ + public function setZipcode($zipcode) + { + $this->zipcode = $zipcode; + return $this; + } + + /** + * Get zipcode + * + * @return string + */ + public function getZipcode() + { + return $this->zipcode; + } + + /** + * Set country + * + * @param string $country + * @return Meeting + */ + public function setCountry($country) + { + $this->country = $country; + return $this; + } + + /** + * Get country + * + * @return string + */ + public function getCountry() + { + return $this->country; + } + + /** + * Set formattedAddress + * + * @param string $formattedAddress + * @return Meeting + */ + public function setFormattedAddress($formattedAddress) + { + $this->formattedAddress = $formattedAddress; + return $this; + } + + /** + * Get formattedAddress + * + * @return string + */ + public function getFormattedAddres() + { + return $this->formattedAddress; + } + + /** + * Set latitude + * + * @param float $latitude + * @return Meeting + */ + public function setLatitude($latitude) + { + $this->latitude = $latitude; + return $this; + } + + /** + * Get latitude + * + * @return float + */ + public function getLatitude() + { + return $this->latitude; + } + + /** + * Set longitude + * + * @param float $longitude + * @return Meeting + */ + public function setLongitude($longitude) + { + $this->longitude = $longitude; + return $this; + } + + /** + * Get longitude + * + * @return float + */ + public function getLongitude() + { + return $this->longitude; + } + + /** + * Get capacity + * + * @return string + */ + public function getCapacity() + { + return $this->capacity; + } + + /** + * Set capacity + * + * @param string $capacity + * @return Meeting + */ + public function setCapacity($capacity) + { + $this->capacity = $capacity; + return $this; + } + + /** + * Get hangoutLink + * + * @return string + */ + public function getHangoutLink() + { + return $this->hangoutLink; + } + + /** + * Set hangoutLink + * + * @param string $hangoutLink + * @return Meeting + */ + public function setHangoutLink($hangoutLink) + { + $this->hangoutLink = $hangoutLink; + return $this; + } + + /** + * Get more + * + * @return string + */ + public function getMore() + { + return $this->more; + } + + /** + * Set more + * + * @param string $more + * @return Meeting + */ + public function setMore($more) + { + $this->more = $more; + return $this; + } + + /** + * Get subject + * + * @return string + */ + public function getSubject() + { + return $this->subject; + } + + /** + * Set subject + * + * @param string $subject + * @return Meeting + */ + public function setSubject($subject) + { + $this->subject = $subject; + return $this; + } + + /** + * Get precisions + * + * @return string + */ + public function getPrecisions() + { + return $this->precisions; + } + + /** + * Set precisions + * + * @param string $precisions + * @return Meeting + */ + public function setPrecisions($precisions) + { + $this->precisions = $precisions; + return $this; + } + + /** + * Add Subscriber + * + * @param \ClassCodeBundle\Entity\People + * @return Meeting + */ + + public function addSubscriber(\ClassCodeBundle\Entity\People $subscriber) + { + if(!($this->subscribers->contains($subscriber))){ + $subscriber->addMeeting($this); // synchronously updating inverse side + $this->subscribers[] = $subscriber; + } + return $this; + } + + /** + * Remove Subscriber + * + * @param \ClassCodeBundle\Entity\People + * @return Meeting + */ + + public function removeSubscriber(\ClassCodeBundle\Entity\People $subscriber) + { + if($this->subscribers->contains($subscriber)){ + $subscriber->removeMeeting($this); // synchronously updating inverse side + $this->subscribers->removeElement($subscriber); + } + return $this; + } + /** + * Get Subscribers + * + * @return Doctrine\Common\Collections\Collection + */ + public function getSubscribers() + { + return $this->subscribers; + } + + /** + * Set updated_at + * + * @param \DateTime $date + * @return Meeting + */ + public function setUpdatedAt($date) + { + $this->updated_at = $date; + + return $this; + } + + /** + * Get updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->updated_at; + } + + /** + * Set updated_by + * + * @param string $login + * @return Meeting + */ + public function setUpdatedBy($login) + { + $this->updated_by = $login; + + return $this; + } + + /** + * Get updated_by + * + * @return string + */ + public function getUpdatedBy() + { + return $this->updated_by; + } + +} \ No newline at end of file diff --git a/src/ClassCodeBundle/Entity/MeetingRepository.php b/src/ClassCodeBundle/Entity/MeetingRepository.php new file mode 100644 index 0000000000000000000000000000000000000000..29650e2579426df004d07834735ce8a41b238566 --- /dev/null +++ b/src/ClassCodeBundle/Entity/MeetingRepository.php @@ -0,0 +1,35 @@ +<?php + +namespace ClassCodeBundle\Entity; + +use Doctrine\ORM\EntityRepository; + +/** + * MeetingRepository + * + * Add your own custom + * repository methods below. + */ +class MeetingRepository extends EntityRepository +{ + public function findAll(){ + return $this->findBy(array(), array('date' => 'ASC')); + } + + public function findAllWithGeoLoc(){ + $query = $this->getEntityManager() + ->createQuery( + "SELECT m FROM ClassCodeBundle:Meeting m + WHERE m.latitude != 0 and m.longitude != 0" + ); + + try { + $results = $query->getResult(); + + return $results; + } catch (\Doctrine\ORM\NoResultException $exception) { + return null; + } + } + +} diff --git a/src/ClassCodeBundle/Entity/People.php b/src/ClassCodeBundle/Entity/People.php new file mode 100644 index 0000000000000000000000000000000000000000..3f9ecf0945c1b4aed2133fe07779eaf06f60d8b6 --- /dev/null +++ b/src/ClassCodeBundle/Entity/People.php @@ -0,0 +1,947 @@ +<?php + +namespace ClassCodeBundle\Entity; + +use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Validator\Constraints as Assert ; +use Doctrine\Common\Collections\ArrayCollection; +use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; +use Doctrine\Common\Collections\Criteria; + +/** + * ClassCodeBundle\Entity\People + * + * @ORM\Table(name="people") + * @ORM\Entity(repositoryClass="ClassCodeBundle\Entity\PeopleRepository") + */ +class People +{ + /** + * @var integer $id + * + * @ORM\Column(name="id", type="integer") + * @ORM\Id + * @ORM\GeneratedValue(strategy="AUTO") + */ + private $id; + + /** + * @var integer $userId + * + * @ORM\Column(name="user_id", type="integer") + * + */ + private $userId; + + /** + * @var string $username + * + * @ORM\Column(name="user_login", type="string", length=255) + * + */ + private $username; + + /** + * @var string $displayname + * + * @ORM\Column(name="displayName", type="string", length=255) + * + */ + private $displayname; + + + /** + * @var string $email + * + * @ORM\Column(name="user_email", type="string", length=255) + * + */ + private $email; + + /** + * @var string $avatar + * + * @ORM\Column(name="avatar", type="string", length=255,nullable=true) + * + */ + private $avatar; + + /** + * @var string $avatarImg + * + * @ORM\Column(name="avatarImg", type="string", length=255,nullable=true) + * + */ + private $avatarImg; + + /** + * @var string $firstname + * + * @ORM\Column(name="firstname", type="string", length=255,nullable=true) + * + */ + private $firstname; + + /** + * @var string $lastname + * + * @ORM\Column(name="lastname", type="string", length=255,nullable=true) + * + */ + private $lastname; + + /** + * @var string $nickname + * + * @ORM\Column(name="nickname", type="string", length=255,nullable=true) + * + */ + private $nickname; + + /** + * @var string $structure + * + * @ORM\Column(name="structure", type="string", length=255,nullable=true) + * + */ + private $structure; + + /** + * @var string $context + * + * @ORM\Column(name="context", type="string", length=255,nullable=true) + * + */ + private $context; + + /** + * @var string $profile + * + * @ORM\Column(name="profile", type="string", length=255,nullable=true) + * + */ + private $profile; + + /** + * @var string $teaching + * + * @ORM\Column(name="teaching", type="string", length=255,nullable=true) + * + */ + private $teaching; + + /** + * @ORM\Column(name="facilitator", type="boolean", length=1,options={"default" = 0}) + */ + private $facilitator = 0; + + /** + * @var string $computerJob + * + * @ORM\Column(name="computerJob", type="string", length=255,nullable=true) + * + */ + private $computerJob; + + /** + * @var string $learning + * + * @ORM\Column(name="learning", type="string", length=255,nullable=true) + * + */ + private $learning; + + /** + * @var string $skills + * + * @ORM\Column(name="skills", type="string", length=255,nullable=true) + * + */ + private $skills; + + /** + * @var string $street + * + * @ORM\Column(name="street", type="string", length=255,nullable=true) + * + */ + private $street; + + /** + * @var string $city + * + * @ORM\Column(name="city", type="string", length=255,nullable=true) + * + */ + private $city; + + /** + * @var string $state + * + * @ORM\Column(name="state", type="string", length=255,nullable=true) + * + */ + private $state; + + /** + * @var string $zipcode + * + * @ORM\Column(name="zipcode", type="string", length=255,nullable=true) + * + */ + private $zipcode; + + /** + * @var string $country + * + * @ORM\Column(name="country", type="string", length=255,nullable=true) + * + */ + private $country; + + /** + * @var string $formattedAddress + * + * @ORM\Column(name="formattedAddress", type="string", length=255,nullable=true) + * + */ + private $formattedAddress; + + /** + * @var float $latitude + * + * @ORM\Column(name="latitude", type="float", length=255) + * + */ + private $latitude = 0; + + /** + * @var float $longitude + * + * @ORM\Column(name="longitude", type="float", length=255) + * + */ + private $longitude = 0; + + /** + * @ORM\ManyToMany(targetEntity="Meeting", mappedBy="subscribers",cascade={"persist"}) + **/ + private $meetings; + + /** + * @ORM\OneToMany(targetEntity="Meeting", mappedBy="ownerId") + **/ + private $ownedMeetings; + + /** + * @var \DateTime $updated_at + * + * @ORM\Column(name="updated_at", type="datetime", nullable=true) + */ + private $updated_at; + + /** + * @var string $updated_by + * + * @ORM\Column(name="updated_by", type="text", type="string", length=255, nullable=true) + */ + private $updated_by; + + public function __construct() { + $this->isActive = true; + $this->meetings = new ArrayCollection(); + $this->ownedMeetings = new ArrayCollection(); + } + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set userId + * + * @param integer $userId + * @return People + */ + public function setUserId($userId) + { + $this->userId = $userId; + return $this; + } + + /** + * Get userId + * + * @return integer + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set username + * + * @param string $username + * @return People + */ + public function setUsername($username) + { + $this->username = $username; + return $this; + } + + /** + * Get username + * + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * Set displayname + * + * @param string $username + * @return People + */ + public function setDisplayname($displayname) + { + $this->displayname = $displayname; + return $this; + } + + /** + * Get displayname + * + * @return string + */ + public function getDisplayname() + { + if($this->displayname){ + return $this->displayname; + }else{ + return $this->username; + } + + } + + /** + * Set email + * + * @param string $email + * @return People + */ + public function setEmail($email) + { + $this->email = $email; + return $this; + } + + /** + * Get email + * + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * Set avatar + * + * @param string $avatar + * @return People + */ + public function setAvatar($avatar) + { + $this->avatar = $avatar; + return $this; + } + + /** + * Get avatar + * + * @return string + */ + public function getAvatar() + { + return $this->avatar; + } + + /** + * Set avatarImg + * + * @param string $avatarImg + * @return People + */ + public function setAvatarImg($avatarImg) + { + $this->avatarImg = $avatarImg; + return $this; + } + + /** + * Get avatarImg + * + * @return string + */ + public function getAvatarImg() + { + return $this->avatarImg; + } + + /** + * Set firstname + * + * @param string $firstname + * @return People + */ + public function setFirstname($firstname) + { + $this->firstname = $firstname; + return $this; + } + + /** + * Get firstname + * + * @return string + */ + public function getFirstname() + { + return $this->firstname; + } + + /** + * Set lastname + * + * @param string $lastname + * @return People + */ + public function setLastname($lastname) + { + $this->lastname = $lastname; + return $this; + } + + /** + * Get lastname + * + * @return string + */ + public function getLastname() + { + return $this->lastname; + } + + /** + * Set nickname + * + * @param string $nickname + * @return People + */ + public function setNickname($nickname) + { + $this->nickname = $nickname; + return $this; + } + + /** + * Get nickname + * + * @return string + */ + public function getNickname() + { + if($this->nickname){ + return $this->nickname; + }else{ + return $this->displayname; + } + } + + /** + * Set structure + * + * @param string $structure + * @return People + */ + public function setStructure($structure) + { + $this->structure = $structure; + return $this; + } + + /** + * Get structure + * + * @return string + */ + public function getStructure() + { + return $this->structure; + } + + /** + * Set context + * + * @param string $context + * @return People + */ + public function setContext($context) + { + $this->context = $context; + return $this; + } + + /** + * Get context + * + * @return string + */ + public function getContext() + { + return $this->context; + } + + /** + * Set profile + * + * @param string $profile + * @return People + */ + public function setProfile($profile) + { + $this->profile = $profile; + return $this; + } + + /** + * Get profile + * + * @return string + */ + public function getProfile() + { + return $this->profile; + } + + /** + * Set teaching + * + * @param string $teaching + * @return People + */ + public function setTeaching($teaching) + { + $this->teaching = $teaching; + return $this; + } + + /** + * Get teaching + * + * @return string + */ + public function getTeaching() + { + return $this->teaching; + } + + /** + * Set facilitator + * + * @param boolean $facilitator + * @return People + */ + public function setFacilitator($facilitator) + { + $this->facilitator = $facilitator; + return $this; + } + + /** + * Get facilitator + * + * @return boolean + */ + public function getFacilitator() + { + return $this->facilitator; + } + + /** + * Set computerJob + * + * @param string $computerJob + * @return People + */ + public function setComputerJob($computerJob) + { + $this->computerJob = $computerJob; + return $this; + } + + /** + * Get computerJob + * + * @return string + */ + public function getComputerJob() + { + return $this->computerJob; + } + + /** + * Set learning + * + * @param string $learning + * @return People + */ + public function setLearning($learning) + { + $this->learning = $learning; + return $this; + } + + /** + * Get learning + * + * @return string + */ + public function getLearning() + { + return $this->learning; + } + + /** + * Set skills + * + * @param string $skills + * @return People + */ + public function setSkills($skills) + { + $this->skills = $skills; + return $this; + } + + /** + * Get skills + * + * @return string + */ + public function getSkills() + { + return $this->skills; + } + + /** + * Set street + * + * @param string $street + * @return People + */ + public function setStreet($street) + { + $this->street = $street; + return $this; + } + + /** + * Get street + * + * @return string + */ + public function getStreet() + { + return $this->street; + } + + /** + * Set city + * + * @param string $city + * @return People + */ + public function setCity($city) + { + $this->city = $city; + return $this; + } + + /** + * Get city + * + * @return string + */ + public function getCity() + { + return $this->city; + } + + /** + * Set state + * + * @param string $state + * @return People + */ + public function setState($state) + { + $this->state = $state; + return $this; + } + + /** + * Get state + * + * @return state + */ + public function getState() + { + return $this->state; + } + + /** + * Set zipcode + * + * @param string $zipcode + * @return People + */ + public function setZipcode($zipcode) + { + $this->zipcode = $zipcode; + return $this; + } + + /** + * Get zipcode + * + * @return string + */ + public function getZipcode() + { + return $this->zipcode; + } + + /** + * Set country + * + * @param string $country + * @return People + */ + public function setCountry($country) + { + $this->country = $country; + return $this; + } + + /** + * Get country + * + * @return string + */ + public function getCountry() + { + return $this->country; + } + + /** + * Set formattedAddress + * + * @param string $formattedAddress + * @return People + */ + public function setFormattedAddress($formattedAddress) + { + $this->formattedAddress = $formattedAddress; + return $this; + } + + /** + * Get formattedAddress + * + * @return string + */ + public function getFormattedAddres() + { + return $this->formattedAddress; + } + + /** + * Set latitude + * + * @param float $latitude + * @return People + */ + public function setLatitude($latitude) + { + $this->latitude = $latitude; + return $this; + } + + /** + * Get latitude + * + * @return float + */ + public function getLatitude() + { + return $this->latitude; + } + + /** + * Set longitude + * + * @param float $longitude + * @return People + */ + public function setLongitude($longitude) + { + $this->longitude = $longitude; + return $this; + } + + /** + * Get longitude + * + * @return float + */ + public function getLongitude() + { + return $this->longitude; + } + + /** + * Add Meeting + * + * @param \ClassCodeBundle\Entity\Meeting + * @return People + */ + + public function addMeeting(\ClassCodeBundle\Entity\Meeting $meeting) + { + if(!($this->meetings->contains($meeting))){ + $this->meetings[] = $meeting; + } + return $this; + } + + /** + * Remove Meeting + * + * @param \ClassCodeBundle\Entity\Meeting + * @return People + */ + + public function removeMeeting(\ClassCodeBundle\Entity\Meeting $meeting) + { + if($this->meetings->contains($meeting)){ + $this->meetings->removeElement($meeting); + } + return $this; + } + /** + * Get Meetings + * + * @return Doctrine\Common\Collections\Collection + */ + public function getMeetings() + { + return $this->meetings; + } + + /** + * Add $ownedMeetings + * + * @param \ClassCodeBundle\Entity\Meeting $ownedMeetings + * @return People + */ + public function addOwnedMeeting(\ClassCodeBundle\Entity\Meeting $ownedMeetings) + { + if(!($this->ownedMeetings->contains($ownedMeetings))){ + $this->ownedMeetings[] = $ownedMeetings; + } + return $this; + } + + /** + * Remove $ownedMeetings + * + * @param \ClassCodeBundle\Entity\Meetingm $ownedMeetings + * @return People + */ + public function removeOwnedMeeting(\ClassCodeBundle\Entity\Meeting $ownedMeetings) + { + if($this->ownedMeetings->contains($ownedMeetings)){ + $this->ownedMeetings->removeElement($ownedMeetings); + } + } + + /** + * Get $ownedMeetings + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getOwnedMeetings() + { + return $this->ownedMeetings; + } + + /** + * Set updated_at + * + * @param \DateTime $date + * @return People + */ + public function setUpdatedAt($date) + { + $this->updated_at = $date; + + return $this; + } + + /** + * Get updated_at + * + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->updated_at; + } + + /** + * Set updated_by + * + * @param string $login + * @return People + */ + public function setUpdatedBy($login) + { + $this->updated_by = $login; + + return $this; + } + + /** + * Get updated_by + * + * @return string + */ + public function getUpdatedBy() + { + return $this->updated_by; + } + +} \ No newline at end of file diff --git a/src/ClassCodeBundle/Entity/PeopleRepository.php b/src/ClassCodeBundle/Entity/PeopleRepository.php new file mode 100644 index 0000000000000000000000000000000000000000..f696b80304cf78a4aa73309db49d1342e36391d0 --- /dev/null +++ b/src/ClassCodeBundle/Entity/PeopleRepository.php @@ -0,0 +1,35 @@ +<?php + +namespace ClassCodeBundle\Entity; + +use Doctrine\ORM\EntityRepository; + +/** + * PeopleRepository + * + * Add your own custom + * repository methods below. + */ +class PeopleRepository extends EntityRepository +{ + public function findAll(){ + return $this->findBy(array(), array('username' => 'ASC')); + } + + public function findAllWithGeoLoc(){ + $query = $this->getEntityManager() + ->createQuery( + "SELECT p FROM ClassCodeBundle:People p + WHERE p.latitude != 0 and p.longitude != 0" + ); + + try { + $results = $query->getResult(); + + return $results; + } catch (\Doctrine\ORM\NoResultException $exception) { + return null; + } + } + +} diff --git a/src/ClassCodeBundle/Entity/Structure.php b/src/ClassCodeBundle/Entity/Structure.php index 3c6644db77b5e3401f40c837114a034149e2ad0d..fea1cbb8d96c8f7eaadb84904f92924d225b6244 100644 --- a/src/ClassCodeBundle/Entity/Structure.php +++ b/src/ClassCodeBundle/Entity/Structure.php @@ -274,7 +274,7 @@ class Structure /** * Get latitude * - * @return string + * @return float */ public function getLatitude() { diff --git a/src/ClassCodeBundle/Resources/translations/messages.fr.yml b/src/ClassCodeBundle/Resources/translations/messages.fr.yml index c62a03cd28ac9507a2b1e0b376379efb303f9568..8c71c904292ea8be94bc01c017a23de0d6c2962c 100644 --- a/src/ClassCodeBundle/Resources/translations/messages.fr.yml +++ b/src/ClassCodeBundle/Resources/translations/messages.fr.yml @@ -84,6 +84,11 @@ 'people.login' : "Login" 'people.email' : "Email" 'people.roles' : 'Rôles' +'meeting.subject' : 'Module/Objet' +'meeting.dateTime' : 'Date et Heure' +'meeting.owner' : 'Organisateur' +'meeting.state' : 'Region' +'meeting.noloc' : 'Aucune localisation définie' "attribute.add" : "Ajouter" "attribute.edit" : "Modifier" 'DataTable.FirstPage' : 'Première Page' diff --git a/src/ClassCodeBundle/Resources/views/Meeting/ajax_list.html.twig b/src/ClassCodeBundle/Resources/views/Meeting/ajax_list.html.twig new file mode 100644 index 0000000000000000000000000000000000000000..08851084ecc65a02c6812cba83d32171702b1a41 --- /dev/null +++ b/src/ClassCodeBundle/Resources/views/Meeting/ajax_list.html.twig @@ -0,0 +1,32 @@ +<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id='meeting_list'> + <thead> + <tr> + <th>{{ 'meeting.subject'|trans }} </th> + <th>{{ 'meeting.dateTime'|trans }} </th> + <th>{{ 'meeting.owner'|trans }} </th> + <th>{{ 'meeting.state'|trans }} </th> + </tr> + </thead> + <tbody> + {% for m in meeting %} + <tr> + <td> + {{ m.getSubject }} + </td> + <td> + {{ m.getDate }} <br>{{ m.getTime }} + </td> + <td> + {{ m.getOwner.getNickName }} + </td> + <td> + {% if m.getState != "" %} + {{ m.getState }} + {% elseif m.getLatitude ==0 and m.getLongitude ==0 %} + {{ 'meeting.noloc'|trans }} + {% endif %} + </td> + </tr> + {% endfor %} + </tbody> +</table> \ No newline at end of file diff --git a/src/ClassCodeBundle/Resources/views/Meeting/list.html.twig b/src/ClassCodeBundle/Resources/views/Meeting/list.html.twig new file mode 100644 index 0000000000000000000000000000000000000000..bdd2f9897e317051095d89cf4a6a25d9907b716e --- /dev/null +++ b/src/ClassCodeBundle/Resources/views/Meeting/list.html.twig @@ -0,0 +1,122 @@ +{% extends 'base.html.twig' %} + +{% block stylesheets %} + {{ parent() }} + <link rel="stylesheet" href="{{ asset('js/leaflet-1.3.1/leaflet.css') }}" /> + <link rel="stylesheet" href="{{ asset('js/leaflet-1.3.1/plugins/leaflet.markercluster-1.3.0/dist/MarkerCluster.Default.css') }}" /> +{% endblock %} + +{% block body_title %} + {{ 'people.list' | trans }} +{% endblock body_title %} + +{% block toplinklist %} + {% if is_granted('ROLE_ADMIN') %} + + {% endif %} +{% endblock toplinklist %} + +{% block right_action %} +{% endblock %} +{% block body_inner %} + <div id="classcodeadmin_content" class="col-md-12" style="display:none;"> + + <div class="col-sm-12"> + <div id="peopleMap" style="height:400px;"> + </div> + + <div id='people_list_div'> + {% include '@ClassCode/Meeting/ajax_list.html.twig' %} + </div> + </div> + + <div id="loader"> + <img src="{{ commons_url }}/images/pictos/loading_40.gif" alt="{{ 'Loading'|trans }}" title="{{ 'Loading'|trans }}"> + </div> + + + +{% endblock %} + +{% block javascripts %} + {{ parent() }} + <script type="text/javascript" src="{{ asset('js/leaflet-1.3.1/leaflet.js') }}"></script> + <script type="text/javascript" src="{{ asset('js/leaflet-1.3.1/plugins/leaflet.markercluster-1.3.0/dist/leaflet.markercluster.js') }}"></script> + <script> + $(document).ready(function() { + loadDataTable(); + $('#loader').hide(); + $('#classcodeadmin_content').show(); + //map + var peopleMap = L.map('peopleMap',{maxZoom: 18}).setView([46.52863469527167, 2.43896484375], 5), + markers = L.markerClusterGroup({ + spiderfyOnMaxZoom: true, + showCoverageOnHover: false, + zoomToBoundsOnClick: true, + polygonOptions: { + fillColor: '#FFFFFF', + color: '#FFFFFF', + weight: 0.5, + opacity: 1, + fillOpacity: 0.5 + } + }), + lat = "", + lon = "", + LeafIcon = L.Icon.extend({ + options: { + iconSize: [38, 95], + shadowSize: [50, 64], + iconAnchor: [22, 94], + shadowAnchor: [4, 62], + popupAnchor: [-3, -76] + } + }); + + var markerDetail = ""; + var lat; + var lon; + {% for m in meetingWithGeoloc %} + {% if m.getLatitude != 0 and m.getLongitude != 0 %} + lat = "{{ m.getLatitude }}" ; + lon = "{{ m.getLongitude }}" ; + if((lat !="0")&&(lon != "0")){ + markerDetail ="<p class='h4'><b>{{ m.getSubject }}</b></p>"; + markerDetail += "<p class='h5'><b> " + "{{ m.getOwner.getNickName }} " + "</b></p>"; + markerDetail += "<p class='h5'><b> " + "{{ m.getDate }} " + "</b></p>"; + markerDetail += "<p class='h5'><b> " + "{{ m.getTime }} " + "</b></p>"; + markers.addLayer(L.marker(L.latLng(lat, lon)).bindPopup(markerDetail) + .openPopup()); + peopleMap.addLayer(markers); + } + {% endif %} + {% endfor %} + L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { + maxZoom: 18, + attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' + }).addTo(peopleMap); + }); + + function loadDataTable(){ + $('#meeting_list').dataTable({ + "sDom": "<'row'<'col-md-6'li><'col-md-6'f>r>t<'row'<'col-md-6'><'col-md-6'p>>", + "oLanguage": { + "oPaginate": { + "sFirst":"{{ 'DataTable.FirstPage'|trans }}", + "sLast": "{{ 'DataTable.LastPage'|trans }}", + "sNext": "{{ 'DataTable.Next'|trans }}", + "sPrevious": "{{ 'DataTable.Previous'|trans }}" + }, + "sInfo": "{{ 'DataTable.Conclusion'|trans }}", + "sLengthMenu": "{{ 'DataTable.Menu'|trans }}", + "sSearch": "{{ 'DataTable.Search'|trans }}", + "sInfoThousands": " ", + "sEmptyTable": "{{ 'DataTable.noData'|trans }}", + "sInfoEmpty": "{{ 'DataTable.noData'|trans }}" + }, + "aLengthMenu": [[100, 500, 1000,10000, -1], [100, 500, 1000,10000, "{{ 'DataTable.all'|trans }}"]], + "iDisplayLength": 1000 + }); + } + </script> +{% endblock %} \ No newline at end of file diff --git a/src/ClassCodeBundle/Resources/views/People/ajax_list.html.twig b/src/ClassCodeBundle/Resources/views/People/ajax_list.html.twig index 2d5405c34fe867166141ce8107ab0d1b767e5d7b..08a0cb21206d20d6074a19c270cbd251b083cb9d 100644 --- a/src/ClassCodeBundle/Resources/views/People/ajax_list.html.twig +++ b/src/ClassCodeBundle/Resources/views/People/ajax_list.html.twig @@ -10,7 +10,7 @@ {% for p in people %} <tr> <td> - {{ p.getDisplayName }} + {{ p.getNickName }} </td> <td> {{ p.getUsername }} diff --git a/src/ClassCodeBundle/Resources/views/People/list.html.twig b/src/ClassCodeBundle/Resources/views/People/list.html.twig index f51d83520cc3cbde818afa1b228ef76897057732..f116f7acaa948edacd764265f2c11ebb71fc475a 100644 --- a/src/ClassCodeBundle/Resources/views/People/list.html.twig +++ b/src/ClassCodeBundle/Resources/views/People/list.html.twig @@ -76,14 +76,14 @@ var markerDetail = ""; var lat; var lon; - {% for p in people %} - {% if p.getGeoLoc %} - lat = "{{ p.getGeoLoc.getLatitude }}" ; - lon = "{{ p.getGeoLoc.getLongitude }}" ; + {% for p in peopleWithGeoloc %} + {% if p.getLatitude != 0 and p.getLongitude != 0 %} + lat = "{{ p.getLatitude }}" ; + lon = "{{ p.getLongitude }}" ; if((lat !="0")&&(lon != "0")){ markerDetail ="<p class='h4'><b>"; - markerDetail += "{{ p.getDisplayName }}"; - markerDetail += "</b></p>"+ "<p class='h5'><b> " + "{{ p.getUserName }} " + "</b></p>"; + markerDetail += "{{ p.getNickName }}"; + markerDetail += "</b></p>"+ "<p class='h5'><b> " + "{{ p.getEmail }} " + "</b></p>"; markers.addLayer(L.marker(L.latLng(lat, lon)).bindPopup(markerDetail) .openPopup()); peopleMap.addLayer(markers); diff --git a/src/PixeesBundle/Entity/GeoLoc.php b/src/PixeesBundle/Entity/GeoLoc.php deleted file mode 100644 index e48cd4e46f505053a13d267c48f17e465e53c776..0000000000000000000000000000000000000000 --- a/src/PixeesBundle/Entity/GeoLoc.php +++ /dev/null @@ -1,196 +0,0 @@ -<?php - -namespace PixeesBundle\Entity; - -use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Validator\Constraints as Assert ; -use Doctrine\Common\Collections\ArrayCollection; -use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; - -/** - * PixeesBundle\Entity\GeoLoc - * - * @ORM\Table(name="sf_classcodeadmin_geoLoc") - * @ORM\Entity(repositoryClass="PixeesBundle\Entity\GeoLocRepository") - */ -class GeoLoc -{ - /** - * @var integer $id - * - * @ORM\Column(name="ID", type="integer") - * @ORM\Id - * @ORM\GeneratedValue(strategy="AUTO") - */ - private $id; - - /** - * @var integer $userId - * - * @ORM\OneToOne(targetEntity="People", inversedBy="geoLoc") - * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true) - * - */ - protected $userId; - - /** - * @var float $latitude - * - * @ORM\Column(name="latitude", type="float", length=255) - * - * - */ - private $latitude; - - /** - * @var float $longitude - * - * @ORM\Column(name="longitude", type="float", length=255) - * - * - */ - private $longitude; - - /** - * @var \DateTime $updated_at - * - * @ORM\Column(name="updated_at", type="datetime", nullable=true) - */ - private $updated_at; - - /** - * @var string $updated_by - * - * @ORM\Column(name="updated_by", type="text", type="string", length=255, nullable=true) - */ - private $updated_by; - - public function __construct() { - - } - - /** - * Get id - * - * @return integer - */ - public function getId() - { - return $this->id; - } - - - /** - * Set people - * - * @param \PixeesBundle\Entity\People $people - * @return GeoLoc - */ - public function setPeople(\PixeesBundle\Entity\People $people) - { - $this->userId = $people; - return $this; - } - - /** - * Get people - * - * @return \PixeesBundle\Entity\People - */ - public function getPeople() - { - return $this->userId; - } - - /** - * Set latitude - * - * @param float $latitude - * @return GeoLoc - */ - public function setLatitude($latitude) - { - $this->latitude = $latitude; - return $this; - } - - /** - * Get latitude - * - * @return string - */ - public function getLatitude() - { - return $this->latitude; - } - - /** - * Set longitude - * - * @param float $longitude - * @return GeoLoc - */ - public function setLongitude($longitude) - { - $this->longitude = $longitude; - return $this; - } - - /** - * Get longitude - * - * @return float - */ - public function getLongitude() - { - return $this->longitude; - } - - - /** - * Set updated_at - * - * @param \DateTime $date - * @return Coordination - */ - public function setUpdatedAt($date) - { - $this->updated_at = $date; - - return $this; - } - - /** - * Get updated_at - * - * @return \DateTime - */ - public function getUpdatedAt() - { - return $this->updated_at; - } - - /** - * Set updated_by - * - * @param string $login - * @return Coordination - */ - public function setUpdatedBy($login) - { - $this->updated_by = $login; - - return $this; - } - - /** - * Get updated_by - * - * @return string - */ - public function getUpdatedBy() - { - return $this->updated_by; - } - -} \ No newline at end of file diff --git a/src/PixeesBundle/Entity/GeoLocRepository.php b/src/PixeesBundle/Entity/GeoLocRepository.php deleted file mode 100644 index 598aa11908f6e92295ffbd866e543f83a1ff6e76..0000000000000000000000000000000000000000 --- a/src/PixeesBundle/Entity/GeoLocRepository.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -namespace PixeesBundle\Entity; - -use Doctrine\ORM\EntityRepository; - -/** - * GeoLocRepository - * - * Add your own custom - * repository methods below. - */ -class GeoLocRepository extends EntityRepository -{ - public function findAll(){ - return $this->findBy(array(), array('object_id' => 'ASC')); - } -} diff --git a/src/PixeesBundle/Entity/People.php b/src/PixeesBundle/Entity/People.php index 3fb2fbf9b25c6af0f7eb7cbdd69ef6dc7b10e0a2..bafe064158d46745cca3d644613326e2bf91583d 100644 --- a/src/PixeesBundle/Entity/People.php +++ b/src/PixeesBundle/Entity/People.php @@ -74,12 +74,6 @@ class People implements UserInterface */ private $isActive; - /** - * @ORM\OneToOne(targetEntity="GeoLoc", mappedBy="userId") - * - */ - protected $geoLoc; - public function __construct() { $this->isActive = true; $this->metaDatas = new ArrayCollection(); @@ -223,25 +217,4 @@ class People implements UserInterface // see section on salt below return null; } - - /** - * Set GeoLoc - * - * @param \PixeesBundle\Entity\GeoLoc - * @return People - */ - - public function setGeoLoc(\PixeesBundle\Entity\GeoLoc $geoloc){ - $this->geoLoc = $geoloc; - return $this; - } - - /** - * Get GeoLoc - * - * @return \PixeesBundle\Entity\GeoLoc - */ - public function getGeoLoc(){ - return $this->geoLoc; - } } \ No newline at end of file