<?php require 'initiateCollector.php'; $trialTypes = getAllTrialTypeFiles(); if (!isset($_SESSION['Trial Tester']) or isset($_POST['resetSession'])) { $_SESSION = array(); $_SESSION['Trial Tester'] = true; } elseif (isset($_POST['LoadStimFile'])) { $_SESSION['Stimuli'] = GetFromFile($_PATH->stimuli_dir . '/' . $_POST['StimuliFile']); $redirect = true; } elseif (isset($_POST['Procedure_Trial_Type'])) { $redirect = true; $posts = array(); foreach ($_POST as $name => $val) { $name = explode('_', htmlspecialchars_decode($name)); $category = array_shift($name); $name = implode('_', $name); if ($category === 'Stimuli' or $category === 'Procedure') { if (is_array($val)) { foreach ($val as &$v) { $v = trim(htmlspecialchars_decode($v)); } unset($v); $val = implode('|~|', $val); } else { $val = trim(htmlspecialchars_decode($val)); } $posts[$category][$name] = $val; } } $trialType = $posts['Procedure']['Trial_Type'];
if ($_CONFIG->password === '') { exit('GetData has not been enabled. Please enter a password in the Settings file in your experiment folder.'); } $_PATH->loadDefault('Current Data', $_CONFIG->experiment_name . '-Data'); // filter user input before using $POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); #### Column Prefixes #### $expPrefix = 'Exp_'; $finalQuestionsPrefix = 'FiQ_'; $demographicsPrefix = 'Dem_'; $statusBeginPrefix = 'Sta_'; $statusEndPrefix = 'End_'; $instructionsPrefix = 'Ins_'; #### // scan the TrialType folder, and take the name of any file ending in .php as a trial type $trialTypes = array_keys(getAllTrialTypeFiles()); // the scopes 'Experiment' and 'Condition' will later cause data in these files to be distributed among all related files in that category // e.g., even if participants only provide demographics in their first session, the scope 'Experiment' will let that data be merged to // their output in later sessions or different conditions $extraFileMeta = array('Demographics' => array('fileName' => pathinfo($_PATH->demographics_data, PATHINFO_FILENAME), 'Prefix' => $demographicsPrefix, 'Scope' => 'Experiment'), 'Final_Questions' => array('fileName' => pathinfo($_PATH->final_questions_data, PATHINFO_FILENAME), 'Prefix' => $finalQuestionsPrefix, 'Scope' => 'Condition'), 'Status_Begin' => array('fileName' => pathinfo($_PATH->status_begin_data, PATHINFO_FILENAME), 'Prefix' => $statusBeginPrefix, 'Scope' => 'ID'), 'Status_End' => array('fileName' => pathinfo($_PATH->status_end_data, PATHINFO_FILENAME), 'Prefix' => $statusEndPrefix, 'Scope' => 'ID'), 'Instructions' => array('fileName' => pathinfo($_PATH->instructions_data, PATHINFO_FILENAME), 'Prefix' => $instructionsPrefix, 'Scope' => 'Condition')); if (!isset($POST['Password']) and count($POST) > 0) { foreach ($extraFileMeta as $category => $fileMeta) { if (!isset($POST[$category]) or !isset($POST[$category . '_Columns'])) { unset($extraFileMeta[$category]); } } } foreach ($extraFileMeta as $metaName => &$extraMeta) { $extraMeta['Columns'] = array(); } unset($extraMeta);