Example #1
0
    require_login();
} else {
    user_accesstime_log();
}
$PAGE->set_heading($SITE->fullname);
/* ---this is the return url--- */
$returnurl = new moodle_url('/local/collegestructure/index.php', array('id' => $id));

$strheading = get_string('manageschools', 'local_collegestructure');

/* ---Start of delete the school--- */
if ($delete) {
    $PAGE->url->param('delete', 1);
    if ($confirm and confirm_sesskey()) {

        $school->school_delete_instance($id);

        redirect($returnurl);
    }
    $strheading = get_string('deleteschool', 'local_collegestructure');
    $PAGE->navbar->add(get_string('manageschools', 'local_collegestructure'), "/local/collegestructure/index.php", get_string('viewschool', 'local_collegestructure'));
    $PAGE->navbar->add($strheading);
    $PAGE->set_title($strheading);

    echo $OUTPUT->header();
    echo $OUTPUT->heading($strheading);

    $checkchilditems = $DB->get_records('local_school', array('parentid' => $id));
    /* ---Check if any programs are created for a school--- */
    $checkexistprogram = $DB->get_records('local_program', array('schoolid' => $id));
    /* ---Check if any departments are created for a school--- */