echo "<script language='javascript'>window.location.replace('error.php?error=problem_vt')</script>"; exit; } $vtUser = new VtUser(NULL); $vtUserRigths = new VtRights(NULL); $context = get_context_instance(CONTEXT_COURSE, $course_id); if (voiceauthoring_getRole($context) == "Instructor") { $vtUserRigths->setProfile('moodle.recorder.instructor'); $type = "record"; } else { $vtUserRigths->setProfile('moodle.recorder.student'); $type = "play"; } $rid = voiceauthoring_get_resource_rid($course_id); if ($rid === false) { $result = $vtAction->createRecorder("Voice Authoring associated to the course " . $course_id); //create the resource on the vt if ($result != NULL && $result->error != "error") { if (!storeResource($result->getRid(), $course_id, "recorder", $course_id . "_recorder")) { $rid = $result->getRid(); //problem to insert the record in db } } } $resource = voicetools_api_get_resource($rid); if ($resource) { //echo "<script language='javascript'>window.location.replace('error.php?error=problem_vt')</script>"; //exit(); $message = new vtMessage(null); $message->setMid($block_id); $result = $vtAction->getVtSession($resource, $vtUser, $vtUserRigths, $message);