// // Janata Lab // UC Davis Center for Mind and Brain // Developed for the Ensemble Project // // require_once('../include/subject_includes.php'); $_SESSION['submit_stimulus_id'] = TRUE; // get info from experiment_x_form and form tables include('query_form_info.php'); // only play stim if soundCompleted was not sent by flash player, // or we are not revisiting the form because of an error in the response posting // this is hard to follow, as it's written $doPlayStim = (!($_SESSION['stimulus_completed']) && !( isset($_GET['inline_error_message']) && ($_GET['inline_error_message'] != "") || isset($_POST['inline_error_message']) && ($_POST['inline_error_message'] != "") )); if( $doPlayStim ) { ignore_user_abort( FALSE ); $matlabCommand = parse_matlab_arguments( $row_form_info[ 'stimulus_matlab' ] ); // execute matrpc call, store result as trialId $trialId = matrpc_message( $matlabCommand ); if( $trialId == "end" ) // matrpc function has told us to end the experiment // this can override ensemble's loop mechanism if it's not finished { unset( $_SESSION['trial_id'] ); //after all trials have been exhausted, break out of the loop $_SESSION['num_skip_forms'] = 1; include( $questionnaire_dir."form_processing/update_session.php" ); } elseif( $trialId == "break" ) // take a break { include( $questionnaire_dir."form_processing/htmlhead_name_mesg.php" ); printf( "
"); } elseif( is_numeric( $trialId ) && $trialId > 0 ) // we got a good result from the matrpc call { switch($_SESSION['language']) { case "german": include('htmlhead_name_mesg_formhead_german.php'); break; default: include('htmlhead_name_mesg_formhead.php'); break; } $_SESSION['trial_id'] = $trialId; // prototype is: present_trial_stimuli( $trialId, $player, $duration1, $pause1, $duration2, $pause2 ); present_trial_stimuli( $trialId,'present_audio_stimuli_muschoose.swf'); // defaults are fine for the other parameters printf("