当前位置: 首页>>代码示例>>PHP>>正文


PHP calendar_get_link_href函数代码示例

本文整理汇总了PHP中calendar_get_link_href函数的典型用法代码示例。如果您正苦于以下问题:PHP calendar_get_link_href函数的具体用法?PHP calendar_get_link_href怎么用?PHP calendar_get_link_href使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了calendar_get_link_href函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: show_month_detailed


//.........这里部分代码省略.........
     // Get the day names as the header.
     $header = array();
     for ($i = $display->minwday; $i <= $display->maxwday; ++$i) {
         $header[] = $daynames[$i % $numberofdaysinweek]['shortname'];
     }
     $table->head = $header;
     // For the table display. $week is the row; $dayweek is the column.
     $week = 1;
     $dayweek = $startwday;
     $row = new html_table_row(array());
     // Paddding (the first week may have blank days in the beginning)
     for ($i = $display->minwday; $i < $startwday; ++$i) {
         $cell = new html_table_cell('&nbsp;');
         $cell->attributes = array('class' => 'nottoday dayblank');
         $row->cells[] = $cell;
     }
     // Now display all the calendar
     $weekend = CALENDAR_DEFAULT_WEEKEND;
     if (isset($CFG->calendar_weekend)) {
         $weekend = intval($CFG->calendar_weekend);
     }
     $daytime = $display->tstart - DAYSECS;
     for ($day = 1; $day <= $display->maxdays; ++$day, ++$dayweek) {
         $daytime = $daytime + DAYSECS;
         if ($dayweek > $display->maxwday) {
             // We need to change week (table row)
             $table->data[] = $row;
             $row = new html_table_row(array());
             $dayweek = $display->minwday;
             ++$week;
         }
         // Reset vars
         $cell = new html_table_cell();
         $dayhref = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', array('view' => 'day', 'course' => $calendar->courseid)), 0, 0, 0, $daytime);
         $cellclasses = array();
         if ($weekend & 1 << $dayweek % $numberofdaysinweek) {
             // Weekend. This is true no matter what the exact range is.
             $cellclasses[] = 'weekend';
         }
         // Special visual fx if an event is defined
         if (isset($eventsbyday[$day])) {
             if (count($eventsbyday[$day]) == 1) {
                 $title = get_string('oneevent', 'calendar');
             } else {
                 $title = get_string('manyevents', 'calendar', count($eventsbyday[$day]));
             }
             $cell->text = html_writer::tag('div', html_writer::link($dayhref, $day, array('title' => $title)), array('class' => 'day'));
         } else {
             $cell->text = html_writer::tag('div', $day, array('class' => 'day'));
         }
         // Special visual fx if an event spans many days
         $durationclass = false;
         if (isset($typesbyday[$day]['durationglobal'])) {
             $durationclass = 'duration_global';
         } else {
             if (isset($typesbyday[$day]['durationcourse'])) {
                 $durationclass = 'duration_course';
             } else {
                 if (isset($typesbyday[$day]['durationgroup'])) {
                     $durationclass = 'duration_group';
                 } else {
                     if (isset($typesbyday[$day]['durationuser'])) {
                         $durationclass = 'duration_user';
                     }
                 }
             }
开发者ID:abhilash1994,项目名称:moodle,代码行数:67,代码来源:renderer.php

示例2: calendar_get_sideblock_upcoming

function calendar_get_sideblock_upcoming($events, $linkhref = NULL)
{
    $content = '';
    $lines = count($events);
    if (!$lines) {
        return $content;
    }
    for ($i = 0; $i < $lines; ++$i) {
        if (!isset($events[$i]->time)) {
            // Just for robustness
            continue;
        }
        $events[$i] = calendar_add_event_metadata($events[$i]);
        $content .= '<div class="event"><span class="icon c0">' . $events[$i]->icon . '</span> ';
        if (!empty($events[$i]->referer)) {
            // That's an activity event, so let's provide the hyperlink
            $content .= $events[$i]->referer;
        } else {
            if (!empty($linkhref)) {
                $ed = usergetdate($events[$i]->timestart);
                $href = calendar_get_link_href(CALENDAR_URL . $linkhref, $ed['mday'], $ed['mon'], $ed['year']);
                $content .= '<a href="' . $href . '#event_' . $events[$i]->id . '">' . $events[$i]->name . '</a>';
            } else {
                $content .= $events[$i]->name;
            }
        }
        $events[$i]->time = str_replace('&raquo;', '<br />&raquo;', $events[$i]->time);
        $content .= '<div class="date">' . $events[$i]->time . '</div></div>';
        if ($i < $lines - 1) {
            $content .= '<hr />';
        }
    }
    return $content;
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:34,代码来源:lib.php

示例3: optional_param

$cal_m = optional_param('cal_m');
$cal_d = optional_param('cal_d');
if (isguest()) {
    // Guests cannot do anything with events
    redirect(CALENDAR_URL . 'view.php?view=upcoming&amp;course=' . $urlcourse);
}
$focus = '';
if (!($site = get_site())) {
    redirect($CFG->wwwroot . '/' . $CFG->admin . '/index.php');
}
$strcalendar = get_string('calendar', 'calendar');
// Initialize the session variables
calendar_session_vars();
$now = usergetdate(time());
$navlinks = array();
$calendar_navlink = array('name' => $strcalendar, 'link' => calendar_get_link_href(CALENDAR_URL . 'view.php?view=upcoming&amp;course=' . $urlcourse . '&amp;', $now['mday'], $now['mon'], $now['year']), 'type' => 'misc');
$day = intval($now['mday']);
$mon = intval($now['mon']);
$yr = intval($now['year']);
if ($usehtmleditor = can_use_richtext_editor()) {
    $defaultformat = FORMAT_HTML;
} else {
    $defaultformat = FORMAT_MOODLE;
}
// If a course has been supplied in the URL, change the filters to show that one
if ($urlcourse > 0 && record_exists('course', 'id', $urlcourse)) {
    require_login($urlcourse, false);
    if ($urlcourse == SITEID) {
        // If coming from the site page, show all courses
        $SESSION->cal_courses_shown = calendar_get_default_courses(true);
        calendar_set_referring_course(0);
开发者ID:NextEinstein,项目名称:riverhills,代码行数:31,代码来源:event.php

示例4: calendar_format_event_time

/**
 * Get event format time
 *
 * @param calendar_event $event event object
 * @param int $now current time in gmt
 * @param array $linkparams list of params for event link
 * @param bool $usecommonwords the words as formatted date/time.
 * @param int $showtime determine the show time GMT timestamp
 * @return string $eventtime link/string for event time
 */
function calendar_format_event_time($event, $now, $linkparams = null, $usecommonwords = true, $showtime = 0)
{
    $starttime = $event->timestart;
    $endtime = $event->timestart + $event->timeduration;
    if (empty($linkparams) || !is_array($linkparams)) {
        $linkparams = array();
    }
    $linkparams['view'] = 'day';
    // OK, now to get a meaningful display...
    // Check if there is a duration for this event.
    if ($event->timeduration) {
        // Get the midnight of the day the event will start.
        $usermidnightstart = usergetmidnight($starttime);
        // Get the midnight of the day the event will end.
        $usermidnightend = usergetmidnight($endtime);
        // Check if we will still be on the same day.
        if ($usermidnightstart == $usermidnightend) {
            // Check if we are running all day.
            if ($event->timeduration == DAYSECS) {
                $time = get_string('allday', 'calendar');
            } else {
                // Specify the time we will be running this from.
                $datestart = calendar_time_representation($starttime);
                $dateend = calendar_time_representation($endtime);
                $time = $datestart . ' <strong>&raquo;</strong> ' . $dateend;
            }
            // Set printable representation.
            if (!$showtime) {
                $day = calendar_day_representation($event->timestart, $now, $usecommonwords);
                $url = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', $linkparams), 0, 0, 0, $endtime);
                $eventtime = html_writer::link($url, $day) . ', ' . $time;
            } else {
                $eventtime = $time;
            }
        } else {
            // It must spans two or more days.
            $daystart = calendar_day_representation($event->timestart, $now, $usecommonwords) . ', ';
            if ($showtime == $usermidnightstart) {
                $daystart = '';
            }
            $timestart = calendar_time_representation($event->timestart);
            $dayend = calendar_day_representation($event->timestart + $event->timeduration, $now, $usecommonwords) . ', ';
            if ($showtime == $usermidnightend) {
                $dayend = '';
            }
            $timeend = calendar_time_representation($event->timestart + $event->timeduration);
            // Set printable representation.
            if ($now >= $usermidnightstart && $now < $usermidnightstart + DAYSECS) {
                $url = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', $linkparams), 0, 0, 0, $endtime);
                $eventtime = $timestart . ' <strong>&raquo;</strong> ' . html_writer::link($url, $dayend) . $timeend;
            } else {
                $url = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', $linkparams), 0, 0, 0, $endtime);
                $eventtime = html_writer::link($url, $daystart) . $timestart . ' <strong>&raquo;</strong> ';
                $url = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', $linkparams), 0, 0, 0, $starttime);
                $eventtime .= html_writer::link($url, $dayend) . $timeend;
            }
        }
    } else {
        // There is no time duration.
        $time = calendar_time_representation($event->timestart);
        // Set printable representation.
        if (!$showtime) {
            $day = calendar_day_representation($event->timestart, $now, $usecommonwords);
            $url = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', $linkparams), 0, 0, 0, $starttime);
            $eventtime = html_writer::link($url, $day) . ', ' . trim($time);
        } else {
            $eventtime = $time;
        }
    }
    // Check if It has expired.
    if ($event->timestart + $event->timeduration < $now) {
        $eventtime = '<span class="dimmed_text">' . str_replace(' href=', ' class="dimmed" href=', $eventtime) . '</span>';
    }
    return $eventtime;
}
开发者ID:miguelangelUvirtual,项目名称:uEducon,代码行数:85,代码来源:lib.php

示例5: calendar_format_event_time

/**
 * Get event format time
 *
 * @param calendar_event $event event object
 * @param int $now current time in gmt
 * @param array $linkparams list of params for event link
 * @param bool $usecommonwords the words as formatted date/time.
 * @param int $showtime determine the show time GMT timestamp
 * @return string $eventtime link/string for event time
 */
function calendar_format_event_time($event, $now, $linkparams = null, $usecommonwords = true, $showtime = 0)
{
    $startdate = usergetdate($event->timestart);
    $enddate = usergetdate($event->timestart + $event->timeduration);
    $usermidnightstart = usergetmidnight($event->timestart);
    if ($event->timeduration) {
        // To avoid doing the math if one IF is enough :)
        $usermidnightend = usergetmidnight($event->timestart + $event->timeduration);
    } else {
        $usermidnightend = $usermidnightstart;
    }
    if (empty($linkparams) || !is_array($linkparams)) {
        $linkparams = array();
    }
    $linkparams['view'] = 'day';
    // OK, now to get a meaningful display...
    // First of all we have to construct a human-readable date/time representation
    if ($event->timeduration) {
        // It has a duration
        if ($usermidnightstart == $usermidnightend || $event->timestart == $usermidnightstart && ($event->timeduration == 86400 || $event->timeduration == 86399) || $event->timestart + $event->timeduration <= $usermidnightstart + 86400) {
            // But it's all on the same day
            $timestart = calendar_time_representation($event->timestart);
            $timeend = calendar_time_representation($event->timestart + $event->timeduration);
            $time = $timestart . ' <strong>&raquo;</strong> ' . $timeend;
            if ($event->timestart == $usermidnightstart && ($event->timeduration == 86400 || $event->timeduration == 86399)) {
                $time = get_string('allday', 'calendar');
            }
            // Set printable representation
            if (!$showtime) {
                $day = calendar_day_representation($event->timestart, $now, $usecommonwords);
                $url = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', $linkparams), $enddate['mday'], $enddate['mon'], $enddate['year']);
                $eventtime = html_writer::link($url, $day) . ', ' . $time;
            } else {
                $eventtime = $time;
            }
        } else {
            // It spans two or more days
            $daystart = calendar_day_representation($event->timestart, $now, $usecommonwords) . ', ';
            if ($showtime == $usermidnightstart) {
                $daystart = '';
            }
            $timestart = calendar_time_representation($event->timestart);
            $dayend = calendar_day_representation($event->timestart + $event->timeduration, $now, $usecommonwords) . ', ';
            if ($showtime == $usermidnightend) {
                $dayend = '';
            }
            $timeend = calendar_time_representation($event->timestart + $event->timeduration);
            // Set printable representation
            if ($now >= $usermidnightstart && $now < $usermidnightstart + 86400) {
                $url = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', $linkparams), $enddate['mday'], $enddate['mon'], $enddate['year']);
                $eventtime = $timestart . ' <strong>&raquo;</strong> ' . html_writer::link($url, $dayend) . $timeend;
            } else {
                $url = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', $linkparams), $enddate['mday'], $enddate['mon'], $enddate['year']);
                $eventtime = html_writer::link($url, $daystart) . $timestart . ' <strong>&raquo;</strong> ';
                $url = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', $linkparams), $startdate['mday'], $startdate['mon'], $startdate['year']);
                $eventtime .= html_writer::link($url, $dayend) . $timeend;
            }
        }
    } else {
        $time = calendar_time_representation($event->timestart);
        // Set printable representation
        if (!$showtime) {
            $day = calendar_day_representation($event->timestart, $now, $usecommonwords);
            $url = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', $linkparams), $startdate['mday'], $startdate['mon'], $startdate['year']);
            $eventtime = html_writer::link($url, $day) . ', ' . trim($time);
        } else {
            $eventtime = $time;
        }
    }
    if ($event->timestart + $event->timeduration < $now) {
        // It has expired
        $eventtime = '<span class="dimmed_text">' . str_replace(' href=', ' class="dimmed" href=', $eventtime) . '</span>';
    }
    return $eventtime;
}
开发者ID:JP-Git,项目名称:moodle,代码行数:85,代码来源:lib.php

示例6: calendar_show_month_detailed


//.........这里部分代码省略.........
    $text .= '<label for="cal_course_flt_jump">' . get_string('detailedmonthview', 'calendar') . ':</label>' . calendar_course_filter_selector($getvars);
    echo '<div class="header">' . $text . '</div>';
    echo '<div class="controls">';
    echo calendar_top_controls('month', array('id' => $courseid, 'm' => $m, 'y' => $y));
    echo '</div>';
    // Start calendar display
    echo '<table class="calendarmonth"><tr class="weekdays">';
    // Begin table. First row: day names
    // Print out the names of the weekdays
    for ($i = $display->minwday; $i <= $display->maxwday; ++$i) {
        // This uses the % operator to get the correct weekday no matter what shift we have
        // applied to the $display->minwday : $display->maxwday range from the default 0 : 6
        echo '<th scope="col">' . get_string($CALENDARDAYS[$i % 7], 'calendar') . '</th>';
    }
    echo '</tr><tr>';
    // End of day names; prepare for day numbers
    // For the table display. $week is the row; $dayweek is the column.
    $week = 1;
    $dayweek = $startwday;
    // Paddding (the first week may have blank days in the beginning)
    for ($i = $display->minwday; $i < $startwday; ++$i) {
        echo '<td class="nottoday">&nbsp;</td>' . "\n";
    }
    // Now display all the calendar
    for ($day = 1; $day <= $display->maxdays; ++$day, ++$dayweek) {
        if ($dayweek > $display->maxwday) {
            // We need to change week (table row)
            echo "</tr>\n<tr>";
            $dayweek = $display->minwday;
            ++$week;
        }
        // Reset vars
        $cell = '';
        $dayhref = calendar_get_link_href(CALENDAR_URL . 'view.php?view=day&amp;course=' . $courseid . '&amp;', $day, $m, $y);
        if (CALENDAR_WEEKEND & 1 << $dayweek % 7) {
            // Weekend. This is true no matter what the exact range is.
            $class = 'weekend';
        } else {
            // Normal working day.
            $class = '';
        }
        // Special visual fx if an event is defined
        if (isset($eventsbyday[$day])) {
            if (count($eventsbyday[$day]) == 1) {
                $title = get_string('oneevent', 'calendar');
            } else {
                $title = get_string('manyevents', 'calendar', count($eventsbyday[$day]));
            }
            $cell = '<div class="day"><a href="' . $dayhref . '" title="' . $title . '">' . $day . '</a></div>';
        } else {
            $cell = '<div class="day">' . $day . '</div>';
        }
        // Special visual fx if an event spans many days
        if (isset($typesbyday[$day]['durationglobal'])) {
            $class .= ' duration_global';
        } else {
            if (isset($typesbyday[$day]['durationcourse'])) {
                $class .= ' duration_course';
            } else {
                if (isset($typesbyday[$day]['durationgroup'])) {
                    $class .= ' duration_group';
                } else {
                    if (isset($typesbyday[$day]['durationuser'])) {
                        $class .= ' duration_user';
                    }
                }
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:67,代码来源:view.php

示例7: calendar_information

if ($action !== '') {
    $url->param('action', $action);
}
if ($course !== NULL) {
    $url->param('course', $course->id);
}
$PAGE->set_url($url);
$calendar = new calendar_information(0, 0, 0, $time);
$calendar->prepare_for_view($course, $courses);
$pagetitle = get_string('export', 'calendar');
// Print title and header
if ($issite) {
    $PAGE->navbar->add($course->shortname, new moodle_url('/course/view.php', array('id' => $course->id)));
}
$link = new moodle_url(CALENDAR_URL . 'view.php', array('view' => 'upcoming', 'course' => $calendar->courseid));
$PAGE->navbar->add(get_string('calendar', 'calendar'), calendar_get_link_href($link, 0, 0, 0, $time));
$PAGE->navbar->add($pagetitle);
$PAGE->set_title($course->shortname . ': ' . get_string('calendar', 'calendar') . ': ' . $pagetitle);
$PAGE->set_heading($course->fullname);
$PAGE->set_pagelayout('standard');
$renderer = $PAGE->get_renderer('core_calendar');
$calendar->add_sidecalendar_blocks($renderer);
// Get the calendar type we are using.
$calendartype = \core_calendar\type_factory::get_calendar_instance();
$now = $calendartype->timestamp_to_date_array($time);
$weekend = CALENDAR_DEFAULT_WEEKEND;
if (isset($CFG->calendar_weekend)) {
    $weekend = intval($CFG->calendar_weekend);
}
$numberofdaysinweek = $calendartype->get_num_weekdays();
$formdata = array('allownextweek' => $weekend & 1 << $now['wday'], 'allownextmonth' => calendar_days_in_month($now['mon'], $now['year']) - $now['mday'] < $numberofdaysinweek, 'allowthisweek' => !($weekend & 1 << $now['wday'] && !($weekend & 1 << ($now['wday'] + 1) % $numberofdaysinweek)));
开发者ID:gabrielrosset,项目名称:moodle,代码行数:31,代码来源:export.php

示例8: require_login

require_login();
if (empty($CFG->enablecalendarexport)) {
    die('no export');
}
if (!($site = get_site())) {
    redirect($CFG->wwwroot . '/' . $CFG->admin . '/index.php');
}
// Initialize the session variables
calendar_session_vars();
$pagetitle = get_string('export', 'calendar');
$navlinks = array();
$now = usergetdate(time());
if (!empty($courseid) && $course->id != SITEID) {
    $navlinks[] = array('name' => $course->shortname, 'link' => "{$CFG->wwwroot}/course/view.php?id={$course->id}", 'type' => 'misc');
}
$navlinks[] = array('name' => get_string('calendar', 'calendar'), 'link' => calendar_get_link_href(CALENDAR_URL . 'view.php?view=upcoming&amp;course=' . $courseid . '&amp;', $now['mday'], $now['mon'], $now['year']), 'type' => 'misc');
$navlinks[] = array('name' => $pagetitle, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
if (!checkdate($mon, $day, $yr)) {
    $day = intval($now['mday']);
    $mon = intval($now['mon']);
    $yr = intval($now['year']);
}
$time = make_timestamp($yr, $mon, $day);
if (empty($USER->id) or isguest()) {
    $defaultcourses = calendar_get_default_courses();
    calendar_set_filters($courses, $groups, $users, $defaultcourses, $defaultcourses);
} else {
    calendar_set_filters($courses, $groups, $users);
}
if (empty($USER->id) or isguest()) {
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:31,代码来源:export.php

示例9: show_month_detailed


//.........这里部分代码省略.........
     $wdays = array(0 => '<strong>' . get_string('sunday', 'calendar') . '</strong>', 1 => '<strong>' . get_string('monday', 'calendar') . '</strong>', 2 => '<strong>' . get_string('tuesday', 'calendar') . '</strong>', 3 => '<strong>' . get_string('wednesday', 'calendar') . '</strong>', 4 => '<strong>' . get_string('thursday', 'calendar') . '</strong>', 5 => '<strong>' . get_string('friday', 'calendar') . '</strong>', 6 => '<strong>' . get_string('saturday', 'calendar') . '</strong>');
     // Loop only if the day offset is greater than 0.
     // This loop involves shifting the days around until the desired start day
     // is at the start of the array.
     $daycount = 0;
     while ($display->minwday > $daycount++) {
         $wdays_end = array_shift($wdays);
         array_push($wdays, $wdays_end);
     }
     // Now we set the (modified) array to the table header to be displayed.
     $table->head = $wdays;
     $row = new html_table_row(array());
     // Paddding (the first week may have blank days in the beginning)
     for ($i = $display->minwday; $i < $startwday; ++$i) {
         $cell = new html_table_cell('&nbsp;');
         $cell->attributes = array('class' => 'nottoday');
         $row->cells[] = $cell;
     }
     // Now display all the calendar
     $weekend = CALENDAR_DEFAULT_WEEKEND;
     if (isset($CFG->calendar_weekend)) {
         $weekend = intval($CFG->calendar_weekend);
     }
     for ($calendar->day = 1; $calendar->day <= $display->maxdays; ++$calendar->day, ++$dayweek) {
         if ($dayweek > $display->maxwday) {
             // We need to change week (table row)
             $table->data[] = $row;
             $row = new html_table_row(array());
             $dayweek = $display->minwday;
             ++$week;
         }
         // Reset vars
         $cell = new html_table_cell();
         $dayhref = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', array('view' => 'day', 'course' => $calendar->courseid)), $calendar->day, $calendar->month, $calendar->year);
         $cellclasses = array();
         if ($weekend & 1 << $dayweek % 7) {
             // Weekend. This is true no matter what the exact range is.
             $cellclasses[] = 'weekend';
         }
         // Special visual fx if an event is defined
         if (isset($eventsbyday[$calendar->day])) {
             if (count($eventsbyday[$calendar->day]) == 1) {
                 $title = get_string('oneevent', 'calendar');
             } else {
                 $title = get_string('manyevents', 'calendar', count($eventsbyday[$calendar->day]));
             }
             $cell->text = html_writer::tag('div', html_writer::link($dayhref, $calendar->day, array('title' => $title)), array('class' => 'day'));
         } else {
             $cell->text = html_writer::tag('div', $calendar->day, array('class' => 'day'));
         }
         // Special visual fx if an event spans many days
         $durationclass = false;
         if (isset($typesbyday[$calendar->day]['durationglobal'])) {
             $durationclass = 'duration_global';
         } else {
             if (isset($typesbyday[$calendar->day]['durationcourse'])) {
                 $durationclass = 'duration_course';
             } else {
                 if (isset($typesbyday[$calendar->day]['durationgroup'])) {
                     $durationclass = 'duration_group';
                 } else {
                     if (isset($typesbyday[$calendar->day]['durationuser'])) {
                         $durationclass = 'duration_user';
                     }
                 }
             }
开发者ID:rosenclever,项目名称:moodle,代码行数:67,代码来源:renderer.php

示例10: calendar_information

if ($yr !== 0) {
    $url->param('cal_y', $yr);
}
if ($course !== NULL) {
    $url->param('course', $course->id);
}
$PAGE->set_url($url);
$calendar = new calendar_information($day, $mon, $yr);
$calendar->prepare_for_view($course, $courses);
$pagetitle = get_string('export', 'calendar');
// Print title and header
if ($issite) {
    $PAGE->navbar->add($course->shortname, new moodle_url('/course/view.php', array('id' => $course->id)));
}
$link = new moodle_url(CALENDAR_URL . 'view.php', array('view' => 'upcoming', 'course' => $calendar->courseid));
$PAGE->navbar->add(get_string('calendar', 'calendar'), calendar_get_link_href($link, $now['mday'], $now['mon'], $now['year']));
$PAGE->navbar->add($pagetitle);
$PAGE->set_title($course->shortname . ': ' . get_string('calendar', 'calendar') . ': ' . $pagetitle);
$PAGE->set_heading($course->fullname);
$PAGE->set_button(calendar_preferences_button($course));
$PAGE->set_pagelayout('standard');
$renderer = $PAGE->get_renderer('core_calendar');
$calendar->add_sidecalendar_blocks($renderer);
echo $OUTPUT->header();
echo $renderer->start_layout();
switch ($action) {
    case 'advanced':
        // Why nothing?
        break;
    case '':
    default:
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:31,代码来源:export.php

示例11: show_month_detailed

function show_month_detailed($baseparams, $display, $m, $y, $courses, $groups, $users, $courseid, $activefilters, $waitlistedsessions, $events) {
    global $USER, $SESSION, $OUTPUT;
    global $timenow;

    $calendardays = calendar_get_days();

    $weekend = CALENDAR_DEFAULT_WEEKEND;
    if (isset($CFG->calendar_weekend)) {
        $weekend = intval($CFG->calendar_weekend);
    }

    // Extract information: events vs. time
    calendar_events_by_day($events, $m, $y, $eventsbyday, $durationbyday, $typesbyday, $courses);
    echo $OUTPUT->container_start(null, 'calendarcontainer');
    echo $OUTPUT->box_start('generalbox monthlycalendar');
    $text = '';
    echo $OUTPUT->container($text, 'header');

    echo $OUTPUT->container(top_controls($m, $y), 'controls');

    // Start calendar display
    echo html_writer::start_tag('table', array('class' => 'calendarmonth', 'summary' => get_string('calendar:tablesummary', 'block_facetoface')));
    echo html_writer::start_tag('tr', array('class' => 'weekdays')); // Begin table. First row: day names

    // Print out the names of the weekdays
    for($i = $display->minwday; $i <= $display->maxwday; ++$i) {
        // This uses the % operator to get the correct weekday no matter what shift we have
        // applied to the $display->minwday : $display->maxwday range from the default 0 : 6
        $day = $calendardays[$i % 7];
        echo html_writer::tag('th', get_string($day, 'calendar'), array('scope' => 'col'));
    }

    echo html_writer::end_tag('tr') . html_writer::start_tag('tr'); // End of day names; prepare for day numbers

    // For the table display. $week is the row; $dayweek is the column.
    $week = 1;
    $dayweek = $display->startwday;

    // Paddding (the first week may have blank days in the beginning)
    for($i = $display->minwday; $i < $display->startwday; ++$i) {
        echo html_writer::tag('td', '&nbsp;', array('class' => 'nottoday')) . "\n";
    }

    // Now display all the calendar
    for($day = 1; $day <= $display->maxdays; ++$day, ++$dayweek) {
        if ($dayweek > $display->maxwday) {
            // We need to change week (table row)
            echo html_writer::end_tag('tr') . html_writer::start_tag('tr');
            $dayweek = $display->minwday;
            ++$week;
        }

        // Reset vars
        $cell = '';
        $dayhref = calendar_get_link_href(new moodle_url(CALENDAR_URL.'view.php', array('view' => 'day', 'course' => $courseid)), $day, $m, $y);

        if ($weekend & (1 << ($dayweek % 7))) {
            // Weekend. This is true no matter what the exact range is.
            $class = 'weekend';
        }
        else {
            // Normal working day.
            $class = '';
        }

        // Special visual fx if an event is defined
        if (isset($eventsbyday[$day])) {
            if (count($eventsbyday[$day]) == 1) {
                $title = get_string('oneevent', 'calendar');
            }
            else {
                $title = get_string('manyevents', 'calendar', count($eventsbyday[$day]));
            }
            $cell = $OUTPUT->container(html_writer::link($dayhref, $day, array('title' => $title)), array('class' => 'day'));
        }
        else {
            $cell = $OUTPUT->container($day, array('class' => 'day'));
        }

        // Special visual fx if an event spans many days
        if (isset($typesbyday[$day]['durationglobal'])) {
            $class .= ' duration_global';
        }
        else if (isset($typesbyday[$day]['durationcourse'])) {
            $class .= ' duration_course';
        }
        else if (isset($typesbyday[$day]['durationgroup'])) {
            $class .= ' duration_group';
        }
        else if (isset($typesbyday[$day]['durationuser'])) {
            $class .= ' duration_user';
        }

        // Special visual fx for today
        $today = strftime('%d', $timenow);
        if ($display->thismonth && $day == $today) {
            $class .= ' today';
        } else {
            $class .= ' nottoday';
        }
//.........这里部分代码省略.........
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:101,代码来源:calendar.php

示例12: require_login

        //TODO: wrong
        require_login();
    } else {
        $PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
        //TODO: wrong
    }
}
$calendar = new calendar_information($day, $mon, $yr);
$calendar->courseid = $courseid;
// Initialize the session variables
calendar_session_vars();
//add_to_log($course->id, "course", "view", "view.php?id=$course->id", "$course->id");
$now = usergetdate(time());
$pagetitle = '';
$strcalendar = get_string('calendar', 'calendar');
$link = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', array('view' => 'upcoming', 'course' => $courseid)), $now['mday'], $now['mon'], $now['year']);
$PAGE->navbar->add($strcalendar, $link);
if (!checkdate($mon, $day, $yr)) {
    $day = intval($now['mday']);
    $mon = intval($now['mon']);
    $yr = intval($now['year']);
}
$time = make_timestamp($yr, $mon, $day);
switch ($view) {
    case 'day':
        $PAGE->navbar->add(userdate($time, get_string('strftimedate')));
        $pagetitle = get_string('dayview', 'calendar');
        break;
    case 'month':
        $PAGE->navbar->add(userdate($time, get_string('strftimemonthyear')));
        $pagetitle = get_string('detailedmonthview', 'calendar');
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:31,代码来源:view.php

示例13: calendar_format_event_time

function calendar_format_event_time($event, $now, $morehref, $usecommonwords = true)
{
    $startdate = usergetdate($event->timestart);
    $enddate = usergetdate($event->timestart + $event->timeduration);
    $usermidnightstart = usergetmidnight($event->timestart);
    if ($event->timeduration) {
        // To avoid doing the math if one IF is enough :)
        $usermidnightend = usergetmidnight($event->timestart + $event->timeduration);
    } else {
        $usermidnightend = $usermidnightstart;
    }
    // OK, now to get a meaningful display...
    // First of all we have to construct a human-readable date/time representation
    if ($event->timestart + $event->timeduration < $now) {
        // It has expired, so we don't care about duration
        $day = calendar_day_representation($event->timestart + $event->timeduration, $now, $usecommonwords);
        $time = calendar_time_representation($event->timestart + $event->timeduration);
        // This var always has the printable time representation
        $eventtime = '<span class="dimmed_text"><a class="dimmed" href="' . calendar_get_link_href(CALENDAR_URL . 'view.php?view=day' . $morehref . '&amp;', $enddate['mday'], $enddate['mon'], $enddate['year']) . '">' . $day . '</a> (' . $time . ')</span>';
    } else {
        if ($event->timeduration) {
            // It has a duration
            if ($usermidnightstart == $usermidnightend) {
                // But it's all on the same day
                $day = calendar_day_representation($event->timestart, $now, $usecommonwords);
                $timestart = calendar_time_representation($event->timestart);
                $timeend = calendar_time_representation($event->timestart + $event->timeduration);
                // Set printable representation
                $eventtime = calendar_get_link_tag($day, CALENDAR_URL . 'view.php?view=day' . $morehref . '&amp;', $enddate['mday'], $enddate['mon'], $enddate['year']) . ' (' . $timestart . ' <strong>&raquo;</strong> ' . $timeend . ')';
            } else {
                // It spans two or more days
                $daystart = calendar_day_representation($event->timestart, $now, $usecommonwords);
                $dayend = calendar_day_representation($event->timestart + $event->timeduration, $now, $usecommonwords);
                $timestart = calendar_time_representation($event->timestart);
                $timeend = calendar_time_representation($event->timestart + $event->timeduration);
                // Set printable representation
                $eventtime = calendar_get_link_tag($daystart, CALENDAR_URL . 'view.php?view=day' . $morehref . '&amp;', $startdate['mday'], $startdate['mon'], $startdate['year']) . ' (' . $timestart . ') <strong>&raquo;</strong> ' . calendar_get_link_tag($dayend, CALENDAR_URL . 'view.php?view=day' . $morehref . '&amp;', $enddate['mday'], $enddate['mon'], $enddate['year']) . ' (' . $timeend . ')';
            }
        } else {
            // It's an "instantaneous" event
            $day = calendar_day_representation($event->timestart, $now, $usecommonwords);
            $time = calendar_time_representation($event->timestart);
            // Set printable representation
            $eventtime = calendar_get_link_tag($day, CALENDAR_URL . 'view.php?view=day' . $morehref . '&amp;', $startdate['mday'], $startdate['mon'], $startdate['year']) . ' (' . $time . ')';
        }
    }
    return $eventtime;
}
开发者ID:veritech,项目名称:pare-project,代码行数:48,代码来源:lib.php


注:本文中的calendar_get_link_href函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。