if (isset($status_id)) {
        $allow = check_allow('participantstatus_edit', 'participant_status_main.php');
    } else {
        $allow = check_allow('participantstatus_add', 'participant_status_main.php');
    }
}
if ($proceed) {
    if (isset($status_id) && $status_id == 0) {
        $not_unconfirmed = false;
    } else {
        $not_unconfirmed = true;
    }
    // load languages
    $languages = get_languages();
    if (isset($status_id)) {
        $status = orsee_db_load_array("participant_statuses", $status_id, "status_id");
        if (!isset($status['status_id'])) {
            redirect('admin/participant_status_main.php');
        }
        if ($proceed) {
            $pars = array(':status_id' => $status_id);
            $query = "SELECT * from " . table('lang') . " WHERE content_type='participant_status_name' AND content_name= :status_id";
            $status_name = orsee_query($query, $pars);
            $query = "SELECT * from " . table('lang') . " WHERE content_type='participant_status_error' AND content_name= :status_id";
            $status_error = orsee_query($query, $pars);
        }
    } else {
        $status = array('is_default_active' => 'n', 'is_default_inactive' => 'n', 'access_to_profile' => 'n', 'eligible_for_experiments' => 'n');
        $status_name = array();
        $status_error = array();
    }
示例#2
0
    if (isset($_REQUEST['job_name'])) {
        $job_name = $_REQUEST['job_name'];
    } else {
        $job_name = "";
    }
    if ($job_name) {
        $allow = check_allow('regular_tasks_edit', 'cronjob_main.php');
    } else {
        $allow = check_allow('regular_tasks_add', 'cronjob_main.php');
    }
}
if ($proceed) {
    // load languages
    $languages = get_languages();
    if ($job_name) {
        $job = orsee_db_load_array("cron_jobs", $job_name, "job_name");
    } else {
        $job = array('job_name' => '', 'enabled' => 'n', 'job_last_exec' => 0, 'job_time' => '');
    }
    $continue = true;
    if (isset($_REQUEST['edit']) && $_REQUEST['edit']) {
        if (!$_REQUEST['job_name']) {
            message(lang('name_for_cronjob_required'));
            $continue = false;
        }
        if ($continue) {
            $done = orsee_db_save_array($_REQUEST, "cron_jobs", $job_name, "job_name");
            log__admin("cronjob_edit", $_REQUEST['job_name']);
            message(lang('changes_saved'));
            redirect("admin/cronjob_edit.php?job_name=" . $job_name);
            $proceed = false;
示例#3
0
                }
            } else {
                message(lang('database_error'));
                redirect('admin/lang_item_edit.php?id=' . $id . '&item=' . $item);
            }
        } else {
            $titem = $_REQUEST;
            if ($new_id == "content_shortcut") {
                $titem['content_name'] = $_REQUEST['content_shortcut'];
            }
        }
    }
}
if ($proceed) {
    if ($id) {
        $titem = orsee_db_load_array("lang", $id, "lang_id");
    } else {
        $titem = array('content_name' => '');
    }
    show_message();
    // form
    echo '  <FORM action="lang_item_edit.php" METHOD=POST>
        <INPUT type=hidden name="id" value="' . $id . '">
        <INPUT type=hidden name="item" value="' . $item . '">

        <TABLE class="or_formtable">
            <TR><TD colspan=2>
                <TABLE width="100%" border=0 class="or_panel_title"><TR>
                        <TD style="background: ' . $color['panel_title_background'] . '; color: ' . $color['panel_title_textcolor'] . '" align="center">
                            ' . $header . '
                        </TD>
示例#4
0
function lang__get_language_names()
{
    $names = orsee_db_load_array("lang", "lang_name", "content_name");
    return $names;
}
示例#5
0
    } else {
        $session_id = "";
    }
    if ($session_id) {
        $edit = orsee_db_load_array("sessions", $session_id, "session_id");
    } else {
        $addit = true;
    }
}
if ($proceed) {
    if (isset($_REQUEST['experiment_id'])) {
        $experiment_id = $_REQUEST['experiment_id'];
    } else {
        $experiment_id = $edit['experiment_id'];
    }
    $experiment = orsee_db_load_array("experiments", $experiment_id, "experiment_id");
    if (!isset($experiment['experiment_id'])) {
        redirect("admin/");
    }
}
if ($proceed) {
    $allow = check_allow('session_edit', 'experiment_show.php?experiment_id=' . $experiment_id);
}
if ($proceed) {
    if (!check_allow('experiment_restriction_override')) {
        check_experiment_allowed($experiment_id, "admin/experiment_show.php?experiment_id=" . $experiment_id);
    }
}
if ($proceed) {
    if (isset($experiment_id) && $experiment_id) {
        $allow = check_allow('session_edit', 'experiment_show.php?experiment_id=' . $experiment_id);
示例#6
0
                if (isset($mailboxes[$id])) {
                    $continue = true;
                }
            } elseif ($mode == 'experiment') {
                $experiment = orsee_db_load_array("experiments", $id, "experiment_id");
                if (isset($experiment['experiment_id'])) {
                    $continue = true;
                }
            } elseif ($mode == 'session') {
                $session = orsee_db_load_array("sessions", $id, "session_id");
                if (isset($session['session_id'])) {
                    $continue = true;
                    $experiment = orsee_db_load_array("experiments", $session['experiment_id'], "experiment_id");
                }
            } elseif ($mode == 'participant') {
                $participant = orsee_db_load_array("participants", $id, "participant_id");
                if (isset($participant['participant_id'])) {
                    $continue = true;
                }
            }
        } elseif ($mode == 'trash' && check_allow('emails_trash_view')) {
            $continue = true;
        } elseif ($mode == 'listmailboxes') {
            $continue = true;
        }
    }
    if (!$continue) {
        $mode = "inbox";
    }
}
if ($proceed) {
示例#7
0
}
if ($proceed) {
    $allow = check_allow('lang_symbol_delete', 'lang_symbol_edit.php?lang_id=' . $lang_id);
}
if ($proceed) {
    if (isset($_REQUEST['betternot']) && $_REQUEST['betternot']) {
        redirect('admin/lang_symbol_edit.php?lang_id=' . $lang_id);
    }
}
if ($proceed) {
    if (isset($_REQUEST['reallydelete']) && $_REQUEST['reallydelete']) {
        $reallydelete = true;
    } else {
        $reallydelete = false;
    }
    $symbol = orsee_db_load_array("lang", $lang_id, "lang_id");
    if (!isset($symbol['lang_id'])) {
        redirect("admin/lang_main.php");
    }
}
if ($proceed) {
    if ($reallydelete) {
        $pars = array(':lang_id' => $lang_id);
        $query = "DELETE FROM " . table('lang') . " \n         \t\tWHERE lang_id= :lang_id";
        $result = or_query($query, $pars);
        message(lang('symbol_deleted'));
        log__admin("language_symbol_delete", "lang_id:lang," . $symbol['content_name']);
        redirect('admin/lang_edit.php');
    }
}
if ($proceed) {
示例#8
0
        $continue = true;
        $_REQUEST['content_type'] = "lang";
        if ($lang_id) {
            $done = orsee_db_save_array($_REQUEST, "lang", $lang_id, "lang_id");
        } else {
            $lang_id = lang__insert_to_lang($_REQUEST);
        }
        message(lang('changes_saved'));
        log__admin("language_symbol_edit", "lang_id:lang," . $_REQUEST['content_name']);
        redirect("admin/lang_symbol_edit.php?lang_id=" . $lang_id);
    }
}
if ($proceed) {
    // if lang id given, load data
    if ($lang_id) {
        $content = orsee_db_load_array("lang", $lang_id, "lang_id");
    } else {
        $content = array('content_name' => '');
    }
    if ($lang_id && !isset($content['lang_id'])) {
        redirect("admin/lang_main.php");
    }
}
if ($proceed) {
    echo '<center>';
    // form
    echo '	<FORM action="lang_symbol_edit.php" method=post>
		<INPUT type=hidden name="lang_id" value="' . $lang_id . '">

		<TABLE class="or_formtable">
			<TR><TD colspan="2">
                    $query = "UPDATE " . table('participate_at') . "\n\t\t\t\t\t\t\tSET session_id = :session_id, pstatus_id=0,\n\t\t\t\t\t\t\tpayment_type=0, payment_amt=0  \n\t\t\t\t\t\t\tWHERE participant_id = :participant_id \n\t\t\t\t\t\t\tAND experiment_id= :experiment_id";
                    $done = or_query($query, $pars);
                    if (count($allmids) > 0) {
                        participant__update_last_enrolment_time($allmids);
                    }
                    // clean up participation statuses for 'no session's
                    $query = "UPDATE " . table('participate_at') . "\n\t\t\t\t\t\t\tSET pstatus_id = '0' \n\t\t\t\t\t\t\tWHERE session_id='0'";
                    $done = or_query($query);
                    message(lang('changes_saved'));
                    $m_message = '<UL>';
                    foreach ($new_session as $msession => $mparts) {
                        $m_message .= '<LI>' . count($mparts) . ' ';
                        if ($msession == 0) {
                            $m_message .= lang('xxx_subjects_removed_from_registration');
                        } else {
                            $tsession = orsee_db_load_array("sessions", $msession, "session_id");
                            $m_message .= lang('xxx_subjects_moved_to_session_xxx') . ' 
								<A HREF="' . thisdoc() . '?experiment_id=' . $experiment_id . '&session_id=' . $msession . '">' . session__build_name($tsession) . '</A>';
                            $tpartnr = experiment__count_participate_at($experiment_id, $msession);
                            if ($tsession['part_needed'] + $tsession['part_reserve'] < $tpartnr) {
                                $mmessage .= lang('subjects_number_exceeded');
                            }
                        }
                    }
                    $m_message .= '</UL>';
                    message($m_message);
                    $target = "experiment:" . $experiment['experiment_name'];
                    if ($session_id) {
                        $target .= "\nsession_id:" . $session_id;
                    }
                    log__admin("experiment_edit_participant_list", $target);
$title = "delete_participation_status";
include "header.php";
if ($proceed) {
    if (isset($_REQUEST['pstatus_id'])) {
        $pstatus_id = $_REQUEST['pstatus_id'];
    } else {
        $pstatus_id = "";
    }
    if ($pstatus_id != '' && $pstatus_id == 0) {
        redirect('admin/participation_status_edit.php?pstatus_id=' . $pstatus_id);
    } elseif (!$pstatus_id) {
        redirect('admin/participation_status_main.php');
    }
}
if ($proceed) {
    $pstatus = orsee_db_load_array("participation_statuses", $pstatus_id, "pstatus_id");
    if (!isset($pstatus['pstatus_id'])) {
        redirect('admin/participation_status_main.php');
    }
}
if ($proceed) {
    if (isset($_REQUEST['betternot']) && $_REQUEST['betternot']) {
        redirect('admin/participation_status_edit.php?pstatus_id=' . $pstatus_id);
    }
}
if ($proceed) {
    if (isset($_REQUEST['reallydelete']) && $_REQUEST['reallydelete']) {
        $reallydelete = true;
    } else {
        $reallydelete = false;
    }
示例#11
0
function experimentmail__send_registration_notice($line)
{
    global $settings;
    $reg = experiment__count_participate_at($line['experiment_id'], $line['session_id']);
    $experimenters = db_string_to_id_array($line['experimenter_mail']);
    foreach ($experimenters as $experimenter) {
        $admin = orsee_db_load_array("admin", $experimenter, "admin_id");
        if (isset($admin['admin_id'])) {
            $tlang = $admin['language'] ? $admin['language'] : $settings['admin_standard_language'];
            $lang = load_language($tlang);
            $admin['session_name'] = session__build_name($line, $tlang);
            $admin['experiment_name'] = $line['experiment_name'];
            $admin['registered'] = $reg;
            $admin['status'] = session__get_status($line, $tlang, $reg);
            $admin['needed'] = $line['part_needed'];
            $admin['reserve'] = $line['part_reserve'];
            $subject = load_language_symbol('subject_for_registration_notice', $tlang);
            $subject .= ' ' . $admin['experiment_name'] . ', ' . $admin['session_name'];
            $recipient = $admin['email'];
            $mailtext = load_mail("admin_registration_notice", $tlang) . "\n" . experimentmail__get_admin_footer($tlang, $admin) . "\n";
            $message = process_mail_template($mailtext, $admin);
            $now = time();
            $list_name = lang('participant_list_filename') . ' ' . date("Y-m-d", $now);
            $list_filename = str_replace(" ", "_", $list_name) . ".pdf";
            $list_file = pdfoutput__make_part_list($line['experiment_id'], $line['session_id'], 'registered', 'lname,fname', true, $tlang);
            $done = experimentmail__mail_attach($recipient, $settings['support_mail'], $subject, $message, $list_filename, $list_file);
        }
    }
    // update session table : reg_notice_sent
    $pars = array(':session_id' => $line['session_id']);
    $query = "UPDATE " . table('sessions') . " SET reg_notice_sent='y' WHERE session_id= :session_id ";
    $done2 = or_query($query, $pars);
    return $done;
}
示例#12
0
}
$menu__area = "options";
$title = "data_for_exptype";
include "header.php";
if ($proceed) {
    // load languages
    $languages = get_languages();
    if ($exptype_id) {
        $allow = check_allow('experimenttype_edit', 'experiment_type_main.php');
    } else {
        $allow = check_allow('experimenttype_add', 'experiment_type_main.php');
    }
}
if ($proceed) {
    if ($exptype_id) {
        $exptype = orsee_db_load_array("experiment_types", $exptype_id, "exptype_id");
        $map = explode(",", $exptype['exptype_mapping']);
        foreach ($map as $etype) {
            $exptype['exptype_map'][$etype] = $etype;
        }
        $query = "SELECT * from " . table('lang') . " WHERE content_type='experiment_type' AND content_name='" . $exptype_id . "'";
        $selfdesc = orsee_query($query);
    } else {
        $exptype = array('exptype_name' => '', 'exptype_description' => '');
        $selfdesc = array();
    }
    $continue = true;
    if (isset($_REQUEST['edit']) && $_REQUEST['edit']) {
        if (!$_REQUEST['exptype_name']) {
            message(lang('name_for_exptype_required'));
            $continue = false;
示例#13
0
function participant__show_admin_form($edit, $button_title = "", $errors, $extra = "")
{
    global $lang, $settings, $color;
    $out = array();
    if (!isset($edit['participant_id'])) {
        $edit['participant_id'] = '';
    }
    if (!isset($edit['subpool_id'])) {
        $edit['subpool_id'] = 1;
    }
    $subpool = orsee_db_load_array("subpools", $edit['subpool_id'], "subpool_id");
    if (!$subpool['subpool_id']) {
        $subpool = orsee_db_load_array("subpools", 1, "subpool_id");
    }
    $edit['subpool_id'] = $subpool['subpool_id'];
    $pools = subpools__get_subpools();
    foreach ($pools as $p => $pool) {
        $out['is_subjectpool_' . $p] = false;
    }
    $out['is_subjectpool_' . $subpool['subpool_id']] = true;
    echo '<FORM action="' . thisdoc() . '" method="POST">';
    echo '<table border="0">';
    echo '<TR><TD valign="top">';
    echo '<TABLE class="or_formtable" style="width: 100%; height: 100%; max-width: 100%"><TR><TD>';
    // get the participant form
    participant__show_inner_form($edit, $errors, true);
    echo '</TD></TR></TABLE>';
    echo '</TD><TD valign="top">';
    echo '<TABLE class="or_formtable" style="width: 100%; height: 100%; max-width: 100%; background: ' . $color['list_shade2'] . '"><TR><TD>';
    echo '<INPUT type="hidden" name="participant_id" value="' . $edit['participant_id'] . '">';
    global $hide_header;
    if (isset($hide_header) && $hide_header) {
        echo '<INPUT type="hidden" name="hide_header" value="true">';
    }
    $adminformoutput = participant__get_inner_admin_form($edit, $errors);
    if ($adminformoutput) {
        echo '<TABLE width="100%">
                <TR><TD valign="top" bgcolor="' . $color['list_shade1'] . '">';
        echo $adminformoutput;
        echo '</TD></TR></TABLE>';
    }
    echo '<BR>';
    // then show the rest
    // initialize
    if (!isset($edit['participant_id'])) {
        $edit['participant_id'] = '???';
    }
    if (!isset($edit['participant_id_crypt'])) {
        $edit['participant_id_crypt'] = '???';
    }
    if (isset($edit['creation_time'])) {
        $tout['creation_time'] = ortime__format($edit['creation_time'], '', lang('lang'));
    } else {
        $tout['creation_time'] = '';
    }
    if (!isset($edit['rules_signed'])) {
        $edit['rules_signed'] = '';
    }
    if (!isset($edit['session_id'])) {
        $edit['session_id'] = '';
    }
    if (!isset($edit['remarks'])) {
        $edit['remarks'] = '';
    }
    echo '<table width="100%">';
    echo '  <tr><td>' . lang('subpool') . '</td>
            <td>' . subpools__select_field("subpool_id", $edit['subpool_id']) . '</td></tr>';
    echo '<tr><td colspan=2>&nbsp;</td></tr>';
    echo '  <tr><td>' . lang('id') . '</td>
            <td>' . $edit['participant_id'] . ' (' . $edit['participant_id_crypt'] . ')</td></tr>
        <tr><td>' . lang('creation_time') . '</td>
            <td>';
    if (isset($edit['creation_time'])) {
        echo ortime__format($edit['creation_time'], '', lang('lang'));
    } else {
        echo '???';
    }
    echo '  </td></tr>';
    if ($settings['enable_rules_signed_tracking'] == 'y') {
        echo '<tr><td>' . lang('rules_signed') . '</td>
            <td>' . participant__rules_signed_form_field($edit['rules_signed']) . '</td></tr>';
    }
    echo '<tr><td valign="top">' . lang('remarks') . '</td>
            <td>' . participant__remarks_form_field($edit['remarks']) . '</td></tr>';
    echo '<tr><td colspan=2>&nbsp;</td></tr>';
    echo '<tr><td colspan=2 align=left>
                ' . participant__add_to_session_checkbox() . ' ' . lang('register_sub_for_session') . '<BR>
                ' . participant__add_to_session_select($edit['session_id'], $edit['participant_id']) . '
            </td></tr>';
    echo '</td></tr></table>';
    echo '</TD></TR><TR><TD valign="bottom"  bgcolor="' . $color['list_shade2'] . '">';
    echo '<table>
            <tr style="outline: 2px solid red;">
            <td>
                <B>' . lang('participant_status') . '</B>: ';
    if (check_allow('participants_change_status')) {
        if (!isset($_REQUEST['status_id'])) {
            $_REQUEST['status_id'] = "";
        }
        if ($_REQUEST['status_id'] == '0') {
            $hide = array();
        } else {
            $hide = array('0');
        }
        echo '<INPUT type="hidden" name="old_status_id" value="' . $_REQUEST['status_id'] . '">' . participant_status__select_field('status_id', $_REQUEST['status_id'], $hide);
    } elseif (!$edit['participant_id']) {
        $default_status = participant_status__get("is_default_active");
        $statuses = participant_status__get_statuses();
        echo '<INPUT type="hidden" name="status_id" value="' . $default_status . '">' . $statuses[$default_status]['name'];
    } else {
        echo participant_status__get_name($_REQUEST['status_id']);
    }
    echo '</td></tr></table>';
    echo '</td></tr></table>';
    echo '</td></tr>';
    if (!$button_title) {
        $button_title = lang('change');
    }
    echo '<tr><td colspan="2" align="center">
            <INPUT class="button" name="add" type="submit" value="' . $button_title . '">
            </td></tr>';
    echo '</table></form>';
}
$menu__area = "options_main";
$jquery = array();
include "header.php";
if ($proceed) {
    $user_columns = participant__userdefined_columns();
    if (!isset($_REQUEST['mysql_column_name']) || !isset($user_columns[$_REQUEST['mysql_column_name']])) {
        redirect('admin/options_participant_profile.php');
    } else {
        $field_name = $_REQUEST['mysql_column_name'];
    }
}
if ($proceed) {
    $allow = check_allow('pform_config_field_configure', 'options_participant_profile.php');
}
if ($proceed) {
    $field = orsee_db_load_array("profile_fields", $field_name, "mysql_column_name");
    $allvalues = participantform__allvalues();
    if (!isset($field['mysql_column_name'])) {
        $new = true;
        $field = array('mysql_column_name' => $field_name, 'enabled' => 'y', 'name_lang' => $field_name, 'type' => 'select_lang');
    } else {
        $new = false;
        $prop = db_string_to_property_array($field['properties']);
        unset($field['properties']);
        foreach ($prop as $k => $v) {
            $field[$k] = $v;
        }
    }
    foreach ($allvalues as $k => $v) {
        if (!isset($field[$k])) {
            $field[$k] = $v;
示例#15
0
if ($proceed) {
    if (isset($_REQUEST['betternot']) && $_REQUEST['betternot']) {
        redirect('admin/admin_edit.php?admin_id=' . $admin_id);
        $proceed = false;
    }
}
if ($proceed) {
    if (isset($_REQUEST['reallydelete']) && $_REQUEST['reallydelete']) {
        $reallydelete = true;
    } else {
        $reallydelete = false;
    }
    $allow = check_allow('admin_delete', 'admin_edit.php?admin_id=' . $admin_id);
}
if ($proceed) {
    $admin = orsee_db_load_array("admin", $admin_id, "admin_id");
    echo '<center>';
    if ($reallydelete) {
        $pars = array(':admin_id' => $admin_id);
        $query = "DELETE FROM " . table('admin') . "\n                WHERE admin_id= :admin_id";
        $result = or_query($query, $pars);
        log__admin("admin_delete", $admin['adminname']);
        message(lang('admin_deleted') . ': ' . $admin['adminname']);
        redirect('admin/admin_show.php');
        $proceed = false;
    }
}
if ($proceed) {
    // form
    $num_experiments = experiment__count_experiments("experimenter LIKE :adminname", array(':adminname' => '%|' . $admin['adminname'] . '|%'));
    if ($num_experiments > 0) {
示例#16
0
function downloads__list_files_experiment($experiment_id, $showsize = false, $showtype = false, $showdate = false)
{
    global $lang, $color, $expadmindata;
    $out = '';
    $continue = true;
    if ($continue) {
        $experiment = orsee_db_load_array("experiments", $experiment_id, "experiment_id");
        if (!isset($experiment['experiment_id'])) {
            $continue = false;
        }
    }
    if ($continue) {
        $experimenters = db_string_to_id_array($experiment['experimenter']);
        if (!(in_array($expadmindata['admin_id'], $experimenters) && check_allow('file_view_experiment_my') || check_allow('file_view_experiment_all'))) {
            $continue = false;
        }
    }
    if ($continue) {
        if (check_allow('file_download_experiment_all')) {
            $allow_dl = true;
        } elseif (in_array($expadmindata['admin_id'], $experimenters) && check_allow('file_download_experiment_my')) {
            $allow_dl = true;
        } else {
            $allow_dl = false;
        }
        if (check_allow('file_delete_experiment_all')) {
            $allow_delete = true;
        } elseif (in_array($expadmindata['admin_id'], $experimenters) && check_allow('file_delete_experiment_my')) {
            $allow_delete = true;
        } else {
            $allow_delete = false;
        }
        if (check_allow('file_edit_experiment_all')) {
            $allow_edit = true;
        } elseif (in_array($expadmindata['admin_id'], $experimenters) && check_allow('file_edit_experiment_my')) {
            $allow_edit = true;
        } else {
            $allow_edit = false;
        }
        $query = "SELECT " . table('uploads') . ".*, " . table('sessions') . ".session_start\n                FROM " . table('uploads') . " LEFT JOIN " . table('sessions') . "\n                ON " . table('uploads') . ".session_id = " . table('sessions') . ".session_id\n                WHERE " . table('uploads') . ".experiment_id= :experiment_id\n                ORDER BY session_start, upload_type, upload_name, upload_id";
        $pars = array(':experiment_id' => $experiment_id);
        $result = or_query($query, $pars);
        if (pdo_num_rows($result) > 0) {
            $shade = true;
            $categories = lang__load_lang_cat('file_upload_category');
            $uptype = -1;
            $tsession_id = -1;
            $cols = 3;
            if ($showsize) {
                $cols++;
            }
            if ($showtype) {
                $cols++;
            }
            if ($showdate) {
                $cols++;
            }
            if ($allow_edit) {
                $cols++;
            }
            if ($allow_delete) {
                $cols++;
            }
            $out .= '<TABLE width="100%" border=0 cellspacing="0">';
            while ($upload = pdo_fetch_assoc($result)) {
                if ($shade) {
                    $bgcolor = ' bgcolor="' . $color['list_shade1'] . '"';
                    $shade = false;
                } else {
                    $bgcolor = ' bgcolor="' . $color['list_shade2'] . '"';
                    $shade = true;
                }
                if ($upload['session_id'] != $tsession_id) {
                    $tsession_id = $upload['session_id'];
                    $uptype = 0;
                    $out .= '<TR bgcolor="' . $color['list_shade_subtitle'] . '">
                        <TD colspan=' . $cols . '>';
                    if ($upload['session_id'] > 0) {
                        $out .= '<i>' . lang('session') . ' ' . ortime__format(ortime__sesstime_to_unixtime($upload['session_start'])) . '</i>';
                    } else {
                        $out .= '<i>' . lang('no_session') . '</i>';
                    }
                    $out .= '</TD></TR>';
                }
                if ($upload['upload_type'] != $uptype) {
                    $uptype = $upload['upload_type'];
                    $out .= '<TR bgcolor="' . $color['list_shade_subtitle'] . '">
                        <TD>&nbsp;</TD>
                        <TD colspan=' . ($cols - 1) . '>';
                    if (isset($categories[$uptype])) {
                        $out .= $categories[$uptype];
                    } else {
                        $out .= '???';
                    }
                    $out .= '</TD></TR>';
                }
                $out .= '<TR' . $bgcolor . '><TD>&nbsp;&nbsp;</TD><TD>';
                if ($allow_dl) {
                    $out .= '<A HREF="download_file.php' . '/' . rawurlencode($upload['upload_name'] . '.' . $upload['upload_suffix']) . '?t=d&i=' . $upload['upload_id'] . '">';
                }
                $out .= $upload['upload_name'];
                if ($allow_dl) {
                    $out .= '</A>';
                }
                $out .= '</TD>';
                if ($showsize) {
                    $out .= '<TD>' . number_format(round($upload['upload_filesize'] / 1024), 0) . ' KB</TD>';
                }
                if ($showtype) {
                    $out .= '<TD>' . $upload['upload_suffix'] . '</TD>';
                }
                if ($showdate) {
                    $out .= '<TD>' . ortime__format($upload['upload_id'], '', lang('lang')) . '</TD>';
                }
                if ($allow_edit) {
                    $out .= '    <TD>';
                    $out .= '    <A HREF="download_edit.php?file=' . $upload['upload_id'] . '"><FONT class="small">[' . lang('edit') . ']</FONT></A>';
                    $out .= '    </TD>';
                }
                if ($allow_delete) {
                    $out .= '    <TD>';
                    $out .= '    <A HREF="download_delete.php?dl=' . $upload['upload_id'] . '"><FONT class="small">[' . lang('delete') . ']</FONT></A>';
                    $out .= '    </TD>';
                }
                $out .= '</TR>';
            }
            $out .= '</TABLE>';
        }
    }
    return $out;
}
示例#17
0
ob_start();
$menu__area = "options";
$title = "edit_admin_type";
include "header.php";
if ($proceed) {
    $allow = check_allow('admin_type_edit', 'admin_type_show.php');
}
if ($proceed) {
    if (isset($_REQUEST['type_id']) && $_REQUEST['type_id']) {
        $type_id = $_REQUEST['type_id'];
    } else {
        $type_id = "";
    }
    $rights = array();
    if ($type_id) {
        $type = orsee_db_load_array("admin_types", $type_id, "type_id");
    } else {
        $type = array();
    }
    if (isset($_REQUEST['save']) && $_REQUEST['save']) {
        $continue = true;
        $type = $_REQUEST;
        if (!$type_id && !$type['type_name']) {
            message(lang('error_admintype_name_required'));
            $continue = false;
        }
        if (isset($type['right_list'])) {
            $trights = array();
            foreach ($type['right_list'] as $key => $value) {
                if ($value) {
                    $trights[] = $key;
示例#18
0
function pdfoutput__make_part_list($experiment_id, $session_id = "", $pstatus = "", $focus = "", $sort = "", $file = false, $tlang = "")
{
    global $settings;
    if ($tlang == "") {
        global $lang;
    } else {
        $lang = load_language($tlang);
    }
    $experiment = orsee_db_load_array("experiments", $experiment_id, "experiment_id");
    $pstatuses = expregister__get_participation_statuses();
    if ($session_id) {
        $clause = "session_id = '" . $session_id . "'";
        $title = lang('registered_subjects');
    } elseif (isset($pstatuses[$pstatus])) {
        $clause = "pstatus_id = '" . $pstatus . "'";
        if ($pstatus == 0) {
            $clause .= " AND session_id != 0";
        }
        $title = lang('subjects_in_participation_status') . ' "' . $pstatuses[$pstatus]['internal_name'] . '"';
    } elseif ($focus == 'enroled') {
        $clause = "session_id != 0";
        $title = lang('registered_subjects');
    }
    $cols = participant__get_result_table_columns('session_participants_list_pdf');
    if ($session_id) {
        unset($cols['session_id']);
    }
    // load sessions of this experiment
    $pars = array(':experiment_id' => $experiment_id);
    $query = "SELECT *\n\t\t\tFROM " . table('sessions') . "\n\t\t\tWHERE experiment_id= :experiment_id\n\t\t\tORDER BY session_start";
    $result = or_query($query, $pars);
    global $thislist_sessions;
    $thislist_sessions = array();
    while ($line = pdo_fetch_assoc($result)) {
        $thislist_sessions[$line['session_id']] = $line;
    }
    // load participant data for this session/experiment
    $pars = array(':experiment_id' => $experiment_id);
    $select_query = "SELECT * FROM " . table('participate_at') . ", " . table('participants') . "  \n\t\t\t\t\tWHERE " . table('participate_at') . ".experiment_id= :experiment_id\n\t\t\t\t\tAND " . table('participate_at') . ".participant_id=" . table('participants') . ".participant_id\n\t\t\t\t\tAND (" . $clause . ")";
    $order = query__get_sort('session_participants_list_pdf', $sort);
    if (!$order) {
        $order = table('participants') . ".participant_id";
    }
    $select_query .= " ORDER BY " . $order;
    // get result
    $result = or_query($select_query, $pars);
    $participants = array();
    while ($line = pdo_fetch_assoc($result)) {
        $participants[] = $line;
    }
    $result_count = count($participants);
    // load sessions of this experiment
    $pars = array(':texperiment_id' => $experiment_id);
    $squery = "SELECT *\n            FROM " . table('sessions') . "\n\t\t\tWHERE experiment_id= :texperiment_id \n            ORDER BY session_start";
    $result = or_query($squery, $pars);
    $thislist_sessions = array();
    while ($line = pdo_fetch_assoc($result)) {
        $thislist_sessions[$line['session_id']] = $line;
    }
    // reorder by session date if ordered by session id
    if ($sort == "session_id") {
        $temp_participants = $participants;
        $participants = array();
        foreach ($thislist_sessions as $sid => $s) {
            foreach ($temp_participants as $p) {
                if ($p['session_id'] == $sid) {
                    $participants[] = $p;
                }
            }
        }
    }
    unset($temp_participants);
    // determine table title
    $table_title = $experiment['experiment_public_name'];
    if ($session_id) {
        $table_title .= ', ' . lang('session') . ' ' . str_replace("&nbsp;", " ", session__build_name($thislist_sessions[$session_id]));
    }
    $table_title .= ' - ' . $title;
    // determine table headings
    $table_headings = participant__get_result_table_headcells_pdf($cols);
    $table_data = array();
    $pnr = 0;
    foreach ($participants as $p) {
        $pnr++;
        $p['order_number'] = $pnr;
        $row = participant__get_result_table_row_pdf($cols, $p);
        $table_data[] = $row;
    }
    // prepare pdf
    include_once '../tagsets/class.ezpdf.php';
    $pdf = new Cezpdf('a4', 'landscape');
    $pdf->selectFont('../tagsets/fonts/Times-Roman.afm');
    $fontsize = $settings['participant_list_pdf_table_fontsize'] ? $settings['participant_list_pdf_table_fontsize'] : 10;
    $titlefontsize = $settings['participant_list_pdf_title_fontsize'] ? $settings['participant_list_pdf_title_fontsize'] : 12;
    $y = $pdf->ezTable($table_data, $table_headings, $table_title, array('gridlines' => 31, 'showHeadings' => 1, 'shaded' => 2, 'shadeCol' => array(1, 1, 1), 'shadeCol2' => array(0.9, 0.9, 0.9), 'fontSize' => $fontsize, 'titleFontSize' => $titlefontsize, 'rowGap' => 1, 'colGap' => 3, 'innerLineThickness' => 0.5, 'outerLineThickness' => 1, 'maxWidth' => 800, 'width' => 800, 'protectRows' => 2));
    if ($file) {
        $pdffilecode = $pdf->output();
        return $pdffilecode;
    } else {
        $pdf->ezStream(array('Content-Disposition' => 'participant_list.pdf', 'Accept-Ranges' => 0, 'compress' => 1));
    }
}
示例#19
0
             $redir .= "&";
         } else {
             $redir .= "?";
         }
         $redir .= "s=" . $session_id;
         redirect($redir);
     }
 } elseif (isset($_REQUEST['cancel']) && $_REQUEST['cancel'] && isset($settings['allow_subject_cancellation']) && $settings['allow_subject_cancellation'] == 'y') {
     $continue = true;
     if (!$session_id) {
         $continue = false;
         log__participant("interfere enrolment cancellation- no session_id", $participant_id);
         message(lang('error_session_id_register'));
         redirect("public/participant_show_mob.php" . $token_string);
     } else {
         $session = orsee_db_load_array("sessions", $session_id, "session_id");
         if (!isset($session['session_id'])) {
             log__participant("interfere enrolment cancellation - invalid session_id", $participant_id);
             message(lang('error_session_id_register'));
             redirect("public/participant_show_mob.php" . $token_string);
         }
     }
     if ($proceed) {
         $participate_at = expregister__get_participate_at($participant_id, $session['experiment_id']);
         if (!isset($participate_at['session_id']) || $participate_at['session_id'] != $session_id) {
             $continue = false;
             redirect("public/participant_show_mob.php" . $token_string);
         }
     }
     if ($proceed) {
         $cancellation_deadline = sessions__get_cancellation_deadline($session);
示例#20
0
function admin__load_admin_rights($admin_type)
{
    $admin_type = orsee_db_load_array("admin_types", $admin_type, "type_name");
    $trights = explode(",", $admin_type['rights']);
    $rights = array();
    foreach ($trights as $right) {
        $rights[$right] = true;
    }
    return $rights;
}
示例#21
0
        }
    }
}
if ($proceed) {
    if ($experiment_id > 0) {
        $experimenters = db_string_to_id_array($experiment['experimenter']);
        if (!(in_array($expadmindata['admin_id'], $experimenters) && check_allow('file_download_experiment_my') || check_allow('file_download_experiment_all'))) {
            redirect('admin/experiment_show.php?experiment_id=' . $experiment_id);
        }
    } else {
        $allow = check_allow('file_download_general', 'download_main.php');
    }
}
if ($proceed) {
    // load file specification
    $filedata = orsee_db_load_array("uploads_data", $upload_id, "upload_id");
    // mime type
    $mime_type = $upload['upload_mimetype'];
    if (!$mime_type) {
        $mime_type = downloads__mime_type($upload['upload_suffix']);
    }
    if (!$mime_type) {
        $mime_type = "text/*";
    }
    $filename = str_replace(" ", "_", $upload['upload_name']) . "." . $upload['upload_suffix'];
    ob_end_clean();
    header("Pragma: public");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Content-Type: " . $mime_type . "; name=\"{$filename}\"");
    header("Content-Disposition: attachment; filename=\"{$filename}\"");
示例#22
0
文件: query.php 项目: danorama/orsee
function query__apply_permanent_queries()
{
    global $settings;
    $continue = true;
    $target = '';
    $num_queries = 0;
    $num_p = 0;
    $num_assigned = 0;
    if ($continue) {
        if ($settings['allow_permanent_queries'] != 'y') {
            $continue = false;
        }
    }
    if ($continue) {
        $ppart = array();
        $ppart = participant__get_permanent_query_participants();
        if (count($ppart) == 0) {
            $continue = false;
        }
    }
    if ($continue) {
        $pqu = array();
        $pqu = query__get_permanent();
        if (count($pqu) == 0) {
            $continue = false;
        } else {
            $num_queries = count($pqu);
        }
    }
    if ($continue) {
        $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
        $query_assigned = array();
        foreach ($ppart as $p) {
            $num_p++;
            foreach ($pqu as $q) {
                $experiment = orsee_db_load_array("experiments", $q['experiment_id'], "experiment_id");
                if (!isset($experiment['experiment_id'])) {
                    $continue = false;
                }
                if ($continue) {
                    $posted_query = $json->decode($q['json_query']);
                    $query_array = query__get_query_array($posted_query['query']);
                    $active_clause = array('query' => participant_status__get_pquery_snippet("eligible_for_experiments"), 'pars' => array());
                    $exptype_clause = array('query' => "subscriptions LIKE (:experiment_ext_type)", 'pars' => array(':experiment_ext_type' => "%|" . $experiment['experiment_ext_type'] . "|%"));
                    $notyetassigned_clause = array('query' => "participant_id NOT IN (SELECT participant_id FROM " . table('participate_at') . " WHERE experiment_id= :experiment_id)", 'pars' => array(':experiment_id' => $experiment['experiment_id']));
                    $additional_clauses = array($active_clause, $exptype_clause, $notyetassigned_clause);
                    $query = query__get_query($query_array, time(), $additional_clauses, '');
                    $result = or_query($query['query'], $query['pars']);
                    $p_is_eligibe = false;
                    while ($pc = pdo_fetch_assoc($result)) {
                        if ($pc['participant_id'] = $p['participant_id']) {
                            $p_is_eligibe = true;
                        }
                    }
                    if (!$p_is_eligibe) {
                        $continue = false;
                    }
                }
                if ($continue) {
                    // assign participant
                    $pars = array(':participant_id' => $p['participant_id'], ':experiment_id' => $experiment['experiment_id']);
                    $query = "INSERT INTO " . table('participate_at') . " (participant_id,experiment_id)\n                            VALUES (:participant_id , :experiment_id)";
                    $done = or_query($query, $pars);
                    $num_assigned++;
                    if ($settings['permanent_queries_invite'] == 'y') {
                        // send invitation into mail queue
                        $pars = array(':experiment_id' => $experiment['experiment_id'], ':now' => time(), ':recipient' => $p['participant_id']);
                        $query = "INSERT INTO " . table('mail_queue') . "\n                                SET timestamp = :now,\n                                mail_type = 'invitation',\n                                mail_recipient = :recipient,\n                                experiment_id = :experiment_id ";
                        $done = or_query($query, $pars);
                    }
                    if (!isset($query_assigned[$q['query_id']])) {
                        $query_assigned[$q['query_id']] = 0;
                    }
                    $query_assigned[$q['query_id']]++;
                }
            }
            // done with participant, reset permanent status
            $pars = array(':participant_id' => $p['participant_id']);
            $query = "UPDATE " . table('participants') . "\n                    SET apply_permanent_queries = 0\n                    WHERE participant_id = :participant_id";
            $done = or_query($query, $pars);
        }
        // and now update permanent queries with assignment numbers
        foreach ($pqu as $q) {
            if (!isset($query_assigned[$q['query_id']])) {
                $query_assigned[$q['query_id']] = 0;
            }
            $done = query__update_permanent_query($q['query_id'], $query_assigned[$q['query_id']]);
        }
    }
    $target = 'Participants checked: ' . $num_p;
    if ($num_p > 0) {
        $target .= ', PermQueries found: ' . $num_queries;
    }
    if ($num_queries > 0) {
        $target .= ', Assignments made: ' . $num_assigned;
    }
    return $target;
}
示例#23
0
}
if ($proceed) {
    if (isset($_REQUEST['betternot']) && $_REQUEST['betternot']) {
        redirect('admin/events_edit.php?event_id=' . $event_id);
    }
}
if ($proceed) {
    if (isset($_REQUEST['reallydelete']) && $_REQUEST['reallydelete']) {
        $reallydelete = true;
    } else {
        $reallydelete = false;
    }
    $allow = check_allow('events_delete', 'events_edit.php?event_id=' . $event_id);
}
if ($proceed) {
    $space = orsee_db_load_array("events", $event_id, "event_id");
    if ($reallydelete) {
        $pars = array('event_id' => $event_id);
        $query = "DELETE FROM " . table('events') . "\n                WHERE event_id= :event_id";
        $result = or_query($query, $pars);
        log__admin("events_delete", "event_id:" . $event_id);
        message(lang('lab_reservation_deleted'));
        redirect('admin/calendar_main.php');
    }
}
if ($proceed) {
    // form
    echo '  <CENTER>
        <TABLE>
            <TR>
                <TD colspan=2>
示例#24
0
文件: email.php 项目: bgreiner/orsee
function email__is_allowed($email, $experiment, $priv = 'read')
{
    global $settings, $expadmindata;
    $return = false;
    $continue = true;
    if ($settings['enable_email_module'] == 'y') {
        if (check_allow('emails_' . $priv . '_all')) {
            $return = true;
            $continue = false;
        }
        if ($continue && check_allow('emails_' . $priv . '_experiments') && $email['experiment_id']) {
            if (!isset($experiment['experiment_id'])) {
                $experiment = orsee_db_load_array("experiments", $email['experiment_id'], "experiment_id");
            }
            $experimenters = db_string_to_id_array($experiment['experimenter']);
            if (in_array($expadmindata['admin_id'], $experimenters)) {
                $return = true;
                $continue = false;
            }
        }
        if ($continue && $settings['email_module_allow_assign_emails'] == 'y' && check_allow('emails_' . $priv . '_assigned')) {
            $assigned_to = db_string_to_id_array($experiment['assigned_to']);
            if (in_array($expadmindata['admin_id'], $assigned_to)) {
                $return = true;
                $continue = false;
            }
        }
    }
    return $return;
}
    } else {
        $message_id = '';
    }
    if (!$message_id) {
        redirect('admin/emails_main.php');
    }
}
if ($proceed) {
    if (isset($_REQUEST['k'])) {
        $k = $_REQUEST['k'];
    } else {
        redirect('admin/emails_main.php');
    }
}
if ($proceed) {
    $email = orsee_db_load_array("emails", $message_id, "message_id");
    if (!isset($email['message_id'])) {
        redirect('admin/emails_main.php');
    }
}
if ($proceed) {
    if (!$email['has_attachments']) {
        redirect('admin/emails_view.php?message_id=' . urlencode($message_id));
    }
}
if ($proceed) {
    $attachments = email__dbstring_to_attachment_array($email['attachment_data'], false);
    if (!isset($attachments[$k])) {
        redirect('admin/emails_view.php?message_id=' . urlencode($message_id));
    }
}
示例#26
0
function sessions__session_full($session_id, $thissession = array())
{
    if (!isset($thissession['session_id'])) {
        $thissession = orsee_db_load_array("sessions", $session_id, "session_id");
    }
    $reg = experiment__count_participate_at($thissession['experiment_id'], $thissession['session_id']);
    if ($reg < $thissession['part_needed'] + $thissession['part_reserve']) {
        $session_full = false;
    } else {
        $session_full = true;
    }
    return $session_full;
}
示例#27
0
                }
                $form = false;
                $addition = "";
                if ($hide_header) {
                    $addition .= "&hide_header=true";
                }
                redirect("admin/participants_edit.php?participant_id=" . $participant['participant_id'] . $addition);
            } else {
                message(lang('database_error'));
            }
        }
    }
}
if ($proceed) {
    if ($participant_id && $continue) {
        $_REQUEST = orsee_db_load_array("participants", $participant_id, "participant_id");
    }
    $button_title = $participant_id ? lang('save') : lang('add');
    echo '<CENTER>';
    show_message();
    participant__show_admin_form($_REQUEST, $button_title, $errors__dataform, true);
    echo '<CENTER>';
    if ($participant_id) {
        participants__get_statistics($participant_id);
    }
    if ($settings['enable_email_module'] == 'y' && isset($_REQUEST['participant_id'])) {
        $nums = email__get_privileges('participant', $_REQUEST, 'read', true);
        if ($nums['allowed'] && $nums['num_all'] > 0) {
            echo '<br><br><TABLE class="or_page_subtitle" style="background: ' . $color['page_subtitle_background'] . '; color: ' . $color['page_subtitle_textcolor'] . '; width: 90%">
					<TR><TD align="left">
						' . lang('emails') . '
示例#28
0
$title = "edit_budget";
$jquery = array('arraypicker', 'textext');
include "header.php";
if ($proceed) {
    if (isset($_REQUEST['budget_id'])) {
        $budget_id = $_REQUEST['budget_id'];
    }
    if (isset($budget_id)) {
        $allow = check_allow('payments_budget_edit', 'payments_budget_main.php');
    } else {
        $allow = check_allow('payments_budget_add', 'payments_budget_main.php');
    }
}
if ($proceed) {
    if (isset($budget_id)) {
        $budget = orsee_db_load_array("budgets", $budget_id, "budget_id");
        if (!isset($budget['budget_id'])) {
            redirect('admin/payments_budget_main.php');
        }
    } else {
        $budget = array('budget_name' => '', 'budget_limit' => '', 'enabled' => 0, 'experimenter' => '');
    }
}
if ($proceed) {
    $continue = true;
    if (isset($_REQUEST['edit']) && $_REQUEST['edit']) {
        if (!isset($_REQUEST['budget_name']) || !$_REQUEST['budget_name']) {
            message(lang('error_you_have_to_provide_budget_name'));
            $continue = false;
        }
        if ($continue) {
}
if ($proceed) {
    $allow = check_allow('pform_templates_edit', 'options_main.php');
}
if ($proceed) {
    $t = options__load_object('profile_form_template', $item_name);
}
if ($proceed) {
    if (!isset($_REQUEST['subpool_id'])) {
        $subpool_id = 1;
    } else {
        $subpool_id = $_REQUEST['subpool_id'];
    }
    $subpool = orsee_db_load_array("subpools", $subpool_id, "subpool_id");
    if (!$subpool['subpool_id']) {
        $subpool = orsee_db_load_array("subpools", 1, "subpool_id");
    }
}
if ($proceed) {
    if (isset($_REQUEST['edit']) && $_REQUEST['edit']) {
        $t['item_details']['current_draft'] = $_REQUEST['current_draft'];
        $t['item_details'] = property_array_to_db_string($t['item_details']);
        $done = orsee_db_save_array($t, "objects", $t['item_id'], "item_id");
        log__admin("pform_templates_edit", "item_name:" . $t['item_name']);
        message(lang('changes_saved'));
        redirect('admin/options_profile_template_edit.php?item_name=' . $item_name . '&subpool_id=' . $subpool_id);
    } elseif (isset($_REQUEST['activate']) && $_REQUEST['activate']) {
        $t['item_details']['current_template'] = $t['item_details']['current_draft'];
        $t['item_details'] = property_array_to_db_string($t['item_details']);
        $done = orsee_db_save_array($t, "objects", $t['item_id'], "item_id");
        log__admin("pform_templates_activate", "item_name:" . $t['item_name']);
示例#30
0
}
if ($proceed) {
    // load languages
    $languages = get_languages();
    foreach ($languages as $language) {
        $exptype[$language] = $selfdesc[$language];
    }
    echo '<center>';
    if ($reallydelete) {
        if (isset($_REQUEST['merge_with']) && $_REQUEST['merge_with']) {
            $merge_with = $_REQUEST['merge_with'];
        } else {
            $merge_with = '';
        }
        if ($merge_with) {
            $merge_with_type = orsee_db_load_array("experiment_types", $merge_with, "exptype_id");
        }
        if (!isset($merge_with_type['exptype_id'])) {
            message("No target exptype provided!");
            redirect('admin/experiment_type_edit.php?exptype_id=' . $exptype_id);
        } else {
            $queries = array();
            $tq = array();
            $tq['pars'] = array(':exptype_id' => $exptype_id);
            $tq['query'] = "DELETE FROM " . table('experiment_types') . " \n  \t             \tWHERE exptype_id= :exptype_id";
            $queries[] = $tq;
            $tq = array();
            $tq['pars'] = array(':exptype_id' => $exptype_id);
            $tq['query'] = "DELETE FROM " . table('lang') . "\n            \t    WHERE content_name= :exptype_id \n\t\t\t\t\tAND content_type='experiment_type'";
            $queries[] = $tq;
            $tq = array();