if ($params['type'] == "board") { $result = $vtAction->createBoard(); //create the resource on the vt $messageAction = "created"; $messageProduct = "board"; } elseif ($params['type'] == "presentation") { $result = $vtAction->createPresentation(); $messageAction = "created"; $messageProduct = "presentation"; } elseif ($params['type'] == "pc") { $result = $vtAction->createPodcaster(); $messageAction = "created"; $messageProduct = "pc"; } if ($result != NULL && $result->error != "error") { $resource_id = storeResource($result->getRid(), $session->getCourseId(), $params); if (empty($resource_id)) { wimba_add_log(WIMBA_ERROR, voicepresentation_LOGS, "manageAction : Problem to add the resource into the database"); redirection($redirectionUrl . '&error=problem_bd'); } if ($params['action'] == "createDefault") { echo $result->getRid(); exit; } } else { if ($params['action'] == "createDefault") { echo "error"; exit; } wimba_add_log(WIMBA_ERROR, voicepresentation_LOGS, "manageAction :Problem to add the new resource on the vt server"); redirection($redirectionUrl . '&error=problem_vt');
$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); if ($result === false) { $error = "There is a problem to display the voice authoring"; // echo "<script language='javascript'>window.location.replace('error.php?error=problem_vt')</script>";