2024-07-05 09:30:55 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
defined('MOODLE_INTERNAL') || die();
|
|
|
|
|
|
|
|
function exp360_add_instance($exp360)
|
|
|
|
{
|
|
|
|
global $DB;
|
|
|
|
|
|
|
|
$exp360->timemodified = time();
|
|
|
|
$exp360->timecreated = time();
|
|
|
|
|
2024-07-05 09:38:10 +00:00
|
|
|
// Process standard intro fields.
|
|
|
|
$exp360->introformat = FORMAT_HTML;
|
|
|
|
$exp360->intro = '';
|
|
|
|
|
2024-07-05 09:30:55 +00:00
|
|
|
return $DB->insert_record('exp360', $exp360);
|
|
|
|
}
|
|
|
|
|
|
|
|
function exp360_update_instance($exp360)
|
|
|
|
{
|
|
|
|
global $DB;
|
|
|
|
|
|
|
|
$exp360->timemodified = time();
|
|
|
|
$exp360->id = $exp360->instance;
|
|
|
|
|
2024-07-05 09:38:10 +00:00
|
|
|
// Process standard intro fields.
|
|
|
|
$exp360->introformat = FORMAT_HTML;
|
|
|
|
$exp360->intro = '';
|
|
|
|
|
2024-07-05 09:30:55 +00:00
|
|
|
return $DB->update_record('exp360', $exp360);
|
|
|
|
}
|
|
|
|
|
|
|
|
function exp360_delete_instance($id)
|
|
|
|
{
|
|
|
|
global $DB;
|
|
|
|
|
|
|
|
if (!$exp360 = $DB->get_record('exp360', array('id' => $id))) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$DB->delete_records('exp360', array('id' => $exp360->id));
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2024-07-05 09:58:14 +00:00
|
|
|
|
|
|
|
function mod_exp360_cm_info_dynamic(cm_info $cm)
|
|
|
|
{
|
2024-07-05 10:18:34 +00:00
|
|
|
global $PAGE;
|
2024-07-05 09:58:14 +00:00
|
|
|
|
|
|
|
if ($cm->modname !== 'exp360') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-07-05 10:18:34 +00:00
|
|
|
$renderer = $PAGE->get_renderer('mod_exp360');
|
|
|
|
$modals = $renderer->render_modals();
|
2024-09-23 07:08:09 +00:00
|
|
|
$script = $renderer->render_activity($cm->id, $cm->get_formatted_name());
|
2024-07-05 09:58:14 +00:00
|
|
|
|
|
|
|
$cm->set_no_view_link();
|
2024-07-05 10:31:26 +00:00
|
|
|
$cm->set_content($modals . $script);
|
2024-09-23 08:10:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function mod_exp360_supports($feature) {
|
|
|
|
switch($feature) {
|
|
|
|
case FEATURE_COMPLETION_TRACKS_VIEWS: return true;
|
|
|
|
default: return null;
|
|
|
|
}
|
2024-07-05 10:44:26 +00:00
|
|
|
}
|