SCORM attempt status

SCORM attempt status

by Stephan Tedesco -
Number of replies: 1

Hi, I am new to the Moodle and need to develop some custom function, in order to display to the learner, that he reached his maximum attempts in all of his activities in the current course (and to reach his required grade of 60% from the both attempts).  I understand, that i have to make something with  "scorm_get_attempt_status" in the /scorm/locallib.php and his results and then display it in the renderer.php of the course. 

In the renderer.php I would add an else if-statement and then look in every activity if it is completed after the second attempt.

What has to be added, in order to display after failed completition of the course a simple message to the learner. 

Sorry for the complicated looking question, but as I said, it is new to me and I don't know the exact structure.


Average of ratings: -
In reply to Stephan Tedesco

Re: SCORM attempt status

by Stephan Tedesco -

After struggle with the moodle database and not finding function to get me the data I need, here is where I am right now:

I added the following function in scorm/locallib.php, but can't finish It (sorry for the pseudocode...)

       function scorm_get_attempt_status_bool($user, $scorm, $cm='') {

    global $DB, $PAGE, $OUTPUT;

//true if not failed

    $attempts = scorm_get_attempt_count($user->id, $scorm, true);

    if (empty($attempts)) {

        $attemptcount = 0;

    } else {

        $attemptcount = count($attempts);

    }


    $result = '<p>'.get_string('noattemptsallowed', 'scorm').': ';

    if ($scorm->maxattempt > 0) {

        $result .= $scorm->maxattempt . '<br />';

    } else {

        $result = true;

    }

    //$result .= get_string('noattemptsmade', 'scorm').': ' . $attemptcount . '<br />';

    

    /*

     * while($scorm= next segment?? )

     * {

     * //see: scorm_get_user_grades

        $user_score = scorm_grade_user($scorm, $userid);

     *  if($user_attempts == maxattempts && $user_score < $needed_score(from database?))

     *          return false

     * }

     * return true

     *      */

}

Does anybody has an advice how to finish it? 


Thanks in advance. 


S.