';
$areyousure = '
'.format_string($entry->concept).'
'.get_string('areyousureexport','glossary').'
'.format_string($mainglossary->name).'?';
$linkyes = 'exportentry.php';
$linkno = 'view.php';
$optionsyes = array('id'=>$entry->id, 'confirm'=>1, 'sesskey'=>sesskey(), 'prevmode'=>$prevmode, 'hook'=>$hook);
$optionsno = array('id'=>$cm->id, 'mode'=>$prevmode, 'hook'=>$hook);
echo $OUTPUT->confirm($areyousure, new moodle_url($linkyes, $optionsyes), new moodle_url($linkno, $optionsno));
echo '
';
echo $OUTPUT->footer();
die;
} else {
$entry->glossaryid = $mainglossary->id;
$entry->sourceglossaryid = $glossary->id;
$DB->update_record('glossary_entries', $entry);
// move attachments too
$fs = get_file_storage();
if ($oldfiles = $fs->get_area_files($context->id, 'mod_glossary', 'attachment', $entry->id)) {
foreach ($oldfiles as $oldfile) {
$file_record = new stdClass();
$file_record->contextid = $maincontext->id;
$fs->create_file_from_storedfile($file_record, $oldfile);
}
$fs->delete_area_files($context->id, 'mod_glossary', 'attachment', $entry->id);
$entry->attachment = '1';
} else {
$entry->attachment = '0';
}
$DB->update_record('glossary_entries', $entry);
redirect ($returnurl);
}