require_once "../../config.php"; require_once "lib.php"; require_once 'lib/php/vt/VtAction.php'; require_once 'lib/php/vt/WimbaVoicetools.php'; require_once 'lib/php/vt/WimbaVoicetoolsAPI.php'; global $CFG, $USER; $vtAction = new vtAction($USER->email); $course_id = optional_param('course_id', 0, PARAM_INT); $block_id = optional_param('block_id', 0, PARAM_INT); require_login($course_id); if (!isset($CFG->voicetools_servername)) { 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();
function createUserRights($product, $role) { $vtUserRigths = new VtRights(NULL); $vtUserRigths->setProfile('moodle.' . $product . '.' . strtolower($role)); if ($product == "presentation") { $vtUserRigths->add("reply_message"); } return $vtUserRigths; }