Example #1
0
/* ---get the admin layout--- */
$PAGE->set_pagelayout('admin');
/* ---check the context level of the user and check weather the user is login to the system or not--- */
$PAGE->set_context($systemcontext);
$currentcss = '/local/collegestructure/css/styles.css';
$PAGE->requires->css($currentcss);
$PAGE->set_url('/local/collegestructure/index.php');
/* ---Header and the navigation bar--- */
$PAGE->set_heading(get_string('manageschools', 'local_collegestructure'));
$PAGE->navbar->add(get_string('manageschools', 'local_collegestructure'), new moodle_url('/local/collegestructure/index.php'));
$PAGE->navbar->add(get_string('view', 'local_collegestructure'));
echo $OUTPUT->header();
/* ---Heading of the page--- */
echo $OUTPUT->heading(get_string('manageschools', 'local_collegestructure'));
$currenttab = 'view';
$school->print_collegetabs($currenttab, $id = NULL);
// error handling instead of showing empty table
$schoollist=$DB->get_records('local_school');
if(empty($schoollist)){
 print_cobalterror('schoolnotcreated','local_collegestructure',$CFG->wwwroot.'/local/collegestructure/school.php');   
}
echo '<div style="float:right;"><span><a href="index.php?flat=2"><img src="pix/grid.png" title="Grid View To display all programs and departments in a school" alt="Grid View"> </a> <span> <span><a href="index.php?flat=1"><img src="pix/normal.png" title="Just Displays all the schools and Subschools" alt="Normal View"></a> </span></div>';
/* ---Get the records from the database--- */
/* ---Moodle 2.2 and onwards--- */
if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) {
    echo $OUTPUT->box(get_string('allowframembedding', 'local_collegestructure'));
}

$flist = 0;
$perpage = 2;
if ($flat == 1 || $flat == 0) {