moodle-expcontent/lib.php

39 lines
807 B
PHP
Raw Normal View History

2021-07-06 14:08:32 +00:00
<?php
if (!defined('MOODLE_INTERNAL')) die();
function expcontent_add_instance($expcontent) {
global $DB;
$expcontent->timemodified = time();
$expcontent->introformat = FORMAT_MOODLE;
$expcontent->id = $DB->insert_record('expcontent', $expcontent);
return $expcontent->id;
}
function expcontent_update_instance($expcontent) {
global $DB;
$expcontent->timemodified = time();
$expcontent->id = $expcontent->instance;
if (! $DB->update_record('expcontent', $expcontent)) {
return false;
}
return true;
}
function expcontent_delete_instance($id) {
global $DB;
if (! $expcontent = $DB->get_record('expcontent', array('id' => $id))) {
return false;
}
$DB->delete_records('expcontent', array('id' => $id));
return true;
}