<?php

include "../config.php";
include "classes.php";

$condX = $_REQUEST['condX'];
$conX = $_REQUEST['conX'];
$tabStatus = $_REQUEST['tabStatus'];
$tblX = $_REQUEST['tblX'];
$Q29a = array(1,2,3,4,5,6,7,8,9,10);

$dataX = array();

if($conX==1)
{    
    $condX="1=1";   
}

$profileOverall = new ProfileOverall($conn,$tblX,$Q29a);
$profileAirport = new ProfileAirport($conn,$tblX,$Q29a,$condX);

if($tabStatus=="false")
{
    $data['genderOverall'] = $profileOverall->profileOverallCount('HQ8',range(1, 2));
    $data['ageOverall'] = $profileOverall->profileOverallCount('HQ9',array(2,3,4,5));
    $data['airportOverall'] = $profileOverall->profileOverallCount('Q5',array(1,2,3,4,5,6,7));
    $data['incomeOverall'] = $profileOverall->profileOverallCount('Q11',array(1,2,3,4));
    $data['segmentOverall'] = $profileOverall->profileOverallCount('Q13a',array(1,2));
    $data['typesOverall'] = $profileOverall->profileOverallCount('Q13b',array(1,2));
    $data['dwellOverallD'] = $profileOverall->profileOverallCount('Q16a',array(1,2,3,4,5,6));
    $data['dwellOverallA'] = $profileOverall->profileOverallCount('Q16b',array(1,2,3,4,5,6));
    $data['frequencyOverallD'] = $profileOverall->profileOverallCount('Q17a',array(1,2,3,4,5));
    $data['frequencyOverallI'] = $profileOverall->profileOverallCount('Q17b',array(1,2,3,4,5));
    $data['travellingOverall'] = $profileOverall->profileOverallCount('Q18',array(1,2,3,4));
    $data['purposeOverall'] = $profileOverall->profileOverallCount('Q19',array(1,2,3,4,5));
    $data['terminalOverall'] = $profileOverall->profileOverallCount('Q5a',array(1,2,3));
    $data['travellerOverall'] = $profileOverall->profileOverallCount('Q14c',array(1,2));
}

$data['genderAirport'] = $profileAirport->profileAirportCount('HQ8',range(1, 2),$airport);
$data['ageAirport'] = $profileAirport->profileAirportCount('HQ9',array(2,3,4,5),$airport);
$data['incomeAirport'] = $profileAirport->profileAirportCount('Q11',array(1,2,3,4),$airport);
$data['segmentAirport'] = $profileAirport->profileAirportCount('Q13a',array(1,2),$airport);
$data['typesAirport'] = $profileAirport->profileAirportCount('Q13b',array(1,2),$airport);
$data['dwellAirportD'] = $profileAirport->profileAirportCount('Q16a',array(1,2,3,4,5,6),$airport);
$data['dwellAirportA'] = $profileAirport->profileAirportCount('Q16b',array(1,2,3,4,5,6),$airport);
$data['frequencyAirportD'] = $profileAirport->profileAirportCount('Q17a',array(1,2,3,4,5),$airport);
$data['frequencyAirportI'] = $profileAirport->profileAirportCount('Q17b',array(1,2,3,4,5),$airport);
$data['travellingAirport'] = $profileAirport->profileAirportCount('Q18',array(1,2,3,4),$airport);
$data['purposeAirport'] = $profileAirport->profileAirportCount('Q19',array(1,2,3,4,5),$airport);
$data['terminalAirport'] = $profileAirport->profileAirportCount('Q5a',array(1,2,3),$airport);
$data['travellerAirport'] = $profileAirport->profileAirportCount('Q14c',array(1,2),$airport);


echo json_encode($data);

?>