Permalink
Browse files

MDL-23291 - fixed deprecated errors in wiki.

  • Loading branch information...
1 parent 39bc4c6 commit 6c5b99d9f71e738a16c01d985439e36ad3874200 Rossiani Wijaya committed Jul 26, 2010
Showing with 17 additions and 24 deletions.
  1. +17 −24 mod/wiki/index.php
View
41 mod/wiki/index.php
@@ -35,30 +35,29 @@
require_once('lib.php');
$id = required_param('id', PARAM_INT); // course
+$PAGE->set_url('/mod/wiki/index.php', array('id'=>$id));
if (!$course = $DB->get_record('course', array('id' => $id))) {
print_error('invalidcourseid');
}
-require_course_login($course->id, true, $cm);
+require_course_login($course->id, true);
+$PAGE->set_pagelayout('incourse');
+$context = get_context_instance(CONTEXT_COURSE, $course->id);
add_to_log($course->id, 'wiki', 'view all', "index.php?id=$course->id", "");
/// Get all required stringswiki
-
$strwikis = get_string("modulenameplural", "wiki");
$strwiki = get_string("modulename", "wiki");
/// Print the header
-
-$navlinks = array();
-$navlinks[] = array('name' => $strwikis, 'link' => '', 'type' => 'activity');
-$navigation = build_navigation($navlinks);
-
-print_header_simple("$strwikis", "", $navigation, "", "", true, "", navmenu($course));
+$PAGE->navbar->add($strwikis, "index.php?id=$course->id");
+$PAGE->set_title($strwikis);
+$PAGE->set_heading($course->fullname);
+echo $OUTPUT->header();
/// Get all the appropriate data
-
if (!$wikis = get_all_instances_in_course("wiki", $course)) {
notice("There are no wikis", "../../course/view.php?id=$course->id");
die;
@@ -74,23 +73,20 @@
$timenow = time();
$strsectionname = get_string('sectionname', 'format_'.$course->format);
$strname = get_string("name");
+$table = new html_table();
if ($usesections) {
- $table->head = array ($strsectionname, $strname);
- $table->align = array("center", "left");
+ $table->head = array ($strsectionname, $strname);
} else {
- $table->head = array ($strname);
- $table->align = array("left");
+ $table->head = array ($strname);
}
foreach ($wikis as $wiki) {
+ $linkcss = null;
if (!$wiki->visible) {
- //Show dimmed if the mod is hidden
- $link = "<a class=\"dimmed\" href=\"view.php?id=$wiki->coursemodule\">$wiki->name</a>";
- } else {
- //Show normal if the mod is visible
- $link = "<a href=\"view.php?id=$wiki->coursemodule\">$wiki->name</a>";
- }
+ $linkcss = array('class'=>'dimmed');
+ }
+ $link = html_writer::link(new moodle_url('/mod/wiki/view.php', array('id'=>$wiki->coursemodule)), $wiki->name, $linkcss);
if ($usesections) {
$table->data[] = array(get_section_name($course, $sections[$wiki->section]), $link);
@@ -99,10 +95,7 @@
}
}
-echo "<br />";
-
-print_table($table);
+echo html_writer::table($table);
/// Finish the page
-
-print_footer($course);
+echo $OUTPUT->footer();

0 comments on commit 6c5b99d

Please sign in to comment.