本文整理匯總了PHP中lesson_process_post_save函數的典型用法代碼示例。如果您正苦於以下問題:PHP lesson_process_post_save函數的具體用法?PHP lesson_process_post_save怎麽用?PHP lesson_process_post_save使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了lesson_process_post_save函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
示例2: save_dates
public function save_dates(cm_info $cm, array $dates)
{
global $DB, $COURSE;
// Fetch module instance from $mods array.
$lesson = $this->mods[$cm->instance];
// Updating date values.
foreach ($dates as $datetype => $datevalue) {
$lesson->{$datetype} = $datevalue;
}
$lesson->timemodified = time();
// Update DB record.
$DB->update_record('lesson', $lesson);
// Update associated calender events.
lesson_process_post_save($lesson);
}
示例3: 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;
}