original_string: public function get_manual_enrol_button(course_enrolment_manager $manager) {
          global $CFG, $PAGE;
          require_once($CFG->dirroot.'/cohort/lib.php');
  
          $instance = null;
          $instances = array();
          foreach ($manager->get_enrolment_instances() as $tempinstance) {
              if ($tempinstance->enrol == 'manual') {
                  if ($instance === null) {
                      $instance = $tempinstance;
                  }
                  $instances[] = array('id' => $tempinstance->id, 'name' => $this->get_instance_name($tempinstance));
              }
          }
          if (empty($instance)) {
              return false;
          }
  
          $link = $this->get_manual_enrol_link($instance);
          if (!$link) {
              return false;
          }
  
          $button = new enrol_user_button($link, get_string('enrolusers', 'enrol_manual'), 'get');
          $button->class .= ' enrol_manual_plugin';
  
          $context = context_course::instance($instance->courseid);
          $arguments = array('contextid' => $context->id);
  
          $PAGE->requires->js_call_amd('enrol_manual/quickenrolment', 'init', array($arguments));
  
          return $button;
      }
code: public function get_manual_enrol_button(course_enrolment_manager $manager) {
          global $CFG, $PAGE;
          require_once($CFG->dirroot.'/cohort/lib.php');
  
          $instance = null;
          $instances = array();
          foreach ($manager->get_enrolment_instances() as $tempinstance) {
              if ($tempinstance->enrol == 'manual') {
                  if ($instance === null) {
                      $instance = $tempinstance;
                  }
                  $instances[] = array('id' => $tempinstance->id, 'name' => $this->get_instance_name($tempinstance));
              }
          }
          if (empty($instance)) {
              return false;
          }
  
          $link = $this->get_manual_enrol_link($instance);
          if (!$link) {
              return false;
          }
  
          $button = new enrol_user_button($link, get_string('enrolusers', 'enrol_manual'), 'get');
          $button->class .= ' enrol_manual_plugin';
  
          $context = context_course::instance($instance->courseid);
          $arguments = array('contextid' => $context->id);
  
          $PAGE->requires->js_call_amd('enrol_manual/quickenrolment', 'init', array($arguments));
  
          return $button;
      }
code_tokens: public function get_manual_enrol_button ( course_enrolment_manager $ manager ) { global $ CFG , $ PAGE ; require_once ( $ CFG -> dirroot . '/cohort/lib.php' ) ; $ instance = null ; $ instances = array ( ) ; foreach ( $ manager -> get_enrolment_instances ( ) as $ tempinstance ) { if ( $ tempinstance -> enrol == 'manual' ) { if ( $ instance === null ) { $ instance = $ tempinstance ; } $ instances [ ] = array ( 'id' => $ tempinstance -> id , 'name' => $ this -> get_instance_name ( $ tempinstance ) ) ; } } if ( empty ( $ instance ) ) { return false ; } $ link = $ this -> get_manual_enrol_link ( $ instance ) ; if ( ! $ link ) { return false ; } $ button = new enrol_user_button ( $ link , get_string ( 'enrolusers' , 'enrol_manual' ) , 'get' ) ; $ button -> class .= ' enrol_manual_plugin' ; $ context = context_course :: instance ( $ instance -> courseid ) ; $ arguments = array ( 'contextid' => $ context -> id ) ; $ PAGE -> requires -> js_call_amd ( 'enrol_manual/quickenrolment' , 'init' , array ( $ arguments ) ) ; return $ button ; }
docstring: Returns a button to manually enrol users through the manual enrolment plugin.
  
  By default the first manual enrolment plugin instance available in the course is used.
  If no manual enrolment instances exist within the course then false is returned.
  
  This function also adds a quickenrolment JS ui to the page so that users can be enrolled
  via AJAX.
  
  @param course_enrolment_manager $manager
  @return enrol_user_button
docstring_tokens: Returns a button to manually enrol users through the manual enrolment plugin .