Пример #1
0
//check the context level of the user and check weather the user is login to the system or not
$PAGE->set_context($systemcontext);
require_login();
if ($CFG->forcelogin) {
    require_login();
} else {
    user_accesstime_log();
}

$PAGE->set_url('/local/examtype/info.php');

//Header and the navigation bar
$PAGE->set_heading($SITE->fullname);
$PAGE->set_title(get_string('pluginname', 'local_examtype'));
$PAGE->navbar->add(get_string('pluginname', 'local_examtype'));
$PAGE->navbar->add(get_string('info', 'local_examtype'));
echo $OUTPUT->header();

echo $OUTPUT->heading(get_string('pluginname', 'local_examtype')); //Heading of the page
$currenttab = "info";
$instance = new cobalt_examtype();
$instance->print_examtabs($currenttab, $id = -1);
// Moodle 2.2 and onwards
if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) {
    echo $OUTPUT->box(get_string('helpinfo', 'local_examtype'));
}
$content = get_string('info_help', 'local_examtype');
echo '<div class="help_cont">' . $content . '<div>';

echo $OUTPUT->footer();
Пример #2
0
if ($CFG->forcelogin) {
    require_login();
} else {
    user_accesstime_log();
}
$PAGE->set_heading($SITE->fullname);
$PAGE->set_url('/local/examtype/edit.php', array('id' => $id));

$PAGE->set_context($systemcontext);
if (!has_capability('local/examtype:manage', $systemcontext)) {
    print_error('You dont have permissions');
}
$returnurl = new moodle_url('/local/examtype/index.php', array('id' => $id));
$currenturl = "{$CFG->wwwroot}/local/examtype/index.php";
$strheading = get_string('addeditexamtype', 'local_examtype');
$instance = new cobalt_examtype();
// delete function 
if ($delete) {
    $PAGE->url->param('delete', 1);
    if ($confirm and confirm_sesskey()) {
        $result = $instance->examtype_delete_instance($id);
        $instance->success_error_msg($result, 'success_del_exam', 'error_del_exam', $currenturl, null);
        redirect($returnurl);
    }
    $strheading = get_string('deleteexamtype', 'local_examtype');
    $PAGE->navbar->add(get_string('manageexamtype', 'local_examtype'), new moodle_url('/local/examtype/index.php', array('id' => $id)));

    $PAGE->navbar->add($strheading);
    $PAGE->set_title($strheading);
    echo $OUTPUT->header();
    echo $OUTPUT->heading($strheading);