<?php

// $Id: format.php,v 1.5 2009/05/07 16:12:46 mchurch Exp $
// Display the whole course as "topics" made of of modules
// In fact, this is very similar to the "weeks" format, in that
// each "topic" is actually a week.  The main difference is that
// the dates aren't printed - it's just an aesthetic thing for
// courses that aren't so rigidly defined by time.
// Included from "view.php"
require_once $CFG->libdir . '/ajax/ajaxlib.php';
require_once $CFG->dirroot . '/mod/forum/lib.php';
require_once $CFG->dirroot . '/course/format/' . $course->format . '/course_format.class.php';
require_once $CFG->dirroot . '/course/format/' . $course->format . '/course_format_fn.class.php';
require_once $CFG->dirroot . '/course/format/' . $course->format . '/lib.php';
require_once $CFG->dirroot . '/course/format/' . $course->format . '/modulelib.php';
$cobject = new course_format_fn($course);
$course = $cobject->course;
/// Handle any extra arguments
$cobject->handle_extra_actions();
/// Add any extra module information to our module structures.
$cobject->add_extra_module_info();
$selected_week = optional_param('selected_week', -1, PARAM_INT);
// Bounds for block widths
// more flexible for theme designers taken from theme config.php
$lmin = empty($THEME->block_l_min_width) ? 100 : $THEME->block_l_min_width;
$lmax = empty($THEME->block_l_max_width) ? 210 : $THEME->block_l_max_width;
$rmin = empty($THEME->block_r_min_width) ? 100 : $THEME->block_r_min_width;
$rmax = empty($THEME->block_r_max_width) ? 210 : $THEME->block_r_max_width;
define('BLOCK_L_MIN_WIDTH', $lmin);
define('BLOCK_L_MAX_WIDTH', $lmax);
define('BLOCK_R_MIN_WIDTH', $rmin);
require_once $CFG->dirroot . '/course/format/' . $course->format . '/course_format.class.php';
require_once $CFG->dirroot . '/course/format/' . $course->format . '/course_format_fn.class.php';
require_once $CFG->dirroot . '/course/format/' . $course->format . '/lib.php';
require_once $CFG->dirroot . '/course/format/' . $course->format . '/modulelib.php';
global $DB, $OUTPUT, $THEME, $PAGE;
//Check sesubmission plugin
if ($assignCheck = $DB->get_record_sql("SELECT * FROM {$CFG->prefix}assign LIMIT 0, 1")) {
    if (isset($assignCheck->attemptreopenmethod)) {
        $resubmission = true;
    } else {
        $resubmission = false;
    }
} else {
    $resubmission = false;
}
$cobject = new course_format_fn($course);
$course = $cobject->course;
if (!isset($course->showsection0)) {
    $course->showsection0 = 0;
}
$cobject->handle_extra_actions();
$selected_week = optional_param('selected_week', -1, PARAM_INT);
$streditsummary = get_string('editsummary');
$stradd = get_string('add');
$stractivities = get_string('activities');
$strshowallweeks = get_string('showallweeks', 'format_octabs');
$strweek = get_string('week');
$strgroups = get_string('groups');
$strgroupmy = get_string('groupmy');
$editing = $PAGE->user_is_editing();
if ($editing) {