\n");
echo("\n");
echo("| $country | \n");
$pcountry = $country;
}
if (strlen($province)) {
$width = 70;
if ($country == 'United Kingdom') $width = '130';
$detail = " +";
echo("$province ($pcount)$detail | \n");
}
}
echo("
\n");
//
// List of resellers
//
$resellers = db_query("SELECT reseller_code FROM resellers ORDER BY business_name");
$width = 130;
$count = 0;
echo("
");
echo("\n");
while ($row = db_fetch_assoc($resellers)) {
$rname = $row['reseller_code'];
// echo("| $rname | \n");
$pcount = db_getVal("SELECT count(*) FROM schools WHERE status = 'Active' AND reseller = '$rname'");
$detail = " +";
echo("$rname ($pcount)$detail | \n");
$count++;
if ($count >= 6) {
$count = 0;
echo("
");
}
}
echo("
\n");
$rwhere = "";
//
// List of schools
//
if (array_key_exists('reseller',$_GET) && strlen($_GET['reseller'])) {
$reseller = $_GET['reseller'];
$rwhere = "AND reseller = '$reseller' ";
$query = "SELECT * FROM schools WHERE status = 'Active' $rwhere ORDER BY country,province,listing_city,school_name";
}
else {
$pwhere = "AND province = 'BC' ";
if (array_key_exists('prov',$_GET)) $pwhere = "AND province = '$_GET[prov]' ";
if (array_key_exists('country',$_GET)) $pwhere = "AND country = '$_GET[country]' ";
$mode = 'Summary';
$query = "SELECT * FROM schools WHERE status = 'Active' $pwhere ORDER BY country,province,listing_city,school_name";
}
$schools = db_query($query);
$prev_country = "";
$prev_province = "";
$prev_city = "";
if (array_key_exists('mode',$_GET)) $mode = $_GET['mode'];
$output = "";
while ($row = db_fetch_assoc($schools)) {
extract($row);
$city = $listing_city;
$ocity = $city;
$city = trim($city);
if ($city != $ocity) db_query("UPDATE schools SET city = '" . db_escape_string($city) . "' WHERE record_num = $record_num");
if ($prev_province != $province) echo("$country - $province
");
if ($prev_city != $city) {
$numCity = db_getVal("SELECT count(*) FROM schools WHERE status = 'Active' AND city = '" . db_escape_string($city) . "' $rwhere");
echo("$city - $numCity
");
}
switch ($mode) {
case 'Detail':
$contacts = "";
$results = db_query("SELECT * FROM school_contact_list WHERE school_num = $record_num ORDER BY sequence");
while ($row = db_fetch_assoc($results)) {
$contacts .= '
- ' . $row['contact_name'];
if (strlen($row['contact_phone'])) $contacts .= " - " . $row['contact_phone'];
if (strlen($row['contact_email'])) $contacts .= " - " . $row['contact_email'] . "";
}
$edate = $expiry_date;
if (strpos($start_date,'2015-') !== FALSE) {
$start_date = "$start_date";
if (strpos($expiry_date,'2016-') !== FALSE) $expiry_date = "$expiry_date";
}
$expiry_date = "$expiry_date";
echo("");
echo("$school_name ($record_num)
\n");
echo("$address, $city, $province
\nPrincipal: $principal - $phone$contacts
");
echo("Start: $start_date - Expiry: $expiry_date");
// Get any linked sites
$results = db_query("SELECT * FROM schools WHERE status = 'Linked' AND linked_site = $record_num ORDER BY link_sequence");
if (db_num_rows($results)) {
while ($row = db_fetch_assoc($results)) {
extract($row);
echo("
\n - ($record_num) $url");
}
}
echo("
\n");
break;
case 'Summary':
default:
echo("$school_name ($record_num)
\n$address, $city, $province
\n");
break;
}
$prev_country = $country;
$prev_province = $province;
$prev_city = $city;
}
echo(nl2br($output));
$schoolsList = true;
include "include/jquery.hl.php";
include "include/jquery.dialogs.php";
?>