Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add export functionality for bootstrap and decision and add themes to
export of Xerte

- Add export for bootstrap
- Add export for decision
- Add themas to export of Nottingham template
  • Loading branch information
torinfo committed Mar 13, 2015
1 parent 9d47c8d commit 650b85b
Show file tree
Hide file tree
Showing 19 changed files with 636 additions and 506 deletions.
4 changes: 2 additions & 2 deletions languages/en-GB/modules/decision/export_page.inc
Expand Up @@ -12,12 +12,12 @@

define("XERTE_EXPORT_HTML5", "Export with Javascript (a.k.a. HTML5) Engine");
define("XERTE_EXPORT_FLASH", "Export with Flash Engine");
define("XERTE_EXPORT_DESCRIPTION","There are several ways to export a project. An exported project is packaged, but not deleted, into a zip file for you to share with another user, to deploy on the web, or to import into a SCORM compliant LMS or VLE. You can choose whether to export all of the project's files, or just those files used by the project.");
define("XERTE_EXPORT_DESCRIPTION","There are several ways to export a project. An exported project is packaged, but not deleted, into a zip file for you to share with another user, to deploy on the web, or to import into an LMS or VLE. You can choose whether to export all of the project's files, or just those files used by the project.");

define("XERTE_EXPORT_ZIP_ARCHIVE", "Archive export. Complete backup including offline editing and round-tripping back to toolkits or sharing with other Xerte users: ");
define("XERTE_EXPORT_ZIP_ARCHIVE_LINK","Get Archive Zip.");

define("XERTE_EXPORT_ZIP", "Export for deployment. Contains only the files required for importing into a vle without SCORM tracking, sharing via CD or USB etc or importing into another XOT install: ");
define("XERTE_EXPORT_ZIP", "Export for deployment. Contains only the files required for importing into a vle, sharing via CD or USB etc or importing into another XOT install: ");
define("XERTE_EXPORT_ZIP_LINK","Get Deployment Zip.");

define("XERTE_EXPORT_SCORM", "Export for SCORM deployment: self contained, SCORM 1.2 or SCORM 2004 enables tracking of Quiz scores e.g. into Moodle gradebook: ");
Expand Down
4 changes: 2 additions & 2 deletions languages/en-GB/modules/site/export_page.inc
Expand Up @@ -12,12 +12,12 @@

define("XERTE_EXPORT_HTML5", "Export with Javascript (a.k.a. HTML5) Engine");
define("XERTE_EXPORT_FLASH", "Export with Flash Engine");
define("XERTE_EXPORT_DESCRIPTION","There are several ways to export a project. An exported project is packaged, but not deleted, into a zip file for you to share with another user, to deploy on the web, or to import into a SCORM compliant LMS or VLE. You can choose whether to export all of the project's files, or just those files used by the project.");
define("XERTE_EXPORT_DESCRIPTION","There are several ways to export a project. An exported project is packaged, but not deleted, into a zip file for you to share with another user, to deploy on the web, or to import into an LMS or VLE. You can choose whether to export all of the project's files, or just those files used by the project.");

define("XERTE_EXPORT_ZIP_ARCHIVE", "Archive export. Complete backup including offline editing and round-tripping back to toolkits or sharing with other Xerte users: ");
define("XERTE_EXPORT_ZIP_ARCHIVE_LINK","Get Archive Zip.");

define("XERTE_EXPORT_ZIP", "Export for deployment. Contains only the files required for importing into a vle without SCORM tracking, sharing via CD or USB etc or importing into another XOT install: ");
define("XERTE_EXPORT_ZIP", "Export for deployment. Contains only the files required for importing into a vle, sharing via CD or USB etc or importing into another XOT install: ");
define("XERTE_EXPORT_ZIP_LINK","Get Deployment Zip.");

define("XERTE_EXPORT_SCORM", "Export for SCORM deployment: self contained, SCORM 1.2 or SCORM 2004 enables tracking of Quiz scores e.g. into Moodle gradebook: ");
Expand Down
118 changes: 118 additions & 0 deletions modules/decision/export.php
@@ -0,0 +1,118 @@
<?php
/**
* Licensed to The Apereo Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
* The Apereo Foundation licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Export a LO - e.g. from properties.
* Example call : /website_code/php/scorm/export.php?scorm=false&template_id=10&html5=false&flash=true
*/
global $dir_path, $delete_file_array, $zipfile, $folder_id_array, $file_array, $folder_array, $delete_folder_array, $parent_template_path;

