예제 #1
0
 public function libraries()
 {
     $input = JFactory::getApplication()->input;
     $machine_name = $input->getVar('machine_name');
     if (empty($machine_name)) {
         $storage = H5PJoomla::getInstance('editorstorage');
         $document = JFactory::getDocument();
         $document->setMimeEncoding('application/json');
         $libs = $storage->getLibraries();
         print $libs;
     } else {
         $major_version = $input->getVar('major_version');
         $minor_version = $input->getVar('minor_version');
         $storage = H5PJoomla::getInstance('editorstorage');
         $h5p_joomla = H5PJoomla::getInstance('interface');
         // FIXME: H5peditor should use main folder from Interface, but for
         // now, H5peditor uses its own directories.
         $h5p_editor = new H5peditor($storage, JPATH_ROOT . DIRECTORY_SEPARATOR . 'media', JURI::root(false));
         $document = JFactory::getDocument();
         $document->setMimeEncoding('application/json');
         // Joomla System plugin SEF occasionally screw up the output from
         // here.  Turn it off.  This is not permanent and will only affect
         // the output from this particular function.
         $config = JFactory::getConfig();
         $config->set('sef', '0');
         $libdata = $h5p_editor->getLibraryData($machine_name, $major_version, $minor_version);
         print $libdata;
     }
 }