-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
88 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
Moosh/Command/Moodle41/H5pPlugin/H5pPluginContentTypesExport.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
/** | ||
* moosh - Moodle Shell | ||
* | ||
* @copyright 2012 onwards Tomasz Muras | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace Moosh\Command\Moodle41\H5pPlugin; | ||
use Moosh\MooshCommand; | ||
|
||
/** | ||
* Exports libraries or content types 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. | ||
* H5p core libraries. | ||
* moosh hp5-plugin-contenttypes-export [-n, --name] | ||
* | ||
* @example 1: Export content types with default filename (h5p-core-contenttypes-export.csv). | ||
* moosh hp5-plugin-contenttypes-export | ||
* | ||
* @example 2: Export content types to with custom filename: "my-custom-file.csv" | ||
* moosh hp5-plugin-contenttypes-export -n my-custom-file | ||
* | ||
* @example 3: Export content types to txt file (using csv format) | ||
* moosh hp5-plugin-contenttypes-export -n my-custom-txt-file.txt | ||
* | ||
* @author Michal Chruscielski <[email protected]> | ||
*/ | ||
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."); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters