コード例 #1
0
             require_once '../scorm_cloud/scorm_cloud.lib.php';
             $lp_id = $_REQUEST['lp_id'];
             $cid = $_REQUEST['cidReq'];
             if (cloud_isCloudCourse($cid, $lp_id)) {
                 if (api_get_setting('enableCloudCourseSharing', 'existingCloudCourseUse') == 'true') {
                     cloud_deleteRegistrations($cid, $lp_id);
                 } else {
                     $tbl_scorm_cloud = Database::get_main_table('scorm_cloud');
                     $sql_cloud_get_course = "Select cloud_course_id from {$tbl_scorm_cloud} " . "WHERE course_code = '{$cid}'  AND lp_id = {$lp_id} ";
                     $res = api_sql_query($sql_cloud_get_course, __FILE__, __LINE__);
                     if (Database::num_rows($res) > 0) {
                         $row = Database::fetch_array($res);
                         $cloud_courseId = $row['cloud_course_id'];
                     }
                     //echo $cloud_courseId.'<br/>';
                     cloud_deleteCourse($cloud_courseId);
                 }
             }
         }
         //////////////
         $_SESSION['refresh'] = 1;
         //remove lp from homepage if it is there
         $_SESSION['oLP']->toggle_visibility((int) $_GET['lp_id'], 'i');
         $_SESSION['oLP']->delete(null, (int) $_GET['lp_id'], 'remove');
         api_session_unregister('oLP');
         require 'lp_list.php';
     }
     break;
 case 'toggle_visible':
     //change lp visibility (inside lp tool)
     if (!api_is_allowed_to_edit()) {
コード例 #2
0
    api_not_allowed(true);
}
/*
-----------------------------------------------------------
	Libraries
-----------------------------------------------------------
*/
//many useful functions in main_api.lib.php, by default included
//require_once(api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php');
require_once api_get_path(LIBRARY_PATH) . 'events.lib.inc.php';
require_once api_get_path(LIBRARY_PATH) . 'document.lib.php';
require_once 'scorm_cloud.lib.php';
$ScormService = cloud_getScormEngineService();
if (isset($_REQUEST['action'])) {
    if ($_REQUEST['action'] == 'delete' && isset($_REQUEST['ccid'])) {
        cloud_deleteCourse($_REQUEST['ccid']);
        header('location: cloudManager.php');
    } elseif ($_REQUEST['action'] == 'upload') {
        $courseId = uniqid();
        require_once 'CloudPHPLibrary/CourseData.php';
        $uploadService = $ScormService->getUploadService();
        $courseService = $ScormService->getCourseService();
        // Where the file is going to be placed
        $target_path = "uploads/";
        /* Add the original filename to our target path.  
        		Result is "uploads/filename.extension" */
        $target_path = $target_path . basename($_FILES['user_file']['name']);
        $tempFile = $_FILES["user_file"]["tmp_name"];
        move_uploaded_file($_FILES['user_file']['tmp_name'], $target_path);
        $absoluteFilePathToZip = $target_path;
        //now upload the file and save the resulting location