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


PHP calendar_user_can_add_event函数代码示例

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


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

示例1: moodle_url

if ($courseid != SITEID) {
    $url->param('course', $courseid);
}
navigation_node::override_active_url(new moodle_url('/calendar/view.php', array('view' => 'month')));
$PAGE->set_url($url);
$PAGE->set_pagelayout('standard');
$PAGE->navbar->add(get_string('managesubscriptions', 'calendar'));
if ($courseid != SITEID && !empty($courseid)) {
    $course = $DB->get_record('course', array('id' => $courseid));
    $courses = array($course->id => $course);
} else {
    $course = get_site();
    $courses = calendar_get_default_courses();
}
require_course_login($course);
if (!calendar_user_can_add_event($course)) {
    print_error('errorcannotimport', 'calendar');
}
$form = new calendar_addsubscription_form(null);
$form->set_data(array('course' => $course->id));
$importresults = '';
$formdata = $form->get_data();
if (!empty($formdata)) {
    require_sesskey();
    // Must have sesskey for all actions.
    $subscriptionid = calendar_add_subscription($formdata);
    if ($formdata->importfrom == CALENDAR_IMPORT_FROM_FILE) {
        // Blank the URL if it's a file import.
        $formdata->url = '';
        $calendar = $form->get_file_content('importfile');
        $ical = new iCalendar();
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:managesubscriptions.php

示例2: show_upcoming_events

 /**
  * Displays upcoming events
  *
  * @param calendar_information $calendar
  * @param int $futuredays
  * @param int $maxevents
  * @return string
  */
 public function show_upcoming_events(calendar_information $calendar, $futuredays, $maxevents, moodle_url $returnurl = null)
 {
     if ($returnurl === null) {
         $returnurl = $this->page->url;
     }
     $events = calendar_get_upcoming($calendar->courses, $calendar->groups, $calendar->users, $futuredays, $maxevents);
     $output = html_writer::start_tag('div', array('class' => 'header'));
     $output .= $this->course_filter_selector($returnurl, get_string('upcomingeventsfor', 'calendar'));
     if (calendar_user_can_add_event($calendar->course)) {
         $output .= $this->add_event_button($calendar->course->id);
     }
     $output .= html_writer::end_tag('div');
     if ($events) {
         $output .= html_writer::start_tag('div', array('class' => 'eventlist'));
         foreach ($events as $event) {
             // Convert to calendar_event object so that we transform description
             // accordingly
             $event = new calendar_event($event);
             $event->calendarcourseid = $calendar->courseid;
             $output .= $this->event($event);
         }
         $output .= html_writer::end_tag('div');
     } else {
         $output .= $this->output->heading(get_string('noupcomingevents', 'calendar'));
     }
     return $output;
 }
开发者ID:abhilash1994,项目名称:moodle,代码行数:35,代码来源:renderer.php

示例3: show_upcoming_events

 /**
  * Displays upcoming events
  *
  * @param calendar_information $calendar
  * @param int $futuredays
  * @param int $maxevents
  * @return string
  */
 public function show_upcoming_events(calendar_information $calendar, $futuredays, $maxevents)
 {
     $events = calendar_get_upcoming($calendar->courses, $calendar->groups, $calendar->users, $futuredays, $maxevents);
     $output = html_writer::start_tag('div', array('class' => 'header'));
     if (!isguestuser() && isloggedin() && calendar_user_can_add_event()) {
         $output .= $this->add_event_button($calendar->courseid);
     }
     $output .= html_writer::tag('label', get_string('upcomingevents', 'calendar'), array('for' => 'cal_course_flt_jump'));
     $output .= $this->course_filter_selector(array('from' => 'upcoming'));
     $output .= html_writer::end_tag('div');
     if ($events) {
         $output .= html_writer::start_tag('div', array('class' => 'eventlist'));
         foreach ($events as $event) {
             // Convert to calendar_event object so that we transform description
             // accordingly
             $event = new calendar_event($event);
             $event->calendarcourseid = $calendar->courseid;
             $output .= $this->event($event);
         }
         $output .= html_writer::end_tag('div');
     } else {
         $output .= $this->output->heading(get_string('noupcomingevents', 'calendar'));
     }
     return $output;
 }
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:33,代码来源:renderer.php

示例4: calendar_show_upcoming_events

function calendar_show_upcoming_events($courses, $groups, $users, $futuredays, $maxevents, $courseid)
{
    global $USER;
    $events = calendar_get_upcoming($courses, $groups, $users, $futuredays, $maxevents);
    $text = '';
    if (!isguest() && !empty($USER->id) && calendar_user_can_add_event()) {
        $text .= '<div class="buttons">';
        $text .= '<form action="' . CALENDAR_URL . 'event.php" method="get">';
        $text .= '<div>';
        $text .= '<input type="hidden" name="action" value="new" />';
        $text .= '<input type="hidden" name="course" value="' . $courseid . '" />';
        /*
        $text.= '<input type="hidden" name="cal_m" value="'.$m.'" />';
        $text.= '<input type="hidden" name="cal_y" value="'.$y.'" />';
        */
        $text .= '<input type="submit" value="' . get_string('newevent', 'calendar') . '" />';
        $text .= '</div></form></div>';
    }
    $text .= get_string('upcomingevents', 'calendar') . ': ' . calendar_course_filter_selector('from=upcoming');
    echo '<div class="header">' . $text . '</div>';
    if ($events) {
        echo '<div class="eventlist">';
        foreach ($events as $event) {
            $event->calendarcourseid = $courseid;
            calendar_print_event($event);
        }
        echo '</div>';
    } else {
        print_heading(get_string('noupcomingevents', 'calendar'));
    }
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:31,代码来源:view.php

示例5: calendar_show_month_detailed

function calendar_show_month_detailed($m, $y, $courses, $groups, $users, $courseid)
{
    global $CFG, $SESSION, $USER, $CALENDARDAYS;
    global $day, $mon, $yr;
    $getvars = 'from=month&amp;cal_d=' . $day . '&amp;cal_m=' . $mon . '&amp;cal_y=' . $yr;
    // For filtering
    $display =& new stdClass();
    $display->minwday = get_user_preferences('calendar_startwday', CALENDAR_STARTING_WEEKDAY);
    $display->maxwday = $display->minwday + 6;
    if (!empty($m) && !empty($y)) {
        $thisdate = usergetdate(time());
        // Time and day at the user's location
        if ($m == $thisdate['mon'] && $y == $thisdate['year']) {
            // Navigated to this month
            $date = $thisdate;
            $display->thismonth = true;
        } else {
            // Navigated to other month, let's do a nice trick and save us a lot of work...
            if (!checkdate($m, 1, $y)) {
                $date = array('mday' => 1, 'mon' => $thisdate['mon'], 'year' => $thisdate['year']);
                $display->thismonth = true;
            } else {
                $date = array('mday' => 1, 'mon' => $m, 'year' => $y);
                $display->thismonth = false;
            }
        }
    } else {
        $date = usergetdate(time());
        $display->thismonth = true;
    }
    // Fill in the variables we 're going to use, nice and tidy
    list($d, $m, $y) = array($date['mday'], $date['mon'], $date['year']);
    // This is what we want to display
    $display->maxdays = calendar_days_in_month($m, $y);
    $startwday = 0;
    if (get_user_timezone_offset() < 99) {
        // We 'll keep these values as GMT here, and offset them when the time comes to query the db
        $display->tstart = gmmktime(0, 0, 0, $m, 1, $y);
        // This is GMT
        $display->tend = gmmktime(23, 59, 59, $m, $display->maxdays, $y);
        // GMT
        $startwday = gmdate('w', $display->tstart);
        // $display->tstart is already GMT, so don't use date(): messes with server's TZ
    } else {
        // no timezone info specified
        $display->tstart = mktime(0, 0, 0, $m, 1, $y);
        $display->tend = mktime(23, 59, 59, $m, $display->maxdays, $y);
        $startwday = date('w', $display->tstart);
        // $display->tstart not necessarily GMT, so use date()
    }
    // Align the starting weekday to fall in our display range
    if ($startwday < $display->minwday) {
        $startwday += 7;
    }
    // Get events from database
    $events = calendar_get_events(usertime($display->tstart), usertime($display->tend), $users, $groups, $courses);
    if (!empty($events)) {
        foreach ($events as $eventid => $event) {
            if (!empty($event->modulename)) {
                $cm = get_coursemodule_from_instance($event->modulename, $event->instance);
                if (!groups_course_module_visible($cm)) {
                    unset($events[$eventid]);
                }
            }
        }
    }
    // Extract information: events vs. time
    calendar_events_by_day($events, $m, $y, $eventsbyday, $durationbyday, $typesbyday, $courses);
    $text = '';
    if (!isguest() && !empty($USER->id) && calendar_user_can_add_event()) {
        $text .= '<div class="buttons"><form action="' . CALENDAR_URL . 'event.php" method="get">';
        $text .= '<div>';
        $text .= '<input type="hidden" name="action" value="new" />';
        $text .= '<input type="hidden" name="course" value="' . $courseid . '" />';
        $text .= '<input type="hidden" name="cal_m" value="' . $m . '" />';
        $text .= '<input type="hidden" name="cal_y" value="' . $y . '" />';
        $text .= '<input type="submit" value="' . get_string('newevent', 'calendar') . '" />';
        $text .= '</div></form></div>';
    }
    //    $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('course', array('id' => $courseshown, 'm' => $cal_m, 'y' => $cal_y));
    echo calendar_top_controls('course', 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.
//.........这里部分代码省略.........
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:format.php


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