Merge branch 'davericher-master'

pull/20/head^2
Frode Petterson 2016-04-13 11:30:39 +02:00
commit b559935c09
5 changed files with 226 additions and 168 deletions

View File

@ -1,6 +1,6 @@
This folder contains the h5p general library. The files within this folder are not specific to any framework. This folder contains the h5p general library. The files within this folder are not specific to any framework.
Any interaction with LMS, CMS or other frameworks is done through interfaces. Plattforms needs to implement Any interaction with LMS, CMS or other frameworks is done through interfaces. Platforms needs to implement
the H5PFrameworkInterface(in h5p.classes.php) and also do the following: the H5PFrameworkInterface(in h5p.classes.php) and also do the following:
- Provide a form for uploading h5p packages. - Provide a form for uploading h5p packages.

View File

@ -1,5 +1,5 @@
<h2>Overview</h2> <h2>Overview</h2>
<p>H5P is a file format for content/applications made using modern, open web technlogies (HTML5). The format enables easy installation and transfer of applications/content on different CMSes, LMSes and other platforms. An H5P can be uploaded and published on a platform in mostly the same way one would publish a Flash file today. H5P files may also be updated by simply uploading a new version of the file, the same way as one would using Flash.</p> <p>H5P is a file format for content/applications made using modern, open web technologies (HTML5). The format enables easy installation and transfer of applications/content on different CMSes, LMSes and other platforms. An H5P can be uploaded and published on a platform in mostly the same way one would publish a Flash file today. H5P files may also be updated by simply uploading a new version of the file, the same way as one would using Flash.</p>
<p>H5P opens for extensive reuse of code and wide flexibility regarding what may be developed as an H5P.</p> <p>H5P opens for extensive reuse of code and wide flexibility regarding what may be developed as an H5P.</p>
<p>The system uses package files containing all necessary files and libraries for the application to function. These files are based on open formats.</p> <p>The system uses package files containing all necessary files and libraries for the application to function. These files are based on open formats.</p>
<h2>Overview of package files</h2> <h2>Overview of package files</h2>
@ -74,7 +74,7 @@
<p>The root of a library folder shall contain a file name <i>library.json</i> formatted similar to the package's <i>hp5.json</i>, but with a few differences. The library shall also have one or more images in the root folder, named <i>library.jpg</i>, <i>library1.jpg</i> etc. Image sizes 512px × 512px, and will be used in the H5P editor tool.</p> <p>The root of a library folder shall contain a file name <i>library.json</i> formatted similar to the package's <i>hp5.json</i>, but with a few differences. The library shall also have one or more images in the root folder, named <i>library.jpg</i>, <i>library1.jpg</i> etc. Image sizes 512px × 512px, and will be used in the H5P editor tool.</p>
<p>Libraries are not allowed to modify the document tree in ways that will have consequences for the web site or will be noticable by the user without the library explicitly being initialized from the main package library or another invoked library.</p> <p>Libraries are not allowed to modify the document tree in ways that will have consequences for the web site or will be noticeable by the user without the library explicitly being initialized from the main package library or another invoked library.</p>
<p>The library shall always include a JavaScript object function named the same as the defined library <i>machineName</i> (defined in <i>library.json</i> and used as the library folder name). This object will be instantiated with the library options as parameter. The resulting object must contain a function <i>attach(target)</i> that will be called after instantiation to attach the library DOM to the main DOM inside <i>target</i></p> <p>The library shall always include a JavaScript object function named the same as the defined library <i>machineName</i> (defined in <i>library.json</i> and used as the library folder name). This object will be instantiated with the library options as parameter. The resulting object must contain a function <i>attach(target)</i> that will be called after instantiation to attach the library DOM to the main DOM inside <i>target</i></p>

View File

@ -14,13 +14,14 @@ class H5PDevelopment {
/** /**
* Constructor. * Constructor.
* *
* @param object $H5PFramework * @param H5PFrameworkInterface|object $H5PFramework
* The frameworks implementation of the H5PFrameworkInterface * The frameworks implementation of the H5PFrameworkInterface
* @param string $filesPath * @param string $filesPath
* Path to where H5P should store its files * Path to where H5P should store its files
* @param $language
* @param array $libraries Optional cache input. * @param array $libraries Optional cache input.
*/ */
public function __construct($H5PFramework, $filesPath, $language, $libraries = NULL) { public function __construct(H5PFrameworkInterface $H5PFramework, $filesPath, $language, $libraries = NULL) {
$this->h5pF = $H5PFramework; $this->h5pF = $H5PFramework;
$this->language = $language; $this->language = $language;
$this->filesPath = $filesPath; $this->filesPath = $filesPath;
@ -35,7 +36,7 @@ class H5PDevelopment {
/** /**
* Get contents of file. * Get contents of file.
* *
* @param string File path. * @param string $file File path.
* @return mixed String on success or NULL on failure. * @return mixed String on success or NULL on failure.
*/ */
private function getFileContents($file) { private function getFileContents($file) {
@ -111,7 +112,7 @@ class H5PDevelopment {
} }
/** /**
* @return array Libraris in development folder. * @return array Libraries in development folder.
*/ */
public function getLibraries() { public function getLibraries() {
return $this->libraries; return $this->libraries;
@ -152,6 +153,7 @@ class H5PDevelopment {
* @param string $name of the library. * @param string $name of the library.
* @param int $majorVersion of the library. * @param int $majorVersion of the library.
* @param int $minorVersion of the library. * @param int $minorVersion of the library.
* @param $language
* @return string Translation * @return string Translation
*/ */
public function getLanguage($name, $majorVersion, $minorVersion, $language) { public function getLanguage($name, $majorVersion, $minorVersion, $language) {
@ -169,7 +171,7 @@ class H5PDevelopment {
* *
* @param string $name Machine readable library name * @param string $name Machine readable library name
* @param integer $majorVersion * @param integer $majorVersion
* @param integer $majorVersion * @param $minorVersion
* @return string Library identifier. * @return string Library identifier.
*/ */
public static function libraryToString($name, $majorVersion, $minorVersion) { public static function libraryToString($name, $majorVersion, $minorVersion) {

View File

@ -50,11 +50,11 @@ abstract class H5PEventBase {
* @param string $sub_type * @param string $sub_type
* Name of event sub type * Name of event sub type
* @param string $content_id * @param string $content_id
* Identifier for content affacted by the event * Identifier for content affected by the event
* @param string $content_title * @param string $content_title
* Content title (makes it easier to know which content was deleted etc.) * Content title (makes it easier to know which content was deleted etc.)
* @param string $library_name * @param string $library_name
* Name of the library affacted by the event * Name of the library affected by the event
* @param string $library_version * @param string $library_version
* Library version * Library version
*/ */
@ -178,14 +178,14 @@ abstract class H5PEventBase {
/** /**
* Stores the event data in the database. * Stores the event data in the database.
* *
* Must be overriden by plugin. * Must be overridden by plugin.
*/ */
abstract protected function save(); abstract protected function save();
/** /**
* Add current event data to statistics counter. * Add current event data to statistics counter.
* *
* Must be overriden by plugin. * Must be overridden by plugin.
*/ */
abstract protected function saveStats(); abstract protected function saveStats();
} }

File diff suppressed because it is too large Load Diff