original_string: public static function is_user_gradable_in_course($courseid, $userid) {
          global $CFG;
  
          $gradableuser = false;
          $coursecontext = \context_course::instance($courseid);
          if (is_enrolled($coursecontext, $userid, '', false)) {
              $roles = get_user_roles($coursecontext, $userid);
              $gradebookroles = explode(',', $CFG->gradebookroles);
              foreach ($roles as $role) {
                  foreach ($gradebookroles as $gradebookrole) {
                      if ($role->roleid = $gradebookrole) {
                          $gradableuser = true;
                      }
                  }
              }
          }
  
          return $gradableuser;
      }
code: public static function is_user_gradable_in_course($courseid, $userid) {
          global $CFG;
  
          $gradableuser = false;
          $coursecontext = \context_course::instance($courseid);
          if (is_enrolled($coursecontext, $userid, '', false)) {
              $roles = get_user_roles($coursecontext, $userid);
              $gradebookroles = explode(',', $CFG->gradebookroles);
              foreach ($roles as $role) {
                  foreach ($gradebookroles as $gradebookrole) {
                      if ($role->roleid = $gradebookrole) {
                          $gradableuser = true;
                      }
                  }
              }
          }
  
          return $gradableuser;
      }
code_tokens: public static function is_user_gradable_in_course ( $ courseid , $ userid ) { global $ CFG ; $ gradableuser = false ; $ coursecontext = \ context_course :: instance ( $ courseid ) ; if ( is_enrolled ( $ coursecontext , $ userid , '' , false ) ) { $ roles = get_user_roles ( $ coursecontext , $ userid ) ; $ gradebookroles = explode ( ',' , $ CFG -> gradebookroles ) ; foreach ( $ roles as $ role ) { foreach ( $ gradebookroles as $ gradebookrole ) { if ( $ role -> roleid = $ gradebookrole ) { $ gradableuser = true ; } } } } return $ gradableuser ; }
docstring: Check if a user can be graded in a course
  
  @param int $courseid The course
  @param int $userid The user
  @return bool
docstring_tokens: Check if a user can be graded in a course