} } 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])) {
$notool = optional_param("novoicetools", "false"); $keys = array_merge(getKeysOfGeneralParameters(), getKeyWimbaVoiceForm()); foreach ($keys as $param) { $value = optional_param($param["value"], $param["default_value"], $param["type"]); if ($value != null) { $params[$param["value"]] = $value; } } wimba_add_log(WIMBA_DEBUG, voicepresentation_LOGS, "manageAction : parameters \n" . print_r($params, true)); require_login($params["enc_course_id"]); $session = new WimbaMoodleSession($params); $redirectionUrl = 'welcome.php?id=' . $params["enc_course_id"] . '&' . voicepresentation_get_url_params($params["enc_course_id"]) . '&time=' . $session->timeOfLoad; $urlModuleForm = $CFG->wwwroot . '/course/mod.php?section=0&sesskey=' . sesskey() . '&id=' . $session->getCourseId() . '&add=voicepresentation&rid='; $messageType = ""; if ($session->error === false && $session != NULL) { $vtAction = new vtAction($session->getEmail(), $params); if ($params['action'] == 'launch') { $session->setCurrentVtUSer($params["type"]); if ($params["studentView"] == "true") { $session->setVtUserRigths($params["type"], "student"); } $resource = voicetools_api_get_resource($params["resource_id"]); $result = $vtAction->getVtSession($resource, $session->getVtUser(), $session->getVtUserRigths()); if ($result != NULL) { wimba_add_log(WIMBA_DEBUG, voicepresentation_LOGS, "launch the " . $params["type"] . ", nid =" . $result->getNid()); if (!empty($params["filter_screen_name"])) { redirection($CFG->voicetools_servername . '/' . $params["type"] . '?action=display_popup&nid=' . $result->getNid() . "&filter_screen_name=" . $params["filter_screen_name"]); } else { redirection($CFG->voicetools_servername . '/' . $params["type"] . '?action=display_popup&nid=' . $result->getNid()); } } else {
require_login($course->id); if ($voicetool->isfirst == 0) { $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);
<script language="javascript" src="lib/web/js/lib/prototype/prototype.js"></script> <script language="javascript" src="lib/web/js/constants.js"></script> <script language="javascript" src="lib/web/js/wimba_ajax.js"></script> <link rel="STYLESHEET" href="css/StyleSheet.css" type="text/css" /> </head> <body> <?php 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');