MDL-16221
[moodle-linuxchix.git] / mod / glossary / formats / encyclopedia / encyclopedia_format.php
blob7d50b0eab983431496a5bd7638031c567e73b212
1 <?php // $Id$
3 function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode='',$hook='',$printicons=1,$ratings=NULL, $aliases=true) {
4 global $CFG, $USER;
7 $user = get_record('user', 'id', $entry->userid);
8 $strby = get_string('writtenby', 'glossary');
10 $return = false;
11 if ($entry) {
12 echo '<table class="glossarypost encyclopedia" cellspacing="0">';
13 echo '<tr valign="top">';
14 echo '<td class="left picture">';
16 print_user_picture($user, $course->id, $user->picture);
18 echo '</td>';
19 echo '<th class="entryheader">';
20 echo '<div class="concept">';
21 glossary_print_entry_concept($entry);
22 echo '</div>';
24 $fullname = fullname($user);
25 $by->name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$course->id.'">'.$fullname.'</a>';
26 $by->date = userdate($entry->timemodified);
27 echo '<span class="author">'.get_string('bynameondate', 'forum', $by).'</span>';
29 echo '</th>';
31 echo '<td class="entryapproval">';
32 glossary_print_entry_approval($cm, $entry, $mode);
33 echo '</td>';
35 echo '</tr>';
37 echo '<tr valign="top">';
38 echo '<td class="left side" rowspan="2">&nbsp;</td>';
39 echo '<td colspan="2" class="entry">';
41 if ($entry->attachment) {
42 $entry->course = $course->id;
43 if (strlen($entry->definition)%2) {
44 $align = 'right';
45 } else {
46 $align = 'left';
48 glossary_print_entry_attachment($entry,'',$align,false);
50 glossary_print_entry_definition($entry);
52 if ($printicons or $ratings or $aliases) {
53 echo '</td></tr>';
54 echo '<tr>';
55 echo '<td colspan="2" class="entrylowersection">';
56 $return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry,$mode,$hook,$printicons,$ratings, $aliases);
57 echo ' ';
60 echo '</td></tr>';
61 echo "</table>\n";
63 } else {
64 echo '<div style="text-align:center">';
65 print_string('noentry', 'glossary');
66 echo '</div>';
69 return $return;
72 function glossary_print_entry_encyclopedia($course, $cm, $glossary, $entry, $mode='', $hook='', $printicons=1, $ratings=NULL) {
74 //The print view for this format is exactly the normal view, so we use it
76 //Take out autolinking in definitions un print view
77 $entry->definition = '<span class="nolink">'.$entry->definition.'</span>';
79 //Call to view function (without icons, ratings and aliases) and return its result
81 return glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode, $hook, false, false, false);