<TR>
						<TD>' . lang('id') . ':</TD><TD>' . $experiment['experiment_id'] . '</TD>
						<TD>' . lang('type') . ':</TD>';
    if (!isset($exptypes[$experiment['experiment_ext_type']]['exptype_name'])) {
        $exptypes[$experiment['experiment_ext_type']]['exptype_name'] = 'type undefined';
    }
    echo '<TD>' . $lang[$experiment['experiment_type']] . ' (' . $exptypes[$experiment['experiment_ext_type']]['exptype_name'] . ')</TD>
					</TR>
					<TR>
						<TD>' . lang('name') . ':</TD><TD>' . $experiment['experiment_name'] . '</TD>
						<TD>' . lang('public_name') . ':</TD><TD>' . $experiment['experiment_public_name'] . '</TD>
					</TR>';
    echo '			<TR>
						<TD>' . lang('class') . ':</TD>
						<TD>' . experiment__experiment_class_field_to_list($experiment['experiment_class']) . '</TD>
						<TD>' . lang('experimenter') . ':</TD><TD>' . experiment__list_experimenters($experiment['experimenter'], true, true) . '</TD>
					</TR>';
    // CONDITIONAL EXPERIMENT FIELDS
    $conditional_fields = array();
    if ($experiment['experiment_description']) {
        $conditional_fields[] = '<TD>' . lang('internal_description') . ':</TD><TD>' . $experiment['experiment_description'] . '</TD>';
    }
    if ($experiment['public_experiment_note']) {
        $conditional_fields[] = '<TD>' . lang('public_experiment_note') . ':</TD><TD>' . $experiment['public_experiment_note'] . '</TD>';
    }
    if ($settings['enable_editing_of_experiment_sender_email'] == 'y') {
        $conditional_fields[] = '<TD>' . lang('email_sender_address') . ':</TD><TD>' . $experiment['sender_mail'] . '</TD>';
    }
    $i = 0;
    foreach ($conditional_fields as $condfield) {
        if ($i / 2 == round($i / 2)) {
예제 #2
0
 $shade = false;
 while ($line = pdo_fetch_assoc($result)) {
     echo '  <tr class="small"';
     if ($shade) {
         echo ' bgcolor="' . $color['list_shade1'] . '"';
     } else {
         echo ' bgcolor="' . $color['list_shade2'] . '"';
     }
     if (!$line['enabled']) {
         echo ' style="font-style: italic;"';
     }
     echo '>
             <TD>' . $line['budget_id'] . '</TD>
             <TD>' . ($line['enabled'] ? lang('y') : lang('n')) . '</TD>
             <td>' . $line['budget_name'] . '</td>
             <td>' . experiment__list_experimenters($line['experimenter'], false, true) . '</td>
             <td>' . $line['budget_limit'] . '</td>';
     if (check_allow('payments_budget_edit')) {
         echo '<td valign=top>';
         echo '<A HREF="payments_budget_edit.php?budget_id=' . $line['budget_id'] . '">' . lang('edit') . '</A>';
         echo '</td>';
     }
     echo '</tr>';
     if ($shade) {
         $shade = false;
     } else {
         $shade = true;
     }
 }
 echo '</tbody></table>';
 echo '<BR><BR>
예제 #3
0
파일: email.php 프로젝트: bgreiner/orsee
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>';
}
예제 #4
0
 echo 'PRODID:-//hacksw/handcal//NONSGML v1.0//EN' . "\r\n";
 echo 'CALSCALE:GREGORIAN' . "\r\n";
 echo 'BEGIN:VTIMEZONE' . "\r\n";
 echo 'TZID:UTC' . "\r\n";
 echo 'BEGIN:STANDARD' . "\r\n";
 echo 'DTSTART:19700101T000000' . "\r\n";
 echo 'RDATE:19700101T000000' . "\r\n";
 echo 'TZOFFSETFROM:-0000' . "\r\n";
 echo 'TZOFFSETTO:-0000' . "\r\n";
 echo 'TZNAME:UTC' . "\r\n";
 echo 'END:STANDARD' . "\r\n";
 echo 'END:VTIMEZONE' . "\r\n";
 foreach ($results as $day) {
     foreach ($day as $item) {
         $description = '';
         $description .= experiment__list_experimenters($item['experimenters'], false, true) . '\\n';
         if ($item['type'] == "location_reserved") {
             if (check_allow('events_edit')) {
                 $item['title_link'] = $item['edit_link'];
             }
         } elseif ($item['type'] == "experiment_session") {
             $description .= $item['participants_registered'] . " (" . $item['participants_needed'] . "," . $item['participants_reserve'] . ")" . '\\n';
             //  if(check_allow('session_edit'))
             //      $description.=lang('participants').': '.$item['edit_link'].'\n';
             //  if(check_allow('experiment_show_participants'))
             //      $description.=lang('participants').': '.$item['participants_link'].'\n';
         }
         $description = trim($description);
         echo 'BEGIN:VEVENT' . "\r\n";
         echo 'DTEND:' . calendar__unixtime_to_ical_date($item['end_time']) . "\r\n";
         echo 'UID:' . calendar__escapestring($item['uid']) . "\r\n";
예제 #5
0
function pdfoutput__make_pdf_calendar($displayfrom = 0, $wholeyear = false, $admin = false, $forward = 0, $file = false)
{
    global $settings, $lang;
    if ($displayfrom == 0) {
        $displayfrom = time();
    }
    // prepare pdf
    include_once '../tagsets/class.ezpdf.php';
    $pdf = new Cezpdf('a4');
    $pdf->selectFont('../tagsets/fonts/Times-Roman.afm');
    $fontsize = $settings['calendar_pdf_table_fontsize'] ? $settings['calendar_pdf_table_fontsize'] : 8;
    $titlefontsize = $settings['calendar_pdf_title_fontsize'] ? $settings['calendar_pdf_title_fontsize'] : 12;
    //start building calendar
    $displayfrom_lower = $displayfrom;
    $displayfrom_upper = date__skip_months($forward, $displayfrom_lower);
    if ($wholeyear) {
        $displayfrom_upper = mktime(0, 0, 0, 1, 1, date('Y', $displayfrom) + 1);
    }
    $results = calendar__get_events($admin, $displayfrom_lower, $displayfrom_upper, false, true);
    $month_names = explode(",", $lang['month_names']);
    //loop through each month
    for ($itime = $displayfrom_lower; $itime <= $displayfrom_upper; $itime = date__skip_months(1, $itime)) {
        $year = date("Y", $itime);
        $month = date("m", $itime);
        $weeks = days_in_month($month, $year);
        $table_title = $month_names[$month - 1] . ' ' . $year;
        $table_headings = array();
        $calendar__weekdays = explode(",", $lang['format_datetime_weekday_abbr']);
        for ($i3 = 1; $i3 <= 7; ++$i3) {
            if (!isset($lang['format_datetime_firstdayofweek_0:Su_1:Mo']) || !$lang['format_datetime_firstdayofweek_0:Su_1:Mo']) {
                $wdindex = $i3 - 2;
                if ($wdindex < 0) {
                    $wdindex = 6;
                }
            } else {
                $wdindex = $i3 - 1;
            }
            $table_headings[$i3] = $calendar__weekdays[$wdindex];
        }
        $table_data = array();
        for ($i2 = 1; $i2 <= count($weeks); ++$i2) {
            $las1 = array();
            $las2 = array();
            for ($i3 = 1; $i3 <= 7; ++$i3) {
                if (!isset($weeks[$i2][$i3])) {
                    $las1[$i3] = "";
                    $las2[$i3] = "";
                } else {
                    $las1[$i3] = $weeks[$i2][$i3];
                    $las2[$i3] = "";
                    //the date is the key of the $results array for easy searching
                    $today = $year * 10000 + $month * 100 + $weeks[$i2][$i3];
                    if (isset($results[$today])) {
                        foreach ($results[$today] as $item) {
                            $las2[$i3] .= $item['display_time'];
                            $las2[$i3] .= "\n" . "<i>" . $item['location'] . "</i>\n";
                            if ($admin || $settings['public_calendar_hide_exp_name'] != 'y') {
                                $las2[$i3] .= '<b>' . $item['title'] . '</b>';
                            } else {
                                $las2[$i3] .= '<b>' . $lang['calendar_experiment_session'] . '</b>';
                            }
                            $las2[$i3] .= "\n";
                            if ($admin) {
                                $las2[$i3] .= experiment__list_experimenters($item['experimenters'], false, true) . "\n";
                            }
                            if ($item['type'] == "experiment_session") {
                                if ($admin) {
                                    $las2[$i3] .= $item['participants_registered'] . " (" . $item['participants_needed'] . "," . $item['participants_reserve'] . ")";
                                } else {
                                    $las2[$i3] .= $statusdata[$item['status']]['message'];
                                }
                            }
                            $las2[$i3] .= "\n\n";
                        }
                    }
                }
            }
            $table_data[] = $las1;
            $table_data[] = $las2;
        }
        $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, 1), 'fontSize' => $fontsize, 'titleFontSize' => $titlefontsize, 'rowGap' => 1, 'colGap' => 3, 'innerLineThickness' => 0.5, 'outerLineThickness' => 1, 'maxWidth' => 500, 'width' => 500, 'protectRows' => 2));
        $pdf->ezSetDy(-20);
    }
    if ($file) {
        $pdffilecode = $pdf->output();
        return $pdffilecode;
        //$fname ="/apache/orsee/admin/pdfdir/test.pdf";
        //$fp = fopen($fname,'w');
        //fwrite($fp,$pdffilecode);
        //fclose($fp);
        //echo '<A HREF="pdfdir/test.pdf" target="_blank">pdf file</A><BR><BR>';
        //$pdfcode = str_replace("\n","\n<br>",htmlspecialchars($pdfcode));
        //echo trim($pdfcode);
    } else {
        $pdf->ezStream(array('Content-Disposition' => 'calendar.pdf', 'Accept-Ranges' => 0, 'compress' => 1));
    }
}
예제 #6
0
파일: calendar.php 프로젝트: danorama/orsee
function calendar__display_calendar($admin = false)
{
    global $lang, $color, $settings;
    $displayfrom = time();
    if (isset($_REQUEST['displayfrom'])) {
        $displayfrom = $_REQUEST['displayfrom'];
    }
    $wholeyear = false;
    if (isset($_REQUEST['wholeyear']) && $admin) {
        $wholeyear = true;
    }
    //$monthsum format: years x 12 + months
    $calendar_month_font = "white";
    if (isset($color['calendar_month_font'])) {
        $calendar_month_font = $color['calendar_month_font'];
    }
    $calendar_day_background = "white";
    if (isset($color['calendar_day_background'])) {
        $calendar_day_background = $color['calendar_day_background'];
    }
    $calendar_month_background = "black";
    if (isset($color['calendar_month_background'])) {
        $calendar_month_background = $color['calendar_month_background'];
    }
    echo '
    <style>
        #calendarContainer {
            width: 90%;
            margin-left: auto;
            margin-right: auto;
        }
        .calendarTable {
            border: 0px;
            border-collapse: separate;
        }

        /* head of calendar */
        .calendarTable thead  {
            background: ' . $calendar_month_background . ';
            color: ' . $calendar_month_font . ';
        }
        .calendarTable>thead>tr>th {
            border: 0;
            border-bottom: 3px solid #E2E2E2;
            height: 20px;
            text-align: right;
            font-weight: 600;
            padding: 0px 10px 0px 0px;
        }
        .calendarTable>thead>tr>th.monthTag{
            font-size: 13pt;
            height: 30px;
        }
        /* round corners */
        .calendarTable>thead>tr:first-child>th:only-child {
            -moz-border-radius: 10px 10px 0px 0px;
            -webkit-border-radius: 10px 10px 0px 0px;
            border-radius: 10px 10px 0px 0px;
        }

        /* calendar rows and cells*/
        .calendarTable>tbody>tr {
        }
        .calendarTable>tbody>tr>td {
            border: 1px solid #C5C5C5;
            padding: 0;
            margin: 0;
            height: 100px;
            min-width: 3%;
            width: 3%;
            max-width: 30%;
            text-align: left;
            vertical-align: top;
        }
        .calendarTable>tbody>tr .calendarCellRealDate{
            border: 2px solid #C5C5C5;
        }
        .calendarTable>tbody>tr>td .calendarCellHead {
            padding: 0;
            padding-left: 3px;
            padding-right: 10px;
            margin: 0;
            background: ' . $calendar_day_background . ';
            text-align: right;
            height: 17px;
            font-weight: bold;
        }
        .calendarTable>tbody>tr>td .calendarCellContent {
            padding: 0;
            padding-top: 3px;
            padding-bottom: 3px;
            padding-left: 6px;
            padding-right: 15px;
            position: relative;
            margin-left: 5px;
            margin-right: 5px;
            margin-top: 3px;
            margin-bottom: 3px;
            -moz-border-radius: 5px 20px 5px 5px;
            -webkit-border-radius: 5px 20px 5px 5px;
            border-radius: 5px 20px 5px 5px;
        }
        .calendarTable>tbody>tr>td .calendarCellContent .calendarCellContentTitle {
            display: block;
        }
        .calendarTable>tbody>tr>td .calendarCellContent span {
            display: block;
        }

        /* round corners */
        .calendarTable>tbody>tr:last-child>td:first-child {
            -moz-border-radius: 0px 0px 0px 10px;
            -webkit-border-radius: 0px 0px 0px 10px;
            border-radius: 0px 0px 0px 10px;
        }

        .calendarTable>tbody>tr:last-child>td:last-child {
             -moz-border-radius: 0px 0px 10px 0px;
             -webkit-border-radius: 0px 0px 10px 0px;
             border-radius: 0px 0px 10px 0px;
        }

        /* highlight today cell */
        .calendarTable>tbody>tr>td.today {
            border: 2px solid #F00;
        }

    </style>
    ';
    $statusdata = array("not_enough_participants" => array("color" => $admin ? $color['session_not_enough_participants'] : $color['session_public_free_places'], "message" => $admin ? $lang["not_enough_participants"] : lang('free_places')), "not_enough_reserve" => array("color" => $admin ? $color['session_not_enough_reserve'] : $color['session_public_free_places'], "message" => $admin ? $lang["not_enough_reserve"] : lang('free_places')), "complete" => array("color" => $admin ? $color['session_complete'] : $color['session_public_complete'], "message" => $lang["complete"]));
    echo '<div id="calendarContainer">';
    //start building calendar
    $displayfrom_lower = $displayfrom;
    $displayfrom_upper = date__skip_months(1, $displayfrom_lower);
    if ($wholeyear && $admin) {
        $displayfrom_upper = mktime(0, 0, 0, 1, 1, date('Y', $displayfrom) + 1);
    }
    $results = calendar__get_events($admin, $displayfrom_lower, $displayfrom_upper, false, true);
    $buttons1 = "";
    $buttons2 = "";
    if ($admin) {
        $buttons1 .= "<TABLE border=0 width=100%>";
        $buttons1 .= '<TR>';
        if ($wholeyear) {
            $buttons1 .= '<TD align="left">' . button_link("?", lang('current_month'), '', 'font-size: 8pt;') . '</TD>';
        } else {
            $buttons1 .= '<TD align="left">' . button_link("?wholeyear=true&displayfrom=" . mktime(0, 0, 0, 1, 1, date('Y', $displayfrom)), lang('whole_year'), '', 'font-size: 8pt;') . '</TD>';
        }
        $buttons1 .= '<TD align="center">' . button_link('events_edit.php', lang('create_event'), 'plus-circle') . '<BR>
                <FONT class="small">' . lang('for_session_time_reservation_please_use_experiments') . '</FONT></TD>';
        $buttons1 .= '<TD align="right">' . button_link('calendar_main_print_pdf.php?displayfrom=' . $displayfrom . '&wholeyear=' . $wholeyear, lang('print_version'), 'print', 'font-size: 8pt;', 'target="_blank"') . '</TD>';
        $buttons1 .= '</TR></TABLE>';
    }
    $buttons2 .= '<TABLE width="100%"><TR><TD colspan=3 align="left">';
    $buttons2 .= button_link("?displayfrom=" . date__skip_months(-1, $displayfrom), strtoupper(lang('previous')), 'caret-square-o-up', 'font-size: 8pt;');
    $buttons2 .= '</TD><TD colspan=4 align="right">';
    $buttons2 .= button_link("?displayfrom=" . date__skip_months(1, $displayfrom), strtoupper(lang('next')), 'caret-square-o-down', 'font-size: 8pt;');
    $buttons2 .= '</TD></TR></TABLE><BR>';
    echo $buttons1;
    echo $buttons2;
    $month_names = explode(",", $lang['month_names']);
    //loop through each month
    for ($itime = $displayfrom_lower; $itime <= $displayfrom_upper; $itime = date__skip_months(1, $itime)) {
        $year = date("Y", $itime);
        $month = date("m", $itime);
        $weeks = days_in_month($month, $year);
        echo '<TABLE class="calendarTable" WIDTH="100%">';
        echo '<thead><tr>';
        echo '<th colspan="7" class="monthTag"><center>' . $month_names[$month - 1] . ' ' . $year . '</center></td></tr><tr>';
        $calendar__weekdays = explode(",", $lang['format_datetime_weekday_abbr']);
        for ($i3 = 1; $i3 <= 7; ++$i3) {
            if (!isset($lang['format_datetime_firstdayofweek_0:Su_1:Mo']) || !$lang['format_datetime_firstdayofweek_0:Su_1:Mo']) {
                $wdindex = $i3 - 1;
            } else {
                $wdindex = $i3;
                if ($wdindex == 7) {
                    $wdindex = 0;
                }
            }
            echo '<th>' . $calendar__weekdays[$wdindex] . '</th>';
        }
        echo '</tr></thead>';
        echo '<tbody>';
        for ($i2 = 1; $i2 <= count($weeks); ++$i2) {
            echo '<tr>';
            for ($i3 = 1; $i3 <= 7; ++$i3) {
                if (isset($weeks[$i2][$i3])) {
                    //the date is the key of the $results array for easy searching
                    $today = $year * 10000 + $month * 100 + $weeks[$i2][$i3];
                    $realtoday = date("Y") * 10000 + date("m") * 100 + date("d");
                    echo '<td class="calendarCellRealDate';
                    if ($today == $realtoday) {
                        echo ' today';
                    }
                    echo '">';
                    echo '<div class="calendarCellHead">';
                    echo $weeks[$i2][$i3];
                    echo '</div>';
                    if (isset($results[$today])) {
                        foreach ($results[$today] as $item) {
                            $title = $item['title'];
                            if (isset($item['title_link'])) {
                                $title = '<a href="' . $item['title_link'] . '">' . $title . '</a>';
                            }
                            echo '<div style="background: ' . $item['color'] . ';" class="calendarCellContent">';
                            echo '<span style="font-weight: bold;">';
                            echo $item['display_time'];
                            echo '</span>';
                            echo '<span style="font-size: 11;">';
                            echo $item['location'];
                            echo '</span>';
                            if ($admin || $settings['public_calendar_hide_exp_name'] != 'y') {
                                echo '<div class="calendarCellContentTitle">' . $title . '</div>';
                            } else {
                                echo '<div class="calendarCellContentTitle">' . lang('calendar_experiment_session') . '</div>';
                            }
                            if ($admin) {
                                echo '<span style="font-size: 11;">';
                                echo experiment__list_experimenters($item['experimenters'], true, true);
                                echo '</span>';
                            }
                            if ($item['type'] == "location_reserved") {
                                echo '<span>';
                                if (check_allow('events_edit')) {
                                    echo '<a style="font-size: 11;" href="' . $item['edit_link'] . '">[' . lang('edit') . ']</a>';
                                }
                                echo '</span>';
                            } elseif ($item['type'] == "experiment_session") {
                                echo '<span style="color: ' . $statusdata[$item['status']]['color'] . ';">';
                                if ($admin) {
                                    echo " " . $item['participants_registered'] . " (" . $item['participants_needed'] . "," . $item['participants_reserve'] . ")";
                                } else {
                                    echo $statusdata[$item['status']]['message'];
                                }
                                echo '</span>';
                                if ($admin && check_allow('experiment_show_participants')) {
                                    echo '<span>';
                                    echo '<a style="font-size: 11;" href="' . $item['participants_link'] . '">[' . lang('participants') . ']</a>';
                                    echo '</span>';
                                }
                            }
                            echo '</div>';
                        }
                    }
                } else {
                    echo '<td>&nbsp;';
                }
                echo '</td>';
            }
            echo '</tr>';
        }
        echo '</tbody></TABLE><br /><br /><br />';
    }
    echo $buttons2;
    //echo $buttons1;
    echo '</div>';
}
예제 #7
0
function downloads__list_experiments($showsize = false, $showtype = false, $showdate = false)
{
    global $lang, $color, $expadmindata;
    $out = '';
    $continue = true;
    if (check_allow('file_view_experiment_all')) {
        $experimenter_clause = '';
        $pars = array();
    } elseif (check_allow('file_view_experiment_my')) {
        $experimenter_clause = " AND " . table('experiments') . ".experimenter LIKE :experimenter ";
        $pars = array(':experimenter' => '%|' . $expadmindata['admin_id'] . '|%');
    } else {
        $continue = false;
    }
    if ($continue) {
        $query = "SELECT " . table('experiments') . ".*,\n                (SELECT min(session_start) from or_sessions as s1 WHERE s1.experiment_id=" . table('experiments') . ".experiment_id) as first_session_date,\n                (SELECT max(session_start) from or_sessions as s2 WHERE s2.experiment_id=" . table('experiments') . ".experiment_id) as last_session_date\n                FROM " . table('experiments') . "\n                WHERE " . table('experiments') . ".experiment_id IN\n                (SELECT DISTINCT experiment_id FROM " . table('uploads') . ")\n                " . $experimenter_clause . "\n                ORDER BY last_session_date DESC";
        $result = or_query($query, $pars);
        $experiments = array();
        while ($line = pdo_fetch_assoc($result)) {
            $experiments[] = $line;
        }
        if (count($experiments) > 0) {
            $out .= '<TABLE width=100% border=0>';
            $shade = true;
            foreach ($experiments as $exp) {
                if ($shade) {
                    $bgcolor = ' bgcolor="' . $color['list_shade1'] . '"';
                    $shade = false;
                } else {
                    $bgcolor = ' bgcolor="' . $color['list_shade2'] . '"';
                    $shade = true;
                }
                $out .= '<TR' . $bgcolor . '><TD>';
                $out .= $exp['experiment_name'] . '</TD><TD>(';
                $out .= lang('from') . ' ';
                if ($exp['first_session_date'] == 0) {
                    $out .= '???';
                } else {
                    $out .= ortime__format(ortime__sesstime_to_unixtime($exp['first_session_date']), 'hide_time:true');
                }
                $out .= ' ' . lang('to') . ' ';
                if ($exp['last_session_date'] == 0) {
                    $out .= '???';
                } else {
                    $out .= ortime__format(ortime__sesstime_to_unixtime($exp['last_session_date']), 'hide_time:true');
                }
                $out .= ')</TD><TD>';
                $out .= experiment__list_experimenters($exp['experimenter'], true, true);
                $out .= '</TD><TD><A HREF="download_main.php?experiment_id=' . $exp['experiment_id'] . '">' . lang('show_files') . '</A>';
                $out .= '</TD></TR>';
            }
            $out .= '</TABLE>';
        }
    }
    return $out;
}
예제 #8
0
function query__get_pseudo_query_array($posted_array)
{
    global $lang;
    $formfields = participantform__load();
    $pseudo_query_array = array();
    $clevel = 1;
    foreach ($posted_array as $num => $entry) {
        $temp_keys = array_keys($entry);
        $module_string = $temp_keys[0];
        $module_string_array = explode("_", $module_string);
        $module = $module_string_array[0];
        $type = $module_string_array[1];
        if ($module == 'pform') {
            unset($module_string_array[0]);
            unset($module_string_array[1]);
            $pform_formfield = implode("_", $module_string_array);
        } else {
            $pform_formfield = "";
        }
        $params = $entry[$module_string];
        $level = $clevel;
        $op_text = "";
        $text = '';
        $add = true;
        if (isset($params['logical_op']) && $params['logical_op']) {
            $op_text = lang($params['logical_op']);
        }
        switch ($module) {
            case "bracket":
                if ($type == 'open') {
                    $level = $clevel;
                    $clevel++;
                    $text = '(';
                } else {
                    $clevel--;
                    $level = $clevel;
                    $text = ')';
                }
                break;
            case "experimentclasses":
                $text = query__pseudo_query_not_without($params);
                $text .= ' ' . lang('participants_participated_expclass');
                $text .= ': ' . experiment__experiment_class_field_to_list($params['ms_classes']);
                break;
            case "experimenters":
                $text = query__pseudo_query_not_without($params);
                $text .= ' ' . lang('participants_participated_experimenters');
                $text .= ': ' . experiment__list_experimenters($params['ms_experimenters'], false, true);
                break;
            case "experimentsassigned":
                $text = query__pseudo_query_not_without($params);
                $text .= ' ' . lang('participants_were_assigned_to');
                $text .= ': ' . experiment__exp_id_list_to_exp_names($params['ms_experiments']);
                break;
            case "experimentsparticipated":
                $text = query__pseudo_query_not_without($params);
                $text .= ' ' . lang('participants_have_participated_on');
                $text .= ': ' . experiment__exp_id_list_to_exp_names($params['ms_experiments']);
                break;
            case "statusids":
                $text = query__pseudo_query_not_without($params);
                $text .= ' ' . lang('participants_of_status');
                $text .= ': ' . participant__status_id_list_to_status_names($params['ms_status']);
                break;
            case "pformtextfields":
                $text = lang('where');
                $text .= ' "' . $params['search_string'] . '" ';
                $text .= query__pseudo_query_not_not($params);
                $text .= lang('in') . ' ';
                if ($params['search_field'] == 'all') {
                    $text .= lang('any_field');
                } else {
                    $text .= $params['search_field'];
                }
                break;
            case "pform":
                $f = array();
                foreach ($formfields as $p) {
                    if ($p['mysql_column_name'] == $pform_formfield) {
                        $f = $p;
                    }
                }
                if (isset($f['mysql_column_name'])) {
                    $text = lang('where') . ' ' . lang($f['name_lang']) . ' ';
                    if ($type == 'numberselect') {
                        $text .= $params['sign'] . $params['fieldvalue'];
                    } elseif ($type == 'simpleselect') {
                        $text .= query__pseudo_query_not_not($params) . '= "' . $params['fieldvalue'] . '"';
                    } else {
                        $text .= query__pseudo_query_not_not($params) . lang('in') . ': ' . participant__select_lang_idlist_to_names($f['mysql_column_name'], $params['ms_' . $pform_formfield]);
                    }
                } else {
                    $add = false;
                }
                break;
            case "noshows":
                $text = lang('where_nr_noshowups_is') . ' ';
                $text .= $params['sign'] . ' ' . $params['count'];
                break;
            case "participations":
                $text = lang('where_nr_participations_is') . ' ';
                $text .= $params['sign'] . ' ' . $params['count'];
                break;
            case "updaterequest":
                $text = lang('where_profile_update_request_is') . ' ';
                if ($params['update_request_status'] == 'y') {
                    $text .= lang('active');
                } else {
                    $text .= lang('inactive');
                }
                break;
            case "activity":
                $text = lang('where') . ' ' . lang($params['activity_type']) . ' ';
                $text .= query__pseudo_query_not_not($params);
                $text .= lang('before_date') . ' ';
                $sesstime_act = ortime__array_to_sesstime($params, 'dt_activity_');
                $text .= ortime__format(ortime__sesstime_to_unixtime($sesstime_act), 'hide_time:true');
                break;
            case "randsubset":
                $text = lang('limit_to_randomly_drawn') . ' ';
                $text .= $params['limit'];
                break;
            case "subsubjectpool":
                $text = query__pseudo_query_not_without($params);
                $text .= ' ' . lang('who_are_in_subjectpool');
                $text .= ': ' . subpools__idlist_to_namelist($params['ms_subpool']);
                break;
        }
        if ($add) {
            $pseudo_query_array[] = array('level' => $level, 'op_text' => $op_text, 'text' => $text);
        }
    }
    return $pseudo_query_array;
}
예제 #9
0
 }
 echo '<TD>' . $lang[$experiment['experiment_type']] . ' (' . $exptypes[$experiment['experiment_ext_type']]['exptype_name'] . ')</TD>
                 </TR>
                 <TR>
                     <TD>' . lang('name') . ':</TD><TD>' . $experiment['experiment_name'] . '</TD>
                     <TD>' . lang('public_name') . ':</TD><TD>' . $experiment['experiment_public_name'] . '</TD>
                 </TR>';
 echo '
                 <TR>
                     <TD>' . lang('class') . ':</TD>
                     <TD>' . experiment__experiment_class_field_to_list($experiment['experiment_class']) . '</TD>
                     <TD>' . lang('description') . ':</TD><TD>' . $experiment['experiment_description'] . '</TD>
                 </TR>
                 <TR>
                     <TD>' . lang('experimenter') . ':</TD><TD>' . experiment__list_experimenters($experiment['experimenter'], true, true) . '</TD>
                     <TD>' . lang('get_emails') . ':</TD><TD>' . experiment__list_experimenters($experiment['experimenter_mail'], true, true) . '</TD>
                 </TR>';
 // CONDITIONAL EXPERIMENT FIELDS
 $conditional_fields = array();
 if ($settings['enable_editing_of_experiment_sender_email'] == 'y') {
     $conditional_fields[] = '<TD>' . lang('email_sender_address') . ':</TD><TD>' . $experiment['sender_mail'] . '</TD>';
 }
 if ($settings['enable_payment_module'] == "y" && check_allow('payments_view')) {
     $conditional_fields[] = '<TD>' . lang('total_payment') . ':</TD><TD>' . or__format_number($experiment_total_payment, 2) . '</TD>';
 }
 if (trim($experiment['experiment_link_to_paper'])) {
     $conditional_fields[] = '<TD colspan=2><A target="_blank" HREF="' . trim($edit['experiment_link_to_paper']) . '">' . lang('Link to paper') . '</A></TD>';
 }
 $i = 0;
 foreach ($conditional_fields as $condfield) {
     if ($i / 2 == round($i / 2)) {
예제 #10
0
function experiment__other_experiments_select_field($postvarname, $type = "assigned", $experiment_id = "", $selected, $multi = true, $mpoptions = array())
{
    // $postvarname - name of form field
    // selected - array of pre-selected experimenter usernames
    global $lang, $preloaded_experiments, $settings;
    $out = "";
    if (!(is_array($preloaded_experiments) && count($preloaded_experiments) > 0)) {
        $preloaded_experiments = experiment__preload_experiments();
    }
    $mylist = array();
    foreach ($preloaded_experiments as $e) {
        if ($e['experiment_id'] != $experiment_id && ($type == 'all' || $type == 'assigned' && $e['assigned'] == 'y' || $type == 'participated' && $e['participated'] == 'y')) {
            $ename = $e['experiment_name'];
            if ($e['time'] || $e['experimenter']) {
                $ename .= ' (';
            }
            if ($e['experimenter']) {
                $ename .= experiment__list_experimenters($e['experimenter'], false, false);
            }
            if ($e['time'] && $e['experimenter']) {
                $ename .= ', ';
            }
            if ($e['time']) {
                $ename .= ortime__format(ortime__sesstime_to_unixtime($e['start_date']), 'hide_time:true') . '-' . ortime__format(ortime__sesstime_to_unixtime($e['end_date']), 'hide_time:true');
            }
            if ($e['time'] || $e['experimenter']) {
                $ename .= ')';
            }
            $mylist[$e['experiment_id']] = $ename;
        }
    }
    if (!is_array($mpoptions)) {
        $mpoptions = array();
    }
    if (!isset($mpoptions['picker_icon'])) {
        $mpoptions['picker_icon'] = 'cogs';
    }
    if ($multi) {
        $out .= get_multi_picker($postvarname, $mylist, $selected, $mpoptions);
    } else {
        $out .= '<SELECT name="' . $postvarname . '">
				<OPTION value=""';
        if (!$selected) {
            $out .= ' SELECTED';
        }
        $out .= '>-</OPTION>
				';
        foreach ($mylist as $k => $v) {
            $out .= '<OPTION value="' . $k . '"';
            if ($selected == $k) {
                $out .= ' SELECTED';
            }
            $out .= '>' . $v . '</OPTION>
				';
        }
        $out .= '</SELECT>
		';
    }
    return $out;
}
예제 #11
0
         $experimenters = db_string_to_id_array($exp['experimenter']);
         if (!(in_array($expadmindata['admin_id'], $experimenters) && check_allow('file_view_experiment_my') || check_allow('file_view_experiment_all'))) {
             redirect('admin/download_main.php');
         }
     }
     if ($proceed) {
         $thislist_sessions = sessions__get_sessions($experiment_id);
         $first_last = sessions__get_first_last_date($thislist_sessions);
         echo ' <TABLE class="or_panel">';
         echo '<TR><TD>
                 <TABLE width="100%" border=0 class="or_panel_title"><TR>
                     <TD style="background: ' . $color['panel_title_background'] . '; color: ' . $color['panel_title_textcolor'] . '">';
         echo lang('experiment') . ' ' . $exp['experiment_name'] . ', ';
         echo lang('from') . ' ' . $first_last['first'] . ' ';
         echo lang('to') . ' ' . $first_last['last'];
         echo ', ' . experiment__list_experimenters($exp['experimenter'], true, true);
         echo '</TD>';
         echo '</TR></TABLE>
             </TD></TR>';
         echo '<TR><TD>';
         echo downloads__list_files_experiment($exp['experiment_id'], true, true, true);
         echo '</TD></TR>';
         echo '  </TABLE>';
         echo '<BR><BR><a href="experiment_show.php?experiment_id=' . $exp['experiment_id'] . '">' . icon('back') . ' ' . lang('mainpage_of_this_experiment') . '</A>';
         echo '<BR><BR><A href="download_main.php">' . icon('back') . ' ' . lang('back') . '</A>';
     }
 } else {
     if (check_allow('file_download_general')) {
         echo ' <TABLE class="or_panel">';
         echo '<TR><TD>
                 <TABLE width="100%" border=0 class="or_panel_title"><TR>