本文整理汇总了PHP中file_get_draft_area_info函数的典型用法代码示例。如果您正苦于以下问题:PHP file_get_draft_area_info函数的具体用法?PHP file_get_draft_area_info怎么用?PHP file_get_draft_area_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了file_get_draft_area_info函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: validation
public function validation($data, $files)
{
$errors = parent::validation($data, $files);
$info = file_get_draft_area_info($data['content']);
if ($info['filecount'] == 0) {
$errors['content'] = get_string('required');
}
return $errors;
}
开发者ID:eSrem,项目名称:moodle-mod_mediagallery,代码行数:9,代码来源:item_bulk_form.php
示例2: validation
function validation($data, $files)
{
global $CFG;
$errors = array();
$draftitemid = $data['files_filemanager'];
$fileinfo = file_get_draft_area_info($draftitemid);
if ($fileinfo['filesize'] > $CFG->userquota) {
$errors['files_filemanager'] = get_string('userquotalimit', 'error');
}
return $errors;
}
开发者ID:rama1712,项目名称:moodle,代码行数:11,代码来源:files_form.php
示例3: forum_add_attachment
/**
* If successful, this function returns the name of the file
*
* @global object
* @param object $post is a full post record, including course and forum
* @param object $forum
* @param object $cm
* @param mixed $mform
* @param string $message
* @return bool
*/
function forum_add_attachment($post, $forum, $cm, $mform=null, &$message=null) {
global $DB;
if (empty($mform)) {
return false;
}
if (empty($post->attachments)) {
return true; // Nothing to do
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$info = file_get_draft_area_info($post->attachments);
$present = ($info['filecount']>0) ? '1' : '';
file_save_draft_area_files($post->attachments, $context->id, 'mod_forum', 'attachment', $post->id);
$DB->set_field('forum_posts', 'attachment', $present, array('id'=>$post->id));
return true;
}
开发者ID:nfreear,项目名称:moodle,代码行数:32,代码来源:lib.php
示例4: file_is_draft_area_limit_reached
/**
* Returns whether a draft area has exceeded/will exceed its size limit.
*
* Please note that the unlimited value for $areamaxbytes is -1 {@link FILE_AREA_MAX_BYTES_UNLIMITED}, not 0.
*
* @param int $draftitemid the draft area item id.
* @param int $areamaxbytes the maximum size allowed in this draft area.
* @param int $newfilesize the size that would be added to the current area.
* @param bool $includereferences true to include the size of the references in the area size.
* @return bool true if the area will/has exceeded its limit.
* @since Moodle 2.4
*/
function file_is_draft_area_limit_reached($draftitemid, $areamaxbytes, $newfilesize = 0, $includereferences = false)
{
if ($areamaxbytes != FILE_AREA_MAX_BYTES_UNLIMITED) {
$draftinfo = file_get_draft_area_info($draftitemid);
$areasize = $draftinfo['filesize_without_references'];
if ($includereferences) {
$areasize = $draftinfo['filesize'];
}
if ($areasize + $newfilesize > $areamaxbytes) {
return true;
}
}
return false;
}
开发者ID:IFPBMoodle,项目名称:moodle,代码行数:26,代码来源:filelib.php
示例5: imscp_update_instance
/**
* Update imscp instance.
* @param object $data
* @param object $mform
* @return bool true
*/
function imscp_update_instance($data, $mform)
{
global $CFG, $DB;
require_once "{$CFG->dirroot}/mod/imscp/locallib.php";
$cmid = $data->coursemodule;
$data->timemodified = time();
$data->id = $data->instance;
$data->structure = null;
// Better reparse structure after each update.
$DB->update_record('imscp', $data);
$context = context_module::instance($cmid);
$imscp = $DB->get_record('imscp', array('id' => $data->id), '*', MUST_EXIST);
if (!empty($data->package) && ($draftareainfo = file_get_draft_area_info($data->package)) && $draftareainfo['filecount']) {
$fs = get_file_storage();
$imscp->revision++;
$DB->update_record('imscp', $imscp);
// Get a list of existing packages before adding new package.
if ($imscp->keepold > -1) {
$packages = $fs->get_area_files($context->id, 'mod_imscp', 'backup', false, "itemid ASC", false);
} else {
$packages = array();
}
file_save_draft_area_files($data->package, $context->id, 'mod_imscp', 'backup', $imscp->revision, array('subdirs' => 0, 'maxfiles' => 1));
$files = $fs->get_area_files($context->id, 'mod_imscp', 'backup', $imscp->revision, '', false);
$package = reset($files);
// Purge all extracted content.
$fs->delete_area_files($context->id, 'mod_imscp', 'content');
// Extract package content.
if ($package) {
$packer = get_file_packer('application/zip');
$package->extract_to_storage($packer, $context->id, 'mod_imscp', 'content', $imscp->revision, '/');
}
// Cleanup old package files, keep current + keep old.
while ($packages and count($packages) > $imscp->keepold) {
$package = array_shift($packages);
$fs->delete_area_files($context->id, 'mod_imscp', 'backup', $package->get_itemid());
}
}
$structure = imscp_parse_structure($imscp, $context);
$imscp->structure = is_array($structure) ? serialize($structure) : null;
$DB->update_record('imscp', $imscp);
return true;
}
开发者ID:dg711,项目名称:moodle,代码行数:49,代码来源:lib.php
示例6: get_file_storage
$fs = get_file_storage();
$file = $fs->get_file($user_context->id, 'user', 'draft', $draftid, $filepath, '.');
$parent_path = $file->get_parent_directory()->get_filepath();
if ($newfile = $zipper->archive_to_storage(array($file), $user_context->id, 'user', 'draft', $draftid, $parent_path, $filepath . '.zip', $USER->id)) {
$return = new stdClass();
$return->filepath = $parent_path;
echo json_encode($return);
} else {
echo json_encode(false);
}
die;
case 'downloaddir':
$filepath = required_param('filepath', PARAM_PATH);
$zipper = get_file_packer('application/zip');
$fs = get_file_storage();
$area = file_get_draft_area_info($draftid);
if ($area['filecount'] == 0) {
echo json_encode(false);
die;
}
$stored_file = $fs->get_file($user_context->id, 'user', 'draft', $draftid, $filepath, '.');
if ($filepath === '/') {
$parent_path = '/';
$filename = get_string('files') . '.zip';
} else {
$parent_path = $stored_file->get_parent_directory()->get_filepath();
$filename = trim($filepath, '/') . '.zip';
}
// archive compressed file to an unused draft area
$newdraftitemid = file_get_unused_draft_itemid();
if ($newfile = $zipper->archive_to_storage(array($stored_file), $user_context->id, 'user', 'draft', $newdraftitemid, '/', $filename, $USER->id)) {
开发者ID:nmicha,项目名称:moodle,代码行数:31,代码来源:draftfiles_ajax.php
示例7: save_question_options
public function save_question_options($formdata)
{
global $DB, $USER;
$context = $formdata->context;
$options = $DB->get_record('qtype_ddimageortext', array('questionid' => $formdata->id));
if (!$options) {
$options = new stdClass();
$options->questionid = $formdata->id;
$options->correctfeedback = '';
$options->partiallycorrectfeedback = '';
$options->incorrectfeedback = '';
$options->id = $DB->insert_record('qtype_ddimageortext', $options);
}
$options->shuffleanswers = !empty($formdata->shuffleanswers);
$options = $this->save_combined_feedback_helper($options, $formdata, $context, true);
$this->save_hints($formdata, true);
$DB->update_record('qtype_ddimageortext', $options);
$DB->delete_records('qtype_ddimageortext_drops', array('questionid' => $formdata->id));
foreach (array_keys($formdata->drops) as $dropno) {
if ($formdata->drops[$dropno]['choice'] == 0) {
continue;
}
$drop = new stdClass();
$drop->questionid = $formdata->id;
$drop->no = $dropno + 1;
$drop->xleft = $formdata->drops[$dropno]['xleft'];
$drop->ytop = $formdata->drops[$dropno]['ytop'];
$drop->choice = $formdata->drops[$dropno]['choice'];
$drop->label = $formdata->drops[$dropno]['droplabel'];
$DB->insert_record('qtype_ddimageortext_drops', $drop);
}
// An array of drag no -> drag id.
$olddragids = $DB->get_records_menu('qtype_ddimageortext_drags', array('questionid' => $formdata->id), '', 'no, id');
foreach (array_keys($formdata->drags) as $dragno) {
$info = file_get_draft_area_info($formdata->dragitem[$dragno]);
if ($info['filecount'] > 0 || trim($formdata->draglabel[$dragno]) != '') {
$draftitemid = $formdata->dragitem[$dragno];
$drag = new stdClass();
$drag->questionid = $formdata->id;
$drag->no = $dragno + 1;
$drag->draggroup = $formdata->drags[$dragno]['draggroup'];
$drag->infinite = empty($formdata->drags[$dragno]['infinite']) ? 0 : 1;
$drag->label = $formdata->draglabel[$dragno];
if (isset($olddragids[$dragno + 1])) {
$drag->id = $olddragids[$dragno + 1];
unset($olddragids[$dragno + 1]);
$DB->update_record('qtype_ddimageortext_drags', $drag);
} else {
$drag->id = $DB->insert_record('qtype_ddimageortext_drags', $drag);
}
if ($formdata->drags[$dragno]['dragitemtype'] == 'image') {
self::constrain_image_size_in_draft_area($draftitemid, QTYPE_DDIMAGEORTEXT_DRAGIMAGE_MAXWIDTH, QTYPE_DDIMAGEORTEXT_DRAGIMAGE_MAXHEIGHT);
file_save_draft_area_files($draftitemid, $formdata->context->id, 'qtype_ddimageortext', 'dragimage', $drag->id, array('subdirs' => 0, 'maxbytes' => 0, 'maxfiles' => 1));
} else {
// Delete any existing files for draggable text item type.
$fs = get_file_storage();
$fs->delete_area_files($formdata->context->id, 'qtype_ddimageortext', 'dragimage', $drag->id);
}
}
}
if (!empty($olddragids)) {
list($sql, $params) = $DB->get_in_or_equal(array_values($olddragids));
$DB->delete_records_select('qtype_ddimageortext_drags', "id {$sql}", $params);
}
self::constrain_image_size_in_draft_area($formdata->bgimage, QTYPE_DDIMAGEORTEXT_BGIMAGE_MAXWIDTH, QTYPE_DDIMAGEORTEXT_BGIMAGE_MAXHEIGHT);
file_save_draft_area_files($formdata->bgimage, $formdata->context->id, 'qtype_ddimageortext', 'bgimage', $formdata->id, array('subdirs' => 0, 'maxbytes' => 0, 'maxfiles' => 1));
}
开发者ID:evltuma,项目名称:moodle,代码行数:67,代码来源:questiontype.php
示例8: file_is_draft_area_limit_reached
/**
* Returns whether a draft area has exceeded/will exceed its size limit.
*
* Please note that the unlimited value for $areamaxbytes is -1 {@link FILE_AREA_MAX_BYTES_UNLIMITED}, not 0.
*
* @param int $draftitemid the draft area item id.
* @param int $areamaxbytes the maximum size allowed in this draft area.
* @param int $newfilesize the size that would be added to the current area.
* @return bool true if the area will/has exceeded its limit.
* @since 2.4
*/
function file_is_draft_area_limit_reached($draftitemid, $areamaxbytes, $newfilesize = 0)
{
if ($areamaxbytes != FILE_AREA_MAX_BYTES_UNLIMITED) {
$draftinfo = file_get_draft_area_info($draftitemid);
if ($draftinfo['filesize'] + $newfilesize > $areamaxbytes) {
return true;
}
}
return false;
}
开发者ID:neogic,项目名称:moodle,代码行数:21,代码来源:filelib.php
示例9: save
/**
* Save a message and destinataries
* @param array $destinataries Destinataries for the message
* @param array $attachments File attachments
* @return mixed Message id or false if something fails
*/
public function save($destinataries, $attachments, $editoritemid)
{
global $USER, $DB, $CFG;
$message = new stdClass();
$message->sender = $USER->id;
$message->courseid = $this->courseid;
$message->subject = $this->subject;
$message->body = $this->body;
//$post->message = file_save_draft_area_files($post->itemid, $context->id, 'mod_forum', 'post', $post->id, array('subdirs'=>true), $post->message);
$message->attachment = 0;
$message->approved = $this->approved;
$message->timesent = $this->timesent;
$message->timecreated = $this->timecreated;
if ($messageid = $DB->insert_record('block_jmail', $message)) {
foreach ($destinataries as $d) {
if (!$d->userid) {
continue;
}
$to = new stdClass();
$to->userid = $d->userid;
$to->messageid = $messageid;
$to->type = $d->type;
$to->mread = 0;
$to->answered = 0;
$to->deleted = 0;
$to->labeled = 0;
$DB->insert_record('block_jmail_sent', $to);
}
$this->id = $messageid;
$context = block_jmail_get_context(CONTEXT_COURSE, $this->courseid);
// We need the block instance for saving the attachments
if ($instance = $DB->get_record('block_instances', array('blockname' => 'jmail', 'parentcontextid' => $context->id))) {
// attachments
$context = block_jmail_get_context(CONTEXT_BLOCK, $instance->id);
require_once $CFG->libdir . '/filelib.php';
$message->body = file_save_draft_area_files($editoritemid, $context->id, 'block_jmail', 'body', $messageid, array('subdirs' => true), $message->body);
$DB->set_field('block_jmail', 'body', $message->body, array('id' => $messageid));
$info = file_get_draft_area_info($attachments);
$present = $info['filecount'] > 0 ? '1' : '';
file_save_draft_area_files($attachments, $context->id, 'block_jmail', 'attachment', $messageid);
$DB->set_field('block_jmail', 'attachment', $present, array('id' => $messageid));
}
return $messageid;
}
return false;
}
开发者ID:borrown,项目名称:moodle-block_jmail,代码行数:52,代码来源:block_jmail_message.class.php
示例10: validation
public function validation($data, $files)
{
$message = $this->_customdata['message'];
$errors = array();
// Skip on discard
if (!empty($data['discard'])) {
return array();
}
// Course selected
if (isset($data['course']) and $data['course'] == SITEID) {
$errors['course'] = get_string('erroremptycourse', 'local_mail');
}
// Empty subject?
if (!empty($data['send']) and !trim($data['subject'])) {
$errors['subject'] = get_string('erroremptysubject', 'local_mail');
}
// At least one recipient
if (!empty($data['send']) and (!$message or !$message->recipients())) {
$errors['recipients'] = get_string('erroremptyrecipients', 'local_mail');
}
// Maximum number of attachmnents
$options = self::file_options();
$info = file_get_draft_area_info($data['attachments']);
if ($info['filecount'] > $options['maxfiles']) {
$errors['attachments'] = get_string('maxfilesreached', 'moodle', $options['maxfiles']);
}
return $errors;
}
开发者ID:miguelangelUvirtual,项目名称:uEducon,代码行数:28,代码来源:compose_form.php
示例11: validation
public function validation($data, $files)
{
global $CFG;
$errors = parent::validation($data, $files);
$info = isset($data['content']) ? file_get_draft_area_info($data['content']) : array('filecount' => 0);
$url = isset($data['externalurl']) ? trim($data['externalurl']) : '';
if (empty($data['externalurl']) && $info['filecount'] == 0 && empty($data['objectid'])) {
$errors['filecheck'] = get_string('required');
} else {
if (!empty($url)) {
if (preg_match('|^/|', $url)) {
// Links relative to server root are ok - no validation necessary.
} else {
if (preg_match('|^[a-z]+://|i', $url) or preg_match('|^https?:|i', $url) or preg_match('|^ftp:|i', $url)) {
// Normal URL.
if (!mediagallery_appears_valid_url($url)) {
$errors['externalurl'] = get_string('invalidurl', 'url');
}
} else {
if (preg_match('|^[a-z]+:|i', $url)) {
// General URI such as teamspeak, mailto, etc. - it may or may not work in all browsers.
// We do not validate these at all, sorry.
} else {
// Invalid URI, we try to fix it by adding 'http://' prefix.
// Relative links are NOT allowed because we display the link on different pages!
require_once $CFG->dirroot . "/mod/url/locallib.php";
if (!url_appears_valid_url('http://' . $url)) {
$errors['externalurl'] = get_string('invalidurl', 'url');
}
}
}
}
}
}
return $errors;
}
开发者ID:eSrem,项目名称:moodle-mod_mediagallery,代码行数:36,代码来源:item_form.php
示例12: hsuforum_add_attachment
/**
* If successful, this function returns the name of the file
*
* @global object
* @param object $post is a full post record, including course and forum
* @param object $forum
* @param object $cm
* @param mixed $mform
* @param string $unused
* @param \mod_hsuforum\upload_file $uploader
* @return bool
*/
function hsuforum_add_attachment($post, $forum, $cm, $mform = null, $unused = null, \mod_hsuforum\upload_file $uploader = null)
{
global $DB;
if ($uploader instanceof \mod_hsuforum\upload_file) {
$files = $uploader->process_file_upload($post->id);
$DB->set_field('hsuforum_posts', 'attachment', empty($files) ? 0 : 1, array('id' => $post->id));
return true;
}
if (empty($mform)) {
return false;
}
if (empty($post->attachments)) {
return true;
// Nothing to do
}
$context = context_module::instance($cm->id);
$info = file_get_draft_area_info($post->attachments);
$present = $info['filecount'] > 0 ? '1' : '';
file_save_draft_area_files($post->attachments, $context->id, 'mod_hsuforum', 'attachment', $post->id, mod_hsuforum_post_form::attachment_options($forum));
$DB->set_field('hsuforum_posts', 'attachment', $present, array('id' => $post->id));
return true;
}
开发者ID:cdsmith-umn,项目名称:moodle-mod_hsuforum,代码行数:34,代码来源:lib.php
示例13: set_attachmentsdraftid
public function set_attachmentsdraftid($attachmentsdraftitemid)
{
$fileareainfo = file_get_draft_area_info($attachmentsdraftitemid);
if ($fileareainfo['filecount']) {
$this->_attachmentsdraftid = $attachmentsdraftitemid;
}
}
开发者ID:troywilliams,项目名称:moodle-mod_dialogue,代码行数:7,代码来源:message.php
示例14: is_feedback_modified
/**
* Has the feedback file been modified?
*
* @param stdClass $grade Grade object.
* @param stdClass $data Form data.
* @return boolean True if the file area has been modified, else false.
*/
public function is_feedback_modified(stdClass $grade, stdClass $data)
{
global $USER;
$filekey = null;
$draftareainfo = null;
foreach ($data as $key => $value) {
if (strpos($key, 'files_') === 0 && strpos($key, '_filemanager')) {
$filekey = $key;
}
}
if (isset($filekey)) {
$draftareainfo = file_get_draft_area_info($data->{$filekey});
$filecount = $this->count_files($grade->id, ASSIGNFEEDBACK_FILE_FILEAREA);
if ($filecount != $draftareainfo['filecount']) {
return true;
} else {
// We need to check that the files in the draft area are the same as in the file area.
$usercontext = context_user::instance($USER->id);
$fs = get_file_storage();
$draftfiles = $fs->get_area_files($usercontext->id, 'user', 'draft', $data->{$filekey}, 'id', true);
$files = $fs->get_area_files($this->assignment->get_context()->id, 'assignfeedback_file', ASSIGNFEEDBACK_FILE_FILEAREA, $grade->id, 'id', false);
foreach ($files as $key => $file) {
// Flag for recording if we have a matching file.
$matchflag = false;
foreach ($draftfiles as $draftkey => $draftfile) {
if (!$file->is_directory()) {
// File name is the same, but it could be a different file with the same name.
if ($draftfile->get_filename() == $file->get_filename()) {
// If the file name is the same but the content hash is different, or
// The file path for the file has changed, then we have a modification.
if ($draftfile->get_contenthash() != $file->get_contenthash() || $draftfile->get_filepath() != $file->get_filepath()) {
return true;
}
// These files match. Check the next file.
$matchflag = true;
// We have a match on the file name so we can move to the next file and not
// proceed through the other draftfiles.
break;
}
}
}
// If the file does not match then there has been a modification.
if (!$matchflag) {
return true;
}
}
}
}
return false;
}
开发者ID:janeklb,项目名称:moodle,代码行数:57,代码来源:locallib.php
示例15: trim
$newfolderpath = $draftpath . trim($newdirname, '/') . '/';
$fs->create_directory($user_context->id, 'user', 'draft', $itemid, $newfolderpath);
$home_url->param('action', 'browse');
if (!empty($newdirname)) {
$home_url->param('draftpath', $newfolderpath);
$str = get_string('createfoldersuccess', 'repository');
} else {
$home_url->param('draftpath', $draftpath);
$str = get_string('createfolderfail', 'repository');
}
redirect($home_url, $str);
break;
case 'browse':
default:
$files = file_get_drafarea_files($itemid, $draftpath);
$info = file_get_draft_area_info($itemid);
$filecount = $info['filecount'];
echo $OUTPUT->header();
if ((!empty($files) or $draftpath != '/') and $env == 'filemanager') {
echo '<div class="fm-breadcrumb">';
$home_url->param('action', 'browse');
$home_url->param('draftpath', '/');
echo '<a href="' . $home_url->out() . '">' . get_string('files') . '</a> ▶';
$trail = '';
if ($draftpath !== '/') {
$path = '/' . trim($draftpath, '/') . '/';
$parts = explode('/', $path);
foreach ($parts as $part) {
if ($part != '') {
$trail .= '/' . $part . '/';
$data->path[] = array('name' => $part, 'path' => $trail);
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:31,代码来源:draftfiles_manager.php
示例16: stdClass
if ($newfile = $zipper->archive_to_storage(array($filepath => $file), $user_context->id, 'user', 'draft', $draftid, $parent_path, $zipfile, $USER->id)) {
$return = new stdClass();
$return->filepath = $parent_path;
echo json_encode($return);
} else {
echo json_encode(false);
}
die;
case 'downloaddir':
$filepath = required_param('filepath', PARAM_PATH);
$zipper = get_file_packer('application/zip');
$fs = get_file_storage();
$area = file_get_draft_area_info($draftid, $filepath);
if ($area['filecount'] == 0 && $area['foldercount'] == 0) {
echo json_encode(false);
die;
}
$stored_file = $fs->get_file($user_context->id, 'user', 'draft', $draftid, $filepath, '.');
if ($filepath === '/') {
$filename = get_string('files').'.zip';
} else {
$filename = explode('/', trim($filepath, '/'));
$filename = array_pop($filename) . '.zip';
}
// archive compressed file to an unused draft area
$newdraftitemid = file_get_unused_draft_itemid();
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:30,代码来源:draftfiles_ajax.php
示例17: forum_add_attachment
/**
* If successful, this function returns the name of the file
*
* @global object
* @param object $post is a full post record, including course and forum
* @param object $forum
* @param object $cm
* @param mixed $mform
* @param string $unused
* @return bool
*/
function forum_add_attachment($post, $forum, $cm, $mform=null, $unused=null) {
global $DB;
if (empty($mform)) {
return false;
}
if (empty($post->attachments)) {
return true; // Nothing to do
}
$context = context_module::instance($cm->id);
$info = file_get_draft_area_info($post->attachments);
$present = ($info['filecount']>0) ? '1' : '';
file_save_draft_area_files($post->attachments, $context->id, 'mod_forum', 'attachment', $post->id,
mod_forum_post_form::attachment_options($forum));
$DB->set_field('forum_posts', 'attachment', $present, array('id'=>$post->id));
return true;
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:33,代码来源:lib.php
示例18: file_get_submitted_draft_itemid
if ($bulk) {
$draftid = file_get_submitted_draft_itemid('content');
$files = $fs->get_area_files(context_user::instance($USER->id)->id, 'user', 'draft', $draftid, 'id DESC', false);
$storedfile = reset($files);
\mod_mediagallery\item::create_from_archive($gallery, $storedfile, $data);
} else {
$data->description = $data->description['text'];
$data->galleryid = $gallery->id;
if (!empty($data->id)) {
$item = new \mod_mediagallery\item($data->id);
$item->update($data);
} else {
$item = \mod_mediagallery\item::create($data);
}
if (!empty($data->content)) {
$info = file_get_draft_area_info($data->content);
file_save_draft_area_files($data->content, $context->id, 'mod_mediagallery', 'item', $item->id, $fmoptions);
$storedfile = null;
if ($gallery->galleryfocus != \mod_mediagallery\base::TYPE_IMAGE && $gallery->mode != 'thebox') {
$draftid = file_get_submitted_draft_itemid('customthumbnail');
if ($files = $fs->get_area_files(context_user::instance($USER->id)->id, 'user', 'draft', $draftid, 'id DESC', false)) {
$storedfile = reset($files);
}
}
if ($gallery->mode != 'thebox') {
$item->generate_image_by_type('lowres', false, $storedfile);
$item->generate_image_by_type('thumbnail', false, $storedfile);
}
$params = array('context' => $context, 'objectid' => $item->id, 'other' => array('copyright_id' => $data->copyright_id, 'theme_id' => $data->theme_id));
$event = \mod_mediagallery\event\item_updated::create($params);
$event->add_record_snapshot('mediagallery_item', $item->get_record());
开发者ID:eSrem,项目名称:moodle-mod_mediagallery,代码行数:31,代码来源:item.php
注:本文中的file_get_draft_area_info函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论