Beispiel #1
0
//$hierarche->get_school_items();
echo $OUTPUT->box(get_string('asignregistrartabdes', 'local_collegestructure'));
if (is_siteadmin())
    $sql = "SELECT * FROM {local_school}";
else
    $sql = " SELECT distinct(s.id),s.* FROM {local_school} s  where id in(select schoolid from {local_school_permissions} where userid={$USER->id}) ORDER BY s.sortorder  ";
$schoolusers = $DB->get_records_sql($sql);

$data = array();

if ($schoolusers) {
    foreach ($schoolusers as $schooluser) {
        $line = array();
        $reg = array();
        $line[] = $schooluser->fullname;
        $reg[] = $hierarche->get_allregisters($schooluser->id);
        $line[] = $reg[0];
        $data[] = $line;
    }
} else {
    $line = array();
    $line[] = "No user is assigned till now";
    $data[] = $line;
}
$table = new html_table();
if ($schoolusers) {
    $table->head = array(
        get_string('schoolname', 'local_collegestructure'), get_string('username', 'local_collegestructure'));
}

$table->size = array('40%', '40%', '20%');