예제 #1
0
<?php

// part of orsee. see orsee.org
ob_start();
include "nonoutputheader.php";
if (isset($_REQUEST['displayfrom']) && $_REQUEST['displayfrom']) {
    $displayfrom = (int) $_REQUEST['displayfrom'];
} else {
    $displayfrom = time();
}
if (isset($_REQUEST['wholeyear']) && $_REQUEST['wholeyear']) {
    $wholeyear = true;
} else {
    $wholeyear = false;
}
pdfoutput__make_pdf_calendar($displayfrom, $wholeyear, true, 1);
예제 #2
0
function experimentmail__send_calendar()
{
    global $lang, $settings;
    $now = time();
    if (isset($settings['emailed_calendar_included_months']) && $settings['emailed_calendar_included_months'] > 0) {
        $number_of_months = $settings['emailed_calendar_included_months'] - 1;
    } else {
        $number_of_months = 1;
    }
    $from = $settings['support_mail'];
    // remember the current language for later reset
    $old_lang = lang('lang');
    // preload details with current language
    $maillang = $old_lang;
    $mail_subject = lang('experiment_calendar') . ' ' . ortime__format($now, 'hide_time:true');
    $cal_name = lang('experiment_calendar') . ' ' . date("Y-m-d", $now);
    $cal_filename = str_replace(" ", "_", $cal_name) . ".pdf";
    $cal_file = pdfoutput__make_pdf_calendar($now, false, true, $number_of_months, true);
    // get experimenters who want to receive the calendar
    $query = "SELECT *\n            FROM " . table('admin') . "\n            WHERE get_calendar_mail='y'\n            AND disabled='n'\n            ORDER BY language";
    $result = or_query($query);
    $i = 0;
    $rec_count = pdo_num_rows($result);
    while ($admin = pdo_fetch_assoc($result)) {
        if ($admin['language'] != $maillang) {
            $maillang = $admin['language'];
            $lang = load_language($maillang);
            $mail_subject = lang('experiment_calendar') . ' ' . ortime__format($now, 'hide_time:true', $maillang);
            $cal_name = lang('experiment_calendar') . ' ' . date("Y-m-d", $now);
            $cal_filename = str_replace(" ", "_", $cal_name) . ".pdf";
            $cal_file = pdfoutput__make_pdf_calendar($now, false, true, $number_of_months, true);
        }
        $mailtext = load_mail("admin_calendar_mailtext", $maillang) . "\n" . experimentmail__get_admin_footer($maillang, $admin) . "\n";
        $message = process_mail_template($mailtext, $admin);
        $done = experimentmail__mail_attach($admin['email'], $from, $mail_subject, $message, $cal_filename, $cal_file);
        if ($done) {
            $i++;
        }
    }
    // reset language
    if ($maillang != $old_lang) {
        $lang = load_language($old_lang);
    }
    return $cal_name . " sent to " . $i . " out of " . $rec_count . " administrators\n";
}