$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.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.php" . $token_string); } } if ($proceed) { $cancellation_deadline = sessions__get_cancellation_deadline($session); $now = time(); if ($cancellation_deadline < $now) { $continue = false; message(lang('error_enrolment_cancellation_deadline_expired')); redirect("public/participant_show.php" . $token_string); } } if ($proceed) { if (isset($_REQUEST['reallycancel']) && $_REQUEST['reallycancel']) { // if all checks are done, register ... if ($continue) { $done = expregister__cancel($participant, $session); $done = participant__update_last_enrolment_time($participant_id); $done = log__participant("cancel_session_enrolment", $participant['participant_id'], "experiment_id:" . $session['experiment_id'] . "\nsession_id:" . $session_id); message(lang('successfully_canceled_enrolment_xxx') . " " . experiment__get_public_name($session['experiment_id']) . ", " . session__build_name($session) . ". " . lang('this_will_be_confirmed_by_an_email'));
} echo '<strong>' . lang('laboratory') . ':</strong><br>' . $labs[$s['laboratory_id']]['lab_name'] . '<br>' . $labs[$s['laboratory_id']]['lab_address'] . '<br><br>'; if (isset($settings['allow_subject_cancellation']) && $settings['allow_subject_cancellation'] == 'y') { $s['cancellation_deadline'] = sessions__get_cancellation_deadline($s); if ($s['cancellation_deadline'] > time()) { echo '<a href="#can' . $s['session_id'] . '" class="ui-btn ui-icon-delete ui-btn-icon-left">' . lang('cancel_enrolment') . '</a>'; } else { echo ''; } } echo '</div>'; echo $footer; } if (isset($settings['allow_subject_cancellation']) && $settings['allow_subject_cancellation'] == 'y') { foreach ($registered as $s) { $s['cancellation_deadline'] = sessions__get_cancellation_deadline($s); if ($s['cancellation_deadline'] > time()) { echo '<div data-role="page" id="can' . $s['session_id'] . '" data-dialog="true">'; echo '<div data-role="header" data-theme="a"> <h1>' . lang('session_enrolment_cancellation') . '</h1> <a href="#reg' . $s['session_id'] . '" class="ui-btn-left">' . lang('back') . '</a> </div>'; echo '<div data-role="content">'; show_message(); echo '<h3 class="ui-bar ui-bar-a">' . lang('do_you_really_want_to_cancel_session_enrolment') . '</h3>'; echo '<strong>' . lang('experiment') . ':</strong><br>' . $s['experiment_public_name'] . '<br>'; if (or_setting('allow_public_experiment_note') && isset($s['public_experiment_note']) && trim($s['public_experiment_note'])) { echo '<i>' . lang('note') . ': ' . trim($s['public_experiment_note']) . '</i><br>'; } echo '<strong>' . lang('date_and_time') . ':</strong><br>' . $s['session_name'] . '<br>'; if (or_setting('allow_public_session_note') && isset($s['public_session_note']) && trim($s['public_session_note'])) {
function expregister__list_registered_for($participant, $reg_session_id = "") { global $lang, $color, $preloaded_laboratories, $settings, $token_string; $registered = expregister__get_registrations($participant['participant_id']); if (!(is_array($preloaded_laboratories) && count($preloaded_laboratories) > 0)) { $preloaded_laboratories = laboratories__get_laboratories(); } echo '<TABLE width="100%" border=0 cellspacing="0">'; $labs = array(); $shade = true; if (count($registered) > 0) { echo '<TR bgcolor="' . $color['list_shade_subtitle'] . '"> <TD>' . lang('experiment') . '</TD> <TD>' . lang('date_and_time') . '</TD> <TD>' . lang('location') . '</TD>'; if (isset($settings['allow_subject_cancellation']) && $settings['allow_subject_cancellation'] == 'y') { echo '<TD></TD>'; } echo '</TR>'; } else { echo '<TD>' . lang('mobile_no_current_registrations') . '</TD>'; } foreach ($registered as $s) { echo '<TR'; if ($shade) { $shade = false; } else { $shade = true; } if ($s['session_id'] == $reg_session_id) { echo ' bgcolor="' . $color['just_registered_session_background'] . '"'; } elseif ($shade) { echo ' bgcolor="' . $color['list_shade1'] . '"'; } else { echo ' bgcolor="' . $color['list_shade2'] . '"'; } echo '><TD>' . $s['experiment_public_name']; if (or_setting('allow_public_experiment_note') && isset($s['public_experiment_note']) && trim($s['public_experiment_note'])) { echo '<BR><i>' . lang('note') . ': ' . trim($s['public_experiment_note']) . '</i>'; } echo '</TD> <TD>' . $s['session_name']; if (or_setting('allow_public_session_note') && isset($s['public_session_note']) && trim($s['public_session_note'])) { echo '<BR><i>' . lang('note') . ': ' . trim($s['public_session_note']) . '</i>'; } echo '</TD> <TD>'; if (isset($preloaded_laboratories[$s['laboratory_id']])) { echo $preloaded_laboratories[$s['laboratory_id']]['lab_name']; } else { echo lang('unknown_laboratory'); } echo '</TD>'; if (isset($settings['allow_subject_cancellation']) && $settings['allow_subject_cancellation'] == 'y') { $s['cancellation_deadline'] = sessions__get_cancellation_deadline($s); if ($s['cancellation_deadline'] > time()) { echo '<FORM action="participant_show.php"> <TD>'; if ($token_string) { echo '<INPUT type=hidden name="p" value="' . $participant['participant_id_crypt'] . '">'; } echo '<INPUT type=hidden name="s" value="' . $s['session_id'] . '"> <INPUT class="button small" style="font-size: 8pt;" type="submit" name="cancel" value="' . lang('cancel_enrolment') . '"> </td></FORM>'; } else { echo '<TD></TD>'; } } echo '</TR>'; $labs[$s['laboratory_id']] = $s['laboratory_id']; } echo '</TABLE>'; return $labs; }