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...
Merged from MOODLE_14_STABLE
<?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;
//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");
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);
+
+}
+
?>
<?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;
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);
+
+}
+
?>
<?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;
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);
+}
+
?>
<?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;
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\"> </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");
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);
+
+}
+
?>
<?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";
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;
+}
+
?>
<?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 ) {
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 {
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);
+
+}
+
?>
<?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;
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>";
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);
+
+}
+
?>
<?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;
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>";
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);
+
+}
+
?>
(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 ) {
}
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;
$selected = $url;
}
}
- $menu[$url] = $currentcategory->name;
+ $menu[$url] = clean_text($currentcategory->name); //Only clean, not filters
}
}
if ( !$selected ) {
}
if ( $category ) {
- echo $category->name;
+ echo format_text($category->name);
} else {
if ( $hook == GLOSSARY_SHOW_NOT_CATEGORISED ) {
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);
}
}
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2004091700;
+$module->version = 2004111000;
$module->requires = 2004091700; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)