$redirect = false;
        }
        $urltogo = new moodle_url('/course/view.php', array('id' => $detail['redirect_courseid']));
        if ($redirect == true) {
            redirect($urltogo);
        }
    }
}
$data = new stdClass();
$data->url = new moodle_url($returnurl);
$data->wwwroot = $CFG->wwwroot;
$PAGE->set_title($detail['name']);
$PAGE->navbar->add(get_string('coursecatalog', 'local_catalog'), new moodle_url('/local/catalog/catalog.php'), global_navigation::TYPE_CUSTOM);
$referral_section = optional_param('ref', 0, PARAM_INT);
if ($referral_section != 0) {
    $ref = local_catalog_get_section_detail($referral_section);
    $PAGE->navbar->add($ref['name'], new moodle_url('/local/catalog/section.php', array('id' => $ref['id'])), global_navigation::TYPE_CUSTOM);
}
$PAGE->navbar->add($detail['name'], new moodle_url('/local/catalog/course.php', array('id' => $id)), global_navigation::TYPE_CUSTOM);
$data->header = $OUTPUT->header();
$data->heading = $OUTPUT->heading($detail['name']);
$data->footer = $OUTPUT->footer();
$data->catalogid = $id;
$data->coursetitle = $detail['name'];
if (strlen($detail['subtitle']) > 0) {
    $data->subtitle = $detail['subtitle'];
}
if (strlen($detail['preview_video_id']) > 0) {
    $data->preview_video_id = $detail['preview_video_id'];
}
$data->description = $detail['description'];
*/
/// Includes
require_once "../../config.php";
require_once 'forms.php';
require_once 'locallib.php';
/// Security
$systemcontext = context_system::instance();
/// Build page
$returnurl = $CFG->wwwroot . '/local/catalog/section.php';
$PAGE->set_url($returnurl);
$PAGE->set_context($systemcontext);
$PAGE->set_heading($SITE->fullname);
//page layout
$PAGE->set_pagelayout('standard');
$id = required_param('id', PARAM_INT);
$detail = local_catalog_get_section_detail($id);
$data = new stdClass();
$data->url = new moodle_url($returnurl);
$data->wwwroot = $CFG->wwwroot;
$PAGE->set_title($detail['name']);
$PAGE->navbar->add($detail['name'], new moodle_url('/local/catalog/section.php', array('id' => $id)), global_navigation::TYPE_CUSTOM);
$data->header = $OUTPUT->header();
$data->heading = $OUTPUT->heading($detail['name']);
$data->footer = $OUTPUT->footer();
$data->name = $detail['name'];
$data->tagline = $detail['tagline'];
if (strlen($detail['video']) > 0) {
    $data->video = $detail['video'];
}
if (strlen($detail['header']) > 0) {
    $data->section_header = $detail['header'];