예제 #1
0
 </td>
					<?php 
}
$sql = "select count(id) from groups where teacher_code != 0";
$total = dbGetFld($sql);
?>
				</tr>
				<tr>
				<td class=sutd> <?php 
echo $total;
?>
 </td>
				<?php 
for ($i = 0; $i <= $game_weeks + 1; $i++) {
    $sql = "select count(id) from groups where teacher_code != 0 and week={$i}";
    $n = dbGetFld($sql);
    $p = $n * 100 / $total;
    $p = sprintf("%0.1f", $p);
    ?>
					<td class=sutd> <?php 
    echo $p;
    ?>
% </td>
					<?php 
}
?>
			</tr>
		</table>
		<br>
		<br>
예제 #2
0
    $raised = raisedbystudent($o->uid, $tvc);
    $tr[$o->gid] = true;
    if ($rs->CurrentRow() % $j == 0) {
        echo $rs->CurrentRow() . "&mdash;";
    }
    ob_flush();
    flush();
}
p("Done");
b("updating raised money for teams");
$rc = count($tr);
p("Records to process: {$rc}");
$j = $rc / 10;
$cr = 0;
foreach ($tr as $gid => $v) {
    $raised = dbGetFld("select sum(raised) + (avg(raised) * CEIL((4-count(raised))/4)) from results where gid={$gid}");
    dbExec("update groups set raisedmoney={$raised} where id={$gid}");
    $cr++;
    if ($cr % $j == 0) {
        echo $cr . "&mdash;";
    }
    ob_flush();
    flush();
}
p("Done");
b("updating raised money percentile for students");
$rs = dbExec("select uid, raised as val  from results where p_raised is NULL order by val asc");
$rc = $rs->RecordCount();
p("Records to process: {$rc}");
$j = $rc / 10;
$total = $rc;
예제 #3
0
    echo $s;
    ?>
 </td>
			<?php 
}
$total2 = dbGetFld("select count(id) from users where active=1 and user_type='s' and group_id != 0");
?>
			</tr>
			<tr>
				<td class=sutd> <?php 
echo $total2;
?>
 </td>
			<?php 
for ($i = 0; $i <= $game_weeks + 1; $i++) {
    $n2 = dbGetFld("select count(id) from users where active=1 and user_type='s' and group_id != 0 and week={$i}");
    $p2 = $n2 * 100 / $total2;
    $p2 = sprintf("%0.1f", $p2);
    ?>
					<td class=sutd> <?php 
    echo $p2;
    ?>
% </td>
			<?php 
}
?>
			</tr>
		</table>
		<!-- end new content -->
</div>
예제 #4
0
<?php

include "a_menu.php";
$act = rt("act");
if ($act) {
    ob_clean();
    $dec = rt("decision");
    $col = rt("col");
    $val = rt("val");
    if ($act == "set") {
        $sql = "update scores set {$col}={$val} where decision='{$dec}'";
        dbExec($sql);
        $nval = dbGetFld("select {$col} from scores where decision='{$dec}'");
        echo "ok,{$dec},{$col},{$nval}";
        exit;
    } else {
        if ($act == "clr") {
            $sql = "delete from scores where decision='{$dec}'";
            dbExec($sql);
            $sql = "insert into scores (decision) values ('{$dec}')";
            dbExec($sql);
        } else {
            if ($act == "del") {
                $sql = "delete from scores where decision='{$dec}'";
                dbExec($sql);
            }
        }
    }
}
include "table.php";
?>
예제 #5
0
파일: hourly.php 프로젝트: piter65/spilldec
     // count how many groups are in the tutorial
     $sql = "select count(id) from `groups` where teacher_code={$tc} and week=0";
     $num_groups_in_tutorial = dbGetFld($sql);
     if ($num_groups_in_tutorial > 0) {
         // at least one group is still in tutorial
         $in_tutorial = 1;
     }
     if ($num_groups > 0) {
         // this teacher has at least one group
         /*$sql = "select count( distinct group_id ) from users where teacher_code=$tc and week=0 and gamedata!=''";
         		$groups_in_tutorial = dbGetFld($sql);
         		$status = "In Tutorial";*/
         for ($w = 1; $w <= $game_weeks + 1; $w++) {
             // count how many groups are in, or beyond, week $w
             $sql = "select count(id) from groups where teacher_code={$tc} and week>={$w}";
             $groups_in_week = dbGetFld($sql);
             if ($groups_in_week / $num_groups > $most) {
                 // most of the groups are in, or beyond, week $w
                 $status = "Task {$w}";
                 if ($w > $game_weeks) {
                     // this week is the last one
                     $status = "Finished";
                 }
             }
         }
     }
 }
 // XXX task_progress was not a useful value
 $sql = "update users set low_week = '{$low_week}', status = '{$status}', task_progress=0, in_tutorial={$in_tutorial} where id = {$id} limit 1";
 dbExec($sql);
 echo "{$tc}\t{$full_name}\t<{$email}>\t{$status}\t{$in_tutorial}\t'{$low_week}'\n";