Gazelle/sections/questions/answers.php

40 lines
992 B
PHP
Raw Normal View History

2013-10-13 08:01:01 +00:00
<?
$DB->query("
2013-10-14 08:00:53 +00:00
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");
2013-10-13 08:01:01 +00:00
$Staff = $DB->to_array();
2013-10-14 08:00:53 +00:00
$DB->query("
SELECT COUNT(1)
FROM user_questions");
2013-10-13 08:01:01 +00:00
list($TotalQuestions) = $DB->next_record();
2013-10-14 08:00:53 +00:00
View::show_header("Ask the Staff");
2013-10-13 08:01:01 +00:00
?>
<div class="thin">
2013-10-14 08:00:53 +00:00
<div class="header">
<h2>Staff Answers</h2>
</div>
2013-10-13 08:01:01 +00:00
<div class="linkbox">
2013-10-14 08:00:53 +00:00
<? if (check_perms("users_mod")) { ?>
2013-10-13 08:01:01 +00:00
<a class="brackets" href="questions.php">View questions</a>
<? } else { ?>
<a class="brackets" href="questions.php">Ask question</a>
<? } ?>
2013-10-14 08:00:53 +00:00
<a class="brackets" href="questions.php?action=popular_questions">Popular questions</a>
2013-10-13 08:01:01 +00:00
</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>
<?
2013-10-14 08:00:53 +00:00
View::show_footer();