Example #1
0
             $actiontaken = true;
         }
         break;
         /**
          * 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;