$folder_id_array = array();
$folder_array = array();
$file_array = array();
$delete_file_array = array();
$delete_folder_array = array();
$zipfile = "";

require_once ($xerte_toolkits_site->root_file_path . "website_code/php/scorm/archive.php");
require_once ($xerte_toolkits_site->root_file_path . "website_code/php/scorm/scorm_library.php");
require_once ($xerte_toolkits_site->root_file_path . "website_code/php/xmlInspector.php");
require_once ($xerte_toolkits_site->root_file_path . "website_code/php/screen_size_library.php");
require_once ($xerte_toolkits_site->root_file_path . "website_code/php/user_library.php");
require_once ($xerte_toolkits_site->root_file_path . "website_code/php/url_library.php");

/*
* Set up the paths
*/
$dir_path = $xerte_toolkits_site->users_file_area_full . $row['template_id'] . "-" . $row['username'] . "-" . $row['template_name'] . "/";
$parent_template_path = $xerte_toolkits_site->basic_template_path . $row['template_framework'] . "/parent_templates/" . $row['template_name'] . "/";
$js_path = $xerte_toolkits_site->basic_template_path . $row['template_framework'] . "/js/";


/*
* Make the zip
*/
$zipfile_tmpname = tempnam(sys_get_temp_dir(), 'xerteExport');
_debug("Temporary zip file is : $zipfile_tmpname");


$options = array(
'basedir' => $dir_path,
'prepand' => "",
'inmemory' => 0,
'overwrite' => 1,
'recurse' => 1,
'storepaths' => 1);


$zipfile = Xerte_Zip_Factory::factory($zipfile_tmpname, $options);


/*
* Copy the core files over from the parent folder
*/
copy($dir_path . "data.xml", $dir_path . "template.xml");
$xml = new XerteXMLInspector();
$xml->loadTemplateXML($dir_path . 'template.xml');
if ($fullArchive) {
_debug("Full archive");
}
else
{
_debug("Deployment archive");
}
export_folder_loop($parent_template_path);

copy_parent_files();


export_folder_loop($dir_path);

/*
* Get the name of the learning object
*/
$lo_name = $xml->getName();

/*
* Create basic HTML page
*/
basic_html5_page_create($row['template_framework'], $row['template_name'], $lo_name);

/*
* Add the files to the zip file, create the archive, then send it to the user
*/

xerte_zip_files($fullArchive, $dir_path);
$zipfile->create_archive();


// This outputs http headers etc.
$zipfile->download_file($row['zipname']);

_debug("Zip file errors? " . implode(',', $zipfile->error));

/*
* remove the files
*/
clean_up_files();

@unlink($dir_path . "template.xml");

