original_string: public static function get_course_groups($courseid) {
          $params = self::validate_parameters(self::get_course_groups_parameters(), array('courseid'=>$courseid));
  
          // now security checks
          $context = context_course::instance($params['courseid'], IGNORE_MISSING);
          try {
              self::validate_context($context);
          } catch (Exception $e) {
                  $exceptionparam = new stdClass();
                  $exceptionparam->message = $e->getMessage();
                  $exceptionparam->courseid = $params['courseid'];
                  throw new moodle_exception('errorcoursecontextnotvalid' , 'webservice', '', $exceptionparam);
          }
          require_capability('moodle/course:managegroups', $context);
  
          $gs = groups_get_all_groups($params['courseid'], 0, 0,
              'g.id, g.courseid, g.name, g.idnumber, g.description, g.descriptionformat, g.enrolmentkey');
  
          $groups = array();
          foreach ($gs as $group) {
              list($group->description, $group->descriptionformat) =
                  external_format_text($group->description, $group->descriptionformat,
                          $context->id, 'group', 'description', $group->id);
              $groups[] = (array)$group;
          }
  
          return $groups;
      }
code: public static function get_course_groups($courseid) {
          $params = self::validate_parameters(self::get_course_groups_parameters(), array('courseid'=>$courseid));
  
          // now security checks
          $context = context_course::instance($params['courseid'], IGNORE_MISSING);
          try {
              self::validate_context($context);
          } catch (Exception $e) {
                  $exceptionparam = new stdClass();
                  $exceptionparam->message = $e->getMessage();
                  $exceptionparam->courseid = $params['courseid'];
                  throw new moodle_exception('errorcoursecontextnotvalid' , 'webservice', '', $exceptionparam);
          }
          require_capability('moodle/course:managegroups', $context);
  
          $gs = groups_get_all_groups($params['courseid'], 0, 0,
              'g.id, g.courseid, g.name, g.idnumber, g.description, g.descriptionformat, g.enrolmentkey');
  
          $groups = array();
          foreach ($gs as $group) {
              list($group->description, $group->descriptionformat) =
                  external_format_text($group->description, $group->descriptionformat,
                          $context->id, 'group', 'description', $group->id);
              $groups[] = (array)$group;
          }
  
          return $groups;
      }
code_tokens: public static function get_course_groups ( $ courseid ) { $ params = self :: validate_parameters ( self :: get_course_groups_parameters ( ) , array ( 'courseid' => $ courseid ) ) ; // now security checks $ context = context_course :: instance ( $ params [ 'courseid' ] , IGNORE_MISSING ) ; try { self :: validate_context ( $ context ) ; } catch ( Exception $ e ) { $ exceptionparam = new stdClass ( ) ; $ exceptionparam -> message = $ e -> getMessage ( ) ; $ exceptionparam -> courseid = $ params [ 'courseid' ] ; throw new moodle_exception ( 'errorcoursecontextnotvalid' , 'webservice' , '' , $ exceptionparam ) ; } require_capability ( 'moodle/course:managegroups' , $ context ) ; $ gs = groups_get_all_groups ( $ params [ 'courseid' ] , 0 , 0 , 'g.id, g.courseid, g.name, g.idnumber, g.description, g.descriptionformat, g.enrolmentkey' ) ; $ groups = array ( ) ; foreach ( $ gs as $ group ) { list ( $ group -> description , $ group -> descriptionformat ) = external_format_text ( $ group -> description , $ group -> descriptionformat , $ context -> id , 'group' , 'description' , $ group -> id ) ; $ groups [ ] = ( array ) $ group ; } return $ groups ; }
docstring: Get all groups in the specified course
  
  @param int $courseid id of course
  @return array of group objects (id, courseid, name, enrolmentkey)
  @since Moodle 2.2
docstring_tokens: Get all groups in the specified course