<?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;
}

function expcontent_supports($feature) {
    switch($feature) {
	case FEATURE_COMPLETION_TRACKS_VIEWS: return true;
	case FEATURE_BACKUP_MOODLE2: return true;
	default: return null;
    }
}
