original_string: public function get_available_areas() {
          global $CFG;
  
          $this->ensure_isset(array('context', 'component'));
  
          if ($this->get_context()->contextlevel == CONTEXT_SYSTEM) {
              if ($this->get_component() !== 'core_grading') {
                  throw new coding_exception('Unsupported component at the system context');
              } else {
                  return array();
              }
  
          } else if ($this->get_context()->contextlevel == CONTEXT_MODULE) {
              list($context, $course, $cm) = get_context_info_array($this->get_context()->id);
              return self::available_areas('mod_'.$cm->modname);
  
          } else {
              throw new coding_exception('Unsupported gradable area context level');
          }
      }
code: public function get_available_areas() {
          global $CFG;
  
          $this->ensure_isset(array('context', 'component'));
  
          if ($this->get_context()->contextlevel == CONTEXT_SYSTEM) {
              if ($this->get_component() !== 'core_grading') {
                  throw new coding_exception('Unsupported component at the system context');
              } else {
                  return array();
              }
  
          } else if ($this->get_context()->contextlevel == CONTEXT_MODULE) {
              list($context, $course, $cm) = get_context_info_array($this->get_context()->id);
              return self::available_areas('mod_'.$cm->modname);
  
          } else {
              throw new coding_exception('Unsupported gradable area context level');
          }
      }
code_tokens: public function get_available_areas ( ) { global $ CFG ; $ this -> ensure_isset ( array ( 'context' , 'component' ) ) ; if ( $ this -> get_context ( ) -> contextlevel == CONTEXT_SYSTEM ) { if ( $ this -> get_component ( ) !== 'core_grading' ) { throw new coding_exception ( 'Unsupported component at the system context' ) ; } else { return array ( ) ; } } else if ( $ this -> get_context ( ) -> contextlevel == CONTEXT_MODULE ) { list ( $ context , $ course , $ cm ) = get_context_info_array ( $ this -> get_context ( ) -> id ) ; return self :: available_areas ( 'mod_' . $ cm -> modname ) ; } else { throw new coding_exception ( 'Unsupported gradable area context level' ) ; } }
docstring: Returns the list of gradable areas in the given context and component
  
  This performs a callback to the library of the relevant plugin to obtain
  the list of supported areas.
  @return array of (string)areacode => (string)localized title of the area
docstring_tokens: Returns the list of gradable areas in the given context and component