2013-05-28 08:01:02 +00:00
|
|
|
<?php
|
2011-09-10 08:00:10 +00:00
|
|
|
|
2012-10-11 08:00:15 +00:00
|
|
|
View::show_header('Staff Inbox');
|
2011-09-10 08:00:10 +00:00
|
|
|
|
|
|
|
$View = display_str($_GET['view']);
|
2012-03-28 08:00:20 +00:00
|
|
|
$UserLevel = $LoggedUser['EffectiveClass'];
|
2011-09-10 08:00:10 +00:00
|
|
|
|
|
|
|
// Setup for current view mode
|
2013-07-02 08:01:37 +00:00
|
|
|
$SortStr = 'IF(AssignedToUser = '.$LoggedUser['ID'].', 0, 1) ASC, ';
|
2011-09-10 08:00:10 +00:00
|
|
|
switch ($View) {
|
|
|
|
case 'unanswered':
|
2013-04-17 08:00:58 +00:00
|
|
|
$ViewString = 'Unanswered';
|
2013-07-02 08:01:37 +00:00
|
|
|
$WhereCondition = "
|
|
|
|
WHERE (Level <= $UserLevel OR AssignedToUser = '".$LoggedUser['ID']."')
|
|
|
|
AND Status = 'Unanswered'";
|
2011-09-10 08:00:10 +00:00
|
|
|
break;
|
|
|
|
case 'open':
|
2013-08-28 23:08:41 +00:00
|
|
|
$ViewString = 'Unresolved';
|
2013-07-02 08:01:37 +00:00
|
|
|
$WhereCondition = "
|
|
|
|
WHERE (Level <= $UserLevel OR AssignedToUser = '".$LoggedUser['ID']."')
|
|
|
|
AND Status IN ('Open', 'Unanswered')";
|
2012-02-07 08:00:20 +00:00
|
|
|
$SortStr = '';
|
2011-09-10 08:00:10 +00:00
|
|
|
break;
|
|
|
|
case 'resolved':
|
2013-04-17 08:00:58 +00:00
|
|
|
$ViewString = 'Resolved';
|
2013-07-02 08:01:37 +00:00
|
|
|
$WhereCondition = "
|
|
|
|
WHERE (Level <= $UserLevel OR AssignedToUser = '".$LoggedUser['ID']."')
|
|
|
|
AND Status = 'Resolved'";
|
2012-02-07 08:00:20 +00:00
|
|
|
$SortStr = '';
|
2011-09-10 08:00:10 +00:00
|
|
|
break;
|
|
|
|
case 'my':
|
2013-08-28 23:08:41 +00:00
|
|
|
$ViewString = 'Your Unanswered';
|
2013-07-02 08:01:37 +00:00
|
|
|
$WhereCondition = "
|
|
|
|
WHERE (Level = $UserLevel OR AssignedToUser = '".$LoggedUser['ID']."')
|
|
|
|
AND Status = 'Unanswered'";
|
2011-09-10 08:00:10 +00:00
|
|
|
break;
|
|
|
|
default:
|
2012-02-20 08:00:22 +00:00
|
|
|
if ($UserLevel >= 700) {
|
2013-08-28 23:08:41 +00:00
|
|
|
$ViewString = 'Your Unanswered';
|
2013-07-02 08:01:37 +00:00
|
|
|
$WhereCondition = "
|
|
|
|
WHERE (
|
|
|
|
(Level >= ".max($Classes[MOD]['Level'], 700)." AND Level <= $UserLevel)
|
|
|
|
OR AssignedToUser = '".$LoggedUser['ID']."'
|
|
|
|
)
|
|
|
|
AND Status = 'Unanswered'";
|
2012-02-21 08:00:18 +00:00
|
|
|
} elseif ($UserLevel == 650) {
|
|
|
|
// Forum Mods
|
2013-08-28 23:08:41 +00:00
|
|
|
$ViewString = 'Your Unanswered';
|
2013-07-02 08:01:37 +00:00
|
|
|
$WhereCondition = "
|
|
|
|
WHERE (Level = $UserLevel OR AssignedToUser = '".$LoggedUser['ID']."')
|
|
|
|
AND Status = 'Unanswered'";
|
2011-09-10 08:00:10 +00:00
|
|
|
} else {
|
2012-02-21 08:00:18 +00:00
|
|
|
// FLS
|
2013-04-17 08:00:58 +00:00
|
|
|
$ViewString = 'Unanswered';
|
2013-07-02 08:01:37 +00:00
|
|
|
$WhereCondition = "
|
|
|
|
WHERE (Level <= $UserLevel OR AssignedToUser = '".$LoggedUser['ID']."')
|
|
|
|
AND Status = 'Unanswered'";
|
2011-09-10 08:00:10 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-05-28 08:01:02 +00:00
|
|
|
list($Page, $Limit) = Format::page_limit(MESSAGES_PER_PAGE);
|
2011-09-10 08:00:10 +00:00
|
|
|
// Get messages
|
|
|
|
$StaffPMs = $DB->query("
|
|
|
|
SELECT
|
|
|
|
SQL_CALC_FOUND_ROWS
|
|
|
|
ID,
|
|
|
|
Subject,
|
|
|
|
UserID,
|
|
|
|
Status,
|
|
|
|
Level,
|
|
|
|
AssignedToUser,
|
|
|
|
Date,
|
|
|
|
Unread,
|
|
|
|
ResolverID
|
|
|
|
FROM staff_pm_conversations
|
|
|
|
$WhereCondition
|
2012-02-07 08:00:20 +00:00
|
|
|
ORDER BY $SortStr Level DESC, Date DESC
|
2011-09-10 08:00:10 +00:00
|
|
|
LIMIT $Limit
|
|
|
|
");
|
|
|
|
|
|
|
|
$DB->query('SELECT FOUND_ROWS()');
|
|
|
|
list($NumResults) = $DB->next_record();
|
|
|
|
$DB->set_query_id($StaffPMs);
|
|
|
|
|
2012-10-11 08:00:15 +00:00
|
|
|
$CurURL = Format::get_url();
|
2013-04-17 08:00:58 +00:00
|
|
|
if (empty($CurURL)) {
|
|
|
|
$CurURL = 'staffpm.php?';
|
2011-09-10 08:00:10 +00:00
|
|
|
} else {
|
2013-08-28 23:08:41 +00:00
|
|
|
$CurURL = "staffpm.php?$CurURL&";
|
2011-09-10 08:00:10 +00:00
|
|
|
}
|
2013-05-15 08:00:54 +00:00
|
|
|
$Pages = Format::get_pages($Page, $NumResults, MESSAGES_PER_PAGE, 9);
|
2011-09-10 08:00:10 +00:00
|
|
|
|
|
|
|
$Row = 'a';
|
|
|
|
|
|
|
|
// Start page
|
|
|
|
?>
|
|
|
|
<div class="thin">
|
2012-08-19 08:00:19 +00:00
|
|
|
<div class="header">
|
|
|
|
<h2><?=$ViewString?> Staff PMs</h2>
|
|
|
|
<div class="linkbox">
|
2013-04-17 08:00:58 +00:00
|
|
|
<? if ($IsStaff) { ?>
|
2013-08-28 23:08:41 +00:00
|
|
|
<a href="staffpm.php" class="brackets">View your unanswered</a>
|
2011-09-10 08:00:10 +00:00
|
|
|
<? } ?>
|
2013-08-28 23:08:41 +00:00
|
|
|
<a href="staffpm.php?view=unanswered" class="brackets">View all unanswered</a>
|
|
|
|
<a href="staffpm.php?view=open" class="brackets">View unresolved</a>
|
|
|
|
<a href="staffpm.php?view=resolved" class="brackets">View resolved</a>
|
2012-12-07 08:00:19 +00:00
|
|
|
<? if ($IsStaff) { ?>
|
2013-08-28 23:08:41 +00:00
|
|
|
<a href="staffpm.php?action=scoreboard" class="brackets">View scoreboard</a>
|
2012-12-07 08:00:19 +00:00
|
|
|
<? } ?>
|
2012-08-19 08:00:19 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<div class="linkbox">
|
2011-09-10 08:00:10 +00:00
|
|
|
<?=$Pages?>
|
|
|
|
</div>
|
|
|
|
<div class="box pad" id="inbox">
|
|
|
|
<?
|
|
|
|
|
2013-08-28 23:08:41 +00:00
|
|
|
if (!$DB->has_results()) {
|
2011-09-10 08:00:10 +00:00
|
|
|
// No messages
|
|
|
|
?>
|
|
|
|
<h2>No messages</h2>
|
|
|
|
<?
|
|
|
|
|
2013-08-28 23:08:41 +00:00
|
|
|
} else {
|
2011-09-10 08:00:10 +00:00
|
|
|
// Messages, draw table
|
|
|
|
if ($ViewString != 'Resolved' && $IsStaff) {
|
|
|
|
// Open multiresolve form
|
|
|
|
?>
|
2012-09-15 08:00:25 +00:00
|
|
|
<form class="manage_form" name="staff_messages" method="post" action="staffpm.php" id="messageform">
|
2011-09-10 08:00:10 +00:00
|
|
|
<input type="hidden" name="action" value="multiresolve" />
|
|
|
|
<input type="hidden" name="view" value="<?=strtolower($View)?>" />
|
|
|
|
<?
|
|
|
|
}
|
|
|
|
|
|
|
|
// Table head
|
|
|
|
?>
|
2013-04-17 08:00:58 +00:00
|
|
|
<table class="message_table<?=($ViewString != 'Resolved' && $IsStaff) ? ' checkboxes' : '' ?>">
|
2011-09-10 08:00:10 +00:00
|
|
|
<tr class="colhead">
|
2013-08-28 23:08:41 +00:00
|
|
|
<? if ($ViewString != 'Resolved' && $IsStaff) { ?>
|
|
|
|
<td width="10"><input type="checkbox" onclick="toggleChecks('messageform', this);" /></td>
|
|
|
|
<? } ?>
|
2011-09-10 08:00:10 +00:00
|
|
|
<td width="50%">Subject</td>
|
|
|
|
<td>Sender</td>
|
|
|
|
<td>Date</td>
|
|
|
|
<td>Assigned to</td>
|
2013-08-28 23:08:41 +00:00
|
|
|
<? if ($ViewString == 'Resolved') { ?>
|
2011-09-10 08:00:10 +00:00
|
|
|
<td>Resolved by</td>
|
2013-08-28 23:08:41 +00:00
|
|
|
<? } ?>
|
2011-09-10 08:00:10 +00:00
|
|
|
</tr>
|
|
|
|
<?
|
|
|
|
|
|
|
|
// List messages
|
2013-08-28 23:08:41 +00:00
|
|
|
while (list($ID, $Subject, $UserID, $Status, $Level, $AssignedToUser, $Date, $Unread, $ResolverID) = $DB->next_record()) {
|
|
|
|
$Row = $Row === 'a' ? 'b' : 'a';
|
|
|
|
$RowClass = "row$Row";
|
2011-09-10 08:00:10 +00:00
|
|
|
|
2012-10-11 08:00:15 +00:00
|
|
|
//$UserInfo = Users::user_info($UserID);
|
|
|
|
$UserStr = Users::format_username($UserID, true, true, true, true);
|
2011-09-10 08:00:10 +00:00
|
|
|
|
|
|
|
// Get assigned
|
|
|
|
if ($AssignedToUser == '') {
|
|
|
|
// Assigned to class
|
2013-04-17 08:00:58 +00:00
|
|
|
$Assigned = ($Level == 0) ? 'First Line Support' : $ClassLevels[$Level]['Name'];
|
2011-09-10 08:00:10 +00:00
|
|
|
// No + on Sysops
|
2013-07-02 08:01:37 +00:00
|
|
|
if ($Assigned != 'Sysop') {
|
|
|
|
$Assigned .= '+';
|
|
|
|
}
|
2011-09-10 08:00:10 +00:00
|
|
|
|
|
|
|
} else {
|
|
|
|
// Assigned to user
|
2012-10-11 08:00:15 +00:00
|
|
|
// $UserInfo = Users::user_info($AssignedToUser);
|
|
|
|
$Assigned = Users::format_username($AssignedToUser, true, true, true, true);
|
2011-09-10 08:00:10 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get resolver
|
|
|
|
if ($ViewString == 'Resolved') {
|
2012-10-11 08:00:15 +00:00
|
|
|
//$UserInfo = Users::user_info($ResolverID);
|
|
|
|
$ResolverStr = Users::format_username($ResolverID, true, true, true, true);
|
2011-09-10 08:00:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Table row
|
|
|
|
?>
|
|
|
|
<tr class="<?=$RowClass?>">
|
2013-08-28 23:08:41 +00:00
|
|
|
<? if ($ViewString != 'Resolved' && $IsStaff) { ?>
|
2011-09-10 08:00:10 +00:00
|
|
|
<td class="center"><input type="checkbox" name="id[]" value="<?=$ID?>" /></td>
|
2013-08-28 23:08:41 +00:00
|
|
|
<? } ?>
|
2011-09-10 08:00:10 +00:00
|
|
|
<td><a href="staffpm.php?action=viewconv&id=<?=$ID?>"><?=display_str($Subject)?></a></td>
|
|
|
|
<td><?=$UserStr?></td>
|
|
|
|
<td><?=time_diff($Date, 2, true)?></td>
|
|
|
|
<td><?=$Assigned?></td>
|
2013-08-28 23:08:41 +00:00
|
|
|
<? if ($ViewString == 'Resolved') { ?>
|
2011-09-10 08:00:10 +00:00
|
|
|
<td><?=$ResolverStr?></td>
|
2013-08-28 23:08:41 +00:00
|
|
|
<? } ?>
|
2011-09-10 08:00:10 +00:00
|
|
|
</tr>
|
|
|
|
<?
|
|
|
|
|
|
|
|
$DB->set_query_id($StaffPMs);
|
2013-08-28 23:08:41 +00:00
|
|
|
} //while
|
2011-09-10 08:00:10 +00:00
|
|
|
|
|
|
|
// Close table and multiresolve form
|
|
|
|
?>
|
|
|
|
</table>
|
2012-09-15 08:00:25 +00:00
|
|
|
<? if ($ViewString != 'Resolved' && $IsStaff) { ?>
|
2013-08-28 23:08:41 +00:00
|
|
|
<div class="submit_div">
|
|
|
|
<input type="submit" value="Resolve selected" />
|
|
|
|
</div>
|
2011-09-10 08:00:10 +00:00
|
|
|
</form>
|
|
|
|
<?
|
2012-09-15 08:00:25 +00:00
|
|
|
}
|
2013-08-28 23:08:41 +00:00
|
|
|
} //if (!$DB->has_results())
|
2011-09-10 08:00:10 +00:00
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
<div class="linkbox">
|
|
|
|
<?=$Pages?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?
|
|
|
|
|
2012-10-11 08:00:15 +00:00
|
|
|
View::show_footer();
|
2011-09-10 08:00:10 +00:00
|
|
|
|
|
|
|
?>
|