$blocks->recipient = $selected;
    voiceemail_update_blocks_instance($blocks);
    //redirection to the course page
    parentRedirection("{$CFG->wwwroot}/course/view.php?id={$course_id}");
} else {
    if ($type == "other") {
        $emailTo = implode(";", $users);
    } else {
        $emailTo = voiceemail_getEnrolledUsers($course_id, $type);
    }
    $vtAction = new VtAction($USER->email);
    //get the voice email linked to this block
    $voiceemail = get_record("voiceemail_resources", "block", $block_id);
    if (empty($voiceemail)) {
        $vmail = $vtAction->createVMmail("Voice email for the course " . $course_id . " and the block " . $block_id);
        storeVmailResource($vmail->getRid(), $course_id, $block_id);
    } else {
        $vmail = $vtAction->getResource($voiceemail->rid);
    }
    if ($vmail->error == "error") {
        //have to display the error
        return false;
    }
    $currentUser = $vtAction->createUser($USER->firstname . "_" . $USER->lastname, $USER->email);
    $currentUserRights = $vtAction->createUserRights($vmail->getType(), voiceemail_getRole($context));
    $resourceOptions =& $vmail->options;
    $resourceOptions->setFrom($USER->email);
    $resourceOptions->setTo($emailTo);
    $vtSession = $vtAction->getVtSession($vmail, $currentUser, $currentUserRights);
    redirection($servername . "/" . $vmail->getType() . "?action=display_popup&nid=" . $vtSession->getNid());
}
Пример #2
0
$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);
if (function_exists("build_navigation")) {
    $cm->modname = "voiceemail";
    $cm->name = $voicetool->name;
    $navigation = build_navigation('', $cm);
    print_header("{$course->shortname}: {$voicetool->name}", $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $strvoicetool . " " . get_string('activity', 'voiceemail')), navmenu($course));
} else {
Пример #3
0
function voiceemail_get_url_params($courseid)
{
    global $USER;
    global $CFG;
    $context = get_context_instance(CONTEXT_COURSE, $courseid);
    $role = voiceemail_getRole($context);
    $signature = md5($courseid . $USER->email . $USER->firstname . $USER->lastname . $role);
    $url_params = "enc_course_id=" . rawurlencode($courseid) . "&enc_email=" . rawurlencode($USER->email) . "&enc_firstname=" . rawurlencode($USER->firstname) . "&enc_lastname=" . rawurlencode($USER->lastname) . "&enc_role=" . rawurlencode($role) . "&signature=" . rawurlencode($signature);
    return $url_params;
}