$voicetool->isfirst = 1; $voicetool->name = addslashes($voicetool->name); update_record("voiceemail", $voicetool); redirection("{$CFG->wwwroot}/course/view.php?id={$course->id}"); } $servername = $CFG->voicetools_servername; $strvoicetools = get_string("modulenameplural", "voiceemail"); $strvoicetool = get_string("modulename", "voiceemail"); $sentence1 = get_string('vtpopupshouldappear.1', 'voiceemail'); $sentence2 = "<a href='javascript:startVoiceTools()';>" . get_string('vtpopupshouldappear.2', 'voiceemail') . "</a>"; $sentence3 = get_string('vtpopupshouldappear.3', 'voiceemail'); $strLaunchComment = $sentence1 . $sentence2 . $sentence3; //get the informations related to the Vt resource $vtAction = new vtAction($USER->email); $dbResource = get_record("voiceemail_resources", "id", $voicetool->rid); $resource = $vtAction->getResource($dbResource->rid); //check the availability of the resource $roleSwitch = isSwitch(); //the user have switched his role? //determinate the role for the wimba tools $context = get_context_instance(CONTEXT_MODULE, $cm->id); $role = voiceemail_getRole($context); if ($resource->error == true) { wimba_add_log(WIMBA_ERROR, voiceemail_LOGS, "view.php : problem to get the resource(rid : " . $voicetool->rid . ") linked to this activity"); error(get_string("problem_vt", "voiceemail"), "{$CFG->wwwroot}/course/view.php?id={$course->id}"); } $currentUser = $vtAction->createUser($USER->firstname . "_" . $USER->lastname, $USER->email); $currentUserRights = $vtAction->createUserRights($resource->getType(), $role); $resource->setEmailFrom($USER->email); //get the vt session $vtSession = $vtAction->getVtSession($resource, $currentUser, $currentUserRights);
} require_login($params["enc_course_id"]); $session = new WimbaMoodleSession($params); $resource_id = $params["resource_id"]; $redirectionUrl = 'welcome.php?id=' . $params["enc_course_id"] . '&' . voiceboard_get_url_params($params["enc_course_id"]) . '&time=' . $session->timeOfLoad; if ($session->error === false && $session != NULL) { $cancelUrl = 'index.php?id=' . $params["enc_course_id"]; $context = get_context_instance(CONTEXT_COURSE, $params["enc_course_id"]); $adminUsers = get_users_by_capability($context, 'mod/voiceboard:presenter'); $allUsers = get_users_by_capability($context, 'moodle/course:view'); //$users also contain the users which have this capabilities at the system level $students = array_diff_assoc($allUsers, $adminUsers); //we get the student by getting the diff of the two arrays $users_key = array_keys($students); $vtAction = new vtAction($session->getEmail(), $params); $resource = $vtAction->getResource($resource_id); if ($resource === false) { //problem to get the grade redirection($redirectionUrl . '&error=problem_vt'); } $options = $resource->getOptions(); $isAverageMethodAvailable = true; $arrayAverageLength = $vtAction->getAverageMessageLengthPerUser($resource_id); if ($arrayAverageLength == "not_implemented") { $isAverageMethodAvailable = false; } $arrayNbMessage = $vtAction->getNbMessagePerUser($resource_id); $urlParams = 'resource_id=' . $resource_id . '&type=board&id=' . $params["enc_course_id"] . '&' . voiceboard_get_url_params($params["enc_course_id"]) . '&time=' . $session->timeOfLoad; $previousGrade = grade_get_grades($params["enc_course_id"], "mod", "voiceboard", $params["gradeId"], $users_key); if (!empty($previousGrade) && isset($previousGrade->items[0])) { //extract only the grade information from the object that we get
$urls[] = $text; } else { $urls[] = '<a href="' . $href . '">' . $text . '</a>'; } } $breadcrumb = implode(' -> ', $urls); print_header("{$course->shortname}: {$voicetool->name}", "{$course->fullname}", $breadcrumb . " {$voicetool->name}", "", "", true, update_module_button($cm->id, $course->id, $strvoicetool), navmenu($course, $cm)); } $roleSwitch = isSwitch(); //the user have switched his role? //determinate the role for the wimba tools $context = get_context_instance(CONTEXT_MODULE, $cm->id); $role = voicepodcaster_getRole($context); //get the informations related to the Vt resource $vtAction = new vtAction($USER->email); $resource = $vtAction->getResource($voicetool->rid); //check the availability of the resource $vtpreview = isVtAvailable($voicetool->rid); if ($resource->error == true) { wimba_add_log(WIMBA_ERROR, voicepodcaster_LOGS, "view.php : problem to get the resource(rid : " . $voicetool->rid . ") linked to this activity"); error(get_string("problem_vt", "voicepodcaster"), "{$CFG->wwwroot}/course/view.php?id={$course->id}"); } $currentUser = $vtAction->createUser($USER->firstname . "_" . $USER->lastname, $USER->email); $currentUserRights = $vtAction->createUserRights($resource->getType(), $role); //get the vt session $vtSession = $vtAction->getVtSession($resource, $currentUser, $currentUserRights); ?> <script type="text/javascript"> var popup; function doOpenPopup (url, type)