216 lines
7.4 KiB
PHP
216 lines
7.4 KiB
PHP
<?php
|
|
require_once("include/globals.php");
|
|
|
|
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
|
header("Location: /");
|
|
exit();
|
|
}
|
|
|
|
|
|
// Start the template and output buffering
|
|
startTemplate();
|
|
$headerArgs = "";
|
|
|
|
|
|
$school_name = $school_record['school_name'];
|
|
unset($student);
|
|
|
|
|
|
if ($_SESSION['UserInfo']['type'] == 'Parent' || (array_key_exists('mode',$_GET) && $_GET['mode'] == 'parent')) {
|
|
if (array_key_exists('student_num',$_GET)) $student_num = intval($_GET['student_num']);
|
|
if (array_key_exists('student_num',$_POST)) $student_num = intval($_POST['student_num']);
|
|
|
|
if (!isset($student_num)) {
|
|
$error_message = getLanguageText('ERRORMSG-INVALID-ACCESS');
|
|
$action = '';
|
|
$naction = '';
|
|
header("Location: /?action=$action&naction=$naction$headerArgs&form_message=" . urlencode($form_message) . "&error_message=" . urlencode($error_message));
|
|
exit();
|
|
}
|
|
|
|
|
|
// Verify that this student is linked to the current user
|
|
$unum = $_SESSION['UserInfo']['record_num'];
|
|
$query = "select * from people " .
|
|
"where school_num = $base_school_num " .
|
|
"and user_num = $unum " .
|
|
"and people_type = 'Student' " .
|
|
"and display = 'Y' " .
|
|
"and record_num = $student_num";
|
|
$results = db_query($query);
|
|
|
|
if (db_num_rows($results) == 0) {
|
|
echo("<br>\n");
|
|
$error_message = getLanguageText('ERRORMSG-INVALID-ACCESS');
|
|
include "form.messages.php";
|
|
return;
|
|
}
|
|
|
|
$student = db_fetch_array($results);
|
|
|
|
// Get class_num
|
|
$class_num = $student['class_num'];
|
|
}
|
|
else {
|
|
if (array_key_exists('class_num',$_GET)) $class_num = intval($_GET['class_num']);
|
|
if (array_key_exists('class_num',$_POST)) $class_num = intval($_POST['class_num']);
|
|
}
|
|
|
|
|
|
$templatePageTitle = $school_record['school_name'] . " - " . getLanguageText('TEXT-CLASS-LIST');
|
|
|
|
// Get class info
|
|
if (isset($class_num)) {
|
|
$class_info = getClassInfo($class_num);
|
|
$templatePageTitle .= "<br>\n$class_info";
|
|
}
|
|
|
|
if (isset($student) && $school_record['verified_only_class_list'] == 'Y' && $student['status'] != 'Verified') {
|
|
$content = getPageContent($school_num,"Access to Class List Denied");
|
|
?>
|
|
<table width='750' cellpadding='5' cellspacing='2' border='0' class='content-table'>
|
|
<tr>
|
|
<td align='center' class='heading'><?php displayLanguageText('ERRORMSG-ACCESS-NOT-PERMITTED'); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td align='left'><?php echo($content); ?></td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<?php
|
|
}
|
|
else {
|
|
|
|
?>
|
|
<br>
|
|
<table width='850' cellpadding='5' cellspacing='2' border='0' class='content-table'>
|
|
<tr>
|
|
<td align='left' class='heading'><?php displayLanguageText('TEXT-NAME'); ?></td>
|
|
<?php if ($school_record['c_display_name'] == 'Y') { ?>
|
|
<td align='left' class='heading'><?php displayLanguageText('TEXT-CONTACT'); ?></td>
|
|
<?php } ?>
|
|
<?php if ($school_record['c_display_home_phone'] == 'Y') { ?>
|
|
<td align='left' width='110' class='heading'><?php displayLanguageText('TEXT-HOME'); ?></td>
|
|
<?php } ?>
|
|
<?php if ($school_record['c_display_cell_phone'] == 'Y') { ?>
|
|
<td align='left' width='110' class='heading'><?php displayLanguageText('TEXT-CELL'); ?></td>
|
|
<?php } ?>
|
|
<?php if ($school_record['c_display_home_email'] == 'Y') { ?>
|
|
<td align='left' class='heading'><?php displayLanguageText('TEXT-EMAIL'); ?></td>
|
|
<?php } ?>
|
|
</tr>
|
|
<?php
|
|
// Set student display flag based on user type
|
|
$swhere = "and display = 'Y' ";
|
|
if (in_array($_SESSION['UserInfo']['type'],array('SuperUser','System Administrator','Application Administrator','Communications Administrator','Staff','Administration Team','Schedule Team'))) $swhere = "";
|
|
|
|
// Get students in this class
|
|
$class_num = intval($class_num);
|
|
$query = "select * from people " .
|
|
"where school_num = $base_school_num " .
|
|
"and class_num = $class_num " .
|
|
"and people_type = 'Student' " .
|
|
$swhere .
|
|
"order by last_name,first_name";
|
|
$students = db_query($query);
|
|
echo("\n<!-- $query -->\n\n");
|
|
|
|
$count = 0;
|
|
|
|
while ($row = db_fetch_array($students)) {
|
|
$snum = $row['record_num'];
|
|
$name = $row['first_name'] . " " . $row['last_name'];
|
|
$unum = $row['user_num'];
|
|
|
|
// Get the contact records for this student
|
|
$query = "select * from contacts " .
|
|
"where school_num = $school_num " .
|
|
"and user_num = $unum " .
|
|
"order by last_name,first_name";
|
|
$results = db_query($query);
|
|
|
|
// If there are contact records
|
|
if (db_num_rows($results) > 0) {
|
|
|
|
$bgclass = "data-odd";
|
|
if (($count % 2) == 0) $bgclass = "data-even";
|
|
$count++;
|
|
|
|
// Display each contact record
|
|
while ($row = db_fetch_array($results)) {
|
|
extract($row);
|
|
$contact = $first_name . " " . $last_name;
|
|
|
|
if (strlen($home_email) > 0) $home_email = "<a href='mailto:$home_email'>$home_email</a>";
|
|
?>
|
|
<tr>
|
|
<td align='left' width='200' valign='top' class='<?php echo($bgclass) ?>'><?php echo($name) ?></td>
|
|
<?php if ($school_record['c_display_name'] == 'Y') { ?>
|
|
<td align='left' valign='top' class='<?php echo($bgclass) ?>'><?php echo($contact) ?></td>
|
|
<?php } ?>
|
|
<?php if ($school_record['c_display_home_phone'] == 'Y') { ?>
|
|
<td align='left' valign='top' class='<?php echo($bgclass) ?>'><?php echo($home_phone) ?></td>
|
|
<?php } ?>
|
|
<?php if ($school_record['c_display_cell_phone'] == 'Y') { ?>
|
|
<td align='left' valign='top' class='<?php echo($bgclass) ?>'><?php echo($cell_phone) ?></td>
|
|
<?php } ?>
|
|
<?php if ($school_record['c_display_home_email'] == 'Y') { ?>
|
|
<td align='left' valign='top' class='<?php echo($bgclass) ?>'><?php echo($home_email) ?></td>
|
|
<?php } ?>
|
|
</tr>
|
|
<?php
|
|
$name = "";
|
|
}
|
|
}
|
|
else {
|
|
|
|
$bgclass = "data-odd";
|
|
if (($count % 2) == 0) $bgclass = "data-even";
|
|
$count++;
|
|
|
|
?>
|
|
<tr>
|
|
<td align='left' width='200' valign='top' class='<?php echo($bgclass) ?>'><?php echo($name) ?></td>
|
|
<?php if ($school_record['c_display_name'] == 'Y') { ?>
|
|
<td align='left' valign='top' class='<?php echo($bgclass) ?>'> </td>
|
|
<?php } ?>
|
|
<?php if ($school_record['c_display_home_phone'] == 'Y') { ?>
|
|
<td align='left' valign='top' class='<?php echo($bgclass) ?>'> </td>
|
|
<?php } ?>
|
|
<?php if ($school_record['c_display_cell_phone'] == 'Y') { ?>
|
|
<td align='left' valign='top' class='<?php echo($bgclass) ?>'> </td>
|
|
<?php } ?>
|
|
<?php if ($school_record['c_display_home_email'] == 'Y') { ?>
|
|
<td align='left' valign='top' class='<?php echo($bgclass) ?>'> </td>
|
|
<?php } ?>
|
|
</tr>
|
|
<?php
|
|
}
|
|
}
|
|
|
|
if (isset($student_num)) {
|
|
$print_link = "class-list.print.php?student_num=$student_num";
|
|
}
|
|
else {
|
|
$print_link = "class-list.print.php?class_num=$class_num";
|
|
}
|
|
?>
|
|
</table>
|
|
<table width='850' cellpadding='5' cellspacing='2' border='0'>
|
|
<tr>
|
|
<td align='right'>
|
|
<table align='right'>
|
|
<tr>
|
|
<td align='left'><a href='<?php echo($print_link) ?>' class='btn btn--primary btn--xsmall'><span><?php displayLanguageText('TEXT-PRINTABLE-LIST'); ?></span></a></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<?php
|
|
include "get.adobe.php";
|
|
}
|
|
|
|
endTemplate();
|
|
?>
|