' . lang('to') . ' ' . ortime__format(ortime__sesstime_to_unixtime($max), 'hide_time');
        }
        echo '	</TD></TR></TABLE>';
        echo '</TD></TR><TR><TD>';
        echo '<table class="or_orr_section_content">';
        $shade = false;
        $num_cols = count($pstatuses);
        foreach ($sessions as $s) {
            if ($shade) {
                $rowspec = ' class="or_orr_list_shade_even"';
                $shade = false;
            } else {
                $rowspec = ' class="or_orr_list_shade_odd"';
                $shade = true;
            }
            $session_time = session__build_name($s);
            $ssicons = array("planned" => "wrench", "live" => "spinner fa-spin fa-fw", "completed" => "thumbs-o-up", "balanced" => "money");
            echo '<tr' . $rowspec . '><td colspan="' . $num_cols . '"><B>' . $session_time;
            echo ', ' . $preloaded_laboratories[$s['laboratory_id']]['lab_name'];
            echo '</B></td>
				<td colspan=3 align="right">' . lang('session_status') . ': <B><span class="session_status_' . $s['session_status'] . '">' . '<i class="fa fa-' . $ssicons[$s['session_status']] . '"></i>&nbsp;' . $lang['session_status_' . $s['session_status']] . '</span></B>
			</td>
        	</tr>';
            echo '	<TR' . $rowspec . '>
				<TD>' . lang('subjects') . '</TD>
				<TD>' . lang('needed_participants_abbr') . ': ' . $s['part_needed'] . '</TD>
				<TD>' . lang('reserve_participants_abbr') . ': ' . $s['part_reserve'] . '</TD>';
            foreach ($pstatuses as $pstatus_id => $pstatus) {
                echo '<TD>';
                if ($pstatus['participated']) {
                    echo '<B>';
Example #2
0
        } else {
            $time_changed = false;
        }
        if (!isset($_REQUEST['addit'])) {
            if ($_REQUEST['registration_end_hours'] != $edit['registration_end_hours'] || $time_changed) {
                $_REQUEST['reg_notice_sent'] = "n";
                message(lang('reg_time_extended_but_notice_sent'));
            }
            if (($_REQUEST['session_reminder_hours'] != $edit['session_reminder_hours'] || $time_changed) && isset($edit['session_reminder_sent']) && $edit['session_reminder_sent'] == "y") {
                message(lang('session_reminder_changed_but_notice_sent'));
            }
        }
        $edit = $_REQUEST;
        $done = orsee_db_save_array($edit, "sessions", $edit['session_id'], "session_id");
        if ($done) {
            log__admin("session_edit", "session:" . session__build_name($edit, $settings['admin_standard_language']) . "\nsession_id:" . $edit['session_id']);
            message(lang('changes_saved'));
            redirect('admin/session_edit.php?session_id=' . $edit['session_id']);
        } else {
            lang('database_error');
            redirect('admin/session_edit.php?session_id=' . $edit['session_id']);
        }
    }
}
if ($proceed) {
    // form
    if (isset($_REQUEST['copy']) && $_REQUEST['copy']) {
        $session_id = "";
    }
    if (!$session_id) {
        $addit = true;
        $csess_id = '';
        foreach ($exp as $sess_id => $sess) {
            $cpaytype_id = '';
            foreach ($sess as $paytype_id => $paytype) {
                foreach ($paytype as $p) {
                    $pid++;
                    if ($cexp_id != $exp_id) {
                        echo '<TR style="background: ' . $color['list_header_background'] . '; color: ' . $color['list_header_textcolor'] . ';">
								<TD colspan=8><B>' . $p['experiment_name'] . '</B></TD>
								</TR>';
                        $cexp_id = $exp_id;
                    }
                    if ($csess_id != $sess_id) {
                        echo '<TR bgcolor="' . $color['list_shade1'] . '">
								<TD>&nbsp;&nbsp;</TD>
								<TD colspan=6>' . session__build_name($p) . '</TD>
								<TD style="background: ' . $color['list_header_background'] . '; color: ' . $color['list_header_textcolor'] . ';">&nbsp;</TD>
								</TR>';
                        $csess_id = $sess_id;
                    }
                    if ($cpaytype_id != $paytype_id) {
                        echo '<TR>
								<TD bgcolor="' . $color['list_shade2'] . '">&nbsp;</TD>
								<TD bgcolor="' . $color['list_shade2'] . '">&nbsp;&nbsp;</TD>
								<TD bgcolor="' . $color['list_shade2'] . '" colspan=4>' . $payment_types[$p['payment_type']] . '</TD>
								<TD bgcolor="' . $color['list_shade1'] . '">&nbsp;</TD>
								<TD style="background: ' . $color['list_header_background'] . '; color: ' . $color['list_header_textcolor'] . ';">&nbsp;</TD>
								</TR>';
                        $cpaytype_id = $paytype_id;
                    }
                    echo '<TR>
        }
        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_mob.php" . $token_string);
            }
        }
        // if all checks are done, cancel ...
        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_id) . ". " . lang('this_will_be_confirmed_by_an_email'));
            redirect("public/participant_show_mob.php" . $token_string);
        }
    }
}
if ($proceed) {
    $labs = laboratories__get_laboratories();
    // load the data
    // invitations
    $invdata = expregister__get_invitations($participant_id);
    $invited = $invdata['invited'];
    $inv_experiments = $invdata['inv_experiments'];
    // registrations
    $registered = expregister__get_registrations($participant_id);
    // history
    $history = expregister__get_history($participant_id);
Example #5
0
 echo '<TABLE width=90% border=0><TR><TD align="left">
             <A HREF="emails_main.php?mode=inbox">' . lang('mailbox_inbox') . '</A> |
             <A HREF="emails_main.php?mode=listmailboxes">' . lang('all_mailboxes') . '</A>';
 if (check_allow('emails_trash_empty')) {
     echo ' | <A HREF="emails_main.php?mode=trash">' . lang('mailbox_trash') . '</A> ';
 }
 echo '</TD></TR>
     <TR><TD align="center">
         <TABLE class="or_page_subtitle" style="width: 100%; background: ' . $color['page_subtitle_background'] . '; color: ' . $color['page_subtitle_textcolor'] . '">
             <TR><TD align="center">';
 if ($mode == 'inbox') {
     echo lang('mailbox_inbox');
 } elseif ($mode == 'experiment') {
     echo lang('experiment') . ': ' . $experiment['experiment_name'];
 } elseif ($mode == 'session') {
     echo lang('session') . ': ' . $experiment['experiment_name'] . ', ' . session__build_name($session);
 } elseif ($mode == 'participant') {
     echo lang('participant') . ': ' . $participant['email'];
 } elseif ($mode == 'mailbox') {
     echo lang('email_mailbox') . ': ' . $mailboxes[$id];
 } elseif ($mode == 'listmailboxes') {
     echo lang('all_mailboxes');
 } elseif ($mode == 'trash') {
     echo lang('mailbox_trash');
     if (check_allow('emails_trash_empty')) {
         echo button_link(thisdoc() . '?mode=trash&empty_trash=true', lang('email_empty_trash'), 'trash') . '<BR>';
     }
 }
 echo '
         </TD></TR></TABLE>
     </TD></TR>
Example #6
0
     </TD>
 </TR>
 <TR>
     <TD>
         ' . lang('experiment') . ':
     </TD>
     <TD>
         ' . experiment__get_public_name($session['experiment_id']) . '
     </TD>
 </TR>
 <TR>
     <TD>
         ' . lang('date_and_time') . ':
     </TD>
     <TD>
         ' . session__build_name($session) . '
     </TD>
 </TR>
 <TR>
     <TD>
         ' . lang('laboratory') . ':
     </TD>
     <TD>
         ' . laboratories__get_laboratory_name($session['laboratory_id']) . '
     </TD>
 </TR>
 <TR>
     <TD colspan=2>&nbsp;</TD>
 </TR>
 <TR>
     <TD align=center colspan=2>
Example #7
0
function email__list_emails($mode = 'inbox', $id = '', $rmode = 'assigned', $url_string = '', $show_refresh = true)
{
    global $color, $lang, $settings;
    if (substr($url_string, 0, 1) == '?') {
        $url_string = substr($url_string, 1);
    }
    $conditions = array();
    $pars = array();
    if ($mode == 'trash') {
        $conditions[] = ' flag_deleted=1 ';
    } else {
        $conditions[] = ' flag_deleted=0 ';
    }
    if ($mode == 'inbox') {
        $conditions[] = ' flag_processed=0 ';
    } elseif ($mode == 'mailbox') {
        $conditions[] = ' mailbox=:mailbox ';
        $pars[':mailbox'] = $id;
    } elseif ($mode == 'experiment') {
        $conditions[] = ' experiment_id=:experiment_id ';
        $pars[':experiment_id'] = $id;
    } elseif ($mode == 'session') {
        $conditions[] = ' session_id=:session_id ';
        $pars[':session_id'] = $id;
    } elseif ($mode == 'participant') {
        $conditions[] = ' participant_id=:participant_id ';
        $pars[':participant_id'] = $id;
    }
    if ($rmode == 'assigned') {
        global $expadmindata;
        $ass_clause = query__get_experimenter_or_clause(array($expadmindata['admin_id']), 'emails', 'assigned_to');
        $conditions[] = $ass_clause['clause'];
        foreach ($ass_clause['pars'] as $k => $v) {
            $pars[$k] = $v;
        }
    } elseif ($rmode == 'experiments') {
        global $expadmindata;
        $likelist = query__make_like_list($expadmindata['admin_id'], 'assigned_to');
        $conditions[] = " experiment_id IN (SELECT experiment_id as id\n                        FROM " . table('experiments') . " WHERE (" . $likelist['par_names'] . ") ) ";
        foreach ($likelist['pars'] as $k => $v) {
            $pars[$k] = $v;
        }
    }
    $query = "SELECT * FROM " . table('emails') . "\n            WHERE " . implode(" AND ", $conditions) . "\n            ORDER BY thread_time DESC, thread_id, if (thread_id=message_id,0,1), timestamp";
    $result = or_query($query, $pars);
    $emails = array();
    $experiment_ids = array();
    $session_ids = array();
    while ($email = pdo_fetch_assoc($result)) {
        $emails[] = $email;
        if ($mode != 'experiment' && $email['experiment_id']) {
            $experiment_ids[] = $email['experiment_id'];
        }
        if ($mode != 'session' && $email['session_id']) {
            $session_ids[] = $email['session_id'];
        }
    }
    $mailboxes = email__load_mailboxes();
    $shade = false;
    $related_experiments = experiment__load_experiments_for_ids($experiment_ids);
    $related_sessions = sessions__load_sessions_for_ids($session_ids);
    echo '<table style="max-width: 90%;">';
    if ($show_refresh) {
        echo '
         <tr><td align="right">
            ' . icon('refresh', thisdoc() . '?' . $url_string, 'fa-2x', 'color: green;', 'refresh list'), '
          </td></tr>';
    }
    echo '    <tr><td>
          <table class="or_listtable"><thead>
          <tr style="background: ' . $color['list_header_background'] . ';  color: ' . $color['list_header_textcolor'] . ';">';
    echo '<td>&nbsp;&nbsp;&nbsp;</td>';
    // is thread head
    echo '<td>' . lang('email_subject') . '</td>';
    // type: incoming, note, reply && subject
    echo '<td>' . lang('email_from') . '</td>';
    // from
    echo '<td>' . lang('date') . '</td>';
    // date
    echo '<td></td>';
    // read // assigned_to_read
    echo '<td></td>';
    // processed - check and background of row
    echo '<td></td>';
    // view email button
    echo '</tr>
            </thead><tbody>';
    $cols = 7;
    $shade = false;
    $style_unprocessed = ' style="font-weight: bold;"';
    foreach ($emails as $email) {
        $second_row = '';
        if ($email['thread_id'] == $email['message_id']) {
            if ($shade) {
                $shade = false;
            } else {
                $shade = true;
            }
            $second_row = "";
            // experiment or mailbox - not if experiment or session or mailbox
            if (!in_array($mode, array('experiment', 'session', 'mailbox'))) {
                if ($email['experiment_id']) {
                    if (isset($related_experiments[$email['experiment_id']])) {
                        $second_row .= $related_experiments[$email['experiment_id']]['experiment_name'];
                    }
                } elseif ($email['mailbox']) {
                    $second_row .= '<b>' . lang('email_mailbox') . ':</b> ' . $mailboxes[$email['mailbox']];
                }
            }
            // session - not if session or mailbox
            if (!in_array($mode, array('session', 'mailbox'))) {
                if ($email['session_id']) {
                    if ($second_row) {
                        $second_row .= ', ';
                    }
                    $second_row .= session__build_name($related_sessions[$email['session_id']]);
                }
            }
            // assigned to
            if ($settings['email_module_allow_assign_emails'] == 'y' && $email['assigned_to']) {
                if ($second_row) {
                    $second_row .= ', ';
                }
                $second_row .= experiment__list_experimenters($email['assigned_to'], false, true);
            }
        }
        echo '<tr';
        if ($shade) {
            echo ' bgcolor="' . $color['list_shade1'] . '"';
        } else {
            echo ' bgcolor="' . $color['list_shade2'] . '"';
        }
        if (!$email['flag_processed'] && $mode != 'inbox') {
            echo $style_unprocessed;
        }
        echo '>';
        // thread head and subject
        if ($email['message_id'] == $email['thread_id']) {
            echo '<TD colspan=2>';
        } else {
            echo '<TD></TD><TD>';
        }
        echo '<A name="' . $email['message_id'] . '"></A>';
        $linktext = '';
        if ($email['message_type'] == 'reply') {
            $linktext .= icon('reply', '', '', ' color: #666666;', 'reply');
        } elseif ($email['message_type'] == 'note') {
            $linktext .= icon('file-text-o', '', '', ' color: #666666;', 'internal note');
        } elseif ($email['message_type'] == 'incoming') {
            $linktext .= icon('envelope-square', '', '', ' color: #666666;', 'incoming');
        }
        $linktext .= '&nbsp;&nbsp;&nbsp;';
        if ($email['message_type'] == 'note') {
            $linktext .= lang('email_internal_note');
        } else {
            $linktext .= $email['subject'];
        }
        echo $linktext;
        if ($email['has_attachments']) {
            echo icon('paperclip');
        }
        echo '</TD>';
        // from
        echo '<td>';
        if ($email['message_type'] == 'reply') {
            echo experiment__list_experimenters($email['admin_id'], false, true) . ' &lt;' . $email['from_address'] . '&gt;';
        } elseif ($email['message_type'] == 'note') {
            echo experiment__list_experimenters($email['admin_id'], false, true);
        } else {
            if ($email['from_name']) {
                echo $email['from_name'] . ' &lt;' . $email['from_address'] . '&gt;';
            } else {
                echo $email['from_address'];
            }
        }
        if ($email['message_type'] == 'incoming' && $email['participant_id']) {
            echo icon('check-circle-o', '', '', ' font-size: 8pt; color: #666666;', 'checked');
        }
        echo '</td>';
        // date
        echo '<td>' . ortime__format($email['timestamp']) . '</td>';
        if ($email['thread_id'] == $email['message_id']) {
            // read // assigned_to_read
            echo '<td align=center valign=middle>';
            echo '<A HREF="' . thisdoc() . '?' . $url_string . '&switch_read=true&message_id=' . urlencode($email['message_id']) . '">';
            if ($email['flag_read']) {
                echo icon('circle-o', '', '', ' color: #666666;');
            } else {
                echo icon('dot-circle-o', '', '', ' color: #008000;');
            }
            echo '</A>';
            if ($settings['email_module_allow_assign_emails'] == 'y' && $email['assigned_to']) {
                echo '<A HREF="' . thisdoc() . '?' . $url_string . '&switch_assigned_to_read=true&message_id=' . urlencode($email['message_id']) . '">';
                if ($email['flag_assigned_to_read']) {
                    echo icon('circle-o', '', '', ' color: #666666;');
                } else {
                    echo icon('dot-circle-o', '', '', ' color: #000080;');
                }
                echo '</A>';
            }
            echo '</td>';
            // processed - check and background of row
            echo '<td>';
            if ($email['flag_processed']) {
                echo icon('check', '', '', ' color: #008000;');
            }
            echo '</td>';
            // view email button
            echo '<td valign="top"';
            if ($second_row) {
                echo ' rowspan="2"';
            }
            echo '>';
            echo javascript__email_popup_button_link($email['message_id']);
            echo '</td>';
        } else {
            echo '<td colspan="3"></td>';
        }
        echo '</tr>';
        if ($second_row) {
            echo '<tr';
            if ($shade) {
                echo ' bgcolor="' . $color['list_shade1'] . '"';
            } else {
                echo ' bgcolor="' . $color['list_shade2'] . '"';
            }
            if (!$email['flag_processed'] && $mode != 'inbox') {
                echo $style_unprocessed;
            }
            echo '>';
            echo '<TD></TD>';
            echo '<TD colspan="' . ($cols - 2) . '">';
            echo '<i>' . $second_row . '</i>';
            echo '</TD>';
            echo '</TR>';
        }
    }
    echo '</tbody></table>
            </td></tr>
            </table>';
}
Example #8
0
        $pars = array(':session_id' => $session_id);
        $query = "DELETE FROM " . table('sessions') . " \n         \t\tWHERE session_id= :session_id";
        $result = or_query($query, $pars);
        message(lang('session_deleted'));
        log__admin("session_delete", "session:" . session__build_name($session, $settings['admin_standard_language']) . "\n,session_id:" . $session_id);
        redirect('admin/experiment_show.php?experiment_id=' . $session['experiment_id']);
    }
}
if ($proceed) {
    // form
    echo '	<CENTER>
		<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'] . '">
									' . lang('delete_session') . ' ' . session__build_name($session) . '
								</TD>
				</TR></TABLE>
			</TD></TR>
			<TR>
				<TD colspan=2>
					' . lang('really_delete_session') . '
					<BR><BR>';
    dump_array($session);
    echo '
				</TD>
			</TR>
			<TR>
				<TD align=left>
					' . button_link('session_delete.php?session_id=' . $session_id . '&reallydelete=true', lang('yes_delete'), 'check-square biconred') . '
				</TD>
        $participants = array();
        foreach ($thislist_sessions as $sid => $s) {
            foreach ($temp_participants as $p) {
                if ($p['session_id'] == $sid) {
                    $participants[] = $p;
                }
            }
        }
    }
    unset($temp_participants);
    echo '<center>';
    echo '<TABLE class="or_page_subtitle" style="background: ' . $color['page_subtitle_background'] . '; color: ' . $color['page_subtitle_textcolor'] . '; width: 95%">
			<TR><TD align="center">
			' . $experiment['experiment_name'];
    if ($session_id) {
        echo ', ' . lang('session') . ' ' . session__build_name($session);
    }
    echo ', ' . $title . '		
			</TD>';
    echo '</TR></TABLE>';
    if ($display != 'enrol') {
        echo '<P align=right><A class="small" HREF="experiment_participants_show_pdf.php' . $thiscgis . '" target="_blank">' . lang('print_version') . '</A></P>';
    }
    // show query
    //echo '	<P class="small">Query: '.$query.'</P>';
    // form
    echo '
		<FORM name="part_list" method=post action="' . thisdoc() . '">
	
		<BR>
		<table class="or_listtable" style="width: 95%"><thead>
