]> git.mjollnir.org Git - moodle.git/commitdiff
[Changed] The print_simple_box_start/stop changes conflicted greatly with the display...
authormark-nielsen <mark-nielsen>
Sun, 19 Mar 2006 01:53:50 +0000 (01:53 +0000)
committermark-nielsen <mark-nielsen>
Sun, 19 Mar 2006 01:53:50 +0000 (01:53 +0000)
[Added] new styles to styles.php to help display the buttons correctly.

mod/lesson/styles.php
mod/lesson/view.php

index f768fc61bc2730fb2a8e43fd1a3e57628aad1d5c..15f6150cdbbde10dda6a93af0eca17af174bacd2 100644 (file)
 .mod-lesson .standardbutton {
 }
 
+/* Next three classes are for branch table buttons when displayed horizontally */
+.mod-lesson .prevhorizontal {
+    display: inline;
+    float: left;
+}
+
+.mod-lesson .nexthorizontal {
+    display: inline;
+    float: right;
+}
+
+.mod-lesson .standardhorizontal {
+    display: inline;
+}
+
+/* Next three classes are for branch table buttons when displayed vertically */
+.mod-lesson .prevvertical {
+}
+
+.mod-lesson .nextvertical a {
+}
+
+.mod-lesson .standardvertical a {
+}
+
 /*  branchbuttoncontainer wraps around branch table buttons */
 .mod-lesson .branchbuttoncontainer {
     text-align: center;
+    padding: 3px;
 }
 
 /*  branchslidetop and branchslidebottom classes are wrapped around the branch buttons (branchslidetop around 
     /*  You could float them out of the slide
     position: absolute;
     top: 60px;*/
