\n", $_SERVER['PHP_SELF'] ); printf( "This is your chance to take a short break, if you want." ); printf( "Click Next when you are ready to continue.

\n" ); printf( ">>\">\n" ); 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("\n"); } else // ERROR { // what do we do here? } } else // stim have already been played. display the form with its questions, etc. { //submit_lock prevents successive clicks from submitting the form multiple times. It is set to true in submit_response.php ignore_user_abort(FALSE); $_SESSION['submit_lock'] = FALSE; $query_form_questions = sprintf("SELECT form_x_question.form_question_num,form_x_question.question_iteration,question.question_id,question.question_text,question.heading_format,question_x_data_format.subquestion,"). sprintf("question_x_data_format.heading,question_x_data_format.range,question_x_data_format.default,question_x_data_format.html_field_type,question_x_data_format.required,"). sprintf("data_format.data_format_id,data_format.type,data_format.enum_values "). sprintf("FROM form_x_question,question,question_x_data_format,data_format WHERE form_x_question.form_id=%d ",$form_id). sprintf("AND question.question_id=form_x_question.question_id AND question_x_data_format.question_id=question.question_id "). sprintf("AND data_format.data_format_id=question_x_data_format.answer_format_id "). sprintf("ORDER BY form_x_question.form_question_num,form_x_question.question_iteration,question_x_data_format.subquestion"); $form_questions = mysql_query($query_form_questions) or die(mysql_error()); $row_form_questions = mysql_fetch_assoc($form_questions); $totalRows_form_questions = mysql_num_rows($form_questions); //the total number of questions in the form for($iRow = 0;$iRow < $totalRows_form_questions;$iRow++) { $form_field = sprintf("questid_%d_formquest_%d_iter_1_subquest_%d_type_%d",$row_form_questions['question_id'],$row_form_questions['form_question_num'], $row_form_questions['subquestion'],$row_form_questions['data_format_id']); if($iRow == 0) { $form_field = $form_field."_enum_0"; $enum_vals = enumstr2array($row_form_questions['enum_values']); $enum_ind = array_search($_SESSION['responseMade'],$enum_vals); $_POST[$form_field] = strval($enum_ind); } else { if(strcmp($_SESSION['timeOfResponse'],'NaN')==0) $_SESSION['timeOfResponse'] = '-1'; //convert NaNs to -1 $_POST[$form_field] = strval($_SESSION['timeOfResponse']); } $row_form_questions = mysql_fetch_assoc($form_questions); } include('submit_response.php'); } ?>