本文整理汇总了PHP中learnpath::get_package_type方法的典型用法代码示例。如果您正苦于以下问题:PHP learnpath::get_package_type方法的具体用法?PHP learnpath::get_package_type怎么用?PHP learnpath::get_package_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类learnpath
的用法示例。
在下文中一共展示了learnpath::get_package_type方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api_get_path
if (!isset($_POST['file_name'])) {
return false;
}
// Escape path with basename so it can only be directly into the archive/ directory.
$s = api_get_path(SYS_ARCHIVE_PATH) . basename($_POST['file_name']);
// Get name of the zip file without the extension
$info = pathinfo($s);
$filename = $info['basename'];
$extension = $info['extension'];
$file_base_name = str_replace('.' . $extension, '', $filename);
$new_dir = api_replace_dangerous_char(trim($file_base_name));
$result = learnpath::verify_document_size($s);
if ($result == true) {
throw new \Exception(get_lang('UplFileTooBig'));
}
$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) {
throw new \Exception('Error import local package');
}
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']);
示例2: round
$title = $_FILES['file']['name'];
$srcfile = $_FILES['file']['tmp_name'];
$size = round($_FILES['file']['size'] / 1000);
//get name of the zip file without the extension
$extension = file_ext($title);
$filename = date("YmdHis-") . rand(1000, 9999) . "." . $extension;
$file_base_name = str_replace('.' . $extension, '', $filename);
//$file_base_name = replace_dangerous_char(trim($file_base_name),'strict');
//move_uploaded_file($srcfile,$course_dir.iconv("GBK","UTF-8",$s));
move_uploaded_file($srcfile, $course_dir . $filename);
//die("insert into attachment(title,size,type,path,time,unzip) values ('$title','$size','$extension','".$course_dir.$filename."','$time','1')");
$mysql->query("insert into attachment(title,size,type,path,time,unzip) values ('{$title}','{$size}','{$extension}','" . $course_dir . $filename . "','{$time}','1')");
$attachmentId = $mysql->insert_id();
$unzip = new unzip();
$unzip->extract_zip($course_dir . $filename, $course_dir . $file_base_name . "/");
$type = learnpath::get_package_type($course_dir . $filename, $filename);
switch ($type) {
case 'scorm':
require_once 'scorm.class.php';
//require_once api_get_path(LIBRARY_PATH).'searchengine.lib.php';
$oScorm = new scorm();
//$manifest = $oScorm->import_package($_FILES['file'],$current_dir);
$manifest = $course_dir . $file_base_name . "/imsmanifest.xml";
if (!empty($manifest)) {
$oScorm->parse_manifest($manifest);
$oScorm->import_manifest($parentDir);
} else {
//show error message stored in $oScrom->error_msg
//logger("error: lp_upload->switch(scorm)->empty(manifest)");
die("不是符合标准的scorm课程包。");
}