예제 #1
0
function expregister__get_invitations($participant_id)
{
    global $settings;
    $pars = array(':participant_id' => $participant_id);
    $query = "SELECT *\n   \t\t\tFROM " . table('participate_at') . ", " . table('experiments') . ", " . table('sessions') . " \n        \tWHERE " . table('experiments') . ".experiment_id=" . table('sessions') . ".experiment_id\n\t\t\tAND " . table('experiments') . ".experiment_id=" . table('participate_at') . ".experiment_id\n\t\t\tAND " . table('participate_at') . ".participant_id = :participant_id\n\t\t\tAND " . table('sessions') . ".session_status = 'live' \n\t\t\tAND " . table('participate_at') . ".session_id=0 \n\t\t\tAND " . table('participate_at') . ".pstatus_id=0 ";
    if ($settings['enable_enrolment_only_on_invite'] == 'y') {
        $query .= " AND " . table('participate_at') . ".invited=1 ";
    }
    $query .= "AND " . table('experiments') . ".experiment_type='laboratory'\n      \t\tORDER BY " . table('experiments') . ".experiment_id, session_start";
    $result = or_query($query, $pars);
    $invited = array();
    $last_exp_id = "";
    $inv_experiments = array();
    while ($varray = pdo_fetch_assoc($result)) {
        $varray['session_unixtime'] = ortime__sesstime_to_unixtime($varray['session_start']);
        $varray['registration_unixtime'] = sessions__get_registration_end($varray);
        $varray['session_full'] = sessions__session_full("", $varray);
        $now = time();
        if ($now < $varray['session_unixtime']) {
            if ($varray['experiment_id'] != $last_exp_id) {
                $last_exp_id = $varray['experiment_id'];
                $varray['new_experiment'] = true;
            } else {
                $varray['new_experiment'] = false;
            }
            $varray['session_name'] = session__build_name($varray);
            $invited[] = $varray;
            $inv_experiments[$varray['experiment_id']] = true;
        }
    }
    $result = array('inv_experiments' => $inv_experiments, 'invited' => $invited);
    return $result;
}
예제 #2
0
         if (!$participate_at['invited']) {
             $continue = false;
             redirect("public/participant_show_mob.php" . $token_string);
         }
     }
 }
 if ($proceed) {
     if (isset($participate_at['session_id']) && $participate_at['session_id'] > 0) {
         $continue = false;
         message(lang('error_already_registered'));
         redirect("public/participant_show_mob.php" . $token_string);
     }
 }
 if ($proceed) {
     $registration_end = sessions__get_registration_end($session);
     $full = sessions__session_full($session_id, $session);
     $now = time();
     if ($registration_end < $now) {
         $continue = false;
         message(lang('error_registration_expired'));
         redirect("public/participant_show_mob.php" . $token_string);
     }
 }
 if ($proceed) {
     if ($full) {
         $continue = false;
         message(lang('error_session_complete'));
         redirect("public/participant_show_mob.php" . $token_string);
     }
 }
 // if all checks are done, register ...
예제 #3
0
function experimentmail__get_session_list($experiment_id, $tlang = "")
{
    global $settings, $lang;
    $savelang = $lang;
    if (!$tlang) {
        $tlang = $settings['public_standard_language'];
    }
    if (lang('lang') != $tlang) {
        $lang = load_language($tlang);
    }
    $pars = array(':experiment_id' => $experiment_id);
    $query = "SELECT *\n            FROM " . table('sessions') . "\n            WHERE experiment_id= :experiment_id\n            AND session_status='live'\n            ORDER BY session_start";
    $result = or_query($query, $pars);
    $list = "";
    while ($s = pdo_fetch_assoc($result)) {
        $registration_unixtime = sessions__get_registration_end($s);
        $session_full = sessions__session_full('', $s);
        $now = time();
        if ($registration_unixtime > $now && !$session_full) {
            $list .= session__build_name($s, lang('lang')) . ' ' . laboratories__get_laboratory_name($s['laboratory_id']);
            if (or_setting('include_sign_up_until_in_invitation')) {
                $list .= ', ' . lang('registration_until') . ' ' . ortime__format($registration_unixtime, '', lang('lang'));
            }
            $list .= "\n";
        }
    }
    $lang = $savelang;
    return $list;
}