public static function onGetAttributeTypes() { return array('sender_chain_source' => array('MODULE' => 'sender', 'GROUP' => 'source', 'NAME' => Loc::getMessage('sender_conversion_chain_source'), 'SORT' => 5100, 'SPLIT_BY' => 'sender_chain_source', 'BG_COLOR' => '#cf4343', 'GET_VALUES' => function (array $list) { $itemList = array(); $filter = array(); if ($list) { $filter['=POSTING.MAILING_CHAIN.ID'] = $list; } $itemDb = PostingClickTable::getList(array('select' => array('MAILING_CHAIN_ID' => 'POSTING.MAILING_CHAIN.ID', 'MAILING_CHAIN_SUBJECT' => 'POSTING.MAILING_CHAIN.SUBJECT'), 'filter' => $filter, 'group' => array('MAILING_CHAIN_ID', 'MAILING_CHAIN_SUBJECT'))); while ($item = $itemDb->fetch()) { if (strlen($item['MAILING_CHAIN_SUBJECT']) <= 0) { continue; } $itemList[$item['MAILING_CHAIN_ID']] = array('NAME' => $item['MAILING_CHAIN_SUBJECT']); } return $itemList; })); }
} } // get statistic by last posting if (!empty($arPosting)) { $statResult['all'] = $arPosting['STATUS'] != \Bitrix\Sender\PostingTable::STATUS_ABORT ? $arPosting['COUNT_SEND_ALL'] : 0; $statResult['delivered'] = $arPosting['COUNT_SEND_SUCCESS']; $statResult['not_send'] = $arPosting['COUNT_SEND_NONE']; $statResult['error'] = $arPosting['COUNT_SEND_ERROR']; $statResult['read'] = $arPosting['COUNT_READ']; $statResult['click'] = $arPosting['COUNT_CLICK']; $statResult['unsub'] = $arPosting['COUNT_UNSUB']; $statResult['all_print'] = $statResult['all']; } // get url clicking statistic if (!empty($arPosting)) { $statClickDb = \Bitrix\Sender\PostingClickTable::getList(array('select' => array('URL', 'CNT'), 'filter' => array('POSTING_ID' => $arPosting['ID']), 'runtime' => array(new \Bitrix\Main\Entity\ExpressionField('CNT', 'COUNT(%s)', 'ID')), 'group' => array('URL'), 'order' => array('CNT' => 'DESC'), 'limit' => 15)); while ($statClick = $statClickDb->fetch()) { $statClickList[] = $statClick; } } } $strError = ""; if (empty($arPosting)) { $strError = GetMessage("sender_stat_error_no_data"); } $lAdmin->BeginCustomContent(); if (!empty($strError)) { CAdminMessage::ShowMessage($strError); } else { if (intval($statResult['all']) <= 0) { $statResult['all'] = 1;
public static function updateRecipientReadCounters($type) { $params = array('select' => array('RECIPIENT_ID'), 'runtime' => array(new \Bitrix\Main\Entity\ReferenceField('UPDATE_RECIPIENT', 'Bitrix\\Sender\\PostingRecipientTable', array('=this.RECIPIENT_ID' => 'ref.ID'))), 'filter' => array('!UPDATE_RECIPIENT.ID' => null, '=UPDATE_RECIPIENT.IS_' . $type => 'N'), 'group' => array('RECIPIENT_ID')); $dataDb = null; switch ($type) { case 'READ': $dataDb = \Bitrix\Sender\PostingReadTable::getList($params); break; case 'CLICK': $dataDb = \Bitrix\Sender\PostingClickTable::getList($params); break; case 'UNSUB': $dataDb = \Bitrix\Sender\PostingUnsubTable::getList($params); break; } if (!$dataDb) { return false; } while ($item = $dataDb->fetch()) { if (self::isTimeUp()) { return true; } \Bitrix\Sender\PostingRecipientTable::update(array('ID' => $item['RECIPIENT_ID']), array('IS_' . $type => 'Y')); } return false; }