//Author: Stefan Tomic
//Janata Lab
//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
$play_stim = (!($_SESSION['stimulus_completed']) && !( isset($_GET['inline_error_message']) && ($_GET['inline_error_message'] != "") ||
isset($_POST['inline_error_message']) && ($_POST['inline_error_message'] != "") ));
if($play_stim) {
ignore_user_abort(FALSE);
$matlab_call = parse_matlab_arguments($row_form_info['stimulus_matlab']);
$trial_id = matrpc_message($matlab_call);
if (is_numeric($trial_id)) {
switch($_SESSION['language']) {
case "english":
include('htmlhead_name_mesg_formhead.php');
//printf("\n
Playing Sound
\n\n");
break;
case "german":
include('htmlhead_name_mesg_formhead_german.php');
//printf("\nTon Wird Gespielt
\n\n");
break;
default:
include('htmlhead_name_mesg_formhead.php');
//printf("\nPlaying Sound
\n\n");
break;
}
$_SESSION['trial_id'] = $trial_id;
$sql_get_location = sprintf("select location from trial left join stimulus on (trial.stimulus_id1 = stimulus.stimulus_id) ").
sprintf("where trial.trial_id = %d",$_SESSION['trial_id']);
$get_location = mysql_select($sql_get_location);
$relative_stim_path = $get_location['location'];
$stim_url = utf8_encode($relative_stim_path);
//get the stimulus_id for this stim based on the location returned
$sql_stim_id = sprintf("select stimulus_id from stimulus where location='%s'",$relative_stim_path);
mysql_select_db($database_subject,$subject);
$get_stim_id = mysql_query($sql_stim_id, $subject) or die(mysql_error());
$row_stim_id = mysql_fetch_assoc($get_stim_id);
$_SESSION['stimulus_id'] = $row_stim_id['stimulus_id'];
present_stimuli(NULL,$_SESSION['stimulus_id']);
printf("