From: stronk7 Date: Mon, 2 Aug 2004 21:53:47 +0000 (+0000) Subject: TEMPLATE format for glossaries. It is self-documented, but some X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=8d8275a5c54a2c1a0555afadbeba80fd8889bedb;p=moodle.git TEMPLATE format for glossaries. It is self-documented, but some review will be welcome...ciao :-) --- diff --git a/mod/glossary/formats/README.txt b/mod/glossary/formats/README.txt new file mode 100644 index 0000000000..219ce819aa --- /dev/null +++ b/mod/glossary/formats/README.txt @@ -0,0 +1,40 @@ +$Id$ + +Starting with Moodle 1.4, the glossary module supports a plugin +architecture to create your own formats. This plugin system allows +you to "invent" your own presentations for your glossary data. :-) + +To facilitate the creation process a TEMPLATE format has been created. +You should use it as the base for your own modifications. It includes +all the suitable data to be showed. + +Please, follow this STEPS: + +1.-Think about a English word (or short phrase) to define your format. + For futher reference in this document, we call it "THENAME". +2.-Duplicate the TEMPLATE directory (under mod/glossary/formats/TEMPLATE). +3.-Rename it to THENAME. +4.-Go into the THENAME directory and rename the TEMPLATE_format.php file + to THENAME_format.php +5.-Edit the THENAME_format.php file. Change every ocurrence of TEMPLATE to + THENAME. +6.-Login into Moodle. Go to any glossary in your site. +7.-Edit (configure) your glossary. In the Format popup you'll see a new + entry. Is must be showed as "displayformatTHENAME". Select it and see + your glossary. +8.-Edit the THENAME_format.php. Make your own modifications and see them + in your glossary (you will need some PHP skills for this). This file has + been commented as possible to make things easier to you (anyway, every + idea to polish such comments will be welcome, of course!!). +9.-If you want to translate your THENAME format name to some nice name to + be showed in the Format popup, simply, edit your lang/XX/glossary.php + file (where XX is your languaje) and create a new displayformatTHENAME + string. +10.-Enjoy!! (and don't forget to send your amazing glossary formats to + Moodle's forum. They will be welcome!! ;-) + +To talk about Glossay formats, go to: + http://moodle.org/mod/forum/view.php?id=742 + +Eloy (stronk7) +08/02/2004 (MM/DD/YYYY) :-D diff --git a/mod/glossary/formats/TEMPLATE/TEMPLATE_format.php b/mod/glossary/formats/TEMPLATE/TEMPLATE_format.php new file mode 100755 index 0000000000..e5346d836f --- /dev/null +++ b/mod/glossary/formats/TEMPLATE/TEMPLATE_format.php @@ -0,0 +1,95 @@ +cellheading2; + + $user = get_record("user", "id", $entry->userid); + $strby = get_string("writtenby", "glossary"); + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + + if ($entry) { + //Use this function to show author's image + //Comments: Configuration not supported + print_user_picture($user->id, $course->id, $user->picture); + + //Line separator to show this template fine. :-) + echo "
\n"; + + //Use this code to show author's name + //Comments: Configuration not supported + echo "$strby " . fullname($user, isteacher($course->id)) . "
\n"; + + //Use this code to show modification date + //Comments: Configuration not supported + echo get_string("lastedited").": ". userdate($entry->timemodified) . "
\n"; + + //Use this function to show the approval button. It'll be showed if necessary + //Comments: You can configure this parameters: + //----Define where to show the approval button + $approvalalign = 'right'; //Values: left, center and right (default right) + //----Define if the approval button must be showed into a 100% width table + $approvalinsidetable = true; //Values: true, false (default true) + //Call the function + glossary_print_entry_approval($cm, $entry, $mode, $approvalalign, $approvalinsidetable); + + //Line separator to show this template fine. :-) + echo "
\n"; + + //Use this function to show the attachment. It'll be showed if necessary + //Comments: You can configure this parameters: + //----Define how to show the attachment + $attachmentformat = 'html'; //Values: html (link) and NULL (inline image if possible) (default NULL) + //----Define where to show the attachment + $attachmentalign = 'right'; //Values: left, center and right (default right) + //----Define if the attachment must be showed into a 100% width table + $attachmentinsidetable = true; //Values: true, false (default true) + //Call the function + glossary_print_entry_attachment($entry,$attachmentformat,$attachmentalign,$attachmentinsidetable); + + //Line separator to show this template fine. :-) + echo "
\n"; + + //Use this function to print the concept + //Comments: Configuration not supported + glossary_print_entry_concept($entry); + + //Line separator to show this template fine. :-) + echo "
\n"; + + //Use this function to show the definition + //Comments: Configuration not supported + glossary_print_entry_definition($entry); + + //Line separator to show this template fine. :-) + echo "
\n"; + + //Use this function to show aliases, editing icons and ratings + //Comments: You can configure this parameters: + //----Define when to show the aliases popup + $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); + } else { + echo "
"; + print_string("noentry", "glossary"); + echo "
"; + } + echo "
\n"; + + return $return; +} + +?>