diff --git a/Moosh/Command/Moodle41/H5pCore/H5pCoreContentTypesExport.php b/Moosh/Command/Moodle41/H5pCore/H5pCoreContentTypesExport.php index 847b1ad1..d4aee6d7 100644 --- a/Moosh/Command/Moodle41/H5pCore/H5pCoreContentTypesExport.php +++ b/Moosh/Command/Moodle41/H5pCore/H5pCoreContentTypesExport.php @@ -11,7 +11,8 @@ /** - * Exports content types from H5p core to file in csv format. + * Exports content types from H5p core to file in csv format. In fact content type in H5p is just + * a runnable library. Be aware that H5p Plugin libraries are stored separately from H5p Core libraries. * moosh hp5-core-contenttypes-export [-n, --name] * * @example 1: Export content types with default filename (h5p-core-contenttypes-export.csv). diff --git a/Moosh/Command/Moodle41/H5pCore/H5pCoreLibrariesExport.php b/Moosh/Command/Moodle41/H5pCore/H5pCoreLibrariesExport.php index f8c1e476..cf1cbce7 100644 --- a/Moosh/Command/Moodle41/H5pCore/H5pCoreLibrariesExport.php +++ b/Moosh/Command/Moodle41/H5pCore/H5pCoreLibrariesExport.php @@ -10,7 +10,8 @@ use Moosh\MooshCommand; /** - * Exports libraries from H5p to file in csv format. + * Exports libraries from H5p to file in csv format. In fact content type in H5p is just + * a runnable library. Be aware that H5p Plugin libraries are stored separately from H5p Core libraries. * moosh hp5-core-libraries-export [-n, --name] * * @example 1: Export libraries with default filename (h5p-core-libraries-export.csv). diff --git a/Moosh/Command/Moodle41/H5pPlugin/H5pPluginContentTypesExport.php b/Moosh/Command/Moodle41/H5pPlugin/H5pPluginContentTypesExport.php new file mode 100644 index 00000000..2ac4a697 --- /dev/null +++ b/Moosh/Command/Moodle41/H5pPlugin/H5pPluginContentTypesExport.php @@ -0,0 +1,49 @@ + + */ +class H5pPluginContentTypesExport extends MooshCommand +{ + public function __construct() + { + parent::__construct('contenttypes-export', 'h5p-plugin'); + + $this->addOption('n|name:', 'name of exported csv file', "h5p-plugin-contenttypes-export.csv"); + } + + public function execute() + { + $filename = $this->expandedOptions['name']; + + $manager = new H5pPluginExportManager(); + $manager->exportContentTypes($filename, $this->verbose); + + if($this->verbose) { + mtrace("Content types export successful."); + } + } +} \ No newline at end of file diff --git a/Moosh/Command/Moodle41/H5pPlugin/H5pPluginLibrariesExport.php b/Moosh/Command/Moodle41/H5pPlugin/H5pPluginLibrariesExport.php index 6ad5c8d0..31dd5325 100644 --- a/Moosh/Command/Moodle41/H5pPlugin/H5pPluginLibrariesExport.php +++ b/Moosh/Command/Moodle41/H5pPlugin/H5pPluginLibrariesExport.php @@ -10,7 +10,8 @@ use Moosh\MooshCommand; /** - * Exports libraries from H5p to file in csv format. + * Exports libraries from H5p to file in csv format. In fact content type in H5p is just + * a runnable library. Be aware that H5p Plugin libraries are stored separately from H5p Core libraries. * moosh hp5-plugin-libraries-export [-n, --name] * * @example 1: Export libraries with default filename (h5p-core-libraries-export.csv). diff --git a/Moosh/Command/Moodle41/H5pPlugin/helpers/H5pPluginExportManager.php b/Moosh/Command/Moodle41/H5pPlugin/helpers/H5pPluginExportManager.php index 9fc56839..d28ba831 100644 --- a/Moosh/Command/Moodle41/H5pPlugin/helpers/H5pPluginExportManager.php +++ b/Moosh/Command/Moodle41/H5pPlugin/helpers/H5pPluginExportManager.php @@ -58,7 +58,7 @@ private function export($filename, $verbose, $runnable){ } if(!class_exists(framework::class)) { - cli_error("H5p factory class cannot be loaded."); + cli_error("H5p factory class cannot be loaded. Check if H5p plugin is properly installed and configured."); } // Using factory object instead of fetching from database. It provides actual data fetching, diff --git a/www/commands/index.md b/www/commands/index.md index d6369e3c..5a5520b5 100755 --- a/www/commands/index.md +++ b/www/commands/index.md @@ -1713,7 +1713,8 @@ Example: h5p-core-contenttypes-export ---- -Exports libraries from H5p core to file in csv format. +Exports libraries from H5p core to file in csv format. Be aware that H5p Core libraries are stored separately +from H5p Plugin libraries. Available options: @@ -1737,7 +1738,8 @@ Example 3: Export content types to txt file (using csv format) h5p-core-libraries-export ---- -Exports content types from H5p core to file in csv format. +Exports content types from H5p core to file in csv format. Be aware that H5p Core libraries are stored separately +from H5p Plugin libraries. Available options: @@ -1760,8 +1762,9 @@ Example 3: Export content types to txt file (using csv format) h5p-plugin-libraries-export ---- -Exports libraries from H5p plugin to file in csv format. In H5p plugin content types and libraries -are treated as one data type. +Exports libraries from H5p plugin to file in csv format. In fact H5p content types +are just libraries that are marked as runnable. Be aware that H5p Plugin libraries are stored separately +from H5p Core libraries. Available options: @@ -1782,6 +1785,31 @@ Example 3: Export libraries to txt file (using csv format) moosh h5p-plugin-libraries-export -n my-custom-txt-file.txt +h5p-plugin-contenttypes-export +---- +Exports content types from H5p plugin to file in csv format. In fact H5p content types +are just libraries that are marked as runnable. Be aware that H5p Plugin libraries are stored separately +from H5p Core libraries. + +Available options: + +| Option | Description | +|------------|---------------------------| +| -n, --name | Defines target file name. | + + +Example 1: Export content types types + + moosh h5p-plugin-contenttypes-export + +Example 2: Export content types with custom filename "my-custom-file.csv" + + moosh h5p-plugin-contenttypes-export -n my-custom-file + +Example 3: Export content types to txt file (using csv format) + + moosh h5p-plugin-contenttypes-export -n my-custom-txt-file.txt + info ----