当前位置: 首页>>代码示例>>PHP>>正文


PHP resourcelib_embed_general函数代码示例

本文整理汇总了PHP中resourcelib_embed_general函数的典型用法代码示例。如果您正苦于以下问题:PHP resourcelib_embed_general函数的具体用法?PHP resourcelib_embed_general怎么用?PHP resourcelib_embed_general使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了resourcelib_embed_general函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: resource_display_embed

/**
 * Display embedded resource file.
 * @param object $resource
 * @param object $cm
 * @param object $course
 * @param stored_file $file main file
 * @return does not return
 */
function resource_display_embed($resource, $cm, $course, $file)
{
    global $CFG, $PAGE, $OUTPUT;
    $extra = 'target="_blank"';
    $clicktoopen = resource_get_clicktoopen($file, $resource->revision, $extra);
    $context = context_module::instance($cm->id);
    $path = '/' . $context->id . '/mod_resource/content/' . $resource->revision . $file->get_filepath() . $file->get_filename();
    $fullurl = file_encode_url($CFG->wwwroot . '/pluginfile.php', $path, false);
    $moodleurl = new moodle_url('/pluginfile.php' . $path);
    $mimetype = $file->get_mimetype();
    $title = $resource->name;
    $extension = resourcelib_get_extension($file->get_filename());
    $mediarenderer = $PAGE->get_renderer('core', 'media');
    $embedoptions = array(core_media::OPTION_TRUSTED => true, core_media::OPTION_BLOCK => true);
    if (file_mimetype_in_typegroup($mimetype, 'web_image')) {
        // It's an image
        $code = resourcelib_embed_image($fullurl, $title);
    } else {
        if ($mimetype === 'application/pdf') {
            // PDF document
            $code = resourcelib_embed_pdf($fullurl, $title, $clicktoopen);
        } else {
            if ($mediarenderer->can_embed_url($moodleurl, $embedoptions)) {
                // Media (audio/video) file.
                $code = $mediarenderer->embed_url($moodleurl, $title, 0, 0, $embedoptions);
            } else {
                // anything else - just try object tag enlarged as much as possible
                $code = resourcelib_embed_general($fullurl, $title, $clicktoopen, $mimetype);
            }
        }
    }
    resource_print_header($resource, $cm, $course);
    resource_print_heading($resource, $cm, $course);
    echo $code;
    resource_print_intro($resource, $cm, $course);
    echo $OUTPUT->footer();
    die;
}
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:46,代码来源:locallib.php

示例2: url_display_embed

/**
 * Display embedded url file.
 * @param object $url
 * @param object $cm
 * @param object $course
 * @return does not return
 */
function url_display_embed($url, $cm, $course)
{
    global $CFG, $PAGE, $OUTPUT;
    $mimetype = resourcelib_guess_url_mimetype($url->externalurl);
    $fullurl = url_get_full_url($url, $cm, $course);
    $title = $url->name;
    $link = html_writer::tag('a', $fullurl, array('href' => str_replace('&', '&', $fullurl)));
    $clicktoopen = get_string('clicktoopen', 'url', $link);
    $moodleurl = new moodle_url($fullurl);
    $extension = resourcelib_get_extension($url->externalurl);
    $mediamanager = core_media_manager::instance();
    $embedoptions = array(core_media_manager::OPTION_TRUSTED => true, core_media_manager::OPTION_BLOCK => true);
    if (in_array($mimetype, array('image/gif', 'image/jpeg', 'image/png'))) {
        // It's an image
        $code = resourcelib_embed_image($fullurl, $title);
    } else {
        if ($mediamanager->can_embed_url($moodleurl, $embedoptions)) {
            // Media (audio/video) file.
            $code = $mediamanager->embed_url($moodleurl, $title, 0, 0, $embedoptions);
        } else {
            // anything else - just try object tag enlarged as much as possible
            $code = resourcelib_embed_general($fullurl, $title, $clicktoopen, $mimetype);
        }
    }
    url_print_header($url, $cm, $course);
    url_print_heading($url, $cm, $course);
    echo $code;
    url_print_intro($url, $cm, $course);
    echo $OUTPUT->footer();
    die;
}
开发者ID:lucaboesch,项目名称:moodle,代码行数:38,代码来源:locallib.php

