moodle-expcontent/lib.php
2021-12-07 11:02:33 +01:00

48 lines
No EOL
1 KiB
PHP

<?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;
$expcontent->introformat = FORMAT_MOODLE;
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;
}
function expcontent_supports($feature) {
switch($feature) {
case FEATURE_COMPLETION_TRACKS_VIEWS: return true;
case FEATURE_SHOW_DESCRIPTION: return true;
default: return null;
}
}