Exemplo n.º 1
0
 $file_base_name = str_replace('.' . $extension, '', $filename);
 $new_dir = api_replace_dangerous_char(trim($file_base_name), 'strict');
 require_once 'learnpath.class.php';
 $result = learnpath::verify_document_size($s);
 if ($result == true) {
     return api_failure::set_failure('upload_file_too_big');
 }
 $type = learnpath::get_package_type($s, basename($s));
 switch ($type) {
     case 'scorm':
         require_once 'scorm.class.php';
         $oScorm = new scorm();
         $manifest = $oScorm->import_local_package($s, $current_dir);
         if ($manifest === false) {
             //if ap i_set_failure
             return api_failure::set_failure(api_failure::get_last_failure());
         }
         if (!empty($manifest)) {
             $oScorm->parse_manifest($manifest);
             $oScorm->import_manifest(api_get_course_id(), $_REQUEST['use_max_score']);
         }
         $proximity = '';
         if (!empty($_REQUEST['content_proximity'])) {
             $proximity = Database::escape_string($_REQUEST['content_proximity']);
         }
         $maker = '';
         if (!empty($_REQUEST['content_maker'])) {
             $maker = Database::escape_string($_REQUEST['content_maker']);
         }
         $oScorm->set_proximity($proximity);
         $oScorm->set_maker($maker);
Exemplo n.º 2
0
                 }
             }
             $title = @htmlspecialchars(GetQuizName($filename, $document_sys_path . $uploadPath . '/' . $fld . '/'), ENT_COMPAT, api_get_system_encoding());
             $query = "UPDATE {$dbTable} SET comment='" . Database::escape_string($title) . "' WHERE c_id = {$course_id} AND path=\"" . $uploadPath . "/" . $fld . "/" . $filename . "\"";
             Database::query($query);
             api_item_property_update($_course, TOOL_QUIZ, $id, 'QuizAdded', api_get_user_id());
         } else {
             if ($finish == 2) {
                 // delete?
                 //$dialogBox .= get_lang('NoImg');
             }
             $finish = 0;
             // error
             if (api_failure::get_last_failure() == 'not_enough_space') {
                 $dialogBox .= get_lang('NoSpace');
             } elseif (api_failure::get_last_failure() == 'php_file_in_zip_file') {
                 $dialogBox .= get_lang('ZipNoPhp');
             }
         }
     }
 }
 if ($finish == 1) {
     /** ok -> send to main exercises page */
     header('Location: exercice.php?' . api_get_cidreq());
     exit;
 }
 Display::display_header($nameTools, get_lang('Exercise'));
 echo '<div class="actions">';
 echo '<a href="exercice.php?show=test">' . Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM) . '</a>';
 echo '</div>';
 if ($finish == 2) {
            case 'confirmation':
                Display::display_confirmation_message($dialog_box);
                break;
            case 'error':
                Display::display_error_message($dialog_box);
                break;
            case 'warning':
                Display::display_warning_message($dialog_box);
                break;
            default:
                Display::display_normal_message($dialog_box);
                break;
        }
    }
    if (api_failure::get_last_failure()) {
        Display::display_normal_message(api_failure::get_last_failure());
    }
    //include('content_makers.inc.php');
    echo '<div class="actions">';
    echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add_lp">' . '<img src="../img/wizard.gif" border="0" align="absmiddle" alt="' . get_lang('_add_learnpath') . '">&nbsp;' . get_lang('_add_learnpath') . '</a>' . str_repeat('&nbsp;', 3) . '<a href="../upload/index.php?' . api_get_cidreq() . '&curdirpath=/&tool=' . TOOL_LEARNPATH . '"><img src="../img/file_zip.gif" border="0" alt="' . get_lang("UploadScorm") . '" align="absmiddle">&nbsp;' . get_lang("UploadScorm") . '</a>';
    //////added for cloud
    if (api_get_setting('enableScormCloud', 'enableScormCloud') == 'true') {
        echo str_repeat('&nbsp;', 3) . '<a href="../scorm_cloud/upload.php?' . api_get_cidreq() . '&curdirpath=/&tool=' . TOOL_LEARNPATH . '">' . '<img src="../scorm_cloud/img/cloud_icon_sm.gif" border="0" alt="' . get_lang("AddCloudCourse") . '" align="absmiddle">', '&nbsp;' . get_lang("AddCloudCourse") . '</a>';
    }
    /////////
    if (api_get_setting('service_ppt2lp', 'active') == 'true') {
        echo str_repeat('&nbsp;', 3) . '<a href="../upload/upload_ppt.php?' . api_get_cidreq() . '&curdirpath=/&tool=' . TOOL_LEARNPATH . '"><img src="../img/powerpoint.gif" border="0" alt="' . get_lang("PowerPointConvert") . '" align="absmiddle">&nbsp;' . get_lang("PowerPointConvert") . '</a>';
        //echo  str_repeat('&nbsp;',3).'<a href="../upload/upload_word.php?'.api_get_cidreq().'&curdirpath=/&tool='.TOOL_LEARNPATH.'"><img src="../img/word.gif" border="0" alt="'.get_lang("WordConvert").'" align="absmiddle">&nbsp;'.get_lang("WordConvert").'</a>';
    }
    echo '</div>';
}
Exemplo n.º 4
0
 * Process part of the SCORM sub-process for upload. This script MUST BE included by upload/index.php
 * as it prepares most of the variables needed here.
 * @package chamilo.upload
 * @author Yannick Warnier <*****@*****.**>
 */
