Пример #1
0
 public function __construct($current_project)
 {
     $this->runner_type = $_GET['runner_type'];
     $this->action = $_GET['action'];
     $this->action_value = $_GET['action_value'];
     $this->list_table = $this->runner_type . "_list";
     $this->attribs_table = $this->runner_type . "_attrib";
     $this->output_table = $this->runner_type . "_output:";
     $this->current_project = $current_project;
     $this->name_to_edit = $_GET['name'];
     $this->name = $_GET['name'];
     // select the first ppt for use as a template for input etc.
     //$participant= $this->get_single_participant_id();
     // now build the arrays for the form
     $this->column_list = @header_array_builder("" . $this->current_project . ".datasets");
     // Computation list
     $this->computation_list = array("AVG", "SUM", "MAX", "MIN", "COUNT", "COUNT DISTINCT");
     // Calculation list - for custom columns. Defaults to multiply
     $this->calculation_list = array("*", "+", "-", "/");
     // Time period list
     $this->time_period_list = single_column_array_builder($this->current_project . ".time_periods_list", "name");
     // Response list
     $this->response_list = single_column_array_builder($this->current_project . ".responses_list", "name");
     // Outcome list
     $this->outcome_list = array("CORRECT", "INCORRECT");
 }
 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>";
 }
        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");
    }
    foreach ($participant_list as $participant) {
        // work out true id of participant
        $current_true_ppt_id = get_current_true_participant_id($participant);
        $result = mysql_query("DELETE FROM " . $current_project . ".datasets WHERE INPSYTE__PPT_ID='" . $participant . "'");
        $result = mysql_query("DELETE FROM " . $current_project . ".datasets_aggregated WHERE INPSYTE__PPT_ID='" . $participant . "'");
        $result = mysql_query("DELETE FROM " . $current_project . ".participants WHERE ppt_id='" . $participant . "'");
        $result = mysql_query("DELETE FROM " . $current_project . ".aois WHERE ppt_id='" . $participant . "'");
        $result = mysql_query("DELETE FROM " . $current_project . ".analyses_output WHERE ppt_id='" . $participant . "'");
        $result = mysql_query("DELETE FROM " . $current_project . ".responses_output WHERE ppt_id='" . $participant . "'");
        $result = mysql_query("DELETE FROM " . $current_project . ".time_periods_output WHERE ppt_id='" . $participant . "'");
        $result = mysql_query("DELETE FROM " . $current_project . ".completed_runner_list WHERE ppt_id='" . $participant . "'");
        //$result = mysql_query("DELETE FROM ".$current_project.".output WHERE ppt_id='".$current_true_ppt_id."'");
        //chdir('..');
        //$aoi_file_delete = getcwd().'/projects/'.$current_project.'/compiled_aois/aoi'.$participant.'.txt';
    Inpsyte Data Analysis is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    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>";