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


PHP dndupload_add_to_course函数代码示例

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


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

示例1: include_course_ajax

/**
 * Include the relevant javascript and language strings for the resource
 * toolbox YUI module
 *
 * @param integer $id The ID of the course being applied to
 * @param array $usedmodules An array containing the names of the modules in use on the page
 * @param array $enabledmodules An array containing the names of the enabled (visible) modules on this site
 * @param stdClass $config An object containing configuration parameters for ajax modules including:
 *          * resourceurl   The URL to post changes to for resource changes
 *          * sectionurl    The URL to post changes to for section changes
 *          * pageparams    Additional parameters to pass through in the post
 * @return bool
 */
function include_course_ajax($course, $usedmodules = array(), $enabledmodules = null, $config = null)
{
    global $CFG, $PAGE, $SITE;
    // Ensure that ajax should be included
    if (!course_ajax_enabled($course)) {
        return false;
    }
    if (!$config) {
        $config = new stdClass();
    }
    // The URL to use for resource changes
    if (!isset($config->resourceurl)) {
        $config->resourceurl = '/course/rest.php';
    }
    // The URL to use for section changes
    if (!isset($config->sectionurl)) {
        $config->sectionurl = '/course/rest.php';
    }
    // Any additional parameters which need to be included on page submission
    if (!isset($config->pageparams)) {
        $config->pageparams = array();
    }
    // Include toolboxes
    $PAGE->requires->yui_module('moodle-course-toolboxes', 'M.course.init_resource_toolbox', array(array('courseid' => $course->id, 'ajaxurl' => $config->resourceurl, 'config' => $config)));
    $PAGE->requires->yui_module('moodle-course-toolboxes', 'M.course.init_section_toolbox', array(array('courseid' => $course->id, 'format' => $course->format, 'ajaxurl' => $config->sectionurl, 'config' => $config)));
    // Include course dragdrop
    if (course_format_uses_sections($course->format)) {
        $PAGE->requires->yui_module('moodle-course-dragdrop', 'M.course.init_section_dragdrop', array(array('courseid' => $course->id, 'ajaxurl' => $config->sectionurl, 'config' => $config)), null, true);
        $PAGE->requires->yui_module('moodle-course-dragdrop', 'M.course.init_resource_dragdrop', array(array('courseid' => $course->id, 'ajaxurl' => $config->resourceurl, 'config' => $config)), null, true);
    }
    // Require various strings for the command toolbox
    $PAGE->requires->strings_for_js(array('moveleft', 'deletechecktype', 'deletechecktypename', 'edittitle', 'edittitleinstructions', 'show', 'hide', 'groupsnone', 'groupsvisible', 'groupsseparate', 'clicktochangeinbrackets', 'markthistopic', 'markedthistopic', 'movesection', 'movecoursemodule', 'movecoursesection', 'movecontent', 'tocontent', 'emptydragdropregion', 'afterresource', 'aftersection', 'totopofsection'), 'moodle');
    // Include section-specific strings for formats which support sections.
    if (course_format_uses_sections($course->format)) {
        $PAGE->requires->strings_for_js(array('showfromothers', 'hidefromothers'), 'format_' . $course->format);
    }
    // For confirming resource deletion we need the name of the module in question
    foreach ($usedmodules as $module => $modname) {
        $PAGE->requires->string_for_js('pluginname', $module);
    }
    // Load drag and drop upload AJAX.
    require_once $CFG->dirroot . '/course/dnduploadlib.php';
    dndupload_add_to_course($course, $enabledmodules);
    return true;
}
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:58,代码来源:lib.php

示例2: include_course_ajax

/**
 * Include the relevant javascript and language strings for the resource
 * toolbox YUI module
 *
 * @param integer $id The ID of the course being applied to
 * @param array $usedmodules An array containing the names of the modules in use on the page
 * @param array $enabledmodules An array containing the names of the enabled (visible) modules on this site
 * @param stdClass $config An object containing configuration parameters for ajax modules including:
 *          * resourceurl   The URL to post changes to for resource changes
 *          * sectionurl    The URL to post changes to for section changes
 *          * pageparams    Additional parameters to pass through in the post
 * @return bool
 */
function include_course_ajax($course, $usedmodules = array(), $enabledmodules = null, $config = null)
{
    global $PAGE, $SITE;
    // Ensure that ajax should be included
    if (!course_ajax_enabled($course)) {
        return false;
    }
    if (!$config) {
        $config = new stdClass();
    }
    // The URL to use for resource changes
    if (!isset($config->resourceurl)) {
        $config->resourceurl = '/course/rest.php';
    }
    // The URL to use for section changes
    if (!isset($config->sectionurl)) {
        $config->sectionurl = '/course/rest.php';
    }
    // Any additional parameters which need to be included on page submission
    if (!isset($config->pageparams)) {
        $config->pageparams = array();
    }
    // Include toolboxes
    $PAGE->requires->yui_module('moodle-course-toolboxes', 'M.course.init_resource_toolbox', array(array('courseid' => $course->id, 'ajaxurl' => $config->resourceurl, 'config' => $config)));
    $PAGE->requires->yui_module('moodle-course-toolboxes', 'M.course.init_section_toolbox', array(array('courseid' => $course->id, 'format' => $course->format, 'ajaxurl' => $config->sectionurl, 'config' => $config)));
    // Include course dragdrop
    if ($course->id != $SITE->id) {
        $PAGE->requires->yui_module('moodle-course-dragdrop', 'M.course.init_section_dragdrop', array(array('courseid' => $course->id, 'ajaxurl' => $config->sectionurl, 'config' => $config)), null, true);
        $PAGE->requires->yui_module('moodle-course-dragdrop', 'M.course.init_resource_dragdrop', array(array('courseid' => $course->id, 'ajaxurl' => $config->resourceurl, 'config' => $config)), null, true);
    }
    // Include blocks dragdrop
    $params = array('courseid' => $course->id, 'pagetype' => $PAGE->pagetype, 'pagelayout' => $PAGE->pagelayout, 'regions' => $PAGE->blocks->get_regions());
    $PAGE->requires->yui_module('moodle-core-blocks', 'M.core_blocks.init_dragdrop', array($params), null, true);
    // Require various strings for the command toolbox
    $PAGE->requires->strings_for_js(array('moveleft', 'deletechecktype', 'deletechecktypename', 'edittitle', 'edittitleinstructions', 'show', 'hide', 'groupsnone', 'groupsvisible', 'groupsseparate', 'clicktochangeinbrackets', 'markthistopic', 'markedthistopic', 'move', 'movesection'), 'moodle');
    // Include format-specific strings
    if ($course->id != $SITE->id) {
        $PAGE->requires->strings_for_js(array('showfromothers', 'hidefromothers'), 'format_' . $course->format);
    }
    // For confirming resource deletion we need the name of the module in question
    foreach ($usedmodules as $module => $modname) {
        $PAGE->requires->string_for_js('pluginname', $module);
    }
    // Load drag and drop upload AJAX.
    dndupload_add_to_course($course, $enabledmodules);
    // Add the module chooser
    $PAGE->requires->yui_module('moodle-course-modchooser', 'M.course.init_chooser', array(array('courseid' => $course->id)));
    $PAGE->requires->strings_for_js(array('addresourceoractivity', 'modchooserenable', 'modchooserdisable'), 'moodle');
    return true;
}
开发者ID:nmicha,项目名称:moodle,代码行数:63,代码来源:lib.php


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