• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP initialise_filepicker函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __construct

 public function __construct(stdClass $options)
 {
     global $CFG, $USER, $PAGE;
     require_once $CFG->dirroot . '/repository/lib.php';
     $defaults = array('accepted_types' => '*', 'return_types' => FILE_INTERNAL, 'env' => 'filepicker', 'client_id' => uniqid(), 'itemid' => 0, 'maxbytes' => -1, 'maxfiles' => 1, 'buttonname' => false);
     foreach ($defaults as $key => $value) {
         if (empty($options->{$key})) {
             $options->{$key} = $value;
         }
     }
     $options->currentfile = '';
     if (!empty($options->itemid)) {
         $fs = get_file_storage();
         $usercontext = get_context_instance(CONTEXT_USER, $USER->id);
         if (empty($options->filename)) {
             if ($files = $fs->get_area_files($usercontext->id, 'user', 'draft', $options->itemid, 'id DESC', false)) {
                 $file = reset($files);
             }
         } else {
             $file = $fs->get_file($usercontext->id, 'user', 'draft', $options->itemid, $options->filepath, $options->filename);
         }
         if (!empty($file)) {
             $options->currentfile = html_writer::link(moodle_url::make_draftfile_url($file->get_itemid(), $file->get_filepath(), $file->get_filename()), $file->get_filename());
         }
     }
     // initilise options, getting files in root path
     $this->options = initialise_filepicker($options);
     // copying other options
     foreach ($options as $name => $value) {
         if (!isset($this->options->{$name})) {
             $this->options->{$name} = $value;
         }
     }
 }
开发者ID:nigeldaley,项目名称:moodle,代码行数:34,代码来源:outputcomponents.php


示例2: display_add_field

    function display_add_field($recordid=0) {
        global $CFG, $DB, $OUTPUT, $PAGE;

        $text   = '';
        $format = 0;

        $str = '<div title="'.$this->field->description.'">';

        editors_head_setup();
        $options = $this->get_options();

        $itemid = $this->field->id;
        $field = 'field_'.$itemid;

        if ($recordid && $content = $DB->get_record('data_content', array('fieldid'=>$this->field->id, 'recordid'=>$recordid))){
            $format = $content->content1;
            $text = clean_text($content->content, $format);
            $text = file_prepare_draft_area($draftitemid, $this->context->id, 'mod_data', 'content', $content->id, $options, $text);
        } else {
            $draftitemid = file_get_unused_draft_itemid();
            if (can_use_html_editor()) {
                $format = FORMAT_HTML;
            } else {
                $format = FORMAT_PLAIN;
            }
        }

        // get filepicker info
        //
        $fpoptions = array();
        if ($options['maxfiles'] != 0 ) {
            $args = new stdClass();
            // need these three to filter repositories list
            $args->accepted_types = array('web_image');
            $args->return_types = (FILE_INTERNAL | FILE_EXTERNAL);
            $args->context = $this->context;
            $args->env = 'filepicker';
            // advimage plugin
            $image_options = initialise_filepicker($args);
            $image_options->context = $this->context;
            $image_options->client_id = uniqid();
            $image_options->maxbytes = $options['maxbytes'];
            $image_options->env = 'editor';
            $image_options->itemid = $draftitemid;

            // moodlemedia plugin
            $args->accepted_types = array('video', 'audio');
            $media_options = initialise_filepicker($args);
            $media_options->context = $this->context;
            $media_options->client_id = uniqid();
            $media_options->maxbytes  = $options['maxbytes'];
            $media_options->env = 'editor';
            $media_options->itemid = $draftitemid;

            // advlink plugin
            $args->accepted_types = '*';
            $link_options = initialise_filepicker($args);
            $link_options->context = $this->context;
            $link_options->client_id = uniqid();
            $link_options->maxbytes  = $options['maxbytes'];
            $link_options->env = 'editor';
            $link_options->itemid = $draftitemid;

            $fpoptions['image'] = $image_options;
            $fpoptions['media'] = $media_options;
            $fpoptions['link'] = $link_options;
        }

        $editor = editors_get_preferred_editor($format);
        $strformats = format_text_menu();
        $formats =  $editor->get_supported_formats();
        foreach ($formats as $fid) {
            $formats[$fid] = $strformats[$fid];
        }
        $editor->use_editor($field, $options, $fpoptions);
        $str .= '<input type="hidden" name="'.$field.'_itemid" value="'.$draftitemid.'" />';
        $str .= '<div><textarea id="'.$field.'" name="'.$field.'" rows="'.$this->field->param3.'" cols="'.$this->field->param2.'">'.s($text).'</textarea></div>';
        $str .= '<div><select name="'.$field.'_content1">';
        foreach ($formats as $key=>$desc) {
            $selected = ($format == $key) ? 'selected="selected"' : '';
            $str .= '<option value="'.s($key).'" '.$selected.'>'.$desc.'</option>';
        }
        $str .= '</select>';
        $str .= '</div>';

        $str .= '</div>';
        return $str;
    }
