2004-05-14 19:36:39 +00:00
|
|
|
<?php // $Id$
|
2003-09-16 03:07:21 +00:00
|
|
|
/// This page prints a particular instance of glossary
|
|
|
|
require_once("../../config.php");
|
|
|
|
require_once("lib.php");
|
2004-05-09 22:20:05 +00:00
|
|
|
require_once("$CFG->dirroot/rss/rsslib.php");
|
|
|
|
|
2003-11-21 18:42:38 +00:00
|
|
|
global $CFG, $THEME, $USER;
|
2003-11-15 15:55:47 +00:00
|
|
|
$debug = 0;
|
2003-11-19 17:36:00 +00:00
|
|
|
$CFG->startpagetime = microtime();
|
2003-11-18 00:41:35 +00:00
|
|
|
|
2004-04-18 05:54:33 +00:00
|
|
|
optional_variable($id); // Course Module ID
|
|
|
|
optional_variable($g); // Glossary ID
|
|
|
|
|
2003-11-15 15:55:47 +00:00
|
|
|
optional_variable($tab,GLOSSARY_NO_VIEW); // browsing entries by categories?
|
2003-10-19 03:40:36 +00:00
|
|
|
|
2003-11-19 17:36:00 +00:00
|
|
|
optional_variable($mode,""); // [ "term" | "entry" | "cat" | "date" |
|
2003-11-15 15:55:47 +00:00
|
|
|
// "letter" | "search" | "author" | "approval" ]
|
|
|
|
optional_variable($hook,""); // the term, entry, cat, etc... to look for based on mode
|
2003-10-19 03:40:36 +00:00
|
|
|
|
2003-11-15 15:55:47 +00:00
|
|
|
optional_variable($fullsearch,0); // full search (concept and definition) when searching?
|
|
|
|
|
|
|
|
optional_variable($sortkey,""); // Sorted view:
|
2003-11-16 17:13:19 +00:00
|
|
|
// [ CREATION | UPDATE | FIRSTNAME | LASTNAME |
|
|
|
|
// concept | timecreated | ... ]
|
2003-11-15 15:55:47 +00:00
|
|
|
optional_variable($sortorder,""); // it defines the order of the sorting (ASC or DESC)
|
|
|
|
|
2003-11-18 00:41:35 +00:00
|
|
|
optional_variable($offset,0); // entries to bypass (for paging purpouses)
|
2003-11-04 18:38:22 +00:00
|
|
|
|
2003-11-18 00:41:35 +00:00
|
|
|
optional_variable($show,""); // [ concept | alias ] => mode=term hook=$show
|
|
|
|
optional_variable($displayformat,-1); // override of the glossary display format
|
2003-11-16 17:13:19 +00:00
|
|
|
|
2004-08-29 22:57:41 +00:00
|
|
|
$mode = strip_tags(urldecode($mode)); //XSS
|
|
|
|
$hook = strip_tags(urldecode($hook)); //XSS
|
|
|
|
$fullsearch = strip_tags(urldecode($fullsearch)); //XSS
|
|
|
|
$sortkey = strip_tags(urldecode($sortkey)); //XSS
|
|
|
|
$sortorder = strip_tags(urldecode($sortorder)); //XSS
|
|
|
|
$offset = strip_tags(urldecode($offset)); //XSS
|
|
|
|
$show = strip_tags(urldecode($show)); //XSS
|
|
|
|
|
2004-04-18 05:54:33 +00:00
|
|
|
if (!empty($id)) {
|
|
|
|
if (! $cm = get_record("course_modules", "id", $id)) {
|
|
|
|
error("Course Module ID was incorrect");
|
|
|
|
}
|
|
|
|
if (! $course = get_record("course", "id", $cm->course)) {
|
|
|
|
error("Course is misconfigured");
|
|
|
|
}
|
|
|
|
if (! $glossary = get_record("glossary", "id", $cm->instance)) {
|
|
|
|
error("Course module is incorrect");
|
|
|
|
}
|
|
|
|
} else if (!empty($g)) {
|
|
|
|
if (! $glossary = get_record("glossary", "id", $g)) {
|
|
|
|
error("Course module is incorrect");
|
|
|
|
}
|
|
|
|
if (! $course = get_record("course", "id", $glossary->course)) {
|
|
|
|
error("Could not determine which course this belonged to!");
|
|
|
|
}
|
|
|
|
if (!$cm = get_coursemodule_from_instance("glossary", $glossary->id, $course->id)) {
|
|
|
|
error("Could not determine which course module this belonged to!");
|
|
|
|
}
|
2004-08-26 15:21:57 +00:00
|
|
|
$id = $cm->id;
|
2004-04-18 05:54:33 +00:00
|
|
|
} else {
|
|
|
|
error("Must specify glossary ID or course module ID");
|
|
|
|
}
|
2004-05-15 17:27:50 +00:00
|
|
|
|
|
|
|
if ($CFG->forcelogin) {
|
|
|
|
require_login();
|
|
|
|
}
|
2003-10-08 03:13:12 +00:00
|
|
|
|
2003-11-15 15:55:47 +00:00
|
|
|
/// redirecting if adding a new entry
|
|
|
|
if ($tab == GLOSSARY_ADDENTRY_VIEW ) {
|
2004-09-16 17:13:57 +00:00
|
|
|
redirect("edit.php?id=$cm->id&mode=$mode");
|
2003-11-15 15:55:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// setting the defaut number of entries per page if not set
|
|
|
|
|
|
|
|
if ( !$entriesbypage = $glossary->entbypage ) {
|
2003-11-18 13:49:31 +00:00
|
|
|
$entriesbypage = $CFG->glossary_entbypage;
|
2003-11-15 15:55:47 +00:00
|
|
|
}
|
|
|
|
|
2003-11-19 17:36:00 +00:00
|
|
|
/// setting the default values for the display mode of the current glossary
|
|
|
|
/// only if the glossary is viewed by the first time
|
2004-07-27 17:19:47 +00:00
|
|
|
if ( $dp = get_record('glossary_formats','name', $glossary->displayformat) ) {
|
2003-11-19 17:36:00 +00:00
|
|
|
$printpivot = $dp->showgroup;
|
|
|
|
if ( $mode == '' and $hook == '' and $show == '') {
|
|
|
|
$mode = $dp->defaultmode;
|
|
|
|
$hook = $dp->defaulthook;
|
|
|
|
$sortkey = $dp->sortkey;
|
|
|
|
$sortorder = $dp->sortorder;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$printpivot = 1;
|
2003-11-19 17:47:40 +00:00
|
|
|
if ( $mode == '' and $hook == '' and $show == '') {
|
|
|
|
$mode = 'letter';
|
|
|
|
$hook = 'ALL';
|
|
|
|
}
|
2003-11-19 17:36:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( $displayformat == -1 ) {
|
|
|
|
$displayformat = $glossary->displayformat;
|
|
|
|
}
|
2003-11-15 15:55:47 +00:00
|
|
|
|
2003-11-19 17:36:00 +00:00
|
|
|
if ( $show ) {
|
|
|
|
$mode = 'term';
|
|
|
|
$hook = $show;
|
|
|
|
$show = '';
|
|
|
|
}
|
2003-11-15 15:55:47 +00:00
|
|
|
/// Processing standard security processes
|
|
|
|
$navigation = "";
|
2003-11-09 03:35:36 +00:00
|
|
|
if ($course->category) {
|
2003-11-15 15:55:47 +00:00
|
|
|
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
|
2003-11-09 03:35:36 +00:00
|
|
|
require_login($course->id);
|
|
|
|
}
|
2003-09-23 12:34:47 +00:00
|
|
|
if (!$cm->visible and !isteacher($course->id)) {
|
2003-09-21 17:08:41 +00:00
|
|
|
notice(get_string("activityiscurrentlyhidden"));
|
2003-10-08 03:13:12 +00:00
|
|
|
}
|
2004-09-16 17:13:57 +00:00
|
|
|
add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id&tab=$tab", $glossary->id, $cm->id);
|
2003-10-22 04:15:08 +00:00
|
|
|
|
2003-11-15 15:55:47 +00:00
|
|
|
/// stablishing flag variables
|
2003-10-21 04:55:22 +00:00
|
|
|
if ( $sortorder = strtolower($sortorder) ) {
|
2003-10-22 04:15:08 +00:00
|
|
|
if ($sortorder != 'asc' and $sortorder != 'desc') {
|
|
|
|
$sortorder = '';
|
2003-10-19 03:40:36 +00:00
|
|
|
}
|
|
|
|
}
|
2003-10-21 04:55:22 +00:00
|
|
|
if ( $sortkey = strtoupper($sortkey) ) {
|
2003-11-16 17:13:19 +00:00
|
|
|
if ($sortkey != 'CREATION' and
|
|
|
|
$sortkey != 'UPDATE' and
|
|
|
|
$sortkey != 'FIRSTNAME' and
|
|
|
|
$sortkey != 'LASTNAME'
|
|
|
|
) {
|
2003-10-22 04:15:08 +00:00
|
|
|
$sortkey = '';
|
2003-10-21 04:55:22 +00:00
|
|
|
}
|
2003-10-19 03:40:36 +00:00
|
|
|
}
|
2003-10-28 16:10:36 +00:00
|
|
|
|
2003-11-15 15:55:47 +00:00
|
|
|
switch ( $mode = strtolower($mode) ) {
|
|
|
|
case 'search': /// looking for terms containing certain word(s)
|
|
|
|
$tab = GLOSSARY_STANDARD_VIEW;
|
2003-10-21 04:55:22 +00:00
|
|
|
|
2003-11-15 15:55:47 +00:00
|
|
|
$searchterms = explode(' ', $hook); // Search for words independently
|
2003-09-16 03:07:21 +00:00
|
|
|
foreach ($searchterms as $key => $searchterm) {
|
|
|
|
if (strlen($searchterm) < 2) {
|
|
|
|
unset($searchterms[$key]);
|
2003-10-08 03:13:12 +00:00
|
|
|
}
|
|
|
|
}
|
2003-11-15 15:55:47 +00:00
|
|
|
$hook = trim(implode(' ', $searchterms));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'entry': /// Looking for a certain entry id
|
2003-11-03 02:26:44 +00:00
|
|
|
$tab = GLOSSARY_STANDARD_VIEW;
|
2004-07-27 17:19:47 +00:00
|
|
|
if ( $dp = get_record("glossary_formats","name", $glossary->displayformat) ) {
|
|
|
|
$displayformat = $dp->popupformatname;
|
2003-11-19 17:36:00 +00:00
|
|
|
}
|
2003-11-15 15:55:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'cat': /// Looking for a certain cat
|
|
|
|
$tab = GLOSSARY_CATEGORY_VIEW;
|
|
|
|
if ( $hook > 0 ) {
|
|
|
|
$category = get_record("glossary_categories","id",$hook);
|
|
|
|
}
|
|
|
|
break;
|
2003-10-21 04:55:22 +00:00
|
|
|
|
2003-11-15 15:55:47 +00:00
|
|
|
case 'approval': /// Looking for entries waiting for approval
|
|
|
|
$tab = GLOSSARY_APPROVAL_VIEW;
|
|
|
|
if ( !$hook and !$sortkey and !$sortorder) {
|
|
|
|
$hook = 'ALL';
|
2003-10-22 04:15:08 +00:00
|
|
|
}
|
2003-11-15 15:55:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'term': /// Looking for entries that include certain term in its concept, definition or aliases
|
|
|
|
$tab = GLOSSARY_STANDARD_VIEW;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'date':
|
|
|
|
$tab = GLOSSARY_DATE_VIEW;
|
|
|
|
if ( !$sortkey ) {
|
|
|
|
$sortkey = 'UPDATE';
|
2003-10-08 03:13:12 +00:00
|
|
|
}
|
2003-11-15 15:55:47 +00:00
|
|
|
if ( !$sortorder ) {
|
|
|
|
$sortorder = 'desc';
|
|
|
|
}
|
|
|
|
break;
|
2003-10-08 03:13:12 +00:00
|
|
|
|
2003-11-15 15:55:47 +00:00
|
|
|
case 'author': /// Looking for entries, browsed by author
|
|
|
|
$tab = GLOSSARY_AUTHOR_VIEW;
|
|
|
|
if ( !$hook ) {
|
|
|
|
$hook = 'ALL';
|
|
|
|
}
|
2003-11-16 17:13:19 +00:00
|
|
|
if ( !$sortkey ) {
|
|
|
|
$sortkey = 'FIRSTNAME';
|
|
|
|
}
|
|
|
|
if ( !$sortorder ) {
|
|
|
|
$sortorder = 'asc';
|
|
|
|
}
|
2003-11-15 15:55:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'letter': /// Looking for entries that begin with a certain letter, ALL or SPECIAL characters
|
|
|
|
default:
|
|
|
|
$tab = GLOSSARY_STANDARD_VIEW;
|
|
|
|
if ( !$hook ) {
|
|
|
|
$hook = 'ALL';
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ( $tab ) {
|
|
|
|
case GLOSSARY_IMPORT_VIEW:
|
|
|
|
case GLOSSARY_EXPORT_VIEW:
|
|
|
|
case GLOSSARY_APPROVAL_VIEW:
|
|
|
|
$isuserframe = 0;
|
|
|
|
break;
|
2003-10-08 03:13:12 +00:00
|
|
|
|
2003-11-15 15:55:47 +00:00
|
|
|
default:
|
|
|
|
$isuserframe = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Printing the heading
|
2003-10-08 03:13:12 +00:00
|
|
|
$strglossaries = get_string("modulenameplural", "glossary");
|
|
|
|
$strglossary = get_string("modulename", "glossary");
|
|
|
|
$strallcategories = get_string("allcategories", "glossary");
|
|
|
|
$straddentry = get_string("addentry", "glossary");
|
|
|
|
$strnoentries = get_string("noentries", "glossary");
|
|
|
|
$strsearchconcept = get_string("searchconcept", "glossary");
|
|
|
|
$strsearchindefinition = get_string("searchindefinition", "glossary");
|
|
|
|
$strsearch = get_string("search");
|
|
|
|
|
2003-09-29 03:06:30 +00:00
|
|
|
print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname",
|
2004-09-12 16:24:41 +00:00
|
|
|
"$navigation <a href=\"index.php?id=$course->id\">$strglossaries</a> -> $glossary->name",
|
2003-10-08 03:13:12 +00:00
|
|
|
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
|
|
|
|
navmenu($course, $cm));
|
2004-05-09 22:20:05 +00:00
|
|
|
|
|
|
|
//If rss are activated at site and glossary level and this glossary has rss defined, show link
|
2004-07-27 17:19:47 +00:00
|
|
|
if (isset($CFG->enablerssfeeds) && isset($CFG->glossary_enablerssfeeds) &&
|
2004-10-04 22:21:30 +00:00
|
|
|
$CFG->enablerssfeeds && $CFG->glossary_enablerssfeeds && $glossary->rsstype && $glossary->rssarticles) {
|
2004-05-09 22:20:05 +00:00
|
|
|
echo '<table width="100%" border="0" cellpadding="3" cellspacing="0"><tr valign="top"><td align="right">';
|
|
|
|
$tooltiptext = get_string("rsssubscriberss","glossary",$glossary->name);
|
2004-10-04 22:21:30 +00:00
|
|
|
rss_print_link($course->id, $USER->id, "glossary", $glossary->id, $tooltiptext);
|
2004-05-09 22:20:05 +00:00
|
|
|
echo '</td></tr></table>';
|
|
|
|
}
|
2003-10-08 03:13:12 +00:00
|
|
|
|
2003-11-01 20:27:21 +00:00
|
|
|
echo '<p align="center"><font size="3"><b>' . stripslashes_safe($glossary->name);
|
2003-11-18 13:49:31 +00:00
|
|
|
if ( $isuserframe and $mode != 'search') {
|
2003-11-03 02:26:44 +00:00
|
|
|
/// the "Print" icon
|
2004-09-16 17:13:57 +00:00
|
|
|
echo " <a title =\"". get_string("printerfriendly","glossary") . "\" target=\"printview\" href=\"print.php?id=$cm->id&mode=$mode&hook=$hook&sortkey=$sortkey&sortorder=$sortorder&offset=$offset\">";
|
|
|
|
echo '<img border="0" src="print.gif" alt="" /></a>';
|
2003-11-03 02:26:44 +00:00
|
|
|
}
|
2003-11-01 20:27:21 +00:00
|
|
|
echo '</b></font></p>';
|
|
|
|
|
2003-10-15 16:12:38 +00:00
|
|
|
/// Info box
|
|
|
|
if ( $glossary->intro ) {
|
2003-11-21 04:55:32 +00:00
|
|
|
echo '<table align="center" width="70%" bgcolor="#FFFFFF" class="generaltab"><tr><td>';
|
2003-10-26 08:06:16 +00:00
|
|
|
echo format_text($glossary->intro);
|
2003-10-15 16:12:38 +00:00
|
|
|
print_simple_box_end();
|
2003-10-21 04:55:22 +00:00
|
|
|
}
|
2003-10-15 16:12:38 +00:00
|
|
|
|
2003-10-08 03:13:12 +00:00
|
|
|
/// Search box
|
2003-11-18 13:49:31 +00:00
|
|
|
// echo '<p>';
|
2004-09-12 16:24:41 +00:00
|
|
|
echo '<table align="center" width="70%" bgcolor="' . $THEME->cellheading .'" class="generalbox"><tr><td align="center">';
|
2003-11-18 13:49:31 +00:00
|
|
|
|
2003-11-26 14:42:47 +00:00
|
|
|
echo '<p align="center">';
|
2003-10-08 03:13:12 +00:00
|
|
|
echo '<form method="POST" action="view.php">';
|
2004-09-12 14:41:49 +00:00
|
|
|
echo '<input type="submit" value="'.$strsearch.'" name="searchbutton" /> ';
|
2004-03-31 08:14:10 +00:00
|
|
|
if ($mode == 'search') {
|
2004-09-12 14:41:49 +00:00
|
|
|
echo '<input type="text" name="hook" size="20" value="'.$hook.'" /> ';
|
2004-03-31 08:14:10 +00:00
|
|
|
} else {
|
2004-09-12 14:41:49 +00:00
|
|
|
echo '<input type="text" name="hook" size="20" value="" /> ';
|
2004-03-31 08:14:10 +00:00
|
|
|
}
|
|
|
|
if ($fullsearch) {
|
|
|
|
$fullsearchchecked = 'checked="checked"';
|
|
|
|
} else {
|
|
|
|
$fullsearchchecked = '';
|
|
|
|
}
|
2004-09-12 14:41:49 +00:00
|
|
|
echo '<input type="checkbox" name="fullsearch" value="1" '.$fullsearchchecked.' />';
|
|
|
|
echo '<input type="hidden" name="mode" value="search" />';
|
|
|
|
echo '<input type="hidden" name="id" value="'.$cm->id.'" />';
|
2003-11-15 15:55:47 +00:00
|
|
|
echo $strsearchindefinition;
|
2003-10-08 03:13:12 +00:00
|
|
|
echo '</form>';
|
|
|
|
echo '</p>';
|
2003-11-15 15:55:47 +00:00
|
|
|
print_simple_box_end();
|
2003-09-21 17:08:41 +00:00
|
|
|
|
2003-11-03 02:26:44 +00:00
|
|
|
include("tabs.html");
|
2003-09-16 03:07:21 +00:00
|
|
|
|
2003-11-18 13:49:31 +00:00
|
|
|
include_once("sql.php");
|
2003-11-15 15:55:47 +00:00
|
|
|
|
|
|
|
/// printing the entries
|
|
|
|
$entriesshown = 0;
|
|
|
|
$currentpivot = '';
|
2004-05-20 19:51:23 +00:00
|
|
|
$ratingsmenuused = NULL;
|
|
|
|
$paging = NULL;
|
2004-09-09 18:31:50 +00:00
|
|
|
|
2003-10-08 03:13:12 +00:00
|
|
|
if ($allentries) {
|
2004-09-09 18:31:50 +00:00
|
|
|
|
2003-11-15 15:55:47 +00:00
|
|
|
/// printing the paging links
|
2003-11-21 02:50:08 +00:00
|
|
|
|
2003-11-18 13:49:31 +00:00
|
|
|
$paging = get_string("allentries","glossary");
|
|
|
|
if ( $offset < 0 ) {
|
|
|
|
$paging = '<strong>' . $paging . '</strong>';
|
|
|
|
} else {
|
2004-09-16 17:13:57 +00:00
|
|
|
$paging = "<a href=\"view.php?id=$id&mode=$mode&hook=$hook&offset=-1&sortkey=$sortkey&sortorder=$sortorder&fullsearch=$fullsearch\">" . $paging . '</a>';
|
2003-11-18 13:49:31 +00:00
|
|
|
}
|
2004-09-09 18:31:50 +00:00
|
|
|
if ($count > $entriesbypage ) {
|
2003-11-04 18:38:22 +00:00
|
|
|
for ($i = 0; ($i*$entriesbypage) < $count ; $i++ ) {
|
|
|
|
if ( $paging != '' ) {
|
2003-11-18 13:49:31 +00:00
|
|
|
if ($i % 20 == 0 and $i) {
|
2004-09-12 14:41:49 +00:00
|
|
|
$paging .= '<br />';
|
2003-11-04 18:38:22 +00:00
|
|
|
} else {
|
|
|
|
$paging .= ' | ';
|
|
|
|
}
|
|
|
|
}
|
2003-11-18 13:49:31 +00:00
|
|
|
$pagenumber = (string) ($i + 1 );
|
2003-11-04 18:38:22 +00:00
|
|
|
if ($offset / $entriesbypage == $i) {
|
2003-11-18 13:49:31 +00:00
|
|
|
$paging .= '<strong>' . $pagenumber . '</strong>';
|
2003-11-04 18:38:22 +00:00
|
|
|
} else {
|
2004-09-16 17:13:57 +00:00
|
|
|
$paging .= "<a href=\"view.php?id=$id&mode=$mode&hook=$hook&offset=" . ($i*$entriesbypage) . "&sortkey=$sortkey&sortorder=$sortorder&fullsearch=$fullsearch\">" . $pagenumber . '</a>';
|
2003-11-04 18:38:22 +00:00
|
|
|
}
|
|
|
|
}
|
2004-09-12 16:24:41 +00:00
|
|
|
$paging = "<font size=\"1\"><center>" . get_string ("jumpto") . " $paging</center></font>";
|
2003-11-18 13:49:31 +00:00
|
|
|
} else {
|
|
|
|
$paging = '';
|
2003-11-04 18:38:22 +00:00
|
|
|
}
|
2003-11-18 03:41:09 +00:00
|
|
|
echo $paging;
|
2003-11-15 15:55:47 +00:00
|
|
|
|
2003-11-21 18:42:38 +00:00
|
|
|
$ratings = NULL;
|
|
|
|
$ratingsmenuused = false;
|
|
|
|
if ($glossary->assessed and !empty($USER->id)) {
|
|
|
|
if ($ratings->scale = make_grades_menu($glossary->scale)) {
|
|
|
|
$ratings->assesstimestart = $glossary->assesstimestart;
|
|
|
|
$ratings->assesstimefinish = $glossary->assesstimefinish;
|
|
|
|
}
|
2003-11-23 01:01:29 +00:00
|
|
|
if ($glossary->assessed == 2 and !isteacher($course->id)) {
|
|
|
|
$ratings->allow = false;
|
|
|
|
} else {
|
|
|
|
$ratings->allow = true;
|
|
|
|
}
|
|
|
|
|
2004-09-12 16:24:41 +00:00
|
|
|
echo "<form name=\"form\" method=\"post\" action=\"rate.php\">";
|
|
|
|
echo "<input type=\"hidden\" name=\"id\" value=\"$course->id\" />";
|
2003-11-21 18:42:38 +00:00
|
|
|
}
|
|
|
|
|
2003-09-16 03:07:21 +00:00
|
|
|
foreach ($allentries as $entry) {
|
2004-09-09 18:31:50 +00:00
|
|
|
|
|
|
|
/// Setting the pivot for the current entry
|
2003-11-15 15:55:47 +00:00
|
|
|
$pivot = $entry->pivot;
|
|
|
|
if ( !$fullpivot ) {
|
|
|
|
$pivot = $pivot[0];
|
|
|
|
}
|
|
|
|
|
2004-09-09 18:31:50 +00:00
|
|
|
/// if there's a group break
|
|
|
|
if ( $currentpivot != strtoupper($pivot) ) {
|
|
|
|
|
|
|
|
// print the group break if apply
|
|
|
|
if ( $printpivot ) {
|
|
|
|
$currentpivot = strtoupper($pivot);
|
|
|
|
|
|
|
|
echo '<p>';
|
|
|
|
echo '<table width="95%" border="0" class="generaltabselected" bgcolor="' . $THEME->cellheading2 . '">';
|
|
|
|
|
|
|
|
echo '<tr>';
|
|
|
|
$pivottoshow = $currentpivot;
|
|
|
|
if ( isset($entry->uid) ) {
|
|
|
|
// printing the user icon if defined (only when browsing authors)
|
|
|
|
echo '<td align="left">';
|
|
|
|
|
|
|
|
$user = get_record("user","id",$entry->uid);
|
|
|
|
print_user_picture($user->id, $course->id, $user->picture);
|
|
|
|
$pivottoshow = fullname($user, isteacher($course->id));;
|
|
|
|
} else {
|
|
|
|
echo '<td align="center">';
|
2003-10-21 04:55:22 +00:00
|
|
|
}
|
2003-11-16 17:13:19 +00:00
|
|
|
|
2004-09-09 18:31:50 +00:00
|
|
|
echo "<strong> $pivottoshow</strong>" ;
|
|
|
|
echo '</td></tr></table>';
|
2003-11-16 17:13:19 +00:00
|
|
|
|
2004-09-09 18:31:50 +00:00
|
|
|
}
|
2003-11-15 15:55:47 +00:00
|
|
|
}
|
|
|
|
|
2004-09-09 18:31:50 +00:00
|
|
|
$concept = $entry->concept;
|
|
|
|
$definition = $entry->definition;
|
2003-11-15 15:55:47 +00:00
|
|
|
|
2004-09-09 18:31:50 +00:00
|
|
|
/// highlight the term if necessary
|
|
|
|
if ($mode == 'search') {
|
|
|
|
$entry->highlight = $hook;
|
|
|
|
}
|
2003-11-18 00:41:35 +00:00
|
|
|
|
2004-09-09 18:31:50 +00:00
|
|
|
/// and finally print the entry.
|
|
|
|
|
|
|
|
if ( glossary_print_entry($course, $cm, $glossary, $entry, $mode, $hook,1,$displayformat,$ratings) ) {
|
|
|
|
$ratingsmenuused = true;
|
2003-11-15 15:55:47 +00:00
|
|
|
}
|
2004-09-09 18:31:50 +00:00
|
|
|
|
|
|
|
$entriesshown++;
|
2003-11-04 18:38:22 +00:00
|
|
|
}
|
2003-11-15 15:55:47 +00:00
|
|
|
}
|
|
|
|
if ( !$entriesshown ) {
|
|
|
|
print_simple_box('<center>' . get_string("noentries","glossary") . '</center>',"center","95%");
|
|
|
|
}
|
2003-11-21 18:42:38 +00:00
|
|
|
|
|
|
|
if ($ratingsmenuused) {
|
2004-09-12 14:41:49 +00:00
|
|
|
echo "<p><center><input type=\"submit\" value=\"".get_string("sendinratings", "glossary")."\" />";
|
2003-11-21 18:42:38 +00:00
|
|
|
if ($glossary->scale < 0) {
|
|
|
|
if ($scale = get_record("scale", "id", abs($glossary->scale))) {
|
|
|
|
print_scale_menu_helpbutton($course->id, $scale );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo "</center>";
|
|
|
|
echo "</form>";
|
|
|
|
}
|
|
|
|
|
2003-11-18 03:41:09 +00:00
|
|
|
if ( $paging ) {
|
|
|
|
echo "<hr />$paging";
|
|
|
|
}
|
|
|
|
echo '<p>';
|
2003-10-22 04:15:08 +00:00
|
|
|
echo '</center>';
|
2003-10-08 03:13:12 +00:00
|
|
|
glossary_print_tabbed_table_end();
|
2003-11-19 17:36:00 +00:00
|
|
|
if ( $debug and isadmin() ) {
|
2003-11-15 15:55:47 +00:00
|
|
|
echo '<p>';
|
2004-09-12 14:41:49 +00:00
|
|
|
print_simple_box("$sqlselect<br /> $sqlfrom<br /> $sqlwhere<br /> $sqlorderby<br /> $sqllimit","center","85%");
|
2003-11-19 17:36:00 +00:00
|
|
|
|
2004-09-12 16:24:41 +00:00
|
|
|
echo "<p align=\"right\"><font size=\"-3\">";
|
2003-11-18 00:41:35 +00:00
|
|
|
echo microtime_diff($CFG->startpagetime, microtime());
|
|
|
|
echo "</font></p>";
|
|
|
|
}
|
2003-11-19 17:36:00 +00:00
|
|
|
|
2003-11-21 02:50:08 +00:00
|
|
|
/// Finish the page
|
|
|
|
print_footer($course);
|
|
|
|
|
2003-11-21 05:24:01 +00:00
|
|
|
?>
|