Ejemplo n.º 1
0
<h2>Who has played?</h2>
<div id=inset>
	<?php 
$rs = dbExec("select\n\t\t\t\t\tid,\n\t\t\t\t\tlast_name,\n\t\t\t\t\tfirst_name,\n\t\t\t\t\tusername,\n\t\t\t\t\tschool_code,\n\t\t\t\t\tteacher_code,\n\t\t\t\t\tweek\n\t\t\t\t\tgroup_id\n\t\t\t\tfrom\n\t\t\t\t\tusers\n\t\t\t\tWHERE\n\t\t\t\t\t`active` = 1\n\t\t\t\t\tAND\n\t\t\t\t\t`user_type` = 's'\n\t\t\t\t\tAND\n\t\t\t\t\t`school_code` !=0\n\t\t\t\t\tAND\n\t\t\t\t\t`auth_count` > 0\n\t\t\t\t\tAND\n\t\t\t\t\t`gamedata` != ''\n\t\t\t\torder by\n\t\t\t\t\tlast_name\n\t\t\t\t\t");
$students = array();
while (!$rs->EOF) {
    $o = $rs->FetchNextObj();
    $students[$o->id] = $o;
}
$schools = array();
$ref = array();
foreach ($students as $s) {
    $c = $s->school_code;
    if (!$ref[$c]) {
        $ref[$c] = true;
        $o = getrecobj("schools", "where code = {$c}");
        $schools[$o->name] = $o;
    }
}
$teachers = array();
$ref = array();
foreach ($students as $s) {
    $c = $s->teacher_code;
    if (!$ref[$c]) {
        $ref[$c] = true;
        $rs = dbExec("select\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\tlast_name,\n\t\t\t\t\t\t\tfirst_name,\n\t\t\t\t\t\t\tconcat(last_name,', ',first_name) as name,\n\t\t\t\t\t\t\tusername,\n\t\t\t\t\t\t\tschool_code,\n\t\t\t\t\t\t\tteacher_code,\n\t\t\t\t\t\t\tusername,\n\t\t\t\t\t\t\tpassword,\n\t\t\t\t\t\t\temail,\n\t\t\t\t\t\t\tphone\n\t\t\t\t\t\tfrom\n\t\t\t\t\t\t\tusers\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t`active` = 1\n\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t`user_type` = 't'\n\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\tteacher_code = {$c}\n\t\t\t\t\t\torder by\n\t\t\t\t\t\t\tlast_name\n\t\t\t\t\t\t\t");
        $o = $rs->FetchNextObj();
        $teachers[$o->name] = $o;
    }
}
?>
Ejemplo n.º 2
0
				<p>
			</div>
		</td>
	</tr>
	<tr><td style="padding: 2em;">

		<?php 
$studs = array();
$sql = "select * from users where active=1 and user_type='s' and teacher_code={$teacher_code} and group_id != 0 order by last_name";
$rs_studs = dbExec($sql);
while (!$rs_studs->EOF) {
    $o = $rs_studs->FetchNextObj();
    $o->eid = "stud" . $o->id;
    $o->role = roleName($o->class);
    $o->name = $o->last_name . ", " . $o->first_name;
    $o->tracking = getrecobj("tracking", "where user_id=" . $o->id);
    $studs[$o->id] = $o;
}
$teams = array();
$sql = "select * from groups where teacher_code={$teacher_code} order by name";
$rs_teams = dbExec($sql);
while (!$rs_teams->EOF) {
    $o = $rs_teams->FetchNextObj();
    $o->eid = "team" . $o->id;
    $o->studs = array();
    $teams[$o->id] = $o;
}
foreach ($studs as $o) {
    $t = $teams[$o->group_id];
    $o->team = $t;
    array_push($t->studs, $o);