Esempio n. 1
0
$PAGE->set_context($systemcontext);
if ($CFG->forcelogin) {
    require_login();
} else {
    user_accesstime_log();
}
if (!has_capability('local/lecturetype:manage', $systemcontext)) {
    print_error('You dont have permissions');
}
$PAGE->set_url('/local/lecturetype/info.php');
// Header and the navigation bar
$PAGE->set_heading($SITE->fullname);
$PAGE->set_title(get_string('pluginname', 'local_lecturetype'));
$PAGE->navbar->add(get_string('managelecturetypes', 'local_lecturetype'), new moodle_url('/local/lecturetype/index.php'));
$PAGE->navbar->add(get_string('info', 'local_lecturetype'));
// echo $OUTPUT->header();
echo $OUTPUT->header();
// Heading of the page
$currenttab = 'info';      // as ‘view’ page will be our default page, value to the ‘$currentab’ is  given as a static value.
$instance = new cobalt_lecturetype();
$instance->print_lecturetabs($currenttab, $id = -1);

echo $OUTPUT->heading(get_string('lecturetypename', 'local_lecturetype'));
// Moodle 2.2 and onwards
if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) {
    echo $OUTPUT->box(get_string('helpinfo', 'local_lecturetype'));
}
$content = get_string('info_help', 'local_lecturetype');
echo '<div class="help_cont">' . $content . '<div>';
echo $OUTPUT->footer();
Esempio n. 2
0
    require_login();
} else {
    user_accesstime_log();
}
$PAGE->set_heading($SITE->fullname);
$PAGE->set_url('/local/lecturetype/edit.php', array('id' => $id));
$systemcontext = context_system::instance();
$PAGE->set_context($systemcontext);
if (!has_capability('local/lecturetype:manage', $systemcontext)) {
    print_error('You dont have permissions');
}
//this is the return url 
$returnurl = new moodle_url('/local/lecturetype/index.php', array('id' => $id));
$currenturl = "{$CFG->wwwroot}/local/lecturetype/index.php";
$strheading = get_string('pluginname', 'local_lecturetype');
$instance = new cobalt_lecturetype();
/* Start of delete the lecturetype */
if ($delete) {
    $PAGE->url->param('delete', 1);
    if ($confirm and confirm_sesskey()) {
        $result = $instance->lecturetype_delete_instance($id);
        $instance->success_error_msg($result, 'success_del_lecture', 'error_del_lecture', $currenturl, null);
        redirect($returnurl);
    }
    $strheading = get_string('deletelecturetype', 'local_lecturetype');
    $PAGE->navbar->add($strheading);
    $PAGE->set_title($strheading);
    echo $OUTPUT->header();
    echo $OUTPUT->heading($strheading);
    if (!$exists = $DB->get_records('local_scheduledexams', array('lecturetype' => $id))) {
        $yesurl = new moodle_url('/local/lecturetype/edit.php', array('id' => $id, 'delete' => 1, 'confirm' => 1, 'sesskey' => sesskey()));