Browse files

Old-awaiting for 1.4.2 release changes in the glossary.

Now, print view is different for each format (consistent with it).
New, custom formats can, optionally, define their print view. Else
the default one will be used.
With this, 1.4.x glossary developments are finished and we can start
solving some pending things in 1.5...
  • Loading branch information...
1 parent f94c960 commit ffe79bd906e72ab9ad84f884fcc879239543f303 stronk7 committed Nov 9, 2004
View
22 mod/glossary/formats/TEMPLATE/TEMPLATE_format.php
@@ -1,6 +1,6 @@
<?PHP // $Id$
-function glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode="",$hook="",$printicons=1,$ratings=NULL) {
+function glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL, $aliases=true) {
global $THEME, $CFG, $USER;
@@ -69,17 +69,18 @@ function glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode="",
//Line separator to show this template fine. :-)
echo "<br />\n";
- //Use this function to show aliases, editing icons and ratings
+ //Use this function to show aliases, editing icons and ratings (all know as the 'lower section')
//Comments: You can configure this parameters:
//----Define when to show the aliases popup
- $aliases = true; //Values: true, false (Default: true)
+ // use it only if you are really sure!
+ //$aliases = true; //Values: true, false (Default: true)
//----Uncoment this line to avoid ratings being showed
// use it only if you are really sure! You can define this in the glossary conf. page.
//$ratings = NULL;
//----Uncoment this line to avoid editing icons being showed
// use it only if you are really sure!
//$printicons = false;
- $return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry,$mode,$hook,$printicons,$ratings,$aliases);
+ $return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $ratings, $aliases);
} else {
echo "<center>";
print_string("noentry", "glossary");
@@ -92,4 +93,17 @@ function glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode="",
return $return;
}
+function glossary_print_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL) {
+
+ //The print view for this format is exactly the normal view, so we use it
+ //Anyway, you can modify this to use your own print format!!
+
+ //Take out autolinking in definitions in print view
+ $entry->definition = '<nolink>'.$entry->definition.'</nolink>';
+
+ //Call to view function (without icons, ratings and aliases) and return its result
+ return glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode, $hook, false, false, false);
+
+}
+
?>
View
16 mod/glossary/formats/continuous/continuous_format.php
@@ -1,6 +1,6 @@
<?PHP // $Id$
-function glossary_show_entry_continuous($course, $cm, $glossary, $entry, $mode="",$hook="",$printicons=1,$ratings=NULL) {
+function glossary_show_entry_continuous($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL, $aliases=false) {
global $THEME, $USER;
@@ -16,12 +16,24 @@ function glossary_show_entry_continuous($course, $cm, $glossary, $entry, $mode="
echo ":</b> ";
glossary_print_entry_definition($entry);
$entry->alias = "";
- $return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry,$mode,$hook,$printicons,$ratings,false);
+ $return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $ratings, $aliases);
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
return $return;
}
+function glossary_print_entry_continuous($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL) {
+
+ //The print view for this format is exactly the normal view, so we use it
+
+ //Take out autolinking in definitions un print view
+ $entry->definition = '<nolink>'.$entry->definition.'</nolink>';
+
+ //Call to view function (without icons, ratings and aliases) and return its result
+ return glossary_show_entry_continuous($course, $cm, $glossary, $entry, $mode, $hook, false, false, false);
+
+}
+
?>
View
15 mod/glossary/formats/dictionary/dictionary_format.php
@@ -1,6 +1,6 @@
<?PHP // $Id$
-function glossary_show_entry_dictionary($course, $cm, $glossary, $entry, $mode="",$hook="",$printicons=1,$ratings=NULL) {
+function glossary_show_entry_dictionary($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL, $aliases=true) {
global $THEME, $CFG, $USER;
@@ -15,12 +15,23 @@ function glossary_show_entry_dictionary($course, $cm, $glossary, $entry, $mode="
glossary_print_entry_concept($entry);
echo ":</b> ";
glossary_print_entry_definition($entry);
- $return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry,$mode,$hook,$printicons,$ratings);
+ $return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $ratings, $aliases);
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
return $return;
}
+function glossary_print_entry_dictionary($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL) {
+
+ //The print view for this format is exactly the normal view, so we use it
+
+ //Take out autolinking in definitions in print view
+ $entry->definition = '<nolink>'.$entry->definition.'</nolink>';
+
+ //Call to view function (without icons, ratings and aliases) and return its result
+ return glossary_show_entry_dictionary($course, $cm, $glossary, $entry, $mode, $hook, false, false, false);
+}
+
?>
View
25 mod/glossary/formats/encyclopedia/encyclopedia_format.php
@@ -1,6 +1,6 @@
<?PHP // $Id$
-function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode="",$hook="",$printicons=1,$ratings=NULL) {
+function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode="",$hook="",$printicons=1,$ratings=NULL, $aliases=true) {
global $THEME, $CFG, $USER;
$colour = $THEME->cellheading2;
@@ -47,9 +47,14 @@ function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode
glossary_print_entry_attachment($entry,"",$align,false);
}
glossary_print_entry_definition($entry);
-
- $return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry,$mode,$hook,$printicons,$ratings);
- echo ' ';
+ if ($printicons or $ratings or $aliases) {
+ echo "</td></tr>";
+ echo "\n<td bgcolor=\"$colour\" width=35 valign=top class=\"forumpostside\">&nbsp;</td>";
+ echo "\n<td width=100% colspan=\"2\" bgcolor=\"$THEME->cellcontent\" class=\"forumpostmessage\">";
+
+ $return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry,$mode,$hook,$printicons,$ratings, $aliases);
+ echo ' ';
+ }
} else {
echo "<center>";
print_string("noentry", "glossary");
@@ -62,4 +67,16 @@ function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode
return $return;
}
+function glossary_print_entry_encyclopedia($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL) {
+
+ //The print view for this format is exactly the normal view, so we use it
+
+ //Take out autolinking in definitions un print view
+ $entry->definition = '<nolink>'.$entry->definition.'</nolink> ';
+
+ //Call to view function (without icons, ratings and aliases) and return its result
+ return glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode, $hook, false, false, false);
+
+}
+
?>
View
27 mod/glossary/formats/entrylist/entrylist_format.php
@@ -1,6 +1,6 @@
<?PHP // $Id$
-function glossary_show_entry_entrylist($course, $cm, $glossary, $entry, $mode="",$hook="",$printicons=1,$ratings=NULL) {
+function glossary_show_entry_entrylist($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL, $aliases=true) {
global $THEME, $USER;
$colour = "#FFFFFF";
@@ -31,4 +31,29 @@ function glossary_show_entry_entrylist($course, $cm, $glossary, $entry, $mode=""
return $return;
}
+function glossary_print_entry_entrylist($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL) {
+
+ //The print view for this format is different from the normal view, so we implement it here completely
+ global $THEME, $CFG, $USER;
+
+ $colour = $THEME->cellheading2;
+
+ //Take out autolinking in definitions un print view
+ $entry->definition = '<nolink>'.$entry->definition.'</nolink>';
+
+ echo "\n<table border=0 width=95% cellspacing=0 valign=top cellpadding=3 class=forumpost align=center>\n";
+ echo "<tr>\n";
+ echo "<td width=\"100%\" valign=\"top\" bgcolor=\"#FFFFFF\">\n";
+ echo "<b>";
+ glossary_print_entry_concept($entry);
+ echo ":</b> ";
+ glossary_print_entry_definition($entry);
+ $return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, false, false, false);
+ echo "</td>\n";
+ echo "</tr>\n";
+ echo "</table>\n";
+
+ return $return;
+}
+
?>
View
16 mod/glossary/formats/faq/faq_format.php
@@ -1,6 +1,6 @@
<?PHP // $Id$
-function glossary_show_entry_faq($course, $cm, $glossary, $entry, $mode="",$hook="",$printicons=1,$ratings=NULL) {
+function glossary_show_entry_faq($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL, $aliases=true) {
global $THEME, $USER;
$return = false;
if ( $entry ) {
@@ -34,7 +34,7 @@ function glossary_show_entry_faq($course, $cm, $glossary, $entry, $mode="",$hook
glossary_print_entry_definition($entry);
- $return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook,$printicons,$ratings);
+ $return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $ratings, $aliases);
echo '</td></tr></table>';
} else {
@@ -45,4 +45,16 @@ function glossary_show_entry_faq($course, $cm, $glossary, $entry, $mode="",$hook
return $return;
}
+function glossary_print_entry_faq($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL) {
+
+ //The print view for this format is exactly the normal view, so we use it
+
+ //Take out autolinking in definitions un print view
+ $entry->definition = '<nolink>'.$entry->definition.'</nolink>';
+
+ //Call to view function (without icons, ratings and aliases) and return its result
+ return glossary_show_entry_faq($course, $cm, $glossary, $entry, $mode, $hook, false, false, false);
+
+}
+
?>
View
16 mod/glossary/formats/fullwithauthor/fullwithauthor_format.php
@@ -1,6 +1,6 @@
<?PHP // $Id$
-function glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mode="",$hook="",$printicons=1,$ratings=NULL) {
+function glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL, $aliases=true) {
global $THEME, $CFG, $USER;
$colour = $THEME->cellheading2;
@@ -40,7 +40,7 @@ function glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mo
echo "\n<td width=100% colspan=\"2\" bgcolor=\"$THEME->cellcontent\" class=\"forumpostmessage\">";
glossary_print_entry_definition($entry);
- $return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry,$mode,$hook,$printicons,$ratings);
+ $return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $ratings, $aliases);
echo ' ';
} else {
echo "<center>";
@@ -53,4 +53,16 @@ function glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mo
return $return;
}
+function glossary_print_entry_fullwithauthor($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL) {
+
+ //The print view for this format is exactly the normal view, so we use it
+
+ //Take out autolinking in definitions un print view
+ $entry->definition = '<nolink>'.$entry->definition.'</nolink>';
+
+ //Call to view function (without icons, ratings and aliases) and return its result
+ return glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mode, $hook, false, false, false);
+
+}
+
?>
View
16 mod/glossary/formats/fullwithoutauthor/fullwithoutauthor_format.php
@@ -1,6 +1,6 @@
<?PHP // $Id$
-function glossary_show_entry_fullwithoutauthor($course, $cm, $glossary, $entry, $mode="",$hook="",$printicons=1,$ratings=NULL) {
+function glossary_show_entry_fullwithoutauthor($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL, $aliases=true) {
global $THEME, $CFG, $USER;
$colour = $THEME->cellheading2;
@@ -32,7 +32,7 @@ function glossary_show_entry_fullwithoutauthor($course, $cm, $glossary, $entry,
echo "\n<td width=100% colspan=\"2\" bgcolor=\"$THEME->cellcontent\" class=\"forumpostmessage\">";
glossary_print_entry_definition($entry);
- $return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry,$mode,$hook,$printicons,$ratings);
+ $return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $ratings, $aliases);
echo ' ';
} else {
echo "<center>";
@@ -45,4 +45,16 @@ function glossary_show_entry_fullwithoutauthor($course, $cm, $glossary, $entry,
return $return;
}
+function glossary_print_entry_fullwithoutauthor($course, $cm, $glossary, $entry, $mode="", $hook="", $printicons=1, $ratings=NULL) {
+
+ //The print view for this format is exactly the normal view, so we use it
+
+ //Take out autolinking in definitions un print view
+ $entry->definition = '<nolink>'.$entry->definition.'</nolink>';
+
+ //Call to view function (without icons, ratings and aliases) and return its result
+ return glossary_show_entry_fullwithoutauthor($course, $cm, $glossary, $entry, $mode, $hook, false, false, false);
+
+}
+
?>
View
23 mod/glossary/lib.php
@@ -528,25 +528,40 @@ function glossary_get_entries_by_category($glossary, $hook, $where="", $orderby=
(ge.glossaryid = $glossary->id or ge.sourceglossaryid = $glossary->id) $where $orderby");
}
-function glossary_print_entry($course, $cm, $glossary, $entry, $mode="",$hook="",$printicons = 1, $displayformat = -1, $ratings = NULL) {
+function glossary_print_entry($course, $cm, $glossary, $entry, $mode="",$hook="",$printicons = 1, $displayformat = -1, $ratings = NULL, $printview = false) {
global $THEME, $USER, $CFG;
$return = false;
if ( $displayformat < 0 ) {
$displayformat = $glossary->displayformat;
}
if ($entry->approved or ($USER->id == $entry->userid) or ($mode == 'approval' and !$entry->approved) ) {
$formatfile = $CFG->dirroot.'/mod/glossary/formats/'.$displayformat.'/'.$displayformat.'_format.php';
- $functionname = 'glossary_show_entry_'.$displayformat;
+ if ($printview) {
+ $functionname = 'glossary_print_entry_'.$displayformat;
+ } else {
+ $functionname = 'glossary_show_entry_'.$displayformat;
+ }
if (file_exists($formatfile)) {
include_once($formatfile);
if (function_exists($functionname)) {
$return = $functionname($course, $cm, $glossary, $entry,$mode,$hook,$printicons,$ratings);
+ } else if ($printview) {
+ //If the glossary_print_entry_XXXX function doesn't exist, print default (old) print format
+ $return = glossary_print_entry_default($entry);
}
}
}
return $return;
}
+ //Default (old) print format used if custom function doesn't exist in format
+function glossary_print_entry_default ($entry) {
+ echo '<b>'. strip_tags($entry->concept) . ': </b>';
+ $options->para = false;
+ $definition = format_text('<nolink>' . strip_tags($entry->definition) . '</nolink>', $entry->format,$options);
+ echo ($definition);
+ echo '<br /><br />';
+}
function glossary_print_entry_concept($entry) {
$options->para = false;
@@ -1356,15 +1371,15 @@ function glossary_print_categories_menu($cm, $glossary, $hook, $category) {
$selected = $url;
}
}
- $menu[$url] = $currentcategory->name;
+ $menu[$url] = clean_text($currentcategory->name); //Only clean, not filters
}
}
if ( !$selected ) {
$selected = GLOSSARY_SHOW_NOT_CATEGORISED;
}
if ( $category ) {
- echo $category->name;
+ echo format_text($category->name);
} else {
if ( $hook == GLOSSARY_SHOW_NOT_CATEGORISED ) {
View
17 mod/glossary/print.php
@@ -149,34 +149,33 @@
echo get_string("modulename","glossary") . ': <strong>' . $glossary->name . '</strong><p>';
if ( $allentries ) {
foreach ($allentries as $entry) {
- /// Setting the pivot for the current entry
+
+ // Setting the pivot for the current entry
$pivot = $entry->pivot;
if ( !$fullpivot ) {
$pivot = $pivot[0];
}
+ // If there's group break
if ( $currentpivot != strtoupper($pivot) ) {
+
// print the group break if apply
if ( $printpivot ) {
$currentpivot = strtoupper($pivot);
$pivottoshow = $currentpivot;
if ( isset($entry->uid) ) {
+ // printing the user icon if defined (only when browsing authors)
$user = get_record("user","id",$entry->uid);
$pivottoshow = fullname($user, isteacher($course->id));
}
- echo "<p align=\"center\"><strong><i>$pivottoshow</i></strong></p>" ;
+ echo "<p align=\"center\"><strong><i>".clean_text($pivottoshow)."</i></strong></p>" ;
}
}
- echo '<b>'. strip_tags($entry->concept) . ': </b>';
- $options->para = false;
- $definition = format_text('<nolink>' . strip_tags($entry->definition) . '</nolink>', $entry->format,$options);
-
- echo ($definition);
-
- echo '<br><br>';
+ glossary_print_entry($course, $cm, $glossary, $entry, $mode, $hook,1,$displayformat,false,true);
+
}
}
View
4 mod/glossary/version.php
@@ -5,12 +5,12 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2004080920; // YYYYMMDD = current module version
+$module->version = 2004080931; // YYYYMMDD = current module version
// X = point release version 1,2,3 etc
// Y = increments between point releases
$module->requires = 2004082300; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)
-$release = "1.4.2"; // User-friendly version number
+$release = "1.4.3"; // User-friendly version number
?>

0 comments on commit ffe79bd

Please sign in to comment.