Exemplo n.º 1
0
function query__get_query_form_prototypes($hide_modules = array(), $experiment_id = "", $status_query = "")
{
    global $lang, $settings, $all_orsee_query_modules;
    $formfields = participantform__load();
    $orsee_query_modules = $all_orsee_query_modules;
    $protoypes = array();
    foreach ($orsee_query_modules as $module) {
        if (!in_array($module, $hide_modules)) {
            switch ($module) {
                case "brackets":
                    $prototype = array('type' => 'brackets', 'displayname' => lang('query_brackets'), 'field_name_placeholder' => '#brackets#');
                    $content = "";
                    $prototype['content'] = $content;
                    $prototypes[] = $prototype;
                    break;
                case "experimentclasses":
                    $prototype = array('type' => 'experimentclasses_multiselect', 'displayname' => lang('query_experiment_class'), 'field_name_placeholder' => '#experiment_class#');
                    $content = "";
                    $content .= '<SELECT name="not">
                        <OPTION value="NOT" SELECTED>' . lang('without') . '</OPTION>
                        <OPTION value="">' . lang('only') . '</OPTION>
					</SELECT> ';
                    $content .= lang('participants_participated_expclass') . '<BR>';
                    $content .= experiment__experiment_class_select_field('#experiment_class#_ms_classes', array(), true, array('cols' => 40, 'picker_maxnumcols' => 3));
                    $prototype['content'] = $content;
                    $prototypes[] = $prototype;
                    break;
                case "experimenters":
                    $prototype = array('type' => 'experimenters_multiselect', 'displayname' => lang('query_experimenters'), 'field_name_placeholder' => '#experimenters#');
                    $content = "";
                    $content .= '<SELECT name="not">
                        <OPTION value="NOT" SELECTED>' . lang('without') . '</OPTION>
                        <OPTION value="">' . lang('only') . '</OPTION>
					</SELECT> ';
                    $content .= lang('participants_participated_experimenters') . '<BR>';
                    $content .= experiment__experimenters_select_field("#experimenters#_ms_experimenters", array(), true, array('cols' => 40, 'tag_color' => '#f1c06f', 'picker_color' => '#c58720', 'picker_maxnumcols' => 3));
                    $prototype['content'] = $content;
                    $prototypes[] = $prototype;
                    break;
                case "experimentsassigned":
                    $prototype = array('type' => 'experimentsassigned_multiselect', 'displayname' => lang('query_experiments_assigned'), 'field_name_placeholder' => '#experiments_assigned#');
                    $content = "";
                    $content .= '<SELECT name="not">
                        <OPTION value="NOT" SELECTED>' . lang('without') . '</OPTION>
                        <OPTION value="">' . lang('only') . '</OPTION>
					</SELECT> ';
                    $content .= lang('participants_were_assigned_to') . '<BR>';
                    $content .= experiment__other_experiments_select_field("#experiments_assigned#_ms_experiments", "assigned", $experiment_id, array(), true, array('cols' => 80, 'tag_color' => '#b3ffb3', 'picker_color' => '#00a300', 'picker_maxnumcols' => $settings['query_experiment_list_nr_columns']));
                    $prototype['content'] = $content;
                    $prototypes[] = $prototype;
                    break;
                case "experimentsparticipated":
                    $prototype = array('type' => 'experimentsparticipated_multiselect', 'displayname' => lang('query_experiments_participated'), 'field_name_placeholder' => '#experiments_participated#');
                    $content = "";
                    $content .= '<SELECT name="not">
                        <OPTION value="NOT" SELECTED>' . lang('without') . '</OPTION>
                        <OPTION value="">' . lang('only') . '</OPTION>
					</SELECT> ';
                    $content .= lang('participants_have_participated_on') . '<BR>';
                    $content .= experiment__other_experiments_select_field("#experiments_participated#_ms_experiments", "participated", $experiment_id, array(), true, array('cols' => 80, 'tag_color' => '#a8a8ff', 'picker_color' => '#0000ff', 'picker_maxnumcols' => $settings['query_experiment_list_nr_columns']));
                    $prototype['content'] = $content;
                    $prototypes[] = $prototype;
                    break;
                case "statusids":
                    $prototype = array('type' => 'statusids_multiselect', 'displayname' => lang('query_participant_status'), 'field_name_placeholder' => '#statusids#');
                    $content = "";
                    $content .= '<SELECT name="not">
                        <OPTION value="NOT" SELECTED>' . lang('without') . '</OPTION>
                        <OPTION value="">' . lang('only') . '</OPTION>
					</SELECT> ';
                    $content .= lang('participants_of_status') . ' ';
                    $content .= participant_status__multi_select_field("#statusids#_ms_status", array(), array('cols' => 80, 'tag_color' => '#a8a8ff', 'picker_color' => '#0000ff', 'picker_maxnumcols' => 2));
                    $prototype['content'] = $content;
                    $prototypes[] = $prototype;
                    break;
                case "pformtextfields":
                    $prototype = array('type' => 'pformtextfields_freetextsearch', 'displayname' => lang('query_participant_form_textfields'), 'field_name_placeholder' => '#participant_form_textfields#');
                    $form_query_fields = array();
                    foreach ($formfields as $f) {
                        if (preg_match("/(textline|textarea)/i", $f['type']) && (!$experiment_id && $f['search_include_in_participant_query'] == 'y' || $experiment_id && $f['search_include_in_experiment_assign_query'] == 'y')) {
                            $tfield = array();
                            $tfield['value'] = $f['mysql_column_name'];
                            $tfield['name'] = lang($f['name_lang']);
                            $form_query_fields[] = $tfield;
                        }
                    }
                    $content = "";
                    $content .= lang('where');
                    $content .= ' <INPUT type="text" size="20" maxlength="100" name="search_string" value="">';
                    $content .= '<SELECT name="not">
                        <OPTION value="NOT">' . lang('not') . '</OPTION>
                        <OPTION value="" SELECTED></OPTION>
					</SELECT> ';
                    $content .= ' ' . lang('in') . ' ';
                    $content .= '<SELECT name="search_field">
       	        	<OPTION value="all" SELECTED>' . lang('any_field') . '</OPTION>';
                    foreach ($form_query_fields as $tf) {
                        $content .= '<OPTION value="' . $tf['value'] . '">' . $tf['name'] . '</OPTION>';
                    }
                    $content .= '</SELECT>';
                    $prototype['content'] = $content;
                    $prototypes[] = $prototype;
                    break;
                case "pformselects":
                    $pform_selects = array();
                    foreach ($formfields as $f) {
                        if (!preg_match("/(textline|textarea)/i", $f['type']) && (!$experiment_id && $f['search_include_in_participant_query'] == 'y' || $experiment_id && $f['search_include_in_experiment_assign_query'] == 'y')) {
                            $pform_selects[] = $f['mysql_column_name'];
                        }
                    }
                    // $existing=true;
                    //if ($experiment_id) $show_count=false; else $show_count=true;
                    // needs too much time for queries. So  better:
                    $existing = false;
                    $show_count = false;
                    foreach ($pform_selects as $fieldname) {
                        $f = array();
                        foreach ($formfields as $p) {
                            if ($p['mysql_column_name'] == $fieldname) {
                                $f = $p;
                            }
                        }
                        $f = form__replace_funcs_in_field($f);
                        if (isset($f['mysql_column_name'])) {
                            $fieldname_lang = lang($f['name_lang']);
                            $fname_ph = '#pform_select_' . $fieldname . '#';
                            $prototype = array('type' => 'pform_select_' . $fieldname, 'displayname' => lang('query_participant_form_selectfield') . $fieldname_lang, 'field_name_placeholder' => $fname_ph);
                            $content = "";
                            $content .= lang('where') . ' ' . $fieldname_lang . ' ';
                            if ($f['type'] == 'select_numbers') {
                                $content .= '<select name="sign">
                      <OPTION value="<="><=</OPTION>
					  <OPTION value="=" SELECTED>=</OPTION>
                      <OPTION value=">">></OPTION>
					  </select>';
                            } else {
                                $content .= '<select name="not">
				 	<OPTION value="" SELECTED>=</OPTION>
				 	<OPTION value="NOT">' . lang('not') . ' =</OPTION>
				 	</select> ';
                            }
                            if (preg_match("/(select_lang|radioline_lang)/", $f['type'])) {
                                $content .= language__multiselectfield_item($fieldname, $fieldname, $fname_ph . '_ms_' . $fieldname, array(), "", $existing, $status_query, $show_count, true, array('cols' => 80, 'tag_color' => '#bbbbbb', 'picker_color' => '#444444', 'picker_maxnumcols' => 3));
                                $prototype['type'] = 'pform_multiselect_' . $fieldname;
                            } elseif ($f['type'] == 'select_numbers') {
                                if ($f['values_reverse'] == 'y') {
                                    $reverse = true;
                                } else {
                                    $reverse = false;
                                }
                                $content .= participant__select_numbers($fieldname, 'fieldvalue', '', $f['value_begin'], $f['value_end'], 0, $f['value_step'], $reverse, false, $existing, $status_query, $show_count);
                                $prototype['type'] = 'pform_numberselect_' . $fieldname;
                            } elseif (preg_match("/(select_list|radioline)/i", $f['type']) && !$existing) {
                                $f['value'] = '';
                                $content .= form__render_select_list($f, 'fieldvalue');
                                $prototype['type'] = 'pform_simpleselect_' . $fieldname;
                            } else {
                                $content .= participant__select_existing($fieldname, 'fieldvalue', '', $status_query, $show_count);
                                $prototype['type'] = 'pform_simpleselect_' . $fieldname;
                            }
                            $prototype['content'] = $content;
                            $prototypes[] = $prototype;
                        }
                    }
                    break;
                case "noshows":
                    $prototype = array('type' => 'noshows_numbercompare', 'displayname' => lang('query_noshows'), 'field_name_placeholder' => '#noshows#');
                    $query = "SELECT max(number_noshowup) as maxnoshow FROM " . table('participants');
                    if ($status_query) {
                        $query .= " WHERE " . $status_query;
                    }
                    $line = orsee_query($query);
                    $content = "";
                    $content .= lang('where_nr_noshowups_is') . ' ';
                    $content .= '<select name="sign">
                    	<OPTION value="<=" SELECTED><=</OPTION>
               			<OPTION value=">">></OPTION>
                    	</select> ';
                    $content .= helpers__select_number("count", '0', 0, $line['maxnoshow'], 0);
                    $prototype['content'] = $content;
                    $prototypes[] = $prototype;
                    break;
                case "participations":
                    $prototype = array('type' => 'participations_numbercompare', 'displayname' => lang('query_participations'), 'field_name_placeholder' => '#participations#');
                    $query = "SELECT max(number_reg) as maxnumreg FROM " . table('participants');
                    if ($status_query) {
                        $query .= " WHERE " . $status_query;
                    }
                    $line = orsee_query($query);
                    $content = "";
                    $content .= lang('where_nr_participations_is') . ' ';
                    $content .= '<select name="sign">
                    	<OPTION value="<=" SELECTED><=</OPTION>
               			<OPTION value=">">></OPTION>
                    	</select> ';
                    $content .= helpers__select_number("count", '0', 0, $line['maxnumreg'], 0);
                    $prototype['content'] = $content;
                    $prototypes[] = $prototype;
                    break;
                case "updaterequest":
                    $prototype = array('type' => 'updaterequest_simpleselect', 'displayname' => lang('query_profile_update_request'), 'field_name_placeholder' => '#updaterequest#');
                    $content = "";
                    $content .= lang('where_profile_update_request_is') . ' ';
                    $content .= '<select name="update_request_status">
					<OPTION value="y">' . lang('active') . '</OPTION>
					<OPTION value="n">' . lang('inactive') . '</OPTION>
                   	</select> ';
                    $prototype['content'] = $content;
                    $prototypes[] = $prototype;
                    break;
                case "activity":
                    $prototype = array('type' => 'activity_numbercompare', 'displayname' => lang('query_activity'), 'field_name_placeholder' => '#activity#');
                    $content = lang('where');
                    $content .= '<SELECT name="activity_type">
                        <OPTION value="last_activity" SELECTED>' . lang('last_activity') . '</OPTION>
                        <OPTION value="last_enrolment">' . lang('last_enrolment') . '</OPTION>
                        <OPTION value="last_profile_update">' . lang('last_profile_update') . '</OPTION>
        			    <OPTION value="creation_time">' . lang('creation_time') . '</OPTION>';
                    //$content.='    <OPTION value="deletion_time">'.lang('deletion_time').'</OPTION>';
                    $content .= '</SELECT> ';
                    $content .= '<SELECT name="not">
						<OPTION value="" SELECTED></OPTION>
						<OPTION value="NOT">' . lang('not') . '</OPTION>
					</SELECT> ';
                    $content .= lang('before_date') . ' ';
                    $content .= formhelpers__pick_date('#activity#_dt_activity');
                    $prototype['content'] = $content;
                    $prototypes[] = $prototype;
                    break;
                case "randsubset":
                    $prototype = array('type' => 'randsubset_limitnumber', 'displayname' => lang('query_rand_subset'), 'field_name_placeholder' => '#rand_subset#');
                    $query_limit = !isset($_REQUEST['query_limit']) || !$_REQUEST['query_limit'] ? $settings['query_random_subset_default_size'] : $_REQUEST['query_limit'];
                    $content = "";
                    $content .= lang('limit_to_randomly_drawn') . ' ';
                    $content .= '<INPUT type="text" data-elem-name="limit" value="' . $settings['query_random_subset_default_size'] . '" size="5" maxlength="10">';
                    $prototype['content'] = $content;
                    $prototypes[] = $prototype;
                    break;
                case "subsubjectpool":
                    $prototype = array('type' => 'subsubjectpool_multiselect', 'displayname' => lang('query_subsubjectpool'), 'field_name_placeholder' => '#subsubjectpool#', 'defaults' => array('#subsubjectpool#_not' => '', '#subsubjectpool#_ms_subpool' => ''));
                    $content = "";
                    $content .= '<SELECT name="not">
                        <OPTION value="NOT" SELECTED>' . lang('without') . '</OPTION>
                        <OPTION value="">' . lang('only') . '</OPTION>
					</SELECT> ';
                    $content .= lang('who_are_in_subjectpool') . ' ';
                    $content .= subpools__multi_select_field("#subsubjectpool#_ms_subpool", array(), array('cols' => 80, 'tag_color' => '#a8a8ff', 'picker_color' => '#0000ff', 'picker_maxnumcols' => 1));
                    $prototype['content'] = $content;
                    $prototypes[] = $prototype;
                    break;
            }
        }
    }
    return $prototypes;
}
Exemplo n.º 2
0
 echo '<FORM action="session_edit.php" method="POST">
         <INPUT type=hidden name=session_id value="' . $edit['session_id'] . '">
         <INPUT type=hidden name=experiment_id value="' . $edit['experiment_id'] . '">';
 if (isset($addit) && $addit) {
     echo '<INPUT type=hidden name="addit" value="true">';
 }
 echo '
     <TABLE class="or_formtable">
     <TR>
         <TD>' . lang('id') . ':</TD>
         <TD>' . $edit['session_id'] . '</TD>
     </TR>';
 echo '  <TR>
         <TD>' . lang('date') . ':</TD>
         <TD>';
 echo formhelpers__pick_date('session_start', $edit['session_start'], $settings['session_start_years_backward'], $settings['session_start_years_forward']);
 echo '
         </TD>
     </TR>';
 echo '  <TR>
         <TD>
             ' . lang('time') . ':
         </TD>
         <TD>';
 echo formhelpers__pick_time('session_start', $edit['session_start']);
 echo '
         </TD>
     </TR>';
 echo '  <TR>
         <TD>
             ' . lang('laboratory') . ':
