moodle-expcontent/lib.php

39 lines
No EOL
807 B
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;
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;
}