Example #1
0
                unset($itemComm);
                if (!$isFound) {
                    $items[$commKey]['COMMUNICATIONS'][] = array('TYPE' => $comm['TYPE'], 'VALUE' => $comm['VALUE']);
                }
            }
        }
        unset($comm);
    }
}
foreach ($imageless as $typeName => &$ids) {
    if ($typeName === CCrmOwnerType::ContactName) {
        $dbRes = CCrmContact::GetListEx(array(), array('@ID' => $ids), false, false, array('ID', 'PHOTO'));
        while ($contact = $dbRes->Fetch()) {
            $key = "CONTACT_{$contact['ID']}";
            if (isset($items[$key])) {
                $items[$key]['IMAGE_URL'] = CCrmMobileHelper::PrepareContactImageUrl($contact, array('WIDTH' => 40, 'HEIGHT' => 40));
            }
        }
    } elseif ($typeName === CCrmOwnerType::CompanyName) {
        $dbRes = CCrmCompany::GetListEx(array(), array('@ID' => $ids), false, false, array('ID', 'LOGO'));
        while ($company = $dbRes->Fetch()) {
            $key = "COMPANY_{$company['ID']}";
            if (isset($items[$key])) {
                $items[$key]['IMAGE_URL'] = CCrmMobileHelper::PrepareCompanyImageUrl($company, array('WIDTH' => 40, 'HEIGHT' => 40));
            }
        }
    } elseif ($typeName === CCrmOwnerType::LeadName) {
        foreach ($ids as $id) {
            $key = "LEAD_{$id}";
            if (isset($items[$key])) {
                $items[$key]['IMAGE_URL'] = CCrmMobileHelper::GetLeadListImageStub();