Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- Rewrite of the internal API in order to, hopefully, create an easy …

…way to handle the flow of data internally and externally.

- Adding a new frame: Browse by Author
- A new, friendly way to show entries (asked by Martin): view?id=cm&mode=term&hook=[concept | alias ]
- Handling user activies, outline and complete.
- Properly showing new entries in recent activity box.
- Adding a flag to categories to specify if a category should or should not be automatically linked.
- Adding some missing strings and files as well.
- Adding a field to each glossary that specify how many entries by pages it should show.
  • Loading branch information...
commit 1ac87c73976764fe43dbef8f1a0dd6ce205a3147 1 parent 45376a5
willcast authored
Showing with 880 additions and 529 deletions.
  1. +8 −1 lang/en/glossary.php
  2. +7 −0 lang/en/help/glossary/destination.html
  3. +7 −0 lang/en/help/glossary/entbypage.html
  4. +3 −0  lang/en/help/glossary/filetoimport.html
  5. +3 −0  lang/en/help/glossary/importcategories.html
  6. +5 −0 lang/en/help/glossary/index.html
  7. +5 −0 lang/en/help/glossary/linkcategory.html
  8. +3 −3 mod/glossary/approve.php
  9. +1 −0  mod/glossary/backuplib.php
  10. +21 −1 mod/glossary/comment.php
  11. +26 −26 mod/glossary/config.html
  12. +9 −0 mod/glossary/db/mysql.php
  13. +2 −0  mod/glossary/db/mysql.sql
  14. +2 −0  mod/glossary/db/postgres7.sql
  15. +2 −2 mod/glossary/deleteentry.html
  16. +7 −7 mod/glossary/deleteentry.php
  17. +3 −2 mod/glossary/dynalink.php
  18. +12 −3 mod/glossary/edit.html
  19. +11 −5 mod/glossary/edit.php
  20. +20 −1 mod/glossary/editcategories.html
  21. +25 −18 mod/glossary/editcategories.php
  22. +6 −0 mod/glossary/export.php
  23. +11 −11 mod/glossary/exportentry.php
  24. +3 −3 mod/glossary/formats/2.php
  25. +3 −3 mod/glossary/formats/3.php
  26. +3 −3 mod/glossary/formats/4.php
  27. +3 −3 mod/glossary/formats/5.php
  28. +4 −2 mod/glossary/import.php
  29. +161 −87 mod/glossary/lib.php
  30. +15 −5 mod/glossary/mod.html
  31. +20 −21 mod/glossary/print.php
  32. +1 −0  mod/glossary/restorelib.php
  33. +11 −4 mod/glossary/showentry.php
  34. +30 −9 mod/glossary/tabs.html
  35. +1 −1  mod/glossary/version.php
  36. +426 −308 mod/glossary/view.php
