/** * Lists all the currently closed tickets * @param WebPage $oP The current web page * @return void */ function ListClosedTickets(WebPage $oP) { $aAttSpecs = explode(',', PORTAL_TICKETS_SEARCH_CRITERIA); // Remove the caller_id form the search criteria if the user is not a Portal Power User // since the user is only allowed to see her/his own tickets foreach ($aAttSpecs as $idx => $sAttCode) { if ($sAttCode == 'caller_id' && !IsPowerUser()) { unset($aAttSpecs[$idx]); } } $aClasses = GetTicketClasses(); $sMainClass = reset($aClasses); $oP->DisplaySearchForm($sMainClass, $aAttSpecs, array('operation' => 'show_closed'), 'search_', false); $oUserOrg = GetUserOrg(); $oP->add("<h1>" . Dict::S('Portal:ClosedRequests') . "</h1>\n"); $aClassToSet = array(); foreach (GetTicketClasses() as $sClass) { $oSearch = $oP->PostedParamsToFilter($sClass, $aAttSpecs, 'search_'); if (is_null($oSearch)) { $oSearch = new DBObjectSearch($sClass); } $oSearch->AddCondition('org_id', $oUserOrg->GetKey()); $oSearch->AddCondition('status', 'closed'); $iUser = UserRights::GetContactId(); if ($iUser > 0 && !IsPowerUser()) { $oSearch->AddCondition('caller_id', $iUser); } $aClassToSet[$sClass] = new CMDBObjectSet($oSearch); } DisplayRequestLists($oP, $aClassToSet); }