original_string: public function get_listing($fullpath = '', $page = '') {
          global $OUTPUT;
  
          $list = array(
              'list' => array(),
              'manage' => false,
              'dynload' => true,
              'nologin' => true,
              'path' => array()
          );
  
          // We analyse the path to extract what to browse.
          $fullpath = empty($fullpath) ? $this->build_node_path('root') : $fullpath;
          $trail = explode('|', $fullpath);
          $trail = array_pop($trail);
          list($mode, $path, $unused) = $this->explode_node_path($trail);
  
          // Is that a search?
          if ($mode === 'search') {
              return $this->search($path, $page);
          }
  
          // Cleaning up the requested path.
          $path = trim($path, '/');
          if (!$this->is_in_repository($path)) {
              // In case of doubt on the path, reset to default.
              $path = '';
          }
          $rootpath = $this->get_rootpath();
          $abspath = rtrim($rootpath . $path, '/') . '/';
  
          // Retrieve list of files and directories and sort them.
          $fileslist = array();
          $dirslist = array();
          if ($dh = opendir($abspath)) {
              while (($file = readdir($dh)) != false) {
                  if ($file != '.' and $file != '..') {
                      if (is_file($abspath . $file)) {
                          $fileslist[] = $file;
                      } else {
                          $dirslist[] = $file;
                      }
                  }
              }
          }
          core_collator::asort($fileslist, core_collator::SORT_NATURAL);
          core_collator::asort($dirslist, core_collator::SORT_NATURAL);
  
          // Fill the results.
          foreach ($dirslist as $file) {
              $list['list'][] = $this->build_node($rootpath, $path, $file, true, $fullpath);
          }
          foreach ($fileslist as $file) {
              $list['list'][] = $this->build_node($rootpath, $path, $file, false, $fullpath);
          }
  
          $list['path'] = $this->build_breadcrumb($fullpath);
          $list['list'] = array_filter($list['list'], array($this, 'filter'));
  
          return $list;
      }
code: public function get_listing($fullpath = '', $page = '') {
          global $OUTPUT;
  
          $list = array(
              'list' => array(),
              'manage' => false,
              'dynload' => true,
              'nologin' => true,
              'path' => array()
          );
  
          // We analyse the path to extract what to browse.
          $fullpath = empty($fullpath) ? $this->build_node_path('root') : $fullpath;
          $trail = explode('|', $fullpath);
          $trail = array_pop($trail);
          list($mode, $path, $unused) = $this->explode_node_path($trail);
  
          // Is that a search?
          if ($mode === 'search') {
              return $this->search($path, $page);
          }
  
          // Cleaning up the requested path.
          $path = trim($path, '/');
          if (!$this->is_in_repository($path)) {
              // In case of doubt on the path, reset to default.
              $path = '';
          }
          $rootpath = $this->get_rootpath();
          $abspath = rtrim($rootpath . $path, '/') . '/';
  
          // Retrieve list of files and directories and sort them.
          $fileslist = array();
          $dirslist = array();
          if ($dh = opendir($abspath)) {
              while (($file = readdir($dh)) != false) {
                  if ($file != '.' and $file != '..') {
                      if (is_file($abspath . $file)) {
                          $fileslist[] = $file;
                      } else {
                          $dirslist[] = $file;
                      }
                  }
              }
          }
          core_collator::asort($fileslist, core_collator::SORT_NATURAL);
          core_collator::asort($dirslist, core_collator::SORT_NATURAL);
  
          // Fill the results.
          foreach ($dirslist as $file) {
              $list['list'][] = $this->build_node($rootpath, $path, $file, true, $fullpath);
          }
          foreach ($fileslist as $file) {
              $list['list'][] = $this->build_node($rootpath, $path, $file, false, $fullpath);
          }
  
          $list['path'] = $this->build_breadcrumb($fullpath);
          $list['list'] = array_filter($list['list'], array($this, 'filter'));
  
          return $list;
      }
code_tokens: public function get_listing ( $ fullpath = '' , $ page = '' ) { global $ OUTPUT ; $ list = array ( 'list' => array ( ) , 'manage' => false , 'dynload' => true , 'nologin' => true , 'path' => array ( ) ) ; // We analyse the path to extract what to browse. $ fullpath = empty ( $ fullpath ) ? $ this -> build_node_path ( 'root' ) : $ fullpath ; $ trail = explode ( '|' , $ fullpath ) ; $ trail = array_pop ( $ trail ) ; list ( $ mode , $ path , $ unused ) = $ this -> explode_node_path ( $ trail ) ; // Is that a search? if ( $ mode === 'search' ) { return $ this -> search ( $ path , $ page ) ; } // Cleaning up the requested path. $ path = trim ( $ path , '/' ) ; if ( ! $ this -> is_in_repository ( $ path ) ) { // In case of doubt on the path, reset to default. $ path = '' ; } $ rootpath = $ this -> get_rootpath ( ) ; $ abspath = rtrim ( $ rootpath . $ path , '/' ) . '/' ; // Retrieve list of files and directories and sort them. $ fileslist = array ( ) ; $ dirslist = array ( ) ; if ( $ dh = opendir ( $ abspath ) ) { while ( ( $ file = readdir ( $ dh ) ) != false ) { if ( $ file != '.' and $ file != '..' ) { if ( is_file ( $ abspath . $ file ) ) { $ fileslist [ ] = $ file ; } else { $ dirslist [ ] = $ file ; } } } } core_collator :: asort ( $ fileslist , core_collator :: SORT_NATURAL ) ; core_collator :: asort ( $ dirslist , core_collator :: SORT_NATURAL ) ; // Fill the results. foreach ( $ dirslist as $ file ) { $ list [ 'list' ] [ ] = $ this -> build_node ( $ rootpath , $ path , $ file , true , $ fullpath ) ; } foreach ( $ fileslist as $ file ) { $ list [ 'list' ] [ ] = $ this -> build_node ( $ rootpath , $ path , $ file , false , $ fullpath ) ; } $ list [ 'path' ] = $ this -> build_breadcrumb ( $ fullpath ) ; $ list [ 'list' ] = array_filter ( $ list [ 'list' ] , array ( $ this , 'filter' ) ) ; return $ list ; }
docstring: Get the list of files and directories in that repository.
  
  @param string $fullpath Path to explore. This is assembled by {@link self::build_node_path()}.
  @param string $page Page number.
  @return array List of files and folders.
docstring_tokens: Get the list of files and directories in that repository .