<commit_before><?php

namespace eALPS\PortalBundle\Controller;

use \DateTime;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

// these import the "@Route" and "@Template" annotations
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

use eALPS\PortalBundle\Entity\Info;
use eALPS\PortalBundle\Form\Type\InfoType;

class InfoController extends Controller
{
	
	public function localAction()
	{
		$infoArray = $this
				-> getDoctrine()
				-> getEntityManager('info')
				-> getRepository('eALPSPortalBundle:Info')
				-> findByAvailability(1);
				/*
					-> createQuery("
					SELECT id, title, body, importance, address, datetime(insertdate) as insertdate, datetime(updatedate) as updatedate, datetime(deletedate) as deletedate, term, availability
					FROM info
					ORDER BY updatedate DESC
				")
				-> getResult();
				*/
				
		return $this->render('eALPSPortalBundle:Info:local.html.twig', array('infoArray' => $infoArray));
	}
	
	public function localAdminAction(Request $request)
	{
		$infoArray = $this
			-> getDoctrine()
			-> getEntityManager('info')
			-> getRepository('eALPSPortalBundle:Info')
			-> findAll();
				/*
					-> createQuery("
					SELECT id, title, body, importance, address, datetime(insertdate) as insertdate, datetime(updatedate) as updatedate, datetime(deletedate) as deletedate, term, availability
					FROM info
					ORDER BY updatedate DESC
				")
				-> getResult();
				*/
				
		$insertInfo = new Info();
		$insertForm = $this->createForm(new InfoType(), $insertInfo);
		$insertAction = $this->get('router')->generate('e_alps_portal_info_insert');
		
		$updateInfo = new Info();
		$updateForm = $this->createForm(new InfoType(), $updateInfo);
		$updateAction = $this->get('router')->generate('e_alps_portal_info_update');
		
		return $this->render('eALPSPortalBundle:Info:localAdmin.html.twig', array('infoArray' => $infoArray, 'insertForm' => $insertForm->createView(), 'insertAction' => $insertAction, 'updateForm' => $updateForm->createView(), 'updateAction' => $updateAction));
	}
	
	public function insertAction(Request $request)
	{
		$insertInfo = new Info();
		$insertForm = $this->createForm(new InfoType(), $insertInfo);

		if ($request -> getMethod() == 'POST') {
			$insertForm -> bindRequest($request);
			
			$date = new DateTime();
			$insertInfo -> setInsertdate($date -> format('Y-m-d H:i:s'));
			$insertInfo -> setUpdatedate($date -> format('Y-m-d H:i:s'));
			
			$em = $this
				-> getDoctrine()
				-> getEntityManager('info');
			$em -> persist($insertInfo);
			$em -> flush();
			
			return $this->redirect($this->generateUrl('e_alps_portal_info_local_admin'));
			
		}
		
		return $this->redirect($this->generateUrl('e_alps_portal_info_local_admin'));
	}
	
	public function updateAction(Request $request)
	{
		$updateInfo = new Info();
		$updateForm = $this->createForm(new InfoType(), $updateInfo);

		if ($request -> getMethod() == 'POST') {
			$insertForm -> bindRequest($request);
			
			$date = new DateTime();
			$updateInfo -> setUpdatedate($date -> format('Y-m-d H:i:s'));
			
			$em = $this
				-> getDoctrine()
				-> getEntityManager('info');
			$em -> persist($info);
			$em -> flush();
			
			return $this->redirect($this->generateUrl('e_alps_portal_info_local_admin'));
			
		}
		
		return $this->redirect($this->generateUrl('e_alps_portal_info_local_admin'));
	}
}
 <commit_msg>お知らせ編集機能の改良<commit_after><?php

namespace eALPS\PortalBundle\Controller;

use \DateTime;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

// these import the "@Route" and "@Template" annotations
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

use eALPS\PortalBundle\Entity\Info;
use eALPS\PortalBundle\Form\Type\InfoType;

class InfoController extends Controller
{
	
	public function localAction()
	{
		$infoArray = $this
				-> getDoctrine()
				-> getEntityManager('info')
				-> getRepository('eALPSPortalBundle:Info')
				-> findByAvailability(1);
				/*
					-> createQuery("
					SELECT id, title, body, importance, address, datetime(insertdate) as insertdate, datetime(updatedate) as updatedate, datetime(deletedate) as deletedate, term, availability
					FROM info
					ORDER BY updatedate DESC
				")
				-> getResult();
				*/
				
		return $this->render('eALPSPortalBundle:Info:local.html.twig', array('infoArray' => $infoArray));
	}
	
	public function localAdminAction(Request $request)
	{
		$infoArray = $this
			-> getDoctrine()
			-> getEntityManager('info')
			-> getRepository('eALPSPortalBundle:Info')
			-> findAll();
				/*
					-> createQuery("
					SELECT id, title, body, importance, address, datetime(insertdate) as insertdate, datetime(updatedate) as updatedate, datetime(deletedate) as deletedate, term, availability
					FROM info
					ORDER BY updatedate DESC
				")
				-> getResult();
				*/
				
		$insertInfo = new Info();
		$insertForm = $this->createForm(new InfoType(), $insertInfo);
		$insertAction = $this->get('router')->generate('e_alps_portal_info_insert');
		
		$updateInfo = new Info();
		$updateForm = $this->createForm(new InfoType(), $updateInfo);
		$updateAction = $this->get('router')->generate('e_alps_portal_info_update');
		
		return $this->render('eALPSPortalBundle:Info:localAdmin.html.twig', array('infoArray' => $infoArray, 'insertForm' => $insertForm->createView(), 'insertAction' => $insertAction, 'updateForm' => $updateForm->createView(), 'updateAction' => $updateAction));
	}
	
	public function insertAction(Request $request)
	{
		$insertInfo = new Info();
		$insertForm = $this->createForm(new InfoType(), $insertInfo);

		if ($request -> getMethod() == 'POST') {
			$insertForm -> bindRequest($request);
			
			$date = new DateTime();
			$insertInfo -> setInsertdate($date -> format('Y-m-d H:i:s'));
			$insertInfo -> setUpdatedate($date -> format('Y-m-d H:i:s'));
			
			$em = $this
				-> getDoctrine()
				-> getEntityManager('info');
			$em -> persist($insertInfo);
			$em -> flush();
			
			return $this->redirect($this->generateUrl('e_alps_portal_info_local_admin'));
			
		}
		
		return $this->redirect($this->generateUrl('e_alps_portal_info_local_admin'));
	}
	
	public function updateAction(Request $request)
	{
		$updateInfo = new Info();
		$updateForm = $this->createForm(new InfoType(), $updateInfo);

		if ($request -> getMethod() == 'POST') {
			$updateForm -> bindRequest($request);
			
			$date = new DateTime();
			$updateInfo -> setUpdatedate($date -> format('Y-m-d H:i:s'));
			
			$em = $this
				-> getDoctrine()
				-> getEntityManager('info');
			$em -> persist($info);
			$em -> flush();
			
			return $this->redirect($this->generateUrl('e_alps_portal_info_local_admin'));
			
		}
		
		return $this->redirect($this->generateUrl('e_alps_portal_info_local_admin'));
	}
}
 
{'fraction_non_alphanumeric': 0.1593579822298653, 'fraction_numerical': 0.00028661507595299513, 'mean_word_length': 4.30722433460076, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 115, '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': '821933', 'n_tokens_mistral': 2560, 'n_tokens_neox': 2178, 'n_words': 414}