Small fix to avoid warnings on empty tables
[moodle.git] / mod / glossary / lib.php
CommitLineData
07842023 1<?PHP // $Id$
2
3/// Library of functions and constants for module glossary
4/// (replace glossary with the name of your module and delete this line)
5
e179048e 6require_once("$CFG->dirroot/files/mimetypes.php");
07842023 7
fb443f1a 8$tCFG->TabTableBGColor = $THEME->cellcontent2;
9$tCFG->TabTableWidth = "70%";
10$tCFG->ActiveTabColor = $THEME->cellcontent2;
11$tCFG->InactiveTabColor = $THEME->cellheading2;
12$tCFG->TabsPerRow = 5;
13$tCFG->TabSeparation = 4;
14
07842023 15function glossary_add_instance($glossary) {
16/// Given an object containing all the necessary data,
17/// (defined by the form in mod.html) this function
18/// will create a new instance and return the id number
19/// of the new instance.
20
21 $glossary->timecreated = time();
22 $glossary->timemodified = $glossary->timecreated;
23
24 # May have to add extra stuff in here #
25
26 return insert_record("glossary", $glossary);
27}
28
29
30function glossary_update_instance($glossary) {
31/// Given an object containing all the necessary data,
32/// (defined by the form in mod.html) this function
33/// will update an existing instance with new data.
34
35 $glossary->timemodified = time();
36 $glossary->id = $glossary->instance;
37
38 # May have to add extra stuff in here #
39
40 return update_record("glossary", $glossary);
41}
42
43
44function glossary_delete_instance($id) {
45/// Given an ID of an instance of this module,
46/// this function will permanently delete the instance
47/// and any data that depends on it.
48
49 if (! $glossary = get_record("glossary", "id", "$id")) {
50 return false;
51 }
52
53 $result = true;
54
55 # Delete any dependent records here #
56
57 if (! delete_records("glossary", "id", "$glossary->id")) {
58 $result = false;
59 }
60 delete_records("glossary_entries", "glossaryid", "$glossary->id");
61
62 return $result;
63}
64
65function glossary_user_outline($course, $user, $mod, $glossary) {
66/// Return a small object with summary information about what a
67/// user has done with a given particular instance of this module
68/// Used for user activity reports.
69/// $return->time = the time they did it
70/// $return->info = a short text description
71
72 return $return;
73}
74
75function glossary_user_complete($course, $user, $mod, $glossary) {
76/// Print a detailed representation of what a user has done with
77/// a given particular instance of this module, for user activity reports.
78
79 return true;
80}
81
82function glossary_print_recent_activity($course, $isteacher, $timestart) {
83/// Given a course and a time, this module should find recent activity
84/// that has occurred in glossary activities and print it out.
85/// Return true if there was output, or false is there was none.
86
87 global $CFG, $THEME;
88
89 if (!$logs = get_records_select("log", "time > '$timestart' AND ".
90 "course = '$course->id' AND ".
91 "module = 'glossary' AND ".
92 "action = 'add %' ", "time ASC")) {
93 return false;
94 }
95
07842023 96 foreach ($logs as $log) {
97 //Create a temp valid module structure (course,id)
98 $tempmod->course = $log->course;
99 $tempmod->id = $log->info;
100 //Obtain the visible property from the instance
101 $modvisible = instance_is_visible($log->module,$tempmod);
07842023 102
103 //Only if the mod is visible
104 if ($modvisible) {
105 $entries[$log->info] = glossary_log_info($log);
106 $entries[$log->info]->time = $log->time;
107 $entries[$log->info]->url = $log->url;
108 }
07842023 109 }
110
07842023 111 $content = false;
112 if ($entries) {
113 $strftimerecent = get_string("strftimerecent");
114 $content = true;
115 print_headline(get_string("newentries", "glossary").":");
116 foreach ($entries as $entry) {
117 $date = userdate($entry->timemodified, $strftimerecent);
118 echo "<p><font size=1>$date - $entry->firstname $entry->lastname<br>";
119 echo "\"<a href=\"$CFG->wwwroot/mod/glossary/$entry->url\">";
120 echo "$entry->concept";
121 echo "</a>\"</font></p>";
122 }
123 }
124
125 return $content;
126}
127
128function glossary_cron () {
129/// Function to be run periodically according to the moodle cron
130/// This function searches for things that need to be done, such
131/// as sending out mail, toggling flags etc ...
132
133 global $CFG;
134
135 return true;
136}
137
138function glossary_grades($glossaryid) {
139/// Must return an array of grades for a given instance of this module,
140/// indexed by user. It also returns a maximum allowed grade.
141
142 $return->grades = NULL;
143 $return->maxgrade = NULL;
144
145 return $return;
146}
147
148
149//////////////////////////////////////////////////////////////////////////////////////
150/// Any other glossary functions go here. Each of them must have a name that
151/// starts with glossary_
152
153function glossary_log_info($log) {
154 global $CFG;
155 return get_record_sql("SELECT g.*, u.firstname, u.lastname
156 FROM {$CFG->prefix}glossary_entries g,
157 {$CFG->prefix}user u
158 WHERE g.glossaryid = '$log->info'
159 AND u.id = '$log->userid'");
160}
161
162function glossary_get_entries($glossaryid, $entrylist) {
163 global $CFG;
164
165 return get_records_sql("SELECT id,userid,concept,definition,format
166 FROM {$CFG->prefix}glossary_entries
167 WHERE glossaryid = '$glossaryid'
168 AND id IN ($entrylist)");
169}
170
fb443f1a 171function glossary_print_entry($course, $cm, $glossary, $entry,$currentview="",$cat="") {
e179048e 172 global $THEME, $USET, $CFG;
173
174 $PermissionGranted = 0;
175 $formatfile = "$CFG->dirroot/mod/glossary/formats/$glossary->displayformat.php";
176 $functionname = "glossary_print_entry_by_format";
177
178 if ( $glossary->displayformat > 0 ) {
179 if ( file_exists($formatfile) ) {
180 include_once($formatfile);
181 if (function_exists($functionname) ) {
182 $PermissionGranted = 1;
183 }
184 }
07842023 185 } else {
e179048e 186 $PermissionGranted = 1;
07842023 187 }
06d94a52 188
e179048e 189 if ( $glossary->displayformat > 0 and $PermissionGranted ) {
fb443f1a 190 glossary_print_entry_by_format($course, $cm, $glossary, $entry,$currentview,$cat);
07842023 191 } else {
fb443f1a 192 glossary_print_entry_by_default($course, $cm, $glossary, $entry,$currentview,$cat);
07842023 193 }
07842023 194
07842023 195}
196
fb443f1a 197function glossary_print_entry_by_default($course, $cm, $glossary, $entry,$currentview="",$cat="") {
07842023 198 global $THEME, $USER;
199
200 $colour = $THEME->cellheading2;
201
202 echo "\n<TR>";
e179048e 203 echo "<TD WIDTH=100% BGCOLOR=\"#FFFFFF\">";
204 if ($entry->attachment) {
205 $entry->course = $course->id;
206 echo "<table border=0 align=right><tr><td>";
207 echo glossary_print_attachments($entry,"html");
208 echo "</td></tr></table>";
209 }
210 echo "<b>$entry->concept</b>: ";
07842023 211 echo format_text($entry->definition, $entry->format);
fb443f1a 212 glossary_print_entry_icons($course, $cm, $glossary, $entry,$currentview,$cat);
07842023 213 echo "</td>";
214 echo "</TR>";
215}
216
fb443f1a 217function glossary_print_entry_icons($course, $cm, $glossary, $entry,$currentview="",$cat="") {
07842023 218 global $THEME, $USER;
219
220 if (isteacher($course->id) or $glossary->studentcanpost and $entry->userid == $USER->id) {
221 echo "<p align=right>";
222 if (isteacher($course->id) and !$glossary->mainglossary) {
223 $mainglossary = get_record("glossary","mainglossary",1,"course",$course->id);
224 if ( $mainglossary ) {
07842023 225
fb443f1a 226 echo "<a href=\"exportentry.php?id=$cm->id&entry=$entry->id&currentview=$currentview&cat=$cat\"><img alt=\"" . get_string("exporttomainglossary","glossary") . "\"src=\"export.gif\" height=11 width=11 border=0></a> ";
07842023 227
228 }
229 }
fb443f1a 230 echo "<a href=\"deleteentry.php?id=$cm->id&mode=delete&entry=$entry->id&currentview=$currentview&cat=$cat\"><img alt=\"" . get_string("delete") . "\"src=\"../../pix/t/delete.gif\" height=11 width=11 border=0></a> ";
231 echo "<a href=\"edit.php?id=$cm->id&e=$entry->id&currentview=$currentview&cat=$cat\"><img alt=\"" . get_string("edit") . "\" src=\"../../pix/t/edit.gif\" height=11 width=11 border=0></a>";
07842023 232 }
233}
234
235function glossary_search_entries($searchterms, $glossary, $includedefinition) {
236/// Returns a list of entries found using an array of search terms
237/// eg word +word -word
238///
239
240 global $CFG;
241
242 if (!isteacher($glossary->course)) {
243 $glossarymodule = get_record("modules", "name", "glossary");
6a22879b 244 $onlyvisible = " AND g.id = cm.instance AND cm.visible = 1 AND cm.module = $glossarymodule->id";
07842023 245 $onlyvisibletable = ", {$CFG->prefix}course_modules cm";
246 } else {
247
248 $onlyvisible = "";
249 $onlyvisibletable = "";
250 }
251
252 /// Some differences in syntax for PostgreSQL
253 if ($CFG->dbtype == "postgres7") {
254 $LIKE = "ILIKE"; // case-insensitive
255 $NOTLIKE = "NOT ILIKE"; // case-insensitive
256 $REGEXP = "~*";
257 $NOTREGEXP = "!~*";
258 } else {
259 $LIKE = "LIKE";
260 $NOTLIKE = "NOT LIKE";
261 $REGEXP = "REGEXP";
262 $NOTREGEXP = "NOT REGEXP";
263 }
264
265 $conceptsearch = "";
266 $definitionsearch = "";
267
268
269 foreach ($searchterms as $searchterm) {
270 if (strlen($searchterm) < 2) {
271 continue;
272 }
273 if ($conceptsearch) {
274 $conceptsearch.= " OR ";
275 }
276 if ($definitionsearch) {
277 $definitionsearch.= " OR ";
278 }
279
280 if (substr($searchterm,0,1) == "+") {
281 $searchterm = substr($searchterm,1);
282 $conceptsearch.= " e.concept $REGEXP '(^|[^a-zA-Z0-9])$searchterm([^a-zA-Z0-9]|$)' ";
283 $definitionsearch .= " e.definition $REGEXP '(^|[^a-zA-Z0-9])$searchterm([^a-zA-Z0-9]|$)' ";
284 } else if (substr($searchterm,0,1) == "-") {
285 $searchterm = substr($searchterm,1);
286 $conceptsearch .= " e.concept $NOTREGEXP '(^|[^a-zA-Z0-9])$searchterm([^a-zA-Z0-9]|$)' ";
287 $definitionsearch .= " e.definition $NOTREGEXP '(^|[^a-zA-Z0-9])$searchterm([^a-zA-Z0-9]|$)' ";
288 } else {
289 $conceptsearch .= " e.concept $LIKE '%$searchterm%' ";
290 $definitionsearch .= " e.definition $LIKE '%$searchterm%' ";
291 }
292 }
293
294 if ( !$includedefinition ) {
295 $definitionsearch = "0";
296 }
297
298 $selectsql = "{$CFG->prefix}glossary_entries e,
299 {$CFG->prefix}glossary g $onlyvisibletable
300 WHERE ($conceptsearch OR $definitionsearch)
301 AND e.glossaryid = g.id $onlyvisible
302 AND g.id = $glossary->id";
303
304 $totalcount = count_records_sql("SELECT COUNT(*) FROM $selectsql");
305
306 return get_records_sql("SELECT e.concept, e.definition, e.userid, e.timemodified, e.id, e.format FROM
307 $selectsql ORDER BY e.concept ASC $limit");
308}
309
310function glossary_get_participants($glossaryid) {
311//Returns the users with data in one glossary
312//(users with records in glossary_entries, students)
313
314 global $CFG;
315
316 //Get students
317 $students = get_records_sql("SELECT DISTINCT u.*
318 FROM {$CFG->prefix}user u,
319 {$CFG->prefix}glossary_entries g
320 WHERE g.glossaryid = '$glossaryid' and
321 u.id = g.userid");
322
323 //Return students array (it contains an array of unique users)
324 return ($students);
325}
326
e179048e 327
328function glossary_file_area_name($entry) {
329// Creates a directory file name, suitable for make_upload_directory()
330 global $CFG;
331
332 return "$entry->course/$CFG->moddata/glossary/$entry->glossaryid/$entry->id";
333}
334
335function glossary_file_area($entry) {
336 return make_upload_directory( glossary_file_area_name($entry) );
337}
338
339function glossary_delete_old_attachments($entry, $exception="") {
340// Deletes all the user files in the attachments area for a entry
341// EXCEPT for any file named $exception
342
343 if ($basedir = glossary_file_area($entry)) {
344 if ($files = get_directory_list($basedir)) {
345 foreach ($files as $file) {
346 if ($file != $exception) {
347 unlink("$basedir/$file");
348// notify("Existing file '$file' has been deleted!");
349 }
350 }
351 }
352 if (!$exception) { // Delete directory as well, if empty
353 rmdir("$basedir");
354 }
355 }
356}
357
358function glossary_copy_attachments($entry, $newentry) {
359/// Given a entry object that is being copied to glossaryid,
360/// this function checks that entry
361/// for attachments, and if any are found, these are
362/// copied to the new glossary directory.
363
364 global $CFG;
365
366 $return = true;
367
368 if ($entries = get_records_select("glossary_entries", "id = '$entry->id' AND attachment <> ''")) {
369 foreach ($entries as $curentry) {
370 $oldentry->id = $entry->id;
371 $oldentry->course = $entry->course;
372 $oldentry->glossaryid = $curentry->glossaryid;
373 $oldentrydir = "$CFG->dataroot/".glossary_file_area_name($oldentry);
374 if (is_dir($oldentrydir)) {
375
376 $newentrydir = glossary_file_area($newentry);
377 if (! copy("$oldentrydir/$newentry->attachment", "$newentrydir/$newentry->attachment")) {
378 $return = false;
379 }
380 }
381 }
382 }
383 return $return;
384}
385
386function glossary_move_attachments($entry, $glossaryid) {
387/// Given a entry object that is being moved to glossaryid,
388/// this function checks that entry
389/// for attachments, and if any are found, these are
390/// moved to the new glossary directory.
391
392 global $CFG;
393
394 $return = true;
395
396 if ($entries = get_records_select("glossary_entries", "glossaryid = '$entry->id' AND attachment <> ''")) {
397 foreach ($entries as $entry) {
398 $oldentry->course = $entry->course;
399 $oldentry->glossaryid = $entry->glossaryid;
400 $oldentrydir = "$CFG->dataroot/".glossary_file_area_name($oldentry);
401 if (is_dir($oldentrydir)) {
402 $newentry = $oldentry;
403 $newentry->glossaryid = $glossaryid;
404 $newentrydir = "$CFG->dataroot/".glossary_file_area_name($newentry);
405 if (! @rename($oldentrydir, $newentrydir)) {
406 $return = false;
407 }
408 }
409 }
410 }
411 return $return;
412}
413
414function glossary_add_attachment($entry, $newfile) {
415// $entry is a full entry record, including course and glossary
416// $newfile is a full upload array from $_FILES
417// If successful, this function returns the name of the file
418
419 global $CFG;
420
421 if (empty($newfile['name'])) {
422 return "";
423 }
424
425 $newfile_name = clean_filename($newfile['name']);
426
427 if (valid_uploaded_file($newfile)) {
428 if (! $newfile_name) {
429 notify("This file had a wierd filename and couldn't be uploaded");
430
431 } else if (! $dir = glossary_file_area($entry)) {
432 notify("Attachment could not be stored");
433 $newfile_name = "";
434
435 } else {
436 if (move_uploaded_file($newfile['tmp_name'], "$dir/$newfile_name")) {
437 chmod("$dir/$newfile_name", $CFG->directorypermissions);
438 glossary_delete_old_attachments($entry, $newfile_name);
439 } else {
440 notify("An error happened while saving the file on the server");
441 $newfile_name = "";
442 }
443 }
444 } else {
445 $newfile_name = "";
446 }
447
448 return $newfile_name;
449}
450
451function glossary_print_attachments($entry, $return=NULL) {
452// if return=html, then return a html string.
453// if return=text, then return a text-only string.
454// otherwise, print HTML for non-images, and return image HTML
455
456 global $CFG;
457
458 $filearea = glossary_file_area_name($entry);
459
460 $imagereturn = "";
461 $output = "";
462
463 if ($basedir = glossary_file_area($entry)) {
464 if ($files = get_directory_list($basedir)) {
465 $strattachment = get_string("attachment", "glossary");
466 $strpopupwindow = get_string("popupwindow");
467 foreach ($files as $file) {
468 $icon = mimeinfo("icon", $file);
469 if ($CFG->slasharguments) {
470 $ffurl = "file.php/$filearea/$file";
471 } else {
472 $ffurl = "file.php?file=/$filearea/$file";
473 }
474 $image = "<img border=0 src=\"$CFG->wwwroot/files/pix/$icon\" height=16 width=16 alt=\"$strpopupwindow\">";
475
476 if ($return == "html") {
477 $output .= "<a target=_image href=\"$CFG->wwwroot/$ffurl\">$image</a> ";
478 $output .= "<a target=_image href=\"$CFG->wwwroot/$ffurl\">$file</a><br />";
479 } else if ($return == "text") {
480 $output .= "$strattachment $file:\n$CFG->wwwroot/$ffurl\n";
481
482 } else {
483 if ($icon == "image.gif") { // Image attachments don't get printed as links
484 $imagereturn .= "<br /><img src=\"$CFG->wwwroot/$ffurl\">";
485 } else {
486 link_to_popup_window("/$ffurl", "attachment", $image, 500, 500, $strattachment);
487 echo "<a target=_image href=\"$CFG->wwwroot/$ffurl\">$file</a>";
488 echo "<br />";
489 }
490 }
491 }
492 }
493 }
494
495 if ($return) {
496 return $output;
497 }
498
499 return $imagereturn;
500}
501
06d94a52 502function print_tabbed_table_start($data, $CurrentTab, $tTHEME = NULL) {
503
504if ( !$tTHEME ) {
505 global $THEME;
506 $tTHEME = $THEME;
507}
508
509$TableColor = $tTHEME->TabTableBGColor;
510$TableWidth = $tTHEME->TabTableWidth;
511$CurrentTabColor = $tTHEME->ActiveTabColor;
512$TabColor = $tTHEME->InactiveTabColor;
513$TabsPerRow = $tTHEME->TabsPerRow;
514$TabSeparation = $tTHEME->TabSeparation;
515
516$Tabs = count($data);
517$TabWidth = (int) (100 / $TabsPerRow);
518
519$CurrentRow = ( $CurrentTab - ( $CurrentTab % $TabsPerRow) ) / $TabsPerRow;
520
521$NumRows = (int) ( $Tabs / $TabsPerRow ) + 1;
522
523?>
524 <center>
525 <table border="0" cellpadding="0" cellspacing="0" width="<? p($TableWidth) ?>">
526 <tr>
527 <td width="100%">
528
529 <table border="0" cellpadding="0" cellspacing="0" width="100%">
530
531<?
532$TabProccessed = 0;
533for ($row = 0; $row < $NumRows; $row++) {
534 echo "<tr>\n";
535 if ( $row != $CurrentRow ) {
536 for ($col = 0; $col < $TabsPerRow; $col++) {
537 if ( $TabProccessed < $Tabs ) {
538 if ($TabProccessed == $CurrentTab) {
539 $CurrentColor = $CurrentTabColor;
540 } else {
541 $CurrentColor = $TabColor;
542 }
543 ?>
544 <td width="<? p($TabWidth) ?>%" bgcolor="<? p($CurrentColor) ?>" align="center">
545 <b><a href="<? p($data[$TabProccessed]->link) ?>"><? p($data[$TabProccessed]->caption) ?></a></b></td>
546 <? if ($col < $TabsPerRow) { ?>
547 <td width="<? p($TabSeparation) ?>" align="center">&nbsp;</td>
548 <? }
549 } else {
550 $CurrentColor = "";
551 }
552 $TabProccessed++;
553 }
554 } else {
555 $FirstTabInCurrentRow = $TabProccessed;
556 $TabProccessed += $TabsPerRow;
557 }
558 echo "</tr><tr><td colspan=" . (2* $TabsPerRow) . " ></td></tr>\n";
559}
560 echo "<tr>\n";
561 $TabProccessed = $FirstTabInCurrentRow;
562 for ($col = 0; $col < $TabsPerRow; $col++) {
563 if ( $TabProccessed < $Tabs ) {
564 if ($TabProccessed == $CurrentTab) {
565 $CurrentColor = $CurrentTabColor;
566 } else {
567 $CurrentColor = $TabColor;
568 }
569 ?>
570 <td width="<? p($TabWidth) ?>%" bgcolor="<? p($CurrentColor) ?>" align="center">
571 <b><a href="<? p($data[$TabProccessed]->link) ?>"><? p($data[$TabProccessed]->caption) ?></a></b></td>
572 <? if ($col < $TabsPerRow) { ?>
573 <td width="<? p($TabSeparation) ?>" align="center">&nbsp;</td>
574 <? }
575 } else {
576 if ($NumRows > 1) {
577 $CurrentColor = $TabColor;
578 } else {
579 $CurrentColor = "";
580 }
581 echo "<td colspan = " . (2 * ($TabsPerRow - $col)) . " bgcolor=\"$CurrentColor\" align=\"center\">";
582 echo "</td>";
583
584 $col = $TabsPerRow;
585 }
586 $TabProccessed++;
587 }
588 echo "</tr>\n";
589 ?>
590
591 </table>
592 </td>
593 </tr>
594 <tr>
595 <td width="100%" bgcolor="<? p($TableColor) ?>"><hr></td>
596 </tr>
597 <tr>
598 <td width="100%" bgcolor="<? p($TableColor) ?>">
599 <center>
600<?
601}
602
603function print_tabbed_table_end() {
604 echo "</center><p></td></tr></table></center>";
605}
606
fb443f1a 607function glossary_print_alphabet_menu($cm, $glossary, $l) {
608global $CFG, $THEME;
609 $strselectletter = get_string("selectletter", "glossary");
610 $strspecial = get_string("special", "glossary");
611 $strallentries = get_string("allentries", "glossary");
612
613 echo "<CENTER>$strselectletter";
614
615 if ( $glossary->showspecial ) {
616 if ( $l == "SPECIAL" ) {
617 echo "<p><b>$strspecial</b> | ";
618 } else {
619 echo "<p><a href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&l=SPECIAL\">$strspecial</a> | ";
620 }
621 }
622
623 if ( $glossary->showalphabet ) {
624 $alphabet = explode("|", get_string("alphabet","glossary"));
625 $letters_by_line = 14;
626 for ($i = 0; $i < count($alphabet); $i++) {
627 if ( $l == $alphabet[$i] ) {
628 echo "<b>$alphabet[$i]</b>";
629 } else {
630 echo "<a href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&l=$alphabet[$i]\">$alphabet[$i]</a>";
631 }
632 if ((int) ($i % $letters_by_line) != 0 or $i == 0) {
633 echo " | ";
634 } else {
635 echo "<br>";
636 }
637 }
638 }
639
640 if ( $glossary->showall ) {
641 if ( $l == "ALL" ) {
642 echo "<b>$strallentries</b></p>";
643 } else {
644 echo "<a href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&l=ALL\">$strallentries</a></p>";
645 }
646 }
647}
648function glossary_print_categories_menu($course, $cm, $glossary, $category) {
649global $CFG, $THEME;
650 echo "<table border=0 width=100%>";
651 echo "<tr>";
652
653 echo "<td align=center width=20%>";
654 if ( isteacher($course->id) ) {
655 $options['id'] = $cm->id;
656 $options['cat'] = $cat;
657 echo print_single_button("editcategories.php", $options, get_string("editcategories","glossary"), "get");
658 }
659 echo "</td>";
660
661 echo "<td align=center width=60%>";
662 echo "<b>";
663 if ( $category ) {
664 echo $category->name;
665 } else {
666 echo get_string("entrieswithoutcategory","glossary");
667 }
668 echo "</b></td>";
669 echo "<td align=center width=20%>";
670 $menu[0] = get_string("nocategorized","glossary");
671
672 $categories = get_records("glossary_categories", "glossaryid", $glossary->id, "name ASC");
673 if ( $categories ) {
674 foreach ($categories as $currentcategory) {
675 $url = $currentcategory->id;
676 if ($currentcategory->id == $category->id) {
677 $selected = $url;
678 }
679 $menu[$url] = $currentcategory->name;
680 }
681 }
682
683 echo popup_form("$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&currentview=categories&cat=", $menu, "catmenu", $selected, get_string("jumpto"),
684 "", "", false);
685
686 echo "</td>";
687 echo "</tr>";
688
689 echo "<tr><td colspan=3><hr></td></tr>";
690 echo "</table>";
691}
e179048e 692?>