<commit_before><?php

namespace Administrator\Administration\AdminBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use BDD\BddClientBundle\Entity\Utilisateurs;
use BDD\BddClientBundle\Entity\Histoire;

use Administrator\Administrator\AdminBundle\Ressources;

class HistoireController extends Controller
{
	public function pageAccueilGestionHistoireAction(){
		$session = $this->getRequest()->getSession();
		if ( ($session->get('pren') != NULL) && (strtolower($session->get('typ')) == 'administrateur') ) {
			$em = $this->getDoctrine()->getManager();
			$repository = $em
                        ->getRepository('BDDBddClientBundle:Histoire');
            $listeHistoire=$repository->findAll();
			return $this->render('AdministratorAdministrationAdminBundle:Histoire:gererHistoireAccueil.html.twig',array('listHistoire' => $listeHistoire));
		}else{
			return $this->redirect($this->generateUrl('accueil_accueil_homepage'));
		}		
	}

	public function modificationActionHistoireAction(){
		$session = $this->getRequest()->getSession();
		if ( ($session->get('pren') != NULL) && (strtolower($session->get('typ')) == 'administrateur') ) {
			$articleId = $_POST['articleId'];
           	$button = $_POST['buttonId'];

			if($button == "Modifier"){
				
			}
		   	if($button == "Supprimer"){
				
			}
		}else{
			return $this->redirect($this->generateUrl('accueil_accueil_homepage'));
		}		
	}
	public function ajouterHistoireAction(Request $request){
		$session = $this->getRequest()->getSession();
		if ( ($session->get('pren') != NULL) && (strtolower($session->get('typ')) == 'administrateur') ) {
			$histoire = new Histoire();
         	$form = $this->createFormBuilder($histoire)
         		->add('titre','text')
         		->add('colorTitre', 'choice', array(
         		 'choices'   => array(
         		   'black' => 'Noir',
         		   'red' => 'Rouge',
         		   'green' => 'Vert',
         		   'orange' => 'Orange',
         		   'brown' => 'Marron',
         		   'blue' => 'Bleu')))
         		->add('contenu','textarea')
         		->add('colorContenu', 'choice', array(
         		 'choices'   => array(
         		   'black' => 'Noir',
         		   'red' => 'Rouge',
         		   'green' => 'Vert',
         		   'orange' => 'Orange',
         		   'brown' => 'Marron',
         		   'blue' => 'Bleu')))     
         		->add('lienPhoto','file')
    			->add('positionPhoto', 'choice', array(
         		   'choices'   => array(
         		    	'hg' => 'En haut a gauche',
         		    	'hd' => 'En haut a droite',
         		    	'bg' => 'En bas a gauche',
         		    	'bd' => 'En bas a droite'))) 
         		->add('valider','submit')
         		->add('annuler','reset')
         		->getForm();
        	$form->handleRequest($request);
        	
        	if($form->isValid()){
				$histoire=$form->getData();
				
        	}
        	return $this->render(
        		'AdministratorAdministrationAdminBundle:Histoire:formAjouterHistoire.html.twig', 
        		array('form' => $form->createView()));
        }else{
            return $this->redirect($this->generateUrl('accueil_accueil_homepage'));
        }
    }

    public function ajouterHistoireBisAction(){
		$session = $this->getRequest()->getSession();
		if ( ($session->get('pren') != NULL) && (strtolower($session->get('typ')) == 'administrateur') ) {
			
			
        }
    }
		
}
<commit_msg>histoire<commit_after><?php

namespace Administrator\Administration\AdminBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use BDD\BddClientBundle\Entity\Utilisateurs;
use BDD\BddClientBundle\Entity\Histoire;

use Administrator\Administrator\AdminBundle\Ressources;

class HistoireController extends Controller
{
	public function pageAccueilGestionHistoireAction(){
		$session = $this->getRequest()->getSession();
		if ( ($session->get('pren') != NULL) && (strtolower($session->get('typ')) == 'administrateur') ) {
			$em = $this->getDoctrine()->getManager();
			$repository = $em
                        ->getRepository('BDDBddClientBundle:Histoire');
            $listeHistoire=$repository->findAll();
			return $this->render('AdministratorAdministrationAdminBundle:Histoire:gererHistoireAccueil.html.twig',array('listHistoire' => $listeHistoire));
		}else{
			return $this->redirect($this->generateUrl('accueil_accueil_homepage'));
		}		
	}

	public function modificationActionHistoireAction(){
		$session = $this->getRequest()->getSession();
		if ( ($session->get('pren') != NULL) && (strtolower($session->get('typ')) == 'administrateur') ) {
			$articleId = $_POST['articleId'];
           	$button = $_POST['buttonId'];

			if($button == "Modifier"){
				
			}
		   	if($button == "Supprimer"){
				
			}
		}else{
			return $this->redirect($this->generateUrl('accueil_accueil_homepage'));
		}		
	}
	public function ajouterHistoireAction(Request $request){
		$session = $this->getRequest()->getSession();
		if ( ($session->get('pren') != NULL) && (strtolower($session->get('typ')) == 'administrateur') ) {
			$histoire = new Histoire();
         	$form = $this->createFormBuilder($histoire)
         		->add('titre','text')
         		->add('colorTitre', 'choice', array(
         		 'choices'   => array(
         		   'black' => 'Noir',
         		   'red' => 'Rouge',
         		   'green' => 'Vert',
         		   'orange' => 'Orange',
         		   'brown' => 'Marron',
         		   'blue' => 'Bleu')))
         		->add('contenu','textarea')
         		->add('colorContenu', 'choice', array(
         		 'choices'   => array(
         		   'black' => 'Noir',
         		   'red' => 'Rouge',
         		   'green' => 'Vert',
         		   'orange' => 'Orange',
         		   'brown' => 'Marron',
         		   'blue' => 'Bleu')))     
         		->add('lienPhoto','file')
    			->add('positionPhoto', 'choice', array(
         		   'choices'   => array(
         		    	'hg' => 'HautGauche',
         		    	'hd' => 'HautDroite',
         		    	'bg' => 'BasGauche',
         		    	'bd' => 'BasDroite'))) 
           ->add('valider','submit')
           ->add('annuler','reset')
         		->getForm();
        	$form->handleRequest($request);
        	
        	if($form->isValid()){
				$histoire=$form->getData();
				$tableauCarIndesirable = array(" ", "-", "#", "~", "\t", "\n", "\r", "\0", "\x0B", "\xA0");
            $uploadedFile = $histoire -> getLienPhoto();
            $fileName = str_replace($tableauCarIndesirable, "", $uploadedFile -> getClientOriginalName());
            $dir = $this->getRequest()->server->get('DOCUMENT_ROOT') . $this->getRequest()->getBasePath() . "/images/";
            $uploadedFile->move($dir, $fileName.time());
            $histoire->setLienPhoto($fileName.time());

            $em = $this->getDoctrine()->getManager();
            $em->persist($histoire);
            $em->flush();
        	}
        	return $this->render(
        		'AdministratorAdministrationAdminBundle:Histoire:formAjouterHistoire.html.twig', 
        		array('form' => $form->createView()));
        }else{
            return $this->redirect($this->generateUrl('accueil_accueil_homepage'));
        }
    }


		
}

{'fraction_non_alphanumeric': 0.185989010989011, 'fraction_numerical': 0.0004120879120879121, 'mean_word_length': 2.6278026905829597, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 138, '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': '3875695', 'n_tokens_mistral': 2489, 'n_tokens_neox': 2347, 'n_words': 328}