original_string: public function get_potential_users($enrolid, $search = '', $searchanywhere = false, $page = 0, $perpage = 25,
              $addedenrollment = 0, $returnexactcount = false) {
          global $DB;
  
          list($ufields, $params, $wherecondition) = $this->get_basic_search_conditions($search, $searchanywhere);
  
          $fields      = 'SELECT '.$ufields;
          $countfields = 'SELECT COUNT(1)';
          $sql = " FROM {user} u
              LEFT JOIN {user_enrolments} ue ON (ue.userid = u.id AND ue.enrolid = :enrolid)
                  WHERE $wherecondition
                        AND ue.id IS NULL";
          $params['enrolid'] = $enrolid;
  
          return $this->execute_search_queries($search, $fields, $countfields, $sql, $params, $page, $perpage, $addedenrollment,
                  $returnexactcount);
      }
code: public function get_potential_users($enrolid, $search = '', $searchanywhere = false, $page = 0, $perpage = 25,
              $addedenrollment = 0, $returnexactcount = false) {
          global $DB;
  
          list($ufields, $params, $wherecondition) = $this->get_basic_search_conditions($search, $searchanywhere);
  
          $fields      = 'SELECT '.$ufields;
          $countfields = 'SELECT COUNT(1)';
          $sql = " FROM {user} u
              LEFT JOIN {user_enrolments} ue ON (ue.userid = u.id AND ue.enrolid = :enrolid)
                  WHERE $wherecondition
                        AND ue.id IS NULL";
          $params['enrolid'] = $enrolid;
  
          return $this->execute_search_queries($search, $fields, $countfields, $sql, $params, $page, $perpage, $addedenrollment,
                  $returnexactcount);
      }
code_tokens: public function get_potential_users ( $ enrolid , $ search = '' , $ searchanywhere = false , $ page = 0 , $ perpage = 25 , $ addedenrollment = 0 , $ returnexactcount = false ) { global $ DB ; list ( $ ufields , $ params , $ wherecondition ) = $ this -> get_basic_search_conditions ( $ search , $ searchanywhere ) ; $ fields = 'SELECT ' . $ ufields ; $ countfields = 'SELECT COUNT(1)' ; $ sql = " FROM {user} u
              LEFT JOIN {user_enrolments} ue ON (ue.userid = u.id AND ue.enrolid = :enrolid)
                  WHERE $wherecondition
                        AND ue.id IS NULL" ; $ params [ 'enrolid' ] = $ enrolid ; return $ this -> execute_search_queries ( $ search , $ fields , $ countfields , $ sql , $ params , $ page , $ perpage , $ addedenrollment , $ returnexactcount ) ; }
docstring: Gets an array of the users that can be enrolled in this course.
  
  @global moodle_database $DB
  @param int $enrolid
  @param string $search
  @param bool $searchanywhere
  @param int $page Defaults to 0
  @param int $perpage Defaults to 25
  @param int $addedenrollment Defaults to 0
  @param bool $returnexactcount Return the exact total users using count_record or not.
  @return array with two or three elements:
  int totalusers Number users matching the search. (This element only exist if $returnexactcount was set to true)
  array users List of user objects returned by the query.
  boolean moreusers True if there are still more users, otherwise is False.
  @throws dml_exception
docstring_tokens: Gets an array of the users that can be enrolled in this course .