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


PHP lesson_process_pre_save函数代码示例

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


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

示例1: lesson_update_instance

/**
 * Given an object containing all the necessary data,
 * (defined by the form in mod_form.php) this function
 * will update an existing instance with new data.
 *
 * @global object
 * @param object $lesson Lesson post data from the form
 * @return boolean
 **/
function lesson_update_instance($data, $mform)
{
    global $DB;
    $data->id = $data->instance;
    $cmid = $data->coursemodule;
    lesson_process_pre_save($data);
    unset($data->mediafile);
    $DB->update_record("lesson", $data);
    $context = get_context_instance(CONTEXT_MODULE, $cmid);
    if ($filename = $mform->get_new_filename('mediafilepicker')) {
        if ($file = $mform->save_stored_file('mediafilepicker', $context->id, 'mod_lesson', 'mediafile', 0, '/', $filename, true)) {
            $DB->set_field('lesson', 'mediafile', '/' . $file->get_filename(), array('id' => $data->id));
        } else {
            $DB->set_field('lesson', 'mediafile', '', array('id' => $data->id));
        }
    } else {
        $DB->set_field('lesson', 'mediafile', '', array('id' => $data->id));
    }
    lesson_process_post_save($data);
    // update grade item definition
    lesson_grade_item_update($data);
    // update grades - TODO: do it only when grading style changes
    lesson_update_grades($data, 0, false);
    return true;
}
开发者ID:nmicha,项目名称:moodle,代码行数:34,代码来源:lib.php

示例2: lesson_update_instance

/**
 * Given an object containing all the necessary data,
 * (defined by the form in mod_form.php) this function
 * will update an existing instance with new data.
 *
 * @global object
 * @param object $lesson Lesson post data from the form
 * @return boolean
 **/
function lesson_update_instance($data, $mform) {
    global $DB;

    $data->id = $data->instance;
    $cmid = $data->coursemodule;
    $draftitemid = $data->mediafile;
    $context = context_module::instance($cmid);

    lesson_process_pre_save($data);

    unset($data->mediafile);
    $DB->update_record("lesson", $data);

    lesson_update_media_file($data->id, $context, $draftitemid);

    lesson_process_post_save($data);

    // update grade item definition
    lesson_grade_item_update($data);

    // update grades - TODO: do it only when grading style changes
    lesson_update_grades($data, 0, false);

    return true;
}
开发者ID:jtibbetts,项目名称:moodle,代码行数:34,代码来源:lib.php


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