.
// actions:
// (none)
// form to choose select and xset; OK goes to:
// snap_form
// if have a snapshot, show its start/end times
// show form to get new snapshot
// snap_action
// make new snapshot
// compare(filter, breakdown)
// show comparison.
// show form to set or change filter or breakdown.
require_once("../inc/bolt_util_ops.inc");
require_once("../inc/bolt_db.inc");
require_once("../inc/bolt.inc");
require_once("../inc/bolt_cat.inc");
require_once("../inc/bolt_snap.inc");
require_once("../inc/util_ops.inc");
$filter = null;
$filter_cat = null;
$breakdown = null;
$breakdown_cat = null;
function compare_case(
$title, $select_unit, $snap, $filter, $filter_cat, $breakdown, $breakdown_cat
) {
// for each select alternative, build an array of xset scores
//
$a = array();
foreach ($snap->recs as $uid=>$x) {
if ($filter && $filter->categorize($x->user) != $filter_cat) {
//echo " $uid rejected by filter ";
continue;
}
if ($breakdown && $breakdown->categorize($x->user) != $breakdown_cat) {
//echo " $uid rejected by breakdown ";
continue;
}
$z = $x->sf->selected_unit;
$u = $x->sf->selected_unit;
$a[$u][] = $x->xr->score;
}
if ($title) {
echo "
$title
";
}
foreach ($select_unit->units as $child) {
if (array_key_exists($child->name, $a)) {
$scores = $a[$child->name];
$n = count($scores);
if ($n < 2) {
$x = compare_bar_insuff($child->name, 600);
} else {
conf_int_90($scores, $lo, $hi);
//$x = "($lo, $hi) ($n results)";
$x = compare_bar($child->name, $n, 600, $lo, $hi);
}
} else {
$x = compare_bar_insuff($child->name, 600);
}
echo $x;
}
}
function compare_aux($select_name, $xset_name, $snap) {
global $top_unit, $course_id, $filter, $filter_cat;
global $breakdown, $breakdown_cat;
get_filters_from_form();
$select_unit = lookup_unit($top_unit, $select_name);
if (!$select_unit) error_page("no select unit");
admin_page_head("Unit comparison");
echo "
The following compares the alternatives of
$select_name with respect to $xset_name.