View::show_header('Staff Inbox'); $View = display_str($_GET['view']); $UserLevel = $LoggedUser['EffectiveClass']; // Setup for current view mode $SortStr = "IF(AssignedToUser = ".$LoggedUser['ID'].",0,1) ASC, "; switch ($View) { case 'unanswered': $ViewString = "Unanswered"; $WhereCondition = "WHERE (Level <= $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Unanswered'"; break; case 'open': $ViewString = "All open"; $WhereCondition = "WHERE (Level <= $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status IN ('Open', 'Unanswered')"; $SortStr = ''; break; case 'resolved': $ViewString = "Resolved"; $WhereCondition = "WHERE (Level <= $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Resolved'"; $SortStr = ''; break; case 'my': $ViewString = "My unanswered"; $WhereCondition = "WHERE (Level = $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Unanswered'"; break; default: if ($UserLevel >= 700) { $ViewString = "My unanswered"; $WhereCondition = "WHERE ((Level >= ".max($Classes[MOD]['Level'],700)." AND Level <= $UserLevel) OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Unanswered'"; } elseif ($UserLevel == 650) { // Forum Mods $ViewString = "My Unanswered"; $WhereCondition = "WHERE (Level = $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Unanswered'"; } else { // FLS $ViewString = "Unanswered"; $WhereCondition = "WHERE (Level <= $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Unanswered'"; } break; } list($Page,$Limit) = Format::page_limit(MESSAGES_PER_PAGE); // Get messages $StaffPMs = $DB->query(" SELECT SQL_CALC_FOUND_ROWS ID, Subject, UserID, Status, Level, AssignedToUser, Date, Unread, ResolverID FROM staff_pm_conversations $WhereCondition ORDER BY $SortStr Level DESC, Date DESC LIMIT $Limit "); $DB->query('SELECT FOUND_ROWS()'); list($NumResults) = $DB->next_record(); $DB->set_query_id($StaffPMs); $CurURL = Format::get_url(); if(empty($CurURL)) { $CurURL = "staffpm.php?"; } else { $CurURL = "staffpm.php?".$CurURL."&"; } $Pages=Format::get_pages($Page,$NumResults,MESSAGES_PER_PAGE,9); $Row = 'a'; // Start page ?>