show_header('Staff Inbox'); $View = display_str($_GET['view']); $UserLevel = $LoggedUser['Class']; // Setup for current view mode 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')"; break; case 'resolved': $ViewString = "Resolved"; $WhereCondition = "WHERE (Level <= $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Resolved'"; break; case 'my': $ViewString = "My unanswered"; $WhereCondition = "WHERE (Level = $UserLevel OR AssignedToUser='".$LoggedUser['ID']."') AND Status='Unanswered'"; break; default: if ($IsStaff) { $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) = 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 Date DESC LIMIT $Limit "); $DB->query('SELECT FOUND_ROWS()'); list($NumResults) = $DB->next_record(); $DB->set_query_id($StaffPMs); $CurURL = get_url(); if(empty($CurURL)) { $CurURL = "staffpm.php?"; } else { $CurURL = "staffpm.php?".$CurURL."&"; } $Pages=get_pages($Page,$NumResults,MESSAGES_PER_PAGE,9); $Row = 'a'; // Start page ?>