/** * Imports a zip file (presumably AICC) into the Dokeos structure * @param string Zip file info as given by $_FILES['userFile'] * @return string Absolute path to the AICC config files directory or empty string on error */ function import_package($zip_file_info, $current_dir = '') { if ($this->debug > 0) { error_log('In aicc::import_package(' . print_r($zip_file_info, true) . ',"' . $current_dir . '") method', 0); } //ini_set('error_log','E_ALL'); $maxFilledSpace = 1000000000; $zip_file_path = $zip_file_info['tmp_name']; $zip_file_name = $zip_file_info['name']; if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Zip file path = ' . $zip_file_path . ', zip file name = ' . $zip_file_name, 0); } $course_rel_dir = api_get_course_path() . '/scorm'; //scorm dir web path starting from /courses $course_sys_dir = api_get_path(SYS_COURSE_PATH) . $course_rel_dir; //absolute system path for this course $current_dir = replace_dangerous_char(trim($current_dir), 'strict'); //current dir we are in, inside scorm/ if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Current_dir = ' . $current_dir, 0); } //$uploaded_filename = $_FILES['userFile']['name']; //get name of the zip file without the extension if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Received zip file name: ' . $zip_file_path, 0); } $file_info = pathinfo($zip_file_name); $filename = $file_info['basename']; $extension = $file_info['extension']; $file_base_name = str_replace('.' . $extension, '', $filename); //filename without its extension $this->zipname = $file_base_name; //save for later in case we don't have a title if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Base file name is : ' . $file_base_name, 0); } $new_dir = replace_dangerous_char(trim($file_base_name), 'strict'); $this->subdir = $new_dir; if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Subdir is first set to : ' . $this->subdir, 0); } /* if( check_name_exist($course_sys_dir.$current_dir."/".$new_dir) ) { $dialogBox = get_lang('FileExists'); $stopping_error = true; } */ $zipFile = new pclZip($zip_file_path); // Check the zip content (real size and file extension) $zipContentArray = $zipFile->listContent(); $package_type = ''; //the type of the package. Should be 'aicc' after the next few lines $package = ''; //the basename of the config files (if 'courses.crs' => 'courses') $at_root = false; //check if the config files are at zip root $config_dir = ''; //the directory in which the config files are. May remain empty $files_found = array(); $subdir_isset = false; //the following loop should be stopped as soon as we found the right config files (.crs, .au, .des and .cst) foreach ($zipContentArray as $thisContent) { if (preg_match('~.(php.*|phtml)$~i', $thisContent['filename'])) { //if a php file is found, do not authorize (security risk) if ($this->debug > 1) { error_log('New LP - aicc::import_package() - Found unauthorized file: ' . $thisContent['filename'], 0); } return api_failure::set_failure('php_file_in_zip_file'); } elseif (preg_match('?.*/aicc/$?', $thisContent['filename'])) { //if a directory named 'aicc' is found, package type = aicc, but continue //because we need to find the right AICC files if ($this->debug > 1) { error_log('New LP - aicc::import_package() - Found aicc directory: ' . $thisContent['filename'], 0); } $package_type = 'aicc'; } else { //else, look for one of the files we're searching for (something.crs case insensitive) $res = array(); if (preg_match('?^(.*)\\.(crs|au|des|cst|ore|pre|cmp)$?i', $thisContent['filename'], $res)) { if ($this->debug > 1) { error_log('New LP - aicc::import_package() - Found AICC config file: ' . $thisContent['filename'] . '. Now splitting: ' . $res[1] . ' and ' . $res[2], 0); } if ($thisContent['filename'] == basename($thisContent['filename'])) { if ($this->debug > 2) { error_log('New LP - aicc::import_package() - ' . $thisContent['filename'] . ' is at root level', 0); } $at_root = true; if (!is_array($files_found[$res[1]])) { $files_found[$res[1]] = $this->config_exts; //initialise list of expected extensions (defined in class definition) } $files_found[$res[1]][strtolower($res[2])] = $thisContent['filename']; $subdir_isset = true; } else { if (!$subdir_isset) { if (preg_match('?^.*/aicc$?i', dirname($thisContent['filename']))) { //echo "Cutting subdir<br/>"; $this->subdir .= '/' . substr(dirname($thisContent['filename']), 0, -5); } else { //echo "Not cutting subdir<br/>"; $this->subdir .= '/' . dirname($thisContent['filename']); } $subdir_isset = true; } if ($this->debug > 2) { error_log('New LP - aicc::import_package() - ' . $thisContent['filename'] . ' is not at root level - recording subdir ' . $this->subdir, 0); } $config_dir = dirname($thisContent['filename']); //just the relative directory inside scorm/ if (!is_array($files_found[basename($res[1])])) { $files_found[basename($res[1])] = $this->config_exts; } $files_found[basename($res[1])][strtolower($res[2])] = basename($thisContent['filename']); } $package_type = 'aicc'; } else { if ($this->debug > 3) { error_log('New LP - aicc::import_package() - File ' . $thisContent['filename'] . ' didnt match any check', 0); } } } $realFileSize += $thisContent['size']; } if ($this->debug > 2) { error_log('New LP - aicc::import_package() - $files_found: ' . print_r($files_found, true), 0); } if ($this->debug > 1) { error_log('New LP - aicc::import_package() - Package type is now ' . $package_type, 0); } $mandatory = false; foreach ($files_found as $file_name => $file_exts) { $temp = (!empty($files_found[$file_name]['crs']) and !empty($files_found[$file_name]['au']) and !empty($files_found[$file_name]['des']) and !empty($files_found[$file_name]['cst'])); if ($temp) { if ($this->debug > 1) { error_log('New LP - aicc::import_package() - Found all config files for ' . $file_name, 0); } $mandatory = true; $package = $file_name; //store base config file name for reuse in parse_config_files() $this->config_basename = $file_name; //store filenames for reuse in parse_config_files() $this->config_files = $files_found[$file_name]; //get out, we only want one config files set break; } } if ($package_type == '' or $mandatory != true) { return api_failure::set_failure('not_aicc_content'); } if (!enough_size($realFileSize, $course_sys_dir, $maxFilledSpace)) { return api_failure::set_failure('not_enough_space'); } // it happens on Linux that $new_dir sometimes doesn't start with '/' if ($new_dir[0] != '/') { $new_dir = '/' . $new_dir; } //cut trailing slash if ($new_dir[strlen($new_dir) - 1] == '/') { $new_dir = substr($new_dir, 0, -1); } /* -------------------------------------- Uncompressing phase -------------------------------------- */ /* We need to process each individual file in the zip archive to - add it to the database - parse & change relative html links - make sure the filenames are secure (filter funny characters or php extensions) */ if (is_dir($course_sys_dir . $new_dir) or @mkdir($course_sys_dir . $new_dir)) { // PHP method - slower... if ($this->debug >= 1) { error_log('New LP - Changing dir to ' . $course_sys_dir . $new_dir, 0); } $saved_dir = getcwd(); chdir($course_sys_dir . $new_dir); $unzippingState = $zipFile->extract(); for ($j = 0; $j < count($unzippingState); $j++) { $state = $unzippingState[$j]; //TODO fix relative links in html files (?) $extension = strrchr($state["stored_filename"], "."); //if($this->debug>1){error_log('New LP - found extension '.$extension.' in '.$state['stored_filename'],0);} } if (!empty($new_dir)) { $new_dir = $new_dir . '/'; } //rename files, for example with \\ in it if ($dir = @opendir($course_sys_dir . $new_dir)) { if ($this->debug == 1) { error_log('New LP - Opened dir ' . $course_sys_dir . $new_dir, 0); } while ($file = readdir($dir)) { if ($file != '.' && $file != '..') { $filetype = "file"; if (is_dir($course_sys_dir . $new_dir . $file)) { $filetype = "folder"; } //TODO RENAMING FILES CAN BE VERY DANGEROUS AICC-WISE, avoid that as much as possible! //$safe_file=replace_dangerous_char($file,'strict'); $find_str = array('\\', '.php', '.phtml'); $repl_str = array('/', '.txt', '.txt'); $safe_file = str_replace($find_str, $repl_str, $file); if ($safe_file != $file) { //@rename($course_sys_dir.$new_dir,$course_sys_dir.'/'.$safe_file); $mydir = dirname($course_sys_dir . $new_dir . $safe_file); if (!is_dir($mydir)) { $mysubdirs = split('/', $mydir); $mybasedir = '/'; foreach ($mysubdirs as $mysubdir) { if (!empty($mysubdir)) { $mybasedir = $mybasedir . $mysubdir . '/'; if (!is_dir($mybasedir)) { @mkdir($mybasedir); if ($this->debug == 1) { error_log('New LP - Dir ' . $mybasedir . ' doesnt exist. Creating.', 0); } } } } } @rename($course_sys_dir . $new_dir . $file, $course_sys_dir . $new_dir . $safe_file); if ($this->debug == 1) { error_log('New LP - Renaming ' . $course_sys_dir . $new_dir . $file . ' to ' . $course_sys_dir . $new_dir . $safe_file, 0); } } //set_default_settings($course_sys_dir,$safe_file,$filetype); } } closedir($dir); chdir($saved_dir); } } else { return ''; } return $course_sys_dir . $new_dir . $config_dir; }
} $oScorm->set_proximity($proximity); $oScorm->set_maker($maker); $oScorm->set_jslib('scorm_api.php'); break; case 'aicc': require_once 'aicc.class.php'; $oAICC = new aicc(); $config_dir = $oAICC->import_local_package($s, $current_dir); if (!empty($config_dir)) { $oAICC->parse_config_files($config_dir); $oAICC->import_aicc(api_get_course_id()); } $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']); } $oAICC->set_proximity($proximity); $oAICC->set_maker($maker); $oAICC->set_jslib('aicc_api.php'); break; case '': default: return api_failure::set_failure('not_a_learning_path'); } } }
/** * Imports a zip file into the Chamilo structure * @param string Zip file info as given by $_FILES['userFile'] * @return string Absolute path to the imsmanifest.xml file or empty string on error */ function import_package($zip_file_info, $current_dir = '') { if ($this->debug > 0) { error_log('In scorm::import_package(' . print_r($zip_file_info, true) . ',"' . $current_dir . '") method', 0); } $maxFilledSpace = DocumentManager::get_course_quota(); $zip_file_path = $zip_file_info['tmp_name']; $zip_file_name = $zip_file_info['name']; if ($this->debug > 1) { error_log('New LP - import_package() - zip file path = ' . $zip_file_path . ', zip file name = ' . $zip_file_name, 0); } // scorm dir web path starting from /courses $course_rel_dir = api_get_course_path() . '/scorm'; $course_sys_dir = api_get_path(SYS_COURSE_PATH) . $course_rel_dir; // Absolute system path for this course. if (!is_dir($course_sys_dir)) { mkdir($course_sys_dir, api_get_permissions_for_new_directories()); } $current_dir = api_replace_dangerous_char(trim($current_dir), 'strict'); // Current dir we are in, inside scorm/ if ($this->debug > 1) { error_log('New LP - import_package() - current_dir = ' . $current_dir, 0); } //$uploaded_filename = $_FILES['userFile']['name']; // Get name of the zip file without the extension. if ($this->debug > 1) { error_log('New LP - Received zip file name: ' . $zip_file_path, 0); } $file_info = pathinfo($zip_file_name); $filename = $file_info['basename']; $extension = $file_info['extension']; $file_base_name = str_replace('.' . $extension, '', $filename); // Filename without its extension. $this->zipname = $file_base_name; // Save for later in case we don't have a title. if ($this->debug > 1) { error_log("New LP - base file name is : " . $file_base_name, 0); } $new_dir = api_replace_dangerous_char(trim($file_base_name), 'strict'); $this->subdir = $new_dir; if ($this->debug > 1) { error_log("New LP - subdir is first set to : " . $this->subdir, 0); } $zipFile = new PclZip($zip_file_path); // Check the zip content (real size and file extension). $zipContentArray = $zipFile->listContent(); $package_type = ''; $at_root = false; $manifest = ''; $realFileSize = 0; $manifest_list = array(); // The following loop should be stopped as soon as we found the right imsmanifest.xml (how to recognize it?). foreach ($zipContentArray as $thisContent) { $file = $thisContent['filename']; //error_log('Looking at '.$thisContent['filename'], 0); if (preg_match('~.(php.*|phtml)$~i', $file)) { $this->set_error_msg("File {$file} contains a PHP script"); //return api_failure::set_failure('php_file_in_zip_file'); } elseif (stristr($thisContent['filename'], 'imsmanifest.xml')) { //error_log('Found imsmanifest at '.$thisContent['filename'], 0); if ($thisContent['filename'] == basename($thisContent['filename'])) { $at_root = true; } else { //$this->subdir .= '/'.dirname($thisContent['filename']); if ($this->debug > 2) { error_log("New LP - subdir is now " . $this->subdir, 0); } } $package_type = 'scorm'; $manifest_list[] = $thisContent['filename']; $manifest = $thisContent['filename']; //just the relative directory inside scorm/ } else { // Do nothing, if it has not been set as scorm somewhere else, it stays as '' default. } $realFileSize += $thisContent['size']; } // Now get the shortest path (basically, the imsmanifest that is the closest to the root). $shortest_path = $manifest_list[0]; $slash_count = substr_count($shortest_path, '/'); foreach ($manifest_list as $manifest_path) { $tmp_slash_count = substr_count($manifest_path, '/'); if ($tmp_slash_count < $slash_count) { $shortest_path = $manifest_path; $slash_count = $tmp_slash_count; } } $this->subdir .= '/' . dirname($shortest_path); // Do not concatenate because already done above. $manifest = $shortest_path; if ($this->debug > 1) { error_log('New LP - Package type is now ' . $package_type, 0); } // && defined('CHECK_FOR_SCORM') && CHECK_FOR_SCORM) if ($package_type == '') { if ($this->debug > 1) { error_log('New LP - Package type is empty', 0); } return api_failure::set_failure('not_scorm_content'); } // It happens on Linux that $new_dir sometimes doesn't start with '/' if ($new_dir[0] != '/') { $new_dir = '/' . $new_dir; } if ($new_dir[strlen($new_dir) - 1] == '/') { $new_dir = substr($new_dir, 0, -1); } $isDir = is_dir($course_sys_dir . $new_dir); if ($isDir == false) { mkdir($course_sys_dir . $new_dir, api_get_permissions_for_new_directories()); $isDir = is_dir($course_sys_dir . $new_dir); } /* Uncompressing phase */ /* We need to process each individual file in the zip archive to - add it to the database - parse & change relative html links - make sure the filenames are secure (filter funny characters or php extensions) */ if ($isDir) { if (!FileManager::enough_size($realFileSize, $course_sys_dir, $maxFilledSpace)) { if ($this->debug > 1) { error_log('New LP - Not enough space to store package', 0); } return api_failure::set_failure('not_enough_space'); } // PHP method - slower... if ($this->debug >= 1) { error_log('New LP - Changing dir to ' . $course_sys_dir . $new_dir, 0); } $saved_dir = getcwd(); chdir($course_sys_dir . $new_dir); $unzippingState = $zipFile->extract(); for ($j = 0; $j < count($unzippingState); $j++) { $state = $unzippingState[$j]; // TODO: Fix relative links in html files (?) $extension = strrchr($state['stored_filename'], '.'); if ($this->debug >= 1) { error_log('New LP - found extension ' . $extension . ' in ' . $state['stored_filename'], 0); } } if (!empty($new_dir)) { $new_dir = $new_dir . '/'; } // Rename files, for example with \\ in it. if ($this->debug >= 1) { error_log('New LP - try to open: ' . $course_sys_dir . $new_dir, 0); } if ($dir = @opendir($course_sys_dir . $new_dir)) { if ($this->debug >= 1) { error_log('New LP - Opened dir ' . $course_sys_dir . $new_dir, 0); } while ($file = readdir($dir)) { if ($file != '.' && $file != '..') { $filetype = 'file'; if (is_dir($course_sys_dir . $new_dir . $file)) { $filetype = 'folder'; } // TODO: RENAMING FILES CAN BE VERY DANGEROUS SCORM-WISE, avoid that as much as possible! //$safe_file = replace_dangerous_char($file, 'strict'); $find_str = array('\\', '.php', '.phtml'); $repl_str = array('/', '.txt', '.txt'); $safe_file = str_replace($find_str, $repl_str, $file); if ($this->debug >= 1) { error_log('Comparing: ' . $safe_file, 0); } if ($this->debug >= 1) { error_log('and: ' . $file, 0); } if ($safe_file != $file) { $mydir = dirname($course_sys_dir . $new_dir . $safe_file); if (!is_dir($mydir)) { $mysubdirs = split('/', $mydir); $mybasedir = '/'; foreach ($mysubdirs as $mysubdir) { if (!empty($mysubdir)) { $mybasedir = $mybasedir . $mysubdir . '/'; if (!is_dir($mybasedir)) { @mkdir($mybasedir, api_get_permissions_for_new_directories()); if ($this->debug >= 1) { error_log('New LP - Dir ' . $mybasedir . ' doesnt exist. Creating.', 0); } } } } } @rename($course_sys_dir . $new_dir . $file, $course_sys_dir . $new_dir . $safe_file); if ($this->debug >= 1) { error_log('New LP - Renaming ' . $course_sys_dir . $new_dir . $file . ' to ' . $course_sys_dir . $new_dir . $safe_file, 0); } } } } closedir($dir); chdir($saved_dir); api_chmod_R($course_sys_dir . $new_dir, api_get_permissions_for_new_directories()); if ($this->debug > 1) { error_log('New LP - changed back to init dir: ' . $course_sys_dir . $new_dir, 0); } } } else { return ''; } return $course_sys_dir . $new_dir . $manifest; }
/** * Manages all the unzipping process of an uploaded file * * @author Hugues Peeters <*****@*****.**> * * @param array $uploaded_file - follows the $_FILES Structure * @param string $upload_path - destination of the upload. * This path is to append to $base_work_dir * @param string $base_work_dir - base working directory of the module * @param int $max_filled_space - amount of bytes to not exceed in the base * working directory * * @return boolean true if it succeeds false otherwise */ function unzip_uploaded_file($uploaded_file, $upload_path, $base_work_dir, $max_filled_space) { $zip_file = new PclZip($uploaded_file['tmp_name']); // Check the zip content (real size and file extension) if (file_exists($uploaded_file['tmp_name'])) { $zip_content_array = $zip_file->listContent(); $ok_scorm = false; $realFileSize = 0; foreach ($zip_content_array as &$this_content) { if (preg_match('~.(php.*|phtml)$~i', $this_content['filename'])) { return api_failure::set_failure('php_file_in_zip_file'); } elseif (stristr($this_content['filename'], 'imsmanifest.xml')) { $ok_scorm = true; } elseif (stristr($this_content['filename'], 'LMS')) { $ok_plantyn_scorm1 = true; } elseif (stristr($this_content['filename'], 'REF')) { $ok_plantyn_scorm2 = true; } elseif (stristr($this_content['filename'], 'SCO')) { $ok_plantyn_scorm3 = true; } elseif (stristr($this_content['filename'], 'AICC')) { $ok_aicc_scorm = true; } $realFileSize += $this_content['size']; } if ($ok_plantyn_scorm1 && $ok_plantyn_scorm2 && $ok_plantyn_scorm3 || $ok_aicc_scorm) { $ok_scorm = true; } if (!$ok_scorm && defined('CHECK_FOR_SCORM') && CHECK_FOR_SCORM) { return api_failure::set_failure('not_scorm_content'); } if (!enough_size($realFileSize, $base_work_dir, $max_filled_space)) { return api_failure::set_failure('not_enough_space'); } // It happens on Linux that $upload_path sometimes doesn't start with '/' if ($upload_path[0] != '/' && substr($base_work_dir, -1, 1) != '/') { $upload_path = '/' . $upload_path; } if ($upload_path[strlen($upload_path) - 1] == '/') { $upload_path = substr($upload_path, 0, -1); } /* Uncompressing phase */ /* The first version, using OS unzip, is not used anymore because it does not return enough information. We need to process each individual file in the zip archive to - add it to the database - parse & change relative html links */ if (PHP_OS == 'Linux' && !get_cfg_var('safe_mode') && false) { // *** UGent, changed by OC *** // Shell Method - if this is possible, it gains some speed exec("unzip -d \"" . $base_work_dir . $upload_path . "/\"" . $uploaded_file['name'] . " " . $uploaded_file['tmp_name']); } else { // PHP method - slower... $save_dir = getcwd(); chdir($base_work_dir . $upload_path); $unzippingState = $zip_file->extract(); for ($j = 0; $j < count($unzippingState); $j++) { $state = $unzippingState[$j]; // Fix relative links in html files $extension = strrchr($state['stored_filename'], '.'); } if ($dir = @opendir($base_work_dir . $upload_path)) { while ($file = readdir($dir)) { if ($file != '.' && $file != '..') { $filetype = 'file'; if (is_dir($base_work_dir . $upload_path . '/' . $file)) { $filetype = 'folder'; } $safe_file = api_replace_dangerous_char($file, 'strict'); @rename($base_work_dir . $upload_path . '/' . $file, $base_work_dir . $upload_path . '/' . $safe_file); set_default_settings($upload_path, $safe_file, $filetype); } } closedir($dir); } else { error_log('Could not create directory ' . $base_work_dir . $upload_path . ' to unzip files'); } chdir($save_dir); // Back to previous dir position } } return true; }
} } $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) {
* 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'));
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') . '"> ' . get_lang('_add_learnpath') . '</a>' . str_repeat(' ', 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"> ' . get_lang("UploadScorm") . '</a>'; //////added for cloud if (api_get_setting('enableScormCloud', 'enableScormCloud') == 'true') { echo str_repeat(' ', 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">', ' ' . get_lang("AddCloudCourse") . '</a>'; } ///////// if (api_get_setting('service_ppt2lp', 'active') == 'true') { echo str_repeat(' ', 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"> ' . get_lang("PowerPointConvert") . '</a>'; //echo str_repeat(' ',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"> '.get_lang("WordConvert").'</a>'; } echo '</div>'; }
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);