Fix creation

pull/2487/head
jmontoyaa 9 years ago
parent 3d9ba22f9e
commit 5aaa2d2971
  1. 46
      main/newscorm/scorm.class.php
  2. 11
      main/upload/form.scorm.php
  3. 40
      main/upload/index.php

@ -306,15 +306,43 @@ class scorm extends learnpath
$row = Database::fetch_array($res_max);
$dsp = $row[0] + 1;
}
$myname = $oOrganization->get_name();
$myname = api_utf8_decode($myname);
$sql = "INSERT INTO $new_lp (c_id, lp_type, name, ref, description, path, force_commit, default_view_mod, default_encoding, js_lib,display_order, session_id, use_max_score)" .
"VALUES ($courseId , 2,'".$myname."', '".$oOrganization->get_ref()."','','".$this->subdir."', 0, 'embedded', '".$this->manifest_encoding."', 'scorm_api.php', $dsp, $sessionId, $userMaxScore)";
if ($this->debug > 1) { error_log('New LP - In import_manifest(), inserting path: '. $sql, 0); }
Database::query($sql);
$lp_id = Database::insert_id();
$myname = api_utf8_decode($oOrganization->get_name());
$now = api_get_utc_datetime();
$params = [
'c_id' => $courseId,
'lp_type' => 2,
'name' => $myname,
'ref' => $oOrganization->get_ref(),
'description' => '',
'path' => $this->subdir,
'force_commit' => 0,
'default_view_mod' => 'embedded',
'default_encoding' => $this->manifest_encoding,
'js_lib' => 'scorm_api.php',
'display_order' => $dsp,
'session_id' => $sessionId,
'use_max_score' => $userMaxScore,
'content_maker' => '',
'content_license' => '',
'debug' => 0,
'theme' => '',
'preview_image' => '',
'author' => '',
'prerequisite' => 0,
'hide_toc_frame' => 0,
'seriousgame_mode' => 0,
'autolaunch' => 0,
'category_id' => 0,
'max_attempts' => 0,
'subscribe_users' => 0,
'created_on' => $now,
'modified_on' => $now,
'publicated_on' => $now
];
$lp_id = Database::insert($new_lp, $params);
if ($lp_id) {
$sql = "UPDATE $new_lp SET id = iid WHERE iid = $lp_id";

@ -37,21 +37,25 @@ function get_zip_files_in_garbage() {
* Just display the form needed to upload a SCORM and give its settings
*/
$nameTools = get_lang("FileUpload");
$interbreadcrumb[] = array("url" => "../newscorm/lp_controller.php?action=list", "name" => get_lang("ToolLearnpath"));
$interbreadcrumb[] = array(
"url" => api_get_path(WEB_CODE_PATH)."newscorm/lp_controller.php?action=list?".api_get_cidreq(),
"name" => get_lang("ToolLearnpath"),
);
Display::display_header($nameTools, "Path");
require_once '../newscorm/content_makers.inc.php';
require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
echo '<div class="actions">';
echo '<a href="../newscorm/lp_controller.php?cidReq='.$_course['sysCode'].'">'.
echo '<a href="'.api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'">'.
Display::return_icon('back.png', get_lang('ReturnToLearningPaths'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
$form = new FormValidator(
'',
'POST',
'upload.php',
'upload.php?'.api_get_cidreq(),
'',
array(
'id' => "upload_form",
@ -129,5 +133,4 @@ Display::display_normal_message(
);
$form->display();
// footer
Display::display_footer();

@ -15,35 +15,26 @@
* @package chamilo.upload
*/
/**
* INIT SECTION
*/
// global settings initialisation
// also provides access to main api (inc/lib/main_api.lib.php)
require_once '../inc/global.inc.php';
$htmlHeadXtra[] =
"<script type=\"text/javascript\">
<!-- //
$_course = api_get_course_info();
$htmlHeadXtra[] = "<script>
function check_unzip() {
if(document.upload.unzip.checked){
document.upload.if_exists[0].disabled=true;
document.upload.if_exists[1].checked=true;
document.upload.if_exists[2].disabled=true;
}
else {
document.upload.if_exists[0].checked=true;
document.upload.if_exists[0].disabled=false;
document.upload.if_exists[2].disabled=false;
document.upload.if_exists[0].disabled=true;
document.upload.if_exists[1].checked=true;
document.upload.if_exists[2].disabled=true;
} else {
document.upload.if_exists[0].checked=true;
document.upload.if_exists[0].disabled=false;
document.upload.if_exists[2].disabled=false;
}
}
// -->
</script>";
//$is_allowed_to_edit = api_is_allowed_to_edit();
$is_allowed_to_edit = api_is_allowed_to_edit(null,true);
if(!$is_allowed_to_edit){
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
if (!$is_allowed_to_edit) {
api_not_allowed(true);
}
@ -78,7 +69,6 @@ Event::event_access_tool(TOOL_UPLOAD);
/**
* Prepare the header
*/
$htmlHeadXtra[] = '<script language="javascript" src="../inc/lib/javascript/upload.js" type="text/javascript"></script>';
$htmlHeadXtra[] = '<script type="text/javascript">
var myUpload = new upload(0);
@ -89,13 +79,13 @@ $htmlHeadXtra[] = '<script type="text/javascript">
*/
switch ($my_tool) {
case TOOL_LEARNPATH:
require('form.scorm.php');
require 'form.scorm.php';
break;
//the following cases need to be distinguished later on
case TOOL_DROPBOX:
case TOOL_STUDENTPUBLICATION:
case TOOL_DOCUMENT:
default:
require('form.document.php');
default :
require 'form.document.php';
break;
}

Loading…
Cancel
Save