function table_construct()
 {
     echo "<div id='run_div' name='run_div'>";
     echo "<form>";
     $option_list = single_column_array_builder("" . $this->runner_interface->current_project . "." . $this->runner_interface->list_table, "name");
     if (count($option_list) > 0) {
         option_list_builder('selected_option', $option_list, '', '');
         echo "<input type='button' id='run_all_button' onclick='run_selected(\"" . $this->runner_interface->runner_type . "\", \"all\")' value='Run Selected for all Participants'>";
     }
     if (count($option_list) == 0) {
         echo "Nothing has been added for this yet. You can add stuff by going to the Edit menu.";
     }
     echo "</form>";
 }
            $add_session = mysql_query("INSERT IGNORE INTO " . $current_project . ".session_list \n            SET name='" . $current_session . "'");
            if (mysql_error) {
                echo mysql_error();
            }
        }
    }
}
if (isset($_GET['refresh']) && $_GET['refresh'] == 'delete_participant_section') {
    $participant_list = single_column_array_builder("" . $current_project . ".participants", "ppt_id");
    if (count($participant_list) > 0) {
        // Start building the form now
        echo "<div><h1>Delete Participants</h1></div>";
        echo "<div id='delete_participants_form'>";
        echo "<form>";
        echo "Participant ID:";
        option_list_builder('select_participant_option', $participant_list, '', "");
        echo "<br>";
        echo "<input type='button' onclick='delete_participant()' value='Delete Selected Participant'>";
        echo "<input type='button' onclick='delete_all_participants()' value='Delete All Participants'>";
        echo "</form>";
        echo "</div>";
    }
}
if (isset($_POST['refresh']) && $_POST['refresh'] == 'delete' && isset($_POST['participant'])) {
    $ppt_id = $_POST['participant'];
    $participant_list = array();
    if ($ppt_id != 'all') {
        $participant_list[] = $ppt_id;
    }
    if ($ppt_id == 'all') {
        $participant_list = single_column_array_builder($current_project . ".participants", "ppt_id");
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Inpsyte Data Analysis.  If not, see <http://www.gnu.org/licenses/>. 
 */
//////////////////////////////////////////////////////////////////////////////////////////////////
include "../conf/conf.php";
include "../functions/single_column_array_builder.php";
include "../functions/header_array_builder.php";
include "../functions/option_list_builder.php";
if (isset($_GET['refresh'])) {
    //	this will only be blank when we have no projects, i.e. it's a new install
    $project_list = single_column_array_builder("inpsyte__projects.projects", "name");
    // change current active project
    echo "<form id='change_project_form' name='change_project_form'>\n\t    \n\t    <h3>Change Current Project</h3>\n\t    \n\t    <p> This section is used for changing the current project in use by the application.</p>";
    option_list_builder("project_list", $project_list, '', $current_project);
    echo "<input type='button' onclick='change_project()' value='Change Now!'>\n\t    <input type='button' onclick='delete_project()' value='Delete Now!'></p>\n\t    \n\t    </form>\n\t\n\t    </div>";
    // add a new project
    echo "<form id='add_project_form' name='add_project_form'>\n    <h3>Add New Project</h3>\n    <p> You can add a new project here.</p>";
    echo "<input type='text' id='name' name='name' value='' class='required' minlength='2'>";
    echo "  <input type='button' onclick='add_project()' value='Add Now!'>";
    //echo "  <input type='button' id='name' name='name' value='Add Now!'>";
    echo "</p>\n      \n\t<div id='add_project_output'>";
    if ($current_project != '') {
        echo "<br>";
    }
    if ($current_project == '') {
        echo "<script>\n\t\n\t\$('#change_project_form').fadeTo( 0.01, 0.3);\n\talert('Welcome to INPSYTE Data Analysis. To begin with, create a new project.');\n\t</script>";
    }
    echo "</div>\n\t\n    </form>\n    \n    </div>";
}
    foreach ($array as $head) {
        echo "<option value='" . $head . "'>" . $head . "</option>";
    }
    echo "</select>";
    echo "<select multiple id='selected' name='selected'></select>";
    echo "<script>\n\t\t\t\$().ready(function() {\n\t\t\t\t\$('#available').click(add_column);\n\t\t\t\t\$('#selected').click(remove_column);\t\t\n \t\t\t});\n\t\t  </script>";
}
if (isset($_GET['refresh']) && $_GET['refresh'] == 'runner_select_form') {
    /// this sets out what to select
    echo "<form id='change_project_form' name='change_project_form'>\n\tNote: This section is a work in progress.<br>    \n    <p>Select what you want to inspect here.</p>";
    echo "Analysis:";
    option_list_builder("analyses_list", $analyses_list, 'draw_table()', $analyses);
    echo "Participant:";
    option_list_builder("participant_list", $participant_list, 'draw_table()', $participant);
    echo "Trial Number:";
    option_list_builder("trial_list", $trial_list, 'draw_table()', $trial);
    echo "<br><input type='button' onclick='slide_toggle()' value='Reveal/Hide List of Columns'>";
    echo "<div id='slide_section' style='display:none'>";
    select_column_builder($current_project . "." . $participant);
    echo "</div>";
    echo "</form>\n\t\n    </div>";
}
if (isset($_GET['action']) && $_GET['action'] == 'draw_table') {
    $result = mysql_query("select p.*, a.*, ag.* from " . $current_project . "." . $participant . " as p \n\t\tleft join " . $current_project . ".analyses_output \n\t\t\tAS a on (a.trial = p.trial_index and a.ppt_id='" . $participant . "' and a.runner='" . $analyses . "')\n\t\tleft join " . $current_project . "." . $participant . "_aggregated \n\t\t\tAS ag on (ag.trial_index = p.trial_index)\n\t\twhere p.trial_index = " . $trial . "");
    if (mysql_error()) {
        echo mysql_error();
    }
    echo "<table class='display' id='example'>";
    echo "<thead>";
    $headers_done = false;
    while ($row = mysql_fetch_assoc($result)) {
Ejemplo n.º 5
0
 function form_custom_output($type, $input_column, $computation, $output_value, $output_text, $output_manual, $restriction_count)
 {
     echo "<tr>";
     echo "<td>";
     echo "Output Type:";
     echo "</td>";
     echo "<td>";
     // radio button
     echo "<input type='radio' name='output_type' value='calculation' \n\t\tonclick='change_custom_type(\"edit\", \"" . $this->runner_type . "\", \"calc\", \"" . $restriction_count . "\")' ";
     if ($type == "calculation") {
         echo " checked ";
     }
     echo " /> Calculation &nbsp;";
     echo "<input type='radio' name='output_type' value='text'\n\t\tonclick='change_custom_type(\"edit\", \"" . $this->runner_type . "\", \"text\", \"" . $restriction_count . "\")' ";
     if ($type == "text") {
         echo " checked ";
     }
     echo " /> Text &nbsp;";
     echo "<input type='radio' name='output_type' value='manual'\n\t\tonclick='change_custom_type(\"edit\", \"" . $this->runner_type . "\", \"manual\", \"" . $restriction_count . "\")' ";
     if ($type == "manual") {
         echo " checked ";
     }
     echo " /> Manual &nbsp;";
     // draw cell for calculation option
     if ($type == "calculation") {
         echo "<br>";
         option_list_builder("input_column", $this->column_list, '', $input_column);
         echo "<br>";
         option_list_builder("computation", $this->calculation_list, '', $computation);
         echo "<br>";
         echo "<input type='text' id='output_value' name='output_value' value='" . $output_value . "'>";
     }
     // draw cell for text option
     if ($type == "text") {
         echo "<br>";
         echo "<input type='text' id='output_text' name='output_text' value='" . $output_text . "'>";
     }
     if ($type == "manual") {
         echo "<br>";
         echo "Type in a formula for output below. Note that is for advanced users only.";
         echo "<input type='text' size='70' id='output_manual' name='output_manual' value='" . $output_manual . "'>";
     }
     echo "</td>";
     echo "</tr>";
 }
    $participant = $_GET['participant'];
}
// get full details for this ppt
$ppt_result = mysql_query("SELECT * from " . $current_project . ".participants WHERE ppt_id='" . $participant . "'");
while ($row3 = mysql_fetch_array($ppt_result)) {
    $participant_name = $row3['ppt_id'];
    $view_trials_complete = $row3['view_trials'];
}
if ($_GET['refresh'] == 'participant_list') {
    // get the ppts and lsit them
    $participant_list = single_column_array_builder("" . $current_project . ".participants", "ppt_id");
    # Start building the form now
    echo "<div id='participant_list_form' name='participant_list_form'>";
    echo "<form>";
    echo "Select Participant:";
    option_list_builder('selected_participant', $participant_list, '', $participant_name);
    echo "<br>";
    echo "<input type='button' onclick='select_participant()' value='View Trials'>";
    echo "</form>";
    echo "</div>";
}
if (isset($_GET['participant'])) {
    // if images not processed, do them now
    if ($view_trials_complete == 0) {
        $current_dir = getcwd();
        chdir('..');
        $root_dir = getcwd();
        chdir('images');
        $image_dir = getcwd();
        chdir('..');
        chdir('trial_images');
if ($_GET['refresh'] == 'histogram_form') {
    // get the ppts and lsit them
    $participant_list = single_column_array_builder_groupby("" . $current_project . ".analyses_output", "ppt_id");
    array_unshift($participant_list, 'all');
    // set runner list
    $runner_list = single_column_array_builder_groupby("" . $current_project . ".analyses_output", "runner");
    // options for number of bins
    $bin_list = array();
    for ($i = 1; $i < 51; $i++) {
        $bin_list[] = $i;
    }
    // Start building the form now
    echo "<article id='participant_list_form' name='histogram_selection_form'>";
    echo "<form>";
    echo "Note: This section is a work in progress.<br>";
    echo "Select Runner:";
    option_list_builder('selected_runner', $runner_list, '', '');
    echo "<br>";
    echo "Select Participant:";
    option_list_builder('selected_participant', $participant_list, '', '');
    echo "<br>";
    echo "Number of Bins:";
    option_list_builder('selected_bincount', $bin_list, '', '20');
    echo "<br>";
    echo "<input type='button' onclick='select_runner()' value='View Histogram Now'>";
    echo "</form>";
    echo "</article>";
}
if (isset($_GET['participant']) && isset($_GET['runner']) && isset($_GET['bincount'])) {
    echo "<img src='functions/draw_histogram.php?runner=" . $_GET['runner'] . "&bincount=" . $_GET['bincount'] . "&participant=" . $_GET['participant'] . "&table=" . $current_project . "'>";
}