@unlink($zipfile_tmpname);
30 changes: 30 additions & 0 deletions modules/decision/export_page.php
@@ -0,0 +1,30 @@
<?PHP
/**
* Licensed to The Apereo Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
* The Apereo Foundation licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

_load_language_file("/modules/decision/export_page.inc");

echo "<p>" . XERTE_EXPORT_DESCRIPTION . "</p>";

echo "<ol type='1'>";
echo "<li>" . XERTE_EXPORT_ZIP . "<ul><li><button type=\"button\" class=\"xerte_button\" onclick=\"property_tab_download('download_frame', '', '', '" . $xerte_toolkits_site->site_url . url_return("export" , $_POST['template_id']) . "')\">" . XERTE_EXPORT_ZIP_LINK . "</button></li></ul></li><br />";
echo "<li>" . XERTE_EXPORT_ZIP_ARCHIVE . "<ul><li><button type=\"button\" class=\"xerte_button\" onclick=\"property_tab_download('download_frame', '', '', '" . $xerte_toolkits_site->site_url . url_return("export_full" , $_POST['template_id']) . "')\">" . XERTE_EXPORT_ZIP_ARCHIVE_LINK . "</button></li></ul><br /></li>";
echo "</ol>";

?>
119 changes: 16 additions & 103 deletions modules/decision/play.php
Expand Up @@ -25,124 +25,37 @@
// (pl)
// Set up the preview window for a xerte piece
require(dirname(__FILE__) . '/../../website_code/php/xmlInspector.php');
function show_template($row_play){
function show_template($row_play)
{
global $xerte_toolkits_site;

$string_for_flash = $xerte_toolkits_site-> users_file_area_short . $row_play['template_id'] . "-" . $row_play['username'] . "-" . $row_play['template_name'] . "/";
$string_for_flash = $xerte_toolkits_site->users_file_area_short . $row_play['template_id'] . "-" . $row_play['username'] . "-" . $row_play['template_name'] . "/";

$xmlfile = $string_for_flash . "data.xml";

$xmlFixer = new XerteXMLInspector();
$xmlFixer->loadTemplateXML($xmlfile);

if (strlen($xmlFixer->getName()) > 0)
{

if (strlen($xmlFixer->getName()) > 0) {
$title = $xmlFixer->getName();
}
else
{
} else {
$title = XERTE_PREVIEW_TITLE;
}

$string_for_flash_xml = $xmlfile . "?time=" . time();

$template_path_string = "modules/decision/parent_templates/" . $row_play['template_name'];
$template_path_string = "modules/decision/parent_templates/" . $row_play['template_name'];

list($x, $y) = explode("~",get_template_screen_size($row_play['template_name'],$row_play['template_framework']));
list($x, $y) = explode("~", get_template_screen_size($row_play['template_name'], $row_play['template_framework']));

_load_language_file("/modules/decision/preview.inc");

?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title><?PHP echo $title; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

<!--jquery-->
<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common/js/jquery/jquery-1.9.1.js"></script>
<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common/js/jquery/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common/js/jquery/jquery.ui.touch-punch.min.js"></script>

<!--styles -->
<link rel="stylesheet" href="<?PHP echo $template_path_string ?>/common/css/jquery-ui.min.css">
<link rel="stylesheet" href="<?PHP echo $template_path_string ?>/common/css/styles.css">

<!--support for IE < 6-8 -->
<script src="<?PHP echo $template_path_string ?>/common/js/html5shiv.js"></script>

<!--font awesome-->
<link rel="stylesheet" href="<?PHP echo $template_path_string ?>/common/css/font-awesome-4.1.0/css/font-awesome.min.css">

<script type="text/javascript">

var FileLocation = "<?PHP echo $string_for_flash ?>";
var templateLocation = "<?PHP echo $template_path_string ?>/";
var projectXML = "<?PHP echo $string_for_flash_xml ?>/"; //this is the file to read, not the xml

</script>

</head>

<body>

<div id="mainHolder" style="visibility:hidden;">

<div id="headerBlock">

<div id="titles">
<h1> </h1>
<h2> </h2>
</div>

<div id="btnHolder">
<span id="group1">
<button id="backBtn"><span class="fa fa-chevron-circle-left fa-2x"></span><span class="btnLabel"></span></button>
<button id="infoBtn"><span class="fa fa-info-circle fa-2x"></span><span class="btnLabel"></span></button>
<button id="fwdBtn"><span class="fa fa-chevron-circle-right fa-2x"></span><span class="btnLabel"></span></button>
</span>
<span id="group2">
<button id="newBtn"><span class="fa fa-plus-circle fa-2x"></span><span class="btnLabel"></span></button>
</span>
</div>

</div>

<div id="contentHolder">

<div id="stepHolder">
<button id="submitBtn" class="floatR"></button>
</div>

<div id="introHolder"></div>

<div id="overviewHolder">
<div id="overviewBtnHolder">
<button id="emailBtn" class="floatR"><span class="fa fa-envelope fa-2x"></span><span class="btnLabel"></span></button>
<button id="printBtn" class="floatR"><span class="fa fa-print fa-2x"></span><span class="btnLabel"></span></button>
</div>
</div>

</div>

</div>

<div id="footerBlock" />

<!--initialise the application specific code-->
<script src="<?PHP echo $template_path_string ?>/common/js/decision.js"></script>

<script type="text/javascript" language="JavaScript">

<?PHP

echo "</script></body></html>";

}
// $engine is assumed to be html5 if flash is NOT set
$page_content = file_get_contents($xerte_toolkits_site->basic_template_path . $row_play['template_framework'] . "/player/rloObject.htm");
$page_content = str_replace("%TITLE%", $title, $page_content);
$page_content = str_replace("%TEMPLATEPATH%", $template_path_string, $page_content);
$page_content = str_replace("%XMLPATH%", $string_for_flash, $page_content);
$page_content = str_replace("%XMLFILE%", $string_for_flash_xml, $page_content);

?>
echo $page_content;
}

0 comments on commit 650b85b

Please sign in to comment.