original_string: public function get_other_users_for_display(core_enrol_renderer $renderer, moodle_url $pageurl, $sort, $direction, $page, $perpage) {
  
          $userroles = $this->get_other_users($sort, $direction, $page, $perpage);
          $roles = $this->get_all_roles();
          $plugins = $this->get_enrolment_plugins(false);
  
          $context    = $this->get_context();
          $now = time();
          $extrafields = get_extra_user_fields($context);
  
          $users = array();
          foreach ($userroles as $userrole) {
              $contextid = $userrole->contextid;
              unset($userrole->contextid); // This would collide with user avatar.
              if (!array_key_exists($userrole->id, $users)) {
                  $users[$userrole->id] = $this->prepare_user_for_display($userrole, $extrafields, $now);
              }
              $a = new stdClass;
              $a->role = $roles[$userrole->roleid]->localname;
              if ($contextid == $this->context->id) {
                  $changeable = true;
                  if ($userrole->component) {
                      $changeable = false;
                      if (strpos($userrole->component, 'enrol_') === 0) {
                          $plugin = substr($userrole->component, 6);
                          if (isset($plugins[$plugin])) {
                              $changeable = !$plugins[$plugin]->roles_protected();
                          }
                      }
                  }
                  $roletext = get_string('rolefromthiscourse', 'enrol', $a);
              } else {
                  $changeable = false;
                  switch ($userrole->contextlevel) {
                      case CONTEXT_COURSE :
                          // Meta course
                          $roletext = get_string('rolefrommetacourse', 'enrol', $a);
                          break;
                      case CONTEXT_COURSECAT :
                          $roletext = get_string('rolefromcategory', 'enrol', $a);
                          break;
                      case CONTEXT_SYSTEM:
                      default:
                          $roletext = get_string('rolefromsystem', 'enrol', $a);
                          break;
                  }
              }
              if (!isset($users[$userrole->id]['roles'])) {
                  $users[$userrole->id]['roles'] = array();
              }
              $users[$userrole->id]['roles'][$userrole->roleid] = array(
                  'text' => $roletext,
                  'unchangeable' => !$changeable
              );
          }
          return $users;
      }
code: public function get_other_users_for_display(core_enrol_renderer $renderer, moodle_url $pageurl, $sort, $direction, $page, $perpage) {
  
          $userroles = $this->get_other_users($sort, $direction, $page, $perpage);
          $roles = $this->get_all_roles();
          $plugins = $this->get_enrolment_plugins(false);
  
          $context    = $this->get_context();
          $now = time();
          $extrafields = get_extra_user_fields($context);
  
          $users = array();
          foreach ($userroles as $userrole) {
              $contextid = $userrole->contextid;
              unset($userrole->contextid); // This would collide with user avatar.
              if (!array_key_exists($userrole->id, $users)) {
                  $users[$userrole->id] = $this->prepare_user_for_display($userrole, $extrafields, $now);
              }
              $a = new stdClass;
              $a->role = $roles[$userrole->roleid]->localname;
              if ($contextid == $this->context->id) {
                  $changeable = true;
                  if ($userrole->component) {
                      $changeable = false;
                      if (strpos($userrole->component, 'enrol_') === 0) {
                          $plugin = substr($userrole->component, 6);
                          if (isset($plugins[$plugin])) {
                              $changeable = !$plugins[$plugin]->roles_protected();
                          }
                      }
                  }
                  $roletext = get_string('rolefromthiscourse', 'enrol', $a);
              } else {
                  $changeable = false;
                  switch ($userrole->contextlevel) {
                      case CONTEXT_COURSE :
                          // Meta course
                          $roletext = get_string('rolefrommetacourse', 'enrol', $a);
                          break;
                      case CONTEXT_COURSECAT :
                          $roletext = get_string('rolefromcategory', 'enrol', $a);
                          break;
                      case CONTEXT_SYSTEM:
                      default:
                          $roletext = get_string('rolefromsystem', 'enrol', $a);
                          break;
                  }
              }
              if (!isset($users[$userrole->id]['roles'])) {
                  $users[$userrole->id]['roles'] = array();
              }
              $users[$userrole->id]['roles'][$userrole->roleid] = array(
                  'text' => $roletext,
                  'unchangeable' => !$changeable
              );
          }
          return $users;
      }
code_tokens: public function get_other_users_for_display ( core_enrol_renderer $ renderer , moodle_url $ pageurl , $ sort , $ direction , $ page , $ perpage ) { $ userroles = $ this -> get_other_users ( $ sort , $ direction , $ page , $ perpage ) ; $ roles = $ this -> get_all_roles ( ) ; $ plugins = $ this -> get_enrolment_plugins ( false ) ; $ context = $ this -> get_context ( ) ; $ now = time ( ) ; $ extrafields = get_extra_user_fields ( $ context ) ; $ users = array ( ) ; foreach ( $ userroles as $ userrole ) { $ contextid = $ userrole -> contextid ; unset ( $ userrole -> contextid ) ; // This would collide with user avatar. if ( ! array_key_exists ( $ userrole -> id , $ users ) ) { $ users [ $ userrole -> id ] = $ this -> prepare_user_for_display ( $ userrole , $ extrafields , $ now ) ; } $ a = new stdClass ; $ a -> role = $ roles [ $ userrole -> roleid ] -> localname ; if ( $ contextid == $ this -> context -> id ) { $ changeable = true ; if ( $ userrole -> component ) { $ changeable = false ; if ( strpos ( $ userrole -> component , 'enrol_' ) === 0 ) { $ plugin = substr ( $ userrole -> component , 6 ) ; if ( isset ( $ plugins [ $ plugin ] ) ) { $ changeable = ! $ plugins [ $ plugin ] -> roles_protected ( ) ; } } } $ roletext = get_string ( 'rolefromthiscourse' , 'enrol' , $ a ) ; } else { $ changeable = false ; switch ( $ userrole -> contextlevel ) { case CONTEXT_COURSE : // Meta course $ roletext = get_string ( 'rolefrommetacourse' , 'enrol' , $ a ) ; break ; case CONTEXT_COURSECAT : $ roletext = get_string ( 'rolefromcategory' , 'enrol' , $ a ) ; break ; case CONTEXT_SYSTEM : default : $ roletext = get_string ( 'rolefromsystem' , 'enrol' , $ a ) ; break ; } } if ( ! isset ( $ users [ $ userrole -> id ] [ 'roles' ] ) ) { $ users [ $ userrole -> id ] [ 'roles' ] = array ( ) ; } $ users [ $ userrole -> id ] [ 'roles' ] [ $ userrole -> roleid ] = array ( 'text' => $ roletext , 'unchangeable' => ! $ changeable ) ; } return $ users ; }
docstring: Gets an array of other users in this course ready for display.
  
  Other users are users who have been assigned or inherited roles within this
  course but have not been enrolled.
  
  @param core_enrol_renderer $renderer
  @param moodle_url $pageurl
  @param string $sort
  @param string $direction ASC | DESC
  @param int $page Starting from 0
  @param int $perpage
  @return array
docstring_tokens: Gets an array of other users in this course ready for display .