<?php $this->raw(); $column_login = array('uid', 'time', 'status'); $table_login = '******'; $login = Table::set(Db::get_link(), $table_login, $column_login); $table = 'user'; $column = array('uid', 'alias', 'last_name', 'first_name', 'birthday', 'date'); $dbTable = Table::set(Db::get_link(), $table, $column); $dbTable->setPrimary('uid'); $dbTable->setUnique(array()); $dbTable->setSortable(array('uid', 'last_name', 'first_name', 'date', 'alias')); $dbTable->setSearchable(array('uid' => 'bigint', 'last_name' => 'varchar', 'first_name' => 'varchar', 'date' => 'datetime', 'alias' => 'varchar')); $dbTable->setAutoIncrement(true); $req = new Table_query($dbTable, 'u'); $req->outerJoin($login, 'l', 'l.uid=u.uid'); $n = clone $req; /* $req->selectColumn('*')->orWhere(1)->andWhere()->orWhere(array('1',2 ,3 ,4))->andWhere('1'); $req->orderBy(array('uid'=>'ASC')); $req->limitSelect(0,21); $r = $req->getObject(); $n->limitUpdate(1); $test->setValidateRules('alias', function($v) { echo "validate --> $v <br />"; }); echo $n->update(array('alias'=>'sOO----Ouper')); */ $n->selectColumn('u.uid'); $n->orWhere(array(8, 9))->orWhere()->andWhere('1')->orWhere(2); $n->orWhere()->andWhere(4)->orWhere(5)->orWhere()->search(array('alias' => 'a')); $n->orderBy(array('uid' => 'ASC')); $r = $n->getObject();
$txt .= "{$k} = {$v}\n"; } $t->set("<pre>{$txt}</pre>", "left"); $t->nextrow(); $t->dump(); } exit; } if ($userqry) { $rs = dbExec("select\n\t\t\t\t\t\t\tu.id,\n\t\t\t\t\t\t\tu.user_type,\n\t\t\t\t\t\t\tu.username,\n\t\t\t\t\t\t\tu.password,\n\t\t\t\t\t\t\tu.first_name,\n\t\t\t\t\t\t\tu.last_name,\n\t\t\t\t\t\t\tu.email,\n\t\t\t\t\t\t\tt.name as grp,\n\t\t\t\t\t\t\tu.group_id gid,\n\t\t\t\t\t\t\tu.status,\n\t\t\t\t\t\t\tu.task_progress,\n\t\t\t\t\t\t\tu.active\n\t\t\t\t\t\tfrom users as u\n\t\t\t\t\t\tleft outer join groups as t on \n\t\t\t\t\t\t\tt.id = u.group_id\n\t\t\t\t\t\twhere\n\t\t\t\t\t\t\tu.active = 1\n\t\t\t\t\t\t\tand\n\t\t\t\t\t\t\tconcat_ws(\n\t\t\t\t\t\t\t\t' ',\n\t\t\t\t\t\t\t\tu.first_name,\n\t\t\t\t\t\t\t\tu.last_name,\n\t\t\t\t\t\t\t\tu.username,\n\t\t\t\t\t\t\t\tu.email,\n\t\t\t\t\t\t\t\tt.name\n\t\t\t\t\t\t\t\t) like '%{$userqry}%'\n\t\t\t"); $t = new Table("s"); if ($rs->RecordCount() > 0) { //$t->set("ID"); //$t->set("Active"); //$t->set("Type"); $t->set("First"); $t->set("Last"); $t->set("User"); $t->set("Pass"); $t->set("EMail"); $t->set("Team / Status"); //$t->set("Team ID"); $t->nextrow(); while (!$rs->EOF) { $o = $rs->FetchNextobj(); if (preg_match("/-delet/", $o->username)) { continue; } // xxx $ut = "cell"; if ($o->user_type == 't') {
background-color: #26a; color: white; } #b_table { border: solid 1px #46a; border-bottom: solid 0px #46a; } </style> <p> Here is the data in tabular form for easier reading. <p> <?php $t = new Table("b"); $t->set("First Name"); $t->set("Last Name"); $t->set("Team Name"); $t->set("Team Role"); $t->set("Username"); $t->set("Password"); $lc = count($lines); for ($lineno = 0; $lineno < $lc; $lineno++) { $l =& $lines[$lineno]; $t->row($lineno + 1); $t->set($l[0]); $t->set($l[1]); $t->set($l[2]); $t->set($l[3]); $t->set($l[4]); $t->set($l[5]);
<?php $sql = "select * from scores order by decision asc"; $rs = dbExec($sql); $tbl = new Table("scores"); $row = 0; while (!$rs->EOF) { $o = $rs->FetchNextObj(); //$tbl->set(mkbut("Delete", "?act=del&dec=".$o->decision, true)); //$tbl->set(mkbut("Clear", "?act=clr&dec=".$o->decision, true)); $hrow = array(); foreach ($o as $t => $v) { array_push($hrow, $t); } if ($row % 10 == 0) { foreach ($hrow as $h) { $tbl->set($h, "head"); } $tbl->nextrow(); } foreach ($o as $t => $v) { if ($t == "decision") { $tbl->set($v); } else { $class = "set_zero"; if ($v < 0) { $class = "set_neg"; } if ($v > 0) { $class = "set_pos"; } $dec = $o->decision;
font-family: helvetica; padding: 4px; padding-left: 15px; padding-right: 15px; } #top_cell { font-family: helvetica; padding: 4px; padding-left: 15px; padding-right: 15px; } </style> <?php include "table.php"; $t = new Table("top"); $t->set("<div id=hh1>Rank</div>"); $t->set("<div id=hh1>Percentile</div>"); $t->set("<div id=hh1>Student</div>"); $rs = dbExec("select\n r.p_final,\n\t\t\t\t\t\t\tconcat(u.last_name,', ',u.first_name) as name,\n\t\t\t\t\t\t\tconcat_ws(' ',s.name,s.city,s.state) as school,\n\t\t\t\t\t\t\tu.school_code as sc,\n r.uid\n from\n results as r\n left outer join users as u on\n u.id = r.uid\n left outer join schools as s on\n s.code = u.school_code\n where\n p_final is not null\n\t\t\t\t\t\torder by p_final desc\n\t\t\t\t\t\tlimit {$topcount}\n\t\t\t\t\t\t"); while ($o = $rs->FetchNextObj()) { $id = $o->uid; $pcntl = $o->p_final; $name = $o->name; $name = "<a href='?rtype=indv&n={$id}'>{$name}</a>"; $sc = $o->sc; $school = $o->school; $school = "<font color=gray size=-1>{$school}</font>"; $t->row($rs->CurrentRow() + 1); $t->set($rs->CurrentRow() + 1); $t->set(percbar_str($pcntl, $pcntl)); $t->set($name . "<br>" . $school);
$stat = "In task {$wk}"; } } if ($wk < $game_weeks + 1) { $guts .= "<span style='padding-left: 40px;'>{$stat} {$but}</span>"; } if ($dbg) { $guts .= "\n\t\t\t\t\t<br/>\n\t\t\t\t\t<div class=dbg>group_id: " . $o->id . "</div> \n\t\t\t\t\t<div class=dbg>server_host: " . $o->server_host . "</div>\n\t\t\t\t\t<div class=dbg>server_port: " . $o->server_port . "</div>\n\t\t\t\t\t<div class=dbg>week/task: " . $o->week . "</div> \n\t\t\t\t\t"; } if ($user_type != 't') { $guts = ""; } $t->set($guts, "ghead"); $t->nextrow(); $t2 = new Table("s"); $t2->set("Student Name"); for ($w = 1; $w <= $game_weeks; $w++) { $t2->set("Task {$w}"); } $t2->set(""); $t2->set(""); $t2->nextrow(); foreach ($o->studs as $o2) { $eid = "stud" . $o2->id; $z = $o2->name; $z = preg_replace("/ /", " ", $z); if ($user_type == 't') { $z = "<a href='javascript:showdet(\"{$eid}\")' >{$z}</a>"; } $up = "Username: "******"<br/>"; $up .= "Password: "******"<br/>";
$e = explode(";", $h); $hsel .= "<option value='" . $e[1] . "'>" . $e[1] . " (" . $e[0] . ")</option>\n"; } $hsel .= "</select>\n"; $hselu = "<select name='hostu'>\n"; $hselu .= "<option value=''>[No change]</option>\n"; foreach ($hosts as $h) { $e = explode(";", $h); $hselu .= "<option value='" . $e[1] . "'>" . $e[1] . " (" . $e[0] . ")</option>\n"; } $hselu .= "</select>\n"; //echo $hsel; $sql = "select\n\t\t\t\tdistinct(s.code) as code\n\t\t\t\t,\n\t\t\t\tu.teacher_code as tc\n\t\t\t\t,\n\t\t\t\ts.name, s.city, s.state\n\t\t\t\t,\n\t\t\t\tg.server_host as sh, g.server_port as sp\n\t\t\tfrom\n\t\t\t\tschools as s\n\t\t\t\t,\n\t\t\t\tusers as u\n\t\t\t\t,\n\t\t\t\tgroups as g\n\t\t\twhere\n\t\t\t\ts.code = u.school_code\n\t\t\t\tand\n\t\t\t\tu.active=1\n\t\t\t\tand\n\t\t\t\tu.user_type='s'\n\t\t\t\tand\n\t\t\t\tu.group_id!=0\n\t\t\t\tand\n\t\t\t\tu.group_id=g.id\n\t\t\t\tgroup by u.school_code\n\t\t\t\torder by s.name\n\t\t\t\tlimit 700\n\t\t\t"; $rs = dbExec($sql); $t = new Table("foo"); $t->set("Select"); $t->set("school_code"); $t->set("server_host"); $t->set("server_port"); $t->set("School"); ?> <h2>Game Server Redirection Page</h2> <!--p> Schools with students assigned to teams: <?php echo $rs->RecordCount(); ?> <br--> <p> <font color=red> <b><u>Don't do this when servers are in heavy use unless you absolutely must.
?> <style> #x_table { border-collapse: collapse; } #x_head, #x_cell { padding: 2px 8px 2px 8px; border: solid 1px #aaa; } #x_head { font-weight: bold; } </style> <?php $t = new Table("x"); $t->set("Num"); $t->set("School Code"); $t->set("User ID"); $t->set("Last"); $t->set("First"); $t->set("Teacher Code"); $t->set("Teacher Name"); $t->set("Teacher Email"); $t->nextrow(); $tcodes = array(); $num = 1; foreach ($list as $o) { $tid = getfld("id", "users", "where teacher_code=" . $o->teacher_code . " and user_type='t'"); $temail = getfld("email", "users", "where teacher_code=" . $o->teacher_code . " and user_type='t'"); if (!isset($tcodes[$temail])) { $tcodes[$temail] = 1;