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


PHP calendar_sub_month函数代码示例

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


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

示例1: fake_block_threemonths

 /**
  * Produces the content for the three months block (pretend block)
  *
  * This includes the previous month, the current month, and the next month
  *
  * @param calendar_information $calendar
  * @return string
  */
 public function fake_block_threemonths(calendar_information $calendar)
 {
     // Get the calendar type we are using.
     $calendartype = \core_calendar\type_factory::get_calendar_instance();
     $date = $calendartype->timestamp_to_date_array($calendar->time);
     $prevmonth = calendar_sub_month($date['mon'], $date['year']);
     $prevmonthtime = $calendartype->convert_to_gregorian($prevmonth[1], $prevmonth[0], 1);
     $prevmonthtime = make_timestamp($prevmonthtime['year'], $prevmonthtime['month'], $prevmonthtime['day'], $prevmonthtime['hour'], $prevmonthtime['minute']);
     $nextmonth = calendar_add_month($date['mon'], $date['year']);
     $nextmonthtime = $calendartype->convert_to_gregorian($nextmonth[1], $nextmonth[0], 1);
     $nextmonthtime = make_timestamp($nextmonthtime['year'], $nextmonthtime['month'], $nextmonthtime['day'], $nextmonthtime['hour'], $nextmonthtime['minute']);
     $content = html_writer::start_tag('div', array('class' => 'minicalendarblock'));
     $content .= calendar_get_mini($calendar->courses, $calendar->groups, $calendar->users, false, false, 'display', $calendar->courseid, $prevmonthtime);
     $content .= html_writer::end_tag('div');
     $content .= html_writer::start_tag('div', array('class' => 'minicalendarblock'));
     $content .= calendar_get_mini($calendar->courses, $calendar->groups, $calendar->users, false, false, 'display', $calendar->courseid, $calendar->time);
     $content .= html_writer::end_tag('div');
     $content .= html_writer::start_tag('div', array('class' => 'minicalendarblock'));
     $content .= calendar_get_mini($calendar->courses, $calendar->groups, $calendar->users, false, false, 'display', $calendar->courseid, $nextmonthtime);
     $content .= html_writer::end_tag('div');
     return $content;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:30,代码来源:renderer.php

示例2: calendar_top_controls

function calendar_top_controls($type, $data)
{
    global $CFG, $CALENDARDAYS, $THEME;
    $content = '';
    if (!isset($data['d'])) {
        $data['d'] = 1;
    }
    // Ensure course id passed if relevant
    // Required due to changes in view/lib.php mainly (calendar_session_vars())
    $courseid = '';
    if (!empty($data['id'])) {
        $courseid = '&course=' . $data['id'];
    }
    if (!checkdate($data['m'], $data['d'], $data['y'])) {
        $time = time();
    } else {
        $time = make_timestamp($data['y'], $data['m'], $data['d']);
    }
    $date = usergetdate($time);
    $data['m'] = $date['mon'];
    $data['y'] = $date['year'];
    //Accessibility: calendar block controls, replaced <table> with <div>.
    //$nexttext = link_arrow_right(get_string('monthnext', 'access'), $url='', $accesshide=true);
    //$prevtext = link_arrow_left(get_string('monthprev', 'access'), $url='', $accesshide=true);
    switch ($type) {
        case 'frontpage':
            list($prevmonth, $prevyear) = calendar_sub_month($data['m'], $data['y']);
            list($nextmonth, $nextyear) = calendar_add_month($data['m'], $data['y']);
            $nextlink = calendar_get_link_next(get_string('monthnext', 'access'), 'index.php?', 0, $nextmonth, $nextyear, $accesshide = true);
            $prevlink = calendar_get_link_previous(get_string('monthprev', 'access'), 'index.php?', 0, $prevmonth, $prevyear, true);
            $content .= "\n" . '<div class="calendar-controls">' . $prevlink;
            $content .= '<span class="hide"> | </span><span class="current"><a href="' . calendar_get_link_href(CALENDAR_URL . 'view.php?view=month' . $courseid . '&amp;', 1, $data['m'], $data['y']) . '">' . userdate($time, get_string('strftimemonthyear')) . '</a></span>';
            $content .= '<span class="hide"> | </span>' . $nextlink . "\n";
            $content .= "<span class=\"clearer\"><!-- --></span></div>\n";
            break;
        case 'course':
            list($prevmonth, $prevyear) = calendar_sub_month($data['m'], $data['y']);
            list($nextmonth, $nextyear) = calendar_add_month($data['m'], $data['y']);
            $nextlink = calendar_get_link_next(get_string('monthnext', 'access'), 'view.php?id=' . $data['id'] . '&amp;', 0, $nextmonth, $nextyear, $accesshide = true);
            $prevlink = calendar_get_link_previous(get_string('monthprev', 'access'), 'view.php?id=' . $data['id'] . '&amp;', 0, $prevmonth, $prevyear, true);
            $content .= "\n" . '<div class="calendar-controls">' . $prevlink;
            $content .= '<span class="hide"> | </span><span class="current"><a href="' . calendar_get_link_href(CALENDAR_URL . 'view.php?view=month' . $courseid . '&amp;', 1, $data['m'], $data['y']) . '">' . userdate($time, get_string('strftimemonthyear')) . '</a></span>';
            $content .= '<span class="hide"> | </span>' . $nextlink . "\n";
            $content .= "<span class=\"clearer\"><!-- --></span></div>\n";
            break;
        case 'upcoming':
            $content .= '<div style="text-align: center;"><a href="' . CALENDAR_URL . 'view.php?view=upcoming"' . $courseid . '>' . userdate($time, get_string('strftimemonthyear')) . "</a></div>\n";
            break;
        case 'display':
            $content .= '<div style="text-align: center;"><a href="' . calendar_get_link_href(CALENDAR_URL . 'view.php?view=month' . $courseid . '&amp;', 1, $data['m'], $data['y']) . '">' . userdate($time, get_string('strftimemonthyear')) . "</a></div>\n";
            break;
        case 'month':
            list($prevmonth, $prevyear) = calendar_sub_month($data['m'], $data['y']);
            list($nextmonth, $nextyear) = calendar_add_month($data['m'], $data['y']);
            $prevdate = make_timestamp($prevyear, $prevmonth, 1);
            $nextdate = make_timestamp($nextyear, $nextmonth, 1);
            $content .= "\n" . '<div class="calendar-controls">';
            $content .= calendar_get_link_previous(userdate($prevdate, get_string('strftimemonthyear')), 'view.php?view=month' . $courseid . '&amp;', 1, $prevmonth, $prevyear);
            $content .= '<span class="hide"> | </span><span class="current">' . userdate($time, get_string('strftimemonthyear')) . "</span>\n";
            $content .= '<span class="hide"> | </span>' . calendar_get_link_next(userdate($nextdate, get_string('strftimemonthyear')), 'view.php?view=month' . $courseid . '&amp;', 1, $nextmonth, $nextyear);
            $content .= "<span class=\"clearer\"><!-- --></span></div>\n";
            break;
        case 'day':
            $data['d'] = $date['mday'];
            // Just for convenience
            $prevdate = usergetdate(make_timestamp($data['y'], $data['m'], $data['d'] - 1));
            $nextdate = usergetdate(make_timestamp($data['y'], $data['m'], $data['d'] + 1));
            $prevname = calendar_wday_name($CALENDARDAYS[$prevdate['wday']]);
            $nextname = calendar_wday_name($CALENDARDAYS[$nextdate['wday']]);
            $content .= "\n" . '<div class="calendar-controls">';
            $content .= calendar_get_link_previous($prevname, 'view.php?view=day' . $courseid . '&amp;', $prevdate['mday'], $prevdate['mon'], $prevdate['year']);
            // Get the format string
            $text = get_string('strftimedaydate');
            /*
            // Regexp hackery to make a link out of the month/year part
            $text = ereg_replace('(%B.+%Y|%Y.+%B|%Y.+%m[^ ]+)', '<a href="'.calendar_get_link_href('view.php?view=month&amp;', 1, $data['m'], $data['y']).'">\\1</a>', $text);
            $text = ereg_replace('(F.+Y|Y.+F|Y.+m[^ ]+)', '<a href="'.calendar_get_link_href('view.php?view=month&amp;', 1, $data['m'], $data['y']).'">\\1</a>', $text);
            */
            // Replace with actual values and lose any day leading zero
            $text = userdate($time, $text);
            // Print the actual thing
            $content .= '<span class="hide"> | </span><span class="current">' . $text . '</span>';
            $content .= '<span class="hide"> | </span>' . calendar_get_link_next($nextname, 'view.php?view=day' . $courseid . '&amp;', $nextdate['mday'], $nextdate['mon'], $nextdate['year']);
            $content .= "<span class=\"clearer\"><!-- --></span></div>\n";
            break;
    }
    return $content;
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:88,代码来源:lib.php

示例3: core_functions_test

 /**
  * Test all the core functions that use the calendar type system.
  *
  * @param string $type the calendar type we want to test
  */
 private function core_functions_test($type)
 {
     $this->set_calendar_type($type);
     // Get the calendar.
     $calendar = \core_calendar\type_factory::get_calendar_instance();
     // Test the userdate function.
     $this->assertEquals($calendar->timestamp_to_date_string($this->user->timecreated, '', 99, true, true), userdate($this->user->timecreated));
     // Test the calendar/lib.php functions.
     $this->assertEquals($calendar->get_weekdays(), calendar_get_days());
     $this->assertEquals($calendar->get_starting_weekday(), calendar_get_starting_weekday());
     $this->assertEquals($calendar->get_num_days_in_month('1986', '9'), calendar_days_in_month('9', '1986'));
     $this->assertEquals($calendar->get_next_month('1986', '9'), calendar_add_month('9', '1986'));
     $this->assertEquals($calendar->get_prev_month('1986', '9'), calendar_sub_month('9', '1986'));
     // Test the lib/moodle.php functions.
     $this->assertEquals($calendar->get_num_days_in_month('1986', '9'), days_in_month('9', '1986'));
     $this->assertEquals($calendar->get_weekday('1986', '9', '16'), dayofweek('16', '9', '1986'));
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:22,代码来源:calendartype_test.php

示例4: calendar_top_controls

/**
 * Get control options for Calendar
 *
 * @param string $type of calendar
 * @param array $data calendar information
 * @return string $content return available control for the calender in html
 */
function calendar_top_controls($type, $data)
{
    global $PAGE;
    // Get the calendar type we are using.
    $calendartype = \core_calendar\type_factory::get_calendar_instance();
    $content = '';
    // Ensure course id passed if relevant.
    $courseid = '';
    if (!empty($data['id'])) {
        $courseid = '&amp;course=' . $data['id'];
    }
    // If we are passing a month and year then we need to convert this to a timestamp to
    // support multiple calendars. No where in core should these be passed, this logic
    // here is for third party plugins that may use this function.
    if (!empty($data['m']) && !empty($date['y'])) {
        if (!isset($data['d'])) {
            $data['d'] = 1;
        }
        if (!checkdate($data['m'], $data['d'], $data['y'])) {
            $time = time();
        } else {
            $time = make_timestamp($data['y'], $data['m'], $data['d']);
        }
    } else {
        if (!empty($data['time'])) {
            $time = $data['time'];
        } else {
            $time = time();
        }
    }
    // Get the date for the calendar type.
    $date = $calendartype->timestamp_to_date_array($time);
    $urlbase = $PAGE->url;
    // We need to get the previous and next months in certain cases.
    if ($type == 'frontpage' || $type == 'course' || $type == 'month') {
        $prevmonth = calendar_sub_month($date['mon'], $date['year']);
        $prevmonthtime = $calendartype->convert_to_gregorian($prevmonth[1], $prevmonth[0], 1);
        $prevmonthtime = make_timestamp($prevmonthtime['year'], $prevmonthtime['month'], $prevmonthtime['day'], $prevmonthtime['hour'], $prevmonthtime['minute']);
        $nextmonth = calendar_add_month($date['mon'], $date['year']);
        $nextmonthtime = $calendartype->convert_to_gregorian($nextmonth[1], $nextmonth[0], 1);
        $nextmonthtime = make_timestamp($nextmonthtime['year'], $nextmonthtime['month'], $nextmonthtime['day'], $nextmonthtime['hour'], $nextmonthtime['minute']);
    }
    switch ($type) {
        case 'frontpage':
            $prevlink = calendar_get_link_previous(get_string('monthprev', 'access'), $urlbase, false, false, false, true, $prevmonthtime);
            $nextlink = calendar_get_link_next(get_string('monthnext', 'access'), $urlbase, false, false, false, true, $nextmonthtime);
            $calendarlink = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', array('view' => 'month')), false, false, false, $time);
            if (!empty($data['id'])) {
                $calendarlink->param('course', $data['id']);
            }
            if (right_to_left()) {
                $left = $nextlink;
                $right = $prevlink;
            } else {
                $left = $prevlink;
                $right = $nextlink;
            }
            $content .= html_writer::start_tag('div', array('class' => 'calendar-controls'));
            $content .= $left . '<span class="hide"> | </span>';
            $content .= html_writer::tag('span', html_writer::link($calendarlink, userdate($time, get_string('strftimemonthyear')), array('title' => get_string('monththis', 'calendar'))), array('class' => 'current'));
            $content .= '<span class="hide"> | </span>' . $right;
            $content .= "<span class=\"clearer\"><!-- --></span>\n";
            $content .= html_writer::end_tag('div');
            break;
        case 'course':
            $prevlink = calendar_get_link_previous(get_string('monthprev', 'access'), $urlbase, false, false, false, true, $prevmonthtime);
            $nextlink = calendar_get_link_next(get_string('monthnext', 'access'), $urlbase, false, false, false, true, $nextmonthtime);
            $calendarlink = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', array('view' => 'month')), false, false, false, $time);
            if (!empty($data['id'])) {
                $calendarlink->param('course', $data['id']);
            }
            if (right_to_left()) {
                $left = $nextlink;
                $right = $prevlink;
            } else {
                $left = $prevlink;
                $right = $nextlink;
            }
            $content .= html_writer::start_tag('div', array('class' => 'calendar-controls'));
            $content .= $left . '<span class="hide"> | </span>';
            $content .= html_writer::tag('span', html_writer::link($calendarlink, userdate($time, get_string('strftimemonthyear')), array('title' => get_string('monththis', 'calendar'))), array('class' => 'current'));
            $content .= '<span class="hide"> | </span>' . $right;
            $content .= "<span class=\"clearer\"><!-- --></span>";
            $content .= html_writer::end_tag('div');
            break;
        case 'upcoming':
            $calendarlink = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', array('view' => 'upcoming')), false, false, false, $time);
            if (!empty($data['id'])) {
                $calendarlink->param('course', $data['id']);
            }
            $calendarlink = html_writer::link($calendarlink, userdate($time, get_string('strftimemonthyear')));
            $content .= html_writer::tag('div', $calendarlink, array('class' => 'centered'));
            break;
//.........这里部分代码省略.........
开发者ID:miguelangelUvirtual,项目名称:uEducon,代码行数:101,代码来源:lib.php

示例5: use_html_editor

        } else {
            include 'event_new.html';
            if ($usehtmleditor) {
                use_html_editor("description");
            }
        }
        break;
}
echo '</td>';
// START: Last column (3-month display)
$defaultcourses = calendar_get_default_courses();
//calendar_set_filters($courses, $groups, $users, $defaultcourses, $defaultcourses);
// when adding an event you can not be a guest, so I think it's reasonalbe to ignore defaultcourses
// MDL-10353
calendar_set_filters($courses, $groups, $users);
list($prevmon, $prevyr) = calendar_sub_month($mon, $yr);
list($nextmon, $nextyr) = calendar_add_month($mon, $yr);
echo '<td class="sidecalendar">';
echo '<div class="sideblock">';
echo '<div class="header"><h2>' . get_string('eventskey', 'calendar') . '</h2></div>';
echo '<div class="filters">';
echo calendar_filter_controls('event', 'action=' . $action . '&amp;type=' . $eventtype . '&amp;id=' . $eventid);
echo '</div>';
echo '</div>';
echo '<div class="sideblock">';
echo '<div class="header"><h2>' . get_string('monthlyview', 'calendar') . '</h2></div>';
echo '<div class="minicalendarblock minicalendartop">';
echo calendar_top_controls('display', array('id' => $urlcourse, 'm' => $prevmon, 'y' => $prevyr));
echo calendar_get_mini($courses, $groups, $users, $prevmon, $prevyr);
echo '</div><div class="minicalendarblock">';
echo calendar_top_controls('display', array('id' => $urlcourse, 'm' => $mon, 'y' => $yr));
开发者ID:NextEinstein,项目名称:riverhills,代码行数:31,代码来源:event.php

示例6: calendar_top_controls

/**
 * Get control options for Calendar
 *
 * @param string $type of calendar
 * @param array $data calendar information
 * @return string $content return available control for the calender in html
 */
function calendar_top_controls($type, $data)
{
    global $CFG;
    $content = '';
    if (!isset($data['d'])) {
        $data['d'] = 1;
    }
    // Ensure course id passed if relevant
    // Required due to changes in view/lib.php mainly (calendar_session_vars())
    $courseid = '';
    if (!empty($data['id'])) {
        $courseid = '&amp;course=' . $data['id'];
    }
    if (!checkdate($data['m'], $data['d'], $data['y'])) {
        $time = time();
    } else {
        $time = make_timestamp($data['y'], $data['m'], $data['d']);
    }
    $date = usergetdate($time);
    $data['m'] = $date['mon'];
    $data['y'] = $date['year'];
    //Accessibility: calendar block controls, replaced <table> with <div>.
    //$nexttext = link_arrow_right(get_string('monthnext', 'access'), $url='', $accesshide=true);
    //$prevtext = link_arrow_left(get_string('monthprev', 'access'), $url='', $accesshide=true);
    switch ($type) {
        case 'frontpage':
            list($prevmonth, $prevyear) = calendar_sub_month($data['m'], $data['y']);
            list($nextmonth, $nextyear) = calendar_add_month($data['m'], $data['y']);
            $nextlink = calendar_get_link_next(get_string('monthnext', 'access'), 'index.php?', 0, $nextmonth, $nextyear, $accesshide = true);
            $prevlink = calendar_get_link_previous(get_string('monthprev', 'access'), 'index.php?', 0, $prevmonth, $prevyear, true);
            $calendarlink = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', array('view' => 'month')), 1, $data['m'], $data['y']);
            if (!empty($data['id'])) {
                $calendarlink->param('course', $data['id']);
            }
            if (right_to_left()) {
                $left = $nextlink;
                $right = $prevlink;
            } else {
                $left = $prevlink;
                $right = $nextlink;
            }
            $content .= html_writer::start_tag('div', array('class' => 'calendar-controls'));
            $content .= $left . '<span class="hide"> | </span>';
            $content .= html_writer::tag('span', html_writer::link($calendarlink, userdate($time, get_string('strftimemonthyear')), array('title' => get_string('monththis', 'calendar'))), array('class' => 'current'));
            $content .= '<span class="hide"> | </span>' . $right;
            $content .= "<span class=\"clearer\"><!-- --></span>\n";
            $content .= html_writer::end_tag('div');
            break;
        case 'course':
            list($prevmonth, $prevyear) = calendar_sub_month($data['m'], $data['y']);
            list($nextmonth, $nextyear) = calendar_add_month($data['m'], $data['y']);
            $nextlink = calendar_get_link_next(get_string('monthnext', 'access'), 'view.php?id=' . $data['id'] . '&amp;', 0, $nextmonth, $nextyear, $accesshide = true);
            $prevlink = calendar_get_link_previous(get_string('monthprev', 'access'), 'view.php?id=' . $data['id'] . '&amp;', 0, $prevmonth, $prevyear, true);
            $calendarlink = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', array('view' => 'month')), 1, $data['m'], $data['y']);
            if (!empty($data['id'])) {
                $calendarlink->param('course', $data['id']);
            }
            if (right_to_left()) {
                $left = $nextlink;
                $right = $prevlink;
            } else {
                $left = $prevlink;
                $right = $nextlink;
            }
            $content .= html_writer::start_tag('div', array('class' => 'calendar-controls'));
            $content .= $left . '<span class="hide"> | </span>';
            $content .= html_writer::tag('span', html_writer::link($calendarlink, userdate($time, get_string('strftimemonthyear')), array('title' => get_string('monththis', 'calendar'))), array('class' => 'current'));
            $content .= '<span class="hide"> | </span>' . $right;
            $content .= "<span class=\"clearer\"><!-- --></span>";
            $content .= html_writer::end_tag('div');
            break;
        case 'upcoming':
            $calendarlink = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', array('view' => 'upcoming')), 1, $data['m'], $data['y']);
            if (!empty($data['id'])) {
                $calendarlink->param('course', $data['id']);
            }
            $calendarlink = html_writer::link($calendarlink, userdate($time, get_string('strftimemonthyear')));
            $content .= html_writer::tag('div', $calendarlink, array('class' => 'centered'));
            break;
        case 'display':
            $calendarlink = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', array('view' => 'month')), 1, $data['m'], $data['y']);
            if (!empty($data['id'])) {
                $calendarlink->param('course', $data['id']);
            }
            $calendarlink = html_writer::link($calendarlink, userdate($time, get_string('strftimemonthyear')));
            $content .= html_writer::tag('h3', $calendarlink);
            break;
        case 'month':
            list($prevmonth, $prevyear) = calendar_sub_month($data['m'], $data['y']);
            list($nextmonth, $nextyear) = calendar_add_month($data['m'], $data['y']);
            $prevdate = make_timestamp($prevyear, $prevmonth, 1);
            $nextdate = make_timestamp($nextyear, $nextmonth, 1);
            $prevlink = calendar_get_link_previous(userdate($prevdate, get_string('strftimemonthyear')), 'view.php?view=month' . $courseid . '&amp;', 1, $prevmonth, $prevyear);
//.........这里部分代码省略.........
开发者ID:JP-Git,项目名称:moodle,代码行数:101,代码来源:lib.php

示例7: fake_block_threemonths

 /**
  * Produces the content for the three months block (pretend block)
  *
  * This includes the previous month, the current month, and the next month
  *
  * @param calendar_information $calendar
  * @return string
  */
 public function fake_block_threemonths(calendar_information $calendar)
 {
     list($prevmon, $prevyr) = calendar_sub_month($calendar->month, $calendar->year);
     list($nextmon, $nextyr) = calendar_add_month($calendar->month, $calendar->year);
     $content = html_writer::start_tag('div', array('class' => 'minicalendarblock'));
     $content .= calendar_top_controls('display', array('id' => $calendar->courseid, 'm' => $prevmon, 'y' => $prevyr));
     $content .= calendar_get_mini($calendar->courses, $calendar->groups, $calendar->users, $prevmon, $prevyr);
     $content .= html_writer::end_tag('div');
     $content .= html_writer::start_tag('div', array('class' => 'minicalendarblock'));
     $content .= calendar_top_controls('display', array('id' => $calendar->courseid, 'm' => $calendar->month, 'y' => $calendar->year));
     $content .= calendar_get_mini($calendar->courses, $calendar->groups, $calendar->users, $calendar->month, $calendar->year);
     $content .= html_writer::end_tag('div');
     $content .= html_writer::start_tag('div', array('class' => 'minicalendarblock'));
     $content .= calendar_top_controls('display', array('id' => $calendar->courseid, 'm' => $nextmon, 'y' => $nextyr));
     $content .= calendar_get_mini($calendar->courses, $calendar->groups, $calendar->users, $nextmon, $nextyr);
     $content .= html_writer::end_tag('div');
     return $content;
 }
开发者ID:rosenclever,项目名称:moodle,代码行数:26,代码来源:renderer.php

示例8: top_controls

function top_controls($month, $year) {
    global $OUTPUT, $currenttab;

    $content = '';

    $time = make_timestamp($year, $month, 1);
    $date = usergetdate($time);

    $data['m'] = $date['mon'];
    $data['y'] = $date['year'];

    list($prevmonth, $prevyear) = calendar_sub_month($data['m'], $data['y']);
    list($nextmonth, $nextyear) = calendar_add_month($data['m'], $data['y']);
    $prevdate = make_timestamp($prevyear, $prevmonth, 1);
    $nextdate = make_timestamp($nextyear, $nextmonth, 1);
    $content .= $OUTPUT->container_start('calendar-controls');
    $content .= html_writer::start_tag('table', array('summary' => '')) . html_writer::start_tag('tr') . html_writer::start_tag('td');
    $content .= calendar_get_link_previous(userdate($prevdate, get_string('strftimemonthyear')), "calendar.php?tab=$currenttab&amp;", 1, $prevmonth, $prevyear);
    $content .= html_writer::end_tag('td') . html_writer::tag('td', html_writer::tag('span', '|', array('class' => 'hide')) . html_writer::tag('span', userdate($time, get_string('strftimemonthyear')), array('class' => 'current')), array('align' => 'center'));
    $content .= html_writer::tag('td', html_writer::tag('span', '|', array('class' => 'hide')) . calendar_get_link_next(userdate($nextdate, get_string('strftimemonthyear')), "calendar.php?tab=$currenttab&amp;", 1, $nextmonth, $nextyear) . html_writer::tag('span', '<!-- -->', array('class' => 'clearer')), array('align' => 'right'));
    $content .= html_writer::end_tag('tr') . html_writer::end_tag('table');
    $content .= $OUTPUT->container_end() . "\n";
    return $content;
}
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:24,代码来源:calendar.php


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