- Minor changes adopting moodle's naming and coding conventions (perhaps not fully adopted yet)
- Solving bug that traspose All Categories with Not Categorised view.
$string['modulename'] = "Glossary";
$string['modulenameplural'] = "Glossaries";
$string['newglossaryentries'] = "New glossary entries:";
-$string['nocategorized'] = "Not categorised";
+$string['notcategorised'] = "Not categorised";
$string['noentries'] = "No entries found in this section";
$string['noentry'] = "No entry found.";
$string['searchindefinition'] = "Search definitions too";
--- /dev/null
+<P ALIGN=CENTER><B>Description</B></P>
+
+<P>It should describe the purpouse of this glossary, who will be able to post new entries, etc.
fwrite ($bf,full_tag("ID",4,false,$glossary->id));
fwrite ($bf,full_tag("MODTYPE",4,false,"glossary"));
fwrite ($bf,full_tag("NAME",4,false,$glossary->name));
+ fwrite ($bf,full_tag("INTRO",4,false,$glossary->INTRO));
fwrite ($bf,full_tag("STUDENTCANPOST",4,false,$glossary->studentcanpost));
fwrite ($bf,full_tag("ALLOWDUPLICATEDENTRIES",4,false,$glossary->allowduplicatedentries));
fwrite ($bf,full_tag("DISPLAYFORMAT",4,false,$glossary->displayformat));
"ADD `sourceglossaryid` INT(10) unsigned NOT NULL DEFAULT '0' AFTER `attachment` " );
}
+
+ if ( $oldversion < 2003101500 ) {
+ execute_sql( "ALTER TABLE `{$CFG->prefix}glossary` " .
+ "ADD `intro` text NOT NULL DEFAULT '' AFTER `name` " );
+
+ }
return true;
}
id int(10) unsigned NOT NULL auto_increment,
course int(10) unsigned NOT NULL default '0',
name varchar(255) NOT NULL default '',
+ intro text NOT NULL,
studentcanpost tinyint(2) unsigned NOT NULL default '0',
allowduplicatedentries tinyint(2) unsigned NOT NULL default '0',
displayformat tinyint(2) unsigned NOT NULL default '0',
id number(10) primary key,
course number(10) default '0' not null,
name varchar2(255) default '' not null,
+ intro varchar2(255) default '' not null,
studentcanpost number(2) default '0' not null,
allowduplicatedentries number(2) default '0' not null,
displayformat number(2) default '0' not null,
.
/
-insert into prefix_glossary(course,name,studentcanpost,allowduplicatedentries,displayformat,mainglossary,showspecial,showall,showalphabet,timecreated,timemodified) values(1,'1',1,1,1,1,1,1,1,1,1);
-insert into prefix_glossary(course,name,studentcanpost,allowduplicatedentries,displayformat,mainglossary,showspecial,showall,showalphabet,timecreated,timemodified) values(2,'2',2,2,2,2,2,2,2,2,2);
-insert into prefix_glossary(course,name,studentcanpost,allowduplicatedentries,displayformat,mainglossary,showspecial,showall,showalphabet,timecreated,timemodified) values(3,'3',3,3,3,3,3,3,3,3,3);
-insert into prefix_glossary(course,name,studentcanpost,allowduplicatedentries,displayformat,mainglossary,showspecial,showall,showalphabet,timecreated,timemodified) values(4,'4',4,4,4,4,4,4,4,4,4);
+insert into prefix_glossary(course,name,intro,studentcanpost,allowduplicatedentries,displayformat,mainglossary,showspecial,showall,showalphabet,timecreated,timemodified) values(1,'1','1',1,1,1,1,1,1,1,1,1);
+insert into prefix_glossary(course,name,intro,studentcanpost,allowduplicatedentries,displayformat,mainglossary,showspecial,showall,showalphabet,timecreated,timemodified) values(2,'2','2',2,2,2,2,2,2,2,2,2);
+insert into prefix_glossary(course,name,intro,studentcanpost,allowduplicatedentries,displayformat,mainglossary,showspecial,showall,showalphabet,timecreated,timemodified) values(3,'3','3',3,3,3,3,3,3,3,3,3);
+insert into prefix_glossary(course,name,intro,studentcanpost,allowduplicatedentries,displayformat,mainglossary,showspecial,showall,showalphabet,timecreated,timemodified) values(4,'4','4',4,4,4,4,4,4,4,4,4);
select * from prefix_glossary order by 1,2;
id SERIAL,
course int4 NOT NULL default '0',
name varchar(255) NOT NULL default '',
+ intro text NOT NULL default '',
studentcanpost int2 NOT NULL default '0',
allowduplicatedentries int2 NOT NULL default '0',
displayformat int2 NOT NULL default '0',
<?php
global $CFG, $THEME;
require_once("../../config.php");
+ require_once("lib.php");
?>
<FORM name="theform" method="post" <?=$onsubmit ?> action="edit.php" enctype="multipart/form-data">
<table class=generalbox cellpadding=5 bgcolor="<?php p($THEME->cellheading)?>">
<?php
$categories = get_records("glossary_categories","glossaryid",$glossary->id);
echo "<select size=\"6\" name=\"categories[]\" multiple=\"yes\">";
- echo "<option value=0>" . get_string("nocategorized","glossary") . "</optioon>";
+ echo "<option value=\"0\">" . get_string("nocategorized","glossary") . "</optioon>";
if ( $categories ) {
foreach ( $categories as $category ) {
$newentry->timemodified = time();
$newentry->teacherentry = isteacher($course->id,$USER->id);
- $PermissionGranted = 1;
+ $permissiongranted = 1;
if ( !$glossary->allowduplicatedentries ) {
$dupentries = get_records("glossary_entries","UCASE(concept)", strtoupper($newentry->concept));
if ($dupentries) {
foreach ($dupentries as $curentry) {
if ( $glossary->id == $curentry->glossaryid ) {
if ( $curentry->id != $entry ) {
- $PermissionGranted = 0;
+ $permissiongranted = 0;
}
}
}
}
}
- if ( $PermissionGranted ) {
+ if ( $permissiongranted ) {
$newentry->attachment = $_FILES["attachment"];
if ($newfilename = glossary_add_attachment($newentry, $newentry->attachment)) {
$newentry->attachment = $newfilename;
$newentry->teacherentry = isteacher($course->id,$USER->id);
$newentry->sourceglossaryid = 0;
- $PermissionGranted = 1;
+ $permissiongranted = 1;
if ( !$glossary->allowduplicatedentries ) {
$dupentries = get_record("glossary_entries","UCASE(concept)", strtoupper($newentry->concept), "glossaryid", $glossary->id);
if ($dupentries) {
- $PermissionGranted = 0;
+ $permissiongranted = 0;
}
}
- if ( $PermissionGranted ) {
+ if ( $permissiongranted ) {
if (! $newentry->id = insert_record("glossary_entries", $newentry)) {
error("Could not insert this new entry");
} else {
require_once("$CFG->dirroot/files/mimetypes.php");
-$tCFG->TabTableBGColor = $THEME->cellcontent2;
-$tCFG->TabTableWidth = "70%";
-$tCFG->ActiveTabColor = $THEME->cellcontent2;
-$tCFG->InactiveTabColor = $THEME->cellheading2;
-$tCFG->TabsPerRow = 5;
-$tCFG->TabSeparation = 4;
+define("GLOSSARY_SHOW_ALL_CATEGORIES", 0);
+define("GLOSSARY_SHOW_NOT_CATEGORISED", -1);
+define("GLOSSARY_STANDARD_VIEW", 0);
+define("GLOSSARY_CATEGORY_VIEW", 1);
function glossary_add_instance($glossary) {
/// Given an object containing all the necessary data,
function glossary_print_entry($course, $cm, $glossary, $entry,$currentview="",$cat="") {
global $THEME, $USER, $CFG;
- $PermissionGranted = 0;
+ $permissiongranted = 0;
$formatfile = "$CFG->dirroot/mod/glossary/formats/$glossary->displayformat.php";
$functionname = "glossary_print_entry_by_format";
if ( file_exists($formatfile) ) {
include_once($formatfile);
if (function_exists($functionname) ) {
- $PermissionGranted = 1;
+ $permissiongranted = 1;
}
}
} else {
- $PermissionGranted = 1;
+ $permissiongranted = 1;
}
- if ( $glossary->displayformat > 0 and $PermissionGranted ) {
+ if ( $glossary->displayformat > 0 and $permissiongranted ) {
glossary_print_entry_by_format($course, $cm, $glossary, $entry,$currentview,$cat);
} else {
glossary_print_entry_by_default($course, $cm, $glossary, $entry,$currentview,$cat);
function glossary_print_entry_icons($course, $cm, $glossary, $entry,$currentview="",$cat="") {
global $THEME, $USER;
- $ImportedEntry = ($entry->sourceglossaryid == $glossary->id);
- $IsTeacher = isteacher($course->id);
- $IsMainGlossary = $glossary->mainglossary;
+ $importedentry = ($entry->sourceglossaryid == $glossary->id);
+ $isteacher = isteacher($course->id);
+ $ismainglossary = $glossary->mainglossary;
- if ($IsTeacher or $glossary->studentcanpost and $entry->userid == $USER->id) {
+ if ($isteacher or $glossary->studentcanpost and $entry->userid == $USER->id) {
echo "<p align=right>";
// only teachers can export entries so check it out
- if ($IsTeacher and !$IsMainGlossary and !$ImportedEntry) {
+ if ($isteacher and !$ismainglossary and !$importedentry) {
$mainglossary = get_record("glossary","mainglossary",1,"course",$course->id);
if ( $mainglossary ) { // if there is a main glossary defined, allow to export the current entry
}
// Exported entries can be updated/deleted only by teachers in the main glossary
- if ( !$ImportedEntry and ($IsTeacher or !$IsMainGlossary) ) {
+ if ( !$importedentry and ($isteacher or !$ismainglossary) ) {
echo "<a href=\"deleteentry.php?id=$cm->id&mode=delete&entry=$entry->id¤tview=$currentview&cat=$cat\"><img alt=\"" . get_string("delete") . "\"src=\"";
echo $icon;
echo "\" height=11 width=11 border=0></a> ";
echo "<a href=\"edit.php?id=$cm->id&e=$entry->id¤tview=$currentview&cat=$cat\"><img alt=\"" . get_string("edit") . "\" src=\"../../pix/t/edit.gif\" height=11 width=11 border=0></a>";
- } elseif ( $ImportedEntry ) {
+ } elseif ( $importedentry ) {
echo "<font size=-1>" . get_string("exportedentry","glossary") . "</font>";
}
}
return $imagereturn;
}
-function glossary_print_tabbed_table_start($data, $CurrentTab, $tTHEME = NULL) {
+function glossary_print_tabbed_table_start($data, $currenttab, $tTHEME = NULL) {
if ( !$tTHEME ) {
global $THEME;
$tTHEME = $THEME;
}
-$TableColor = $tTHEME->TabTableBGColor;
-$TableWidth = $tTHEME->TabTableWidth;
-$CurrentTabColor = $tTHEME->ActiveTabColor;
-$TabColor = $tTHEME->InactiveTabColor;
-$TabsPerRow = $tTHEME->TabsPerRow;
-$TabSeparation = $tTHEME->TabSeparation;
+$tablecolor = $tTHEME->TabTableBGColor;
+$currenttabcolor = $tTHEME->ActiveTabColor;
+$tabcolor = $tTHEME->InactiveTabColor;
+$inactivefontcolor = $tTHEME->InactiveFontColor;
-$Tabs = count($data);
-$TabWidth = (int) (100 / $TabsPerRow);
+$tablewidth = $tTHEME->TabTableWidth;
+$tabsperrow = $tTHEME->TabsPerRow;
+$tabseparation = $tTHEME->TabSeparation;
-$CurrentRow = ( $CurrentTab - ( $CurrentTab % $TabsPerRow) ) / $TabsPerRow;
+$tabs = count($data);
+$tabwidth = (int) (100 / $tabsperrow);
-$NumRows = (int) ( $Tabs / $TabsPerRow ) + 1;
+$currentrow = ( $currenttab - ( $currenttab % $tabsperrow) ) / $tabsperrow;
+
+$numrows = (int) ( $tabs / $tabsperrow ) + 1;
?>
<center>
- <table border="0" cellpadding="0" cellspacing="0" width="<?php p($TableWidth) ?>">
+ <table border="0" cellpadding="0" cellspacing="0" width="<?php p($tablewidth) ?>">
<tr>
<td width="100%">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<?php
-$TabProccessed = 0;
-for ($row = 0; $row < $NumRows; $row++) {
+$tabproccessed = 0;
+for ($row = 0; $row < $numrows; $row++) {
echo "<tr>\n";
- if ( $row != $CurrentRow ) {
- for ($col = 0; $col < $TabsPerRow; $col++) {
- if ( $TabProccessed < $Tabs ) {
+ if ( $row != $currentrow ) {
+ for ($col = 0; $col < $tabsperrow; $col++) {
+ if ( $tabproccessed < $tabs ) {
if ( $col == 0 ) {
- echo "<td width=\"$TabSeparation\" align=\"center\"> </td>";
+ echo "<td width=\"$tabseparation\" align=\"center\"> </td>";
}
- if ($TabProccessed == $CurrentTab) {
- $CurrentColor = $CurrentTabColor;
+ if ($tabproccessed == $currenttab) {
+ $currentcolor = $currenttabcolor;
} else {
- $CurrentColor = $TabColor;
+ $currentcolor = $tabcolor;
}
-
- echo "<td width=\"$TabWidth%\" bgcolor=\"$CurrentColor\" align=\"center\"><b>";
- if ($TabProccessed != $CurrentTab) {
- echo "<a href=\"" . $data[$TabProccessed]->link . "\">";
+ echo "<td width=\"$tabwidth%\" bgcolor=\"$currentcolor\" align=\"center\"><b>";
+ if ($tabproccessed != $currenttab and $data[$tabproccessed]->link) {
+ echo "<a href=\"" . $data[$tabproccessed]->link . "\">";
}
- echo $data[$TabProccessed]->caption;
- if ($TabProccessed != $CurrentTab) {
+
+ if ( !$data[$tabproccessed]->link ) {
+ echo "<font color=\"$inactivefontcolor\">";
+ }
+ echo $data[$tabproccessed]->caption;
+ if ( !$data[$tabproccessed]->link ) {
+ echo "</font>";
+ }
+
+ if ($tabproccessed != $currenttab and $data[$tabproccessed]->link) {
echo "</a>";
}
echo "</b></td>";
- if ( $col < $TabsPerRow ) {
- echo "<td width=\"$TabSeparation\" align=\"center\"> </td>";
+ if ( $col < $tabsperrow ) {
+ echo "<td width=\"$tabseparation\" align=\"center\"> </td>";
}
} else {
- $CurrentColor = "";
+ $currentcolor = "";
}
- $TabProccessed++;
+ $tabproccessed++;
}
} else {
- $FirstTabInCurrentRow = $TabProccessed;
- $TabProccessed += $TabsPerRow;
+ $firsttabincurrentrow = $tabproccessed;
+ $tabproccessed += $tabsperrow;
}
- echo "</tr><tr><td colspan=" . (2* $TabsPerRow) . " ></td></tr>\n";
+ echo "</tr><tr><td colspan=" . (2* $tabsperrow) . " ></td></tr>\n";
}
echo "<tr>\n";
- $TabProccessed = $FirstTabInCurrentRow;
- for ($col = 0; $col < $TabsPerRow; $col++) {
- if ( $TabProccessed < $Tabs ) {
+ $tabproccessed = $firsttabincurrentrow;
+ for ($col = 0; $col < $tabsperrow; $col++) {
+ if ( $tabproccessed < $tabs ) {
if ( $col == 0 ) {
- echo "<td width=\"$TabSeparation\" align=\"center\"> </td>";
+ echo "<td width=\"$tabseparation\" align=\"center\"> </td>";
}
- if ($TabProccessed == $CurrentTab) {
- $CurrentColor = $CurrentTabColor;
+ if ($tabproccessed == $currenttab) {
+ $currentcolor = $currenttabcolor;
} else {
- $CurrentColor = $TabColor;
+ $currentcolor = $tabcolor;
}
- echo "<td width=\"$TabWidth%\" bgcolor=\"$CurrentColor\" align=\"center\"><b>";
- if ($TabProccessed != $CurrentTab) {
- echo "<a href=\"" . $data[$TabProccessed]->link . "\">";
+ echo "<td width=\"$tabwidth%\" bgcolor=\"$currentcolor\" align=\"center\"><b>";
+ if ($tabproccessed != $currenttab and $data[$tabproccessed]->link) {
+ echo "<a href=\"" . $data[$tabproccessed]->link . "\">";
}
- echo $data[$TabProccessed]->caption;
- if ($TabProccessed != $CurrentTab) {
+
+ if ( !$data[$tabproccessed]->link ) {
+ echo "<font color=\"$inactivefontcolor\">";
+ }
+ echo $data[$tabproccessed]->caption;
+ if ( !$data[$tabproccessed]->link ) {
+ echo "</font>";
+ }
+
+ if ($tabproccessed != $currenttab and $data[$tabproccessed]->link) {
echo "</a>";
}
echo "</b></td>";
- if ($col < $TabsPerRow) {
- echo "<td width=\"$TabSeparation\" align=\"center\"> </td>";
+ if ($col < $tabsperrow) {
+ echo "<td width=\"$tabseparation\" align=\"center\"> </td>";
}
} else {
- if ($NumRows > 1) {
- $CurrentColor = $TabColor;
+ if ($numrows > 1) {
+ $currentcolor = $tabcolor;
} else {
- $CurrentColor = "";
+ $currentcolor = "";
}
- echo "<td colspan = " . (2 * ($TabsPerRow - $col)) . " bgcolor=\"$CurrentColor\" align=\"center\">";
+ echo "<td colspan = " . (2 * ($tabsperrow - $col)) . " bgcolor=\"$currentcolor\" align=\"center\">";
echo "</td>";
- $col = $TabsPerRow;
+ $col = $tabsperrow;
}
- $TabProccessed++;
+ $tabproccessed++;
}
echo "</tr>\n";
?>
</td>
</tr>
<tr>
- <td width="100%" bgcolor="<?php p($TableColor) ?>"><hr></td>
+ <td width="100%" bgcolor="<?php p($tablecolor) ?>"><hr></td>
</tr>
<tr>
- <td width="100%" bgcolor="<?php p($TableColor) ?>">
+ <td width="100%" bgcolor="<?php p($tablecolor) ?>">
<center>
<?php
}
echo "<td align=center width=60%>";
echo "<b>";
- $menu["-1"] = get_string("allcategories","glossary");
- $menu["0"] = get_string("nocategorized","glossary");
+ $menu[GLOSSARY_SHOW_ALL_CATEGORIES] = get_string("allcategories","glossary");
+ $menu[GLOSSARY_SHOW_NOT_CATEGORISED] = get_string("notcategorised","glossary");
$categories = get_records("glossary_categories", "glossaryid", $glossary->id, "name ASC");
if ( $categories ) {
}
}
if ( !$selected ) {
- $selected = "0";
+ $selected = GLOSSARY_SHOW_NOT_CATEGORISED;
}
if ( $category ) {
echo $category->name;
} else {
- if ( $cat < 0 ) {
- echo get_string("allcategories","glossary");
- $selected = "-1";
- } elseif ( $cat == 0 ) {
+ if ( $cat == GLOSSARY_SHOW_NOT_CATEGORISED ) {
+
echo get_string("entrieswithoutcategory","glossary");
- $selected = "0";
+ $selected = GLOSSARY_SHOW_NOT_CATEGORISED;
+
+ } elseif ( $cat == GLOSSARY_SHOW_ALL_CATEGORIES ) {
+
+ echo get_string("allcategories","glossary");
+ $selected = GLOSSARY_SHOW_ALL_CATEGORIES;
+
}
}
echo "</b></td>";
<INPUT type="text" name="name" size=30 value="<?php p($form->name) ?>">
</TD>
</TR>
+<tr valign=top>
+ <td align=right><p><b><?php print_string("description") ?>:</b></p>
+ <font size="1">
+ <?php
+ helpbutton("description", get_string("description"), "glossary", true, true);
+ echo "<br \>";
+ helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
+ echo "<br \>";
+ helpbutton("text", get_string("helptext"), "moodle", true, true);
+ ?>
+ <br />
+ </font>
+ </td>
+ <td>
+ <textarea name="intro" rows=5 cols=50 wrap="virtual"><?php p($form->intro) ?></textarea>
+ </td>
+</tr>
<!-- More rows go in here... -->
<?php
$mainglossary = get_record("glossary","mainglossary",1,"course",$form->course);
//Now, build the glossary record structure
$glossary->course = $restore->course_id;
$glossary->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
+ $glossary->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
$glossary->studentcanpost = backup_todb($info['MOD']['#']['STUDENTCANPOST']['0']['#']);
$glossary->allowduplicatedentries = backup_todb($info['MOD']['#']['ALLOWDUPLICATEDENTRIES']['0']['#']);
$glossary->displayformat = backup_todb($info['MOD']['#']['DISPLAYFORMAT']['0']['#']);
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2003092400; // The current module version (Date: YYYYMMDDXX)
+$module->version = 2003101500; // The current module version (Date: YYYYMMDDXX)
$module->cron = 0; // Period for cron to check this module (secs)
-$release = "0.4 development"; // User-friendly version number
+$release = "0.5 development"; // User-friendly version number
?>
/// This page prints a particular instance of glossary
require_once("../../config.php");
require_once("lib.php");
- require_once("dynalink.php");
require_variable($id); // Course Module ID
optional_variable($l); // letter to look for
add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id");
- $search = trim(strip_tags($search));
+ $search = trim(strip_tags($search));
if ($search and !$entryid) {
$l = "";
$searchterms = explode(" ", $search); // Search for words independently
$search = "";
}
+ $alphabet = explode("|", get_string("alphabet","glossary"));
if ($l == "" and $search == "" and ($eid == "" or $eid == 0)) {
- $l = "A";
+ $l = $alphabet[0];
} elseif ($eid) {
$l = "";
}
print_heading($glossary->name);
+/// Info box
+
+ if ( $glossary->intro ) {
+ print_simple_box_start("center","70%");
+ echo '<p>';
+ echo $glossary->intro;
+ echo '</p>';
+ print_simple_box_end();
+ }
+
/// Add button
if (isteacher($course->id) or ($glossary->studentcanpost) and !isguest($course->id)) {
$data[1]->caption = get_string("categoryview", "glossary");
if ($currentview) {
- $CurrentTab = 1;
+ $currenttab = GLOSSARY_CATEGORY_VIEW; //1;
} else {
- $CurrentTab = 0;
+ $currenttab = GLOSSARY_STANDARD_VIEW; //0;
}
+ $glossary_tCFG->TabTableBGColor = $THEME->cellheading;
+ $glossary_tCFG->ActiveTabColor = $THEME->cellheading;
+ $glossary_tCFG->InactiveTabColor = $THEME->cellcontent2;
+ $glossary_tCFG->InactiveFontColor= $THEME->hidden;
+
+ $glossary_tCFG->TabTableWidth = "70%";
+ $glossary_tCFG->TabsPerRow = 5;
+ $glossary_tCFG->TabSeparation = 4;
- glossary_print_tabbed_table_start($data, $CurrentTab, $tCFG);
+ glossary_print_tabbed_table_start($data, $currenttab, $glossary_tCFG);
echo "<center>";
if ($currentview) {
glossary_print_categories_menu($course, $cm, $glossary, $cat, $category);
} else {
glossary_print_alphabet_menu($cm, $glossary, $l);
if ($l) {
- $CurrentLetter = "";
+ $currentletter = "";
} elseif ($search) {
echo "<h3>$strsearch: $search</h3>";
}
$allentries = glossary_search_entries($searchterms, $glossary, $includedefinition);
} elseif ($eid) { // looking for an entry
$allentries = get_records("glossary_entries", "id", $eid);
- } elseif ($currentview and $cat == -1) { // Browsing all categories
+ } elseif ($currentview and $cat == GLOSSARY_SHOW_ALL_CATEGORIES) { // Browsing all categories
$sql = "SELECT gec.id gecid, gc.name, gc.id CID, ge.*
FROM {$CFG->prefix}glossary_entries ge,
{$CFG->prefix}glossary_entries_categories gec,
}
if ($allentries) {
- $DumpedDefinitions = 0;
+ $dumpeddefinitions = 0;
foreach ($allentries as $entry) {
- $DumpToScreen = 0;
- $FirstLetter = strtoupper(substr(ltrim($entry->concept), 0, strlen($l)));
+ $dumptoscreen = 0;
+ $firstletter = strtoupper(substr(ltrim($entry->concept), 0, strlen($l)));
if ($l) {
- if ($l == "ALL" or $FirstLetter == $l) {
- if ($CurrentLetter != $FirstLetter[0]) {
- $CurrentLetter = $FirstLetter[0];
+ if ($l == "ALL" or $firstletter == $l) {
+ if ($currentletter != $firstletter[0]) {
+ $currentletter = $firstletter[0];
if ($glossary->displayformat == 0) {
- if ($DumpedDefinitions > 0) {
+ if ($dumpeddefinitions > 0) {
echo "</table></center><p>";
}
echo "\n<center><table border=0 cellspacing=0 width=95% valign=top cellpadding=10><tr><td align=center bgcolor=\"$THEME->cellheading2\">";
}
if ($l == "ALL") {
- echo "<b>$CurrentLetter</b>";
+ echo "<b>$currentletter</b>";
}
if ($glossary->displayformat == 0) {
echo "\n</center></td></tr></table></center>";
- if ($DumpedDefinitions > 0) {
+ if ($dumpeddefinitions > 0) {
echo "\n<center><table border=1 cellspacing=0 width=95% valign=top cellpadding=10>";
}
}
}
- $DumpToScreen = 1;
- } elseif ($l == "SPECIAL" and ord($FirstLetter) != ord("Ñ") and
- (ord($FirstLetter) < ord("A") or ord($FirstLetter) > ord("Z"))) {
- $DumpToScreen = 1;
+ $dumptoscreen = 1;
+ } elseif ($l == "SPECIAL" and ord($firstletter) != ord("Ñ") and
+ (ord($firstletter) < ord("A") or ord($firstletter) > ord("Z"))) {
+ $dumptoscreen = 1;
}
} else {
if ($currentview) {
- if ($category) {
+ if ($category) { // if we are browsing a category
if (record_exists("glossary_entries_categories", "entryid", $entry->id, "categoryid", $category->id)) {
- $DumpToScreen = 1;
+ $dumptoscreen = 1;
}
- } else {
- if ($cat < 0) { // No categorized
+ } else {
+ if ($cat == GLOSSARY_SHOW_NOT_CATEGORISED) { // Not categorized
if (! record_exists("glossary_entries_categories", "entryid", $entry->id)) {
- $DumpToScreen = 1;
+ $dumptoscreen = 1;
}
} else { // All categories
if ($currentcategory != $entry->CID) {
$currentcategory = $entry->CID;
if ($glossary->displayformat == 0) {
- if ($DumpedDefinitions > 0) {
+ if ($dumpeddefinitions > 0) {
echo "</table></center><p>";
}
echo "\n<center><table border=0 cellspacing=0 width=95% valign=top cellpadding=10><tr><td align=center bgcolor=\"$THEME->cellheading2\">";
if ($glossary->displayformat == 0) {
echo "\n</center></td></tr></table></center>";
- if ($DumpedDefinitions > 0) {
+ if ($dumpeddefinitions > 0) {
echo "\n<center><table border=1 cellspacing=0 width=95% valign=top cellpadding=10>";
}
}
- $DumpToScreen = 1;
+ $dumptoscreen = 1;
}
}
} else {
- $DumpToScreen = 1;
+ $dumptoscreen = 1;
}
}
- if ($DumpToScreen) {
- $DumpedDefinitions++;
+ if ($dumptoscreen) {
+ $dumpeddefinitions++;
$concept = $entry->concept;
$definition = $entry->definition;
- if ($DumpedDefinitions == 1) {
+ if ($dumpeddefinitions == 1) {
if ($glossary->displayformat == 0) {
echo "\n<center><table border=1 cellspacing=0 width=95% valign=top cellpadding=10>";
}
$entry->concept = highlight($search, $concept);
$entry->definition = highlight($search, $definition);
}
- if (!$glossary->mainglossary) {
- $entry->definition = glossary_dynamic_link($course->id, $definition);
- }
glossary_print_entry($course, $cm, $glossary, $entry, $currentview, $cat);
}
}
}
- if (! $DumpedDefinitions) {
+ if (! $dumpeddefinitions) {
print_simple_box_start("center", "70%", "$THEME->cellheading");
if (!$search) {
echo "<center>$strnoentries</center>";