lesson: MDL-19890 Fix block-printing code in lesson (I hope)
This got broken by one of the commits for MDL-19077 & MDL-19010
This commit is contained in:
+18
-3
@@ -616,12 +616,27 @@ class required_js extends linked_requirement {
|
||||
* is responsible for outputting this HTML promptly.
|
||||
*/
|
||||
public function asap() {
|
||||
if ($this->is_done()) {
|
||||
return;
|
||||
}
|
||||
if (!$this->manager->is_head_done()) {
|
||||
$this->in_head();
|
||||
return '';
|
||||
} else {
|
||||
return $this->now();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the required JavaScript immediately, so it can be included in some
|
||||
* HTML that is being built.
|
||||
*
|
||||
* This is not really recommeneded. But is necessary in some legacy code that
|
||||
* includes a .js files that does document.write.
|
||||
*
|
||||
* @return string The HTML for the script tag. The caller
|
||||
* is responsible for making sure it is output.
|
||||
*/
|
||||
public function now() {
|
||||
if ($this->is_done()) {
|
||||
return '';
|
||||
}
|
||||
$output = $this->get_html();
|
||||
$this->mark_done();
|
||||
|
||||
@@ -7,26 +7,6 @@
|
||||
**/
|
||||
?>
|
||||
|
||||
<!-- Primary layout table -->
|
||||
<table id="layout-table" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<!-- First Column -->
|
||||
<?php if (lesson_blocks_have_content($lesson, $pageblocks, BLOCK_POS_LEFT)) { ?>
|
||||
<td id="left-column" style="width: <?php echo $leftcolumnwidth; ?>px;">
|
||||
<?php
|
||||
lesson_print_menu_block($cm->id, $lesson);
|
||||
|
||||
if (!empty($CFG->showblocksonmodpages)) {
|
||||
if ((blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing())) {
|
||||
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<!-- Start Primary column -->
|
||||
<td id="middle-column">
|
||||
|
||||
<?php if ($lesson->displayleft) { // Skip navigation anchor ?>
|
||||
|
||||
<a name="maincontent" id="maincontent" title="<?php print_string('anchortitle', 'lesson') ?>"></a>
|
||||
@@ -97,23 +77,3 @@
|
||||
<?php } ?>
|
||||
|
||||
</form>
|
||||
</td>
|
||||
<!-- End primary column -->
|
||||
<?php if (lesson_blocks_have_content($lesson, $pageblocks, BLOCK_POS_RIGHT)) { ?>
|
||||
<td id="right-column" style="width: <?php echo $rightcolumnwidth; ?>px;">
|
||||
<!-- Third column -->
|
||||
<?php
|
||||
lesson_print_clock_block($cm->id, $lesson, $timer);
|
||||
lesson_print_mediafile_block($cm->id, $lesson);
|
||||
|
||||
if (!empty($CFG->showblocksonmodpages)) {
|
||||
if ((blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing())) {
|
||||
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- End primary layout table -->
|
||||
@@ -682,7 +682,7 @@
|
||||
$options = new stdClass;
|
||||
$options->noclean = true;
|
||||
$options->para = true;
|
||||
$feedback = print_simple_box(format_text($page->contents, FORMAT_MOODLE, $options), 'center', '', '', 5, 'generalbox', '', true);
|
||||
$feedback = print_box(format_text($page->contents, FORMAT_MOODLE, $options), 'generalbox boxaligncenter', '', true);
|
||||
$feedback .= '<em>'.get_string("youranswer", "lesson").'</em> : '.format_text($studentanswer, FORMAT_MOODLE, $options).
|
||||
"<div class=\"$class\">".format_text($response, FORMAT_MOODLE, $options).'</div>';
|
||||
}
|
||||
@@ -783,12 +783,9 @@
|
||||
|
||||
$PAGE->set_url('mod/lesson/view.php', array('id' => $cm->id, 'pageid' => $page->id));
|
||||
$PAGE->set_subpage($page->id);
|
||||
$pageblocks = blocks_setup($PAGE);
|
||||
|
||||
$leftcolumnwidth = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
|
||||
$rightcolumnwidth = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
|
||||
|
||||
/// Print the header, heading and tabs
|
||||
lesson_add_pretend_blocks($PAGE, $cm, $lesson, $timer);
|
||||
lesson_print_header($cm, $course, $lesson, 'view', true, $page->id);
|
||||
|
||||
include(dirname(__FILE__).'/continue.html');
|
||||
|
||||
+107
-118
@@ -230,19 +230,16 @@ if (!defined("LESSON_RESPONSE_EDITOR")) {
|
||||
function lesson_print_header($cm, $course, $lesson, $currenttab = '', $extraeditbuttons = false, $lessonpageid = NULL) {
|
||||
global $CFG, $PAGE;
|
||||
|
||||
// Note: MDL-19010 there will be further changes to printing header and blocks.
|
||||
// The code will be much nicer than this eventually.
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$activityname = format_string($lesson->name, true, $course->id);
|
||||
$strlesson = get_string('modulename', 'lesson');
|
||||
|
||||
if (empty($title)) {
|
||||
$title = "{$course->shortname}: $activityname";
|
||||
}
|
||||
|
||||
/// Build the buttons
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
if (has_capability('mod/lesson:edit', $context)) {
|
||||
$buttons = update_module_button($cm->id, $course->id, $strlesson);
|
||||
$buttons = update_module_button($cm->id, $course->id, get_string('modulename', 'lesson'));
|
||||
if ($extraeditbuttons) {
|
||||
if ($lessonpageid === NULL) {
|
||||
print_error('invalidpageid', 'lesson');
|
||||
@@ -255,20 +252,6 @@ function lesson_print_header($cm, $course, $lesson, $currenttab = '', $extraedit
|
||||
'<input type="hidden" name="pageid" value="'.$lessonpageid.'" />'.
|
||||
'<input type="submit" value="'.get_string('editpagecontent', 'lesson').'" />'.
|
||||
'</form>';
|
||||
|
||||
if (!empty($CFG->showblocksonmodpages) and $PAGE->user_allowed_editing()) {
|
||||
if ($PAGE->user_is_editing()) {
|
||||
$onoff = 'off';
|
||||
} else {
|
||||
$onoff = 'on';
|
||||
}
|
||||
$buttons .= '<form '.$CFG->frametarget.' method="get" action="'.$CFG->wwwroot.'/mod/lesson/view.php">'.
|
||||
'<input type="hidden" name="id" value="'.$cm->id.'" />'.
|
||||
'<input type="hidden" name="pageid" value="'.$lessonpageid.'" />'.
|
||||
'<input type="hidden" name="edit" value="'.$onoff.'" />'.
|
||||
'<input type="submit" value="'.get_string("blocksedit$onoff").'" />
|
||||
</form>';
|
||||
}
|
||||
}
|
||||
$buttons = '<span class="edit_buttons">' . $buttons .'</span>';
|
||||
}
|
||||
@@ -1735,53 +1718,92 @@ function lesson_displayleftif($lesson) {
|
||||
}
|
||||
|
||||
/**
|
||||
* If there is a media file associated with this
|
||||
* lesson, then print it in a block.
|
||||
*
|
||||
* @param int $cmid Course Module ID for this lesson
|
||||
* @param object $lesson Full lesson record object
|
||||
* @return void
|
||||
**/
|
||||
function lesson_print_mediafile_block($cmid, $lesson) {
|
||||
if (!empty($lesson->mediafile)) {
|
||||
$url = '/mod/lesson/mediafile.php?id='.$cmid;
|
||||
$options = 'menubar=0,location=0,left=5,top=5,scrollbars,resizable,width='. $lesson->mediawidth .',height='. $lesson->mediaheight;
|
||||
$name = 'lessonmediafile';
|
||||
*
|
||||
* @param $cm
|
||||
* @param $lesson
|
||||
* @param $page
|
||||
* @return unknown_type
|
||||
*/
|
||||
function lesson_add_pretend_blocks($page, $cm, $lesson, $timer = null) {
|
||||
$bc = lesson_menu_block_contents($cm->id, $lesson);
|
||||
if (!empty($bc)) {
|
||||
$regions = $page->blocks->get_regions();
|
||||
$firstregion = reset($regions);
|
||||
$page->blocks->add_pretend_block($bc, $firstregion);
|
||||
}
|
||||
|
||||
$content = link_to_popup_window ($url, $name, get_string('mediafilepopup', 'lesson'), '', '', get_string('mediafilepopup', 'lesson'), $options, true);
|
||||
$content .= helpbutton("mediafilestudent", get_string("mediafile", "lesson"), "lesson", true, false, '', true);
|
||||
|
||||
print_side_block(get_string('linkedmedia', 'lesson'), $content, NULL, NULL, '', array('class' => 'mediafile'), get_string('linkedmedia', 'lesson'));
|
||||
$bc = lesson_mediafile_block_contents($cm->id, $lesson);
|
||||
if (!empty($bc)) {
|
||||
$page->blocks->add_pretend_block($bc, $page->blocks->get_default_region());
|
||||
}
|
||||
|
||||
if (!empty($timer)) {
|
||||
$bc = lesson_clock_block_contents($cm->id, $lesson, $timer, $page);
|
||||
if (!empty($bc)) {
|
||||
$page->blocks->add_pretend_block($bc, $page->blocks->get_default_region());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If there is a media file associated with this
|
||||
* lesson, return a block_contents that displays it.
|
||||
*
|
||||
* @param int $cmid Course Module ID for this lesson
|
||||
* @param object $lesson Full lesson record object
|
||||
* @return block_contents
|
||||
**/
|
||||
function lesson_mediafile_block_contents($cmid, $lesson) {
|
||||
if (empty($lesson->mediafile)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$url = '/mod/lesson/mediafile.php?id='.$cmid;
|
||||
$options = 'menubar=0,location=0,left=5,top=5,scrollbars,resizable,width='. $lesson->mediawidth .',height='. $lesson->mediaheight;
|
||||
$name = 'lessonmediafile';
|
||||
|
||||
$content = link_to_popup_window ($url, $name, get_string('mediafilepopup', 'lesson'), '', '', get_string('mediafilepopup', 'lesson'), $options, true);
|
||||
$content .= helpbutton("mediafilestudent", get_string("mediafile", "lesson"), "lesson", true, false, '', true);
|
||||
|
||||
$bc = new block_contents();
|
||||
$bc->title = get_string('linkedmedia', 'lesson');
|
||||
$bc->set_classes('mediafile');
|
||||
$bc->content = $content;
|
||||
|
||||
return $bc;
|
||||
}
|
||||
|
||||
/**
|
||||
* If a timed lesson and not a teacher, then
|
||||
* print the clock
|
||||
* return a block_contents containing the clock.
|
||||
*
|
||||
* @param int $cmid Course Module ID for this lesson
|
||||
* @param object $lesson Full lesson record object
|
||||
* @param object $timer Full timer record object
|
||||
* @return void
|
||||
* @return block_contents
|
||||
**/
|
||||
function lesson_print_clock_block($cmid, $lesson, $timer) {
|
||||
global $CFG, $PAGE;
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cmid);
|
||||
|
||||
function lesson_clock_block_contents($cmid, $lesson, $timer, $page) {
|
||||
// Display for timed lessons and for students only
|
||||
if($lesson->timed and !has_capability('mod/lesson:manage', $context) and !empty($timer)) {
|
||||
|
||||
$clocksettings = Array('starttime'=>$timer->starttime, 'servertime'=>time(),'testlength'=>($lesson->maxtime * 60));
|
||||
$content = $PAGE->requires->data_for_js('clocksettings', $clocksettings)->asap();
|
||||
$content .= $PAGE->requires->js('mod/lesson/timer.js')->asap();
|
||||
$content .= $PAGE->requires->js_function_call('show_clock')->asap();
|
||||
$content .= '<div class="jshidewhenenabled">';
|
||||
$content .= lesson_print_time_remaining($timer->starttime, $lesson->maxtime, true)."\n";
|
||||
$content .= '</div>';
|
||||
|
||||
print_side_block(get_string('timeremaining', 'lesson'), $content, NULL, NULL, '', array('class' => 'clock'), get_string('timeremaining', 'lesson'));
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cmid);
|
||||
if(!$lesson->timed || has_capability('mod/lesson:manage', $context)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$content = '<div class="jshidewhenenabled">';
|
||||
$content .= lesson_print_time_remaining($timer->starttime, $lesson->maxtime, true)."\n";
|
||||
$content .= '</div>';
|
||||
|
||||
$clocksettings = array('starttime'=>$timer->starttime, 'servertime'=>time(),'testlength'=>($lesson->maxtime * 60));
|
||||
$content .= $page->requires->data_for_js('clocksettings', $clocksettings)->now();
|
||||
$content .= $page->requires->js('mod/lesson/timer.js')->now();
|
||||
$content .= $page->requires->js_function_call('show_clock')->now();
|
||||
|
||||
$bc = new block_contents();
|
||||
$bc->title = get_string('timeremaining', 'lesson');
|
||||
$bc->set_classes('clock');
|
||||
$bc->content = $content;
|
||||
|
||||
return $bc;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1792,77 +1814,44 @@ function lesson_print_clock_block($cmid, $lesson, $timer) {
|
||||
* @param object $lesson Full lesson record object
|
||||
* @return void
|
||||
**/
|
||||
function lesson_print_menu_block($cmid, $lesson) {
|
||||
function lesson_menu_block_contents($cmid, $lesson) {
|
||||
global $CFG, $DB;
|
||||
|
||||
if ($lesson->displayleft) {
|
||||
$pageid = $DB->get_field('lesson_pages', 'id', array('lessonid' => $lesson->id, 'prevpageid' => 0));
|
||||
$params = array ("lessonid" => $lesson->id);
|
||||
$pages = $DB->get_records_select('lesson_pages', "lessonid = :lessonid", $params);
|
||||
$currentpageid = optional_param('pageid', $pageid, PARAM_INT);
|
||||
if (!$lesson->displayleft) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($pageid and $pages) {
|
||||
$content = '<a href="#maincontent" class="skip">'.get_string('skip', 'lesson')."</a>\n<div class=\"menuwrapper\">\n<ul>\n";
|
||||
$pageid = $DB->get_field('lesson_pages', 'id', array('lessonid' => $lesson->id, 'prevpageid' => 0));
|
||||
$params = array ("lessonid" => $lesson->id);
|
||||
$pages = $DB->get_records_select('lesson_pages', "lessonid = :lessonid", $params);
|
||||
$currentpageid = optional_param('pageid', $pageid, PARAM_INT);
|
||||
|
||||
while ($pageid != 0) {
|
||||
$page = $pages[$pageid];
|
||||
if (!$pageid || !$pages) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Only process branch tables with display turned on
|
||||
if ($page->qtype == LESSON_BRANCHTABLE and $page->display) {
|
||||
if ($page->id == $currentpageid) {
|
||||
$content .= '<li class="selected">'.format_string($page->title,true)."</a></li>\n";
|
||||
} else {
|
||||
$content .= "<li class=\"notselected\"><a href=\"$CFG->wwwroot/mod/lesson/view.php?id=$cmid&pageid=$page->id\">".format_string($page->title,true)."</a></li>\n";
|
||||
}
|
||||
|
||||
}
|
||||
$pageid = $page->nextpageid;
|
||||
$content = '<a href="#maincontent" class="skip">'.get_string('skip', 'lesson')."</a>\n<div class=\"menuwrapper\">\n<ul>\n";
|
||||
|
||||
while ($pageid != 0) {
|
||||
$page = $pages[$pageid];
|
||||
|
||||
// Only process branch tables with display turned on
|
||||
if ($page->qtype == LESSON_BRANCHTABLE and $page->display) {
|
||||
if ($page->id == $currentpageid) {
|
||||
$content .= '<li class="selected">'.format_string($page->title,true)."</li>\n";
|
||||
} else {
|
||||
$content .= "<li class=\"notselected\"><a href=\"$CFG->wwwroot/mod/lesson/view.php?id=$cmid&pageid=$page->id\">".format_string($page->title,true)."</a></li>\n";
|
||||
}
|
||||
$content .= "</ul>\n</div>\n";
|
||||
print_side_block(get_string('lessonmenu', 'lesson'), $content, NULL, NULL, '', array('class' => 'menu'), get_string('lessonmenu', 'lesson'));
|
||||
|
||||
}
|
||||
$pageid = $page->nextpageid;
|
||||
}
|
||||
$content .= "</ul>\n</div>\n";
|
||||
|
||||
$bc = new block_contents();
|
||||
$bc->title = get_string('lessonmenu', 'lesson');
|
||||
$bc->set_classes('menu');
|
||||
$bc->content = $content;
|
||||
|
||||
return $bc;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is not ideal, but checks to see if a
|
||||
* column has "block" content.
|
||||
*
|
||||
* In the future, it would be nice if the lesson
|
||||
* media file, timer and navigation were blocks
|
||||
* then this would be unnecessary.
|
||||
*
|
||||
* @uses $CFG
|
||||
* @uses $PAGE
|
||||
* @param object $lesson Full lesson record object
|
||||
* @param array $pageblocks An array of block instances organized by left and right columns
|
||||
* @param string $column Pass either BLOCK_POS_RIGHT or BLOCK_POS_LEFT constants
|
||||
* @return boolean
|
||||
**/
|
||||
function lesson_blocks_have_content($lesson, $pageblocks, $column) {
|
||||
global $CFG, $PAGE;
|
||||
|
||||
// First check lesson conditions
|
||||
if ($column == BLOCK_POS_RIGHT) {
|
||||
$managecap = false;
|
||||
if ($cm = get_coursemodule_from_instance('lesson', $lesson->id, $lesson->course)) {
|
||||
$managecap = has_capability('mod/lesson:manage', get_context_instance(CONTEXT_MODULE, $cm->id));
|
||||
}
|
||||
if (($lesson->timed and !$managecap) or !empty($lesson->mediafile)) {
|
||||
return true;
|
||||
}
|
||||
} else if ($column == BLOCK_POS_LEFT) {
|
||||
if ($lesson->displayleft) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!empty($CFG->showblocksonmodpages)) {
|
||||
if ((blocks_have_content($pageblocks, $column) || $PAGE->user_is_editing())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+37
-28
@@ -39,12 +39,12 @@
|
||||
}
|
||||
|
||||
lesson_print_header($cm, $course, $lesson);
|
||||
print_simple_box_start('center');
|
||||
print_box_start('generalbox boxaligncenter');
|
||||
echo '<div style="text-align:center;">';
|
||||
echo '<p>'.$message.'</p>';
|
||||
echo '<div class="lessonbutton standardbutton" style="padding: 5px;"><a href="'.$CFG->wwwroot.'/course/view.php?id='. $course->id .'">'. get_string('returnto', 'lesson', format_string($course->fullname, true)) .'</a></div>';
|
||||
echo '</div>';
|
||||
print_simple_box_end();
|
||||
print_box_end();
|
||||
print_footer($course);
|
||||
exit();
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
if (!$correctpass) {
|
||||
lesson_print_header($cm, $course, $lesson);
|
||||
echo "<div class=\"password-form\">\n";
|
||||
print_simple_box_start('center');
|
||||
print_box_start('generalbox boxaligncenter');
|
||||
echo '<form id="password" method="post" action="'.$CFG->wwwroot.'/mod/lesson/view.php" autocomplete="off">' . "\n";
|
||||
echo '<fieldset class="invisiblefieldset">';
|
||||
echo '<input type="hidden" name="id" value="'. $cm->id .'" />' . "\n";
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
lesson_print_submit_link(get_string('continue', 'lesson'), 'password', 'center', 'standardbutton submitbutton');
|
||||
echo '</fieldset></form>';
|
||||
print_simple_box_end();
|
||||
print_box_end();
|
||||
echo "</div>\n";
|
||||
print_footer($course);
|
||||
exit();
|
||||
@@ -147,10 +147,10 @@
|
||||
if (!empty($errors)) { // print out the errors if any
|
||||
lesson_print_header($cm, $course, $lesson);
|
||||
echo '<p>';
|
||||
print_simple_box_start('center');
|
||||
print_box_start('generalbox boxaligncenter');
|
||||
print_string('completethefollowingconditions', 'lesson', $dependentlesson->name);
|
||||
echo '<p style="text-align:center;">'.implode('<br />'.get_string('and', 'lesson').'<br />', $errors).'</p>';
|
||||
print_simple_box_end();
|
||||
print_box_end();
|
||||
echo '</p>';
|
||||
print_footer($course);
|
||||
exit();
|
||||
@@ -260,22 +260,22 @@
|
||||
lesson_print_header($cm, $course, $lesson);
|
||||
if ($lesson->timed) {
|
||||
if ($lesson->retake) {
|
||||
print_simple_box('<p style="text-align:center;">'. get_string('leftduringtimed', 'lesson') .'</p>', 'center');
|
||||
print_box('<p style="text-align:center;">'. get_string('leftduringtimed', 'lesson') .'</p>', 'generalbox boxaligncenter');
|
||||
echo '<div style="text-align:center;" class="lessonbutton standardbutton">'.
|
||||
'<a href="view.php?id='.$cm->id.'&pageid='.$firstpageid.'&startlastseen=no">'.
|
||||
get_string('continue', 'lesson').'</a></div>';
|
||||
} else {
|
||||
print_simple_box_start('center');
|
||||
print_box_start('generalbox boxaligncenter');
|
||||
echo '<div style="text-align:center;">';
|
||||
echo get_string('leftduringtimednoretake', 'lesson');
|
||||
echo '<br /><br /><div class="lessonbutton standardbutton"><a href="../../course/view.php?id='. $course->id .'">'. get_string('returntocourse', 'lesson') .'</a></div>';
|
||||
echo '</div>';
|
||||
print_simple_box_end();
|
||||
print_box_end();
|
||||
}
|
||||
|
||||
} else {
|
||||
print_simple_box("<p style=\"text-align:center;\">".get_string('youhaveseen','lesson').'</p>',
|
||||
"center");
|
||||
print_box("<p style=\"text-align:center;\">".get_string('youhaveseen','lesson').'</p>',
|
||||
'generalbox boxaligncenter');
|
||||
|
||||
echo '<div style="text-align:center;">';
|
||||
echo '<span class="lessonbutton standardbutton">'.
|
||||
@@ -297,12 +297,12 @@
|
||||
}
|
||||
if (!$lesson->retake) {
|
||||
lesson_print_header($cm, $course, $lesson, 'view');
|
||||
print_simple_box_start('center');
|
||||
print_box_start('generalbox boxaligncenter');
|
||||
echo "<div style=\"text-align:center;\">";
|
||||
echo get_string("noretake", "lesson");
|
||||
echo "<br /><br /><div class=\"lessonbutton standardbutton\"><a href=\"../../course/view.php?id=$course->id\">".get_string('returntocourse', 'lesson').'</a></div>';
|
||||
echo "</div>";
|
||||
print_simple_box_end();
|
||||
print_box_end();
|
||||
print_footer($course);
|
||||
exit();
|
||||
//redirect("../../course/view.php?id=$course->id", get_string("alreadytaken", "lesson"));
|
||||
@@ -507,6 +507,7 @@
|
||||
}
|
||||
|
||||
/// Print the page header, heading and tabs
|
||||
lesson_add_pretend_blocks($PAGE, $cm, $lesson, $timer);
|
||||
lesson_print_header($cm, $course, $lesson, 'view', 'true', $page->id);
|
||||
|
||||
if ($attemptflag) {
|
||||
@@ -518,7 +519,14 @@
|
||||
lesson_print_ongoing_score($lesson);
|
||||
}
|
||||
|
||||
require($CFG->dirroot.'/mod/lesson/viewstart.html');
|
||||
if ($lesson->displayleft) {
|
||||
echo '<a name="maincontent" id="maincontent" title="' . get_string('anchortitle', 'lesson') . '"></a>';
|
||||
}
|
||||
|
||||
if ($lesson->slideshow && $page->qtype == LESSON_BRANCHTABLE) { // Starts the slideshow div
|
||||
echo '<div class="slideshow" style="background-color: ' . $lesson->bgcolor .
|
||||
'; height: ' . $lesson->height . 'px; width: ' . $lesson->width . 'px;">';
|
||||
}
|
||||
|
||||
// now starting to print the page's contents
|
||||
if ($page->qtype == LESSON_BRANCHTABLE) {
|
||||
@@ -530,9 +538,9 @@
|
||||
if (!$lesson->slideshow) {
|
||||
$options = new stdClass;
|
||||
$options->noclean = true;
|
||||
print_simple_box('<div class="contents">'.
|
||||
print_box('<div class="contents">'.
|
||||
format_text($page->contents, FORMAT_MOODLE, $options).
|
||||
'</div>', 'center');
|
||||
'</div>', 'generalbox boxaligncenter');
|
||||
}
|
||||
|
||||
// this is for modattempts option. Find the users previous answer to this page,
|
||||
@@ -556,7 +564,7 @@
|
||||
echo "<input type=\"hidden\" name=\"action\" value=\"continue\" />";
|
||||
echo "<input type=\"hidden\" name=\"pageid\" value=\"$pageid\" />";
|
||||
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />";
|
||||
print_simple_box_start("center");
|
||||
print_box_start('generalbox boxaligncenter');
|
||||
echo '<table width="100%">';
|
||||
}
|
||||
// default format text options
|
||||
@@ -575,7 +583,7 @@
|
||||
echo '<tr><td style="text-align:center;"><label for="answer">'.get_string('youranswer', 'lesson').'</label>'.
|
||||
": <input type=\"text\" id=\"answer\" name=\"answer\" size=\"50\" maxlength=\"200\" $value />\n";
|
||||
echo '</td></tr></table>';
|
||||
print_simple_box_end();
|
||||
print_box_end();
|
||||
lesson_print_submit_link(get_string('pleaseenteryouranswerinthebox', 'lesson'), 'answerform');
|
||||
break;
|
||||
case LESSON_TRUEFALSE :
|
||||
@@ -598,7 +606,7 @@
|
||||
$i++;
|
||||
}
|
||||
echo '</table>';
|
||||
print_simple_box_end();
|
||||
print_box_end();
|
||||
lesson_print_submit_link(get_string('pleasecheckoneanswer', 'lesson'), 'answerform');
|
||||
break;
|
||||
case LESSON_MULTICHOICE :
|
||||
@@ -637,7 +645,7 @@
|
||||
$i++;
|
||||
}
|
||||
echo '</table>';
|
||||
print_simple_box_end();
|
||||
print_box_end();
|
||||
if ($page->qoption) {
|
||||
$linkname = get_string('pleasecheckoneormoreanswers', 'lesson');
|
||||
} else {
|
||||
@@ -688,7 +696,7 @@
|
||||
}
|
||||
}
|
||||
echo '</table>';
|
||||
print_simple_box_end();
|
||||
print_box_end();
|
||||
lesson_print_submit_link(get_string('pleasematchtheabovepairs', 'lesson'), 'answerform');
|
||||
break;
|
||||
case LESSON_BRANCHTABLE :
|
||||
@@ -745,12 +753,12 @@
|
||||
echo '<tr><td style="text-align:center;" valign="top" nowrap="nowrap"><label for="answer">'.get_string("youranswer", "lesson").'</label>:</td><td>'.
|
||||
'<textarea id="answer" name="answer" rows="15" cols="60">'.$value."</textarea>\n";
|
||||
echo '</td></tr></table>';
|
||||
print_simple_box_end();
|
||||
print_box_end();
|
||||
lesson_print_submit_link(get_string('pleaseenteryouranswerinthebox', 'lesson'), 'answerform');
|
||||
break;
|
||||
default: // close the tags MDL-7861
|
||||
echo ('</table>');
|
||||
print_simple_box_end();
|
||||
print_box_end();
|
||||
break;
|
||||
}
|
||||
if ($page->qtype != LESSON_BRANCHTABLE) { // To fix XHTML problem (BT have their own forms)
|
||||
@@ -813,7 +821,7 @@
|
||||
|
||||
// Finish of the page
|
||||
lesson_print_progress_bar($lesson, $course);
|
||||
require($CFG->dirroot.'/mod/lesson/viewend.html');
|
||||
|
||||
} else {
|
||||
// end of lesson reached work out grade
|
||||
|
||||
@@ -833,12 +841,13 @@
|
||||
|
||||
$DB->update_record("lesson_timer", $timer);
|
||||
}
|
||||
|
||||
|
||||
add_to_log($course->id, "lesson", "end", "view.php?id=$cm->id", "$lesson->id", $cm->id);
|
||||
|
||||
|
||||
lesson_add_pretend_blocks($PAGE, $cm, $lesson, $timer);
|
||||
lesson_print_header($cm, $course, $lesson, 'view');
|
||||
print_heading(get_string("congratulations", "lesson"));
|
||||
print_simple_box_start("center");
|
||||
print_box_start('generalbox boxaligncenter');
|
||||
$ntries = $DB->count_records("lesson_grades", array("lessonid"=>$lesson->id, "userid"=>$USER->id));
|
||||
if (isset($USER->modattempts[$lesson->id])) {
|
||||
$ntries--; // need to look at the old attempts :)
|
||||
@@ -920,7 +929,7 @@
|
||||
// display for teacher
|
||||
echo "<p style=\"text-align:center;\">".get_string("displayofgrade", "lesson")."</p>\n";
|
||||
}
|
||||
print_simple_box_end(); //End of Lesson button to Continue.
|
||||
print_box_end(); //End of Lesson button to Continue.
|
||||
|
||||
// after all the grade processing, check to see if "Show Grades" is off for the course
|
||||
// if yes, redirect to the course page
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php // $Id$
|
||||
/**
|
||||
* End of the HTML template for viewing pages
|
||||
*
|
||||
* @version $Id$
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
* @package lesson
|
||||
**/
|
||||
?>
|
||||
<!-- Start view end -->
|
||||
</td>
|
||||
<?php if (lesson_blocks_have_content($lesson, $pageblocks, BLOCK_POS_RIGHT)) { ?>
|
||||
<td id="right-column" style="width: <?php echo $rightcolumnwidth; ?>px;">
|
||||
<?php
|
||||
lesson_print_clock_block($cm->id, $lesson, $timer);
|
||||
lesson_print_mediafile_block($cm->id, $lesson);
|
||||
|
||||
if (!empty($CFG->showblocksonmodpages)) {
|
||||
if ((blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing())) {
|
||||
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- End view end -->
|
||||
@@ -1,41 +0,0 @@
|
||||
<?php // $Id$
|
||||
/**
|
||||
* Start of the HTML template for viewing pages
|
||||
*
|
||||
* @version $Id$
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
* @package lesson
|
||||
**/
|
||||
?>
|
||||
<!-- Start view start -->
|
||||
<table id="layout-table" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<!-- First Column -->
|
||||
<?php if (lesson_blocks_have_content($lesson, $pageblocks, BLOCK_POS_LEFT)) { ?>
|
||||
<td id="left-column" style="width: <?php echo $leftcolumnwidth; ?>px;">
|
||||
<?php
|
||||
lesson_print_menu_block($cm->id, $lesson);
|
||||
|
||||
if (!empty($CFG->showblocksonmodpages)) {
|
||||
if ((blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing())) {
|
||||
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<!-- Start main column -->
|
||||
<td id="middle-column" align="center">
|
||||
|
||||
<?php if ($lesson->displayleft) { ?>
|
||||
|
||||
<a name="maincontent" id="maincontent" title="<?php print_string('anchortitle', 'lesson') ?>"></a>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($lesson->slideshow && $page->qtype == LESSON_BRANCHTABLE) { // Starts the slideshow div ?>
|
||||
|
||||
<div class="slideshow" style="background-color: <?php echo $lesson->bgcolor?>; height: <?php echo $lesson->height ?>px; width: <?php echo $lesson->width?>px;">
|
||||
|
||||
<?php } ?>
|
||||
<!-- End view start -->
|
||||
Reference in New Issue
Block a user