$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); if (isset($_REQUEST['form'])) { $posted_query = $_REQUEST['form']; } else { $posted_query = array('query' => array()); } $posted_query_json = $json->encodeUnsafe($posted_query); $done = query__save_default_query($posted_query_json, 'default_' . $type); redirect('admin/' . thisdoc() . '?type=' . $type); } } if ($proceed) { $titles = array('assign' => 'default_search_for_assigning_participants_to_experiment', 'deassign' => 'default_search_for_deassigning_participants_from_experiment', 'participants_search_active' => 'default_search_for_active_participants', 'participants_search_all' => 'default_search_for_all_participants'); echo '<center>'; show_message(); $load_query = query__load_default_query($type); if ($type == 'participants_search_active') { $hide_modules = array('statusids'); } else { $hide_modules = array(); } $formextra = '<INPUT type="hidden" name="type" value="' . $type . '">'; echo '<TABLE class="or_formtable" style="min-width: 80%"> <TR><TD> <TABLE width="100%" border=0 class="or_panel_title"><TR> <TD style="background: ' . $color['panel_title_background'] . '; color: ' . $color['panel_title_textcolor'] . '" align="center"> ' . lang($titles[$type]) . ' </TD> </TR></TABLE> </TD></TR>'; echo '<TR><TD>';
//echo $query['query']; //echo '</TD></TR></TABLE>'; //dump_array($query['pars'],"Parameters"); echo '<FORM name="part_list" method="POST" action="' . thisdoc() . '"> <INPUT type=hidden name=experiment_id value="' . $experiment_id . '">'; // show list of results $assign_ids = query_show_query_result($query, "assign"); $_SESSION['assign_ids_' . $experiment_id] = $assign_ids; echo '</FORM>'; } else { if (!isset($_SESSION['lastquery_assign_' . $experiment_id])) { $_SESSION['lastquery_assign_' . $experiment_id] = ''; } $load_query = $_SESSION['lastquery_assign_' . $experiment_id]; if (!$load_query) { $load_query = query__load_default_query('assign', $experiment_id); } $hide_modules = array('statusids'); $status_query = participant_status__get_pquery_snippet("eligible_for_experiments"); $saved_queries = query__load_saved_queries('assign', $settings['queryform_experimentassign_savedqueries_numberofentries'], $experiment_id); $exptypes = load_external_experiment_types(); $active_clause = participant_status__get_pquery_snippet("eligible_for_experiments"); $exptype_clause = "subscriptions LIKE '%|" . $experiment['experiment_ext_type'] . "|%'"; echo participants__count_participants($active_clause . ' AND ' . $exptype_clause); echo ' ' . lang('xxx_part_in_db_for_xxx_exp') . ' '; if (!isset($exptypes[$experiment['experiment_ext_type']]['exptype_name'])) { $exptypes[$experiment['experiment_ext_type']]['exptype_name'] = 'type undefined'; } echo $exptypes[$experiment['experiment_ext_type']]['exptype_name']; echo '<BR><BR>'; echo experiment__count_participate_at($experiment_id) . ' ' . lang('participants_assigned_to_this_experiment');
} $load_query = $_SESSION['lastquery_participants_search_active']; if (!$load_query) { $load_query = query__load_default_query('participants_search_active'); } $hide_modules = array('statusids'); $status_query = participant_status__get_pquery_snippet("eligible_for_experiments"); $formextra = '<INPUT type="hidden" name="active" value="true">'; $saved_queries = query__load_saved_queries('participants_search_active', $settings['queryform_partsearchactive_savedqueries_numberofentries']); } else { if (!isset($_SESSION['lastquery_participants_search_all'])) { $_SESSION['lastquery_participants_search_all'] = ''; } $load_query = $_SESSION['lastquery_participants_search_all']; if (!$load_query) { $load_query = query__load_default_query('participants_search_all'); } $hide_modules = array(); $status_query = ""; $formextra = ''; $saved_queries = query__load_saved_queries('participants_search_all', $settings['queryform_partsearchall_savedqueries_numberofentries']); } if ($active) { $active_clause = participant_status__get_pquery_snippet("eligible_for_experiments"); $count = participants__count_participants($active_clause); echo $count . ' ' . lang('active_participant_profiles_in_database') . '<BR>'; } else { $count = participants__count_participants(); echo $count . ' ' . lang('participant_profiles_in_database') . '<BR>'; } echo '<TABLE width="80%"><TR><TD>';