<commit_before><?php

namespace Spacebit\AdminBundle\Controller;

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

class VenuesController extends Controller
{
    public function venuesAction()
    {



        $conn = $this->get('database_connection');


        if (!$this->get('login_authenticator')->authenticateLowLevelAdminLogin()) {
            return new RedirectResponse($this->generateUrl('spacebit_user_login'));
        }

        $stmt = $conn->prepare('SELECT request_id, user_id,venue.resource_id, date_from,date_to, time_from,time_to, status FROM resource_request INNER JOIN venue on  venue.resource_id = resource_request.resource_id ORDER BY status DESC, date_from DESC, time_from DESC;');
        $conn = $this->get('database_connection');
        $stmt = $conn->prepare('SELECT request_id, user_id,venue.resource_id, date_from,date_to, time_from,time_to, status FROM resource_request INNER JOIN venue on venue.resource_id = resource_request.resource_id ORDER BY status DESC, date_from DESC, time_from DESC;');
        $stmt->execute();
        $venues_requests = $stmt->fetchAll();

        return $this->render('SpacebitAdminBundle:Default:venues.html.twig', array(
            'venues_requests'=>$venues_requests,
        ));
    }

    public function getAllAction()
    {

        if (!$this->get('login_authenticator')->authenticateLowLevelAdminLogin()) {
            return new RedirectResponse($this->generateUrl('spacebit_user_login'));
        }
        $conn = $this->get('database_connection');
        $stmt = $conn->prepare('SELECT resource_id, availability, description, capacity, closing_time, dept_name, name, opening_time, venue_type FROM venue INNER JOIN resource USING(resource_id);');
        $stmt->execute();
        $result = $stmt->fetchAll();

        $response = new Response(json_encode(array('result' => $result)));
        $response->headers->set('Content-Type', 'application/json');

        return $response;
    }

    public function getByResourceIDAction()
    {<commit_msg>Commiting<commit_after><?php

namespace Spacebit\AdminBundle\Controller;

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

class VenuesController extends Controller
{
    public function venuesAction()
    {

        if (!$this->get('login_authenticator')->authenticateLowLevelAdminLogin()) {
            return new RedirectResponse($this->generateUrl('spacebit_user_login'));
        }
        $conn = $this->get('database_connection');
  $stmt = $conn->prepare("SELECT dept_name FROM staff  where user_id =:user_id;");
        $stmt->bindValue(':user_id', $this->get('session')->get('user_id'));
        $stmt->execute();
        $staff_member = $stmt->fetch();
/*
        $stmt = $conn->prepare('SELECT request_id,type, user_id,resource_request.resource_id,date_from,date_to, time_from,time_to, status,type,department_name FROM resource_request  where (resource_request.resource_id is NULL  or resource_request.resource_id  in (select resource_id from equipment))  and resource_request.department_name = :dept_name ORDER BY status DESC, date_from DESC, time_from DESC;');
        $stmt->bindValue(':dept_name', $staff_member['dept_name']);
 *
 *
 *
 * */





        $stmt = $conn->prepare('SELECT request_id, user_id,venue.resource_id, date_from,date_to, time_from,time_to, status FROM resource_request INNER JOIN venue on  venue.resource_id = resource_request.resource_id ORDER BY status DESC, date_from DESC, time_from DESC;');
        $conn = $this->get('database_connection');
        $stmt = $conn->prepare('SELECT request_id, user_id,venue.resource_id, date_from,date_to, time_from,time_to, status FROM resource_request INNER JOIN venue on venue.resource_id = resource_request.resource_id ORDER BY status DESC, date_from DESC, time_from DESC;');
        $stmt->execute();
        $venues_requests = $stmt->fetchAll();

        return $this->render('SpacebitAdminBundle:Default:venues.html.twig', array(
            'venues_requests'=>$venues_requests,
        ));
    }

    public function getAllAction()
    {

        if (!$this->get('login_authenticator')->authenticateLowLevelAdminLogin()) {
            return new RedirectResponse($this->generateUrl('spacebit_user_login'));
        }
        $conn = $this->get('database_connection');
        $stmt = $conn->prepare('SELECT resource_id, availability, description, capacity, closing_time, dept_name, name, opening_time, venue_type FROM venue INNER JOIN resource USING(resource_id);');
        $stmt->execute();
        $result = $stmt->fetchAll();

        $response = new Response(json_encode(array('result' => $result)));
        $response->headers->set('Content-Type', 'application/json');

        return $response;
    }

    public function getByResourceIDAction()
    {
{'fraction_non_alphanumeric': 0.12811244979919678, 'fraction_numerical': 0.0, 'mean_word_length': 4.183142559833507, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, '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': '1368502', 'n_tokens_mistral': 1453, 'n_tokens_neox': 1413, 'n_words': 283}