original_string: public static function get_activity_groupmode($cmid) {
          global $USER;
  
          // Warnings array, it can be empty at the end but is mandatory.
          $warnings = array();
  
          $params = array(
              'cmid' => $cmid
          );
          $params = self::validate_parameters(self::get_activity_groupmode_parameters(), $params);
          $cmid = $params['cmid'];
  
          $cm = get_coursemodule_from_id(null, $cmid, 0, false, MUST_EXIST);
  
          // Security checks.
          $context = context_module::instance($cm->id);
          self::validate_context($context);
  
          $groupmode = groups_get_activity_groupmode($cm);
  
          $results = array(
              'groupmode' => $groupmode,
              'warnings' => $warnings
          );
          return $results;
      }
code: public static function get_activity_groupmode($cmid) {
          global $USER;
  
          // Warnings array, it can be empty at the end but is mandatory.
          $warnings = array();
  
          $params = array(
              'cmid' => $cmid
          );
          $params = self::validate_parameters(self::get_activity_groupmode_parameters(), $params);
          $cmid = $params['cmid'];
  
          $cm = get_coursemodule_from_id(null, $cmid, 0, false, MUST_EXIST);
  
          // Security checks.
          $context = context_module::instance($cm->id);
          self::validate_context($context);
  
          $groupmode = groups_get_activity_groupmode($cm);
  
          $results = array(
              'groupmode' => $groupmode,
              'warnings' => $warnings
          );
          return $results;
      }
code_tokens: public static function get_activity_groupmode ( $ cmid ) { global $ USER ; // Warnings array, it can be empty at the end but is mandatory. $ warnings = array ( ) ; $ params = array ( 'cmid' => $ cmid ) ; $ params = self :: validate_parameters ( self :: get_activity_groupmode_parameters ( ) , $ params ) ; $ cmid = $ params [ 'cmid' ] ; $ cm = get_coursemodule_from_id ( null , $ cmid , 0 , false , MUST_EXIST ) ; // Security checks. $ context = context_module :: instance ( $ cm -> id ) ; self :: validate_context ( $ context ) ; $ groupmode = groups_get_activity_groupmode ( $ cm ) ; $ results = array ( 'groupmode' => $ groupmode , 'warnings' => $ warnings ) ; return $ results ; }
docstring: Returns effective groupmode used in a given activity.
  
  @throws moodle_exception
  @param int $cmid course module id.
  @return array containing the group mode and possible warnings.
  @since Moodle 3.0
  @throws moodle_exception
docstring_tokens: Returns effective groupmode used in a given activity .