<commit_before><?php

namespace ActivitiesBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
use ActivitiesBundle\Entity\ActivityIdea;
use ActivitiesBundle\Entity\ActivitiesVote;
use Doctrine\ORM\EntityRepository;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\HttpFoundation\Response;

class ActivityController extends Controller 
{
	/**
	 * @Route("all", name="activitiesShow")
	 */
	public function showAllAction(){
		$listActivities = $this->getDoctrine()->getManager()->getRepository('ActivitiesBundle:Activity')->findAll();

		return $this->render('ActivitiesBundle::listActivity.html.twig', array('listActivities' => $listActivities));
	}

	/**
	 * @Route("activity", name="activityShow")
	 */
	public function showActivityAction(Request $request){
		$id = $request->request->get("id");

		$activity = $this->getDoctrine()->getManager()->getRepository('ActivitiesBundle:Activity')->find($id);
		$photos = $this->getDoctrine()->getManager()->getRepository('ActivitiesBundle:ActivityPhoto')->findBy(array('activity'=>$activity));
		
		return $this->render('ActivitiesBundle::activity.html.twig', array(
			'titre'=> $activity->getName(),
			'description' => $activity->getDescription(),
			//'date' => DateTime::format ( $activity->getDate() ),
			'vote' =>$activity->getVote(),
			'photos' => $photos
			));
	}

	/**
	* @Route("showActivitiesVote", name="showActivitiesVote")
	*/
	public function showActivitiesVoteAction(){
		$listActivitiesIdea = $this->getDoctrine()->getManager()->getRepository('ActivitiesBundle:ActivityIdea')->findAll();
		$listActivitiesVote = $this->getDoctrine()->getManager()->getRepository('ActivitiesBundle:ActivitiesVote');

		$dates = [];
		$votes = [];

		foreach($listActivitiesIdea as $activity)
		{
			$activityDates = $listActivitiesVote->findByActivity($activity);
			$activityVote = $listActivitiesVote->findOneByActivity($activity);

			foreach($activityDates as $date)
			{
				$dates[$activity->getId()][] = $date->getDate();				
			}

			$votes[$activity->getId()] = $activityVote->getVote();
		}

		return $this->render('ActivitiesBundle::listActivityVote.html.twig', array(
				'listActivitiesIdea' => $listActivitiesIdea,
				'dates' => $dates,
				'votes' => $votes,
			));
	}

	/**
	* @Route("summary", name="summaryActivity")
	*/
	public function showSummaryActivityAction(){
		return $this->render('ActivitiesBundle::summaryActivity.html.twig');
	}

	/**<commit_msg>modif vue inscrit<commit_after><?php

namespace ActivitiesBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
use ActivitiesBundle\Entity\ActivityIdea;
use ActivitiesBundle\Entity\ActivitiesVote;
use Doctrine\ORM\EntityRepository;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\HttpFoundation\Response;

class ActivityController extends Controller 
{
	/**
	 * @Route("all", name="activitiesShow")
	 */
	public function showAllAction(){
		$listActivities = $this->getDoctrine()->getManager()->getRepository('ActivitiesBundle:Activity')->findAll();

		return $this->render('ActivitiesBundle::listActivity.html.twig', array('listActivities' => $listActivities));
	}

	/**
	 * @Route("activity", name="activityShow")
	 */
	public function showActivityAction(Request $request){
		$id = $request->request->get("id");

		$activity = $this->getDoctrine()->getManager()->getRepository('ActivitiesBundle:Activity')->find($id);
		$photos = $this->getDoctrine()->getManager()->getRepository('ActivitiesBundle:ActivityPhoto')->findBy(array('activity'=>$activity));
		
		return $this->render('ActivitiesBundle::activity.html.twig', array(
			'titre'=> $activity->getName(),
			'description' => $activity->getDescription(),
			//'date' => DateTime::format ( $activity->getDate() ),
			'vote' =>$activity->getVote(),
			'photos' => $photos
			));
	}

	/**
	* @Route("showActivitiesVote", name="showActivitiesVote")
	*/
	public function showActivitiesVoteAction(){
		$listActivitiesIdea = $this->getDoctrine()->getManager()->getRepository('ActivitiesBundle:ActivityIdea')->findAll();
		$listActivitiesVote = $this->getDoctrine()->getManager()->getRepository('ActivitiesBundle:ActivitiesVote');

		$dates = [];
		$votes = [];

		foreach($listActivitiesIdea as $activity)
		{
			$activityDates = $listActivitiesVote->findByActivity($activity);
			$activityVote = $listActivitiesVote->findOneByActivity($activity);

			foreach($activityDates as $date)
			{
				$dates[$activity->getId()][] = $date->getDate();				
			}

			$votes[$activity->getId()] = $activityVote->getVote();
		}

		return $this->render('ActivitiesBundle::listActivityVote.html.twig', array(
				'listActivitiesIdea' => $listActivitiesIdea,
				'dates' => $dates,
				'votes' => $votes,
			));
	}

	/**
	* @Route("summary", name="summaryActivity")
	*/
	public function showSummaryActivityAction(){
		$activities = $this->getDoctrine()->getManager()->getRepository('ActivitiesBundle:Activity')->findAll();
		return $this->render('ActivitiesBundle::summaryActivity.html.twig', array(
			"activities" => $activities
			));
	}

	/**
{'fraction_non_alphanumeric': 0.1691065118626956, 'fraction_numerical': 0.0, 'mean_word_length': 6.293251533742331, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 98, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2271203', 'n_tokens_mistral': 1937, 'n_tokens_neox': 1771, 'n_words': 229}