View
9 lang/en/glossary.php
@@ -3,15 +3,18 @@
$string['addcomment'] = "Add comment";
$string['addentry'] = "Add a new entry";
-$string['approve'] = "Approve";
+$string['addingcomment'] = "Add a comment";
$string['aliases'] = "Alias(es)";
$string['allentries'] = "ALL";
$string['allcategories'] = "All Categories";
$string['allowcomments'] = "Allow comments on entries";
$string['allowduplicatedentries'] = "Duplicated entries allowed";
$string['answer'] = "Answer";
+$string['approve'] = "Approve";
+$string['authorview'] = "Browse by Author";
$string['areyousuredelete'] = "Are you sure you want to delete this entry?";
$string['areyousuredeletecomment'] = "Are you sure you want to delete this comment?";
+$string['areyousureexport'] = "Are you sure you want to export this entry to";
$string['ascending'] = "(ascending)";
$string['attachment'] = "Attachment";
$string['back'] = "Back";
@@ -62,6 +65,7 @@
$string['editingcomment'] = "Editing comment";
$string['entries'] = "Entries";
$string['importedentries'] = "Imported entries";
+$string['entbypage'] = "Entries shown by page";
$string['entrieswithoutcategory'] = "Entries without category";
$string['entry'] = "Entry";
$string['entryalreadyexist'] = "Entry already exists";
@@ -88,11 +92,13 @@
$string['glosssaryexported'] = "Glossary exported.";
$string['importcategories'] = "Import categories";
$string['isglobal'] = "Is this glossary global?";
+$string['linkcategory'] = "Automatically link this category";
$string['mainglossary'] = "Main glossary";
$string['modulename'] = "Glossary";
$string['modulenameplural'] = "Glossaries";
$string['maxtimehaspassed'] = "Sorry, but the maximum time for editing this comment (\$a) has passed!";
$string['newglossary'] = "New glossary";
+$string['newentries'] = "New glossary entries";
$string['newglossaryentries'] = "New glossary entries:";
$string['newglossarycreated'] = "New glossary created.";
$string['notcategorised'] = "Not categorised";
@@ -101,6 +107,7 @@
$string['nocomments'] = "(No comments found on this entry)";
$string['noentries'] = "No entries found in this section";
$string['noentry'] = "No entry found.";
+$string['numberofentries'] = "Number of entries";
$string['onebyline'] = "(one by line)";
$string['printerfriendly'] = "Printer-friendly version";
$string['question'] = "Question";
View
7 lang/en/help/glossary/destination.html
@@ -0,0 +1,7 @@
+<P ALIGN=CENTER><B>Definition destination of imported entries</B></P>
+
+<P>You can specify where do you want to import the entries:</p>
+<ul>
+<li><strong>Current Glossary:</strong> Will append the imported entries to the current glossary.</li>
+<li><strong>New Glossary:</strong> Will create a new glossary based on the information found in the XML file selected and will insert the new entries on it.</li>
+</ul>
View
7 lang/en/help/glossary/entbypage.html
@@ -0,0 +1,7 @@
+<P ALIGN=CENTER><B>Defining number of entries shown by page</B></P>
+
+<P>You can specify the number of entries shown by page. This number depends on the configuration of the glossary.</p>
+
+<p>The more automatically linked entries you have, the lower this number should be in order to avoid long answer time from the application.</p>
+
+<p>Note: If you get a timout error when browsing a glossary, it probable needs to have a lower number of entries shown by page.</p>
View
3  lang/en/help/glossary/filetoimport.html
@@ -0,0 +1,3 @@
+<P ALIGN=CENTER><B>File to import</B></P>
+
+<P>Select the XML file which contains the entries to import.</p>
View
3  lang/en/help/glossary/importcategories.html
@@ -0,0 +1,3 @@
+<P ALIGN=CENTER><B>Importing categories</B></P>
+
+<P>By default, all the entries will be imported. You can specify if you want the categories to be imported as well (it will import the relationship between the imported categories and the imported entries also).</p>
View
5 lang/en/help/glossary/index.html
@@ -11,7 +11,12 @@
<li><a href="help.php?module=glossary&file=studentcanpost.html">Students can post entries</a>
<li><a href="help.php?module=glossary&file=allowcomments.html">Comments on entries</a>
<li><a href="help.php?module=glossary&file=displayformat.html">Display formats for entries</a>
+ <li><a href="help.php?module=glossary&file=entbypage.html">Number of entries shown by page</a>
<li><a href="help.php?module=glossary&file=shows.html">Browsing options in Alphabet View frame</a>
+ <li><a href="help.php?module=glossary&file=linkcategories.html">Automatically linking categories</a>
+ <li><a href="help.php?module=glossary&file=filetoimport.html">Importing entries</a>
+ <li><a href="help.php?module=glossary&file=importcategories.html">Importing categories</a>
+ <li><a href="help.php?module=glossary&file=destination.html">Destination of the entries to import</a>
</ul>
</blockquote>
View
5 lang/en/help/glossary/linkcategory.html
@@ -0,0 +1,5 @@
+<P ALIGN=CENTER><B>Automatically linking categories</B></P>
+
+<P>You can specify if you want the categories to be automatically linked or not.</p>
+
+<p>Note: Categories are linked based on a case sensitive, full whole match.</p>
View
6 mod/glossary/approve.php
@@ -6,8 +6,8 @@
require_variable($id); // Course Module ID
optional_variable($eid); // Entry ID
- optional_variable($tab,GLOSSARY_APPROVAL_VIEW);
- optional_variable($l,"ALL");
+ optional_variable($mode,"approval");
+ optional_variable($hook,"ALL");
if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect");
@@ -33,6 +33,6 @@
} else {
add_to_log($course->id, "glossary", "approve entry", "showentry.php?id=$cm->id&eid=$eid", "$eid");
}
- redirect("view.php?id=$cm->id&tab=$tab&l=$l",get_string("entryapproved","glossary"),1);
+ redirect("view.php?id=$cm->id&mode=$mode&hook=$hook",get_string("entryapproved","glossary"),1);
die;
?>
View
1  mod/glossary/backuplib.php
@@ -90,6 +90,7 @@ function backup_glossary_categories ($bf,$preferences,$glossary, $userinfo) {
fwrite ($bf,full_tag("ID",6,false,$glo_cat->id));
fwrite ($bf,full_tag("GLOSSARYID",6,false,$glo_cat->glossaryid));
fwrite ($bf,full_tag("NAME",6,false,$glo_cat->name));
+ fwrite ($bf,full_tag("USEDYNALINK",6,false,$glo_cat->usedynalink));
$status = backup_glossary_entries_categories ($bf,$preferences,$glo_cat->id);
View
22 mod/glossary/comment.php
@@ -80,8 +80,28 @@
echo "<br />";
}
- glossary_print_entry($course, $cm, $glossary, $entry);
+ echo "<p align=center>";
+ echo "<table class=\"generalbox\" width=\"70%\" align=\"center\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\">";
+ echo "<tr bgcolor=$THEME->cellheading2><td align=center>";
+ echo "<table border=0 width=100%><tr><td width=33%></td><td width=33% align=center>";
+ echo get_string("commentson","glossary") . " <b>$entry->concept</b></td>";
+ echo "<td width=33% align=right>";
+ echo "</td></tr></table>";
+
+ echo "</td></tr>";
+ echo "<tr><TD WIDTH=100% BGCOLOR=\"#FFFFFF\">";
+ if ($entry->attachment) {
+ $entry->course = $course->id;
+ echo "<table border=0 align=right><tr><td>";
+ echo glossary_print_attachments($entry,"html");
+ echo "</td></tr></table>";
+ }
+ echo "<b>$entry->concept</b>: ";
+ echo format_text($entry->definition, $entry->format);
+ echo "</td>";
+ echo "</TR></table>";
+
echo "<center>";
echo "<br />";
View
52 mod/glossary/config.html
@@ -11,20 +11,20 @@
<tr valign=top>
<td align=right><p>glossary_entbypage:</td>
<td>
- <input name=glossary_entbypage type=text size=5 value="<?php p($CFG->glossary_entbypage) ?>">
+ <input name=glossary_entbypage type=text size=3 value="<?php p($CFG->glossary_entbypage) ?>">
</td>
<td>
<?php print_string("entbypage", "glossary") ?>
</td>
</tr>
<tr valign=top>
- <td align=right><p>students_can_post_entries:</td>
+ <td align=right><p>glossary_studentspost:</td>
<td>
- <SELECT size=1 name=cnfstudentcanpost>
+ <SELECT size=1 name=glossary_studentspost>
<?php
$yselected = "";
$nselected = "";
- if ($CFG->cnfstudentcanpost) {
+ if ($CFG->glossary_studentspost) {
$yselected = " SELECTED ";
} else {
$nselected = " SELECTED ";
@@ -39,13 +39,13 @@
</td>
</tr>
<tr valign=top>
- <td align=right><p>allow_duplicated_entries:</td>
+ <td align=right><p>glossary_dupentries:</td>
<td>
- <SELECT size=1 name=cnfallowdupentries>
+ <SELECT size=1 name=glossary_dupentries>
<?php
$yselected = "";
$nselected = "";
- if ($CFG->cnfallowdupentries) {
+ if ($CFG->glossary_dupentries) {
$yselected = " SELECTED ";
} else {
$nselected = " SELECTED ";
@@ -60,13 +60,13 @@
</td>
</tr>
<tr valign=top>
- <td align=right><p>allow_comments:</td>
+ <td align=right><p>glossary_allowcomments:</td>
<td>
- <SELECT size=1 name=cngallowcomments>
+ <SELECT size=1 name=glossary_allowcomments>
<?php
$yselected = "";
$nselected = "";
- if ($CFG->cngallowcomments) {
+ if ($CFG->glossary_allowcomments) {
$yselected = " SELECTED ";
} else {
$nselected = " SELECTED ";
@@ -77,17 +77,17 @@
</SELECT>
</td>
<td>
- <?php print_string("cngallowcomments", "glossary") ?>
+ <?php print_string("cnfallowcomments", "glossary") ?>
</td>
</tr>
<tr valign=top>
- <td align=right><p>automatically_link_glossaries:</td>
+ <td align=right><p>glossary_linkbydefault:</td>
<td>
- <SELECT size=1 name=cnflinkglossaries>
+ <SELECT size=1 name=glossary_linkbydefault>
<?php
$yselected = "";
$nselected = "";
- if ($CFG->cnflinkglossaries) {
+ if ($CFG->glossary_linkbydefault) {
$yselected = " SELECTED ";
} else {
$nselected = " SELECTED ";
@@ -102,13 +102,13 @@
</td>
</tr>
<tr valign=top>
- <td align=right><p>default_approval_status:</td>
+ <td align=right><p>glossary_defaultapproval:</td>
<td>
- <SELECT size=1 name=cnfapprovalstatus>
+ <SELECT size=1 name=glossary_defaultapproval>
<?php
$yselected = "";
$nselected = "";
- if ($CFG->cnfapprovalstatus) {
+ if ($CFG->glossary_defaultapproval) {
$yselected = " SELECTED ";
} else {
$nselected = " SELECTED ";
@@ -126,13 +126,13 @@
<td colspan = 3 align=center><strong>Entry Level Default Settings</strong></td>
</tr>
<tr valign=top>
- <td align=right><p>automatically_link_entry:</td>
+ <td align=right><p>glossary_linkentries:</td>
<td>
- <SELECT size=1 name=cnflinkentry>
+ <SELECT size=1 name=glossary_linkentries>
<?php
$yselected = "";
$nselected = "";
- if ($CFG->cnflinkentry) {
+ if ($CFG->glossary_linkentries) {
$yselected = " SELECTED ";
} else {
$nselected = " SELECTED ";
@@ -147,13 +147,13 @@
</td>
</tr>
<tr valign=top>
- <td align=right><p>case_sensitive:</td>
+ <td align=right><p>glossary_casesensitive:</td>
<td>
- <SELECT size=1 name=cnfcasesensitive>
+ <SELECT size=1 name=glossary_casesensitive>
<?php
$yselected = "";
$nselected = "";
- if ($CFG->cnfcasesensitive) {
+ if ($CFG->glossary_casesensitive) {
$yselected = " SELECTED ";
} else {
$nselected = " SELECTED ";
@@ -168,13 +168,13 @@
</td>
</tr>
<tr valign=top>
- <td align=right><p>match_whole_words:</td>
+ <td align=right><p>glossary_fullmatch:</td>
<td>
- <SELECT size=1 name=cnffullmatch>
+ <SELECT size=1 name=glossary_fullmatch>
<?php
$yselected = "";
$nselected = "";
- if ($CFG->cnffullmatch) {
+ if ($CFG->glossary_fullmatch) {
$yselected = " SELECTED ";
} else {
$nselected = " SELECTED ";
View
9 mod/glossary/db/mysql.php
@@ -165,6 +165,15 @@ function glossary_upgrade($oldversion) {
PRIMARY KEY (`id`)
) TYPE=MyISAM COMMENT='entries alias'");
}
+
+ if ( $oldversion < 2003111500 ) {
+ execute_sql( "ALTER TABLE `{$CFG->prefix}glossary_categories`
+ ADD `usedynalink` TINYINT(2) UNSIGNED NOT NULL DEFAULT '1' AFTER `name`" );
+
+ execute_sql( "ALTER TABLE `{$CFG->prefix}glossary`
+ ADD `entbypage` TINYINT(3) UNSIGNED NOT NULL DEFAULT '10' AFTER `globalglossary`" );
+
+ }
return true;
}
View
2  mod/glossary/db/mysql.sql
@@ -24,6 +24,7 @@ CREATE TABLE prefix_glossary (
usedynalink tinyint(2) unsigned NOT NULL default '1',
defaultapproval tinyint(2) unsigned NOT NULL default '1',
globalglossary tinyint(2) unsigned NOT NULL default '0',
+ entbypage tinyint(3) unsigned NOT NULL default '10',
timecreated int(10) unsigned NOT NULL default '0',
timemodified int(10) unsigned NOT NULL default '0',
PRIMARY KEY (id)
@@ -71,6 +72,7 @@ CREATE TABLE prefix_glossary_categories (
id int(10) unsigned NOT NULL auto_increment,
glossaryid int(10) unsigned NOT NULL default '0',
name varchar(255) NOT NULL default '',
+ usedynalink tinyint(2) unsigned NOT NULL default '1',
PRIMARY KEY (id)
) TYPE=MyISAM COMMENT='all categories for glossary entries';
View
2  mod/glossary/db/postgres7.sql
@@ -23,6 +23,7 @@ CREATE TABLE prefix_glossary (
allowcomments int2 NOT NULL default '0',
usedynalink int2 NOT NULL default '1',
globalglossary int2 NOT NULL default '0',
+ entbypage int NOT NULL default '10',
timecreated int4 NOT NULL default '0',
timemodified int4 NOT NULL default '0',
PRIMARY KEY (id)
@@ -58,6 +59,7 @@ CREATE TABLE prefix_glossary_categories (
id SERIAL,
glossaryid int4 NOT NULL default '0',
name varchar(255) NOT NULL default '',
+ usedynalink int2 NOT NULL default '1',
PRIMARY KEY (id)
);
View
4 mod/glossary/deleteentry.html
@@ -4,8 +4,8 @@
<input type="hidden" name=mode value="delete">
<input type="hidden" name=go value="1">
<input type="hidden" name=entry value="<?php echo $entry ?>">
-<input type="hidden" name=currentview value="<?=$currentview ?>">
-<input type="hidden" name=cat value="<?=$cat ?>">
+<input type="hidden" name=mode value="<?=$mode ?>">
+<input type="hidden" name=hook value="<?=$hook ?>">
<input type="submit" value=" <?php print_string("yes")?> ">
<input type=button value=" <?php print_string("no")?> " onclick="javascript:history.go(-1);">
View
14 mod/glossary/deleteentry.php
@@ -7,8 +7,8 @@
require_variable($mode); // edit or delete
optional_variable($go); // commit the operation?
optional_variable($entry); // entry id
- optional_variable($tab); // browsing entries by categories?
- optional_variable($cat); // categoryID
+ require_variable($prevmode); // current frame
+ optional_variable($hook); // pivot id
$strglossary = get_string("modulename", "glossary");
$strglossaries = get_string("modulenameplural", "glossary");
@@ -50,7 +50,7 @@
if ($mode == "edit" or $mode == "delete" ) {
echo "<p>";
- if ( isteacher($cm->id) or $glossary->studentcanpost ) {
+ if ( isteacher($course->id) or $glossary->studentcanpost ) {
if ($go) { // the operation was confirmed.
if ( $mode == "delete") {
// if it is an imported entry, just delete the relation
@@ -74,8 +74,8 @@
print_simple_box_end();
}
print_footer($course);
- add_to_log($course->id, "glossary", "delete entry", "view.php?id=$cm->id&tab=$tab&cat=$cat", $entry);
- redirect("view.php?id=$cm->id&tab=$tab&cat=$cat");
+ add_to_log($course->id, "glossary", "delete entry", "view.php?id=$cm->id&mode=$prevmode&hook=$hook", $entry);
+ redirect("view.php?id=$cm->id&mode=$prevmode&hook=$hook");
} else { // the operation has not been confirmed yet so ask the user to do so
if ( $mode == "delete") {
print_simple_box_start("center","40%", "#FFBBBB");
@@ -88,8 +88,8 @@
<input type="hidden" name=mode value="delete">
<input type="hidden" name=go value="1">
<input type="hidden" name=entry value="<?php p($entry) ?>">
- <input type="hidden" name=tab value=<?php p($tab) ?>>
- <input type="hidden" name=cat=<?php p($cat) ?>>
+ <input type="hidden" name=prevmode value=<?php p($prevmode) ?>>
+ <input type="hidden" name=hook value=<?php p($hook) ?>>
<input type="submit" value=" <?php print_string("yes")?> ">
<input type=button value=" <?php print_string("no")?> " onclick="javascript:history.go(-1);">
View
5 mod/glossary/dynalink.php
@@ -35,7 +35,7 @@ function glossary_dynamic_link($courseid, $text) {
}
$entries = get_records_select("glossary_entries", "glossaryid IN ($glossaries) AND usedynalink != 0 and approved != 0 and concept != ''","$ebylenght glossaryid","id,glossaryid,concept,casesensitive,$GLOSSARY_CONCEPT_IS_ENTRY category,fullmatch");
- $categories = get_records_select("glossary_categories", "glossaryid IN ($glossaries)", "$cbylenght glossaryid,id","id,glossaryid,name concept, 1 casesensitive,$GLOSSARY_CONCEPT_IS_CATEGORY category, 1 fullmatch");
+ $categories = get_records_select("glossary_categories", "glossaryid IN ($glossaries) AND usedynalink != 0", "$cbylenght glossaryid,id","id,glossaryid,name concept, 1 casesensitive,$GLOSSARY_CONCEPT_IS_CATEGORY category, 1 fullmatch");
if ( $entries and $categories ) {
$concepts = array_merge($entries, $categories);
usort($concepts,'glossary_sort_entries_by_lenght');
@@ -60,7 +60,7 @@ function glossary_dynamic_link($courseid, $text) {
}
$cm = get_coursemodule_from_instance("glossary", $glossary->id, $courseid);
$title = strip_tags("$glossary->name: " . get_string("category","glossary"). " $category->name");
- $href_tag_begin = "<a class=\"autolink\" title=\"$title\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&tab=1&cat=$concept->id\">";
+ $href_tag_begin = "<a class=\"autolink\" title=\"$title\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&mode=cat&hook=$concept->id\">";
} else {
$concepttitle = urlencode($concept->concept);
$title = strip_tags("$glossary->name: $concepttitle");
@@ -70,6 +70,7 @@ function glossary_dynamic_link($courseid, $text) {
$currentconcept = str_replace("|", "\|", $concept->concept);
$currentconcept = str_replace("'", "\'", $currentconcept);
+ $currentconcept = str_replace("*", "\*", $currentconcept);
if ( $currentconcept = trim(strip_tags($currentconcept)) ) {
if ( !$concept->category ) {
if ( $aliases = get_records("glossary_alias","entryid",$concept->id) ) {
View
15 mod/glossary/edit.html
@@ -49,7 +49,13 @@
<table border=0>
<tr>
<td align=center width=58%>
-
+<?PHP
+ if ( !$glossary->usedynalink ) {
+ echo '<input type="hidden" name=usedynalink value="0">';
+ echo '<input type="hidden" name=casesensitive value="0">';
+ echo '<input type="hidden" name=fullmatch value="0">';
+ } else {
+?>
<table border=0 width=100%>
<tr><td align=right width=80%><small><?php echo get_string("entryusedynalink","glossary") ?>:</small></td><td width=20%>
<script>
@@ -94,6 +100,9 @@
<input type="checkbox" name="fullmatch" value=1 <?php p($selected) ?>> <?php helpbutton("fullmatch", strip_tags(get_string("fullmatch", "glossary")), "glossary") ?>
</td></tr>
</table>
+<?PHP
+ } // end-if !$usedynalink
+?>
</td>
<td align=center width=42% valign=top>
@@ -164,8 +173,8 @@
<input type="hidden" name=hfullmatch value="1">
<input type="hidden" name=id value="<?=$cm->id ?>">
- <input type="hidden" name=tab value="<?=$tab ?>">
- <input type="hidden" name=cat value="<?=$cat ?>">
+ <input type="hidden" name=mode value="<?=$mode ?>">
+ <input type="hidden" name=hook value="<?=$hook ?>">
<input type="hidden" name=confirm value="1">
<input type="submit" value="<?php print_string("savechanges") ?>">
View
16 mod/glossary/edit.php
@@ -8,8 +8,8 @@
optional_variable($e); // EntryID
optional_variable($confirm,0); // proceed. Edit the edtry
-optional_variable($tab); // categories if by category?
-optional_variable($cat); // CategoryID
+optional_variable($mode); // categories if by category?
+optional_variable($hook); // CategoryID
if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect");
@@ -33,6 +33,12 @@
if ( !isset($form->usedynalink) ) {
$form->usedynalink = 0;
}
+ if ( !isset($form->casesensitive) ) {
+ $form->casesensitive = 0;
+ }
+ if ( !isset($form->fullmatch) ) {
+ $form->fullmatch = 0;
+ }
$timenow = time();
$form->text = clean_text($form->text, $form->format);
@@ -102,7 +108,7 @@
if (! update_record("glossary_entries", $newentry)) {
error("Could not update your glossary");
} else {
- add_to_log($course->id, "glossary", "update entry", "view.php?id=$cm->id&eid=$newentry->id&tab=$tab&cat=$cat", "$newentry->id");
+ add_to_log($course->id, "glossary", "update entry", "view.php?id=$cm->id&mode=entry&hook=$newentry->id", "$newentry->id");
}
} else {
error("Could not update this glossary entry because this concept already exist.");
@@ -131,7 +137,7 @@
unset($newentry->attachment);
}
set_field("glossary_entries", "attachment", $newfilename, "id", $newentry->id);
- add_to_log($course->id, "glossary", "add entry", "view.php?id=$cm->id&eid=$newentry->id&tab=$tab&cat=$cat", "$newentry->id");
+ add_to_log($course->id, "glossary", "add entry", "view.php?id=$cm->id&mode=entry&hook=$newentry->id", "$newentry->id");
}
} else {
error("Could not insert this glossary entry because this concept already exist.");
@@ -165,7 +171,7 @@
}
}
- redirect("view.php?id=$cm->id&eid=$newentry->id&tab=$tab&cat=$cat");
+ redirect("view.php?id=$cm->id&mode=entry&hook=$newentry->id");
die;
} else {
if ($e) {
View
21 mod/glossary/editcategories.html
@@ -12,12 +12,31 @@
<INPUT type="text" name="name" size=30 value="<?=$name ?>">
</td>
</tr>
+<tr valign=top>
+ <td align=right><p><b><?php echo get_string("linkcategory","glossary") ?>:</b></p></td>
+ <td>
+ <select size="1" name="usedynalink">
+ <option value="1" <?php
+ if ( $usedynalink ) {
+ echo "selected";
+ }
+ ?>><?php echo get_string("yes") ?></option>
+ <option value="0" <?php
+ if ( !$usedynalink ) {
+ echo "selected";
+ }
+ ?>><?php echo get_string("no") ?>
+ </option>
+ </select> <?php helpbutton("linkcategory", get_string("linkcategory", "glossary"), "glossary") ?>
+ </td>
+</tr>
<td colspan=2>
<p align=center>
<input type="hidden" name=id value="<?=$cm->id ?>">
<input type="hidden" name=action value="<?=$action?>">
<input type="hidden" name=confirm value=1>
- <input type="hidden" name=cat value=<?php p($cat) ?>>
+ <input type="hidden" name=mode value='cat'>
+ <input type="hidden" name=hook value="<?=$hook?>">
<input type="submit" value="<?php print_string("savechanges") ?>">
<input type="reset" value="<?php print_string("back","glossary") ?>" onclick="javascript:history.go(-1);">
</P>
View
43 mod/glossary/editcategories.php
@@ -6,8 +6,10 @@
require_once("lib.php");
require_variable($id); // Course Module ID, or
- optional_variable($cat); // category ID
+ optional_variable($mode); // cat
+ optional_variable($hook); // category ID
optional_variable($action); // what to do
+ optional_variable($usedynalink); // category ID
optional_variable($confirm); // confirm the action
optional_variable($name); // confirm the action
@@ -46,25 +48,27 @@
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm));
- if ( $cat ) {
- $category = get_record("glossary_categories","id",$cat);
+ if ( $hook ) {
+ $category = get_record("glossary_categories","id",$hook);
if ( $action == "edit" ) {
if ( $confirm ) {
$action = "";
- $CategoryObject->id = $cat;
- $CategoryObject->name = $name;
+ $cat->id = $hook;
+ $cat->name = $name;
+ $cat->usedynalink = $usedynalink;
- if ( !update_record("glossary_categories", $CategoryObject) ) {
+ if ( !update_record("glossary_categories", $cat) ) {
error("Weird error. The category was not updated.");
redirect("editcategories.php?id=$cm->id");
} else {
- add_to_log($course->id, "glossary", "edit category", "editcategories.php?id=$cm->id", $cat);
+ add_to_log($course->id, "glossary", "edit category", "editcategories.php?id=$cm->id", $hook);
}
} else {
echo "<p align=\"center\">" . get_string("edit"). " " . get_string("category","glossary") . "<font size=\"3\">";
$name = $category->name;
+ $usedynalink = $category->usedynalink;
require "editcategories.html";
print_footer();
die;
@@ -72,8 +76,8 @@
} elseif ( $action == "delete" ) {
if ( $confirm ) {
- delete_records("glossary_entries_categories","categoryid", $cat);
- delete_records("glossary_categories","id", $cat);
+ delete_records("glossary_entries_categories","categoryid", $hook);
+ delete_records("glossary_categories","id", $hook);
print_simple_box_start("center","40%", "#FFBBBB");
echo "<center>" . get_string("categorydeleted","glossary") ."</center>";
@@ -82,7 +86,7 @@
print_footer($course);
- add_to_log($course->id, "glossary", "delete category", "editcategories.php?id=$cm->id", $cat);
+ add_to_log($course->id, "glossary", "delete category", "editcategories.php?id=$cm->id", $hook);
redirect("editcategories.php?id=$cm->id");
} else {
@@ -104,7 +108,8 @@
<input type="hidden" name=id value="<?php p($cm->id) ?>">
<input type="hidden" name=action value="delete">
<input type="hidden" name=confirm value="1">
- <input type="hidden" name=cat value="<?php echo $cat ?>">
+ <input type="hidden" name=mode value="<?php echo $mode ?>">
+ <input type="hidden" name=hook value="<?php echo $hook ?>">
<table border=0 widTH=100><tr><td align=right width=50%>
<input type="submit" value=" <?php print_string("yes")?> ">
</form>
@@ -135,15 +140,16 @@
} else {
$action = "";
- $CategoryObject->name = $name;
- $CategoryObject->glossaryid = $glossary->id;
+ $cat->name = $name;
+ $cat->usedynalink = $usedynalink;
+ $cat->glossaryid = $glossary->id;
- if ( ! $CategoryObject->id = insert_record("glossary_categories", $CategoryObject) ) {
+ if ( ! $cat->id = insert_record("glossary_categories", $cat) ) {
error("Weird error. The category was not inserted.");
redirect("editcategories.php?id=$cm->id");
} else {
- add_to_log($course->id, "glossary", "add category", "editcategories.php?id=$cm->id", $CategoryObject->id);
+ add_to_log($course->id, "glossary", "add category", "editcategories.php?id=$cm->id", $cat->id);
}
}
} else {
@@ -189,8 +195,8 @@
</td>
<td width="10%" align="center"><b>
<?php
- echo "<a href=\"editcategories.php?id=$cm->id&action=delete&cat=$category->id\"><img alt=\"" . get_string("delete") . "\"src=\"../../pix/t/delete.gif\" height=11 width=11 border=0></a> ";
- echo "<a href=\"editcategories.php?id=$cm->id&action=edit&cat=$category->id\"><img alt=\"" . get_string("edit") . "\" src=\"../../pix/t/edit.gif\" height=11 width=11 border=0></a>";
+ echo "<a href=\"editcategories.php?id=$cm->id&action=delete&mode=cat&hook=$category->id\"><img alt=\"" . get_string("delete") . "\"src=\"../../pix/t/delete.gif\" height=11 width=11 border=0></a> ";
+ echo "<a href=\"editcategories.php?id=$cm->id&action=edit&mode=cat&hook=$category->id\"><img alt=\"" . get_string("edit") . "\" src=\"../../pix/t/edit.gif\" height=11 width=11 border=0></a>";
?>
</b></td>
</tr>
@@ -213,7 +219,8 @@
echo print_single_button("editcategories.php", $options, get_string("add") . " " . get_string("category","glossary"), "get");
echo "</td><td align=left>";
unset($options['action']);
- $options['currentview'] = "categories";
+ $options['mode'] = 'cat';
+ $options['hook'] = $hook;
echo print_single_button("view.php", $options, get_string("back","glossary") );
echo "</td></tr>";
echo "</tablee>";
View
6 mod/glossary/export.php
@@ -35,6 +35,12 @@
$strsearchindefinition = get_string("searchindefinition", "glossary");
$strsearch = get_string("search");
+ $navigation = "";
+ if ($course->category) {
+ $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
+ require_login($course->id);
+ }
+
print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname",
"$navigation <A HREF=index.php?id=$course->id>$strglossaries</A> -> $glossary->name",
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
View
22 mod/glossary/exportentry.php
@@ -5,8 +5,8 @@
require_variable($id); // course module ID
require_variable($entry); // Entry ID
optional_variable($confirm); // confirmation
- optional_variable($currentview);
- optional_variable($cat);
+ optional_variable($mode);
+ optional_variable($hook);
global $THEME, $USER, $CFG;
@@ -53,10 +53,10 @@
if ( !$confirm ) {
echo "<center>";
-
- notice_yesno ("<center><h2>$entry->concept</h2><p align=center>Seguro que desea agregar esta entrada a<br><b>$mainglossary->name</b>?",
- "exportentry.php?id=$id&currentview=$currentview&cat=$cat&entry=$entry->id&confirm=1",
- "view.php?id=$cm->id&currentview=$currentview&cat=$cat&eid=".$entry->id );
+ $areyousure = get_string("areyousureexport","glossary");
+ notice_yesno ("<center><h2>$entry->concept</h2><p align=center>$areyousure<br><b>$mainglossary->name</b>?",
+ "exportentry.php?id=$id&mode=$mode&hook=$hook&entry=$entry->id&confirm=1",
+ "view.php?id=$cm->id&mode=$mode&hook=$hook" );
} else {
if ( ! $mainglossary->allowduplicatedentries ) {
@@ -76,12 +76,12 @@
print_simple_box_start("center", "60%", "$THEME->cellheading");
echo "<p align=center><font size=3>$entryexported</font></p></font>";
- print_continue("view.php?id=$cm->id&eid=".$entry->id);
+ print_continue("view.php?id=$cm->id&mode=entry&hook=".$entry->id);
print_simple_box_end();
print_footer();
- redirect("view.php?id=$cm->id&eid=".$entry->id);
+ redirect("view.php?id=$cm->id&mode=entry&hook=".$entry->id);
die;
}
} else {
@@ -89,16 +89,16 @@
echo "<p align=center><font size=3>$entryalreadyexist</font></p></font>";
echo "<p align=center>";
- print_continue("view.php?id=$cm->id&eid=".$entry->id);
+ print_continue("view.php?id=$cm->id&mode=entry&hook=".$entry->id);
print_simple_box_end();
}
}
} else {
print_simple_box_start("center", "60%", "#FFBBBB");
- echo "<p align=center><font size=3>A weird error was found while trying to export this entry. Operation cancelled.</font></p></font>";
+ notice("A weird error was found while trying to export this entry. Operation cancelled.");
- print_continue("view.php?id=$cm->id&eid=".$entry->id);
+ print_continue("view.php?id=$cm->id&mode=entry&hook=".$entry->id);
print_simple_box_end();
}
View
6 mod/glossary/formats/2.php
@@ -1,6 +1,6 @@
<?PHP // $Id$
-function glossary_print_entry_by_format($course, $cm, $glossary, $entry, $tab="",$cat="") {
+function glossary_print_entry_by_format($course, $cm, $glossary, $entry, $mode="",$hook="",$printicons=1) {
global $THEME, $CFG, $USER;
$colour = $THEME->cellheading2;
@@ -18,7 +18,7 @@ function glossary_print_entry_by_format($course, $cm, $glossary, $entry, $tab=""
echo "</td>";
echo "<td nowrap valign=\"top\" width=100% bgcolor=\"$THEME->cellheading\" class=\"forumpostheader\">";
- glossary_print_entry_approval($cm, $entry, $tab);
+ glossary_print_entry_approval($cm, $entry, $mode);
glossary_print_entry_attachment($entry,"html","right");
echo "<b>";
@@ -35,7 +35,7 @@ function glossary_print_entry_by_format($course, $cm, $glossary, $entry, $tab=""
echo "\n<td width=100% bgcolor=\"$THEME->cellcontent\" class=\"forumpostmessage\">";
glossary_print_entry_definition($entry);
- glossary_print_entry_lower_section($course, $cm, $glossary, $entry,$tab,$cat);
+ glossary_print_entry_lower_section($course, $cm, $glossary, $entry,$mode,$hook,$printicons);
} else {
echo "<center>";
View
6 mod/glossary/formats/3.php
@@ -1,6 +1,6 @@
<?PHP // $Id$
-function glossary_print_entry_by_format($course, $cm, $glossary, $entry, $tab="",$cat="") {
+function glossary_print_entry_by_format($course, $cm, $glossary, $entry, $mode="",$hook="",$printicons=1) {
global $THEME, $CFG, $USER;
$colour = $THEME->cellheading2;
@@ -16,7 +16,7 @@ function glossary_print_entry_by_format($course, $cm, $glossary, $entry, $tab=""
print_user_picture($user->id, $course->id, $user->picture);
echo "</td>";
echo "<td align=\"top\" nowrap width=100% bgcolor=\"$THEME->cellheading\" class=\"forumpostheader\">";
- glossary_print_entry_approval($cm, $entry, $tab);
+ glossary_print_entry_approval($cm, $entry, $mode);
echo "<b>";
glossary_print_entry_concept($entry);
echo "</b><br />";
@@ -40,7 +40,7 @@ function glossary_print_entry_by_format($course, $cm, $glossary, $entry, $tab=""
}
glossary_print_entry_definition($entry);
- glossary_print_entry_lower_section($course, $cm, $glossary, $entry,$tab,$cat);
+ glossary_print_entry_lower_section($course, $cm, $glossary, $entry,$mode,$hook,$printicons);
} else {
echo "<center>";
View
6 mod/glossary/formats/4.php
@@ -1,6 +1,6 @@
<?PHP // $Id$
-function glossary_print_entry_by_format($course, $cm, $glossary, $entry,$tab="",$cat="") {
+function glossary_print_entry_by_format($course, $cm, $glossary, $entry,$mode="",$hook="",$printicons=1) {
global $THEME, $USER;
if ( $entry ) {
@@ -11,7 +11,7 @@ function glossary_print_entry_by_format($course, $cm, $glossary, $entry,$tab="",
echo '<tr>';
echo "<td width=100% bgcolor=\"$colour\">";
$entry->course = $course->id;
- glossary_print_entry_approval($cm, $entry, $tab);
+ glossary_print_entry_approval($cm, $entry, $mode);
glossary_print_entry_attachment($entry,"html","right");
echo '<b>' . get_string("question","glossary") . ':</b> ';
@@ -22,7 +22,7 @@ function glossary_print_entry_by_format($course, $cm, $glossary, $entry,$tab="",
echo glossary_print_entry_definition($entry);
- glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $tab, $cat);
+ glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook,$printicons);
echo '</td></tr></table>';
} else {
View
6 mod/glossary/formats/5.php
@@ -1,6 +1,6 @@
<?PHP // $Id$
-function glossary_print_entry_by_format($course, $cm, $glossary, $entry,$tab="",$cat="") {
+function glossary_print_entry_by_format($course, $cm, $glossary, $entry,$mode="",$hook="",$printicons=1) {
global $THEME, $USER;
$colour = $THEME->cellheading2;
@@ -9,7 +9,7 @@ function glossary_print_entry_by_format($course, $cm, $glossary, $entry,$tab="",
echo "\n<tr>";
echo "<td width=100% bgcolor=\"$colour\">";
- glossary_print_entry_approval($cm, $entry, $tab);
+ glossary_print_entry_approval($cm, $entry, $mode);
if ($entry) {
glossary_print_entry_attachment($entry,"html","right");
echo "<b>";
@@ -20,7 +20,7 @@ function glossary_print_entry_by_format($course, $cm, $glossary, $entry,$tab="",
echo "\n<tr><td width=100% bgcolor=\"$THEME->cellcontent\">";
glossary_print_entry_definition($entry);
- glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $tab, $cat);
+ glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook,$printicons);
} else {
echo "<center>";
print_string("noentry", "glossary");
View
6 mod/glossary/import.php
@@ -11,8 +11,8 @@
optional_variable($file); // file to import
optional_variable($catsincl,0); // Import Categories too?
- optional_variable($lasttab,GLOSSARY_STANDARD_VIEW);
- optional_variable($l,"ALL");
+ optional_variable($mode,'letter');
+ optional_variable($hook,"ALL");
if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect");
@@ -93,6 +93,7 @@
$glossary->name = addslashes(utf8_decode($xmlglossary['NAME'][0]['#']));
$glossary->course = $course->id;
$glossary->globalglossary = $xmlglossary['GLOBALGLOSSARY'][0]['#'];
+ $glossary->entbypage = $xmlglossary['ENTBYPAGE'][0]['#'];
$glossary->intro = addslashes(utf8_decode($xmlglossary['INTRO'][0]['#']));
$glossary->showspecial = $xmlglossary['SHOWSPECIAL'][0]['#'];
$glossary->showalphabet = $xmlglossary['SHOWALPHABET'][0]['#'];
@@ -219,6 +220,7 @@
unset($newcat);
$newcat->name = $xmlcat['#']['NAME'][0]['#'];
+ $newcat->usedynalink = $xmlcat['#']['USEDYNALINK'][0]['#'];
if ( !$category = get_record("glossary_categories","glossaryid",$glossary->id,"name",$newcat->name) ) {
// Create the category if it does not exist
unset($category);
View
248 mod/glossary/lib.php
@@ -8,13 +8,15 @@
define("GLOSSARY_SHOW_ALL_CATEGORIES", 0);
define("GLOSSARY_SHOW_NOT_CATEGORISED", -1);
+define("GLOSSARY_NO_VIEW", -1);
define("GLOSSARY_STANDARD_VIEW", 0);
define("GLOSSARY_CATEGORY_VIEW", 1);
define("GLOSSARY_DATE_VIEW", 2);
-define("GLOSSARY_ADDENTRY_VIEW", 3);
-define("GLOSSARY_IMPORT_VIEW", 4);
-define("GLOSSARY_EXPORT_VIEW", 5);
-define("GLOSSARY_APPROVAL_VIEW", 6);
+define("GLOSSARY_AUTHOR_VIEW", 3);
+define("GLOSSARY_ADDENTRY_VIEW", 4);
+define("GLOSSARY_IMPORT_VIEW", 5);
+define("GLOSSARY_EXPORT_VIEW", 6);
+define("GLOSSARY_APPROVAL_VIEW", 7);
define("GLOSSARY_FORMAT_SIMPLE", 0);
define("GLOSSARY_FORMAT_CONTINUOUS", 1);
@@ -79,7 +81,7 @@ function glossary_delete_instance($id) {
} else {
if ($categories = get_records("glossary_categories","glossaryid",$glossary->id)) {
$cats = "";
- foreach ( $categories as $cat ) {
+ foreach ( $categories as $hook ) {
$cats .= "$cat->id,";
}
$cats = substr($cats,0,-1);
@@ -112,14 +114,55 @@ function glossary_user_outline($course, $user, $mod, $glossary) {
/// $return->time = the time they did it
/// $return->info = a short text description
- return $return;
+ if ($entries = glossary_get_user_entries($glossary->id, $user->id)) {
+ $result->info = count($entries) . ' ' . get_string("entries", "glossary");
+
+ $lastpost = array_pop($entries);
+ $result->time = $lastpost->timemodified;
+ return $result;
+ }
+ return NULL;
+}
+
+function glossary_get_user_entries($glossaryid, $userid) {
+/// Get all the entries for a user in a glossary
+ global $CFG;
+
+ return get_records_sql("SELECT e.*, u.firstname, u.lastname, u.email, u.picture
+ FROM {$CFG->prefix}glossary g,
+ {$CFG->prefix}glossary_entries e,
+ {$CFG->prefix}user u
+ WHERE g.id = '$glossaryid'
+ AND e.glossaryid = g.id
+ AND e.userid = '$userid'
+ AND e.userid = u.id
+ ORDER BY e.timemodified ASC");
}
function glossary_user_complete($course, $user, $mod, $glossary) {
/// Print a detailed representation of what a user has done with
/// a given particular instance of this module, for user activity reports.
+ global $CFG;
- return true;
+ if ($entries = glossary_get_user_entries($glossary->id, $user->id)) {
+ if ( $glossary->displayformat == GLOSSARY_FORMAT_SIMPLE or
+ $glossary->displayformat == GLOSSARY_FORMAT_CONTINUOUS ) {
+ print_simple_box_start("center","70%");
+ } else {
+ echo '<table width="95%" boder="0"><tr><td>';
+ }
+ foreach ($entries as $entry) {
+ $cm = get_coursemodule_from_instance("glossary", $glossary->id, $course->id);
+ glossary_print_entry($course, $cm, $glossary, $entry,"","",0);
+ echo '<p>';
+ }
+ if ( $glossary->displayformat == GLOSSARY_FORMAT_SIMPLE or
+ $glossary->displayformat == GLOSSARY_FORMAT_CONTINUOUS ) {
+ print_simple_box_end();
+ } else {
+ echo '</td></tr></table>';
+ }
+ }
}
function glossary_print_recent_activity($course, $isteacher, $timestart) {
@@ -132,15 +175,16 @@ function glossary_print_recent_activity($course, $isteacher, $timestart) {
if (!$logs = get_records_select("log", "time > '$timestart' AND ".
"course = '$course->id' AND ".
"module = 'glossary' AND ".
- "action = 'add %' ", "time ASC")) {
+ "action = 'add entry'", "time ASC")) {
return false;
}
foreach ($logs as $log) {
//Create a temp valid module structure (course,id)
- $tempmod->course = $log->course;
- $tempmod->id = $log->info;
- //Obtain the visible property from the instance
+ $tempmod->course = $log->course;
+ $entry = get_record("glossary_entries","id",$log->info);
+ $tempmod->id = $entry->glossaryid;
+ //Obtain the visible property from the instance
$modvisible = instance_is_visible($log->module,$tempmod);
//Only if the mod is visible
@@ -168,6 +212,16 @@ function glossary_print_recent_activity($course, $isteacher, $timestart) {
return $content;
}
+function glossary_log_info($log) {
+ global $CFG;
+
+ return get_record_sql("SELECT e.*, u.firstname, u.lastname
+ FROM {$CFG->prefix}glossary_entries e,
+ {$CFG->prefix}user u
+ WHERE e.id = '$log->info'
+ AND u.id = '$log->userid'");
+}
+
function glossary_cron () {
/// Function to be run periodically according to the moodle cron
/// This function searches for things that need to be done, such
@@ -209,13 +263,13 @@ function glossary_get_participants($glossaryid) {
/// Any other glossary functions go here. Each of them must have a name that
/// starts with glossary_
-function glossary_log_info($log) {
- global $CFG;
- return get_record_sql("SELECT g.*, u.firstname, u.lastname
- FROM {$CFG->prefix}glossary_entries g,
- {$CFG->prefix}user u
- WHERE g.glossaryid = '$log->info'
- AND u.id = '$log->userid'");
+function glossary_debug($debug,$text,$br=1) {
+ if ( $debug ) {
+ echo '<font color=red>' . $text . '</font>';
+ if ( $br ) {
+ echo '<br>';
+ }
+ }
}
function glossary_get_entries($glossaryid, $entrylist, $pivot = "") {
@@ -245,7 +299,7 @@ function glossary_get_entries_sorted($glossary, $where="", $orderby="", $pivot =
WHERE (glossaryid = $glossary->id or sourceglossaryid = $glossary->id) $where $orderby");
}
-function glossary_get_entries_by_category($glossary, $cat, $where="", $orderby="", $pivot = "") {
+function glossary_get_entries_by_category($glossary, $hook, $where="", $orderby="", $pivot = "") {
global $CFG;
if ($where) {
$where = " and $where";
@@ -258,14 +312,14 @@ function glossary_get_entries_by_category($glossary, $cat, $where="", $orderby="
}
return get_records_sql("SELECT $pivot ge.*
FROM {$CFG->prefix}glossary_entries ge, {$CFG->prefix}glossary_entries_categories c
- WHERE (ge.id = c.entryid and c.categoryid = $cat) and
+ WHERE (ge.id = c.entryid and c.categoryid = $hook) and
(ge.glossaryid = $glossary->id or ge.sourceglossaryid = $glossary->id) $where $orderby");
}
-function glossary_print_entry($course, $cm, $glossary, $entry, $tab="",$cat="") {
+function glossary_print_entry($course, $cm, $glossary, $entry, $mode="",$hook="",$printicons = 1) {
global $THEME, $USER, $CFG;
- if ($entry->approved or ($USER->id == $entry->userid and !isteacher($course->id)) or $tab == GLOSSARY_APPROVAL_VIEW) {
+ if ($entry->approved or ($USER->id == $entry->userid and !isteacher($course->id)) or $mode == 'approval') {
$permissiongranted = 0;
$formatfile = "$CFG->dirroot/mod/glossary/formats/$glossary->displayformat.php";
$functionname = "glossary_print_entry_by_format";
@@ -284,15 +338,15 @@ function glossary_print_entry($course, $cm, $glossary, $entry, $tab="",$cat="")
}
if ( !$basicformat and $permissiongranted ) {
- glossary_print_entry_by_format($course, $cm, $glossary, $entry,$tab,$cat);
+ glossary_print_entry_by_format($course, $cm, $glossary, $entry,$mode,$hook,$printicons);
} else {
switch ( $glossary->displayformat ) {
- case GLOSSARY_FORMAT_SIMPLE:
- glossary_print_entry_by_default($course, $cm, $glossary, $entry,$tab,$cat);
- break;
- case GLOSSARY_FORMAT_CONTINUOUS:
- glossary_print_entry_continuous($course, $cm, $glossary, $entry,$tab,$cat);
- break;
+ case GLOSSARY_FORMAT_SIMPLE:
+ glossary_print_entry_by_default($course, $cm, $glossary, $entry,$mode,$hook,$printicons);
+ break;
+ case GLOSSARY_FORMAT_CONTINUOUS:
+ glossary_print_entry_continuous($course, $cm, $glossary, $entry,$mode,$hook,$printicons);
+ break;
}
}
}
@@ -306,7 +360,7 @@ function glossary_print_entry_definition($entry) {
echo format_text($definition, $entry->format);
}
-function glossary_print_entry_aliases($course, $cm, $glossary, $entry,$tab="",$cat="", $mode = 'print') {
+function glossary_print_entry_aliases($course, $cm, $glossary, $entry,$mode="",$hook="", $type = 'print') {
$return = '';
if ( $aliases = get_records("glossary_alias","entryid",$entry->id) ) {
foreach ($aliases as $alias) {
@@ -322,14 +376,14 @@ function glossary_print_entry_aliases($course, $cm, $glossary, $entry,$tab="",$
// $return = "<table border=0 align=$align><tr><td>$return</td></tr></table>";
}
}
- if ($mode == 'print') {
+ if ($type == 'print') {
echo $return;
} else {
return $return;
}
}
-function glossary_print_entry_icons($course, $cm, $glossary, $entry,$tab="",$cat="", $mode = 'print') {
+function glossary_print_entry_icons($course, $cm, $glossary, $entry,$mode="",$hook="", $type = 'print') {
global $THEME, $USER;
$importedentry = ($entry->sourceglossaryid == $glossary->id);
@@ -362,7 +416,7 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$tab="",$cat
$mainglossary = get_record("glossary","mainglossary",1,"course",$course->id);
if ( $mainglossary ) { // if there is a main glossary defined, allow to export the current entry
- $return .= " <a title=\"" . get_string("exporttomainglossary","glossary") . "\" href=\"exportentry.php?id=$cm->id&entry=$entry->id&tab=$tab&cat=$cat\"><img src=\"export.gif\" height=11 width=11 border=0></a> ";
+ $return .= " <a title=\"" . get_string("exporttomainglossary","glossary") . "\" href=\"exportentry.php?id=$cm->id&entry=$entry->id&mode=$mode&hook=$hook\"><img src=\"export.gif\" height=11 width=11 border=0></a> ";
}
}
@@ -375,27 +429,30 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$tab="",$cat
// Exported entries can be updated/deleted only by teachers in the main glossary
if ( !$importedentry and ($isteacher or !$ismainglossary) ) {
- $return .= " <a title=\"" . get_string("delete") . "\" href=\"deleteentry.php?id=$cm->id&mode=delete&entry=$entry->id&tab=$tab&cat=$cat\"><img src=\"";
+ $return .= " <a title=\"" . get_string("delete") . "\" href=\"deleteentry.php?id=$cm->id&mode=delete&entry=$entry->id&prevmode=$mode&hook=$hook\"><img src=\"";
$return .= $icon;
$return .= "\" height=11 width=11 border=0></a> ";
- $return .= " <a title=\"" . get_string("edit") . "\" href=\"edit.php?id=$cm->id&e=$entry->id&tab=$tab&cat=$cat\"><img src=\"../../pix/t/edit.gif\" height=11 width=11 border=0></a>";
+ $return .= " <a title=\"" . get_string("edit") . "\" href=\"edit.php?id=$cm->id&e=$entry->id&mode=$mode&hook=$hook\"><img src=\"../../pix/t/edit.gif\" height=11 width=11 border=0></a>";
} elseif ( $importedentry ) {
$return .= " <font size=-1>" . get_string("exportedentry","glossary") . "</font>";
}
}
$return .= "&nbsp;&nbsp;"; // just to make up a little the output in Mozilla ;)
- if ($mode == 'print') {
+ if ($type == 'print') {
echo $return;
} else {
return $return;
}
}
-function glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $tab, $cat) {
+function glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook,$printicons) {
- $aliases = glossary_print_entry_aliases($course, $cm, $glossary, $entry, $tab, $cat,"html");
- $icons = glossary_print_entry_icons($course, $cm, $glossary, $entry, $tab, $cat,"html");
+ $aliases = glossary_print_entry_aliases($course, $cm, $glossary, $entry, $mode, $hook,"html");
+ $icons = "";
+ if ( $printicons ) {
+ $icons = glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode, $hook,"html");
+ }
if ( $aliases ) {
echo '<table border="0" width="100%" align="center"><tr>' .
'<td align="right" width="50%" valign=top><font size=1>' .
@@ -421,39 +478,43 @@ function glossary_print_entry_attachment($entry,$format=NULL,$align="right") {
}
}
-function glossary_print_entry_approval($cm, $entry, $tab) {
- if ( $tab == GLOSSARY_APPROVAL_VIEW ) {
- echo "<a title=\"" . get_string("approve","glossary"). "\" href=\"approve.php?id=$cm->id&eid=$entry->id&tab=$tab\"><IMG align=\"right\" src=\"check.gif\" border=0 width=\"34\" height=\"34\"></a>";
+function glossary_print_entry_approval($cm, $entry, $mode) {
+ if ( $mode == 'approval' and !$entry->approved ) {
+ echo "<a title=\"" . get_string("approve","glossary"). "\" href=\"approve.php?id=$cm->id&eid=$entry->id&mode=$mode\"><IMG align=\"right\" src=\"check.gif\" border=0 width=\"34\" height=\"34\"></a>";
}
}
-function glossary_print_entry_by_default($course, $cm, $glossary, $entry,$tab="",$cat="") {
+function glossary_print_entry_by_default($course, $cm, $glossary, $entry,$mode="",$hook="",$printicons=1) {
global $THEME, $USER;
$colour = $THEME->cellheading2;
echo "\n<TR>";
echo "<TD WIDTH=100% class=\"generalbox\" valign=\"top\" BGCOLOR=\"#FFFFFF\">";
- glossary_print_entry_approval($cm, $entry, $tab);
+ glossary_print_entry_approval($cm, $entry, $mode);
glossary_print_entry_attachment($entry,"html","right");
echo "<b>";
glossary_print_entry_concept($entry);
echo ":</b> ";
glossary_print_entry_definition($entry);
- glossary_print_entry_lower_section($course, $cm, $glossary, $entry,$tab,$cat);
+ glossary_print_entry_lower_section($course, $cm, $glossary, $entry,$mode,$hook,$printicons);
echo "</td>";
echo "</TR>";
}
-function glossary_print_entry_continuous($course, $cm, $glossary, $entry,$tab="",$cat="") {
+function glossary_print_entry_continuous($course, $cm, $glossary, $entry,$mode="",$hook="",$printicons=1) {
global $THEME, $USER;
if ($entry) {
- glossary_print_entry_approval($cm, $entry, $tab);
+ glossary_print_entry_approval($cm, $entry, $mode);
glossary_print_entry_attachment($entry,"html","right");
glossary_print_entry_concept($entry);
echo " ";
+
glossary_print_entry_definition($entry);
- glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $tab, $cat);
+ if ( $printicons ) {
+ $icons = glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode, $hook,"html");
+ echo "($icons)";
+ }
}
}
@@ -853,48 +914,58 @@ function glossary_print_tabbed_table_end() {
echo "</center><p></td></tr></table></center>";
}
-function glossary_print_approval_menu($cm, $glossary, $l, $sortkey, $sortorder = "",$tab=GLOSSARY_STANDARD_VIEW) {
+function glossary_print_approval_menu($cm, $glossary,$mode, $hook, $sortkey = '', $sortorder = '') {
if ($glossary->showalphabet and $glossary->displayformat != GLOSSARY_FORMAT_CONTINUOUS) {
echo '<center>' . get_string("explainalphabet","glossary") . '<p>';
}
- glossary_print_special_links($cm, $glossary,$l, $tab);
+ glossary_print_special_links($cm, $glossary, $mode, $hook);
- glossary_print_alphabet_links($cm, $glossary,$l, $tab);
+ glossary_print_alphabet_links($cm, $glossary, $mode, $hook);
- glossary_print_all_links($cm, $glossary,$l, $tab);
+ glossary_print_all_links($cm, $glossary, $mode, $hook);
- glossary_print_sorting_links($cm, $sortkey,$sortorder, $tab);
+ glossary_print_sorting_links($cm, $mode, $sortkey, $sortorder);
}
-function glossary_print_addentry_menu($cm, $glossary, $l, $sortkey, $sortorder = "", $tab=GLOSSARY_STANDARD_VIEW) {
+function glossary_print_addentry_menu($cm, $glossary, $mode, $hook, $sortkey='', $sortorder = '') {
echo '<center>' . get_string("explainaddentry","glossary") . '<p>';
}
-function glossary_print_import_menu($cm, $glossary, $l, $sortkey, $sortorder = "", $tab=GLOSSARY_STANDARD_VIEW) {
+function glossary_print_import_menu($cm, $glossary, $mode, $hook, $sortkey='', $sortorder = '') {
echo '<center>' . get_string("explainimport","glossary") . '<p>';
}
-function glossary_print_export_menu($cm, $glossary, $l, $sortkey, $sortorder = "", $tab=GLOSSARY_STANDARD_VIEW) {
+function glossary_print_export_menu($cm, $glossary, $mode, $hook, $sortkey='', $sortorder = '') {
echo '<center>' . get_string("explainexport","glossary") . '<p>';
}
-function glossary_print_alphabet_menu($cm, $glossary, $l, $sortkey, $sortorder = "", $tab=GLOSSARY_STANDARD_VIEW) {
- if ( $tab != GLOSSARY_DATE_VIEW ) {
+function glossary_print_alphabet_menu($cm, $glossary, $mode, $hook, $sortkey='', $sortorder = '') {
+ if ( $mode != 'date' ) {
if ($glossary->showalphabet and $glossary->displayformat != GLOSSARY_FORMAT_CONTINUOUS) {
echo '<center>' . get_string("explainalphabet","glossary") . '<p>';
}
- glossary_print_special_links($cm, $glossary,$l, $tab);
+ glossary_print_special_links($cm, $glossary, $mode, $hook);
- glossary_print_alphabet_links($cm, $glossary,$l, $tab);
+ glossary_print_alphabet_links($cm, $glossary, $mode, $hook);
- glossary_print_all_links($cm, $glossary,$l, $tab);
+ glossary_print_all_links($cm, $glossary, $mode, $hook);
} else {
- glossary_print_sorting_links($cm, $sortkey,$sortorder, $tab);
+ glossary_print_sorting_links($cm, $mode, $sortkey,$sortorder);
+ }
+}
+
+function glossary_print_author_menu($cm, $glossary,$mode, $hook, $sortkey = '', $sortorder = '') {
+ if ($glossary->showalphabet and $glossary->displayformat != GLOSSARY_FORMAT_CONTINUOUS) {
+ echo '<center>' . get_string("explainalphabet","glossary") . '<p>';
}
+
+ glossary_print_alphabet_links($cm, $glossary, $mode, $hook);
+ echo "<br />";
+ glossary_print_all_links($cm, $glossary, $mode, $hook);
}
-function glossary_print_categories_menu($course, $cm, $glossary, $cat, $category) {
+function glossary_print_categories_menu($cm, $glossary, $hook, $category) {
global $CFG, $THEME;
echo '<table border=0 width=100%>';
echo '<tr>';
@@ -902,7 +973,8 @@ function glossary_print_categories_menu($course, $cm, $glossary, $cat, $category
echo '<td align=center width=20%>';
if ( isteacher($course->id) ) {
$options['id'] = $cm->id;
- $options['cat'] = $cat;
+ $options['mode'] = 'cat';
+ $options['hook'] = $hook;
echo print_single_button("editcategories.php", $options, get_string("editcategories","glossary"), "get");
}
echo '</td>';
@@ -933,12 +1005,12 @@ function glossary_print_categories_menu($course, $cm, $glossary, $cat, $category
if ( $category ) {
echo $category->name;
} else {
- if ( $cat == GLOSSARY_SHOW_NOT_CATEGORISED ) {
+ if ( $hook == GLOSSARY_SHOW_NOT_CATEGORISED ) {
echo get_string("entrieswithoutcategory","glossary");
$selected = GLOSSARY_SHOW_NOT_CATEGORISED;
- } elseif ( $cat == GLOSSARY_SHOW_ALL_CATEGORIES ) {
+ } elseif ( $hook == GLOSSARY_SHOW_ALL_CATEGORIES ) {
echo get_string("allcategories","glossary");
$selected = GLOSSARY_SHOW_ALL_CATEGORIES;
@@ -948,7 +1020,7 @@ function glossary_print_categories_menu($course, $cm, $glossary, $cat, $category
echo '</b></td>';
echo '<td align=center width=20%>';
- echo popup_form("$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&tab=" . GLOSSARY_CATEGORY_VIEW . "&cat=", $menu, "catmenu", $selected, "",
+ echo popup_form("$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&mode=cat&hook=", $menu, "catmenu", $selected, "",
"", "", false);
echo '</td>';
@@ -957,42 +1029,42 @@ function glossary_print_categories_menu($course, $cm, $glossary, $cat, $category
echo '</table>';
}
-function glossary_print_all_links($cm, $glossary, $l, $tab) {
+function glossary_print_all_links($cm, $glossary, $mode, $hook) {
global $CFG;
if ( $glossary->showall and $glossary->displayformat != GLOSSARY_FORMAT_CONTINUOUS) {
$strallentries = get_string("allentries", "glossary");
- if ( $l == 'ALL' ) {
+ if ( $hook == 'ALL' ) {
echo "<b>$strallentries</b>";
} else {
$strexplainall = strip_tags(get_string("explainall","glossary"));
- echo "<a title=\"$strexplainall\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&l=ALL&tab=$tab\">$strallentries</a>";
+ echo "<a title=\"$strexplainall\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&mode=$mode&hook=ALL\">$strallentries</a>";
}
}
}
-function glossary_print_special_links($cm, $glossary, $l, $tab) {
+function glossary_print_special_links($cm, $glossary, $mode, $hook) {
global $CFG;
if ( $glossary->showspecial and $glossary->displayformat != GLOSSARY_FORMAT_CONTINUOUS ) {
$strspecial = get_string("special", "glossary");
- if ( $l == 'SPECIAL' ) {
+ if ( $hook == 'SPECIAL' ) {
echo "<b>$strspecial</b> | ";
} else {
$strexplainspecial = strip_tags(get_string("explainspecial","glossary"));
- echo "<a title=\"$strexplainspecial\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&l=SPECIAL&tab=$tab\">$strspecial</a> | ";
+ echo "<a title=\"$strexplainspecial\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&mode=$mode&hook=SPECIAL\">$strspecial</a> | ";
}
}
}
-function glossary_print_alphabet_links($cm, $glossary,$l, $tab) {
+function glossary_print_alphabet_links($cm, $glossary, $mode, $hook) {
global $CFG;
if ( $glossary->showalphabet and $glossary->displayformat != GLOSSARY_FORMAT_CONTINUOUS ) {
$alphabet = explode(",", get_string("alphabet"));
$letters_by_line = 14;
for ($i = 0; $i < count($alphabet); $i++) {
- if ( $l == $alphabet[$i] and $l) {
+ if ( $hook == $alphabet[$i] and $hook) {
echo "<b>$alphabet[$i]</b>";
} else {
- echo "<a href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&l=$alphabet[$i]&tab=$tab\">$alphabet[$i]</a>";
+ echo "<a href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&mode=$mode&hook=$alphabet[$i]\">$alphabet[$i]</a>";
}
if ((int) ($i % $letters_by_line) != 0 or $i == 0) {
echo ' | ';
@@ -1003,7 +1075,7 @@ function glossary_print_alphabet_links($cm, $glossary,$l, $tab) {
}
}
-function glossary_print_sorting_links($cm, $sortkey,$sortorder, $tab) {
+function glossary_print_sorting_links($cm, $mode, $sortkey = '',$sortorder = '') {
global $CFG;
$strsort = get_string("sortchronogically", "glossary");
$strsortbycreation = get_string("sortbycreation", "glossary");
@@ -1057,8 +1129,8 @@ function glossary_print_sorting_links($cm, $sortkey,$sortorder, $tab) {
$cordertitle = get_string("ascending","glossary");
$uordertitle = get_string("ascending","glossary");
}
- echo "<br>$strsort: $ubtag<a title=\"$strsortbylastupdate $uordertitle\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&sortkey=UPDATE$uneworder&tab=$tab\">$strsortbylastupdate$uicon</a>$uendbtag | ".
- "$cbtag<a title=\"$strsortbycreation $cordertitle\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&sortkey=CREATION$cneworder&tab=$tab\">$strsortbycreation$cicon</a>$cendbtag</p>";
+ echo "<br>$strsort: $ubtag<a title=\"$strsortbylastupdate $uordertitle\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&sortkey=UPDATE$uneworder&mode=$mode\">$strsortbylastupdate$uicon</a>$uendbtag | ".
+ "$cbtag<a title=\"$strsortbycreation $cordertitle\" href=\"$CFG->wwwroot/mod/glossary/view.php?id=$cm->id&sortkey=CREATION$cneworder&mode=$mode\">$strsortbycreation$cicon</a>$cendbtag</p>";
}
function glossary_sort_entries ( $entry0, $entry1 ) {
@@ -1137,7 +1209,7 @@ function glossary_print_dynaentry($courseid, $entries) {
echo "</tr></table></center>";
}
-function glossary_generate_export_file($glossary, $l = "", $cat = 0) {
+function glossary_generate_export_file($glossary, $hook = "", $hook = 0) {
global $CFG;
glossary_check_moddata_dir($glossary);
$h = glossary_open_xml($glossary);
@@ -1154,30 +1226,31 @@ function glossary_generate_export_file($glossary, $l = "", $cat = 0) {
fwrite ($h,glossary_full_tag("USEDYNALINK",2,false,$glossary->usedynalink));
fwrite ($h,glossary_full_tag("DEFAULTAPPROVAL",2,false,$glossary->defaultapproval));
fwrite ($h,glossary_full_tag("GLOBALGLOSSARY",2,false,$glossary->globalglossary));
+ fwrite ($h,glossary_full_tag("ENTBYPAGE",2,false,$glossary->entbypage));
if ( $entries = get_records("glossary_entries","glossaryid",$glossary->id) ) {
$status = fwrite ($h,glossary_start_tag("ENTRIES",2,true));
foreach ($entries as $entry) {
$permissiongranted = 1;
- if ( $l ) {
- switch ( $l ) {
+ if ( $hook ) {
+ switch ( $hook ) {
case "ALL":
case "SPECIAL":
break;
default:
- $permissiongranted = ($entry->concept[ strlen($l)-1 ] == $l);
+ $permissiongranted = ($entry->concept[ strlen($hook)-1 ] == $hook);
break;
}
}
- if ( $cat ) {
- switch ( $cat ) {
+ if ( $hook ) {
+ switch ( $hook ) {
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);
+ $permissiongranted = record_exists("glossary_entries_categories","entryid",$entry->id, "categoryid",$hook);
break;
}
}
@@ -1207,6 +1280,7 @@ function glossary_generate_export_file($glossary, $l = "", $cat = 0) {
$status = fwrite ($h,glossary_start_tag("CATEGORY",5,true));
fwrite($h,glossary_full_tag("NAME",6,false,$category->name));
+ fwrite($h,glossary_full_tag("USEDYNALINK",6,false,$category->usedynalink));
$status = fwrite($h,glossary_end_tag("CATEGORY",5,true));
}
$status = fwrite($h,glossary_end_tag("CATEGORIES",4,true));
@@ -1336,4 +1410,4 @@ function glossary_check_dir_exists($dir,$create=false) {
}
return $status;
}
-?>
+?>
View
20 mod/glossary/mod.html
@@ -5,19 +5,22 @@
global $CFG;
if (!isset($form->studentcanpost)) {
- $form->studentcanpost = $CFG->cnfstudentcanpost;
+ $form->studentcanpost = $CFG->glossary_studentspost;
}
if (!isset($form->allowduplicatedentries)) {
- $form->allowduplicatedentries = $CFG->cnfallowdupentries;
+ $form->allowduplicatedentries = $CFG->glossary_dupentries;
}
if (!isset($form->allowcomments)) {
- $form->allowcomments = $CFG->cnfallowcomments;
+ $form->allowcomments = $CFG->glossary_allowcomments;
}
if (!isset($form->usedynalink)) {
- $form->usedynalink = $CFG->cnflinkglossaries;
+ $form->usedynalink = $CFG->glossary_linkbydefault;
}
if (!isset($form->defaultapproval)) {
- $form->defaultapproval = $CFG->cnfapprovalstatus;
+ $form->defaultapproval = $CFG->glossary_defaultapproval;
+}
+if (!isset($form->entbypage)) {
+ $form->entbypage = $CFG->glossary_entbypage;
}
if (!isset($form->mainglossary)) {
$form->mainglossary = 0;
@@ -70,6 +73,13 @@
<textarea name="intro" rows=5 cols=50 wrap="virtual"><?php p($form->intro) ?></textarea>
</td>
</tr>
+<TR valign=top>
+ <TD align=right><P><B><?php echo get_string("entbypage", "glossary") ?>:</B></P></TD>
+ <TD>
+ <input name=entbypage type=text size=2 value="<?php p($form->entbypage) ?>"> <?php helpbutton("entbypage", get_string("entbypage", "glossary"), "glossary") ?>
+ </TD>
+</TR>
+
<!-- More rows go in here... -->
<?php
if (isadmin() ) {
View
41 mod/glossary/print.php
@@ -5,13 +5,12 @@
global $CFG;
require_variable($id); // Course Module ID
- require_variable($tab,GLOSSARY_STANDARD_VIEW); // format to show the entries
+ require_variable($mode,"letter"); // format to show the entries
optional_variable($sortkey,"UPDATE"); // Sorting key if TAB = GLOSSARY_DATE_VIEW
optional_variable($sortorder,"asc"); // Sorting order if TAB = GLOSSARY_DATE_VIEW
- optional_variable($l,"ALL");
+ optional_variable($hook,"ALL");
optional_variable($eid);
optional_variable($search);
- optional_variable($cat,GLOSSARY_SHOW_ALL_CATEGORIES);
if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect");
@@ -33,19 +32,18 @@
}
if ( $eid ) {
- $l = '';
- $tab = GLOSSARY_STANDARD_VIEW;
+ $mode = 'entry';
}
/// Generating the SQL based on the format to show
- switch ($tab) {
- case GLOSSARY_CATEGORY_VIEW:
+ switch ($mode) {
+ case "cat":
$where = '';
- if ($cat) {
- if ( $cat != GLOSSARY_SHOW_ALL_CATEGORIES and $cat != GLOSSARY_SHOW_NOT_CATEGORISED ) {
- $where = 'and c.id = ' . $cat;
+ if ($hook) {
+ if ( $hook != GLOSSARY_SHOW_ALL_CATEGORIES and $hook != GLOSSARY_SHOW_NOT_CATEGORISED ) {
+ $where = 'and c.id = ' . $hook;
}
}
- $entries = get_records_sql("SELECT c.name pivot, e.*
+ $entries = get_records_sql("SELECT ec.id, c.name pivot, e.*
FROM {$CFG->prefix}glossary_entries e,
{$CFG->prefix}glossary_entries_categories ec,
{$CFG->prefix}glossary_categories as c
@@ -56,7 +54,7 @@
break;
- case GLOSSARY_DATE_VIEW:
+ case "date":
//// Valid sorting values
switch ($sortkey) {
case 'CREATION':
@@ -79,7 +77,7 @@
ORDER BY e.$sortkey $sortorder");