protected static function get_file_list($directory) {
        global $CFG;
        $directoryroot = $CFG->dirroot;
        $finalfiles = array();
        if (is_dir($directory)) {
            if ($handle = opendir($directory)) {
                $files = scandir($directory);
                foreach ($files as $file) {
                    if ($file != '.' && $file != '..') {
                        // Ignore the file if it is external to the system.
                        if (strrpos($directory, $directoryroot) !== false) {
                            $location = substr($directory, strlen($directoryroot));
                            $name = substr($file, 0, -4);
                            $finalfiles[$name] = $location  . '/' . $file;
                        }
                    }
                }
            }
        }
        return $finalfiles;
    }
protected static function get_file_list($directory) {
        global $CFG;
        $directoryroot = $CFG->dirroot;
        $finalfiles = array();
        if (is_dir($directory)) {
            if ($handle = opendir($directory)) {
                $files = scandir($directory);
                foreach ($files as $file) {
                    if ($file != '.' && $file != '..') {
                        // Ignore the file if it is external to the system.
                        if (strrpos($directory, $directoryroot) !== false) {
                            $location = substr($directory, strlen($directoryroot));
                            $name = substr($file, 0, -4);
                            $finalfiles[$name] = $location  . '/' . $file;
                        }
                    }
                }
            }
        }
        return $finalfiles;
    }
protected static function get_file_list ( $ directory ) { global $ CFG ; $ directoryroot = $ CFG -> dirroot ; $ finalfiles = array ( ) ; if ( is_dir ( $ directory ) ) { if ( $ handle = opendir ( $ directory ) ) { $ files = scandir ( $ directory ) ; foreach ( $ files as $ file ) { if ( $ file != '.' && $ file != '..' ) { // Ignore the file if it is external to the system. if ( strrpos ( $ directory , $ directoryroot ) !== false ) { $ location = substr ( $ directory , strlen ( $ directoryroot ) ) ; $ name = substr ( $ file , 0 , - 4 ) ; $ finalfiles [ $ name ] = $ location . '/' . $ file ; } } } } } return $ finalfiles ; }
Returns a list of files with a full directory path in a specified directory.

@param string $directory location of files.
@return array full location of files from the specified directory.
Returns a list of files with a full directory path in a specified directory .