57 lines
2.1 KiB
PHP
57 lines
2.1 KiB
PHP
<?php
|
|
if (!isset($list_started)) $list_started = false;
|
|
|
|
if (!isset($school_num)) exit();
|
|
if (!isset($base_school_num)) exit();
|
|
|
|
$sparm = "";
|
|
$sessionID = session_id();
|
|
|
|
if (isset($_SESSION['UserInfo']['record_num'])) $userNum = $_SESSION['UserInfo']['record_num'];
|
|
if (isset($userNum) && $userNum > 0) {
|
|
$timestamp = time();
|
|
$sparm = "?sid=$sessionID&un=$userNum&t=$timestamp";
|
|
}
|
|
|
|
// Display link to home site if this is a linked site
|
|
if ($base_school_num != $school_num) {
|
|
if (!$list_started) echo(" <ul>\n");
|
|
$list_started = true;
|
|
|
|
$results = db_query("SELECT * FROM schools WHERE record_num = $base_school_num");
|
|
$row = db_fetch_array($results);
|
|
$m_url = $row['url'];
|
|
$m_title = $row['link_title'];
|
|
if (strlen($m_title) == 0) $m_title = $row['school_name'];
|
|
echo(" <li><a href='http://$m_url/$sparm'>$m_title</a></li>\n");
|
|
}
|
|
|
|
// Only display Active sites
|
|
$awhere = "AND site_active = 'Y' ";
|
|
|
|
// Display all sites for administrators
|
|
if (array_key_exists('UserInfo', $_SESSION) && array_key_exists('type',$_SESSION['UserInfo'])) {
|
|
if (in_array($_SESSION['UserInfo']['type'],array('SuperUser','System Administrator','Application Administrator','Administration Team'))) $awhere = "";
|
|
}
|
|
|
|
// Handle the display of linked sites
|
|
$query = "SELECT * FROM schools " .
|
|
"WHERE linked_site = $base_school_num " .
|
|
"AND record_num != $school_num " .
|
|
"AND status = 'Linked' " .
|
|
$awhere .
|
|
"ORDER BY link_sequence,link_title";
|
|
$linked_sites = db_query($query);
|
|
if (db_num_rows($linked_sites) > 0) {
|
|
if (!$list_started) echo(" <ul>\n");
|
|
$list_started = true;
|
|
while ($row = db_fetch_array($linked_sites)) {
|
|
$m_url = $row['url'];
|
|
$m_title = $row['link_title'];
|
|
if (strlen($m_title) == 0) $m_title = $row['school_name'];
|
|
echo(" <li><a href='http://$m_url/$sparm'>$m_title</a></li>\n");
|
|
}
|
|
}
|
|
|
|
?>
|