Files
2026-10-19 15:22:52 -07:00

131 lines
3.4 KiB
PHP

<?php
require_once("include/globals.php");
// Start the template and output buffering
startTemplate();
$templatePageTitle = "";
$noTitle = true;
$headerArgs = "";
?>
<script language= "JavaScript">
var previousRow;
var previousVSpan;
var previousHSpan;
function showAnswer(question) {
var row = document.getElementById('r'+question);
var vspan = document.getElementById('v'+question);
var hspan = document.getElementById('h'+question);
if (previousRow) {
previousRow.style.display = 'none';
previousVSpan.style.display = '';
previousHSpan.style.display = 'none';
}
row.style.display = '';
row.style.backgroundColor = '#ffffff';
vspan.style.display = 'none';
hspan.style.display = '';
previousRow = row;
previousVSpan = vspan;
previousHSpan = hspan;
}
function hideAnswer(question) {
var row = document.getElementById('r'+question);
var vspan = document.getElementById('v'+question);
var hspan = document.getElementById('h'+question);
row.style.display = 'none';
vspan.style.display = '';
hspan.style.display = 'none';
}
</script>
<?php
//
// Determine if this is limited to Public FAQ's
//
$class_where = "";
if (SessionActive() != 1 || ! UserLoggedIn()) {
$class_where = "where class = 'Public' and admin_only = 'N' ";
}
if (SessionActive() == 1 && UserLoggedIn()) {
if (!in_array($_SESSION['UserInfo']['type'],array('SuperUser','System Administrator','Application Administrator','Communications Administrator','Administration Team'))) {
$class_where = "where admin_only = 'N' ";
}
}
//
// Get set of FAQ's
//
$query = "select * from faqs " .
$class_where .
"order by category,sequence";
$results = db_query($query);
$PageTitle = getLanguageText('FAQS-TITLE');
?>
<br>
<table width='<?php echo($default_data_width) ?>' class='content-table'>
<tr>
<td align='center' class='heading'><?php echo($PageTitle) ?></td>
</tr>
<?php
$prev_category = "";
while ($entry = db_fetch_array($results)) {
extract($entry);
if ($category != $prev_category) {
$prev_category = $category;
?>
<tr>
<td></td>
</tr>
<tr>
<td align='left' class='subheading'>&nbsp;&nbsp;<?php echo($category) ?></td>
</tr>
<?php
}
$answer = nl2br($answer);
?>
<tr>
<td align='center'>
<a name='a<?php echo($record_num) ?>'></a>
<table width='95%' cellspacing='5' cellpadding='5' bgcolor='#aaaaaa' id='t<?php echo($record_num) ?>'>
<tr bgcolor='#dddddd'>
<td align='left'>
<p><b><?php echo($title) ?></b>
&nbsp;&nbsp;&nbsp;&nbsp;
<span id='v<?php echo($record_num) ?>'><a href='#a<?php echo($record_num) ?>' onClick='showAnswer(<?php echo($record_num) ?>);'><?php displayLanguageText('FAQS-VIEW') ?></a></span>
<span id='h<?php echo($record_num) ?>' style='display: none'><a href='#a<?php echo($record_num) ?>' onClick='hideAnswer(<?php echo($record_num) ?>);'><?php displayLanguageText('FAQS-HIDE') ?></a></span></p>
</td>
</tr>
<tr id='r<?php echo($record_num) ?>' style='display: none; background-color: #ffffff;'>
<td align='left'><p><?php echo($answer) ?></p></td>
</tr>
</table>
</td>
</tr>
<?php
}
?>
</table>
<br>
<?php
endTemplate();
?>