diff --git a/h5p.classes.php b/h5p.classes.php index 77130c3..7bf5cab 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -55,6 +55,13 @@ interface H5PFrameworkInterface { * @return string Path to the last uploaded h5p */ public function getUploadedH5pPath(); + + /** + * Get the list of the current installed libraries + * + * @return array Associative array containg one item per machine name. This item contains an array of libraries. + */ + public function loadLibraries(); /** * Get id to an excisting library @@ -243,9 +250,9 @@ interface H5PFrameworkInterface { /** * Delete a library from database and file system * - * @param int $libraryId Library Id + * @param mixed $library Library */ - public function deleteLibrary($libraryId); + public function deleteLibrary($library); /** * Load content. @@ -1325,7 +1332,7 @@ class H5PCore { * @param array $content * @return int Content ID */ - public function saveContent($content, $contentMainId) { + public function saveContent($content, $contentMainId = NULL) { if (isset($content['id'])) { $this->h5pF->updateContent($content, $contentMainId); } @@ -1333,7 +1340,10 @@ class H5PCore { $content['id'] = $this->h5pF->insertContent($content, $contentMainId); } - $this->h5pF->cacheDel('parameters', $content['id']); + if (!isset($content['filtered'])) { + // TODO: Add filtered to all impl. and remove + $this->h5pF->cacheDel('parameters', $content['id']); + } return $content['id']; } @@ -1382,7 +1392,14 @@ class H5PCore { * @return Object NULL on failure. */ public function filterParameters($content) { - $params = $this->h5pF->cacheGet('parameters', $content['id']); + if (isset($content['filtered'])) { + $params = ($content['filtered'] === '' ? NULL : $content['filtered']); + } + else { + // TODO: Add filtered to all impl. and remove + $params = $this->h5pF->cacheGet('parameters', $content['id']); + } + if ($params !== NULL) { return $params; } diff --git a/js/h5p-library-details.js b/js/h5p-library-details.js index e274d22..73a996f 100644 --- a/js/h5p-library-details.js +++ b/js/h5p-library-details.js @@ -39,20 +39,6 @@ var H5PLibraryDetails= H5PLibraryDetails || {}; $libraryInfo.append(H5PUtils.createLabeledField(title, value)); }); - var count; - if (H5PLibraryDetails.library.notCached !== undefined) { - count = H5PIntegration.i18n.H5P.NA; - } - else if (H5PLibraryDetails.library.content === undefined) { - count = 0; - } - else { - count = H5PLibraryDetails.library.content.length; - } - - // List counter: - $libraryInfo.append(H5PUtils.createLabeledField(H5PLibraryDetails.library.translations.contentCount, count)); - return $libraryInfo; }; diff --git a/js/h5p-library-list.js b/js/h5p-library-list.js index cfadf0d..aeba889 100644 --- a/js/h5p-library-list.js +++ b/js/h5p-library-list.js @@ -38,7 +38,7 @@ var H5PLibraryList= H5PLibraryList || {}; var $libraryRow = H5PUtils.createTableRow([ library.title, library.numContent, - library.numContentDependencies === -1 ? t.NA : library.numContentDependencies, + library.numContentDependencies, library.numLibraryDependencies, '