示例3: lesson_get_media_html

/**
 * This is a function used to detect media types and generate html code.
 *
 * @global object $CFG
 * @global object $PAGE
 * @param object $lesson
 * @param object $context
 * @return string $code the html code of media
 */
function lesson_get_media_html($lesson, $context)
{
    global $CFG, $PAGE, $OUTPUT;
    require_once "{$CFG->libdir}/resourcelib.php";
    // get the media file link
    if (strpos($lesson->mediafile, '://') !== false) {
        $url = new moodle_url($lesson->mediafile);
    } else {
        // the timemodified is used to prevent caching problems, instead of '/' we should better read from files table and use sortorder
        $url = moodle_url::make_pluginfile_url($context->id, 'mod_lesson', 'mediafile', $lesson->timemodified, '/', ltrim($lesson->mediafile, '/'));
    }
    $title = $lesson->mediafile;
    $clicktoopen = html_writer::link($url, get_string('download'));
    $mimetype = resourcelib_guess_url_mimetype($url);
    $extension = resourcelib_get_extension($url->out(false));
    $mediarenderer = $PAGE->get_renderer('core', 'media');
    $embedoptions = array(core_media::OPTION_TRUSTED => true, core_media::OPTION_BLOCK => true);
    // find the correct type and print it out
    if (in_array($mimetype, array('image/gif', 'image/jpeg', 'image/png'))) {
        // It's an image
        $code = resourcelib_embed_image($url, $title);
    } else {
        if ($mediarenderer->can_embed_url($url, $embedoptions)) {
            // Media (audio/video) file.
            $code = $mediarenderer->embed_url($url, $title, 0, 0, $embedoptions);
        } else {
            // anything else - just try object tag enlarged as much as possible
            $code = resourcelib_embed_general($url, $title, $clicktoopen, $mimetype);
        }
    }
    return $code;
}
开发者ID:nikitskynikita,项目名称:moodle,代码行数:41,代码来源:locallib.php

示例4: mediaelementjs_display_embed

/**
 * Display embedded url file.
 * @param object $url
 * @param object $cm
 * @param object $course
 * @param stored_file $file main file
 * @return does not return
 */
function mediaelementjs_display_embed($url, $cm, $course)
{
    global $CFG, $PAGE, $OUTPUT;
    $mimetype = resourcelib_guess_url_mimetype($url->externalurl);
    $cloud_storage_mimetype = mediaelementjs_guess_cloud_storage_mimetype($url->externalurl);
    if ($cloud_storage_mimetype) {
        $mimetype = $cloud_storage_mimetype;
    }
    $fullurl = mediaelementjs_get_full_url($url, $cm, $course);
    $title = $url->name;
    $link = html_writer::tag('a', $fullurl, array('href' => str_replace('&', '&', $fullurl)));
    $clicktoopen = get_string('clicktoopen', 'mediaelementjs', $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' || $mimetype == 'audio/x-pn-realaudio-plugin') {
            // MP3 audio file
            $code = GcrFileLib::getAudioEmbedHtml($fullurl, $mimetype);
        } else {
            if ($mimetype == 'application/x-shockwave-flash') {
                // Flash file
                $code = resourcelib_embed_flash($fullurl, $title, $clicktoopen);
            } else {
                if ($mimetype == 'video/x-ms' || $mimetype == 'video/mpeg' || $mimetype == 'video/quicktime' || $mimetype == 'video/webm' || $mimetype == 'video/ogv' || $mimetype == 'video/ogg' || $mimetype == 'video/mp4') {
                    $code = GcrFileLib::getVideoEmbedHtml($fullurl, '100%', '100%', $mimetype);
                } else {
                    // anything else - just try object tag enlarged as much as possible
                    $code = resourcelib_embed_general($fullurl, $title, $clicktoopen, $mimetype);
                }
            }
        }
    }
    mediaelementjs_print_header($url, $cm, $course);
    mediaelementjs_print_heading($url, $cm, $course);
    echo $code;
    mediaelementjs_print_intro($url, $cm, $course);
    echo $OUTPUT->footer();
    die;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:49,代码来源:locallib.php