Exemplo n.º 3
0
						<TR><TD rowspan="2" valign="top">' . lang('human_subjects_ethics_approval') . ':</TD>
						<TD>' . lang('ethics_by') . '<INPUT name="ethics_by" type="text" size=20 maxlength=60
									value="' . $edit['ethics_by'] . '"></TD>
						<TD>' . lang('ethics_number') . '<INPUT name="ethics_number" type="text" size=10 maxlength=50
									value="' . $edit['ethics_number'] . '"></TD>
						</TR><TR>
							<TD colspan="2"><INPUT name="ethics_exempt" type="radio" value="y"';
        if ($edit['ethics_exempt'] == 'y') {
            echo ' CHECKED';
        }
        echo '>' . lang('ethics_exempt_or') . '&nbsp;<INPUT name="ethics_exempt" type="radio" value="n"';
        if ($edit['ethics_exempt'] != 'y') {
            echo ' CHECKED';
        }
        echo '>' . lang('ethics_expires_on') . '&nbsp;&nbsp;';
        echo formhelpers__pick_date('ethics_expire_date', $edit['ethics_expire_date'], $settings['session_start_years_backward'], $settings['session_start_years_forward']);
        echo '			</TD>
						</TR>
					</TABLE>					
					</TD>
			</TR>';
    }
    if ($settings['enable_payment_module'] == 'y') {
        $payment_types = payments__load_paytypes();
        if ($edit['payment_types'] || is_array($payment_types) && count($payment_types) > 1) {
            $show_payment_types = true;
        } else {
            $show_payment_types = false;
        }
        $payment_budgets = payments__load_budgets();
        if ($edit['payment_budgets'] || is_array($payment_budgets) && count($payment_budgets) > 1) {