require_variable($id); // Course Module ID
- optional_variable($l,"ALL");
+ optional_variable($l,"");
optional_variable($cat,0);
if (! $cm = get_record("course_modules", "id", $id)) {
}
/// Tabbed browsing sections
+ $lastl = $l;
+ $lastcat = $cat;
$tab = GLOSSARY_EXPORT_VIEW;
include("tabs.html");
- glossary_generate_export_file($glossary,$l,$cat);
+ glossary_generate_export_file($glossary,$lastl,$lastcat);
print_string("glosssaryexported","glossary");
+ $ffurl = "/$course->id/glossary/" . clean_filename($glossary->name) ."/glossary.xml";
if ($CFG->slasharguments) {
- $ffurl = "../../file.php/$course->id/glossary/" . clean_filename($glossary->name) ."/glossary.xml";
+ $ffurl = "../../file.php$ffurl" ;
} else {
- $ffurl = "../../file.php?file=/$course->id/glossary/" . clean_filename($glossary->name) ."/glossary.xml";
+ $ffurl = "../../file.php?file=$ffurl";
}
echo '<p><center><a href="' . $ffurl . '" target=_blank>' . get_string("exportedfile","glossary") . '</a></center><p>'
?>
\ No newline at end of file
echo "<b>";
glossary_print_entry_concept($entry);
echo ":</b> ";
- glossary_print_entry_aliases($entry);
glossary_print_entry_definition($entry);
glossary_print_entry_lower_section($course, $cm, $glossary, $entry,$tab,$cat);
echo "</td>";
echo "</tr></table></center>";
}
-function glossary_generate_export_file($glossary,$l, $cat) {
+function glossary_generate_export_file($glossary, $l = "", $cat = 0) {
global $CFG;
glossary_check_moddata_dir($glossary);
$h = glossary_open_xml($glossary);
if ( $entries = get_records("glossary_entries","glossaryid",$glossary->id) ) {
$status = fwrite ($h,glossary_start_tag("ENTRIES",2,true));
foreach ($entries as $entry) {
- if ( $entry->approved ) {
+ $permissiongranted = 1;
+ if ( $l ) {
+ switch ( $l ) {
+ case "ALL":
+ case "SPECIAL":
+ break;
+ default:
+ $permissiongranted = ($entry->concept[ strlen($l)-1 ] == $l);
+ break;
+ }
+ }
+ if ( $cat ) {
+ switch ( $cat ) {
+ case GLOSSARY_SHOW_ALL_CATEGORIES:
+ break;
+ case GLOSSARY_SHOW_NOT_CATEGORISED:
+ $permissiongranted = !record_exists("glossary_entries_categories","entryid",$entry->id);
+ break;
+ default:
+ $permissiongranted = record_exists("glossary_entries_categories","entryid",$entry->id, "categoryid",$cat);
+ break;
+ }
+ }
+ if ( $entry->approved and $permissiongranted ) {
$status = fwrite($h,glossary_start_tag("ENTRY",3,true));
fwrite($h,glossary_full_tag("CONCEPT",4,false,$entry->concept));
fwrite($h,glossary_full_tag("DEFINITION",4,false,$entry->definition));