2004-09-12 16:24:41 +00:00
< ? php // $Id$
2003-09-29 17:45:42 +00:00
require_once ( " ../../config.php " );
require_once ( " lib.php " );
2003-11-15 15:55:47 +00:00
optional_variable ( $concept );
2003-11-09 03:29:25 +00:00
optional_variable ( $courseid , 0 );
2003-11-15 15:55:47 +00:00
optional_variable ( $eid , 0 );
2003-11-18 00:41:35 +00:00
optional_variable ( $displayformat , - 1 );
2003-09-29 17:45:42 +00:00
2004-05-15 17:27:50 +00:00
if ( $CFG -> forcelogin ) {
require_login ();
}
2004-07-27 17:19:47 +00:00
if ( $eid ) {
2004-08-26 15:21:57 +00:00
$entry = get_record ( " glossary_entries " , " id " , $eid );
$glossary = get_record ( 'glossary' , 'id' , $entry -> glossaryid );
$entry -> glossaryname = $glossary -> name ;
$entries [] = $entry ;
2004-07-27 17:19:47 +00:00
} else if ( $concept ) {
2004-08-26 15:21:57 +00:00
$entries = glossary_get_entries_search ( $concept , $courseid );
2004-07-27 17:19:47 +00:00
}
2004-08-26 15:21:57 +00:00
foreach ( $entries as $key => $entry ) {
//$entries[$key]->footer = "<p align=\"right\">» <a onClick=\"if (window.opener) {window.opener.location.href='$CFG->wwwroot/mod/glossary/view.php?g=$entry->glossaryid'; return false;} else {openpopup('/mod/glossary/view.php?g=$entry->glossaryid', 'glossary', 'menubar=1,location=1,toolbar=1,scrollbars=1,directories=1,status=1,resizable=1', 0); return false;}\" href=\"$CFG->wwwroot/mod/glossary/view.php?g=$entry->glossaryid\" target=\"_blank\">$entry->glossaryname</a></p>"; // Could not get this to work satisfactorily in all cases - Martin
$entries [ $key ] -> footer = " <p align= \" right \" >» <a target= \" _blank \" href= \" $CFG->wwwroot /mod/glossary/view.php?g= $entry->glossaryid\ " > $entry -> glossaryname </ a ></ p > " ;
2004-07-27 17:19:47 +00:00
}
2004-01-16 11:39:40 +00:00
if ( ! empty ( $courseid )) {
2004-05-02 02:25:04 +00:00
$course = get_record ( " course " , " id " , $courseid );
if ( $course -> category ) {
2004-05-02 02:13:58 +00:00
require_login ( $courseid );
}
2004-01-17 10:18:12 +00:00
$strglossaries = get_string ( " modulenameplural " , " glossary " );
$strsearch = get_string ( " search " );
$CFG -> framename = " newwindow " ;
2004-05-02 02:25:04 +00:00
if ( $course -> category ) {
2004-08-26 15:21:57 +00:00
print_header ( strip_tags ( " $course->shortname : $strglossaries $strsearch " ), " $course->fullname " ,
2004-05-02 02:25:04 +00:00
" <a target= \" newwindow \" href= \" $CFG->wwwroot /course/view.php?id= $course->id\ " > $course -> shortname </ a > -> $strglossaries -> $strsearch " , " " , " " , true, " & nbsp ; " , " & nbsp ; " );
} else {
2004-08-26 15:21:57 +00:00
print_header ( strip_tags ( " $course->shortname : $strglossaries $strsearch " ), " $course->fullname " ,
2004-05-02 02:25:04 +00:00
" $strglossaries -> $strsearch " , " " , " " , true , " " , " " );
}
2004-01-17 10:18:12 +00:00
} else {
print_header (); // Needs to be something here to allow linking back to the whole glossary
2004-01-16 11:39:40 +00:00
}
2004-01-30 07:29:08 +00:00
if ( $entries ) {
2003-11-18 00:41:35 +00:00
glossary_print_dynaentry ( $courseid , $entries , $displayformat );
2003-11-15 15:55:47 +00:00
}
2003-09-29 17:45:42 +00:00
close_window_button ();
2004-01-30 07:29:08 +00:00
?>