Example #10
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));
    }
}
Example #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;
}
Example #12
0
function expregister__get_history($participant_id)
{
    $pars = array(':participant_id' => $participant_id);
    $query = "SELECT * FROM " . table('experiments') . ", \n\t\t" . table('sessions') . ", " . table('participate_at') . "\n    \tWHERE " . table('experiments') . ".experiment_id=" . table('sessions') . ".experiment_id\n\t    AND " . table('experiments') . ".experiment_id=" . table('participate_at') . ".experiment_id\n    \tAND " . table('participate_at') . ".participant_id = :participant_id \n    \tAND " . table('sessions') . ".session_id = " . table('participate_at') . ".session_id\n    \tAND " . table('participate_at') . ".session_id!=0\n\t\tAND " . table('experiments') . ".experiment_type='laboratory' \n    \tORDER BY session_start DESC";
    $result = or_query($query, $pars);
    $history = array();
    while ($varray = pdo_fetch_assoc($result)) {
        $varray['session_unixtime'] = ortime__sesstime_to_unixtime($varray['session_start']);
        $now = time();
        if ($now >= $varray['session_unixtime']) {
            $varray['session_name'] = session__build_name($varray);
            $history[] = $varray;
        }
    }
    return $history;
}
Example #13
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;
}
Example #14
0
                 if ($line['session_id'] > 0) {
                     $osession = orsee_db_load_array("sessions", $line['session_id'], "session_id");
                     message(lang('participant_already_enroled_for_experiment') . ' <A HREF="experiment_participants_show.php?experiment_id=' . $osession['experiment_id'] . '&session_id=' . $osession['session_id'] . '">' . session__build_name($osession) . '</A>.');
                 } else {
                     $pars = array(':participant_id' => $participant['participant_id'], ':session_id' => $session['session_id'], ':experiment_id' => $session['experiment_id']);
                     $query = "UPDATE " . table('participate_at') . " \n\t\t\t\t\t\t\t\t\tSET session_id= :session_id, \n\t\t\t\t\t\t\t\t\tpstatus_id=0 \n\t\t\t\t\t\t\t\t\tWHERE participant_id= :participant_id \n\t\t\t\t\t\t\t\t\tAND experiment_id= :experiment_id";
                     $done2 = or_query($query, $pars);
                 }
             } else {
                 $pars = array(':participant_id' => $participant['participant_id'], ':session_id' => $session['session_id'], ':experiment_id' => $session['experiment_id']);
                 $query = "INSERT into " . table('participate_at') . " \n    \t           \t\t\t\tSET participant_id= :participant_id,\n        \t           \t\t\tsession_id= :session_id, \n            \t       \t\t\texperiment_id= :experiment_id,\n                \t   \t\t\tpstatus_id=0";
                 $done2 = or_query($query, $pars);
             }
             if (isset($done2) && $done2) {
                 message(lang('registered_participant_for') . ' 
 	                	<A HREF="experiment_participants_show.php?experiment_id=' . $session['experiment_id'] . '&session_id=' . $session['session_id'] . '">' . session__build_name($session) . '</A>.');
             }
         } else {
             message(lang('no_session_selected'), 'message_error');
         }
     }
     if ($done) {
         if (isset($_REQUEST['participant_id']) && $_REQUEST['participant_id']) {
             log__admin("participant_edit", "participant_id:" . $participant['participant_id']);
         } else {
             log__admin("participant_create", "participant_id:" . $participant['participant_id']);
         }
         $form = false;
         $addition = "";
         if ($hide_header) {
             $addition .= "&hide_header=true";
Example #15
0
function session__check_lab_time_clash($entry)
{
    global $lang;
    if (isset($entry['session_start'])) {
        $notice = lang('overlapping_sessions');
        $this_start_time = $entry['session_start'];
        $this_end_time = ortime__add_hourmin_to_sesstime($this_start_time, $entry['session_duration_hour'], $entry['session_duration_minute']);
    } else {
        $notice = lang('overlapping_lab_reservation');
        $this_start_time = $entry['event_start'];
        $this_end_time = $entry['event_stop'];
    }
    if (!isset($entry['event_id'])) {
        $entry['event_id'] = '';
    }
    if (!isset($entry['session_id'])) {
        $entry['session_id'] = '';
    }
    $pars = array(':this_end_time' => $this_end_time, ':this_start_time' => $this_start_time, ':session_id' => $entry['session_id'], ':laboratory_id' => $entry['laboratory_id']);
    $query = "SELECT session_start,\n    \t\tdate_format(date_add(session_start*100, \n    \t\tINTERVAL concat(session_duration_hour,':',session_duration_minute) HOUR_MINUTE),'%Y%m%d%H%i') \n    \t\tas session_stop,\n\t\t\t " . table('experiments') . ".*, " . table('sessions') . ".*\n    \t\tFROM " . table('experiments') . ", " . table('sessions') . "\n            WHERE " . table('experiments') . ".experiment_id=" . table('sessions') . ".experiment_id\n            AND " . table('experiments') . ".experiment_type!='internet'\n            AND session_id!=:session_id\n            AND laboratory_id=:laboratory_id \n\t\t\tHAVING NOT (session_start >= :this_end_time OR session_stop <= :this_start_time)\n\t\t\tORDER BY session_start";
    $result = or_query($query, $pars);
    while ($osession = pdo_fetch_assoc($result)) {
        message('<UL><LI>' . $notice . ': <A HREF="session_edit.php?session_id=' . $osession['session_id'] . '">' . $osession['experiment_name'] . ' - ' . session__build_name($osession) . '</A></UL>');
    }
    $pars = array(':this_end_time' => $this_end_time, ':this_start_time' => $this_start_time, ':event_id' => $entry['event_id'], ':laboratory_id' => $entry['laboratory_id']);
    $query = "SELECT event_start, event_stop,\n           " . table('events') . ".*\n\t\t\tFROM " . table('events') . " \n\t\t\tWHERE laboratory_id=:laboratory_id \n\t\t\tAND event_id!=:event_id \n\t\t\tAND NOT (event_start >= :this_end_time OR event_stop <= :this_start_time)\n\t\t\tORDER BY event_start";
    $result = or_query($query);
    while ($osession = pdo_fetch_assoc($result)) {
        $ostart_string = ortime__format(ortime__sesstime_to_unixtime($osession['event_start']));
        $ostop_string = ortime__format(ortime__sesstime_to_unixtime($osession['event_stop']));
        message('<UL><LI>' . $notice . ': <A HREF="events_edit.php?event_id=' . $osession['event_id'] . '">' . $ostart_string . ' - ' . $ostop_string . '</A></UL>');
    }
}
Example #16
0
function cron__check_for_noshow_warnings()
{
    global $settings;
    $now = time();
    $query = "SELECT " . table('sessions') . ".*, " . table('experiments') . ".* \n\t\t\tFROM " . table('sessions') . ", " . table('experiments') . "\n\t\t\tWHERE " . table('sessions') . ".experiment_id = " . table('experiments') . ".experiment_id\n\t\t\tAND (session_status='completed' OR session_status='balanced') \n\t\t\tAND noshow_warning_sent = 'n' \n\t\t\tORDER BY session_start";
    $result = or_query($query);
    $mess = "";
    while ($line = pdo_fetch_assoc($result)) {
        $mess .= "found session " . session__build_name($line, $settings['admin_standard_language']) . "\n";
        if ($settings['send_noshow_warnings'] == 'y') {
            $number = experimentmail__send_noshow_warnings_to_queue($line);
            $mess .= "sent " . $number . " noshow warnings\n";
        }
        $done2 = experimentmail__set_noshow_warnings_checked($line['session_id']);
    }
    return $mess;
}
Example #17
0
    if ($reallysend) {
        // send it out to mail queue
        $number = experimentmail__send_session_reminders_to_queue($session);
        message($number . ' ' . lang('xxx_session_reminder_emails_sent_out'));
        log__admin("session_send_reminder", "session:" . session__build_name($session, $settings['admin_standard_language']) . "\nsession_id:" . $session_id);
        redirect('admin/experiment_participants_show.php?experiment_id=' . $session['experiment_id'] . '&session_id=' . $session_id);
    }
}
if ($proceed) {
    // form
    echo '  <CENTER>
        <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'] . '">
                                    ' . lang('session_reminder_send') . ' ' . session__build_name($session) . '
                                </TD>
                </TR></TABLE>
            </TD></TR>
            <TR>
                <TD colspan=2>
                    ' . lang('really_send_session_reminder_now') . '
                </TD>
            </TR>
            <TR>
                <TD align=left>
                    ' . button_link('session_send_reminder.php?session_id=' . $session_id . '&reallysend=true', lang('yes'), 'check-square bicongreen') . '
                </TD>
                <TD align=right>
                    ' . button_link('session_send_reminder.php?session_id=' . $session_id . '&betternot=true', lang('no_sorry'), 'undo biconred') . '
                </TD>