</div> <?php exit; } else { if ($action == "creategroup") { $anchor = rt("anchor"); $tab = rt("tab"); $name = rt("name"); //$city_name = rt("city_name"); //dbg("name=$name city_name=$city_name"); if ($name == "") { fail("You must supply a team name. Please try again.", $anchor); } //if($city_name == "") // msgRedirectRed("You must supply a city name. Please try again.", $anchor); $s = test_team_name($name); if (is_string($s)) { fail("Sorry, team name is inadequate - {$s}.<br>Please try again."); } // make sure this teacher is below their quota of groups dbg("teacher_code={$teacher_code}"); $sql = "select count(*) from groups where teacher_code={$teacher_code}"; $rs = $db->Execute($sql); if (!$rs) { p_sqlfail($db, $sql); } $maxgrps = $db->GetOne("select val from config where tag='max_groups_per_teacher'"); if ($rs->fields(0) >= $maxgrps) { msgRedirectRed("Sorry. You can not create more than {$maxgrps} teams.", $anchor); } $n = 0;
if (lwr($ROLE) == lwr($roledata[$i])) { dbg("found valid role string {$ROLE}"); // use properly cased $roledata version $ROLE = $roledata[$i]; break; } } if ($i > $c) { // not found err("The role \"" . $ROLE . "\" is invalid"); $ROLE = "-"; } } // team name if ($TEAM != "-") { $s = test_team_name($TEAM); if (is_string($s)) { err("The team name \"{$TEAM}\" {$s}"); $TEAM = "-"; // change to unassigned team } else { dbg("line specified team {$TEAM}"); if (!isset($teams[$TEAM])) { $teams[$TEAM] = array(); dbg("created team {$TEAM}"); } $t = $teams[$TEAM]; if (count($t) >= 4) { err("Too many students assigned to team \"{$TEAM}\""); $TEAM = "-"; } else {