adding some strings
[moodle-linuxchix.git] / mod / resource / index.php
blob56cb2e8a679371008ce182e7edfcf873e7127d9d
1 <?php // $Id$
3 require_once("../../config.php");
5 $id = required_param( 'id', PARAM_INT ); // course
7 if (! $course = get_record("course", "id", $id)) {
8 error("Course ID is incorrect");
11 require_course_login($course, true);
13 if ($course->id != SITEID) {
14 require_login($course->id);
15 $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
16 } else {
17 $navigation = '';
20 add_to_log($course->id, "resource", "view all", "index.php?id=$course->id", "");
22 $strresource = get_string("modulename", "resource");
23 $strresources = get_string("modulenameplural", "resource");
24 $strweek = get_string("week");
25 $strtopic = get_string("topic");
26 $strname = get_string("name");
27 $strsummary = get_string("summary");
28 $strlastmodified = get_string("lastmodified");
30 $navlinks = array();
31 $navlinks[] = array('name' => $strresources, 'link' => '', 'type' => 'activityinstance');
32 $navigation = build_navigation($navlinks);
34 print_header("$course->shortname: $strresources", $course->fullname, $navigation,
35 "", "", true, "", navmenu($course));
37 if (! $resources = get_all_instances_in_course("resource", $course)) {
38 notice("There are no resources", "../../course/view.php?id=$course->id");
39 exit;
42 if ($course->format == "weeks") {
43 $table->head = array ($strweek, $strname, $strsummary);
44 $table->align = array ("center", "left", "left");
45 } else if ($course->format == "topics") {
46 $table->head = array ($strtopic, $strname, $strsummary);
47 $table->align = array ("center", "left", "left");
48 } else {
49 $table->head = array ($strlastmodified, $strname, $strsummary);
50 $table->align = array ("left", "left", "left");
53 $currentsection = "";
54 $options->para = false;
55 foreach ($resources as $resource) {
56 if ($course->format == "weeks" or $course->format == "topics") {
57 $printsection = "";
58 if ($resource->section !== $currentsection) {
59 if ($resource->section) {
60 $printsection = $resource->section;
62 if ($currentsection !== "") {
63 $table->data[] = 'hr';
65 $currentsection = $resource->section;
67 } else {
68 $printsection = '<span class="smallinfo">'.userdate($resource->timemodified)."</span>";
70 if (!empty($resource->extra)) {
71 $extra = urldecode($resource->extra);
72 } else {
73 $extra = "";
75 if (!$resource->visible) { // Show dimmed if the mod is hidden
76 $table->data[] = array ($printsection,
77 "<a class=\"dimmed\" $extra href=\"view.php?id=$resource->coursemodule\">".format_string($resource->name,true)."</a>",
78 format_text($resource->summary, FORMAT_MOODLE, $options) );
80 } else { //Show normal if the mod is visible
81 $table->data[] = array ($printsection,
82 "<a $extra href=\"view.php?id=$resource->coursemodule\">".format_string($resource->name,true)."</a>",
83 format_text($resource->summary, FORMAT_MOODLE, $options) );
87 echo "<br />";
89 print_table($table);
91 print_footer($course);