0) {
$n = ($pg - 1) * $perPage;
$limit = "limit $n,$perPage ";
}
}
// Determine number of images in gallery
$total = db_getVal("SELECT count(*) FROM photo_gallery_images WHERE school_num = $school_num AND gallery_num = $gallery_num");
// Get the images for this gallery
$images = db_query("SELECT * FROM photo_gallery_images WHERE school_num = $school_num AND gallery_num = $gallery_num ORDER BY sequence $limit");
if (db_num_rows($images)) {
if ($total > $perPage) {
if (!isset($pg)) $pg = 1;
$link = "action=photo-gallery&gallery_num=$gallery_num";
$last = 1;
for ($i = 1; (($i - 1) * $perPage) <= $total; $i++) {
if ($i == $pg) $pages .= "[$i] ";
else $pages .= "[$i] ";
$last = $i;
}
$prev = $pg - 1;
if ($prev > 0) $pages = "<<< $pages";
$next = $pg + 1;
if ($next <= $last) $pages .= " >>>";
$pages = "$pages
";
}
if (!isset($pages)) $pages = '';
?>
\n");
echo(" \n");
echo(" | $category_title | \n");
echo("
\n");
echo(" \n");
echo(" | \n");
echo(" \n");
echo(" |
\n");
echo("
\n");
}
}
// Ensure that only valid user types can see the buttons
$AllowedUserTypes = array('SuperUser','System Administrator','Communications Administrator');
if (isset($gallery_num) && checkPermission($AllowedUserTypes) == 1) {
?>