Exemplo n.º 1
0
 if (!isset($_SESSION['Timestamp'])) {
     $_SESSION['Timestamp'] = microtime(true);
 }
 // setting up easier to use and read aliases(shortcuts) of $_SESSION data
 $condition =& $_SESSION['Condition'];
 $currentPos =& $_SESSION['Position'];
 $currentPost =& $_SESSION['PostNumber'];
 $currentTrial =& $_SESSION['Trials'][$currentPos];
 $currentStimuli = $currentTrial['Stimuli'];
 createAliases($currentStimuli);
 // this will also create aliases of any columns that apply to the current trial (filtering out "post X" prefixes when necessary)
 // currentProcedure becomes an array of all columns matched for this trial, using their original column names
 $currentProcedure = ExtractTrial($currentTrial['Procedure'], $currentPost);
 if (!isset($trialType)) {
     $error = array('Error*Missing_Trial_Type' => 'Post ' . $_SESSION['PostNumber']);
     recordTrial();
     header('Location: experiment.php');
     exit;
 }
 $trialType = strtolower($trialType);
 $trialFiles = getTrialTypeFiles($trialType);
 if (isset($trialFiles['script'])) {
     $addedScripts = array($trialFiles['script']);
 }
 if (isset($trialFiles['style'])) {
     $addedStyles = array($trialFiles['style']);
 }
 if (!isset($item)) {
     $item = $currentTrial['Procedure']['Item'];
 }
 if ($currentPost < 1) {
Exemplo n.º 2
0
    foreach ($answers as $i => $ans) {
        $extraData = array();
        $extraData['Serial_Position'] = $i + 1;
        foreach ($stimInfo as $header => $contents) {
            $extraData['Serial_' . $header] = $contents[$i];
        }
        if (isset($match[$i])) {
            $extraData['Serial_Matched_Word'] = $match[$i]['word'];
            $extraData['Serial_Matched_Diff'] = $match[$i]['diff'];
            $extraData['Serial_Output_Order'] = $match[$i]['output_order'];
            $extraData['Serial_lenientAcc'] = 1;
            $extraData['Serial_lenientVal'] = $value[$i];
            if ($match[$i]['diff'] === 0) {
                $extraData['Serial_strictAcc'] = 1;
                $extraData['Serial_strictVal'] = $value[$i];
            } else {
                $extraData['Serial_strictAcc'] = 0;
                $extraData['Serial_strictVal'] = 0;
            }
        } else {
            $extraData['Serial_Matched_Word'] = '_';
            $extraData['Serial_Matched_Diff'] = '_';
            $extraData['Serial_Output_Order'] = '_';
            $extraData['Serial_lenientAcc'] = 0;
            $extraData['Serial_lenientVal'] = 0;
            $extraData['Serial_strictAcc'] = 0;
            $extraData['Serial_strictVal'] = 0;
        }
        recordTrial($extraData, false, false);
    }
}