MDL-63044 block_myoverview: remove timeline view

This commit is contained in:
Ryan Wyllie
2018-09-27 13:10:45 +08:00
parent bbe6eadda7
commit 44eb44e415
41 changed files with 108 additions and 2419 deletions
@@ -1 +0,0 @@
define(["jquery","core/ajax","core/notification"],function(a,b,c){var d=20,e=function(a){a.hasOwnProperty("limit")||(a.limit=d),a.limitnum=a.limit,delete a.limit,a.hasOwnProperty("starttime")&&(a.timesortfrom=a.starttime,delete a.starttime),a.hasOwnProperty("endtime")&&(a.timesortto=a.endtime,delete a.endtime);var e={methodname:"core_calendar_get_action_events_by_course",args:a},f=b.call([e])[0];return f.fail(c.exception),f},f=function(a){a.hasOwnProperty("limit")||(a.limit=10),a.limitnum=a.limit,delete a.limit,a.hasOwnProperty("starttime")&&(a.timesortfrom=a.starttime,delete a.starttime),a.hasOwnProperty("endtime")&&(a.timesortto=a.endtime,delete a.endtime);var d={methodname:"core_calendar_get_action_events_by_courses",args:a},e=b.call([d])[0];return e.fail(c.exception),e},g=function(a){a.hasOwnProperty("limit")||(a.limit=d),a.limitnum=a.limit,delete a.limit,a.hasOwnProperty("starttime")&&(a.timesortfrom=a.starttime,delete a.starttime),a.hasOwnProperty("endtime")&&(a.timesortto=a.endtime,delete a.endtime);var e={methodname:"core_calendar_get_action_events_by_timesort",args:a},f=b.call([e])[0];return f.fail(c.exception),f};return{queryByTime:g,queryByCourse:e,queryByCourses:f}});
-1
View File
@@ -1 +0,0 @@
define(["jquery","core/notification","core/templates","core/custom_interaction_events","block_myoverview/calendar_events_repository"],function(a,b,c,d,e){var f=86400,g={EMPTY_MESSAGE:'[data-region="empty-message"]',ROOT:'[data-region="event-list-container"]',EVENT_LIST:'[data-region="event-list"]',EVENT_LIST_CONTENT:'[data-region="event-list-content"]',EVENT_LIST_GROUP_CONTAINER:'[data-region="event-list-group-container"]',LOADING_ICON_CONTAINER:'[data-region="loading-icon-container"]',VIEW_MORE_BUTTON:'[data-action="view-more"]'},h={EVENT_LIST_ITEMS:"block_myoverview/event-list-items",COURSE_EVENT_LIST_ITEMS:"block_myoverview/course-event-list-items"},i=function(a){a.attr("data-loaded-all",!0)},j=function(a){return!!a.attr("data-loaded-all")},k=function(a){var b=a.find(g.LOADING_ICON_CONTAINER),c=a.find(g.VIEW_MORE_BUTTON);a.addClass("loading"),b.removeClass("hidden"),c.prop("disabled",!0)},l=function(a){var b=a.find(g.LOADING_ICON_CONTAINER),c=a.find(g.VIEW_MORE_BUTTON);a.removeClass("loading"),b.addClass("hidden"),j(a)?c.addClass("hidden"):c.prop("disabled",!1)},m=function(a){return a.hasClass("loading")},n=function(a){a.attr("data-has-events",!0)},o=function(a){return!!a.attr("data-has-events")},p=function(a,b){b?n(a):o(a)||q(a)},q=function(a){a.find(g.EVENT_LIST_CONTENT).addClass("hidden"),a.find(g.EMPTY_MESSAGE).removeClass("hidden")},r=function(a,b,d){return a.removeClass("hidden"),c.render(d,{events:b}).done(function(b,d){c.appendNodeContents(a.find(g.EVENT_LIST),b,d)})},s=function(a,b){var c=b.timesort||0;return c-a},t=function(a,b,c){var d=a.attr("data-midnight"),e=+c.attr("data-start-day")*f,g=+c.attr("data-end-day")*f,h=s(d,b);return""===c.attr("data-end-day")?e<=h:e<=h&&h<g},u=function(b,c){return function(d){return t(b,d,a(c))}},v=function(b,c){var d=0,e=h.EVENT_LIST_ITEMS;return b.attr("data-course-id")&&(e=h.COURSE_EVENT_LIST_ITEMS),a.when.apply(a,a.map(b.find(g.EVENT_LIST_GROUP_CONTAINER),function(f){var g=c.filter(u(b,f));return g.length?(d+=g.length,r(a(f),g,e)):null})).then(function(){return d})},w=function(c,d){c=a(c);var g=+c.attr("data-limit"),h=+c.attr("data-course-id"),j=c.attr("data-last-id"),n=c.attr("data-midnight"),o=n-14*f;if(m(c))return a.Deferred().resolve();if(k(c),"undefined"==typeof d){var q={starttime:o,limit:g};j&&(q.aftereventid=j),h?(q.courseid=h,d=e.queryByCourse(q)):d=e.queryByTime(q)}return d.then(function(a){if(!a.events.length)return i(c),0;var b=a.events;return c.attr("data-last-id",b[b.length-1].id),b.length<g&&i(c),v(c,b).then(function(a){return a<b.length&&i(c),b.length})}).then(function(a){return p(c,a)}).fail(b.exception).always(function(){l(c)})},x=function(a){d.define(a,[d.events.activate]),a.on(d.events.activate,g.VIEW_MORE_BUTTON,function(){w(a)})};return{init:function(b){b=a(b),w(b),x(b)},registerEventListeners:x,load:w,rootSelector:g.ROOT}});
@@ -1 +0,0 @@
define(["jquery","block_myoverview/event_list","block_myoverview/calendar_events_repository"],function(a,b,c){var d=86400,e={EVENTS_BY_COURSE_CONTAINER:'[data-region="course-events-container"]',EVENT_LIST_CONTAINER:'[data-region="event-list-container"]'},f=function(f){var g=f.find(e.EVENTS_BY_COURSE_CONTAINER);if(g.length){var h=g.find(e.EVENT_LIST_CONTAINER).first(),i=h.attr("data-midnight"),j=i-14*d,k=h.attr("data-limit"),l=g.map(function(){return a(this).attr("data-course-id")}).get(),m=c.queryByCourses({courseids:l,starttime:j,limit:k});g.each(function(c,d){d=a(d);var e=d.attr("data-course-id"),f=d.find(b.rootSelector),g=a.Deferred();m.done(function(a){var b=[],c=a.groupedbycourse.filter(function(a){return a.courseid==e});c.length&&(b=c[0].events),g.resolve({events:b})}).fail(function(a){g.reject(a)}),b.load(f,g)})}};return{init:function(b){b=a(b),f(b)}}});
@@ -1,168 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* A javascript module to retrieve calendar events from the server.
*
* @module block_myoverview/calendar_events_repository
* @class repository
* @package block_myoverview
* @copyright 2016 Ryan Wyllie <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define(['jquery', 'core/ajax', 'core/notification'], function($, Ajax, Notification) {
var DEFAULT_LIMIT = 20;
/**
* Retrieve a list of calendar events for the logged in user for the
* given course.
*
* Valid args are:
* int courseid Only get events for this course
* int starttime Only get events after this time
* int endtime Only get events before this time
* int limit Limit the number of results returned
* int aftereventid Offset the result set from the given id
*
* @method queryByCourse
* @param {object} args The request arguments
* @return {promise} Resolved with an array of the calendar events
*/
var queryByCourse = function(args) {
if (!args.hasOwnProperty('limit')) {
args.limit = DEFAULT_LIMIT;
}
args.limitnum = args.limit;
delete args.limit;
if (args.hasOwnProperty('starttime')) {
args.timesortfrom = args.starttime;
delete args.starttime;
}
if (args.hasOwnProperty('endtime')) {
args.timesortto = args.endtime;
delete args.endtime;
}
var request = {
methodname: 'core_calendar_get_action_events_by_course',
args: args
};
var promise = Ajax.call([request])[0];
promise.fail(Notification.exception);
return promise;
};
/**
* Retrieve a list of calendar events for the given courses for the
* logged in user.
*
* Valid args are:
* array courseids Get events for these courses
* int starttime Only get events after this time
* int endtime Only get events before this time
* int limit Limit the number of results returned
*
* @method queryByCourses
* @param {object} args The request arguments
* @return {promise} Resolved with an array of the calendar events
*/
var queryByCourses = function(args) {
if (!args.hasOwnProperty('limit')) {
// This is intentionally smaller than the default limit.
args.limit = 10;
}
args.limitnum = args.limit;
delete args.limit;
if (args.hasOwnProperty('starttime')) {
args.timesortfrom = args.starttime;
delete args.starttime;
}
if (args.hasOwnProperty('endtime')) {
args.timesortto = args.endtime;
delete args.endtime;
}
var request = {
methodname: 'core_calendar_get_action_events_by_courses',
args: args
};
var promise = Ajax.call([request])[0];
promise.fail(Notification.exception);
return promise;
};
/**
* Retrieve a list of calendar events for the logged in user after the given
* time.
*
* Valid args are:
* int starttime Only get events after this time
* int endtime Only get events before this time
* int limit Limit the number of results returned
* int aftereventid Offset the result set from the given id
*
* @method queryByTime
* @param {object} args The request arguments
* @return {promise} Resolved with an array of the calendar events
*/
var queryByTime = function(args) {
if (!args.hasOwnProperty('limit')) {
args.limit = DEFAULT_LIMIT;
}
args.limitnum = args.limit;
delete args.limit;
if (args.hasOwnProperty('starttime')) {
args.timesortfrom = args.starttime;
delete args.starttime;
}
if (args.hasOwnProperty('endtime')) {
args.timesortto = args.endtime;
delete args.endtime;
}
var request = {
methodname: 'core_calendar_get_action_events_by_timesort',
args: args
};
var promise = Ajax.call([request])[0];
promise.fail(Notification.exception);
return promise;
};
return {
queryByTime: queryByTime,
queryByCourse: queryByCourse,
queryByCourses: queryByCourses,
};
});
-416
View File
@@ -1,416 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Javascript to load and render the list of calendar events for a
* given day range.
*
* @module block_myoverview/event_list
* @package block_myoverview
* @copyright 2016 Ryan Wyllie <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define(['jquery', 'core/notification', 'core/templates',
'core/custom_interaction_events',
'block_myoverview/calendar_events_repository'],
function($, Notification, Templates, CustomEvents, CalendarEventsRepository) {
var SECONDS_IN_DAY = 60 * 60 * 24;
var SELECTORS = {
EMPTY_MESSAGE: '[data-region="empty-message"]',
ROOT: '[data-region="event-list-container"]',
EVENT_LIST: '[data-region="event-list"]',
EVENT_LIST_CONTENT: '[data-region="event-list-content"]',
EVENT_LIST_GROUP_CONTAINER: '[data-region="event-list-group-container"]',
LOADING_ICON_CONTAINER: '[data-region="loading-icon-container"]',
VIEW_MORE_BUTTON: '[data-action="view-more"]'
};
var TEMPLATES = {
EVENT_LIST_ITEMS: 'block_myoverview/event-list-items',
COURSE_EVENT_LIST_ITEMS: 'block_myoverview/course-event-list-items'
};
/**
* Set a flag on the element to indicate that it has completed
* loading all event data.
*
* @method setLoadedAll
* @private
* @param {object} root The container element
*/
var setLoadedAll = function(root) {
root.attr('data-loaded-all', true);
};
/**
* Check if all event data has finished loading.
*
* @method hasLoadedAll
* @private
* @param {object} root The container element
* @return {bool} if the element has completed all loading
*/
var hasLoadedAll = function(root) {
return !!root.attr('data-loaded-all');
};
/**
* Set the element state to loading.
*
* @method startLoading
* @private
* @param {object} root The container element
*/
var startLoading = function(root) {
var loadingIcon = root.find(SELECTORS.LOADING_ICON_CONTAINER),
viewMoreButton = root.find(SELECTORS.VIEW_MORE_BUTTON);
root.addClass('loading');
loadingIcon.removeClass('hidden');
viewMoreButton.prop('disabled', true);
};
/**
* Remove the loading state from the element.
*
* @method stopLoading
* @private
* @param {object} root The container element
*/
var stopLoading = function(root) {
var loadingIcon = root.find(SELECTORS.LOADING_ICON_CONTAINER),
viewMoreButton = root.find(SELECTORS.VIEW_MORE_BUTTON);
root.removeClass('loading');
loadingIcon.addClass('hidden');
if (!hasLoadedAll(root)) {
// Only enable the button if we've got more events to load.
viewMoreButton.prop('disabled', false);
} else {
viewMoreButton.addClass('hidden');
}
};
/**
* Check if the element is currently loading some event data.
*
* @method isLoading
* @private
* @param {object} root The container element
* @returns {Boolean}
*/
var isLoading = function(root) {
return root.hasClass('loading');
};
/**
* Flag the root element to remember that it contains events.
*
* @method setHasContent
* @private
* @param {object} root The container element
*/
var setHasContent = function(root) {
root.attr('data-has-events', true);
};
/**
* Check if the root element has had events loaded.
*
* @method hasContent
* @private
* @param {object} root The container element
* @return {bool}
*/
var hasContent = function(root) {
return root.attr('data-has-events') ? true : false;
};
/**
* Update the visibility of the content area. The content area
* is hidden if we have no events.
*
* @method updateContentVisibility
* @private
* @param {object} root The container element
* @param {int} eventCount A count of the events we just received.
*/
var updateContentVisibility = function(root, eventCount) {
if (eventCount) {
// We've rendered some events, let's remember that.
setHasContent(root);
} else {
// If this is the first time trying to load events and
// we don't have any then there isn't any so let's show
// the empty message.
if (!hasContent(root)) {
hideContent(root);
}
}
};
/**
* Hide the content area and display the empty content message.
*
* @method hideContent
* @private
* @param {object} root The container element
*/
var hideContent = function(root) {
root.find(SELECTORS.EVENT_LIST_CONTENT).addClass('hidden');
root.find(SELECTORS.EMPTY_MESSAGE).removeClass('hidden');
};
/**
* Render a group of calendar events and add them to the event
* list.
*
* @method renderGroup
* @private
* @param {object} group The group container element
* @param {array} calendarEvents The list of calendar events
* @param {string} templateName The template name
* @return {promise} Resolved when the elements are attached to the DOM
*/
var renderGroup = function(group, calendarEvents, templateName) {
group.removeClass('hidden');
return Templates.render(
templateName,
{events: calendarEvents}
).done(function(html, js) {
Templates.appendNodeContents(group.find(SELECTORS.EVENT_LIST), html, js);
});
};
/**
* Determine the time (in seconds) from the given timestamp until the calendar
* event will need actioning.
*
* @method timeUntilEvent
* @private
* @param {int} timestamp The time to compare with
* @param {object} event The calendar event
* @return {int}
*/
var timeUntilEvent = function(timestamp, event) {
var orderTime = event.timesort || 0;
return orderTime - timestamp;
};
/**
* Check if the given calendar event should be added to the given event
* list group container. The event list group container will specify a
* day range for the time boundary it is interested in.
*
* If only a start day is specified for the container then it will be treated
* as an open catchment for all events that begin after that time.
*
* @method eventBelongsInContainer
* @private
* @param {object} root The root element
* @param {object} event The calendar event
* @param {object} container The group event list container
* @return {bool}
*/
var eventBelongsInContainer = function(root, event, container) {
var todayTime = root.attr('data-midnight'),
timeUntilContainerStart = +container.attr('data-start-day') * SECONDS_IN_DAY,
timeUntilContainerEnd = +container.attr('data-end-day') * SECONDS_IN_DAY,
timeUntilEventNeedsAction = timeUntilEvent(todayTime, event);
if (container.attr('data-end-day') === '') {
return timeUntilContainerStart <= timeUntilEventNeedsAction;
} else {
return timeUntilContainerStart <= timeUntilEventNeedsAction &&
timeUntilEventNeedsAction < timeUntilContainerEnd;
}
};
/**
* Return a function that can be used to filter a list of events based on the day
* range specified on the given event list group container.
*
* @method getFilterCallbackForContainer
* @private
* @param {object} root The root element
* @param {object} container Event list group container
* @return {function}
*/
var getFilterCallbackForContainer = function(root, container) {
return function(event) {
return eventBelongsInContainer(root, event, $(container));
};
};
/**
* Render the given calendar events in the container element. The container
* elements must have a day range defined using data attributes that will be
* used to group the calendar events according to their order time.
*
* @method render
* @private
* @param {object} root The container element
* @param {array} calendarEvents A list of calendar events
* @return {promise} Resolved with a count of the number of rendered events
*/
var render = function(root, calendarEvents) {
var renderCount = 0;
var templateName = TEMPLATES.EVENT_LIST_ITEMS;
if (root.attr('data-course-id')) {
templateName = TEMPLATES.COURSE_EVENT_LIST_ITEMS;
}
// Loop over each of the element list groups and find the set of calendar events
// that belong to that group (as defined by the group's day range). The matching
// list of calendar events are rendered and added to the DOM within that group.
return $.when.apply($, $.map(root.find(SELECTORS.EVENT_LIST_GROUP_CONTAINER), function(container) {
var events = calendarEvents.filter(getFilterCallbackForContainer(root, container));
if (events.length) {
renderCount += events.length;
return renderGroup($(container), events, templateName);
} else {
return null;
}
})).then(function() {
return renderCount;
});
};
/**
* Retrieve a list of calendar events, render and append them to the end of the
* existing list. The events will be loaded based on the set of data attributes
* on the root element.
*
* This function can be provided with a jQuery promise. If it is then it won't
* attempt to load data by itself, instead it will use the given promise.
*
* The provided promise must resolve with an an object that has an events key
* and value is an array of calendar events.
* E.g.
* { events: ['event 1', 'event 2'] }
*
* @method load
* @param {object} root The root element of the event list
* @param {object} promise A jQuery promise resolved with events
* @return {promise} A jquery promise
*/
var load = function(root, promise) {
root = $(root);
var limit = +root.attr('data-limit'),
courseId = +root.attr('data-course-id'),
lastId = root.attr('data-last-id'),
midnight = root.attr('data-midnight'),
startTime = midnight - (14 * SECONDS_IN_DAY);
// Don't load twice.
if (isLoading(root)) {
return $.Deferred().resolve();
}
startLoading(root);
// If we haven't been provided a promise to resolve the
// data then we will load our own.
if (typeof promise == 'undefined') {
var args = {
starttime: startTime,
limit: limit,
};
if (lastId) {
args.aftereventid = lastId;
}
// If we have a course id then we only want events from that course.
if (courseId) {
args.courseid = courseId;
promise = CalendarEventsRepository.queryByCourse(args);
} else {
// Otherwise we want events from any course.
promise = CalendarEventsRepository.queryByTime(args);
}
}
// Request data from the server.
return promise.then(function(result) {
if (!result.events.length) {
// No events, nothing to do.
setLoadedAll(root);
return 0;
}
var calendarEvents = result.events;
// Remember the last id we've seen.
root.attr('data-last-id', calendarEvents[calendarEvents.length - 1].id);
if (calendarEvents.length < limit) {
// No more events to load, disable loading button.
setLoadedAll(root);
}
// Render the events.
return render(root, calendarEvents).then(function(renderCount) {
if (renderCount < calendarEvents.length) {
// If the number of events that was rendered is less than
// the number we sent for rendering we can assume that there
// are no groups to add them in. Since the ordering of the
// events is guaranteed it means that any future requests will
// also yield events that can't be rendered, so let's not bother
// sending any more requests.
setLoadedAll(root);
}
return calendarEvents.length;
});
}).then(function(eventCount) {
return updateContentVisibility(root, eventCount);
}).fail(
Notification.exception
).always(function() {
stopLoading(root);
});
};
/**
* Register the event listeners for the container element.
*
* @method registerEventListeners
* @param {object} root The root element of the event list
*/
var registerEventListeners = function(root) {
CustomEvents.define(root, [CustomEvents.events.activate]);
root.on(CustomEvents.events.activate, SELECTORS.VIEW_MORE_BUTTON, function() {
load(root);
});
};
return {
init: function(root) {
root = $(root);
load(root);
registerEventListeners(root);
},
registerEventListeners: registerEventListeners,
load: load,
rootSelector: SELECTORS.ROOT,
};
});
@@ -1,108 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Javascript to load and render the list of calendar events grouping by course.
*
* @module block_myoverview/events_by_course_list
* @package block_myoverview
* @copyright 2016 Simey Lameze <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define(
[
'jquery',
'block_myoverview/event_list',
'block_myoverview/calendar_events_repository'
],
function($, EventList, EventsRepository) {
var SECONDS_IN_DAY = 60 * 60 * 24;
var SELECTORS = {
EVENTS_BY_COURSE_CONTAINER: '[data-region="course-events-container"]',
EVENT_LIST_CONTAINER: '[data-region="event-list-container"]',
};
/**
* Loop through course events containers and load calendar events for that course.
*
* @method load
* @param {Object} root The root element of sort by course list.
*/
var load = function(root) {
var courseBlocks = root.find(SELECTORS.EVENTS_BY_COURSE_CONTAINER);
if (!courseBlocks.length) {
return;
}
var eventList = courseBlocks.find(SELECTORS.EVENT_LIST_CONTAINER).first();
var midnight = eventList.attr('data-midnight');
var startTime = midnight - (14 * SECONDS_IN_DAY);
var limit = eventList.attr('data-limit');
var courseIds = courseBlocks.map(function() {
return $(this).attr('data-course-id');
}).get();
// Load the first set of events for each course in a single request.
// We want to avoid sending an individual request for each course because
// there could be lots of them.
var coursesPromise = EventsRepository.queryByCourses({
courseids: courseIds,
starttime: startTime,
limit: limit
});
// Load the events into each course block.
courseBlocks.each(function(index, container) {
container = $(container);
var courseId = container.attr('data-course-id');
var eventListContainer = container.find(EventList.rootSelector);
var promise = $.Deferred();
// Once all of the course events have been loaded then we need
// to extract just the ones relevant to this course block and
// hand them to the event list to render.
coursesPromise.done(function(result) {
var events = [];
// Get this course block's events from the collection returned
// from the server.
var courseGroup = result.groupedbycourse.filter(function(group) {
return group.courseid == courseId;
});
if (courseGroup.length) {
events = courseGroup[0].events;
}
promise.resolve({events: events});
}).fail(function(e) {
promise.reject(e);
});
// Provide the event list with a promise that will be resolved
// when we have received the events from the server.
EventList.load(eventListContainer, promise);
});
};
return {
init: function(root) {
root = $(root);
load(root);
}
};
});
@@ -29,7 +29,6 @@ use renderer_base;
use templatable;
use core_completion\progress;
require_once($CFG->dirroot . '/blocks/myoverview/lib.php');
require_once($CFG->libdir . '/completionlib.php');
/**
@@ -71,14 +70,12 @@ class main implements renderable, templatable {
$coursesview = new courses_view($courses, $coursesprogress);
$nocoursesurl = $output->image_url('courses', 'block_myoverview')->out();
$noeventsurl = $output->image_url('activities', 'block_myoverview')->out();
return [
'midnight' => usergetmidnight(time()),
'coursesview' => $coursesview->export_for_template($output),
'urls' => [
'nocourses' => $nocoursesurl,
'noevents' => $noeventsurl
],
];
}
@@ -31,15 +31,8 @@ $string['nocourses'] = 'No courses';
$string['nocoursesinprogress'] = 'No in progress courses';
$string['nocoursesfuture'] = 'No future courses';
$string['nocoursespast'] = 'No past courses';
$string['noevents'] = 'No upcoming activities due';
$string['next30days'] = 'Next 30 days';
$string['next7days'] = 'Next 7 days';
$string['past'] = 'Past';
$string['pluginname'] = 'Course overview';
$string['recentlyoverdue'] = 'Recently overdue';
$string['sortbycourses'] = 'Sort by courses';
$string['sortbydates'] = 'Sort by dates';
$string['timeline'] = 'Timeline';
$string['viewcourse'] = 'View course';
$string['viewcoursename'] = 'View course {$a}';
$string['privacy:metadata'] = 'The myoverview block does not store any personal data.';
-52
View File
@@ -1,52 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Contains functions called by core.
*
* @package block_myoverview
* @copyright 2017 Mark Nelson <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* The timeline view.
*/
define('BLOCK_MYOVERVIEW_TIMELINE_VIEW', 'timeline');
/**
* The courses view.
*/
define('BLOCK_MYOVERVIEW_COURSES_VIEW', 'courses');
/**
* Returns the name of the user preferences as well as the details this plugin uses.
*
* @return array
*/
function block_myoverview_user_preferences() {
$preferences = array();
$preferences['block_myoverview_last_tab'] = array(
'type' => PARAM_ALPHA,
'null' => NULL_NOT_ALLOWED,
'default' => BLOCK_MYOVERVIEW_TIMELINE_VIEW,
'choices' => array(BLOCK_MYOVERVIEW_TIMELINE_VIEW, BLOCK_MYOVERVIEW_COURSES_VIEW)
);
return $preferences;
}
-41
View File
@@ -1,41 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="157 -1509 148 125" preserveAspectRatio="xMinYMid meet">
<defs>
<style>
.cls-1 {
clip-path: url(#clip-Activities);
}
.cls-2 {
fill: #eee;
}
.cls-3 {
fill: #c4c8cc;
}
.cls-4 {
fill: #fff;
}
</style>
<clipPath id="clip-Activities">
<rect x="157" y="-1509" width="148" height="125"/>
</clipPath>
</defs>
<g id="Activities" class="cls-1">
<g id="Group_42" data-name="Group 42" transform="translate(-268 -1985)">
<ellipse id="Ellipse_37" data-name="Ellipse 37" class="cls-2" cx="74" cy="14.785" rx="74" ry="14.785" transform="translate(425 571.43)"/>
<rect id="Rectangle_80" data-name="Rectangle 80" class="cls-3" width="94.182" height="110.215" transform="translate(451.909 476)"/>
<g id="Group_41" data-name="Group 41" transform="translate(467.043 493)">
<rect id="Rectangle_81" data-name="Rectangle 81" class="cls-4" width="44.456" height="5.625" transform="translate(21.16 0.549)"/>
<rect id="Rectangle_82" data-name="Rectangle 82" class="cls-4" width="33.342" height="5.625" transform="translate(21.16 11.652)"/>
<rect id="Rectangle_83" data-name="Rectangle 83" class="cls-4" width="44.456" height="5.625" transform="translate(21.16 30.772)"/>
<rect id="Rectangle_84" data-name="Rectangle 84" class="cls-4" width="33.342" height="5.625" transform="translate(21.16 41.875)"/>
<rect id="Rectangle_85" data-name="Rectangle 85" class="cls-4" width="44.456" height="5.625" transform="translate(21.16 61.291)"/>
<rect id="Rectangle_86" data-name="Rectangle 86" class="cls-4" width="33.342" height="5.625" transform="translate(21.16 72.393)"/>
<ellipse id="Ellipse_38" data-name="Ellipse 38" class="cls-4" cx="7.007" cy="7" rx="7.007" ry="7" transform="translate(0 0)"/>
<ellipse id="Ellipse_39" data-name="Ellipse 39" class="cls-4" cx="7.007" cy="7" rx="7.007" ry="7" transform="translate(0 31)"/>
<ellipse id="Ellipse_40" data-name="Ellipse 40" class="cls-4" cx="7.007" cy="7" rx="7.007" ry="7" transform="translate(0 61)"/>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

@@ -1,69 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/course-event-list-item
This template renders an event list item for the myoverview block
in the courses view.
Example context (json):
{
"name": "Assignment due 1",
"url": "https://www.google.com",
"timesort": 1490320388,
"action": {
"name": "Submit assignment",
"url": "https://www.google.com",
"itemcount": 1,
"showitemcount": true,
"actionable": true
},
"icon": {
"key": "icon",
"component": "mod_assign",
"alttext": "Assignment icon"
}
}
}}
<li class="list-group-item event-list-item" data-region="event-list-item">
<div class="row">
<div class="col-lg-7 col-xl-8">
<div class="d-inline-block icon-large event-icon">
{{#icon}}{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}{{/icon}}
</div>
<div class="d-inline-block event-name-container">
<a class="event-name text-truncate" href="{{{url}}}">{{{name}}}</a>
<p class="small text-muted text-truncate m-b-0">
{{#userdate}} {{timesort}}, {{#str}} strftimerecent {{/str}} {{/userdate}}
</p>
</div>
</div>
<div class="hidden-md-down d-none d-md-block col-lg-5 col-xl-4 text-truncate">
{{#action.actionable}}
<a href="{{{action.url}}}">{{action.name}}</a>
{{#action.itemcount}}
{{#action.showitemcount}}
<span class="tag tag-pill tag-default">{{.}}</span>
{{/action.showitemcount}}
{{/action.itemcount}}
{{/action.actionable}}
{{^action.actionable}}
<div class="text-muted">{{action.name}}</div>
{{/action.actionable}}
</div>
</div>
</li>
@@ -1,63 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/course-event-list-items
This template renders a group of event list items for the myoverview block
sort by courses view.
Example context (json):
{
"events": [
{
"name": "Assignment due 1",
"url": "https://www.google.com",
"timesort": 1490320388,
"action": {
"name": "Submit assignment",
"url": "https://www.google.com",
"itemcount": 1,
"actionable": true
},
"icon": {
"key": "icon",
"component": "mod_assign",
"alttext": "Assignment icon"
}
},
{
"name": "Assignment due 2",
"url": "https://www.google.com",
"timesort": 1490320388,
"action": {
"name": "Submit assignment",
"url": "https://www.google.com",
"itemcount": 1,
"actionable": true
},
"icon": {
"key": "icon",
"component": "mod_assign",
"alttext": "Assignment icon"
}
}
]
}
}}
{{#events}}
{{> block_myoverview/course-event-list-item }}
{{/events}}
@@ -1,110 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/course-event-list
This template renders a list of events for the myoverview block
sort by courses view.
Example context (json):
{
"urls": {
"noevents": "#"
}
}
}}
<div data-region="event-list-container"
data-limit="{{$limit}}20{{/limit}}"
data-course-id="{{$courseid}}{{/courseid}}"
data-last-id="{{$lastid}}{{/lastid}}"
data-midnight="{{midnight}}"
id="event-list-container-{{$courseid}}{{/courseid}}">
<div data-region="event-list-content">
{{< block_myoverview/event-list-group }}
{{$title}}{{#str}} recentlyoverdue, block_myoverview {{/str}}{{/title}}
{{$extratitleclasses}}text-danger{{/extratitleclasses}}
{{$startday}}-14{{/startday}}
{{$endday}}0{{/endday}}
{{$eventlistitems}}
{{> block_myoverview/course-event-list-items }}
{{/eventlistitems}}
{{/ block_myoverview/event-list-group }}
{{< block_myoverview/event-list-group }}
{{$title}}{{#str}} today {{/str}}{{/title}}
{{$extratitleclasses}}{{/extratitleclasses}}
{{$startday}}0{{/startday}}
{{$endday}}1{{/endday}}
{{$eventlistitems}}
{{> block_myoverview/course-event-list-items }}
{{/eventlistitems}}
{{/ block_myoverview/event-list-group }}
{{< block_myoverview/event-list-group }}
{{$title}}{{#str}} next7days, block_myoverview {{/str}}{{/title}}
{{$extratitleclasses}}{{/extratitleclasses}}
{{$startday}}1{{/startday}}
{{$endday}}7{{/endday}}
{{$eventlistitems}}
{{> block_myoverview/course-event-list-items }}
{{/eventlistitems}}
{{/ block_myoverview/event-list-group }}
{{< block_myoverview/event-list-group }}
{{$title}}{{#str}} next30days, block_myoverview {{/str}}{{/title}}
{{$extratitleclasses}}{{/extratitleclasses}}
{{$startday}}7{{/startday}}
{{$endday}}30{{/endday}}
{{$eventlistitems}}
{{> block_myoverview/course-event-list-items }}
{{/eventlistitems}}
{{/ block_myoverview/event-list-group }}
{{< block_myoverview/event-list-group }}
{{$title}}{{#str}} future, block_myoverview {{/str}}{{/title}}
{{$extratitleclasses}}{{/extratitleclasses}}
{{$startday}}30{{/startday}}
{{$endday}}{{/endday}}
{{$eventlistitems}}
{{> block_myoverview/course-event-list-items }}
{{/eventlistitems}}
{{/ block_myoverview/event-list-group }}
<div class="text-xs-center text-center m-y-2">
<button type="button" class="btn btn-secondary" data-action="view-more">
{{#str}} viewmore {{/str}}
<span class="hidden" data-region="loading-icon-container">
{{> core/loading }}
</span>
</button>
</div>
</div>
<div class="hidden text-xs-center text-center m-y-3" data-region="empty-message">
<img class="empty-placeholder-image-sm"
src="{{urls.noevents}}"
alt="{{#str}} noevents, block_myoverview {{/str}}"
role="presentation">
<p class="text-muted m-t-1">{{#str}} noevents, block_myoverview {{/str}}</p>
<a href="{{viewurl}}" class="btn btn-secondary {{#visible}}text-primary{{/visible}}"
aria-label="{{#str}} viewcoursename, block_myoverview, {{{fullnamedisplay}}} {{/str}}">
{{#str}} viewcourse, block_myoverview {{/str}}
</a>
</div>
</div>
{{#js}}
require(['jquery', 'block_myoverview/event_list'], function($, EventList) {
var root = $("#event-list-container-{{$courseid}}{{/courseid}}");
EventList.registerEventListeners(root);
});
{{/js}}
@@ -1,44 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/course-item
This template renders the each course block containing a summary and calendar events.
Example context (json):
{
"shortname": "course 3",
"viewurl": "https://www.google.com",
"summary": "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout."
}
}}
<li class="list-group-item m-y-1">
<div data-region="course-events-container" id="course-events-container-{{id}}" data-course-id="{{id}}">
<div class="row">
<div class="col-lg-3">
{{> block_myoverview/course-summary }}
</div>
<div class="col-lg-9">
{{< block_myoverview/course-event-list }}
{{$limit}}10{{/limit}}
{{$offset}}0{{/offset}}
{{$courseid}}{{id}}{{/courseid}}
{{/ block_myoverview/course-event-list }}
</div>
</div>
</div>
</li>
@@ -1,49 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/course-summary
This template renders the course summary (view by courses) for the myoverview block.
Example context (json):
{
"fullnamedisplay": "course 3",
"viewurl": "https://www.google.com",
"summary": "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout."
}
}}
<div class="course-info-container" id="course-info-container-{{id}}">
<div class="d-sm-none d-lg-block">
{{> block_myoverview/progress-chart}}
<h4 class="h5"><a href="{{viewurl}}" class="{{^visible}}dimmed{{/visible}}">{{{fullnamedisplay}}}</a></h4>
</div>
<div class="d-none d-sm-block d-lg-none visible-tablet">
<div class="media">
<div class="media-left pr-3">
<div class="media-object">
{{> block_myoverview/progress-chart}}
</div>
</div>
<div class="media-body">
<h4 class="h5"><a href="{{viewurl}}" class="{{^visible}}dimmed{{/visible}}">{{{fullnamedisplay}}}</a></h4>
</div>
</div>
</div>
<p class="text-muted">
{{#shortentext}} 140, {{{summary}}}{{/shortentext}}
</p>
</div>
@@ -0,0 +1,40 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/courses-view-nav-grouping-display-filter
This template renders the main content area for the myoverview block.
Example context (json):
{}
}}
<div data-region="courses-grouping-display-filter" class="btn-group">
<button type="button" class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{#str}} inprogress, block_myoverview {{/str}}
</button>
<div class="dropdown-menu list-group hidden" data-show-active-item data-skip-active-class="true">
<a class="dropdown-item active" href="#myoverview_courses_view_in_progress" data-toggle="tab">
{{#str}} inprogress, block_myoverview {{/str}}
</a>
<a class="dropdown-item" href="#myoverview_courses_view_future" data-toggle="tab">
{{#str}} future, block_myoverview {{/str}}
</a>
<a class="dropdown-item" href="#myoverview_courses_view_past" data-toggle="tab">
{{#str}} past, block_myoverview {{/str}}
</a>
</div>
</div>
@@ -24,25 +24,6 @@
}}
<div id="courses-view-{{uniqid}}" data-region="courses-view">
{{#hascourses}}
<div class="d-flex justify-content-center">
<ul class="nav nav-pills my-5">
<li class="nav-item">
<a class="nav-link active" href="#myoverview_courses_view_in_progress" data-toggle="tab">
{{#str}} inprogress, block_myoverview {{/str}}
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#myoverview_courses_view_future" data-toggle="tab">
{{#str}} future, block_myoverview {{/str}}
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#myoverview_courses_view_past" data-toggle="tab">
{{#str}} past, block_myoverview {{/str}}
</a>
</li>
</ul>
</div>
<div class="tab-content">
<div class="tab-pane active fade show" id="myoverview_courses_view_in_progress">
{{#inprogress}}
@@ -1,75 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/event-list-group
This template renders a list of events for the myoverview block.
Example context (json):
{
"events": [
{
"enddate": "Nov 4th, 10am",
"name": "Assignment due 1",
"url": "https://www.google.com",
"course": {
"fullname": "Course 1"
},
"action": {
"name": "Submit assignment",
"url": "https://www.google.com",
"itemcount": 1
},
"icon": {
"key": "icon",
"component": "mod_assign",
"alttext": "Assignment icon"
}
},
{
"enddate": "Nov 4th, 10am",
"name": "Assignment due 2",
"url": "https://www.google.com",
"course": {
"fullname": "Course 1"
},
"action": {
"name": "Submit assignment",
"url": "https://www.google.com",
"itemcount": 1
},
"icon": {
"key": "icon",
"component": "mod_assign",
"alttext": "Assignment icon"
}
}
]
}
}}
<div data-region="event-list-group-container"
data-start-day="{{$startday}}0{{/startday}}"
data-end-day="{{$endday}}{{/endday}}"
class="hidden">
<h5 class="h6 m-t-1 {{$extratitleclasses}}{{/extratitleclasses}}" id="event-list-title-{{uniqid}}"><strong>{{$title}}{{/title}}</strong></h5>
<ul class="list-group unstyled" data-region="event-list" aria-describedby="event-list-title-{{uniqid}}">
{{$eventlistitems}}
{{> block_myoverview/event-list-items }}
{{/eventlistitems}}
</ul>
</div>
@@ -1,76 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/event-list-item
This template renders an event list item for the myoverview block.
Example context (json):
{
"name": "Assignment due 1",
"url": "https://www.google.com",
"timesort": 1490320388,
"course": {
"fullnamedisplay": "Course 1"
},
"action": {
"name": "Submit assignment",
"url": "https://www.google.com",
"itemcount": 1,
"showitemcount": true,
"actionable": true
},
"icon": {
"key": "icon",
"component": "mod_assign",
"alttext": "Assignment icon"
}
}
}}
<li class="list-group-item event-list-item" data-region="event-list-item">
<div class="row">
<div class="col-sm-8 col-lg-6 col-xl-7">
<div class="d-inline-block icon-large event-icon">
{{#icon}}{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}{{/icon}}
</div>
<div class="d-inline-block event-name-container">
<a class="event-name text-truncate" href="{{{url}}}">{{{name}}}</a>
<p class="small text-muted text-truncate m-b-0">{{{course.fullnamedisplay}}}</p>
</div>
</div>
<div class="col-sm-4 col-lg-6 col-xl-5">
<div class="row">
<div class="col-lg-5 text-xs-right text-lg-left text-truncate">
{{#userdate}} {{timesort}}, {{#str}} strftimerecent {{/str}} {{/userdate}}
</div>
<div class="hidden-md-down d-none d-md-block col-lg-7 text-truncate">
{{#action.actionable}}
<a href="{{{action.url}}}">{{action.name}}</a>
{{#action.itemcount}}
{{#action.showitemcount}}
<span class="tag tag-pill tag-default">{{.}}</span>
{{/action.showitemcount}}
{{/action.itemcount}}
{{/action.actionable}}
{{^action.actionable}}
<div class="text-muted">{{action.name}}</div>
{{/action.actionable}}
</div>
</div>
</div>
</div>
</li>
@@ -1,68 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/event-list-items
This template renders a group of event list items for the myoverview block.
Example context (json):
{
"events": [
{
"name": "Assignment due 1",
"url": "https://www.google.com",
"timesort": 1490320388,
"course": {
"fullnamedisplay": "Course 1"
},
"action": {
"name": "Submit assignment",
"url": "https://www.google.com",
"itemcount": 1,
"actionable": true
},
"icon": {
"key": "icon",
"component": "mod_assign",
"alttext": "Assignment icon"
}
},
{
"name": "Assignment due 2",
"url": "https://www.google.com",
"timesort": 1490320388,
"course": {
"fullnamedisplay": "Course 1"
},
"action": {
"name": "Submit assignment",
"url": "https://www.google.com",
"itemcount": 1,
"actionable": true
},
"icon": {
"key": "icon",
"component": "mod_assign",
"alttext": "Assignment icon"
}
}
]
}
}}
{{#events}}
{{> block_myoverview/event-list-item }}
{{/events}}
@@ -1,87 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/event-list
This template renders a list of events for the myoverview block.
Example context (json):
{
}
}}
<div data-region="event-list-container"
data-limit="{{$limit}}20{{/limit}}"
data-course-id="{{$courseid}}{{/courseid}}"
data-last-id="{{$lastid}}{{/lastid}}"
data-midnight="{{midnight}}"
id="event-list-container-{{$courseid}}{{/courseid}}">
<div data-region="event-list-content">
{{< block_myoverview/event-list-group }}
{{$title}}{{#str}} recentlyoverdue, block_myoverview {{/str}}{{/title}}
{{$extratitleclasses}}text-danger{{/extratitleclasses}}
{{$startday}}-14{{/startday}}
{{$endday}}0{{/endday}}
{{/ block_myoverview/event-list-group }}
{{< block_myoverview/event-list-group }}
{{$title}}{{#str}} today {{/str}}{{/title}}
{{$extratitleclasses}}{{/extratitleclasses}}
{{$startday}}0{{/startday}}
{{$endday}}1{{/endday}}
{{/ block_myoverview/event-list-group }}
{{< block_myoverview/event-list-group }}
{{$title}}{{#str}} next7days, block_myoverview {{/str}}{{/title}}
{{$extratitleclasses}}{{/extratitleclasses}}
{{$startday}}1{{/startday}}
{{$endday}}7{{/endday}}
{{/ block_myoverview/event-list-group }}
{{< block_myoverview/event-list-group }}
{{$title}}{{#str}} next30days, block_myoverview {{/str}}{{/title}}
{{$extratitleclasses}}{{/extratitleclasses}}
{{$startday}}7{{/startday}}
{{$endday}}30{{/endday}}
{{/ block_myoverview/event-list-group }}
{{< block_myoverview/event-list-group }}
{{$title}}{{#str}} future, block_myoverview {{/str}}{{/title}}
{{$extratitleclasses}}{{/extratitleclasses}}
{{$startday}}30{{/startday}}
{{$endday}}{{/endday}}
{{/ block_myoverview/event-list-group }}
<div class="text-xs-center text-center m-y-2">
<button type="button" class="btn btn-secondary" data-action="view-more">
{{#str}} viewmore {{/str}}
<span class="hidden" data-region="loading-icon-container">
{{> core/loading }}
</span>
</button>
</div>
</div>
<div class="hidden text-xs-center text-center m-t-3" data-region="empty-message">
<img class="empty-placeholder-image-lg"
src="{{urls.noevents}}"
alt="{{#str}} noevents, block_myoverview {{/str}}"
role="presentation">
<p class="text-muted m-t-1">{{#str}} noevents, block_myoverview {{/str}}</p>
</div>
</div>
{{#js}}
require(['jquery', 'block_myoverview/event_list'], function($, EventList) {
var root = $("#event-list-container-{{$courseid}}{{/courseid}}");
EventList.registerEventListeners(root);
});
{{/js}}
+12 -18
View File
@@ -24,26 +24,20 @@
}}
<div id="block-myoverview-{{uniqid}}" class="block-myoverview" data-region="myoverview">
<ul id="block-myoverview-view-choices-{{uniqid}}" class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link {{#viewingtimeline}}active{{/viewingtimeline}}" href="#myoverview_timeline_view" role="tab" data-toggle="tab" data-tabname="timeline">
{{#str}} timeline, block_myoverview {{/str}}
</a>
</li>
<li class="nav-item">
<a class="nav-link {{#viewingcourses}}active{{/viewingcourses}}" href="#myoverview_courses_view" role="tab" data-toggle="tab" data-tabname="courses">
{{#str}} courses {{/str}}
</a>
</li>
</ul>
<div class="tab-content content-centred">
<div role="tabpanel" class="tab-pane fade {{#viewingtimeline}}in active{{/viewingtimeline}}" id="myoverview_timeline_view">
{{> block_myoverview/timeline-view }}
</div>
<div role="tabpanel" class="tab-pane fade {{#viewingcourses}}in active{{/viewingcourses}}" id="myoverview_courses_view">
<div class="container p-0 m-b-1">
<div class="row no-gutters">
{{#coursesview}}
{{> block_myoverview/courses-view }}
{{#hascourses}}
<div class="{{#viewingtimeline}}d-none{{/viewingtimeline}}" data-tab-content="courses">
{{> block_myoverview/courses-view-nav-grouping-display-filter }}
</div>
{{/hascourses}}
{{/coursesview}}
</div>
</div>
<div class="container p-0">
{{#coursesview}}
{{> block_myoverview/courses-view }}
{{/coursesview}}
</div>
</div>
@@ -1,121 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/timeline-view-courses
This template renders the timeline view by courses for the myoverview block.
Example context (json):
{}
}}
<div id="sort-by-courses-view-{{uniqid}}">
{{#coursesview}}
{{#inprogress}}
{{#haspages}}
{{#pages}}
<ul class="list-group unstyled hidden" data-region="course-block">
{{#courses}} {{> block_myoverview/course-item }} {{/courses}}
</ul>
{{/pages}}
<div class="text-xs-center text-center m-t-1">
<button type="button" class="btn btn-secondary" data-action="more-courses">
{{#str}} morecourses, block_myoverview {{/str}}
<span class="hidden" data-region="loading-icon-container">
{{> core/loading }}
</span>
</button>
</div>
{{/haspages}}
{{^haspages}}
<div class="text-xs-center text-center m-t-3">
<img class="empty-placeholder-image-lg"
src="{{urls.noevents}}"
alt="{{#str}} nocoursesinprogress, block_myoverview {{/str}}"
role="presentation">
<p class="text-muted m-t-1">{{#str}} nocoursesinprogress, block_myoverview {{/str}}</p>
</div>
{{/haspages}}
{{/inprogress}}
{{^inprogress}}
<div class="text-xs-center text-center m-t-3">
<img class="empty-placeholder-image-lg"
src="{{urls.noevents}}"
alt="{{#str}} nocoursesinprogress, block_myoverview {{/str}}"
role="presentation">
<p class="text-muted m-t-1">{{#str}} nocoursesinprogress, block_myoverview {{/str}}</p>
</div>
{{/inprogress}}
{{/coursesview}}
</div>
{{#js}}
require(['jquery', 'core/custom_interaction_events', 'block_myoverview/event_list_by_course'],
function($, CustomEvents, EventListByCourse) {
var root = $("#sort-by-courses-view-{{uniqid}}");
// This flag is used so that we can delay the loading of the events until the tab
// is toggled by the user.
var seen = false;
CustomEvents.define(root, [CustomEvents.events.activate]);
// Show more courses and load their events when the user clicks the "more courses"
// button.
root.on(CustomEvents.events.activate, '[data-action="more-courses"]', function(e, data) {
var button = $(e.target);
var blocks = root.find('[data-region="course-block"].hidden');
if (blocks && blocks.length) {
var block = blocks.first();
EventListByCourse.init(block);
block.removeClass('hidden');
}
// If there was only one hidden block then we have no more to show now
// so we can disable the button.
if (blocks && blocks.length == 1) {
button.addClass('hidden');
}
if (data) {
data.originalEvent.preventDefault();
data.originalEvent.stopPropagation();
}
e.stopPropagation();
});
// Listen for when the user changes tab so that we can show the first set of courses
// and load their events when they request the sort by courses view for the first time.
root.closest('[data-region="timeline-view"]').on('shown shown.bs.tab', function(e) {
if (seen) {
return;
}
var tab = $(e.target);
var tabTarget = $(tab.attr('href'));
if (!tabTarget || !tabTarget.length) {
return;
}
var viewCourses = tabTarget.find('#sort-by-courses-view-{{uniqid}}');
if (viewCourses && viewCourses.length && !seen) {
seen = true;
viewCourses.find('[data-action="more-courses"]').trigger(CustomEvents.events.activate);
}
});
});
{{/js}}
@@ -1,35 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/timeline-view-dates
This template renders the timeline view by dates for the myoverview block.
Example context (json):
{}
}}
<div data-region="timeline-view-dates" id="timeline-view-dates-{{uniqid}}">
{{< block_myoverview/event-list }}
{{$limit}}20{{/limit}}
{{/ block_myoverview/event-list }}
</div>
{{#js}}
require(['jquery', 'block_myoverview/event_list'], function($, EventList) {
var root = $("#timeline-view-dates-{{uniqid}}").find('[data-region="event-list-container"]');
EventList.load(root);
});
{{/js}}
@@ -1,49 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/timeline-view
This template renders the timeline view for the myoverview block.
Example context (json):
{}
}}
<div id="timeline-view-{{uniqid}}" data-region="timeline-view">
<div class="d-flex justify-content-center">
<ul class="nav nav-pills my-5">
<li class="nav-item">
<a class="nav-link active" href="#myoverview_timeline_dates" data-toggle="tab">
{{#str}} sortbydates, block_myoverview {{/str}}
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#myoverview_timeline_courses" data-toggle="tab">
{{#str}} sortbycourses, block_myoverview {{/str}}
</a>
</li>
</ul>
</div>
<div class="tab-content">
<div class="tab-pane active fade show" id="myoverview_timeline_dates">
{{> block_myoverview/timeline-view-dates }}
</div>
<div class="tab-pane fade" id="myoverview_timeline_courses">
{{> block_myoverview/timeline-view-courses }}
</div>
</div>
</div>
@@ -1,5 +1,5 @@
@block @block_myoverview @javascript
Feature: The my overview block allows users to easily access their courses and see upcoming activities
Feature: The my overview block allows users to easily access their courses
In order to enable the my overview block in a course
As a student
I can add the my overview block to my dashboard
@@ -14,59 +14,23 @@ Feature: The my overview block allows users to easily access their courses and s
| Course 1 | C1 | 0 | ##1 month ago## | ##15 days ago## |
| Course 2 | C2 | 0 | ##yesterday## | ##tomorrow## |
| Course 3 | C3 | 0 | ##first day of next month## | ##last day of next month## |
And the following "activities" exist:
| activity | course | idnumber | name | intro | timeopen | timeclose |
| choice | C2 | choice1 | Test choice 1 | Test choice description | ##yesterday## | ##tomorrow## |
| choice | C1 | choice2 | Test choice 2 | Test choice description | ##1 month ago## | ##15 days ago## |
| choice | C3 | choice3 | Test choice 3 | Test choice description | ##first day of +5 months## | ##last day of +5 months## |
| feedback | C2 | feedback1 | Test feedback 1 | Test feedback description | ##yesterday## | ##tomorrow## |
| feedback | C3 | feedback3 | Test feedback 3 | Test feedback description | ##first day of +5 months## | ##last day of +5 months## |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student1 | C2 | student |
| student1 | C3 | student |
Scenario: View courses and upcoming activities on timeline view
Given I log in as "student1"
And I click on "Timeline" "link" in the "Course overview" "block"
When I click on "Sort by dates" "link" in the "Course overview" "block"
Then I should see "Next 7 days" in the "Course overview" "block"
And I should see "Test choice 1 closes" in the "Course overview" "block"
And I should see "View choices" in the "Course overview" "block"
And I should see "Test feedback 1 closes" in the "Course overview" "block"
And I should see "Answer the questions" in the "Course overview" "block"
And I should see "Future" in the "Course overview" "block"
And I should see "Test choice 3 closes" in the "Course overview" "block"
And I should see "Test feedback 3 closes" in the "Course overview" "block"
And I log out
Scenario: Past activities should not be displayed on the timeline view
Given I log in as "student1"
And I click on "Timeline" "link" in the "Course overview" "block"
When I click on "Sort by dates" "link" in the "Course overview" "block"
And I should not see "Test choice 2 closes" in the "Course overview" "block"
And I log out
Scenario: See the courses I am enrolled by their status on courses view
Given I log in as "student1"
And I click on "Courses" "link" in the "Course overview" "block"
And I click on "In progress" "link" in the "Course overview" "block"
And I should see "Course 2" in the "Course overview" "block"
And I should not see "Course 1" in the "Course overview" "block"
And I click on "In progress" "button" in the "Course overview" "block"
And I click on "Future" "link" in the "Course overview" "block"
And I should see "Course 3" in the "Course overview" "block"
And I should not see "Course 1" in the "Course overview" "block"
And I click on "Future" "button" in the "Course overview" "block"
When I click on "Past" "link" in the "Course overview" "block"
Then I should see "Course 1" in the "Course overview" "block"
And I should not see "Course 2" in the "Course overview" "block"
And I should not see "Course 3" in the "Course overview" "block"
And I log out
Scenario: No activities should be displayed if the user is not enrolled
Given I log in as "student2"
And I click on "Timeline" "link" in the "Course overview" "block"
And I should see "No upcoming activities" in the "Course overview" "block"
When I click on "Courses" "link" in the "Course overview" "block"
Then I should see "No courses" in the "Course overview" "block"
And I log out
@@ -20,18 +20,6 @@ Feature: Course overview block show users their progress on courses
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
Scenario: Course progress percentage should not be displayed if completion is not enabled
Given I log in as "student1"
And I click on "Timeline" "link" in the "Course overview" "block"
When I click on "Sort by courses" "link" in the "Course overview" "block"
Then I should see "Test choice 1 closes" in the "#myoverview_timeline_courses" "css_element"
And I should not see "0%" in the "Course overview" "block"
And I click on "Courses" "link" in the "Course overview" "block"
And I click on "In progress" "link" in the "Course overview" "block"
And I should see "Course 1" in the "Course overview" "block"
And I should not see "0%" in the "Course overview" "block"
And I log out
Scenario: User complete activity and verify his progress
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
@@ -43,21 +31,11 @@ Feature: Course overview block show users their progress on courses
And I press "Save and return to course"
And I log out
And I log in as "student1"
And I click on "Sort by courses" "link" in the "Course overview" "block"
And I should see "Test choice 1 closes" in the "#myoverview_timeline_courses" "css_element"
And I should see "0%" in the "Course overview" "block"
And I click on "Courses" "link" in the "Course overview" "block"
When I click on "In progress" "link" in the "Course overview" "block"
Then I should see "Course 1" in the "Course overview" "block"
And I should see "0%" in the "Course overview" "block"
And I am on "Course 1" course homepage
And I follow "Test choice 1"
And I follow "Dashboard" in the user menu
And I click on "Timeline" "link" in the "Course overview" "block"
And I click on "Sort by courses" "link" in the "Course overview" "block"
And I should see "100%" in the "Course overview" "block"
And I click on "Courses" "link" in the "Course overview" "block"
And I click on "In progress" "link" in the "Course overview" "block"
And I should see "Course 1" in the "Course overview" "block"
And I should see "100%" in the "Course overview" "block"
And I log out
-28
View File
@@ -158,34 +158,6 @@ $doughnut-fill-colour: $brand-warning;
}
.block_myoverview {
.event-list-item {
.event-icon {
vertical-align: middle;
&::before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
}
}
.event-name-container {
vertical-align: middle;
max-width: calc(100% - 50px);
.event-name {
display: block;
}
}
}
.content-centred {
max-width: 900px;
margin-left: auto;
margin-right: auto;
}
.empty-placeholder-image-sm {
height: 50px;
}
-19
View File
@@ -11375,25 +11375,6 @@ div.editor_atto_toolbar button .icon {
width: 45px;
font-size: 45px; }
.block_myoverview .event-list-item .event-icon {
vertical-align: middle; }
.block_myoverview .event-list-item .event-icon::before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle; }
.block_myoverview .event-list-item .event-name-container {
vertical-align: middle;
max-width: calc(100% - 50px); }
.block_myoverview .event-list-item .event-name-container .event-name {
display: block; }
.block_myoverview .content-centred {
max-width: 900px;
margin-left: auto;
margin-right: auto; }
.block_myoverview .empty-placeholder-image-sm {
height: 50px; }
@@ -347,38 +347,6 @@
margin-left: 0;
}
.event-list-item {
border-bottom: 1px solid @tableBorder;
padding-bottom: 10px;
margin-bottom: 10px;
&:last-of-type {
border-bottom: none;
padding-bottom: 0;
margin-bottom: 0;
}
.event-icon {
vertical-align: middle;
&::before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
}
}
.event-name-container {
vertical-align: middle;
max-width: ~"calc(100% - 50px)";
.event-name {
display: block;
}
}
}
.empty-placeholder-image-sm {
height: 50px;
}
-26
View File
@@ -16520,32 +16520,6 @@ body {
.block_myoverview .row-fluid [class*="span"] {
margin-left: 0;
}
.block_myoverview .event-list-item {
border-bottom: 1px solid #ddd;
padding-bottom: 10px;
margin-bottom: 10px;
}
.block_myoverview .event-list-item:last-of-type {
border-bottom: none;
padding-bottom: 0;
margin-bottom: 0;
}
.block_myoverview .event-list-item .event-icon {
vertical-align: middle;
}
.block_myoverview .event-list-item .event-icon::before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
}
.block_myoverview .event-list-item .event-name-container {
vertical-align: middle;
max-width: calc(100% - 50px);
}
.block_myoverview .event-list-item .event-name-container .event-name {
display: block;
}
.block_myoverview .empty-placeholder-image-sm {
height: 50px;
}
@@ -1,95 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/course-event-list-item
This template renders an event list item for the myoverview block
in the courses view.
Example context (json):
{
"name": "Assignment due 1",
"url": "https://www.google.com",
"timesort": 1490320388,
"action": {
"name": "Submit assignment",
"url": "https://www.google.com",
"itemcount": 1,
"showitemcount": true,
"actionable": true
},
"icon": {
"key": "icon",
"component": "mod_assign",
"alttext": "Assignment icon"
}
}
}}
<li class="list-group-item event-list-item" data-region="event-list-item">
<div class="row-fluid visible-desktop">
<div class="span7">
<div class="d-inline-block event-icon">
{{#icon}}{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}{{/icon}}
</div>
<div class="d-inline-block event-name-container">
<a class="event-name text-truncate" href="{{{url}}}">{{{name}}}</a>
<div class="muted text-truncate">
<small>{{#userdate}} {{timesort}}, {{#str}} strftimerecent {{/str}} {{/userdate}}</small>
</div>
</div>
</div>
<div class="span5 text-truncate">
{{#action.actionable}}
<a href="{{{action.url}}}">{{action.name}}</a>
{{#action.itemcount}}
{{#action.showitemcount}}
<span class="badge">{{.}}</span>
{{/action.showitemcount}}
{{/action.itemcount}}
{{/action.actionable}}
{{^action.actionable}}
<div class="text-muted">{{action.name}}</div>
{{/action.actionable}}
</div>
</div>
<div class="row-fluid visible-tablet">
<div class="span12">
<div class="d-inline-block event-icon">
{{#icon}}{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}{{/icon}}
</div>
<div class="d-inline-block event-name-container">
<a class="event-name text-truncate" href="{{{url}}}">{{{name}}}</a>
<div class="muted text-truncate">
<small>{{#userdate}} {{timesort}}, {{#str}} strftimerecent {{/str}} {{/userdate}}</small>
</div>
</div>
</div>
</div>
<div class="row-fluid visible-phone">
<div class="span12">
<div class="d-inline-block event-icon">
{{#icon}}{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}{{/icon}}
</div>
<div class="d-inline-block event-name-container">
<a class="event-name text-truncate" href="{{{url}}}">{{{name}}}</a>
<div class="muted text-truncate">
<small>{{#userdate}} {{timesort}}, {{#str}} strftimerecent {{/str}} {{/userdate}}</small>
</div>
</div>
</div>
</div>
</li>
@@ -1,110 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/course-event-list
This template renders a list of events for the myoverview block
sort by courses view.
Example context (json):
{
"urls": {
"noevents": "#"
}
}
}}
<div data-region="event-list-container"
data-limit="{{$limit}}20{{/limit}}"
data-course-id="{{$courseid}}{{/courseid}}"
data-last-id="{{$lastid}}{{/lastid}}"
data-midnight="{{midnight}}"
id="event-list-container-{{$courseid}}{{/courseid}}">
<div data-region="event-list-content">
{{< block_myoverview/event-list-group }}
{{$title}}{{#str}} recentlyoverdue, block_myoverview {{/str}}{{/title}}
{{$extratitleclasses}}text-danger{{/extratitleclasses}}
{{$startday}}-14{{/startday}}
{{$endday}}0{{/endday}}
{{$eventlistitems}}
{{> block_myoverview/course-event-list-items }}
{{/eventlistitems}}
{{/ block_myoverview/event-list-group }}
{{< block_myoverview/event-list-group }}
{{$title}}{{#str}} today {{/str}}{{/title}}
{{$extratitleclasses}}{{/extratitleclasses}}
{{$startday}}0{{/startday}}
{{$endday}}1{{/endday}}
{{$eventlistitems}}
{{> block_myoverview/course-event-list-items }}
{{/eventlistitems}}
{{/ block_myoverview/event-list-group }}
{{< block_myoverview/event-list-group }}
{{$title}}{{#str}} next7days, block_myoverview {{/str}}{{/title}}
{{$extratitleclasses}}{{/extratitleclasses}}
{{$startday}}1{{/startday}}
{{$endday}}7{{/endday}}
{{$eventlistitems}}
{{> block_myoverview/course-event-list-items }}
{{/eventlistitems}}
{{/ block_myoverview/event-list-group }}
{{< block_myoverview/event-list-group }}
{{$title}}{{#str}} next30days, block_myoverview {{/str}}{{/title}}
{{$extratitleclasses}}{{/extratitleclasses}}
{{$startday}}7{{/startday}}
{{$endday}}30{{/endday}}
{{$eventlistitems}}
{{> block_myoverview/course-event-list-items }}
{{/eventlistitems}}
{{/ block_myoverview/event-list-group }}
{{< block_myoverview/event-list-group }}
{{$title}}{{#str}} future, block_myoverview {{/str}}{{/title}}
{{$extratitleclasses}}{{/extratitleclasses}}
{{$startday}}30{{/startday}}
{{$endday}}{{/endday}}
{{$eventlistitems}}
{{> block_myoverview/course-event-list-items }}
{{/eventlistitems}}
{{/ block_myoverview/event-list-group }}
<div class="text-xs-center text-center m-b-1">
<button type="button" class="btn btn-secondary" data-action="view-more">
{{#str}} viewmore {{/str}}
<span class="hidden" data-region="loading-icon-container">
{{> core/loading }}
</span>
</button>
</div>
</div>
<div class="hidden text-xs-center text-center m-y-3" data-region="empty-message">
<img class="empty-placeholder-image-sm"
src="{{urls.noevents}}"
alt="{{#str}} noevents, block_myoverview {{/str}}"
role="presentation">
<p class="text-muted m-t-1">{{#str}} noevents, block_myoverview {{/str}}</p>
<a href="{{viewurl}}" class="btn"
aria-label="{{#str}} viewcoursename, block_myoverview, {{{fullnamedisplay}}} {{/str}}">
{{#str}} viewcourse, block_myoverview {{/str}}
</a>
</div>
</div>
{{#js}}
require(['jquery', 'block_myoverview/event_list'], function($, EventList) {
var root = $("#event-list-container-{{$courseid}}{{/courseid}}");
EventList.registerEventListeners(root);
});
{{/js}}
@@ -1,44 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/course-item
This template renders the each course block containing a summary and calendar events.
Example context (json):
{
"shortname": "course 3",
"viewurl": "https://www.google.com",
"summary": "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout."
}
}}
<li class="list-group-item well well-small">
<div data-region="course-events-container" id="course-events-container-{{id}}" data-course-id="{{id}}">
<div class="row-fluid">
<div class="span3">
{{> block_myoverview/course-summary }}
</div>
<div class="span9">
{{< block_myoverview/course-event-list }}
{{$limit}}10{{/limit}}
{{$offset}}0{{/offset}}
{{$courseid}}{{id}}{{/courseid}}
{{/ block_myoverview/course-event-list }}
</div>
</div>
</div>
</li>
@@ -1,51 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/course-summary
This template renders the course summary (view by courses) for the myoverview block.
Example context (json):
{
"fullnamedisplay": "course 3",
"viewurl": "https://www.google.com",
"summary": "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout."
}
}}
<div class="course-info-container" id="course-info-container-{{id}}">
<div class="visible-desktop">
{{> block_myoverview/progress-chart}}
<h4><a href="{{viewurl}}" class="{{^visible}}dimmed{{/visible}}">{{{fullnamedisplay}}}</a></h4>
</div>
<div class="hidden-desktop">
<div class="media">
<div class="pull-left">
<div class="media-object">
{{> block_myoverview/progress-chart}}
</div>
</div>
<div class="media-body">
<h4 class="media-heading">
<a href="{{viewurl}}" class="{{^visible}}dimmed{{/visible}}">{{{fullnamedisplay}}}</a>
</h4>
</div>
</div>
</div>
<p class="muted">
{{#shortentext}} 140, {{{summary}}}{{/shortentext}}
</p>
</div>
@@ -0,0 +1,41 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/courses-view-nav-grouping-display-filter
This template renders the main content area for the myoverview block.
Example context (json):
{}
}}
<div data-region="courses-grouping-display-filter" class="btn-group">
<button type="button" class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span data-active-item-text>{{#str}} inprogress, block_myoverview {{/str}}</span>
<span data-region="caret" class="caret"></span>
</button>
<ul class="dropdown-menu" data-show-active-item>
<li class="dropdown-item active" data-target="#myoverview_courses_view_in_progress" data-toggle="tab">
<a tabindex="-1" href="#">{{#str}} inprogress, block_myoverview {{/str}}</a>
</li>
<li class="dropdown-item" data-target="#myoverview_courses_view_future" data-toggle="tab">
<a tabindex="-1" href="#">{{#str}} future, block_myoverview {{/str}}</a>
</li>
<li class="dropdown-item" data-target="#myoverview_courses_view_past" data-toggle="tab">
<a tabindex="-1" href="#">{{#str}} past, block_myoverview {{/str}}</a>
</li>
</ul>
</div>
@@ -24,19 +24,6 @@
}}
<div id="courses-view-{{uniqid}}" data-region="courses-view">
{{#hascourses}}
<div class="row text-center">
<div class="btn-group m-b-1" role="group" data-toggle="btns">
<a class="btn btn-default active" href="#myoverview_courses_view_in_progress" data-toggle="tab">
{{#str}} inprogress, block_myoverview {{/str}}
</a>
<a class="btn btn-default" href="#myoverview_courses_view_future" data-toggle="tab">
{{#str}} future, block_myoverview {{/str}}
</a>
<a class="btn btn-default" href="#myoverview_courses_view_past" data-toggle="tab">
{{#str}} past, block_myoverview {{/str}}
</a>
</div>
</div>
<div class="tab-content">
<div class="tab-pane active fade in" id="myoverview_courses_view_in_progress">
{{#inprogress}}
@@ -1,75 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/event-list-group
This template renders a list of events for the myoverview block.
Example context (json):
{
"events": [
{
"enddate": "Nov 4th, 10am",
"name": "Assignment due 1",
"url": "https://www.google.com",
"course": {
"fullname": "Course 1"
},
"action": {
"name": "Submit assignment",
"url": "https://www.google.com",
"itemcount": 1
},
"icon": {
"key": "icon",
"component": "mod_assign",
"alttext": "Assignment icon"
}
},
{
"enddate": "Nov 4th, 10am",
"name": "Assignment due 2",
"url": "https://www.google.com",
"course": {
"fullname": "Course 1"
},
"action": {
"name": "Submit assignment",
"url": "https://www.google.com",
"itemcount": 1
},
"icon": {
"key": "icon",
"component": "mod_assign",
"alttext": "Assignment icon"
}
}
]
}
}}
<div data-region="event-list-group-container"
data-start-day="{{$startday}}0{{/startday}}"
data-end-day="{{$endday}}{{/endday}}"
class="hidden">
<h5 class="{{$extratitleclasses}}{{/extratitleclasses}}" id="event-list-title-{{uniqid}}"><strong>{{$title}}{{/title}}</strong></h5>
<ul class="unstyled well well-small" data-region="event-list" aria-describedby="event-list-title-{{uniqid}}">
{{$eventlistitems}}
{{> block_myoverview/event-list-items }}
{{/eventlistitems}}
</ul>
</div>
@@ -1,104 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/event-list-item
This template renders an event list item for the myoverview block.
Example context (json):
{
"name": "Assignment due 1",
"url": "https://www.google.com",
"timesort": 1490320388,
"course": {
"fullnamedisplay": "Course 1"
},
"action": {
"name": "Submit assignment",
"url": "https://www.google.com",
"itemcount": 1,
"showitemcount": true,
"actionable": true
},
"icon": {
"key": "icon",
"component": "mod_assign",
"alttext": "Assignment icon"
}
}
}}
<li class="list-group-item event-list-item" data-region="event-list-item">
<div class="row-fluid visible-desktop">
<div class="span6">
<div class="d-inline-block event-icon">
{{#icon}}{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}{{/icon}}
</div>
<div class="d-inline-block event-name-container">
<a class="event-name text-truncate" href="{{{url}}}">{{{name}}}</a>
<div class="muted text-truncate"><small>{{{course.fullnamedisplay}}}</small></div>
</div>
</div>
<div class="span6">
<div class="row-fluid">
<div class="span5 text-truncate">
{{#userdate}} {{timesort}}, {{#str}} strftimerecent {{/str}} {{/userdate}}
</div>
<div class="span7 text-truncate">
{{#action.actionable}}
<a href="{{{action.url}}}">{{action.name}}</a>
{{#action.itemcount}}
{{#action.showitemcount}}
<span class="badge">{{.}}</span>
{{/action.showitemcount}}
{{/action.itemcount}}
{{/action.actionable}}
{{^action.actionable}}
<div class="muted">{{action.name}}</div>
{{/action.actionable}}
</div>
</div>
</div>
</div>
<div class="row-fluid visible-tablet">
<div class="span8">
<div class="d-inline-block event-icon">
{{#icon}}{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}{{/icon}}
</div>
<div class="d-inline-block event-name-container">
<a class="event-name text-truncate" href="{{{url}}}">{{name}}</a>
<div class="muted text-truncate"><small>{{{course.fullnamedisplay}}}</small></div>
</div>
</div>
<div class="span4 text-right text-truncate">
{{#userdate}} {{timesort}}, {{#str}} strftimerecent {{/str}} {{/userdate}}
</div>
</div>
<div class="row-fluid visible-phone">
<div class="span12">
<div class="d-inline-block event-icon">
{{#icon}}{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}{{/icon}}
</div>
<div class="d-inline-block event-name-container">
<a class="event-name text-truncate" href="{{{url}}}">{{{name}}}</a>
<div class="muted text-truncate"><small>{{{course.fullnamedisplay}}}</small></div>
</div>
<div class="text-right text-truncate">
{{#userdate}} {{timesort}}, {{#str}} strftimerecent {{/str}} {{/userdate}}
</div>
</div>
</div>
</li>
@@ -24,33 +24,20 @@
}}
<div id="block-myoverview-{{uniqid}}" class="block-myoverview" data-region="myoverview">
<ul id="block-myoverview-view-choices-{{uniqid}}" class="nav nav-tabs" role="tablist">
<li class="nav-item {{#viewingtimeline}}active{{/viewingtimeline}}">
<a class="nav-link" href="#myoverview_timeline_view" role="tab" data-toggle="tab" data-tabname="timeline">
{{#str}} timeline, block_myoverview {{/str}}
</a>
</li>
<li class="nav-item {{#viewingcourses}}active{{/viewingcourses}}">
<a class="nav-link" href="#myoverview_courses_view" role="tab" data-toggle="tab" data-tabname="courses">
{{#str}} courses {{/str}}
</a>
</li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane fade {{#viewingtimeline}}in active{{/viewingtimeline}}" id="myoverview_timeline_view">
{{> block_myoverview/timeline-view }}
</div>
<div role="tabpanel" class="tab-pane fade {{#viewingcourses}}in active{{/viewingcourses}}" id="myoverview_courses_view">
<div class="container-fluid p-0 m-b-1">
<div class="row-fluid no-gutters">
{{#coursesview}}
{{> block_myoverview/courses-view }}
{{#hascourses}}
<div class="{{#viewingtimeline}}d-none{{/viewingtimeline}}" data-tab-content="courses">
{{> block_myoverview/courses-view-nav-grouping-display-filter }}
</div>
{{/hascourses}}
{{/coursesview}}
</div>
</div>
<div class="container-fluid p-0">
{{#coursesview}}
{{> block_myoverview/courses-view }}
{{/coursesview}}
</div>
</div>
{{#js}}
require(['jquery', 'block_myoverview/tab_preferences'], function($, TabPreferences) {
var root = $('#block-myoverview-view-choices-{{uniqid}}');
TabPreferences.registerEventListeners(root);
});
{{/js}}
@@ -1,55 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_myoverview/timeline-view
This template renders the timeline view for the myoverview block.
Example context (json):
{}
}}
<div id="timeline-view-{{uniqid}}" data-region="timeline-view">
<div class="row text-center">
<div class="btn-group m-b-1" role="group" data-toggle="btns">
<a class="btn btn-default active" href="#myoverview_timeline_dates" data-toggle="tab">
{{#str}} sortbydates, block_myoverview {{/str}}
</a>
<a class="btn btn-default" href="#myoverview_timeline_courses" data-toggle="tab">
{{#str}} sortbycourses, block_myoverview {{/str}}
</a>
</div>
</div>
<div class="tab-content">
<div class="tab-pane active fade in" id="myoverview_timeline_dates">
{{> block_myoverview/timeline-view-dates }}
</div>
<div class="tab-pane fade" id="myoverview_timeline_courses">
{{> block_myoverview/timeline-view-courses }}
</div>
</div>
</div>
{{#js}}
require(['jquery', 'core/custom_interaction_events'], function($, customEvents) {
var root = $('#timeline-view-{{uniqid}}');
customEvents.define(root, [customEvents.events.activate]);
root.on(customEvents.events.activate, '[data-toggle="btns"] > .btn', function() {
root.find('.btn.active').removeClass('active');
$(this).addClass('active');
});
});
{{/js}}