Esempio n. 1
0
}
$native_userid = optional_param('userid', null, PARAM_INTEGER);
$query = block_intuitel_get_input_message();
$intuitelMsg = IntuitelController::getIntuitelXML($query);
//sleep(4);
if ($intuitelMsg->Learner) {
    if ($native_userid) {
        // Debugging backdoor
        $learnerid = Intuitel::getIDFactory()->getUserId($native_userid);
    } else {
        $learnerid = (string) $intuitelMsg->Learner['uId'];
    }
    $loId = new LOId((string) $intuitelMsg->Learner['loId']);
    $nativeCourseId = (string) $intuitelMsg->Learner['debugcourse'];
    $adaptor = Intuitel::getAdaptorInstanceForCourse();
    $idFactory = Intuitel::getIdFactory();
    if ($nativeCourseId) {
        global $PAGE;
        $context = context_course::instance($nativeCourseId);
        $PAGE->set_context($context);
        $courseLoId = $idFactory->getLoIdfromId('course', $nativeCourseId);
        $course = $adaptor->createLO($courseLoId);
    } else {
        $learningObject = $adaptor->createLO($loId);
        if ($learningObject instanceof CourseLO) {
            $course = $learningObject;
        } else {
            $sectionId = $learningObject->getParent();
            $section = $adaptor->createLO($sectionId);
            $courseId = $section->getParent();
            $course = $adaptor->createLO($courseId);