function webex_display_embed($url, $cm, $course)
{
    global $CFG, $PAGE, $OUTPUT;
    $mimetype = resourcelib_guess_webex_mimetype($url->externalurl);
    $fullurl = webex_get_full_webex($url, $cm, $course);
    $title = $url->name;
    $link = html_writer::tag('a', $fullurl, array('href' => str_replace('&', '&', $fullurl)));
    $clicktoopen = get_string('clicktoopen', 'webex', $link);
    $extension = resourcelib_get_extension($url->externalurl);
    if (in_array($mimetype, array('image/gif', 'image/jpeg', 'image/png'))) {
        // It's an image
        $code = resourcelib_embed_image($fullurl, $title);
    } else {
        if ($mimetype == 'audio/mp3') {
            // MP3 audio file
            $code = resourcelib_embed_mp3($fullurl, $title, $clicktoopen);
        } else {
            if ($mimetype == 'video/x-flv' or $extension === 'f4v') {
                // Flash video file
                $code = resourcelib_embed_flashvideo($fullurl, $title, $clicktoopen);
            } else {
                if ($mimetype == 'application/x-shockwave-flash') {
                    // Flash file
                    $code = resourcelib_embed_flash($fullurl, $title, $clicktoopen);
                } else {
                    if (substr($mimetype, 0, 10) == 'video/x-ms') {
                        // Windows Media Player file
                        $code = resourcelib_embed_mediaplayer($fullurl, $title, $clicktoopen);
                    } else {
                        if ($mimetype == 'video/quicktime') {
                            // Quicktime file
                            $code = resourcelib_embed_quicktime($fullurl, $title, $clicktoopen);
                        } else {
                            if ($mimetype == 'video/mpeg') {
                                // Mpeg file
                                $code = resourcelib_embed_mpeg($fullurl, $title, $clicktoopen);
                            } else {
                                if ($mimetype == 'audio/x-pn-realaudio-plugin') {
                                    // RealMedia file
                                    $code = resourcelib_embed_real($fullurl, $title, $clicktoopen);
                                } else {
                                    // anything else - just try object tag enlarged as much as possible
                                    $code = resourcelib_embed_general($fullurl, $title, $clicktoopen, "text/html");
                                    //--------------------------------------------------------------------------
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    webex_print_header($url, $cm, $course);
    webex_print_heading($url, $cm, $course);
    echo $code;
    webex_print_intro($url, $cm, $course);
    echo $OUTPUT->footer();
    die;
}
Пример #2
0
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
require_course_login($course, true, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('mod/webex:view', $context);
add_to_log($course->id, 'webex', 'view', 'view.php?id=' . $cm->id, $url->id, $cm->id);
// Update 'viewed' state if required by completion system
$completion = new completion_info($course);
$completion->set_module_viewed($cm);
$PAGE->set_url('/mod/webex/view.php', array('id' => $cm->id));
// Make sure webex exists before generating output - some older sites may contain empty webexs
// Do not use PARAM_webex here, it is too strict and does not support general URIs!
$extwebex = trim($url->externalurl);
if (empty($extwebex) or $extwebex === 'http://') {
    webex_print_header($url, $cm, $course);
    webex_print_heading($url, $cm, $course);
    webex_print_intro($url, $cm, $course);
    notice(get_string('invalidstoredwebex', 'webex'), new moodle_url('/course/view.php', array('id' => $cm->course)));
    die;
}
unset($extwebex);
if ($redirect) {
    // coming from course page or webex index page,
    // the redirection is needed for completion tracking and logging
    $fullurl = webex_get_full_webex($url, $cm, $course);
    redirect(str_replace('&', '&', $fullurl));
}
switch (webex_get_final_display_type($url)) {
    case RESOURCELIB_DISPLAY_EMBED:
        webex_display_embed($url, $cm, $course);
        break;
    case RESOURCELIB_DISPLAY_FRAME: