original_string: public static function get_subwiki_files($wikiid, $groupid = -1, $userid = 0) {
  
          $returnedfiles = array();
          $warnings = array();
  
          $params = self::validate_parameters(self::get_subwiki_files_parameters(),
                                              array(
                                                  'wikiid' => $wikiid,
                                                  'groupid' => $groupid,
                                                  'userid' => $userid
                                                  )
              );
  
          // Get wiki instance.
          if (!$wiki = wiki_get_wiki($params['wikiid'])) {
              throw new moodle_exception('incorrectwikiid', 'wiki');
          }
          list($course, $cm) = get_course_and_cm_from_instance($wiki, 'wiki');
          $context = context_module::instance($cm->id);
          self::validate_context($context);
  
          // Determine groupid and userid to use.
          list($groupid, $userid) = self::determine_group_and_user($cm, $wiki, $params['groupid'], $params['userid']);
  
          // Get subwiki and validate it.
          $subwiki = wiki_get_subwiki_by_group_and_user_with_validation($wiki, $groupid, $userid);
  
          // Get subwiki based on group and user.
          if ($subwiki === false) {
              throw new moodle_exception('cannotviewfiles', 'wiki');
          } else if ($subwiki->id != -1) {
              // The subwiki exists, let's get the files.
              $returnedfiles = external_util::get_area_files($context->id, 'mod_wiki', 'attachments', $subwiki->id);
          }
  
          $result = array();
          $result['files'] = $returnedfiles;
          $result['warnings'] = $warnings;
          return $result;
      }
code: public static function get_subwiki_files($wikiid, $groupid = -1, $userid = 0) {
  
          $returnedfiles = array();
          $warnings = array();
  
          $params = self::validate_parameters(self::get_subwiki_files_parameters(),
                                              array(
                                                  'wikiid' => $wikiid,
                                                  'groupid' => $groupid,
                                                  'userid' => $userid
                                                  )
              );
  
          // Get wiki instance.
          if (!$wiki = wiki_get_wiki($params['wikiid'])) {
              throw new moodle_exception('incorrectwikiid', 'wiki');
          }
          list($course, $cm) = get_course_and_cm_from_instance($wiki, 'wiki');
          $context = context_module::instance($cm->id);
          self::validate_context($context);
  
          // Determine groupid and userid to use.
          list($groupid, $userid) = self::determine_group_and_user($cm, $wiki, $params['groupid'], $params['userid']);
  
          // Get subwiki and validate it.
          $subwiki = wiki_get_subwiki_by_group_and_user_with_validation($wiki, $groupid, $userid);
  
          // Get subwiki based on group and user.
          if ($subwiki === false) {
              throw new moodle_exception('cannotviewfiles', 'wiki');
          } else if ($subwiki->id != -1) {
              // The subwiki exists, let's get the files.
              $returnedfiles = external_util::get_area_files($context->id, 'mod_wiki', 'attachments', $subwiki->id);
          }
  
          $result = array();
          $result['files'] = $returnedfiles;
          $result['warnings'] = $warnings;
          return $result;
      }
code_tokens: public static function get_subwiki_files ( $ wikiid , $ groupid = - 1 , $ userid = 0 ) { $ returnedfiles = array ( ) ; $ warnings = array ( ) ; $ params = self :: validate_parameters ( self :: get_subwiki_files_parameters ( ) , array ( 'wikiid' => $ wikiid , 'groupid' => $ groupid , 'userid' => $ userid ) ) ; // Get wiki instance. if ( ! $ wiki = wiki_get_wiki ( $ params [ 'wikiid' ] ) ) { throw new moodle_exception ( 'incorrectwikiid' , 'wiki' ) ; } list ( $ course , $ cm ) = get_course_and_cm_from_instance ( $ wiki , 'wiki' ) ; $ context = context_module :: instance ( $ cm -> id ) ; self :: validate_context ( $ context ) ; // Determine groupid and userid to use. list ( $ groupid , $ userid ) = self :: determine_group_and_user ( $ cm , $ wiki , $ params [ 'groupid' ] , $ params [ 'userid' ] ) ; // Get subwiki and validate it. $ subwiki = wiki_get_subwiki_by_group_and_user_with_validation ( $ wiki , $ groupid , $ userid ) ; // Get subwiki based on group and user. if ( $ subwiki === false ) { throw new moodle_exception ( 'cannotviewfiles' , 'wiki' ) ; } else if ( $ subwiki -> id != - 1 ) { // The subwiki exists, let's get the files. $ returnedfiles = external_util :: get_area_files ( $ context -> id , 'mod_wiki' , 'attachments' , $ subwiki -> id ) ; } $ result = array ( ) ; $ result [ 'files' ] = $ returnedfiles ; $ result [ 'warnings' ] = $ warnings ; return $ result ; }
docstring: Returns the list of files from a specific subwiki.
  
  @param int $wikiid The wiki instance ID.
  @param int $groupid The group ID. If not defined, use current group.
  @param int $userid The user ID. If not defined, use current user.
  @return array Containing a list of warnings and a list of files.
  @since Moodle 3.1
  @throws moodle_exception
docstring_tokens: Returns the list of files from a specific subwiki .