Skip to content

Commit

Permalink
MDL-40735 mod_lesson: fixed up a header and stripped out hardcoded fo…
Browse files Browse the repository at this point in the history
…rmatting
  • Loading branch information
andyjdavis committed Sep 2, 2013
1 parent 4387152 commit 974beea
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
6 changes: 3 additions & 3 deletions mod/lesson/import.php
Expand Up @@ -57,10 +57,10 @@


$PAGE->navbar->add($strimportquestions); $PAGE->navbar->add($strimportquestions);
$PAGE->set_title($strimportquestions); $PAGE->set_title($strimportquestions);
$PAGE->set_heading($strimportquestions); $PAGE->set_heading(format_string($course->fullname));
echo $OUTPUT->header(); echo $OUTPUT->header();

echo $OUTPUT->heading(format_string($lesson->name), 2);
echo $OUTPUT->heading_with_help($strimportquestions, 'importquestions', 'lesson' ); echo $OUTPUT->heading_with_help($strimportquestions, 'importquestions', 'lesson', '', '', 3);


if ($data = $mform->get_data()) { if ($data = $mform->get_data()) {


Expand Down
3 changes: 2 additions & 1 deletion mod/lesson/index.php
Expand Up @@ -53,6 +53,7 @@
$PAGE->set_title("$course->shortname: $strlessons"); $PAGE->set_title("$course->shortname: $strlessons");
$PAGE->set_heading($course->fullname); $PAGE->set_heading($course->fullname);
echo $OUTPUT->header(); echo $OUTPUT->header();
echo $OUTPUT->heading($strlessons, 2);


/// Get all the appropriate data /// Get all the appropriate data


Expand Down Expand Up @@ -116,4 +117,4 @@
} }
} }
echo html_writer::table($table); echo html_writer::table($table);
echo $OUTPUT->footer(); echo $OUTPUT->footer();
23 changes: 15 additions & 8 deletions mod/lesson/lesson.php
Expand Up @@ -81,24 +81,31 @@
$title = $DB->get_field("lesson_pages", "title", array("id" => $pageid)); $title = $DB->get_field("lesson_pages", "title", array("id" => $pageid));


echo $lessonoutput->header($lesson, $cm, '', false, null, get_string('moving', 'lesson', format_String($title))); echo $lessonoutput->header($lesson, $cm, '', false, null, get_string('moving', 'lesson', format_String($title)));
echo $OUTPUT->heading(get_string("moving", "lesson", format_string($title))); echo $OUTPUT->heading(get_string("moving", "lesson", format_string($title)), 3);


$params = array ("lessonid" => $lesson->id, "prevpageid" => 0); $params = array ("lessonid" => $lesson->id, "prevpageid" => 0);
if (!$page = $DB->get_record_select("lesson_pages", "lessonid = :lessonid AND prevpageid = :prevpageid", $params)) { if (!$page = $DB->get_record_select("lesson_pages", "lessonid = :lessonid AND prevpageid = :prevpageid", $params)) {
print_error('cannotfindfirstpage', 'lesson'); print_error('cannotfindfirstpage', 'lesson');
} }


echo "<center><table cellpadding=\"5\" border=\"1\">\n"; echo html_writer::start_tag('div', array('class' => 'move-page'));
echo "<tr><td><a href=\"lesson.php?id=$cm->id&amp;sesskey=".sesskey()."&amp;action=moveit&amp;pageid=$pageid&amp;after=0\"><small>".
get_string("movepagehere", "lesson")."</small></a></td></tr>\n"; echo html_writer::start_tag('div', array('class' => 'available-position'));
$moveurl = "lesson.php?id=$cm->id&sesskey=".sesskey()."&action=moveit&pageid=$pageid&after=0";
echo html_writer::link($moveurl, get_string("movepagehere", "lesson"));
echo html_writer::end_tag('div');

while (true) { while (true) {
if ($page->id != $pageid) { if ($page->id != $pageid) {
if (!$title = trim(format_string($page->title))) { if (!$title = trim(format_string($page->title))) {
$title = "<< ".get_string("notitle", "lesson")." >>"; $title = "<< ".get_string("notitle", "lesson")." >>";
} }
echo "<tr><td><b>$title</b></td></tr>\n"; echo html_writer::tag('div', $title, array('class' => 'page'));
echo "<tr><td><a href=\"lesson.php?id=$cm->id&amp;sesskey=".sesskey()."&amp;action=moveit&amp;pageid=$pageid&amp;after={$page->id}\"><small>".
get_string("movepagehere", "lesson")."</small></a></td></tr>\n"; echo html_writer::start_tag('div', array('class' => 'available-position'));
$moveurl = "lesson.php?id=$cm->id&sesskey=".sesskey()."&action=moveit&pageid=$pageid&after={$page->id}";
echo html_writer::link($moveurl, get_string("movepagehere", "lesson"));
echo html_writer::end_tag('div');
} }
if ($page->nextpageid) { if ($page->nextpageid) {
if (!$page = $DB->get_record("lesson_pages", array("id" => $page->nextpageid))) { if (!$page = $DB->get_record("lesson_pages", array("id" => $page->nextpageid))) {
Expand All @@ -109,7 +116,7 @@
break; break;
} }
} }
echo "</table>\n"; echo html_writer::end_tag('div');


break; break;
case 'delete': case 'delete':
Expand Down
4 changes: 2 additions & 2 deletions mod/lesson/report.php
Expand Up @@ -357,7 +357,7 @@
} }


// output the stats // output the stats
echo $OUTPUT->heading(get_string('lessonstats', 'lesson')); echo $OUTPUT->heading(get_string('lessonstats', 'lesson'), 3);
$stattable = new html_table(); $stattable = new html_table();
$stattable->head = array(get_string('averagescore', 'lesson'), get_string('averagetime', 'lesson'), $stattable->head = array(get_string('averagescore', 'lesson'), get_string('averagetime', 'lesson'),
get_string('highscore', 'lesson'), get_string('lowscore', 'lesson'), get_string('highscore', 'lesson'), get_string('lowscore', 'lesson'),
Expand Down Expand Up @@ -509,7 +509,7 @@
//$headingobject->firstname = $students[$userid]->firstname; //$headingobject->firstname = $students[$userid]->firstname;
//$headingobject->attempt = $try + 1; //$headingobject->attempt = $try + 1;
//print_heading(get_string("studentattemptlesson", "lesson", $headingobject)); //print_heading(get_string("studentattemptlesson", "lesson", $headingobject));
echo $OUTPUT->heading(get_string('attempt', 'lesson', $try+1)); echo $OUTPUT->heading(get_string('attempt', 'lesson', $try+1), 3);


$table->head = array(); $table->head = array();
$table->align = array('right', 'left'); $table->align = array('right', 'left');
Expand Down

0 comments on commit 974beea

Please sign in to comment.