コード例 #1
0
/**
 * Prints an array in a readable manner and appends collapsible tags for CSS and
 * Javascript manipulation. Useful for debugging.
 * @param array $displayArray The array to print.
 * @param string $name The title of the array.
 */
function readable(array $displayArray, $name = "Untitled array")
{
    // convert to string to prevent parsing code
    $clean_displayArray = arrayCleaner($displayArray);
    // echo HTML
    echo '<div>' . '<div class="button collapsibleTitle">' . '<h3>' . $name . '</h3>' . '<p>(Click to Open/Close)</p>' . '</div>' . '<pre>', print_r($clean_displayArray, true), '</pre>' . '</div>';
}
コード例 #2
0
    <!-- hidden field that JQuery/JavaScript uses to check the timing to $postTo -->
    <div id="maxTime"   class="hidden"> <?php 
echo $maxTime;
?>
 </div>
    <div id="minTime"   class="hidden"> <?php 
echo $minTime;
?>
 </div>

     <?php 
#### Diagnostics ####
if ($_CONFIG->trial_diagnostics == true or $trialFail == true) {
    // clean the arrays used so that they output strings, not code
    $clean_session = arrayCleaner($_SESSION);
    $clean_currentTrial = arrayCleaner($currentTrial);
    echo '<div class=diagnostics>' . '<h2>Diagnostic information</h2>' . '<ul>' . '<li> Condition #: ' . $clean_session['Condition']['Number'] . '</li>' . '<li> Condition Stimuli File:' . $clean_session['Condition']['Stimuli'] . '</li>' . '<li> Condition Procedure File: ' . $clean_session['Condition']['Procedure'] . '</li>' . '<li> Condition description: ' . $clean_session['Condition']['Condition Description'] . '</li>' . '</ul>' . '<ul>' . '<li> Trial Number: ' . $currentPos . '</li>' . '<li> Trial Type: ' . $trialType . '</li>' . '<li> Trial max time: ' . $clean_currentTrial['Procedure']['Max Time'] . '</li>' . '<li> Trial Time (seconds): ' . $maxTime . '</li>' . '</ul>' . '<ul>' . '<li> Cue: ' . show($cue) . '</li>' . '<li> Answer: ' . show($answer) . '</li>' . '</ul>';
    readable($currentTrial, "Information loaded about the current trial");
    readable($_SESSION['Trials'], "Information loaded about the entire experiment");
    echo '</div>';
}
?>

<!-- Pre-Cache Next trial -->
<div class="precachenext">
    <?php 
if ($nextTrial) {
    $nextCues = explode('|', $nextTrial['Stimuli']['Cue']);
    $nextAnswers = explode('|', $nextTrial['Stimuli']['Answer']);
    $allNext = array_merge($nextCues, $nextAnswers);
    foreach ($allNext as $next) {