/**
 * Process the SCORM package and return to the SCORM tool
 */
$language_file = 'scorm';
$cwdir = getcwd();
require_once '../newscorm/lp_upload.php';

// Reinit current working directory as many functions in upload change it
chdir($cwdir);

$error = api_failure::get_last_failure();

if ($error == 'upload_file_too_big') {
    $msg = urlencode(get_lang('UplFileTooBig'));
    $dialogtype = 'error';
} else {
    if ($error == 'not_a_learning_path') {
        $msg = urlencode(get_lang('ScormUnknownPackageFormat'));
        $dialogtype = 'error';
    } elseif ($error == 'not_enough_space') {
        $msg = urlencode(
            get_lang('ScormNotEnoughSpaceInCourseToInstallPackage')
        );
        $dialogtype = 'error';
    } elseif ($error == 'not_scorm_content') {
        $msg = urlencode(get_lang('ScormPackageFormatNotScorm'));
Exemplo n.º 5
0
            case 'confirmation':
                $message = Display::return_message($dialog_box, 'success');
                break;
            case 'error':
                $message = Display::return_message($dialog_box, 'danger');
                break;
            case 'warning':
                $message = Display::return_message($dialog_box, 'warning');
                break;
            default:
                $message = Display::return_message($dialog_box);
                break;
        }
    }
    if (api_failure::get_last_failure()) {
        $message = Display::return_message(api_failure::get_last_failure());
    }
    $actions .= Display::url(Display::return_icon('new_folder.png', get_lang('AddCategory'), array(), ICON_SIZE_MEDIUM), api_get_self() . '?' . api_get_cidreq() . '&action=add_lp_category');
    $actions .= Display::url(Display::return_icon('new_learnpath.png', get_lang('LearnpathAddLearnpath'), '', ICON_SIZE_MEDIUM), api_get_self() . '?' . api_get_cidreq() . '&action=add_lp');
    $actions .= Display::url(Display::return_icon('import_scorm.png', get_lang('UploadScorm'), '', ICON_SIZE_MEDIUM), '../upload/index.php?' . api_get_cidreq() . '&curdirpath=/&tool=' . TOOL_LEARNPATH);
    if (api_get_setting('service_ppt2lp', 'active') == 'true') {
        $actions .= Display::url(Display::return_icon('import_powerpoint.png', get_lang('PowerPointConvert'), '', ICON_SIZE_MEDIUM), '../upload/upload_ppt.php?' . api_get_cidreq() . '&curdirpath=/&tool=' . TOOL_LEARNPATH);
    }
}
$token = Security::get_token();
/* DISPLAY SCORM LIST */
$categoriesTempList = learnpath::getCategories(api_get_course_int_id());
$categoryTest = new \Chamilo\CourseBundle\Entity\CLpCategory();
$categoryTest->setId(0);
$categoryTest->setName(get_lang('WithOutCategory'));
$categoryTest->setPosition(0);