Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeline events #169

Merged
merged 3 commits into from
Nov 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ function zoom_calendar_item_update(stdClass $zoom) {
require_once($CFG->dirroot.'/calendar/lib.php');

$event = new stdClass();
$event->type = CALENDAR_EVENT_TYPE_ACTION;
$event->timesort = $zoom->start_time;
$event->name = $zoom->name;
if ($zoom->intro) {
$event->description = $zoom->intro;
Expand Down Expand Up @@ -376,6 +378,39 @@ function zoom_calendar_item_delete(stdClass $zoom) {
}
}

/**
* This function receives a calendar event and returns the action associated with it, or null if there is none.
*
* This is used by block_myoverview in order to display the event appropriately. If null is returned then the event
* is not displayed on the block.
*
* @param calendar_event $event
* @param \core_calendar\action_factory $factory
* @param int $userid User id override
* @return \core_calendar\local\event\entities\action_interface|null
*/
function mod_zoom_core_calendar_provide_event_action(calendar_event $event,
\core_calendar\action_factory $factory, $userid = null) {
global $CFG, $DB, $USER;

require_once($CFG->dirroot . '/mod/zoom/locallib.php');

if (empty($userid)) {
$userid = $USER->id;
}

$cm = get_fast_modinfo($event->courseid, $userid)->instances['zoom'][$event->instance];
$zoom = $DB->get_record('zoom', array('id' => $cm->instance), '*');
list($inprogress, $available, $finished) = zoom_get_state($zoom);

return $factory->create_instance(
get_string('join_meeting', 'zoom'),
new \moodle_url('/mod/zoom/view.php', array('id' => $cm->id)),
1,
$available
);
}

/* Gradebook API */

/**
Expand Down