set_url('/mod/sloodle/index.php', $urlparams); // Require that the user logs in require_login($course, false); //add_to_log($course->id, "sloodle", "view sloodle modules", "index.php?id=$course->id"); sloodle_add_to_log($course->id, 'module_viewed', 'index.php', array('id'=>$course->id), 'index: view sloodle modules'); // Fetch our string table data $strsloodle = get_string('modulename', 'sloodle'); $strsloodles = get_string('modulenameplural', 'sloodle'); $strid = get_string('ID', 'sloodle'); $strname = get_string('name', 'sloodle'); $strdescription = get_string('description'); $strmoduletype = get_string('moduletype', 'sloodle'); // Fetch the full names of each module type $sloodle_type_names = array(); foreach ($SLOODLE_TYPES as $ST) { // Get the module type name $sloodle_type_names[$ST] = get_string("moduletype:$ST", 'sloodle'); } // We're going to make one table for each module type $sloodle_tables = array(); // Get all Sloodle modules for the current course $sloodles = sloodle_get_records('sloodle', 'course', $course->id, 'name'); if (!$sloodles) $sloodles = array(); // Go through each module foreach ($sloodles as $s) { // Find out which course module instance this SLOODLE module belongs to $cm = get_coursemodule_from_instance('sloodle', $s->id); if ($cm === false) continue; // Prepare this line of data $line = array(); $line[] = "wwwroot}/mod/sloodle/view.php?id={$cm->id}\">$s->name"; $line[] = $s->intro; // Insert it into the appropriate table $sloodle_tables[$s->type]->data[] = $line; } // Add header information to each table // (cannot use "foreach" on the $sloodle_tables array as PHP4 doesn't support alteration of the original array that way) $table_types = array_keys($sloodle_tables); foreach ($table_types as $k) { $sloodle_tables[$k]->head = array($strname, $strdescription); $sloodle_tables[$k]->align = array('left', 'left'); $sloodle_tables[$k]->size = array('50%', '50%'); } // Page header if ($course->id != SITEID) { sloodle_print_header("{$course->shortname}: $strsloodles", $course->fullname, "id\">$course->shortname -> $strsloodles", "", "", true, "", false); } else { sloodle_print_header("$course->shortname: $strsloodles", $course->fullname, "$strsloodles", "", "", true, "", false); } //----------------------------------------------------- // Quick links (top right of page) // Open the section /*echo "