开发者ID:nicusX,项目名称:moodle,代码行数:88,代码来源:field.class.php


示例3: specific_filepicker_options

 /**
  * Get the options required to configure the filepicker for one of the editor
  * toolbar buttons.
  * @param mixed $acceptedtypes array of types of '*'.
  * @param int $draftitemid the draft area item id.
  * @param object $context the context.
  * @return object the required options.
  */
 protected function specific_filepicker_options($acceptedtypes, $draftitemid, $context)
 {
     $filepickeroptions = new stdClass();
     $filepickeroptions->accepted_types = $acceptedtypes;
     $filepickeroptions->return_types = FILE_INTERNAL | FILE_EXTERNAL;
     $filepickeroptions->context = $context;
     $filepickeroptions->env = 'filepicker';
     $options = initialise_filepicker($filepickeroptions);
     $options->context = $context;
     $options->client_id = uniqid();
     $options->env = 'editor';
     $options->itemid = $draftitemid;
     return $options;
 }
开发者ID:rama1712,项目名称:moodle,代码行数:22,代码来源:renderer.php


示例4: __construct

 /**
  * Constructor
  *
  * @param stdClass $options options for filemanager
  *   default options are:
  *       maxbytes=>-1,
  *       maxfiles=>-1,
  *       itemid=>0,
  *       subdirs=>false,
  *       client_id=>uniqid(),
  *       acepted_types=>'*',
  *       return_types=>FILE_INTERNAL,
  *       context=>$PAGE->context,
  *       author=>fullname($USER),
  *       licenses=>array build from $CFG->licenses,
  *       defaultlicense=>$CFG->sitedefaultlicense
  */
 public function __construct(stdClass $options)
 {
     global $CFG, $USER, $PAGE;
     require_once $CFG->dirroot . '/repository/lib.php';
     $defaults = array('maxbytes' => -1, 'maxfiles' => -1, 'itemid' => 0, 'subdirs' => 0, 'client_id' => uniqid(), 'accepted_types' => '*', 'return_types' => FILE_INTERNAL, 'context' => $PAGE->context, 'author' => fullname($USER), 'licenses' => array());
     if (!empty($CFG->licenses)) {
         $array = explode(',', $CFG->licenses);
         foreach ($array as $license) {
             $l = new stdClass();
             $l->shortname = $license;
             $l->fullname = get_string($license, 'license');
             $defaults['licenses'][] = $l;
         }
     }
     if (!empty($CFG->sitedefaultlicense)) {
         $defaults['defaultlicense'] = $CFG->sitedefaultlicense;
     }
     foreach ($defaults as $key => $value) {
         if (empty($options->{$key})) {
             $options->{$key} = $value;
         }
     }
     $fs = get_file_storage();
     // initilise options, getting files in root path
     $this->options = file_get_drafarea_files($options->itemid, '/');
     // calculate file count
     $usercontext = context_user::instance($USER->id);
     $files = $fs->get_area_files($usercontext->id, 'user', 'draft', $options->itemid, 'id', false);
     $filecount = count($files);
     $this->options->filecount = $filecount;
     // copying other options
     foreach ($options as $name => $value) {
         $this->options->{$name} = $value;
     }
     // calculate the maximum file size as minimum from what is specified in filepicker options,
     // course options, global configuration and php settings
     $coursebytes = $maxbytes = 0;
     list($context, $course, $cm) = get_context_info_array($this->options->context->id);
     if (is_object($course)) {
         $coursebytes = $course->maxbytes;
     }
     if (!empty($this->options->maxbytes) && $this->options->maxbytes > 0) {
         $maxbytes = $this->options->maxbytes;
     }
     $this->options->maxbytes = get_user_max_upload_file_size($context, $CFG->maxbytes, $coursebytes, $maxbytes);
     // building file picker options
     $params = new stdClass();
     $params->accepted_types = $options->accepted_types;
     $params->return_types = $options->return_types;
     $params->context = $options->context;
     $params->env = 'filemanager';
     $params->disable_types = !empty($options->disable_types) ? $options->disable_types : array();
     $filepicker_options = initialise_filepicker($params);
     $this->options->filepicker = $filepicker_options;
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:72,代码来源:filemanager.php


示例5: toHtml

    /**
     * Returns HTML for editor form element.
     *
     * @return string
     */
    function toHtml() {
        global $CFG, $PAGE, $OUTPUT;
        require_once($CFG->dirroot.'/repository/lib.php');

        if ($this->_flagFrozen) {
            return $this->getFrozenHtml();
        }

        $ctx = $this->_options['context'];

        $id           = $this->_attributes['id'];
        $elname       = $this->_attributes['name'];

        $subdirs      = $this->_options['subdirs'];
        $maxbytes     = $this->_options['maxbytes'];
        $areamaxbytes = $this->_options['areamaxbytes'];
        $maxfiles     = $this->_options['maxfiles'];
        $changeformat = $this->_options['changeformat']; // TO DO: implement as ajax calls

        $text         = $this->_values['text'];
        $format       = $this->_values['format'];
        $draftitemid  = $this->_values['itemid'];

        // security - never ever allow guest/not logged in user to upload anything
        if (isguestuser() or !isloggedin()) {
            $maxfiles = 0;
        }

        $str = $this->_getTabs();
        $str .= '<div>';

        $editor = editors_get_preferred_editor($format);
        $strformats = format_text_menu();
        $formats =  $editor->get_supported_formats();
        foreach ($formats as $fid) {
            $formats[$fid] = $strformats[$fid];
        }

        // get filepicker info
        //
        $fpoptions = array();
        if ($maxfiles != 0 ) {
            if (empty($draftitemid)) {
                // no existing area info provided - let's use fresh new draft area
                require_once("$CFG->libdir/filelib.php");
                $this->setValue(array('itemid'=>file_get_unused_draft_itemid()));
                $draftitemid = $this->_values['itemid'];
            }

            $args = new stdClass();
            // need these three to filter repositories list
            $args->accepted_types = array('web_image');
            $args->return_types = $this->_options['return_types'];
            $args->context = $ctx;
            $args->env = 'filepicker';
            // advimage plugin
            $image_options = initialise_filepicker($args);
            $image_options->context = $ctx;
            $image_options->client_id = uniqid();
            $image_options->maxbytes = $this->_options['maxbytes'];
            $image_options->areamaxbytes = $this->_options['areamaxbytes'];
            $image_options->env = 'editor';
            $image_options->itemid = $draftitemid;

            // moodlemedia plugin
            $args->accepted_types = array('video', 'audio');
            $media_options = initialise_filepicker($args);
            $media_options->context = $ctx;
            $media_options->client_id = uniqid();
            $media_options->maxbytes  = $this->_options['maxbytes'];
            $media_options->areamaxbytes  = $this->_options['areamaxbytes'];
            $media_options->env = 'editor';
            $media_options->itemid = $draftitemid;

            // advlink plugin
            $args->accepted_types = '*';
            $link_options = initialise_filepicker($args);
            $link_options->context = $ctx;
            $link_options->client_id = uniqid();
            $link_options->maxbytes  = $this->_options['maxbytes'];
            $link_options->areamaxbytes  = $this->_options['areamaxbytes'];
            $link_options->env = 'editor';
            $link_options->itemid = $draftitemid;

            $args->accepted_types = array('.vtt');
            $subtitle_options = initialise_filepicker($args);
            $subtitle_options->context = $ctx;
            $subtitle_options->client_id = uniqid();
            $subtitle_options->maxbytes  = $this->_options['maxbytes'];
            $subtitle_options->areamaxbytes  = $this->_options['areamaxbytes'];
            $subtitle_options->env = 'editor';
            $subtitle_options->itemid = $draftitemid;

            $fpoptions['image'] = $image_options;
            $fpoptions['media'] = $media_options;
//.........这里部分代码省略.........
开发者ID:EsdrasCaleb,项目名称:moodle,代码行数:101,代码来源:editor.php


示例6: toHtml

 function toHtml()
 {
     global $CFG, $PAGE;
     require_once $CFG->dirroot . '/repository/lib.php';
     if ($this->_flagFrozen) {
         return $this->getFrozenHtml();
     }
     $ctx = $this->_options['context'];
     $id = $this->_attributes['id'];
     $elname = $this->_attributes['name'];
     $subdirs = $this->_options['subdirs'];
     $maxbytes = $this->_options['maxbytes'];
     $maxfiles = $this->_options['maxfiles'];
     $changeformat = $this->_options['changeformat'];
     // TO DO: implement as ajax calls
     $text = $this->_values['text'];
     $format = $this->_values['format'];
     $draftitemid = $this->_values['itemid'];
     // security - never ever allow guest/not logged in user to upload anything
     if (isguestuser() or !isloggedin()) {
         $maxfiles = 0;
     }
     $str = $this->_getTabs();
     $str .= '<div>';
     $editor = editors_get_preferred_editor($format);
     $strformats = format_text_menu();
     $formats = $editor->get_supported_formats();
     foreach ($formats as $fid) {
         $formats[$fid] = $strformats[$fid];
     }
     // get filepicker info
     //
     $fpoptions = array();
     if ($maxfiles != 0) {
         if (empty($draftitemid)) {
             // no existing area info provided - let's use fresh new draft area
             require_once "{$CFG->libdir}/filelib.php";
             $this->setValue(array('itemid' => file_get_unused_draft_itemid()));
             $draftitemid = $this->_values['itemid'];
         }
         $args = new stdClass();
         // need these three to filter repositories list
         $args->accepted_types = array('image');
         $args->return_types = FILE_INTERNAL | FILE_EXTERNAL;
         $args->context = $ctx;
         $args->env = 'filepicker';
         // advimage plugin
         $image_options = initialise_filepicker($args);
         $image_options->context = $ctx;
         $image_options->client_id = uniqid();
         $image_options->maxbytes = $this->_options['maxbytes'];
         $image_options->env = 'editor';
         $image_options->itemid = $draftitemid;
         // moodlemedia plugin
         $args->accepted_types = array('video', 'audio');
         $media_options = initialise_filepicker($args);
         $media_options->context = $ctx;
         $media_options->client_id = uniqid();
         $media_options->maxbytes = $this->_options['maxbytes'];
         $media_options->env = 'editor';
         $media_options->itemid = $draftitemid;
         // advlink plugin
         $args->accepted_types = '*';
         $link_options = initialise_filepicker($args);
         $link_options->context = $ctx;
         $link_options->client_id = uniqid();
         $link_options->maxbytes = $this->_options['maxbytes'];
         $link_options->env = 'editor';
         $link_options->itemid = $draftitemid;
         $fpoptions['image'] = $image_options;
         $fpoptions['media'] = $media_options;
         $fpoptions['link'] = $link_options;
     }
     //If editor is required and tinymce, then set required_tinymce option to initalize tinymce validation.
     if ($editor instanceof tinymce_texteditor && !is_null($this->getAttribute('onchange'))) {
         $this->_options['required'] = true;
     }
     /// print text area - TODO: add on-the-fly switching, size configuration, etc.
     $editor->use_editor($id, $this->_options, $fpoptions);
     $rows = empty($this->_attributes['rows']) ? 15 : $this->_attributes['rows'];
     $cols = empty($this->_attributes['cols']) ? 80 : $this->_attributes['cols'];
     //Apply editor validation if required field
     $editorrules = '';
     if (!is_null($this->getAttribute('onblur')) && !is_null($this->getAttribute('onchange'))) {
         $editorrules = 'onblur="' . htmlspecialchars($this->getAttribute('onblur')) . '" onchange="' . htmlspecialchars($this->getAttribute('onchange')) . '"';
     }
     $str .= '<div><textarea id="' . $id . '" name="' . $elname . '[text]" rows="' . $rows . '" cols="' . $cols . '"' . $editorrules . '>';
     $str .= s($text);
     $str .= '</textarea></div>';
     $str .= '<div>';
     if (count($formats) > 1) {
         $str .= html_writer::select($formats, $elname . '[format]', $format, false);
     } else {
         $str .= html_writer::empty_tag('input', array('name' => $elname . '[format]', 'type' => 'hidden', 'value' => array_pop(array_keys($formats))));
     }
     $str .= '</div>';
     // during moodle installation, user area doesn't exist
     // so we need to disable filepicker here.
     if (!during_initial_install() && empty($CFG->adminsetuppending)) {
         // 0 means no files, -1 unlimited
//.........这里部分代码省略.........
开发者ID:nigeldaley,项目名称:moodle,代码行数:101,代码来源:editor.php


示例7: output_html

    /**
     * Returns an XHTML string for the editor
     *
     * @param string $data
     * @param string $query
     * @return string XHTML string for the editor
     */
    public function output_html($data, $query='') {
        global $USER;

        $default = $this->get_defaultsetting();

        $defaultinfo = $default;
        if (!is_null($default) and $default !== '') {
            $defaultinfo = "\n".$default;
        }

        $ctx = context_user::instance($USER->id);
        $editor = editors_get_preferred_editor(FORMAT_HTML);
        $options = $this->get_options();
        $draftitemid = file_get_unused_draft_itemid();
        $component = is_null($this->plugin) ? 'core' : $this->plugin;
        $data = file_prepare_draft_area($draftitemid, $options['context']->id,
                                        $component, $this->get_full_name().'_draftitemid',
                                        $draftitemid, $options, $data);

        $fpoptions = array();
        $args = new stdClass();

        // Need these three to filter repositories list.
        $args->accepted_types = array('web_image');
        $args->return_types = $options['return_types'];
        $args->context = $ctx;
        $args->env = 'filepicker';

        // Advimage plugin.
        $imageoptions = initialise_filepicker($args);
        $imageoptions->context = $ctx;
        $imageoptions->client_id = uniqid();
        $imageoptions->maxbytes = $options['maxbytes'];
        $imageoptions->areamaxbytes = $options['areamaxbytes'];
        $imageoptions->env = 'editor';
        $imageoptions->itemid = $draftitemid;

        // Moodlemedia plugin.
        $args->accepted_types = array('video', 'audio');
        $mediaoptions = initialise_filepicker($args);
        $mediaoptions->context = $ctx;
        $mediaoptions->client_id = uniqid();
        $mediaoptions->maxbytes  = $options['maxbytes'];
        $mediaoptions->areamaxbytes  = $options['areamaxbytes'];
        $mediaoptions->env = 'editor';
        $mediaoptions->itemid = $draftitemid;

        // Advlink plugin.
        $args->accepted_types = '*';
        $linkoptions = initialise_filepicker($args);
        $linkoptions->context = $ctx;
        $linkoptions->client_id = uniqid();
        $linkoptions->maxbytes  = $options['maxbytes'];
        $linkoptions->areamaxbytes  = $options['areamaxbytes'];
        $linkoptions->env = 'editor';
        $linkoptions->itemid = $draftitemid;

        $fpoptions['image'] = $imageoptions;
        $fpoptions['media'] = $mediaoptions;
        $fpoptions['link'] = $linkoptions;

        $editor->use_editor($this->get_id(), $options, $fpoptions);

        return format_admin_setting($this, $this->visiblename,
        '<div class="form-textarea">
         <textarea rows="'. $this->rows .'" cols="'. $this->cols .'" id="'. $this->get_id() .'" name="'.$this->get_full_name()
         .'"spellcheck="true">'. s($data) .'
         </textarea>
         </div>
        <input value="'.$draftitemid.'" name="'.$this->get_full_name().'_draftitemid" type="hidden" />',
        $this->description, true, '', $defaultinfo, $query);
    }
开发者ID:educacionbe,项目名称:campus,代码行数:79,代码来源:admin_confightmleditor.php


示例8: get_filepicker_options

 public static function get_filepicker_options($context, $draftitemid, $maxbytes)
 {
     // common filepicker arguments
     $args = (object) array('return_types' => FILE_INTERNAL | FILE_EXTERNAL, 'context' => $context, 'env' => 'filepicker');
     // advimage plugin
     $args->accepted_types = array('web_image');
     $image_options = initialise_filepicker($args);
     $image_options->context = $context;
     $image_options->client_id = uniqid();
     $image_options->maxbytes = $maxbytes;
     $image_options->env = 'editor';
     $image_options->itemid = $draftitemid;
     // moodlemedia plugin
     $args->accepted_types = array('video', 'audio');
     $media_options = initialise_filepicker($args);
     $media_options->context = $context;
     $media_options->client_id = uniqid();
     $media_options->maxbytes = $maxbytes;
     $media_options->env = 'editor';
     $media_options->itemid = $draftitemid;
     // advlink plugin
     $args->accepted_types = '*';
     $link_options = initialise_filepicker($args);
     $link_options->context = $context;
     $link_options->client_id = uniqid();
     $link_options->maxbytes = $maxbytes;
     $link_options->env = 'editor';
     $link_options->itemid = $draftitemid;
     return array('image' => $image_options, 'media' => $media_options, 'link' => $link_options);
 }
开发者ID:gbateson,项目名称:moodle-datafield_admin,代码行数:30,代码来源:field.class.php


示例9: display_add_field

    function display_add_field($recordid = 0, $formdata = null) {
        global $CFG, $DB, $OUTPUT, $PAGE;

        $text   = '';
        $format = 0;
        $str = '<div title="' . s($this->field->description) . '">';
        $str .= '<label for="field_' . $this->field->id . '" class="accesshide">';
        $str .= html_writer::span($this->field->name);
        if ($this->field->required) {
            $image = html_writer::img($OUTPUT->pix_url('req'), get_string('requiredelement', 'form'),
                                     array('class' => 'req', 'title' => get_string('requiredelement', 'form')));
            $str .= html_writer::div($image, 'inline-req');
        }
        $str .= '</label>';

        editors_head_setup();
        $options = $this->get_options();

        $itemid = $this->field->id;
        $field = 'field_'.$itemid;

        if ($formdata) {
            $fieldname = 'field_' . $this->field->id . '_content1';
            if (isset($formdata->$fieldname)) {
                $format = $formdata->$fieldname;
            } else {
                $format = file_get_unused_draft_itemid();
            }
            $fieldname = 'field_' . $this->field->id . '_itemid';
            if (isset($formdata->$fieldname)) {
                $draftitemid = clean_param($formdata->$fieldname, PARAM_INT);
            } else {
                $draftitemid = file_get_unused_draft_itemid();
            }
            $fieldname = 'field_' . $this->field->id;
            if (isset($formdata->$fieldname)) {
                $text = $formdata->$fieldname;
            }
        } else if ($recordid &&
                   $content = $DB->get_record('data_content', array('fieldid' => $this->field->id, 'recordid' => $recordid))) {
            $format = $content->content1;
            $text = clean_text($content->content, $format);
            $text = file_prepare_draft_area($draftitemid, $this->context->id, 'mod_data', 'content', $content->id, $options, $text);
        } else {
            $draftitemid = file_get_unused_draft_itemid();
            $format = FORMAT_HTML;
        }

        // get filepicker info
        //
        $fpoptions = array();
        if ($options['maxfiles'] != 0 ) {
            $args = new stdClass();
            // need these three to filter repositories list
            $args->accepted_types = array('web_image');
            $args->return_types = (FILE_INTERNAL | FILE_EXTERNAL);
            $args->context = $this->context;
            $args->env = 'filepicker';
            // advimage plugin
            $image_options = initialise_filepicker($args);
            $image_options->context = $this->context;
            $image_options->client_id = uniqid();
            $image_options->maxbytes = $options['maxbytes'];
            $image_options->env = 'editor';
            $image_options->itemid = $draftitemid;

            // moodlemedia plugin
            $args->accepted_types = array('video', 'audio');
            $media_options = initialise_filepicker($args);
            $media_options->context = $this->context;
            $media_options->client_id = uniqid();
            $media_options->maxbytes  = $options['maxbytes'];
            $media_options->env = 'editor';
            $media_options->itemid = $draftitemid;

            // advlink plugin
            $args->accepted_types = '*';
            $link_options = initialise_filepicker($args);
            $link_options->context = $this->context;
            $link_options->client_id = uniqid();
            $link_options->maxbytes  = $options['maxbytes'];
            $link_options->env = 'editor';
            $link_options->itemid = $draftitemid;

            $fpoptions['image'] = $image_options;
            $fpoptions['media'] = $media_options;
            $fpoptions['link'] = $link_options;
        }

        $editor = editors_get_preferred_editor($format);
        $strformats = format_text_menu();
        $formats =  $editor->get_supported_formats();
        foreach ($formats as $fid) {
            $formats[$fid] = $strformats[$fid];
        }
        $editor->set_text($text);
        $editor->use_editor($field, $options, $fpoptions);
        $str .= '<input type="hidden" name="'.$field.'_itemid" value="'.s($draftitemid).'" />';
        $str .= '<div class="mod-data-input">';
        $str .= '<div><textarea id="'.$field.'" name="'.$field.'" rows="'.$this->field->param3.'" cols="'.$this->field->param2.'" spellcheck="true">'.s($text).'</textarea></div>';
//.........这里部分代码省略.........
开发者ID:EsdrasCaleb,项目名称:moodle,代码行数:101,代码来源:field.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP initialise_fullme_cli函数代码示例发布时间:2022-05-15
下一篇:
PHP initialise_cfg函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap