/** * Helper to display lists (UserRequest, Incident, etc.) * Adjust the presentation depending on the following cases: * - no item at all * - items of one class only * - items of several classes */ function DisplayRequestLists(WebPage $oP, $aClassToSet) { $iNotEmpty = 0; // Count of types for which there are some items to display foreach ($aClassToSet as $sClass => $oSet) { if ($oSet->Count() > 0) { $iNotEmpty++; } } if ($iNotEmpty == 0) { $oP->p(Dict::S('Portal:NoOpenRequest')); } else { foreach ($aClassToSet as $sClass => $oSet) { if ($iNotEmpty > 1) { // Differentiate the sublists $oP->add("<h2>" . MetaModel::GetName($sClass) . "</h2>\n"); } if ($oSet->Count() > 0) { $sZList = GetConstant($sClass, 'LIST_ZLIST'); $aZList = explode(',', $sZList); $oP->DisplaySet($oSet, $aZList, Dict::S('Portal:NoOpenRequest')); } } } }