Ejemplo n.º 1
0
     $cal_templates->set_var('calendar_mode', '?mode=personal');
 } else {
     $cal_templates->set_var('calendar_mode', '');
 }
 $result = DB_query($datesql);
 $nrows = DB_numRows($result);
 if ($nrows == 0) {
     $cal_templates->set_var('lang_month', '');
     $cal_templates->set_var('event_year', '');
     $cal_templates->set_var('event_details', '');
     $cal_templates->parse('output', 'events');
     $display .= $cal_templates->finish($cal_templates->get_var('output'));
     $display .= $LANG_CALJP_1[2];
 } else {
     $cal = new Calendar();
     setCalendarLanguage($cal);
     require_once $_CONF['path'] . 'plugins/calendarjp/include/gltext.class.php';
     $gltext = new GLPText();
     $currentmonth = '';
     for ($i = 0; $i < $nrows; $i++) {
         $A = DB_fetchArray($result);
         if (SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']) > 0) {
             $cal_templates->set_var('lang_owner', $LANG_ACCESS['owner']);
             $ownername = COM_getDisplayName($A['owner_id']);
             $cal_templates->set_var('owner_name', $ownername);
             $cal_templates->set_var('owner_id', $A['owner_id']);
             if (strftime('%B', strtotime($A['datestart'])) != $currentmonth) {
                 $str_month = $cal->getMonthName(strftime('%m', strtotime($A['datestart'])));
                 $cal_templates->set_var('lang_month', $str_month);
                 $cal_templates->set_var('event_year', strftime('%Y', strtotime($A['datestart'])));
                 $currentmonth = strftime('%B', strtotime($A['datestart']));
Ejemplo n.º 2
0
/**
* Gets a small, text-only version of a calendar
*
* @param    int     $m  Month to display
* @param    int     $y  Year to display
* @return   string      HTML for small calendar
*
*/
function getSmallCalendar($m, $y, $mode = '')
{
    global $_CONF;
    $retval = '';
    $mycal = new Calendar();
    setCalendarLanguage($mycal);
    $mycal->setCalendarMatrix($m, $y);
    if (!empty($mode)) {
        $mode = '&amp;mode=' . $mode;
    }
    $retval .= '<table class="smallcal">' . LB . '<tr class="smallcal-headline"><td align="center" colspan="7">' . COM_createLink($mycal->getMonthName($m), $_CONF['site_url'] . '/calendarjp/index.php?month=' . $m . '&amp;year=' . $y . $mode) . '</td></tr>' . makeDaysHeadline() . LB;
    for ($i = 1; $i <= 6; $i++) {
        if ($i % 2 == 0) {
            $tr = '<tr class="smallcal-week-even">' . LB;
        } else {
            $tr = '<tr class="smallcal-week-odd">' . LB;
        }
        $tr_sent = false;
        for ($j = 1; $j <= 7; $j++) {
            $curday = $mycal->getDayData($i, $j);
            if (!$tr_sent) {
                if (empty($curday)) {
                    $retval .= '<tr class="smallcal-week-empty">' . LB;
                } else {
                    $retval .= $tr;
                }
                $tr_sent = true;
            }
            $retval .= '<td';
            if (!empty($curday)) {
                if ($j % 2 == 0) {
                    $retval .= ' class="smallcal-day-even">' . LB;
                } else {
                    $retval .= ' class="smallcal-day-odd">' . LB;
                }
                $retval .= $curday->daynumber;
            } else {
                $retval .= ' class="smallcal-day-empty">&nbsp;';
            }
            $retval .= '</td>' . LB;
        }
        $retval .= '</tr>' . LB;
    }
    $retval .= '</table>' . LB;
    return $retval;
}