Закладка LMS, Moodle SCORM - PullRequest
       20

Закладка LMS, Moodle SCORM

0 голосов
/ 29 февраля 2012

Здравствуйте, я ищу способ добавить в закладки страницу с помощью JavaScript, чтобы при повторном открытии пользователем курса он запоминал страницу, на которой он или она, отправив ее в SCORM / Moodle.1003 *

с использованием Scorm 1.2 и Moodle 1.9:)

Большое спасибо

<!-- ================ -->
<!-- Bookmarking start -->
<!-- ================ -->
<script type="text/javascript" src="SCORM_API_wrapper.js"></script>
<script type="text/javascript">
//Using pipwerks namespace, SCORM 1.2

var success = pipwerks.SCORM.init();

if(success){
  var status = pipwerks.SCORM.get("cmi.core.lesson_status");
  if(status != "completed"){
    success = pipwerks.SCORM.get("cmi.core.lesson_status", "completed");
    if(success){
       pipwerks.SCORM.quit();
    }
  }
}

function setbookMark() {
    var setlessonLocation = scorm.set("cmi.core.lesson_location", "2");
}

function showbookMark() {
    alert(scorm.get("cmi.core.lesson_location"));
}

window.onload = function (){
    init();
    setbookMark();
}


</script>
<!-- ================ -->
<!-- Bookmarking End -->
<!-- ================ -->

Первая страница индекса, которая загружена

<script type="text/javascript" src="SCORM_API_wrapper.js"></script>
<script type="text/javascript">
var scorm = pipwerks.SCORM;


function init(){

    //Specify SCORM 1.2:
    scorm.version = "1.2";

    var callSucceeded = scorm.init();
}

function end(){

    var callSucceeded = scorm.quit();
}


function bookMark() {
    var lessonLocation = scorm.get("cmi.core.lesson_location");
    if (lessonLocation == "1") {
        window.location = "1.html";
        }
    else if(lessonLocation == "2") {
        window.location = "2.html";
        }
    else if(lessonLocation == "3") {
        window.location = "3.html";
        }
    else if(lessonLocation == "4") {
        window.location = "4.html";
        }
    else if(lessonLocation == "5") {
        window.location = "5.html";
        }
    else if(lessonLocation == "6") {
        window.location = "6.html";
        }
    else if(lessonLocation == "") {
        window.location = "1.html";
        }
}

window.onload = function (){
    init();
    bookMark();
}

window.onunload = function (){
    end();
}
</script>

Ответы [ 2 ]

2 голосов
/ 02 марта 2012

Настройка lesson_location эквивалентна созданию файла cookie браузера ... вам нужно написать JavaScript в вашем курсе, который анализирует сохраненную строку и использует ее.

Вам нужно изменить код вколичество мест - код, который вы указали, является примером того, как ваш курс завершается в момент инициализации.Это не совсем то, что вы ищете.

Вот краткое руководство по началу курса и поиску закладки:

var bookmark, initialized, status;
var scorm = pipwerks.SCORM; //shortcut for easier typing

function jumpToPage(url){

    //write some code that navigates to the specified url

    //Save whatever URL was just used as the bookmark
    //each time the function is invoked.
    scorm.set("cmi.core.lesson_location", url);

}

function init(){

    //the default URL in case no bookmark is found
    //or when course is launched for first time
    var url = "url_of_first_page.html";

    initialized = scorm.init();

    if(!initialized){ alert("Course failed to initialize"); return false; }

    //Get the lesson status from the LMS
    status = scorm.get("cmi.core.lesson_status");

    if(status === "completed"){

        //You're already done, get out of here
        scorm.quit();
        return; //exit init() function

    } else if(status === "ab-initio"){

        //this is the very first launch, no bookmark will be found in LMS
        //do nothing

    } else {

        //Check for a bookmark
        bookmark = scorm.get("cmi.core.lesson_location");

        //If a bookmark is found, use its value as the target URL
        if(bookmark){ 
            url = bookmark;
        }

    }        

    jumpToPage(url);

}


window.onload = init;
2 голосов
/ 29 февраля 2012

Вы можете использовать cmi.core.lesson_location для сохранения текущего местоположения учащихся в курсе. Если вам нужно хранить более сложную информацию, такую ​​как текущее состояние учащихся в курсе, используйте cmi.suspend_data. Это оба свойства чтения / записи, которые вы можете прочитать при первой загрузке курса и подключении к СУО, а затем перейти к соответствующему местоположению в курсе.

Краткое руководство по свойствам CMI можно найти в разделе Модель данных: http://scorm.com/scorm-explained/technical-scorm/run-time/run-time-reference/

...