Gazelle/sections/questions/answers.php
2013-10-13 08:01:01 +00:00

40 lines
883 B
PHP

<?
View::show_header("Ask the Staff");
$DB->query("
SELECT
sq.UserID, um.Username, count(1) AS Answered
FROM staff_answers AS sq
LEFT JOIN users_main AS um
ON um.ID = sq.UserID
GROUP BY sq.UserID
ORDER BY um.Username ASC");
$Staff = $DB->to_array();
$DB->query("SELECT COUNT(1) FROM user_questions");
list($TotalQuestions) = $DB->next_record();
?>
<div class="thin">
<h2>
Staff Answers
</h2>
<div class="linkbox">
<?
if (check_perms("users_mod")) { ?>
<a class="brackets" href="questions.php">View questions</a>
<? } else { ?>
<a class="brackets" href="questions.php">Ask question</a>
<? } ?>
</div>
<? foreach($Staff as $User) { ?>
<h2>
<a href="questions.php?action=view_answers&amp;userid=<?=$User['UserID']?>"><?=$User['Username']?></a>
- (<?=$User['Answered']?> / <?=$TotalQuestions?>)
</h2>
<? } ?>
</div>
<?
View::show_footer();