Beispiel #1
0
$PAGE->set_heading($SITE->fullname);
if ($id > 0)
    $string = get_string('pluginname', 'local_modules') . ':' . get_string('editmodule', 'local_modules');
else
    $string = get_string('pluginname', 'local_modules') . ':' . get_string('createmodule', 'local_modules');
$PAGE->set_title($string);
//this is the return url 
$returnurl = new moodle_url('/local/modules/index.php', array('id' => $id));
$currenturl = "{$CFG->wwwroot}/local/modules/index.php";
$strheading = get_string('createmodule', 'local_modules');
$instance = new cobalt_modules();
/* Start of delete the module */
if ($delete) {
    $PAGE->url->param('delete', 1);
    if ($confirm and confirm_sesskey()) {
        $result = $instance->module_delete_instance($id);
        $instance->success_error_msg($result, 'success_del_module', 'error_del_module', $currenturl, null);
        redirect($returnurl);
    }
    $strheading = get_string('deletemodule', 'local_modules');
    $PAGE->navbar->add(get_string('managemodule', 'local_modules'), "/local/modules/index.php", get_string('viewmodules', 'local_modules'));
    $PAGE->navbar->add($strheading);

    echo $OUTPUT->header();
    echo $OUTPUT->heading($strheading);
    $checkexistmodule = $DB->get_records('local_module_permissions', array('moduleid' => $id));
    if ($checkexistmodule) {
        $message = get_string('cannotdeletemodule', 'local_modules');
        echo $message;
        echo $OUTPUT->continue_button(new moodle_url('/local/modules/index.php', array('id' => $id, 'delete' => 0, 'confirm' => 1, 'sesskey' => sesskey())));
    } else {