Documentation updates

namespaces
Svein-Tore Griff With 2013-11-18 18:03:01 +01:00
parent 7aef062810
commit e4c268612f
1 changed files with 36 additions and 11 deletions

View File

@ -225,13 +225,8 @@ interface H5PFrameworkInterface {
* *
* @param int $contentId * @param int $contentId
* ContentID of the node we are going to export * ContentID of the node we are going to export
* @param string $title
* Title of the node to export
* @param string $language
* Language of the node to export
* @return array * @return array
* An array with all the data needed to export the h5p in the following format: * An array with all the data needed to export the h5p in the following format:
* 'title' => string,
* 'contentId' => string/int, * 'contentId' => string/int,
* 'mainLibrary' => string (machine name for main library), * 'mainLibrary' => string (machine name for main library),
* 'embedType' => string, * 'embedType' => string,
@ -240,7 +235,11 @@ interface H5PFrameworkInterface {
* 'majorVersion' => int, * 'majorVersion' => int,
* 'minorVersion' => int, * 'minorVersion' => int,
* 'preloaded' => int(0|1), * 'preloaded' => int(0|1),
* 'language' => string, * 'editorLibraries' => array(
* 'machineName' => string,
* 'majorVersion' => int,
* 'minorVersion' => int,
* 'preloaded' => int(0|1),
*/ */
public function getExportData($contentId); public function getExportData($contentId);
/** /**
@ -1062,12 +1061,20 @@ Class H5PExport {
$this->h5pF = $H5PFramework; $this->h5pF = $H5PFramework;
$this->h5pC = $H5PCore; $this->h5pC = $H5PCore;
} }
/** /**
* Create the H5P package * Return path to h5p package.
* *
* @param object $exportData * Creates package if not already created
* The data to be exported. *
* @return H5P package. * @param int/string $contentId
* Identifier for this H5P
* @param String $title
* Title of H5P
* @param string $language
* Language code for H5P
* @return string
* Path to .h5p file
*/ */
public function getExportPath($contentId, $title, $language) { public function getExportPath($contentId, $title, $language) {
$h5pDir = $this->h5pF->getH5pPath() . DIRECTORY_SEPARATOR; $h5pDir = $this->h5pF->getH5pPath() . DIRECTORY_SEPARATOR;
@ -1156,6 +1163,12 @@ Class H5PExport {
return str_replace(DIRECTORY_SEPARATOR, '/', $zipPath); return str_replace(DIRECTORY_SEPARATOR, '/', $zipPath);
} }
/**
* Delete .h5p file
*
* @param int/string $contentId
* Identifier for the H5P
*/
public function deleteExport($contentId) { public function deleteExport($contentId) {
$h5pDir = $this->h5pF->getH5pPath() . DIRECTORY_SEPARATOR; $h5pDir = $this->h5pF->getH5pPath() . DIRECTORY_SEPARATOR;
$zipPath = $h5pDir . 'exports' . DIRECTORY_SEPARATOR . $contentId . '.h5p'; $zipPath = $h5pDir . 'exports' . DIRECTORY_SEPARATOR . $contentId . '.h5p';
@ -1163,7 +1176,19 @@ Class H5PExport {
file_delete($zipPath); file_delete($zipPath);
} }
} }
/**
* Add editor libraries to the list of libraries
*
* These aren't supposed to go into h5p.json, but must be included with the rest
* of the libraries
*
* @param array $libraries
* List of libraries keyed by machineName
* @param array $editorLibraries
* List of libraries keyed by machineName
* @return List of libraries keyed by machineName
*/
private function addEditorLibraries($libraries, $editorLibraries) { private function addEditorLibraries($libraries, $editorLibraries) {
foreach ($editorLibraries as $editorLibrary) { foreach ($editorLibraries as $editorLibrary) {
$libraries[$editorLibrary['machineName']] = $editorLibrary; $libraries[$editorLibrary['machineName']] = $editorLibrary;