本文整理汇总了PHP中course_enrolment_manager::edit_enrolment方法的典型用法代码示例。如果您正苦于以下问题:PHP course_enrolment_manager::edit_enrolment方法的具体用法?PHP course_enrolment_manager::edit_enrolment怎么用?PHP course_enrolment_manager::edit_enrolment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类course_enrolment_manager
的用法示例。
在下文中一共展示了course_enrolment_manager::edit_enrolment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$PAGE->set_url($url);
$PAGE->set_pagelayout('admin');
navigation_node::override_active_url($usersurl);
list($instance, $plugin) = $manager->get_user_enrolment_components($ue);
if (!$plugin->allow_manage($instance) || $instance->enrol != 'invitation' || !$plugin instanceof enrol_invitation_plugin) {
print_error('erroreditenrolment', 'enrol');
}
$mform = new enrol_invitation_user_enrolment_form($url, array('user' => $user, 'course' => $course, 'ue' => $ue));
$mform->set_data($PAGE->url->params());
// Check the form hasn't been cancelled.
if ($mform->is_cancelled()) {
redirect($returnurl);
} else {
if ($mform->is_submitted() && $mform->is_validated() && confirm_sesskey()) {
// The forms been submit, validated and the sesskey has been checked ... edit the enrolment.
$data = $mform->get_data();
if ($manager->edit_enrolment($ue, $data)) {
redirect($returnurl);
}
}
}
$fullname = fullname($user);
$title = get_string('editenrolment', 'enrol_invitation');
$PAGE->set_title($title);
$PAGE->set_heading($title);
$PAGE->navbar->add($title);
$PAGE->navbar->add($fullname);
echo $OUTPUT->header();
echo $OUTPUT->heading($fullname);
$mform->display();
echo $OUTPUT->footer();
示例2: array
/**
* Edits the details of a users enrolment in the course
*/
/**
* Edits the details of a users enrolment in the course
*/
case 'edit':
$ue = $DB->get_record('user_enrolments', array('id' => required_param('ue', PARAM_INT)), '*', MUST_EXIST);
//Only show the edit form if the user has the appropriate capability
list($instance, $plugin) = $manager->get_user_enrolment_components($ue);
if ($instance && $plugin && $plugin->allow_manage($instance) && has_capability("enrol/{$instance->enrol}:manage", $manager->get_context())) {
$user = $DB->get_record('user', array('id' => $ue->userid), '*', MUST_EXIST);
$mform = new enrol_users_edit_form(NULL, array('user' => $user, 'course' => $course, 'ue' => $ue));
$mform->set_data($PAGE->url->params());
$data = $mform->get_data();
if ($mform->is_cancelled() || $data && $manager->edit_enrolment($ue, $data)) {
redirect($PAGE->url);
} else {
$pagetitle = fullname($user);
}
$actiontaken = true;
}
break;
}
// If we took an action display we need to display something special.
if ($actiontaken) {
if (empty($pageheading)) {
$pageheading = $pagetitle;
}
$PAGE->set_title($pagetitle);
$PAGE->set_heading($pageheading);