mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 16:04:25 +02:00
Merge branch 'MDL-66612-master' of git://github.com/crazyserver/moodle
This commit is contained in:
commit
c3f726a0e5
@ -26,7 +26,7 @@ Feature: Enable the calendar block in a course and test it's functionality
|
||||
Then "Calendar" "block" should exist
|
||||
|
||||
@javascript
|
||||
Scenario: View a global event in the calendar block
|
||||
Scenario: View a site event in the calendar block
|
||||
Given I log in as "admin"
|
||||
And I create a calendar event with form data:
|
||||
| id_eventtype | Site |
|
||||
@ -52,7 +52,7 @@ Feature: Enable the calendar block in a course and test it's functionality
|
||||
| id_eventtype | Course |
|
||||
| id_name | Course Event |
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Hide global events"
|
||||
And I follow "Hide site events"
|
||||
And I hover over today in the calendar
|
||||
Then I should not see "Site Event"
|
||||
And I should see "Course Event"
|
||||
|
@ -5,7 +5,7 @@ Feature: Enable the calendar block in a course
|
||||
I can add the calendar block to a course
|
||||
|
||||
@javascript
|
||||
Scenario: View a global event in the calendar block in a course
|
||||
Scenario: View a site event in the calendar block in a course
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email | idnumber |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
|
||||
|
@ -5,7 +5,7 @@ Feature: View a site event on the dashboard
|
||||
I can view the event in the calendar
|
||||
|
||||
@javascript
|
||||
Scenario: View a global event in the calendar block on the dashboard
|
||||
Scenario: View a site event in the calendar block on the dashboard
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email | idnumber |
|
||||
| student1 | Student | 1 | student1@example.com | S1 |
|
||||
|
@ -5,7 +5,7 @@ Feature: Enable the calendar block on the site front page
|
||||
I can add the calendar block on the site front page
|
||||
|
||||
@javascript
|
||||
Scenario: View a global event in the calendar block on the front page
|
||||
Scenario: View a site event in the calendar block on the front page
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email | idnumber |
|
||||
| student1 | Student | 1 | student1@example.com | S1 |
|
||||
|
@ -16,7 +16,7 @@ Feature: Enable the upcoming events block in a course
|
||||
| teacher1 | C1 | editingteacher |
|
||||
|
||||
@javascript
|
||||
Scenario: View a global event in the calendar block
|
||||
Scenario: View a site event in the calendar block
|
||||
Given I log in as "admin"
|
||||
And I create a calendar event with form data:
|
||||
| id_eventtype | Site |
|
||||
|
@ -9,7 +9,7 @@ Feature: View a upcoming site event on the dashboard
|
||||
| student1 | Student | 1 | student1@example.com | S1 |
|
||||
|
||||
@javascript
|
||||
Scenario: View a global event in the upcoming events block on the dashboard
|
||||
Scenario: View a site event in the upcoming events block on the dashboard
|
||||
Given I log in as "admin"
|
||||
And I create a calendar event with form data:
|
||||
| id_eventtype | Site |
|
||||
|
@ -10,7 +10,7 @@ Feature: View a site event on the frontpage
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
|
||||
|
||||
@javascript
|
||||
Scenario: View a global event in the upcoming events block on the frontpage
|
||||
Scenario: View a site event in the upcoming events block on the frontpage
|
||||
Given I log in as "admin"
|
||||
And I create a calendar event with form data:
|
||||
| id_eventtype | Site |
|
||||
|
@ -55,7 +55,7 @@ class event_icon_exporter extends exporter {
|
||||
$user = $event->get_user();
|
||||
$userid = $user ? $user->get('id') : null;
|
||||
$isactivityevent = !empty($coursemodule);
|
||||
$isglobalevent = ($course && $courseid == SITEID);
|
||||
$issiteevent = ($course && $courseid == SITEID);
|
||||
$iscategoryevent = ($category && !empty($categoryid));
|
||||
$iscourseevent = ($course && !empty($courseid) && $courseid != SITEID && empty($groupid));
|
||||
$isgroupevent = ($group && !empty($groupid));
|
||||
@ -70,7 +70,7 @@ class event_icon_exporter extends exporter {
|
||||
} else {
|
||||
$alttext = get_string('activityevent', 'calendar');
|
||||
}
|
||||
} else if ($isglobalevent) {
|
||||
} else if ($issiteevent) {
|
||||
$key = 'i/siteevent';
|
||||
$component = 'core';
|
||||
$alttext = get_string('typesite', 'calendar');
|
||||
|
@ -57,19 +57,19 @@ trait eventtype {
|
||||
$options = [];
|
||||
|
||||
if (!empty($eventtypes['user'])) {
|
||||
$options['user'] = get_string('user');
|
||||
$options['user'] = get_string('user', 'calendar');
|
||||
}
|
||||
if (!empty($eventtypes['group'])) {
|
||||
$options['group'] = get_string('group');
|
||||
$options['group'] = get_string('group', 'calendar');
|
||||
}
|
||||
if (!empty($eventtypes['course'])) {
|
||||
$options['course'] = get_string('course');
|
||||
$options['course'] = get_string('course', 'calendar');
|
||||
}
|
||||
if (!empty($eventtypes['category'])) {
|
||||
$options['category'] = get_string('category');
|
||||
$options['category'] = get_string('category', 'calendar');
|
||||
}
|
||||
if (!empty($eventtypes['site'])) {
|
||||
$options['site'] = get_string('site');
|
||||
$options['site'] = get_string('site', 'calendar');
|
||||
}
|
||||
|
||||
// If we only have one event type and it's 'user' event then don't bother
|
||||
|
@ -85,7 +85,7 @@ class managesubscriptions extends \moodleform {
|
||||
// Add the select elements for the available event types.
|
||||
$this->add_event_type_elements($mform, $eventtypes);
|
||||
|
||||
// Eventtype: 0 = user, 1 = global, anything else = course ID.
|
||||
// Eventtype: 0 = user, 1 = site, anything else = course ID.
|
||||
$mform->addElement('submit', 'add', get_string('add'));
|
||||
|
||||
// Add the javascript required to enhance this mform.
|
||||
|
@ -76,7 +76,7 @@ if(!empty($what) && !empty($time)) {
|
||||
if ($what == 'all') {
|
||||
$users = $user->id;
|
||||
$courses[SITEID] = new stdClass;
|
||||
$courses[SITEID]->shortname = get_string('globalevents', 'calendar');
|
||||
$courses[SITEID]->shortname = get_string('siteevents', 'calendar');
|
||||
$paramcourses[SITEID] = $courses[SITEID];
|
||||
$paramcategory = true;
|
||||
} else if ($what == 'groups') {
|
||||
|
@ -147,7 +147,7 @@ class core_calendar_external extends external_api {
|
||||
"Set to true to return current user's user events",
|
||||
VALUE_DEFAULT, true, NULL_ALLOWED),
|
||||
'siteevents' => new external_value(PARAM_BOOL,
|
||||
"Set to true to return global events",
|
||||
"Set to true to return site events",
|
||||
VALUE_DEFAULT, true, NULL_ALLOWED),
|
||||
'timestart' => new external_value(PARAM_INT,
|
||||
"Time from which events should be returned",
|
||||
|
@ -70,10 +70,16 @@ define('CALENDAR_TF_24', '%H:%M');
|
||||
define('CALENDAR_TF_12', '%I:%M %p');
|
||||
|
||||
/**
|
||||
* CALENDAR_EVENT_GLOBAL - Global calendar event types
|
||||
* CALENDAR_EVENT_GLOBAL - Site calendar event types
|
||||
* @deprecated since 3.8
|
||||
*/
|
||||
define('CALENDAR_EVENT_GLOBAL', 1);
|
||||
|
||||
/**
|
||||
* CALENDAR_EVENT_SITE - Site calendar event types
|
||||
*/
|
||||
define('CALENDAR_EVENT_SITE', 1);
|
||||
|
||||
/**
|
||||
* CALENDAR_EVENT_COURSE - Course calendar event types
|
||||
*/
|
||||
@ -1551,8 +1557,8 @@ function calendar_add_event_metadata($event) {
|
||||
$event->cmid = $module->id;
|
||||
} else if ($event->courseid == SITEID) { // Site event.
|
||||
$event->icon = '<img src="' . $OUTPUT->image_url('i/siteevent') . '" alt="' .
|
||||
get_string('globalevent', 'calendar') . '" class="icon" />';
|
||||
$event->cssclass = 'calendar_event_global';
|
||||
get_string('siteevent', 'calendar') . '" class="icon" />';
|
||||
$event->cssclass = 'calendar_event_site';
|
||||
} else if ($event->courseid != 0 && $event->courseid != SITEID && $event->groupid == 0) { // Course event.
|
||||
$event->icon = '<img src="' . $OUTPUT->image_url('i/courseevent') . '" alt="' .
|
||||
get_string('courseevent', 'calendar') . '" class="icon" />';
|
||||
@ -1958,7 +1964,7 @@ function calendar_sub_month($month, $year) {
|
||||
* @param int $year the number of the year
|
||||
* @param array $eventsbyday event on specific day
|
||||
* @param array $durationbyday duration of the event in days
|
||||
* @param array $typesbyday event type (eg: global, course, user, or group)
|
||||
* @param array $typesbyday event type (eg: site, course, user, or group)
|
||||
* @param array $courses list of courses
|
||||
* @return void
|
||||
*/
|
||||
@ -1995,9 +2001,9 @@ function calendar_events_by_day($events, $month, $year, &$eventsbyday, &$duratio
|
||||
|
||||
// Mark the day as having such an event.
|
||||
if ($event->courseid == SITEID && $event->groupid == 0) {
|
||||
$typesbyday[$eventdaystart]['startglobal'] = true;
|
||||
// Set event class for global event.
|
||||
$events[$event->id]->class = 'calendar_event_global';
|
||||
$typesbyday[$eventdaystart]['startsite'] = true;
|
||||
// Set event class for site event.
|
||||
$events[$event->id]->class = 'calendar_event_site';
|
||||
} else if ($event->courseid != 0 && $event->courseid != SITEID && $event->groupid == 0) {
|
||||
$typesbyday[$eventdaystart]['startcourse'] = true;
|
||||
// Set event class for course event.
|
||||
@ -2036,7 +2042,7 @@ function calendar_events_by_day($events, $month, $year, &$eventsbyday, &$duratio
|
||||
for ($i = $lowerbound + 1; $i <= $upperbound; ++$i) {
|
||||
$durationbyday[$i][] = $event->id;
|
||||
if ($event->courseid == SITEID && $event->groupid == 0) {
|
||||
$typesbyday[$i]['durationglobal'] = true;
|
||||
$typesbyday[$i]['durationsite'] = true;
|
||||
} else if ($event->courseid != 0 && $event->courseid != SITEID && $event->groupid == 0) {
|
||||
$typesbyday[$i]['durationcourse'] = true;
|
||||
} else if ($event->groupid) {
|
||||
@ -2077,7 +2083,7 @@ function calendar_set_filters(array $courseeventsfrom, $ignorefilters = false, s
|
||||
if ($ignorefilters || calendar_show_event_type(CALENDAR_EVENT_COURSE, $user)) {
|
||||
$courses = array_keys($courseeventsfrom);
|
||||
}
|
||||
if ($ignorefilters || calendar_show_event_type(CALENDAR_EVENT_GLOBAL, $user)) {
|
||||
if ($ignorefilters || calendar_show_event_type(CALENDAR_EVENT_SITE, $user)) {
|
||||
$courses[] = SITEID;
|
||||
}
|
||||
$courses = array_unique($courses);
|
||||
@ -2472,7 +2478,7 @@ function calendar_format_event_time($event, $now, $linkparams = null, $usecommon
|
||||
* @return bool True if the tyep should be displayed false otherwise
|
||||
*/
|
||||
function calendar_show_event_type($type, $user = null) {
|
||||
$default = CALENDAR_EVENT_GLOBAL + CALENDAR_EVENT_COURSE + CALENDAR_EVENT_GROUP + CALENDAR_EVENT_USER;
|
||||
$default = CALENDAR_EVENT_SITE + CALENDAR_EVENT_COURSE + CALENDAR_EVENT_GROUP + CALENDAR_EVENT_USER;
|
||||
|
||||
if (get_user_preferences('calendar_persistflt', 0, $user) === 0) {
|
||||
global $SESSION;
|
||||
@ -2498,7 +2504,7 @@ function calendar_show_event_type($type, $user = null) {
|
||||
*/
|
||||
function calendar_set_event_type_display($type, $display = null, $user = null) {
|
||||
$persist = get_user_preferences('calendar_persistflt', 0, $user);
|
||||
$default = CALENDAR_EVENT_GLOBAL + CALENDAR_EVENT_COURSE + CALENDAR_EVENT_GROUP
|
||||
$default = CALENDAR_EVENT_SITE + CALENDAR_EVENT_COURSE + CALENDAR_EVENT_GROUP
|
||||
+ CALENDAR_EVENT_USER + CALENDAR_EVENT_COURSECAT;
|
||||
if ($persist === 0) {
|
||||
global $SESSION;
|
||||
|
@ -48,7 +48,7 @@ Feature: Course Category Events
|
||||
| student2 | B2i | student |
|
||||
And the following "events" exist:
|
||||
| name | eventtype |
|
||||
| Site event | global |
|
||||
| Site event | site |
|
||||
And the following "events" exist:
|
||||
| name | eventtype | course |
|
||||
| CA1i event | course | A1i |
|
||||
|
@ -532,7 +532,7 @@ class core_calendar_container_testcase extends advanced_testcase {
|
||||
protected function create_event($properties = []) {
|
||||
$record = new \stdClass();
|
||||
$record->name = 'event name';
|
||||
$record->eventtype = 'global';
|
||||
$record->eventtype = 'site';
|
||||
$record->timestart = time();
|
||||
$record->timeduration = 0;
|
||||
$record->timesort = 0;
|
||||
|
@ -467,7 +467,7 @@ class core_calendar_event_factory_testcase extends advanced_testcase {
|
||||
protected function create_event($properties = []) {
|
||||
$record = new \stdClass();
|
||||
$record->name = 'event name';
|
||||
$record->eventtype = 'global';
|
||||
$record->eventtype = 'site';
|
||||
$record->timestart = time();
|
||||
$record->timeduration = 0;
|
||||
$record->timesort = 0;
|
||||
|
@ -141,7 +141,7 @@ class core_calendar_event_mapper_testcase extends advanced_testcase {
|
||||
protected function create_event($properties = []) {
|
||||
$record = new \stdClass();
|
||||
$record->name = 'event name';
|
||||
$record->eventtype = 'global';
|
||||
$record->eventtype = 'site';
|
||||
$record->timestart = time();
|
||||
$record->timeduration = 0;
|
||||
$record->timesort = 0;
|
||||
|
@ -48,7 +48,7 @@ use core_calendar\local\event\factories\event_factory_interface;
|
||||
function create_event($properties) {
|
||||
$record = new \stdClass();
|
||||
$record->name = 'event name';
|
||||
$record->eventtype = 'global';
|
||||
$record->eventtype = 'site';
|
||||
$record->repeat = 0;
|
||||
$record->repeats = 0;
|
||||
$record->timestart = time();
|
||||
|
@ -155,7 +155,7 @@ class core_calendar_repeat_event_collection_testcase extends advanced_testcase {
|
||||
protected function create_event($properties = []) {
|
||||
$record = new \stdClass();
|
||||
$record->name = 'event name';
|
||||
$record->eventtype = 'global';
|
||||
$record->eventtype = 'site';
|
||||
$record->repeat = 0;
|
||||
$record->repeats = 0;
|
||||
$record->timestart = time();
|
||||
|
@ -32,6 +32,7 @@ $string['calendarheading'] = '{$a} Calendar';
|
||||
$string['calendarpreferences'] = 'Calendar preferences';
|
||||
$string['calendartypes'] = 'Calendar types';
|
||||
$string['calendarurl'] = 'Calendar URL: {$a}';
|
||||
$string['category'] = 'Category';
|
||||
$string['categoryevent'] = 'Category event';
|
||||
$string['clickhide'] = 'click to hide';
|
||||
$string['clickshow'] = 'click to show';
|
||||
@ -142,16 +143,12 @@ $string['forcecalendartype'] = 'Force calendar';
|
||||
$string['fri'] = 'Fri';
|
||||
$string['friday'] = 'Friday';
|
||||
$string['generateurlbutton'] = 'Get calendar URL';
|
||||
$string['global'] = 'Global';
|
||||
$string['globalevent'] = 'Global event';
|
||||
$string['globalevents'] = 'Global events';
|
||||
$string['gotoactivity'] = 'Go to activity';
|
||||
$string['gotocalendar'] = 'Go to calendar';
|
||||
$string['group'] = 'Group';
|
||||
$string['groupevent'] = 'Group event';
|
||||
$string['groupevents'] = 'Group events';
|
||||
$string['eventtypeglobal'] = 'global';
|
||||
$string['eventtypesite'] = 'global';
|
||||
$string['eventtypesite'] = 'site';
|
||||
$string['eventtypecategory'] = 'category';
|
||||
$string['eventtypecourse'] = 'course';
|
||||
$string['eventtypemodule'] = 'module';
|
||||
@ -225,6 +222,8 @@ $string['repeatweeksr'] = 'events';
|
||||
$string['sat'] = 'Sat';
|
||||
$string['saturday'] = 'Saturday';
|
||||
$string['shown'] = 'shown';
|
||||
$string['site'] = 'Site';
|
||||
$string['siteevent'] = 'Site event';
|
||||
$string['siteevents'] = 'Site events';
|
||||
$string['spanningevents'] = 'Events underway';
|
||||
$string['subscriptions'] = 'Subscriptions';
|
||||
@ -271,3 +270,9 @@ $string['when'] = 'When';
|
||||
$string['whendate'] = 'When: {$a}';
|
||||
$string['yesterday'] = 'Yesterday';
|
||||
$string['youcandeleteallrepeats'] = 'This event is part of a repeating event series. You can delete this event only, or all {$a} events in the series at once.';
|
||||
|
||||
// Deprecated since Moodle 3.8.
|
||||
$string['global'] = 'Global';
|
||||
$string['globalevent'] = 'Global event';
|
||||
$string['globalevents'] = 'Global events';
|
||||
$string['eventtypeglobal'] = 'global';
|
||||
|
@ -116,4 +116,8 @@ registersite,core_hub
|
||||
updatesite,core_hub
|
||||
unregisterexplained,core_hub
|
||||
configrequestcategoryselection,core_admin
|
||||
requestcategoryselection,core_admin
|
||||
requestcategoryselection,core_admin
|
||||
global,core_calendar
|
||||
globalevent,core_calendar
|
||||
globalevents,core_calendar
|
||||
eventtypeglobal,core_calendar
|
||||
|
@ -210,7 +210,7 @@ class icon_system_fontawesome extends icon_system_font {
|
||||
'core:i/lock' => 'fa-lock',
|
||||
'core:i/categoryevent' => 'fa-cubes',
|
||||
'core:i/course' => 'fa-graduation-cap',
|
||||
'core:i/courseevent' => 'fa-university',
|
||||
'core:i/courseevent' => 'fa-graduation-cap',
|
||||
'core:i/customfield' => 'fa-hand-o-right',
|
||||
'core:i/db' => 'fa-database',
|
||||
'core:i/delete' => 'fa-trash',
|
||||
|
@ -1145,7 +1145,6 @@ EOD;
|
||||
require_once($CFG->dirroot . '/calendar/lib.php');
|
||||
$record = new \stdClass();
|
||||
$record->name = 'event name';
|
||||
$record->eventtype = 'global';
|
||||
$record->repeat = 0;
|
||||
$record->repeats = 0;
|
||||
$record->timestart = time();
|
||||
@ -1176,7 +1175,7 @@ EOD;
|
||||
unset($record->courseid);
|
||||
unset($record->groupid);
|
||||
break;
|
||||
case 'global':
|
||||
case 'site':
|
||||
unset($record->categoryid);
|
||||
unset($record->courseid);
|
||||
unset($record->groupid);
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 267 B After Width: | Height: | Size: 446 B |
@ -1,3 +1,2 @@
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="-0.2 0 16 16" preserveAspectRatio="xMinYMid meet" overflow="visible"><path d="M6 .4c.4-.1.8-.1 1.3-.1 1.5 0 3 .5 4.2 1.4-.6.2-1.2.5-1.7 1-.1 0-.2.1-.2.1-.7-.3-1.5-.6-2.4-.6h-.3C6.8 1.6 6.5.9 6 .4zm5.7 9c-.2.5-.5 1-1 1.4-.3.3-.8.6-1.2.8.2.7.3 1.4.1 2.2.9-.3 1.8-.9 2.5-1.6.9-.9 1.4-1.9 1.8-3-.7.3-1.4.3-2.2.2zm-8.7.7c0-.1.1-.1 0 0-.5-1-.8-2.1-.7-3.2C1.6 6.8.9 6.5.4 6 0 8 .5 10.2 2 11.9c.2-.7.5-1.3 1-1.8zm7.4-6.7c-1.2 1.2-1.2 3.1 0 4.2 1.2 1.2 3.1 1.2 4.2 0s1.2-3.1 0-4.2c-1.1-1.2-3-1.2-4.2 0zm-6.7 7.4c-1.2 1.2-1.2 3.1 0 4.2 1.2 1.2 3.1 1.2 4.2 0 1.2-1.2 1.2-3.1 0-4.2-1.1-1.2-3-1.2-4.2 0zM.9.9C-.3 2.1-.3 4 .9 5.1 2 6.3 4 6.3 5.1 5.1 6.3 3.9 6.3 2 5.1.9 4-.3 2-.3.9.9z" fill="#999"/></svg>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg width="2304" height="1792" viewBox="0 0 2304 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1774 836l18 316q4 69-82 128t-235 93.5-323 34.5-323-34.5-235-93.5-82-128l18-316 574 181q22 7 48 7t48-7zm530-324q0 23-22 31l-1120 352q-4 1-10 1t-10-1l-652-206q-43 34-71 111.5t-34 178.5q63 36 63 109 0 69-58 107l58 433q2 14-8 25-9 11-24 11h-192q-15 0-24-11-10-11-8-25l58-433q-58-38-58-107 0-73 65-111 11-207 98-330l-333-104q-22-8-22-31t22-31l1120-352q4-1 10-1t10 1l1120 352q22 8 22 31z" fill="#999"/></svg>
|
Before Width: | Height: | Size: 920 B After Width: | Height: | Size: 542 B |
Loading…
x
Reference in New Issue
Block a user