$context = context_course::instance($courseid); if (!has_capability('enrol/invitation:enrol', $context)) { throw new moodle_exception('nopermissiontosendinvitation', 'enrol_invitation', $courseurl); } $PAGE->set_context($context); $PAGE->set_url(new moodle_url('/enrol/invitation/invitation.php', array('courseid' => $courseid))); $PAGE->set_pagelayout('course'); $PAGE->set_course($course); $pagetitle = get_string('inviteusers', 'enrol_invitation'); $PAGE->set_heading($pagetitle); $PAGE->set_title($pagetitle); $PAGE->navbar->add($pagetitle); echo $OUTPUT->header(); // Print out a heading. echo $OUTPUT->heading($pagetitle, 2, 'headingblock'); print_page_tabs('invite'); // OUTPUT page tabs. $invitationmanager = new invitation_manager($courseid); // Make sure that site has invitation plugin installed. $instance = $invitationmanager->get_invitation_instance($courseid, true); // If the user was sent to this page by selecting 'resend invite', then // prefill the form with the data used to resend the invite. $prefilled = array(); if ($inviteid) { if ($invite = $DB->get_record('enrol_invitation', array('courseid' => $courseid, 'id' => $inviteid))) { $prefilled['roleid'] = $invite->roleid; $prefilled['email'] = $invite->email; $prefilled['subject'] = $invite->subject; $prefilled['message'] = $invite->message; $prefilled['show_from_email'] = $invite->show_from_email; $prefilled['notify_inviter'] = $invite->notify_inviter;
$PAGE->set_context($context); $PAGE->set_url(new moodle_url('/enrol/invitation/history.php', array('courseid' => $courseid))); $PAGE->set_pagelayout('course'); $PAGE->set_course($course); $pagetitle = get_string('invitehistory', 'enrol_invitation'); $PAGE->set_heading($pagetitle); $PAGE->set_title($pagetitle); $PAGE->navbar->add($pagetitle); // Do not display the page if we are going to be redirecting the user. if ($actionid != invitation_manager::INVITE_RESEND) { // OUTPUT form. echo $OUTPUT->header(); // Print out a heading. echo $OUTPUT->heading($pagetitle, 2, 'headingblock'); // OUTPUT page tabs. print_page_tabs('history'); } // Course must have invitation plugin installed (will give error if not found). $invitationmanager = new invitation_manager($courseid, true); // Get invites and display them. $invites = $invitationmanager->get_invites(); if (empty($invites)) { echo $OUTPUT->notification(get_string('noinvitehistory', 'enrol_invitation'), 'notifymessage'); } else { // Update invitation if the user decided to revoke/extend/resend an invite. if ($inviteid && $actionid) { if (!($curr_invite = $invites[$inviteid])) { print_error('invalidinviteid'); } if ($actionid == invitation_manager::INVITE_REVOKE) { // Set the invite to be expired.