示例5: url_display_embed

/**
 * Display embedded url file.
 * @param object $url
 * @param object $cm
 * @param object $course
 * @param stored_file $file main file
 * @return does not return
 */
function url_display_embed($url, $cm, $course)
{
    global $CFG, $PAGE, $OUTPUT;
    $mimetype = resourcelib_guess_url_mimetype($url->externalurl);
    $fullurl = url_get_full_url($url, $cm, $course);
    $title = $url->name;
    $link = html_writer::tag('a', $fullurl, array('href' => str_replace('&', '&', $fullurl)));
    $clicktoopen = get_string('clicktoopen', 'url', $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, $mimetype);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    url_print_header($url, $cm, $course);
    url_print_heading($url, $cm, $course);
    echo $code;
    url_print_intro($url, $cm, $course);
    echo $OUTPUT->footer();
    die;
}
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:66,代码来源:locallib.php

示例6: lesson_get_media_html

/**
 * This is a function used to detect media types and generate html code.
 *
 * @global object $CFG
 * @global object $PAGE
 * @param object $lesson
 * @param object $context
 * @return string $code the html code of media
 */
function lesson_get_media_html($lesson, $context)
{
    global $CFG, $PAGE, $OUTPUT;
    require_once "{$CFG->libdir}/resourcelib.php";
    // get the media file link
    if (strpos($lesson->mediafile, '://') !== false) {
        $url = new moodle_url($lesson->mediafile);
    } else {
        // the timemodified is used to prevent caching problems, instead of '/' we should better read from files table and use sortorder
        $url = moodle_url::make_pluginfile_url($context->id, 'mod_lesson', 'mediafile', $lesson->timemodified, '/', ltrim($lesson->mediafile, '/'));
    }
    $title = $lesson->mediafile;
    $clicktoopen = html_writer::link($url, get_string('download'));
    $mimetype = resourcelib_guess_url_mimetype($url);
    $extension = resourcelib_get_extension($url->out(false));
    // find the correct type and print it out
    if (in_array($mimetype, array('image/gif', 'image/jpeg', 'image/png'))) {
        // It's an image
        $code = resourcelib_embed_image($url, $title);
    } else {
        if ($mimetype == 'audio/mp3') {
            // MP3 audio file
            $code = resourcelib_embed_mp3($url, $title, $clicktoopen);
        } else {
            if ($mimetype == 'video/x-flv' or $extension === 'f4v') {
                // Flash video file
                $code = resourcelib_embed_flashvideo($url, $title, $clicktoopen);
            } else {
                if ($mimetype == 'application/x-shockwave-flash') {
                    // Flash file
                    $code = resourcelib_embed_flash($url, $title, $clicktoopen);
                } else {
                    if (substr($mimetype, 0, 10) == 'video/x-ms') {
                        // Windows Media Player file
                        $code = resourcelib_embed_mediaplayer($url, $title, $clicktoopen);
                    } else {
                        if ($mimetype == 'video/quicktime') {
                            // Quicktime file
                            $code = resourcelib_embed_quicktime($url, $title, $clicktoopen);
                        } else {
                            if ($mimetype == 'video/mpeg') {
                                // Mpeg file
                                $code = resourcelib_embed_mpeg($url, $title, $clicktoopen);
                            } else {
                                if ($mimetype == 'audio/x-pn-realaudio-plugin') {
                                    // RealMedia file
                                    $code = resourcelib_embed_real($url, $title, $clicktoopen);
                                } else {
                                    // anything else - just try object tag enlarged as much as possible
                                    $code = resourcelib_embed_general($url, $title, $clicktoopen, $mimetype);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return $code;
}
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:69,代码来源:locallib.php

示例7: array

    if (!isguestuser()) {
        // Don't remember guests.
        $DB->set_field('user', 'policyagreed', 1, array('id' => $USER->id));
    }
    $USER->policyagreed = 1;
    unset($SESSION->wantsurl);
    redirect($return);
}
$strpolicyagree = get_string('policyagree');
$strpolicyagreement = get_string('policyagreement');
$strpolicyagreementclick = get_string('policyagreementclick');
$PAGE->set_context(context_system::instance());
$PAGE->set_title($strpolicyagreement);
$PAGE->set_heading($SITE->fullname);
$PAGE->navbar->add($strpolicyagreement);
echo $OUTPUT->header();
echo $OUTPUT->heading($strpolicyagreement);
$mimetype = mimeinfo('type', $sitepolicy);
if ($mimetype == 'document/unknown') {
    // Fallback for missing index.php, index.html.
    $mimetype = 'text/html';
}
// We can not use our popups here, because the url may be arbitrary, see MDL-9823.
$clicktoopen = '<a href="' . $sitepolicy . '" onclick="this.target=\'_blank\'">' . $strpolicyagreementclick . '</a>';
echo '<div class="noticebox">';
echo resourcelib_embed_general($sitepolicy, $strpolicyagreement, $clicktoopen, $mimetype);
echo '</div>';
$formcontinue = new single_button(new moodle_url('policy.php', array('agree' => 1)), get_string('yes'));
$formcancel = new single_button(new moodle_url($CFG->wwwroot . '/login/logout.php', array('agree' => 0)), get_string('no'));
echo $OUTPUT->confirm($strpolicyagree, $formcontinue, $formcancel);
echo $OUTPUT->footer();
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:policy.php

示例8: resource_display_embed

/**
 * Display embedded resource file.
 * @param object $resource
 * @param object $cm
 * @param object $course
 * @param stored_file $file main file
 * @return does not return
 */
function resource_display_embed($resource, $cm, $course, $file)
{
    global $CFG, $PAGE, $OUTPUT;
    $clicktoopen = resource_get_clicktoopen($file, $resource->revision);
    $context = get_context_instance(CONTEXT_MODULE, $cm->id);
    $path = '/' . $context->id . '/mod_resource/content/' . $resource->revision . $file->get_filepath() . $file->get_filename();
    $fullurl = file_encode_url($CFG->wwwroot . '/pluginfile.php', $path, false);
    $mimetype = $file->get_mimetype();
    $title = $resource->name;
    $extension = resourcelib_get_extension($file->get_filename());
    if (in_array($mimetype, array('image/gif', 'image/jpeg', 'image/png'))) {
        // It's an image
        $code = resourcelib_embed_image($fullurl, $title);
    } else {
        if ($mimetype === 'application/pdf') {
            // PDF document
            $code = resourcelib_embed_pdf($fullurl, $title, $clicktoopen);
        } 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') {
                                        // 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, $mimetype);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    resource_print_header($resource, $cm, $course);
    resource_print_heading($resource, $cm, $course);
    echo $code;
    resource_print_intro($resource, $cm, $course);
    echo $OUTPUT->footer();
    die;
}
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:72,代码来源:locallib.php

示例9: url_display_embed

/**
 * Display embedded url file.
 * @param object $url
 * @param object $cm
 * @param object $course
 * @param stored_file $file main file
 * @return does not return
 */
function url_display_embed($url, $cm, $course)
{
    global $CFG, $PAGE;
    $clicktoopen = get_string('clicktoopen', 'url', $url->externalurl);
    $mimetype = resourcelib_guess_url_mimetype($url->externalurl);
    $fullurl = url_get_full_url($url, $cm, $course);
    $title = $url->name;
    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') {
                // 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') {
                                    // 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, $mimetype);
                                    $PAGE->requires->yui_lib('dom')->in_head();
                                    $PAGE->requires->js('mod/url/functions.js')->in_head();
                                    $PAGE->requires->js_function_call('url_init_object');
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    url_print_header($url, $cm, $course);
    url_print_heading($url, $cm, $course);
    echo $code;
    url_print_intro($url, $cm, $course);
    print_footer();
    die;
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:67,代码来源:locallib.php


注:本文中的resourcelib_embed_general函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。