本文整理汇总了PHP中file_get_submitted_draft_itemid函数的典型用法代码示例。如果您正苦于以下问题:PHP file_get_submitted_draft_itemid函数的具体用法?PHP file_get_submitted_draft_itemid怎么用?PHP file_get_submitted_draft_itemid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了file_get_submitted_draft_itemid函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: set_data
function set_data($defaults)
{
if (empty($entry->id)) {
$entry = new stdClass();
$entry->id = null;
}
$draftitemid = file_get_submitted_draft_itemid('config_attachments');
file_prepare_draft_area($draftitemid, $this->block->context->id, 'block_slider', 'content', 0, array('subdirs' => true));
$entry->attachments = $draftitemid;
parent::set_data($defaults);
if ($data = parent::get_data()) {
file_save_draft_area_files($data->config_attachments, $this->block->context->id, 'block_slider', 'content', 0, array('subdirs' => true));
}
}
开发者ID:shinriyadi,项目名称:moodle,代码行数:14,代码来源:edit_form.php
示例2: data_preprocessing
protected function data_preprocessing($question)
{
$question = parent::data_preprocessing($question);
$question = $this->data_preprocessing_combined_feedback($question, true);
$question = $this->data_preprocessing_hints($question, true, true);
if (empty($question->options)) {
return $question;
}
$question->shuffleanswers = $question->options->shuffleanswers;
$key = 0;
foreach ($question->options->subquestions as $subquestion) {
$question->subanswers[$key] = $subquestion->answertext;
$draftid = file_get_submitted_draft_itemid('subquestions[' . $key . ']');
$question->subquestions[$key] = array();
$question->subquestions[$key]['text'] = file_prepare_draft_area($draftid, $this->context->id, 'qtype_ddmatch', 'subquestion', !empty($subquestion->id) ? (int) $subquestion->id : null, $this->fileoptions, $subquestion->questiontext);
$question->subquestions[$key]['format'] = $subquestion->questiontextformat;
$question->subquestions[$key]['itemid'] = $draftid;
$draftid = file_get_submitted_draft_itemid('subanswers[' . $key . ']');
$question->subanswers[$key] = array();
$question->subanswers[$key]['text'] = file_prepare_draft_area($draftid, $this->context->id, 'qtype_ddmatch', 'subanswer', !empty($subquestion->id) ? (int) $subquestion->id : null, $this->fileoptions, $subquestion->answertext);
$question->subanswers[$key]['format'] = $subquestion->answertextformat;
$question->subanswers[$key]['itemid'] = $draftid;
$key++;
}
return $question;
}
开发者ID:antoniorodrigues,项目名称:redes-digitais,代码行数:26,代码来源:edit_ddmatch_form.php
示例3: data_preprocessing
function data_preprocessing($question)
{
if (isset($question->options)) {
$answers = $question->options->answers;
$answers_ids = array();
if (count($answers)) {
$key = 0;
foreach ($answers as $answer) {
$answers_ids[] = $answer->id;
$default_values['answer[' . $key . ']'] = $answer->answer;
$default_values['fraction[' . $key . ']'] = $answer->fraction;
$default_values['feedback[' . $key . ']'] = array();
// prepare feedback editor to display files in draft area
$draftid_editor = file_get_submitted_draft_itemid('feedback[' . $key . ']');
$default_values['feedback[' . $key . ']']['text'] = file_prepare_draft_area($draftid_editor, $this->context->id, 'question', 'answerfeedback', !empty($answer->id) ? (int) $answer->id : null, $this->fileoptions, $answer->feedback);
$default_values['feedback[' . $key . ']']['itemid'] = $draftid_editor;
// prepare files code block ends
$default_values['feedback[' . $key . ']']['format'] = $answer->feedbackformat;
$key++;
}
}
$default_values['usecase'] = $question->options->usecase;
$question = (object) ((array) $question + $default_values);
}
return $question;
}
开发者ID:vuchannguyen,项目名称:web,代码行数:26,代码来源:edit_shortanswer_form.php
示例4: set_data
function set_data($question)
{
if (!empty($question->options->trueanswer)) {
$trueanswer = $question->options->answers[$question->options->trueanswer];
$draftid = file_get_submitted_draft_itemid('trueanswer');
$answerid = $question->options->trueanswer;
$text = $trueanswer->feedback;
$question->correctanswer = $trueanswer->fraction != 0;
$question->feedbacktrue = array();
$question->feedbacktrue['text'] = $trueanswer->feedback;
$question->feedbacktrue['format'] = $trueanswer->feedbackformat;
$question->feedbacktrue['text'] = file_prepare_draft_area($draftid, $this->context->id, 'question', 'answerfeedback', !empty($answerid) ? (int) $answerid : null, $this->fileoptions, $text);
$question->feedbacktrue['itemid'] = $draftid;
}
if (!empty($question->options->falseanswer)) {
$falseanswer = $question->options->answers[$question->options->falseanswer];
$draftid = file_get_submitted_draft_itemid('falseanswer');
$answerid = $question->options->falseanswer;
$text = $falseanswer->feedback;
$question->feedbackfalse = array();
$question->feedbackfalse['text'] = $falseanswer->feedback;
$question->feedbackfalse['format'] = $falseanswer->feedbackformat;
$question->feedbackfalse['text'] = file_prepare_draft_area($draftid, $this->context->id, 'question', 'answerfeedback', !empty($answerid) ? (int) $answerid : null, $this->fileoptions, $text);
$question->feedbackfalse['itemid'] = $draftid;
}
parent::set_data($question);
}
开发者ID:vuchannguyen,项目名称:web,代码行数:27,代码来源:edit_truefalse_form.php
示例5: data_preprocessing
protected function data_preprocessing($question)
{
$question = parent::data_preprocessing($question);
if (empty($question->options)) {
return $question;
}
$question->responseformat = $question->options->responseformat;
$question->responsefieldlines = $question->options->responsefieldlines;
$question->attachments = $question->options->attachments;
$question->boardsize = $question->options->boardsize;
//Set backimage details, and configure a draft area to accept any uploaded pictures
//all this and this whole method does, is to load existing files into a filearea
//so it is not called when creating a new question, only when editing an existing one
//best to use file_get_submitted_draft_itemid - because copying questions gets weird otherwise
//$draftitemid =$question->options->backimage;
$draftitemid = file_get_submitted_draft_itemid('backimage');
file_prepare_draft_area($draftitemid, $this->context->id, 'qtype_poodllrecording', 'backimage', !empty($question->id) ? (int) $question->id : null, array('subdirs' => 0, 'maxbytes' => 0, 'maxfiles' => 1));
$question->backimage = $draftitemid;
$draftid = file_get_submitted_draft_itemid('graderinfo');
$question->graderinfo = array();
$question->graderinfo['text'] = file_prepare_draft_area($draftid, $this->context->id, 'qtype_poodllrecording', 'graderinfo', !empty($question->id) ? (int) $question->id : null, $this->fileoptions, $question->options->graderinfo);
$question->graderinfo['format'] = $question->options->graderinfoformat;
$question->graderinfo['itemid'] = $draftid;
return $question;
}
开发者ID:laiello,项目名称:poodll.poodll2,代码行数:25,代码来源:edit_poodllrecording_form.php
示例6: set_data
function set_data($defaults)
{
if (!empty($this->block->config) && is_object($this->block->config)) {
$whatshot = $this->block->config->whatshot;
$draftid_editor = file_get_submitted_draft_itemid('config_whatshot');
if (empty($whatshot)) {
$currenttext = '';
} else {
$currenttext = $whatshot;
}
$defaults->config_whatshot['text'] = file_prepare_draft_area($draftid_editor, $this->block->context->id, 'block_dashboard', 'content', 0, array('subdirs' => true), $currenttext);
$defaults->config_whatshot['itemid'] = $draftid_editor;
$defaults->config_whatshot['format'] = $this->block->config->format;
} else {
$whatshot = '';
}
if (!$this->block->user_can_edit() && !empty($this->block->config->title)) {
// If a title has been set but the user cannot edit it format it nicely
$title = $this->block->config->title;
$defaults->config_title = format_string($title, true, $this->page->context);
// Remove the title from the config so that parent::set_data doesn't set it.
unset($this->block->config->title);
}
// have to delete text here, otherwise parent::set_data will empty content
// of editor
unset($this->block->config->whatshot);
parent::set_data($defaults);
// restore $text
$this->block->config->whatshot = $whatshot;
if (isset($title)) {
// Reset the preserved title
$this->block->config->title = $title;
}
}
开发者ID:rtsfc,项目名称:moodle-block_dashboard,代码行数:34,代码来源:edit_form.php
示例7: definition_appearance
/**
*
*/
protected function definition_appearance()
{
global $COURSE;
// We want to hide that when using the singleactivity course format because it is confusing.
if (!$this->courseformat->has_view_page()) {
return;
}
$mform =& $this->_form;
$mform->addElement('header', 'coursedisplayhdr', get_string('appearance'));
// Activity icon.
$options = array('subdirs' => 0, 'maxbytes' => $COURSE->maxbytes, 'maxfiles' => 1, 'accepted_types' => array('image'));
$draftitemid = file_get_submitted_draft_itemid('activityicon');
file_prepare_draft_area($draftitemid, $this->context->id, 'mod_dataform', 'activityicon', 0, $options);
$mform->addElement('filemanager', 'activityicon', get_string('activityicon', 'dataform'), null, $options);
$mform->setDefault('activityicon', $draftitemid);
$mform->addHelpButton('activityicon', 'activityicon', 'mod_dataform');
// Displayed view.
$options = array(0 => get_string('choosedots'));
if ($this->_instance) {
if ($views = mod_dataform_view_manager::instance($this->_instance)->views_menu) {
$options = $options + $views;
}
}
$mform->addElement('select', 'inlineview', get_string('inlineview', 'mod_dataform'), $options);
$mform->addHelpButton('inlineview', 'inlineview', 'mod_dataform');
// Embedded.
$mform->addElement('selectyesno', 'embedded', get_string('embedded', 'mod_dataform'));
$mform->addHelpButton('embedded', 'embedded', 'mod_dataform');
$mform->disabledIf('embedded', 'inlineview', 'eq', 0);
}
开发者ID:parksandwildlife,项目名称:learning,代码行数:33,代码来源:mod_form.php
示例8: data_preprocessing
public function data_preprocessing($question)
{
$question = parent::data_preprocessing($question);
$question = $this->data_preprocessing_combined_feedback($question, true);
$question = $this->data_preprocessing_hints($question, true, true);
$dragids = array();
// drag no -> dragid
if (!empty($question->options)) {
$question->shuffleanswers = $question->options->shuffleanswers;
$question->drags = array();
foreach ($question->options->drags as $drag) {
$dragindex = $drag->no - 1;
$question->drags[$dragindex] = array();
$question->drags[$dragindex]['draglabel'] = $drag->label;
$question->drags[$dragindex]['infinite'] = $drag->infinite;
$question->drags[$dragindex]['draggroup'] = $drag->draggroup;
$dragids[$dragindex] = $drag->id;
}
$question->drops = array();
foreach ($question->options->drops as $drop) {
$question->drops[$drop->no - 1] = array();
$question->drops[$drop->no - 1]['choice'] = $drop->choice;
$question->drops[$drop->no - 1]['droplabel'] = $drop->label;
$question->drops[$drop->no - 1]['xleft'] = $drop->xleft;
$question->drops[$drop->no - 1]['ytop'] = $drop->ytop;
}
}
//initialise file picker for bgimage
$draftitemid = file_get_submitted_draft_itemid('bgimage');
file_prepare_draft_area($draftitemid, $this->context->id, 'qtype_ddimageortext', 'bgimage', !empty($question->id) ? (int) $question->id : null, self::file_picker_options());
$question->bgimage = $draftitemid;
//initialise file picker for dragimages
list(, $imagerepeats) = $this->get_drag_item_repeats();
$draftitemids = optional_param_array('dragitem', array(), PARAM_INT);
for ($imageindex = 0; $imageindex < $imagerepeats; $imageindex++) {
$draftitemid = isset($draftitemids[$imageindex]) ? $draftitemids[$imageindex] : 0;
//numbers not allowed in filearea name
$itemid = isset($dragids[$imageindex]) ? $dragids[$imageindex] : null;
file_prepare_draft_area($draftitemid, $this->context->id, 'qtype_ddimageortext', 'dragimage', $itemid, self::file_picker_options());
$question->dragitem[$imageindex] = $draftitemid;
}
if (!empty($question->options)) {
foreach ($question->options->drags as $drag) {
$dragindex = $drag->no - 1;
if (!isset($question->dragitem[$dragindex])) {
$fileexists = false;
} else {
$fileexists = self::file_uploaded($question->dragitem[$dragindex]);
}
$labelexists = trim($question->drags[$dragindex]['draglabel']) != '';
if ($labelexists && !$fileexists) {
$question->dragitemtype[$dragindex] = 'word';
} else {
$question->dragitemtype[$dragindex] = 'image';
}
}
}
$this->js_call();
return $question;
}
开发者ID:ndunand,项目名称:moodle-qtype_ddimageortext,代码行数:60,代码来源:edit_ddimageortext_form.php
示例9: data_preprocessing
protected function data_preprocessing($question) {
$question = parent::data_preprocessing($question);
if (empty($question->options)) {
return $question;
}
$question->responseformat = $question->options->responseformat;
$question->responsefieldlines = $question->options->responsefieldlines;
$question->attachments = $question->options->attachments;
$draftid = file_get_submitted_draft_itemid('graderinfo');
$question->graderinfo = array();
$question->graderinfo['text'] = file_prepare_draft_area(
$draftid, // draftid
$this->context->id, // context
'qtype_essay', // component
'graderinfo', // filarea
!empty($question->id) ? (int) $question->id : null, // itemid
$this->fileoptions, // options
$question->options->graderinfo // text
);
$question->graderinfo['format'] = $question->options->graderinfoformat;
$question->graderinfo['itemid'] = $draftid;
$question->responselimitpolicy = $question->options->responselimitpolicy;
$question->wordlimit = $question->options->wordlimit;
$question->charlimit = $question->options->charlimit;
return $question;
}
开发者ID:nickkoeppen,项目名称:moodle,代码行数:30,代码来源:edit_essay_form.php
示例10: data_preprocessing
function data_preprocessing(&$default_values)
{
// Aaah.. we meet again h5pfile!
$draftitemid = file_get_submitted_draft_itemid('h5pfile');
file_prepare_draft_area($draftitemid, $this->context->id, 'mod_hvp', 'package', 0);
$default_values['h5pfile'] = $draftitemid;
}
开发者ID:brum1975,项目名称:h5p-moodle-plugin,代码行数:7,代码来源:mod_form.php
示例11: data_preprocessing
function data_preprocessing(&$default_values) {
if ($this->current->instance) {
// editing existing instance - copy existing files into draft area
$draftitemid = file_get_submitted_draft_itemid('files');
file_prepare_draft_area($draftitemid, $this->context->id, 'mod_folder', 'content', 0, array('subdirs'=>true));
$default_values['files'] = $draftitemid;
}
}
开发者ID:ncsu-delta,项目名称:moodle,代码行数:8,代码来源:mod_form.php
示例12: prepare_message_for_edit
public function prepare_message_for_edit($cm, $post)
{
$this->append_edited_by($post);
$context = \context_module::instance($cm->id);
$post = trusttext_pre_edit($post, 'message', $context);
$itemid = file_get_submitted_draft_itemid('message');
$message = file_prepare_draft_area($itemid, $context->id, 'mod_hsuforum', 'post', $post->id, \mod_hsuforum_post_form::editor_options($context, $post->id), $post->message);
return array($message, $itemid);
}
开发者ID:cdsmith-umn,项目名称:moodle-mod_hsuforum,代码行数:9,代码来源:form_service.php
示例13: definition_after_data
/**
* Fill in the current page data for this customcert.
*/
public function definition_after_data()
{
$mform = $this->_form;
// Editing existing instance - copy existing files into draft area.
$draftitemid = file_get_submitted_draft_itemid('customcertimage');
file_prepare_draft_area($draftitemid, context_system::instance()->id, 'mod_customcert', 'image', 0, $this->filemanageroptions);
$element = $mform->getElement('customcertimage');
$element->setValue($draftitemid);
}
开发者ID:rezaies,项目名称:moodle-mod_customcert,代码行数:12,代码来源:upload_image_form.php
示例14: data_preprocessing
function data_preprocessing($question)
{
if (!empty($question->options) && !empty($question->options->answers)) {
$answer = reset($question->options->answers);
$question->feedback = array();
$draftid = file_get_submitted_draft_itemid('feedback');
$question->feedback['text'] = file_prepare_draft_area($draftid, $this->context->id, 'question', 'answerfeedback', !empty($answer->id) ? (int) $answer->id : null, $this->fileoptions, $answer->feedback);
$question->feedback['format'] = $answer->feedbackformat;
$question->feedback['itemid'] = $draftid;
}
$question->penalty = 0;
return $question;
}
开发者ID:vuchannguyen,项目名称:web,代码行数:13,代码来源:edit_essay_form.php
示例15: set_data
function set_data($defaults)
{
$block_config = new Object();
$block_config->notify_by_email = file_get_submitted_draft_itemid('notify_by_email');
$block_config->notify_by_sms = file_get_submitted_draft_itemid('notify_by_sms');
$block_config->notify_by_rss = file_get_submitted_draft_itemid('notify_by_rss');
$block_config->notification_frequency = file_get_submitted_draft_itemid('notification_frequency');
$block_config->email_notification_preset = file_get_submitted_draft_itemid('email_notification_preset');
$block_config->sms_notification_preset = file_get_submitted_draft_itemid('sms_notification_preset');
unset($this->block->config->text);
parent::set_data($defaults);
$this->block->config = $block_config;
}
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:13,代码来源:edit_form.php
示例16: slideshow_update_instance
function slideshow_update_instance($data, $mform)
{
global $CFG, $DB;
$cmid = $data->coursemodule;
$draftitemid = $data->location;
$data->timemodified = time();
$data->id = $data->instance;
$DB->update_record("slideshow", $data);
$context = get_context_instance(CONTEXT_MODULE, $cmid);
if ($draftitemid = file_get_submitted_draft_itemid('location')) {
file_save_draft_area_files($draftitemid, $context->id, 'mod_slideshow', 'content', 0, array('subdirs' => true));
}
return true;
}
开发者ID:noparadise,项目名称:moodle-mod_slideshow,代码行数:14,代码来源:lib.php
示例17: data_preprocessing
protected function data_preprocessing($question)
{
$question = parent::data_preprocessing($question);
if (empty($question->options)) {
return $question;
}
$question->responseformat = $question->options->responseformat;
$question->responsefieldlines = $question->options->responsefieldlines;
$question->attachments = $question->options->attachments;
$draftid = file_get_submitted_draft_itemid('graderinfo');
$question->graderinfo = array();
$question->graderinfo['text'] = file_prepare_draft_area($draftid, $this->context->id, 'qtype_poodllrecording', 'graderinfo', !empty($question->id) ? (int) $question->id : null, $this->fileoptions, $question->options->graderinfo);
$question->graderinfo['format'] = $question->options->graderinfoformat;
$question->graderinfo['itemid'] = $draftid;
return $question;
}
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:16,代码来源:edit_poodllrecording_form.php
示例18: data_preprocessing
public function data_preprocessing(&$defaultvalues)
{
global $DB;
$content = null;
if (!empty($defaultvalues['id'])) {
// Load Content
$core = \mod_hvp\framework::instance();
$content = $core->loadContent($defaultvalues['id']);
if ($content === null) {
print_error('invalidhvp');
}
}
// Aaah.. we meet again h5pfile!
$draftitemid = file_get_submitted_draft_itemid('h5pfile');
file_prepare_draft_area($draftitemid, $this->context->id, 'mod_hvp', 'package', 0);
$defaultvalues['h5pfile'] = $draftitemid;
// Individual display options are not stored, must be extracted from disable.
if (isset($defaultvalues['disable'])) {
// Extract disable options.
\mod_hvp\framework::instance();
foreach (\H5PCore::$disable as $bit => $option) {
if ($defaultvalues['disable'] & $bit) {
// Disable.
$defaultvalues[$option] = 0;
} else {
// Enable.
$defaultvalues[$option] = 1;
}
}
}
// Determine default action
if ($content === null && $DB->get_field_sql("SELECT id FROM {hvp_libraries} WHERE runnable = 1", null, IGNORE_MULTIPLE) === false) {
$defaultvalues['h5paction'] = 'upload';
}
// Set editor defaults
$defaultvalues['h5plibrary'] = $content === null ? 0 : H5PCore::libraryToString($content['library']);
$defaultvalues['h5pparams'] = $content === null ? '{}' : $core->filterParameters($content);
// Add required editor assets.
require_once 'locallib.php';
\hvp_add_editor_assets($content === null ? null : $defaultvalues['id']);
// Log editor opened
if ($content === null) {
new \mod_hvp\event('content', 'new');
} else {
new \mod_hvp\event('content', 'edit', $content['id'], $content['title'], $content['library']['name'], $content['library']['majorVersion'] . '.' . $content['library']['minorVersion']);
}
}
开发者ID:nadavkav,项目名称:h5p-moodle-plugin,代码行数:47,代码来源:mod_form.php
示例19: flashcard_filepicker
function flashcard_filepicker($elname, $value, $contextid, $filearea, $cardid, $maxbytes, $accepted_types = '*')
{
global $COURSE, $PAGE, $OUTPUT, $USER;
$html = '';
$usercontext = context_user::instance($USER->id);
$fs = get_file_storage();
// no existing area info provided - let's use fresh new draft area
if ($value) {
$draftitemid = file_get_submitted_draft_itemid($filearea);
$maxbytes = 100000;
file_prepare_draft_area($draftitemid, $contextid, 'mod_flashcard', $filearea, $cardid, array('subdirs' => 0, 'maxbytes' => $maxbytes, 'maxfiles' => 1));
} else {
$draftitemid = file_get_unused_draft_itemid();
}
if ($COURSE->id == SITEID) {
$context = get_context_instance(CONTEXT_SYSTEM);
} else {
$context = get_context_instance(CONTEXT_COURSE, $COURSE->id);
}
$client_id = uniqid();
$args = new stdClass();
// need these three to filter repositories list
$args->accepted_types = $accepted_types;
$args->return_types = FILE_INTERNAL;
$args->itemid = $draftitemid;
$args->maxbytes = $maxbytes;
$args->buttonname = $elname . 'choose';
$args->elementname = $elname;
$id = $elname;
$fp = new file_picker($args);
$options = $fp->options;
$options->context = $PAGE->context;
$html .= $OUTPUT->render($fp);
$html .= '<input type="hidden" name="' . $elname . '" id="' . $id . '" value="' . $draftitemid . '" class="filepickerhidden"/>';
$module = array('name' => 'form_filepicker', 'fullpath' => '/lib/form/filepicker.js', 'requires' => array('core_filepicker', 'node', 'node-event-simulate'));
$PAGE->requires->js_init_call('M.form_filepicker.init', array($fp->options), true, $module);
$nonjsfilepicker = new moodle_url('/repository/draftfiles_manager.php', array('env' => 'filepicker', 'action' => 'browse', 'itemid' => $draftitemid, 'subdirs' => 0, 'maxbytes' => $options->maxbytes, 'maxfiles' => 1, 'ctx_id' => $PAGE->context->id, 'course' => $PAGE->course->id, 'sesskey' => sesskey()));
// non js file picker
$html .= '<noscript>';
$html .= "<div><object type='text/html' data='{$nonjsfilepicker}' height='160' width='600' style='border:1px solid #000'></object></div>";
$html .= '</noscript>';
return $html;
}
开发者ID:gabrielrosset,项目名称:moodle-mod_flashcard,代码行数:43,代码来源:renderers.php
示例20: definition
/**
* Form definition: creates the file manager interface using standard Moodle code, then
* stores the session draft ID so that it can be retrieved. This draft ID is new for
* every session, but does not change as files are picked.
*
*/
public function definition()
{
$mform =& $this->_form;
// Grab max attachment size from config.
$maxbytes = get_config('course_message', 'Attachment_Size');
$elementname = 'attachments' . $this->idmodifier;
// Create a filemanager interface - label is now set since behat testing uses this parameter.
$mform->addElement('filemanager', $elementname, $this->idmodifier . ' files', null, array('subdirs' => 0, 'maxbytes' => $maxbytes, 'maxfiles' => BLOCK_CM_MAX_FILES));
// Setup the "entry" object.
$entry = new stdClass();
$entry->id = null;
// Setup the session (not sure why bytes, files are specified twice).
$draftitemid = file_get_submitted_draft_itemid($elementname);
file_prepare_draft_area($draftitemid, $this->context->id, BLOCK_CM_COMPONENT_NAME, BLOCK_CM_FILE_AREA_NAME, $entry->id, array('subdirs' => 0, 'maxbytes' => $maxbytes, 'maxfiles' => BLOCK_CM_MAX_FILES));
$entry->{$elementname} = $draftitemid;
// Setup the form with the entry.
$this->set_data($entry);
// Store the draft ID so it can be retrieved.
$this->draftid = $draftitemid;
}
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:26,代码来源:attachment_form.class.php
注:本文中的file_get_submitted_draft_itemid函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论