MDL-16221
[moodle-linuxchix.git] / mod / glossary / formats / TEMPLATE / TEMPLATE_format.php
blobcc545746056b980257fb78d31cfd15f3f27fd80a
1 <?php // $Id$
3 function glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1, $ratings=NULL, $aliases=true) {
5 global $CFG, $USER;
8 $user = get_record('user', 'id', $entry->userid);
9 $strby = get_string('writtenby', 'glossary');
11 if ($entry) {
13 echo '<table class="glossarypost TEMPLATE">';
14 echo '<tr>';
15 echo '<td class="entryheader">';
17 //Use this function to show author's image
18 //Comments: Configuration not supported
19 print_user_picture($user, $course->id, $user->picture);
21 //Line separator to show this template fine. :-)
22 echo '<br />';
24 //Use this code to show author's name
25 //Comments: Configuration not supported
26 $fullname = fullname($user);
27 $by = new object();
28 $by->name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$course->id.'">'.$fullname.'</a>';
29 $by->date = userdate($entry->timemodified);
30 echo '<span class="author">'.get_string('bynameondate', 'forum', $by).'</span>' . '<br />';
32 //Use this code to show modification date
33 //Comments: Configuration not supported
34 echo get_string('lastedited').': '. userdate($entry->timemodified) . '<br /></span>';
36 //Use this function to show the approval button. It'll be shown if necessary
37 //Comments: You can configure this parameters:
38 //----Define where to show the approval button
39 $approvalalign = 'right'; //Values: left, center and right (default right)
40 //----Define if the approval button must be showed into a 100% width table
41 $approvalinsidetable = true; //Values: true, false (default true)
42 //Call the function
43 glossary_print_entry_approval($cm, $entry, $mode, $approvalalign, $approvalinsidetable);
45 //Line separator to show this template fine. :-)
46 echo '<br />';
48 echo '</td>';
50 echo '<td class="entryattachment">';
52 //Use this function to show the attachment. It'll be showed if necessary
53 //Comments: You can configure this parameters:
54 //----Define how to show the attachment
55 $attachmentformat = 'html'; //Values: html (link) and NULL (inline image if possible) (default NULL)
56 //----Define where to show the attachment
57 $attachmentalign = 'right'; //Values: left, center and right (default right)
58 //----Define if the attachment must be showed into a 100% width table
59 $attachmentinsidetable = true; //Values: true, false (default true)
60 //Call the function
61 glossary_print_entry_attachment($entry,$attachmentformat,$attachmentalign,$attachmentinsidetable);
63 //Line separator to show this template fine. :-)
64 echo "<br />\n";
66 echo '</td></tr>';
68 echo '<tr valign="top">';
69 echo '<td class="entry">';
71 //Use this function to print the concept in a heading <h3>
72 //Comments: Configuration not supported
73 glossary_print_entry_concept($entry);
75 //Line separator not normally needed now.
76 //echo "<br />\n";
78 //Use this function to show the definition
79 //Comments: Configuration not supported
80 glossary_print_entry_definition($entry);
82 //Line separator to show this template fine. :-)
83 echo "<br />\n";
85 //Use this function to show aliases, editing icons and ratings (all know as the 'lower section')
86 //Comments: You can configure this parameters:
87 //----Define when to show the aliases popup
88 // use it only if you are really sure!
89 //$aliases = true; //Values: true, false (Default: true)
90 //----Uncoment this line to avoid ratings being showed
91 // use it only if you are really sure! You can define this in the glossary conf. page.
92 //$ratings = NULL;
93 //----Uncoment this line to avoid editing icons being showed
94 // use it only if you are really sure!
95 //$printicons = false;
96 $return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $ratings, $aliases);
98 echo '</td>';
99 echo '</tr>';
100 echo "</table>\n";
101 } else {
102 echo '<div style="text-align:center">';
103 print_string('noentry', 'glossary');
104 echo '</div>';
107 return $return;
110 function glossary_print_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1, $ratings=NULL) {
112 //The print view for this format is exactly the normal view, so we use it
113 //Anyway, you can modify this to use your own print format!!
115 //Take out autolinking in definitions in print view
116 $entry->definition = '<span class="nolink">'.$entry->definition.'</span>';
118 //Call to view function (without icons, ratings and aliases) and return its result
119 return glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode, $hook, false, false, false);