Пример #1
0
    if (isset($_REQUEST['betternot']) && $_REQUEST['betternot']) {
        redirect('admin/subpool_edit.php?subpool_id=' . $subpool_id);
    }
}
if ($proceed) {
    if (isset($_REQUEST['reallydelete']) && $_REQUEST['reallydelete']) {
        $reallydelete = true;
    } else {
        $reallydelete = false;
    }
    $allow = check_allow('subjectpool_delete', 'subpool_edit.php?subpool_id=' . $subpool_id);
}
if ($proceed) {
    // load languages
    $languages = get_languages();
    $exptypes = load_external_experiment_types();
    // load subject pool
    $subpool = orsee_db_load_array("subpools", $subpool_id, "subpool_id");
    if (!isset($subpool['subpool_id'])) {
        redirect("admin/subpool_main.php");
    }
}
if ($proceed) {
    $exptype_ids = db_string_to_id_array($subpool['experiment_types']);
    $subpool['exptypes'] = array();
    foreach ($exptype_ids as $exptype_id) {
        $subpool['exptypes'][] = $exptypes[$exptype_id][lang('lang')];
    }
    unset($subpool['experiment_types']);
    $pars = array(':subpool_id' => $subpool_id);
    $query = "SELECT * from " . table('lang') . " WHERE content_type='subjectpool' AND content_name= :subpool_id";
Пример #2
0
function stats__get_data($condition = array(), $type = 'stats', $restrict = array(), $options = array())
{
    global $settings;
    $conditions = array();
    $pars = array();
    if (is_array($condition) && count($condition) > 0) {
        $conditions[] = $condition['clause'];
        if (isset($condition['pars']) && is_array($condition['pars'])) {
            foreach ($condition['pars'] as $k => $v) {
                $pars[$k] = $v;
            }
        }
    }
    $formfields = participantform__load();
    $pform_fields = array();
    $pform_types = array();
    foreach ($formfields as $f) {
        if (!preg_match("/(textline|textarea)/i", $f['type']) && isset($f['include_in_statistics']) && ($f['include_in_statistics'] == 'pie' || $f['include_in_statistics'] == 'bars')) {
            $pform_fields[] = $f['mysql_column_name'];
            $pform_types[$f['mysql_column_name']] = $f;
        }
    }
    $statfields = array('subpool_id', 'subscriptions', 'status_id');
    foreach ($pform_fields as $field) {
        if (!in_array($field, $statfields)) {
            $statfields[] = $field;
        }
    }
    if ($type == 'stats' && $settings['enable_rules_signed_tracking'] == 'y') {
        if (!in_array('rules_signed', $statfields)) {
            $statfields[] = 'rules_signed';
        }
    } else {
        $exists = array_search('rules_signed', $statfields);
        if ($exists) {
            unset($statfields[$exists]);
        }
    }
    if ($type == 'stats') {
        foreach (array('number_reg', 'number_noshowup', 'last_enrolment', 'last_profile_update', 'last_activity') as $field) {
            if (!in_array($field, $statfields)) {
                $statfields[] = $field;
            }
        }
    }
    $query = "SELECT * from " . table('participants');
    $query_conditions = "";
    if (count($conditions) > 0) {
        $query_conditions .= " WHERE";
        $cond_strings = array();
        foreach ($conditions as $cond) {
            $cond_strings[] = "(" . $cond . ")";
        }
        $query_conditions .= " " . implode(" AND ", $cond_strings);
    }
    $query .= $query_conditions;
    $result = or_query($query, $pars);
    $counts = array();
    $pids = array();
    while ($line = pdo_fetch_assoc($result)) {
        // check whether we should count this participant and (for monthly stats) use this value
        $p_restrict = false;
        foreach ($statfields as $c) {
            $value = $line[$c];
            if (in_array($c, array('last_enrolment', 'last_profile_update', 'last_activity'))) {
                if (!$value) {
                    $value = 0;
                }
                if ($value == 0) {
                    $value = '-';
                } else {
                    $value = date('Ym', $value);
                }
            }
            $value = db_string_to_id_array($value);
            if (count($value) > 0) {
                $this_restrict = true;
                foreach ($value as $v) {
                    if (!isset($restrict[$c][$v])) {
                        $this_restrict = false;
                    }
                }
                if ($this_restrict) {
                    $p_restrict = true;
                }
            } else {
                $value = '-';
                if (isset($restrict[$c][$value])) {
                    $p_restrict = true;
                }
            }
        }
        if (!$p_restrict) {
            $pids[] = $line['participant_id'];
            foreach ($statfields as $c) {
                $value = $line[$c];
                $continue = true;
                if (in_array($c, array('last_enrolment', 'last_profile_update', 'last_activity'))) {
                    if (!$value) {
                        $value = 0;
                    }
                    if (date('Ym', $value) < date('Ym', strtotime("-" . $settings['stats_months_backward'] . " month", time()))) {
                        $continue = false;
                    }
                    if ($value == 0) {
                        $value = '-';
                    } else {
                        $value = date('Ym', $value);
                    }
                }
                if ($continue) {
                    $value = db_string_to_id_array($value);
                    if (count($value) > 0) {
                        foreach ($value as $v) {
                            if (!isset($counts[$c][$v])) {
                                $counts[$c][$v] = 0;
                            }
                            $counts[$c][$v]++;
                        }
                    } else {
                        $value = '-';
                        if (!isset($counts[$c][$value])) {
                            $counts[$c][$value] = 0;
                        }
                        $counts[$c][$value]++;
                    }
                }
            }
        }
    }
    $count_pids = count($pids);
    $pid_condition = "";
    if (count($restrict) > 0) {
        $pid_condition = " AND participant_id IN (" . implode(", ", $pids) . ") ";
    } elseif (count($conditions) == 1 && isset($options['condition_only_on_pid']) && $options['condition_only_on_pid']) {
        $pid_condition = " AND " . $condition['clause'] . " ";
    } elseif ($query_conditions) {
        $pid_condition = " AND participant_id IN (SELECT participant_id FROM " . table('participants') . " " . $query_conditions . ") ";
    }
    // avg. experience (participation in experiments of class x, y, z  at time of experiment)
    $statfields[] = 'experience_avg_experimentclass';
    if ($count_pids > 0) {
        $participated_clause = expregister__get_pstatus_query_snippet("participated");
        $query = "SELECT count(*) as num, experiment_class\n                FROM " . table('participate_at') . " as p, " . table('experiments') . " as e\n                WHERE p.session_id>0 " . $pid_condition . "\n                AND e.experiment_id=p.experiment_id\n                AND e.experiment_class !=''\n                AND " . $participated_clause . " ";
        if (is_array($options) && isset($options['upper_experience_limit'])) {
            $query .= " AND session_id IN (SELECT session_id FROM " . table('sessions') . "\n                        WHERE session_start < " . ortime__unixtime_to_sesstime($options['upper_experience_limit']) . "\n                        AND session_status IN ('completed','balanced') ) ";
        }
        $query .= "GROUP BY experiment_class";
        $result = or_query($query, $pars);
        while ($line = pdo_fetch_assoc($result)) {
            $line['experiment_class'] = db_string_to_id_array($line['experiment_class']);
            foreach ($line['experiment_class'] as $v) {
                if ($v > 0) {
                    if (!isset($counts['experience_avg_experimentclass'][$v])) {
                        $counts['experience_avg_experimentclass'][$v] = 0;
                    }
                    $counts['experience_avg_experimentclass'][$v] += round($line['num'] / $count_pids, 2);
                }
            }
        }
    }
    if ($type == 'report') {
        // avg. count pstatus at time of experiment)
        $statfields[] = 'experience_avg_pstatus';
    }
    if ($count_pids > 0 && $type == 'report') {
        $query = "SELECT count(*) as num, pstatus_id\n                FROM " . table('participate_at') . "\n                WHERE session_id>0 " . $pid_condition;
        if (is_array($options) && isset($options['upper_experience_limit'])) {
            $query .= " AND session_id IN (SELECT session_id FROM " . table('sessions') . "\n                    WHERE session_start < " . ortime__unixtime_to_sesstime($options['upper_experience_limit']) . "\n                    AND session_status IN ('completed','balanced') ) ";
        }
        $query .= "GROUP BY pstatus_id";
        $result = or_query($query, $pars);
        while ($line = pdo_fetch_assoc($result)) {
            $counts['experience_avg_pstatus'][$line['pstatus_id']] = round($line['num'] / $count_pids, 2);
        }
    }
    if ($type == 'stats') {
        // by pstatus: pstatus count // really needed? we have no_noshows, num_reg ...
        // by month: pstatus
        $statfields[] = 'bymonth_pstatus';
        $statfields[] = 'bymonth_noshowrate';
    }
    if ($count_pids > 0 && $type == 'stats') {
        $first_month = date('Ym000000', strtotime("-" . $settings['stats_months_backward'] . " month", time()));
        $noshow_statuses = expregister__get_specific_pstatuses("noshow");
        $query = "SELECT date_format(s.session_start*100,'%Y%m') as sessionmonth,\n                pstatus_id, count(p.participate_id) as num\n                FROM " . table('participate_at') . " as p, " . table('sessions') . " as s\n                WHERE p.session_id>0\n                AND p.session_id=s.session_id\n                AND s.session_status IN ('completed','balanced')\n                AND s.session_start>" . $first_month . " " . $pid_condition . "\n                GROUP BY sessionmonth, pstatus_id\n                ORDER BY sessionmonth, pstatus_id ";
        $result = or_query($query, $pars);
        $noshowperc_data = array();
        while ($line = pdo_fetch_assoc($result)) {
            $counts['bymonth_pstatus_' . $line['pstatus_id']][$line['sessionmonth']] = $line['num'];
            if (!isset($noshowperc_data[$line['sessionmonth']]['n'])) {
                $noshowperc_data[$line['sessionmonth']]['n'] = 0;
            }
            if (!isset($noshowperc_data[$line['sessionmonth']]['y'])) {
                $noshowperc_data[$line['sessionmonth']]['y'] = 0;
            }
            if (in_array($line['pstatus_id'], $noshow_statuses)) {
                $noshowperc_data[$line['sessionmonth']]['n'] += $line['num'];
            } else {
                $noshowperc_data[$line['sessionmonth']]['y'] += $line['num'];
            }
        }
        // get the noshow percentages as well
        foreach ($noshowperc_data as $month => $shownup) {
            $counts['bymonth_noshowrate'][$month] = round($shownup['n'] / ($shownup['n'] + $shownup['y']) * 100, 1);
        }
    }
    $xnames = array('number_reg' => lang('experience'), 'number_noshowup' => lang('noshowup'), 'pstatus' => lang('month'), 'experience_avg_experimentclass' => lang('experiment_classes'), 'experience_avg_pstatus' => lang('participation_status'));
    $titles = array('number_reg' => lang('experience'), 'number_noshowup' => lang('noshows_by_count'), 'last_enrolment' => lang('last_enrolment'), 'last_profile_update' => lang('last_profile_update'), 'last_activity' => lang('last_activity'), 'bymonth_noshowrate' => lang('noshows_by_month'), 'experience_avg_experimentclass' => lang('experience_in_experiment_classes'), 'experience_avg_pstatus' => lang('average_participation_experience'));
    // prepare all-containing arrray to return
    $data_temparray = array();
    foreach ($counts as $c => $nums) {
        $d = array();
        $d['N'] = $count_pids;
        if (isset($pform_types[$c])) {
            $d['browsable'] = true;
            $d['charttype'] = $pform_types[$c]['include_in_statistics'];
            $d['type_of_data'] = 'count';
            $d['yname'] = lang('count');
            $d['xname'] = lang($pform_types[$c]['name_lang']);
            $d['title'] = lang($pform_types[$c]['name_lang']);
            if (preg_match("/(select_lang|radioline_lang)/", $pform_types[$c]['type'])) {
                $d['value_names'] = lang__load_lang_cat($c, lang('lang'));
            } elseif (preg_match("/(radioline|select_list)/", $pform_types[$c]['type'])) {
                $optionvalues = explode(",", $pform_types[$c]['option_values']);
                $optionnames = explode(",", $pform_types[$c]['option_values_lang']);
                $d['value_names'] = array();
                foreach ($optionvalues as $k => $v) {
                    if (isset($optionnames[$k])) {
                        $d['value_names'][$v] = lang($optionnames[$k]);
                    }
                }
            } else {
                $d['value_names'] = array();
            }
            // select numbers?
            if ($pform_types[$c]['type'] == 'select_numbers') {
                krsort($nums);
            } else {
                arsort($nums);
            }
            $d['data'] = $nums;
            $data_temparray[$c] = $d;
        } elseif (in_array($c, array('number_reg', 'number_noshowup'))) {
            $d['browsable'] = true;
            $d['charttype'] = 'bars';
            if ($c == 'number_reg') {
                $d['wide'] = true;
            }
            $d['limit_not_apply'] = true;
            $d['type_of_data'] = 'count';
            $d['yname'] = lang('count');
            $d['xname'] = $xnames[$c];
            $d['title'] = $titles[$c];
            $d['value_names'] = array();
            krsort($nums);
            $d['data'] = $nums;
            $data_temparray[$c] = $d;
        } elseif (in_array($c, array('experience_avg_experimentclass', 'experience_avg_pstatus'))) {
            $d['charttype'] = 'pie';
            $d['type_of_data'] = 'calc';
            $d['yname'] = lang('average_count');
            $d['xname'] = $xnames[$c];
            $d['title'] = $titles[$c];
            $d['value_names'] = array();
            if ($c == 'experience_avg_experimentclass') {
                $d['value_names'] = experiment__load_experimentclassnames();
            } else {
                $pstatuses = expregister__get_participation_statuses();
                foreach ($pstatuses as $k => $s) {
                    $d['value_names'][$k] = $s['internal_name'];
                }
            }
            arsort($nums);
            $d['data'] = $nums;
            $data_temparray[$c] = $d;
        } elseif ($c == 'rules_signed') {
            $d['browsable'] = true;
            $d['charttype'] = 'pie';
            $d['type_of_data'] = 'count';
            $d['yname'] = lang('count');
            $d['xname'] = lang('rules_signed');
            $d['title'] = lang('rules_signed');
            $d['value_names'] = array('n' => lang('n'), 'y' => lang('y'));
            arsort($nums);
            $d['data'] = $nums;
            $data_temparray[$c] = $d;
        } elseif ($c == 'subpool_id') {
            $d['browsable'] = true;
            $d['charttype'] = 'pie';
            $d['type_of_data'] = 'count';
            $d['yname'] = lang('count');
            $d['xname'] = lang('subpool');
            $d['title'] = lang('subpool');
            $subpools = subpools__get_subpools();
            $d['value_names'] = array();
            foreach ($subpools as $k => $p) {
                $d['value_names'][$k] = $p['subpool_name'];
            }
            arsort($nums);
            $d['data'] = $nums;
            $data_temparray[$c] = $d;
        } elseif ($c == 'status_id') {
            $d['browsable'] = true;
            $d['charttype'] = 'pie';
            $d['type_of_data'] = 'count';
            $d['yname'] = lang('count');
            $d['xname'] = lang('participant_status');
            $d['title'] = lang('participant_statuses');
            $statuses = participant_status__get_statuses();
            $d['value_names'] = array();
            foreach ($statuses as $k => $p) {
                $d['value_names'][$k] = $p['name'];
            }
            krsort($nums);
            $d['data'] = $nums;
            $data_temparray[$c] = $d;
        } elseif ($c == 'subscriptions') {
            $d['browsable'] = true;
            $d['charttype'] = 'none';
            $d['type_of_data'] = 'count';
            $d['yname'] = lang('count');
            $d['xname'] = lang('subscriptions');
            $d['title'] = lang('subscriptions');
            $exptypes = load_external_experiment_types("", false);
            $d['value_names'] = array();
            foreach ($exptypes as $k => $p) {
                $d['value_names'][$k] = $p[lang('lang')];
            }
            krsort($nums);
            $d['data'] = $nums;
            $data_temparray[$c] = $d;
        } elseif (in_array($c, array('last_enrolment', 'last_profile_update', 'last_activity', 'bymonth_noshowrate'))) {
            $d['charttype'] = 'bars';
            $d['wide'] = true;
            if ($c == 'bymonth_noshowrate') {
                $d['yname'] = lang('share_in_percent');
                $d['type_of_data'] = 'calc';
            } else {
                $d['yname'] = lang('count');
                $d['type_of_data'] = 'count';
            }
            $d['xname'] = lang('month');
            $d['title'] = $titles[$c];
            foreach ($nums as $k => $number) {
                if ($k == '-') {
                    $d['value_names'][$k] = $k;
                } else {
                    $d['value_names'][$k] = substr($k, 4, 2) . '/' . substr($k, 2, 2);
                }
            }
            krsort($nums);
            $d['data'] = $nums;
            $data_temparray[$c] = $d;
        } elseif (preg_match('/^bymonth_pstatus/', $c)) {
            $tarr = explode("_", $c);
            $status = $tarr[2];
            if (!isset($data_temparray['bymonth_pstatus'])) {
                $pstatuses = expregister__get_participation_statuses();
                $d['charttype'] = 'multibars';
                $d['wide'] = true;
                $d['type_of_data'] = 'count';
                $d['yname'] = lang('count');
                $d['xname'] = lang('month');
                $d['title'] = lang('participation_status_count_by_month');
                $d['value_names'] = array();
                $d['column_names'] = array();
                foreach ($pstatuses as $k => $s) {
                    $d['column_names'][$k] = $s['internal_name'];
                }
                $data_temparray['bymonth_pstatus'] = $d;
            }
            krsort($nums);
            $data_temparray['bymonth_pstatus']['data'][$status] = $nums;
            $d['value_names'] = array();
            foreach ($data_temparray['bymonth_pstatus']['data'] as $status => $months) {
                foreach ($months as $month => $count) {
                    $d['value_names'][$month] = $month;
                }
            }
            krsort($d['value_names']);
            foreach ($d['value_names'] as $k => $v) {
                $d['value_names'][$k] = substr($v, 4, 2) . '/' . substr($v, 2, 2);
            }
            $data_temparray['bymonth_pstatus']['value_names'] = $d['value_names'];
        }
    }
    // prepare all-containing array to return
    $data_array = array();
    foreach ($statfields as $c) {
        if (isset($data_temparray[$c]['data'])) {
            $data_temparray[$c]['name'] = $c;
            $data_array[$c] = $data_temparray[$c];
        } else {
            $data_array[$c] = array('name' => $c, 'N' => 0, 'data' => array());
        }
    }
    return $data_array;
}
Пример #3
0
function experimentmail__get_confirmation_mail_text($participant)
{
    global $authdata, $lang, $settings__root_url, $settings;
    $pform_fields = participant__load_participant_email_fields();
    foreach ($pform_fields as $f) {
        if (preg_match("/(radioline|select_list|select_lang|radioline_lang)/", $f['type']) && isset($participant[$f['mysql_column_name']]) && isset($f['lang'][$participant[$f['mysql_column_name']]])) {
            $participant[$f['mysql_column_name']] = $f['lang'][$participant[$f['mysql_column_name']]];
        }
    }
    $exptype_ids = db_string_to_id_array($participant['subscriptions']);
    $exptypes = load_external_experiment_types();
    $invnames = array();
    foreach ($exptype_ids as $exptype_id) {
        $invnames[] = $exptypes[$exptype_id][lang('lang')];
    }
    $participant['invitations'] = implode(", ", $invnames);
    $participant['registration_link'] = $settings__root_url . "/public/participant_confirm.php?c=" . urlencode($participant['confirmation_token']);
    $maillang = experimentmail__get_language($participant['language']);
    $mailtext = load_mail("public_system_registration", $maillang);
    $message = process_mail_template($mailtext, $participant);
    return $message;
}
Пример #4
0
function participant__get_result_table_row_pdf($columns, $p)
{
    global $settings, $color;
    global $thislist_sessions;
    $pform_columns = participant__load_all_pform_fields();
    $row = array();
    foreach ($columns as $k => $arr) {
        switch ($k) {
            case 'number_noshowup':
                $row[] = $p['number_noshowup'] . '/' . $p['number_reg'];
                break;
            case 'rules_signed':
                if ($settings['enable_rules_signed_tracking'] == 'y') {
                    $row[] = $p['rules_signed'] != 'y' ? "X" : '';
                }
                break;
            case 'subscriptions':
                $exptypes = load_external_experiment_types();
                $inv_arr = db_string_to_id_array($p[$k]);
                $inv_names = array();
                foreach ($inv_arr as $inv) {
                    if (isset($exptypes[$inv]['exptype_name'])) {
                        $inv_names[] = $exptypes[$inv]['exptype_name'];
                    } else {
                        $inv_names[] = 'undefined';
                    }
                }
                $row[] = implode(", ", $inv_names);
                break;
            case 'subpool_id':
                $subpools = subpools__get_subpools();
                $subpool_name = isset($subpools[$p[$k]]['subpool_name']) ? $subpools[$p[$k]]['subpool_name'] : $p[$k];
                $row[] = $subpool_name;
                break;
            case 'status_id':
                $participant_statuses = participant_status__get_statuses();
                $pstatus_name = isset($participant_statuses[$p[$k]]['name']) ? $participant_statuses[$p[$k]]['name'] : $p[$k];
                $row[] = $pstatus_name;
                break;
            case 'creation_time':
            case 'deletion_time':
            case 'last_enrolment':
            case 'last_profile_update':
            case 'last_activity':
            case 'last_login_attempt':
                if ($p[$k]) {
                    $row[] = ortime__format($p[$k], 'hide_second:false');
                } else {
                    $row[] = '-';
                }
                break;
            case 'session_id':
                $row[] = session__build_name($thislist_sessions[$p['session_id']]);
                break;
            case 'payment_budget':
                if ($settings['enable_payment_module'] == 'y' && check_allow('payments_view')) {
                    $payment_budgets = payments__load_budgets();
                    if (isset($payment_budgets[$p['payment_budget']])) {
                        $row[] = $payment_budgets[$p['payment_budget']]['budget_name'];
                    } else {
                        $row[] = '-';
                    }
                }
                break;
            case 'payment_type':
                if ($settings['enable_payment_module'] == 'y' && check_allow('payments_view')) {
                    $payment_types = payments__load_paytypes();
                    if (isset($payment_types[$p['payment_type']])) {
                        $row[] = $payment_types[$p['payment_type']];
                    } else {
                        $row[] = '-';
                    }
                }
                break;
            case 'payment_amount':
                if ($settings['enable_payment_module'] == 'y' && check_allow('payments_view')) {
                    if ($p['payment_amt'] != '') {
                        $row[] = $p['payment_amt'];
                    } else {
                        $row[] = '-';
                    }
                }
                break;
            case 'pstatus_id':
                $pstatuses = expregister__get_participation_statuses();
                $row[] = $pstatuses[$p['pstatus_id']]['internal_name'];
                break;
            default:
                if (isset($pform_columns[$k])) {
                    if (preg_match("/(radioline|select_list|select_lang|radioline_lang)/", $pform_columns[$k]['type'])) {
                        if (isset($pform_columns[$k]['lang'][$p[$k]])) {
                            $row[] = lang($pform_columns[$k]['lang'][$p[$k]]);
                        } else {
                            $row[] = $p[$k];
                        }
                    } else {
                        $row[] = $p[$k];
                    }
                } else {
                    if (isset($p[$k])) {
                        $row[] = $p[$k];
                    } else {
                        $row[] = '???';
                    }
                }
        }
    }
    foreach ($row as $k => $v) {
        $row[$k] = str_replace("&nbsp;", " ", $v);
    }
    return $row;
}
Пример #5
0
function experiment_ext_types__checkboxes($postvarname, $showvar, $checked = array())
{
    $exptypes = load_external_experiment_types();
    foreach ($exptypes as $exptype_id => $exptype) {
        echo '<INPUT type="checkbox" name="' . $postvarname . '[' . $exptype_id . ']"
                 value="' . $exptype_id . '"';
        if (isset($checked[$exptype_id]) && $checked[$exptype_id]) {
            echo " CHECKED";
        }
        echo '>' . $exptype[lang('lang')];
        echo '<BR>';
    }
}
Пример #6
0
				<TD><textarea name=experiment_description rows=3 cols=30 
					wrap=virtual>' . stripslashes($edit['experiment_description']) . '</textarea></TD>
			</TR>';
    if (or_setting('allow_public_experiment_note') && check_allow('session_edit_add_public_session_note')) {
        echo '	<TR>
				<TD valign="top">' . lang('public_experiment_note') . '<br><font class="small">' . lang('public_experiment_note_note') . '</font>:</TD>
				<TD><textarea name="public_experiment_note" rows=3 cols=30 wrap=virtual>' . $edit['public_experiment_note'] . '</textarea></TD>
			</TR>';
    }
    echo '		<TR>
				<TD>' . lang('type') . ':</TD>
				<TD><SELECT name="experiment_show_type">';
    $experiment_types = array();
    $experiment_internal_types = $system__experiment_types;
    foreach ($experiment_internal_types as $inttype) {
        $expexttypes = load_external_experiment_types($inttype);
        foreach ($expexttypes as $exttype) {
            $value = $inttype . ',' . $exttype['exptype_id'];
            $show = $lang[$inttype] . ' ("' . $exttype[lang('lang')] . '")';
            echo '<OPTION value="' . $value . '"';
            if ($value == $edit['experiment_show_type']) {
                echo ' SELECTED';
            }
            echo '>' . $show . '</OPTION>';
        }
    }
    echo '		</SELECT></TD>
			</TR>';
    echo '          <TR>
                                <TD>' . lang('class') . ':</TD>
                                <TD valign="top">';
Пример #7
0
function experiment__old_experiments_format_alist($alist)
{
    global $lang, $color;
    static $shade = true;
    extract($alist);
    $exptypes = load_external_experiment_types();
    if ($shade) {
        $shade = false;
    } else {
        $shade = true;
    }
    if (!isset($num_assigned)) {
        $num_assigned = 0;
    }
    if (!isset($num_registered)) {
        $num_registered = 0;
    }
    if (!isset($num_participated)) {
        $num_participated = 0;
    }
    if ($no_sessions == 1) {
        $num_sessions = 0;
    }
    echo '<tr bgcolor="';
    if ($shade) {
        echo $color['list_shade1'];
    } else {
        echo $color['list_shade2'];
    }
    echo '"><td class="small">';
    if (check_allow('experiment_show')) {
        echo '<A HREF="experiment_show.php?experiment_id=' . $experiment_id . '">';
    }
    echo '<span class="small" style="color: black; font-weight: bold; text-decoration: underline;" title="experiment name; click to edit experiment">' . $experiment_name . ' (' . $experiment_public_name . ')</span>';
    if (check_allow('experiment_show')) {
        echo '</A>';
    }
    echo '</td>
        	<td class="small">';
    if ($num_sessions > 0) {
        echo '<span title="first and last session"><i class="fa fa-calendar" style="font-size: 9pt; padding-right: 3px;"></i>' . ortime__format(ortime__sesstime_to_unixtime($first_session_date), 'hide_time');
        echo '&nbsp;' . lang('to') . '&nbsp;' . ortime__format(ortime__sesstime_to_unixtime($last_session_date), 'hide_time') . '</span>';
    }
    echo '&nbsp;<span title="experiment type">' . $lang[$experiment_type] . ' (' . $exptypes[$experiment_ext_type]['exptype_name'] . ')</span></TD>
        	<TD class="small">';
    if ($experiment_type == "laboratory") {
        if (!isset($comp_num_registered)) {
            $comp_num_registered = 0;
        }
        if (!isset($comp_num_noshow)) {
            $comp_num_noshow = 0;
        }
        if ($comp_num_registered == 0) {
            $noshowrate = "??";
        } else {
            $noshowrate = round($comp_num_noshow / $comp_num_registered * 100, 1) . '%';
        }
        echo lang('sessions') . ': <span style="font-weight: bold;" title="number of sessions">' . $num_sessions . '</span>';
        echo '&nbsp&nbsp&nbsp<span title="number of subjects assigned / enroled / participated"><i class="fa fa-users" style="font-size: 7pt; padding-right: 2px;"></i>' . $num_assigned . '/' . $num_registered . '/' . $num_participated . '</span>';
        echo '&nbsp&nbsp;<span title="noshow rate">' . str_replace("-", "&#8209;", lang('noshowup')) . ':&nbsp;' . $noshowrate . '</span>';
    }
    echo '</TD>
        	</TR>
        	<TR bgcolor="';
    if ($shade) {
        echo $color['list_shade1'];
    } else {
        echo $color['list_shade2'];
    }
    echo '">
		<TD class="small" valign="top">
			<A HREF="mailto:' . experiment__list_experimenters($experimenter_mail, false, false, true) . '" class="explist_link small" title="email to experimenters">' . experiment__list_experimenters($experimenter, false, true) . '</A></TD>
		<TD class="small" valign="top">
				<span style="color: #888888;" title="experiment classifications">';
    echo experiment__experiment_class_field_to_list($experiment_class);
    echo '</span>
		</TD>
		<TD class="small" valign="top">';
    if (count($sessions) > 0) {
        echo '
				<TABLE border=0 cellpadding=0 cellspacing=0>
				<TR><TD colspan=3 class="small"><span style="color: red;"><i class="fa fa-exclamation-triangle" style="font-size: 8pt;"></i>Incomplete sessions!</span></TD></TR>';
        $ssicons = array("planned" => "wrench", "live" => "spinner fa-spin fa-fw", "completed" => "thumbs-o-up", "balanced" => "money");
        foreach ($sessions as $s) {
            if (isset($s['num_registered'])) {
                $reg = $s['num_registered'];
            } else {
                $reg = 0;
            }
            if ($reg < $s['part_needed']) {
                $regfontcolor = $color['session_not_enough_participants'];
            } elseif ($reg < $s['part_needed'] + $s['part_reserve']) {
                $regfontcolor = $color['session_not_enough_reserve'];
            } else {
                $regfontcolor = $color['session_complete'];
            }
            echo '<TR><TD>';
            echo '<A HREF="session_edit.php?session_id=' . $s['session_id'] . '" class="explist_link small" title="' . $s['session_status'] . ' session; click to edit session">';
            echo '<span class="session_status_' . $s['session_status'] . '">';
            echo '<i class="fa fa-' . $ssicons[$s['session_status']] . '" style="font-size: 8pt;"></i>';
            echo ortime__format(ortime__sesstime_to_unixtime($s['session_start']));
            echo '</span>';
            echo '</A>';
            echo '</TD><TD>&nbsp;&nbsp;</TD><TD align=right>';
            echo '<A HREF="experiment_participants_show.php?experiment_id=' . $experiment_id . '&session_id=' . $s['session_id'] . '" class="explist_link small" title="signed-up (needed, reserve); click to see participants list" style="color: ' . $regfontcolor . ';">';
            echo $reg . '&nbsp;(' . $s['part_needed'] . ',' . $s['part_reserve'] . ')';
            echo '</A>';
            echo '</TD></TR>';
        }
        echo '</TABLE>';
    }
    echo '</TD>
		</TR>';
}