예제 #1
0
    // $Trials[$count-1]['Stimuli']    = $stimuli[ ($procedure[$count]['Item']) ];         // adding 'Stimuli', as an array, to each position of $Trials
    $Trials[$count - 1]['Procedure'] = $procedure[$count];
    // adding 'Procedure', as an array, to each position of $Trials
    $Trials[$count - 1]['Response'] = $allColumnsOutput;
    // on trials with no Stimuli info (e.g., freerecall) keep the same Stimuli structure but fill with 'n/a' values
    // I need a consistent Trial structure to do all of the automatic output creation I do later on
    if ($Trials[$count - 1]['Stimuli'] == NULL) {
        $stim =& $Trials[$count - 1]['Stimuli'];
        $stim = $stimuli[2];
        $stimKey = array_keys($stim);
        $empty = array_fill_keys($stimKey, 'n/a');
        $Trials[$count - 1]['Stimuli'] = $empty;
    }
    if ($count == $procedureLength - 1) {
        // when the last trial has been loaded
        $Trials[$count] = cleanTrial($Trials[$count - 1]);
        // return a copy of the last trial without any values in it
        $Trials[$count]['Procedure']['Item'] = 'ExperimentFinished';
        // add this flag so we know when participants are done with all sessions
    }
}
#### Establishing $_SESSION['Trials'] as the place where all experiment trials are stored
// $Trials also contains trials for other sessions but experiment.php sends to done.php once a *NewSession* shows up
$_SESSION['Trials'] = $Trials;
$_SESSION['Position'] = 1;
$_SESSION['PostNumber'] = 0;
#### Figuring out what the output filename will be
$outputFile = ComputeString($_CONFIG->output_file_name) . $_CONFIG->output_file_ext;
$_SESSION['Output File'] = "{$_FILES->raw_output}/{$outputFile}";
$_SESSION['Start Time'] = date('c');
###############################################################################
예제 #2
0
            }
            if ($stim === array()) {
                foreach ($_SESSION['Stimuli'][2] as $column => $unused) {
                    $stim[$column] = 'n/a';
                }
            } else {
                foreach ($stim as &$values) {
                    $values = implode('|', $values);
                }
                unset($values);
            }
            $_SESSION['Trials'][$i]['Stimuli'] = $stim;
            $_SESSION['Trials'][$i]['Procedure'] = $procRow;
            $_SESSION['Trials'][$i]['Response'] = array();
        }
        $_SESSION['Trials'][$i + 1] = cleanTrial($_SESSION['Trials'][$i]);
        $_SESSION['Trials'][$i + 1]['Procedure']['Item'] = 'ExperimentFinished';
        #### Finished pseudo-login
    }
}
if (isset($redirect)) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
    exit;
}
include $_PATH->get('Header');
$stimuliFiles = scandir($_PATH->stimuli_dir);
foreach ($stimuliFiles as $i => $fileName) {
    if (!is_file("{$_PATH->stimuli_dir}/{$fileName}")) {
        unset($stimuliFiles[$i]);
        continue;
    }