]> git.mjollnir.org Git - moodle.git/commitdiff
Solve some visualisation issues in encyclopedia format. I think that now
authorstronk7 <stronk7>
Fri, 26 Nov 2004 01:22:41 +0000 (01:22 +0000)
committerstronk7 <stronk7>
Fri, 26 Nov 2004 01:22:41 +0000 (01:22 +0000)
it will be correct!

Merged from MOODLE_14_STABLE

mod/glossary/formats/encyclopedia/encyclopedia_format.php
mod/glossary/lib.php

index 96e06eb02cb87fca17fe70de3af900f2c3ac3290..68e464e311eb4fee175e5290a087aa957a65b70e 100644 (file)
@@ -36,6 +36,7 @@ function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode
         echo "\n<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\">";
+        echo "<table width=\"100%\" border=\"0\"><tr><td>";
 
         if ($entry->attachment) {
             $entry->course = $course->id;
@@ -47,11 +48,9 @@ function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode
             glossary_print_entry_attachment($entry,"",$align,false);
         }
         glossary_print_entry_definition($entry);
+        echo "</td></tr></table>";
+
         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 ' ';
         }
index 7b003ebcbdf649f7fc33ab92fd14a4fbc49352c4..3c4aab27f56b3c15689c71f8c7b70d6f419914d0 100644 (file)
@@ -687,12 +687,14 @@ function  glossary_print_entry_aliases($course, $cm, $glossary, $entry,$mode="",
 function glossary_print_entry_icons($course, $cm, $glossary, $entry,$mode="",$hook="", $type = 'print') {
     global $THEME, $USER, $CFG;
 
+    $output = false;   //To decide if we must really return text in "return". Activate when needed only!
     $importedentry = ($entry->sourceglossaryid == $glossary->id);
     $isteacher = isteacher($course->id);
     $ismainglossary = $glossary->mainglossary;
        
     $return = "<font size=\"1\">";
     if (!$entry->approved) {
+        $output = true;
         $return .= get_string("entryishidden","glossary");
     }
     $return .= glossary_print_entry_commentslink($course, $cm, $glossary, $entry,$mode,$hook,'html');
@@ -701,6 +703,7 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$mode="",$ho
 
     
     if ( (!empty($USER->id) && $glossary->allowcomments && !isguest()) || $isteacher) {
+        $output = true;
         $return .= " <a title=\"" . get_string("addcomment","glossary") . "\" href=\"comment.php?id=$cm->id&amp;eid=$entry->id\"><img src=\"comment.gif\" height=\"11\" width=\"11\" border=\"0\" alt=\"\" /></a> ";
     }
 
@@ -709,9 +712,8 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$mode="",$ho
         if ($isteacher and !$ismainglossary and !$importedentry) {
             $mainglossary = get_record("glossary","mainglossary",1,"course",$course->id);
             if ( $mainglossary ) {  // if there is a main glossary defined, allow to export the current entry
-
+                $output = true;
                 $return .= " <a title=\"" . get_string("exporttomainglossary","glossary") . "\" href=\"exportentry.php?id=$cm->id&amp;entry=$entry->id&amp;mode=$mode&amp;hook=$hook\"><img src=\"export.gif\" height=\"11\" width=\"11\" border=\"0\" alt=\"\" /></a> ";
-
             }
         }
 
@@ -726,6 +728,7 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$mode="",$ho
         // -The user is teacher or he is a student with time permissions (edit period or editalways defined).
         $ineditperiod = ((time() - $entry->timecreated <  $CFG->maxeditingtime) || $glossary->editalways);
         if ( !$importedentry and ($isteacher or ($entry->userid == $USER->id and $ineditperiod))) {
+            $output = true;
             $return .= " <a title=\"" . get_string("delete") . "\" href=\"deleteentry.php?id=$cm->id&amp;mode=delete&amp;entry=$entry->id&amp;prevmode=$mode&amp;hook=$hook\"><img src=\"";
             $return .= $icon;
             $return .= "\" height=\"11\" width=\"11\" border=\"0\" alt=\"\" /></a> ";
@@ -736,6 +739,12 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$mode="",$ho
         }
     }
     $return .= "&nbsp;&nbsp;"; // just to make up a little the output in Mozilla ;)
+
+    //If we haven't calculated any REAL thing, delete result ($return)
+    if (!$output) {
+        $return = '';
+    }
+    //Print or get
     if ($type == 'print') {
         echo $return;
     } else {
@@ -776,7 +785,7 @@ function  glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $m
     if ( $printicons ) {
         $icons   = glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode, $hook,"html");
     }
-    if ($aliases || $printicons || $ratings) {
+    if ($aliases || $icons || $ratings) {
         echo '<table border="0" width="100%" align="center">';
         if ( $aliases ) {
             echo '<tr><td align="center"  valign="top"><font size="1">' .