-    /*  You may choose to not show them at all
-    display: none;*/
+    /*  You may choose to not show them at all */
+    display: none;
 }
 
 .mod-lesson .branchslidebottom {
-    /*  You may choose to not show them at all 
+    /*  You may choose to not show them at all
     display: none; */
+    padding-top: 10px;
 }
 
 /***
index cefa9947ce284cd112f71586a913c1f4e6625ac9..dbe366516a9aa1a592d44d63d78b29fb7ae9dda0 100644 (file)
                     case LESSON_BRANCHTABLE :                        
                         $options = new stdClass;
                         $options->para = false;
-                        $buttons = array('next' => '', 'prev' => '', 'other' => array());
-                        // seperate out next and previous jumps from the other jumps 
+                        $buttons = array('next' => array(), 'prev' => array(), 'other' => array());
+                    /// seperate out next and previous jumps from the other jumps 
                         foreach ($answers as $answer) {
                             if ($answer->jumpto == LESSON_NEXTPAGE) {
-                                $buttons['next'] = '<div class="lessonbutton nextbutton"><a href="javascript:document.answerform.jumpto.value='.$answer->jumpto.';document.answerform.submit();">'.
-                                        strip_tags(format_text($answer->answer, FORMAT_MOODLE, $options)).'</a></div>';
+                                $buttons['next'][] = '<a href="javascript:document.answerform.jumpto.value='.$answer->jumpto.';document.answerform.submit();">'.
+                                        strip_tags(format_text($answer->answer, FORMAT_MOODLE, $options)).'</a>';
                             } else if ($answer->jumpto == LESSON_PREVIOUSPAGE) {
-                                $buttons['prev'] = '<div class="lessonbutton previousbutton"><a href="javascript:document.answerform.jumpto.value='.$answer->jumpto.';document.answerform.submit();">'.
-                                        strip_tags(format_text($answer->answer, FORMAT_MOODLE, $options)).'</a></div>';
+                                $buttons['prev'][] = '<a href="javascript:document.answerform.jumpto.value='.$answer->jumpto.';document.answerform.submit();">'.
+                                        strip_tags(format_text($answer->answer, FORMAT_MOODLE, $options)).'</a>';
                             } else {
-                                $buttons['other'][] = '<div class="lessonbutton standardbutton"><a href="javascript:document.answerform.jumpto.value='.$answer->jumpto.';document.answerform.submit();">'.
-                                        strip_tags(format_text($answer->answer, FORMAT_MOODLE, $options)).'</a></div>';
+                                $buttons['other'][] = '<a href="javascript:document.answerform.jumpto.value='.$answer->jumpto.';document.answerform.submit();">'.
+                                        strip_tags(format_text($answer->answer, FORMAT_MOODLE, $options)).'</a>';
                             }
                         }
-                        
-                        if ($lesson->slideshow) {
-                            $px = $lesson->width - 30; // give us some breathing room
-                            $width = ' width="'.$px.'px"';
-                        } else {
-                            $width = ' width="100%"';
-                        }
-                        
-                        $fullbuttonhtml = '<div class="branchbuttoncontainer">'."\n";
+                    
+                    /// set the order and orientation (order is very important for the divs to work for horizontal!)
                         if ($page->layout) {
-                            // tried to do this with CSS, but couldnt get it to work in MacIE browser.  Using tables instead :(
-                            // don't care if empty or not because we want to keep the table structure
-                            $fullbuttonhtml .= '<table '.$width.' align="center"><tr><td align="left" width="20%">'.$buttons['prev']."</td>\n";
-                            $fullbuttonhtml .= '<td><table align="center"><tr><td>'.implode("</td>\n<td>", $buttons['other'])."</td></tr></table></td>\n";
-                            $fullbuttonhtml .= '<td align="right" width="20%">'.$buttons['next']."</td></tr></table>\n";
-                        } else {
-                            // care about emptyness here
-                            $temparray = array();
-                            if (!empty($buttons['next'])) {
-                                $temparray[] = $buttons['next'];
+                            $orientation = 'horizontal';
+                            $a = 'a';
+                            $b = 'b';
+                            $c = 'c';
+                            $implode = ' ';
+                            $implode2 = "\n    ";
+                            if (empty($buttons['other'])) {
+                                $buttons['other'][] = '&nbsp;';  // very critical! If nothing is in the middle, 
+                                                                 // then the div style float left/right will not 
+                                                                 // render properly with next/previous buttons
                             }
-                            if (!empty($buttons['other'])) {
-                                $temparray = array_merge($temparray, $buttons['other']);
-                            }
-                            if (!empty($buttons['prev'])) {
-                                $temparray[] = $buttons['prev'];
-                            }
-                            $fullbuttonhtml .= '<table align="center" cellpadding="3px"><tr><td align="center">'.
-                                                implode("</td></tr>\n<tr><td align=\"center\">", $temparray).
-                                                "</td></tr></table>\n";
+                        } else {
+                            $orientation = 'vertical';
+                            $a = 'c';
+                            $b = 'a';
+                            $c = 'b';
+                            $implode = '<br /><br />';
+                            $implode2 = "<br />\n    ";
                         }
-                        $fullbuttonhtml .= "</div>\n";
+                        $buttonsarranged = array();
+                        $buttonsarranged[$a] = '<div class="lessonbutton prevbutton prev'.$orientation.'">'.implode($implode, $buttons['prev']).'</div>';
+                        $buttonsarranged[$b] = '<div class="lessonbutton nextbutton next'.$orientation.'">'.implode($implode, $buttons['next']).'</div>';
+                        $buttonsarranged[$c] = '<div class="lessonbutton standardbutton standard'.$orientation.'">'.implode($implode, $buttons['other']).'</div>';
+                        ksort($buttonsarranged); // sort by key
+                        
+                        $fullbuttonhtml = "\n<div class=\"branchbuttoncontainer\">\n    " . implode($implode2, $buttonsarranged). "\n</div>\n";
                     
                         if ($lesson->slideshow) {
-                            //echo '<div class="branchslidetop">' . $fullbuttonhtml . '</div>';
+                            echo '<div class="branchslidetop">' . $fullbuttonhtml . '</div>';
                             $options = new stdClass;
                             $options->noclean = true;
-                            echo '<div class="contents">'.format_text($page->contents, FORMAT_MOODLE, $options).'</div>';;
-                            echo '</table></div><table cellpadding="5" cellspacing="5" align="center">';
+                            echo '<div class="contents">'.format_text($page->contents, FORMAT_MOODLE, $options)."</div>\n";
+                            echo '</div><!--end slideshow div-->';
+                            echo '<div class="branchslidebottom">' . $fullbuttonhtml . '</div>';
                         } else {
-                            echo '<tr><td><table width="100%">';
-                        }
-                        echo '<input type="hidden" name="jumpto" />';
-                        
-                        if (!$lesson->slideshow) {
-                            if (!empty($buttons['next']) or !empty($buttons['prev'])) {
-                                print_simple_box_start("center", '100%');
-                            } else {
-                                print_simple_box_start("center");
-                            }
-                            
+                            print_simple_box_start('center');
                             echo $fullbuttonhtml;
-                            echo '</table></table>';
                             print_simple_box_end();
-                        } else {
-                            echo '<div class="branchslidebottom">' . $fullbuttonhtml . '</div>';
                         }
+                        echo '<input type="hidden" name="jumpto" />';
+                        
                         break;
                     case LESSON_ESSAY :
                         if (isset($USER->modattempts[$lesson->id])) {
             echo "<div align=\"center\" style=\"padding: 5px;\" class=\"lessonbutton standardbutton\"><a href=\"../../grade/index.php?id=$course->id\">".get_string("viewgrades", "lesson")."</a></div>\n"; //view grades
         }
         
-        if ($lesson->slideshow) {  // ends the slideshow div
-            echo '</div>';
-        }
-        
         if ($lesson->displayleft || $lesson->slideshow) {  // this ends the table cell and table for the leftmenu or for slideshow
             echo "</td></tr></table>";
         }