コード例 #1
0
ファイル: postingmanager.php プロジェクト: nycmic/bittest
	/**
	 * @param $recipientId
	 * @param $url
	 * @throws \Bitrix\Main\ArgumentException
	 */
	public static function click($recipientId, $url)
	{

		$postingContactPrimary = array('ID' => $recipientId);
		$recipient = PostingRecipientTable::getRowById($postingContactPrimary);
		if ($recipient && $recipient['ID'])
		{
			$read = PostingReadTable::getRowById(array(
				'POSTING_ID' => $recipient['POSTING_ID'],
				'RECIPIENT_ID' => $recipient['ID']
			));
			if ($read === null)
			{
				static::read($recipientId);
			}

			$postingDb = PostingTable::getList(array(
				'select' => array('ID'),
				'filter' => array('ID' => $recipient['POSTING_ID']),
			));
			if ($postingDb->fetch())
			{
				$fixedUrl = str_replace(
					array(
						'&bx_sender_conversion_id=' . $recipient['ID'],
						'?bx_sender_conversion_id=' . $recipient['ID']
					),
					array('', ''),
					$url
				);
				$addClickDb = PostingClickTable::add(array(
					'POSTING_ID' => $recipient['POSTING_ID'],
					'RECIPIENT_ID' => $recipient['ID'],
					'URL' => $fixedUrl
				));
				if($addClickDb->isSuccess())
				{
					// send event
					$eventData = array(
						'URL' => $url,
						'URL_FIXED' => $fixedUrl,
						'CLICK_ID' => $addClickDb->getId(),
						'RECIPIENT' => $recipient
					);
					$event = new Event('sender', 'OnAfterRecipientClick', array($eventData));
					$event->send();
				}
			}
		}
	}
コード例 #2
0
ファイル: postingmanager.php プロジェクト: akniyev/arteva.ru
 /**
  * @param $recipientId
  * @param $url
  * @throws \Bitrix\Main\ArgumentException
  */
 public static function click($recipientId, $url)
 {
     $postingContactPrimary = array('ID' => $recipientId);
     $arPostingEmail = PostingRecipientTable::getRowById($postingContactPrimary);
     if ($arPostingEmail && $arPostingEmail['ID']) {
         $arPostingRead = PostingReadTable::getRowById(array('POSTING_ID' => $arPostingEmail['POSTING_ID'], 'RECIPIENT_ID' => $arPostingEmail['ID']));
         if ($arPostingRead === null) {
             static::read($recipientId);
         }
         $postingDb = PostingTable::getList(array('select' => array('ID'), 'filter' => array('ID' => $arPostingEmail['POSTING_ID'], 'MAILING.TRACK_CLICK' => 'Y')));
         if ($postingDb->fetch()) {
             PostingClickTable::add(array('POSTING_ID' => $arPostingEmail['POSTING_ID'], 'RECIPIENT_ID' => $arPostingEmail['ID'], 'URL' => $url));
         }
     }
 }
コード例 #3
0
ファイル: posting.php プロジェクト: akniyev/arteva.ru
 /**
  * @param $ar
  * @param bool $checkDuplicate
  */
 public static function addRecipient($ar, $checkDuplicate = false)
 {
     $ar['EMAIL'] = trim(strtolower($ar['EMAIL']));
     if (!$checkDuplicate) {
         $needAdd = true;
     } else {
         if (!PostingRecipientTable::getRowById(array('EMAIL' => $ar['EMAIL'], 'POSTING_ID' => $ar['POSTING_ID']))) {
             $needAdd = true;
         } else {
             $needAdd = false;
         }
     }
     if ($needAdd) {
         PostingRecipientTable::add($ar);
     }
 }
コード例 #4
0
ファイル: postingmanager.php プロジェクト: Hawkart/megatv
 /**
  * Do click actions
  *
  * @param $recipientId
  * @param $url
  * @return void
  * @throws \Bitrix\Main\ArgumentException
  */
 public static function click($recipientId, $url)
 {
     $postingContactPrimary = array('ID' => $recipientId);
     $recipient = PostingRecipientTable::getRowById($postingContactPrimary);
     if ($recipient && $recipient['ID']) {
         $read = PostingReadTable::getRowById(array('POSTING_ID' => $recipient['POSTING_ID'], 'RECIPIENT_ID' => $recipient['ID']));
         if ($read === null) {
             static::read($recipientId);
         }
         $postingDb = PostingTable::getList(array('select' => array('ID'), 'filter' => array('ID' => $recipient['POSTING_ID'])));
         if ($postingDb->fetch()) {
             $uri = new \Bitrix\Main\Web\Uri($url);
             $fixedUrl = $uri->deleteParams(array('bx_sender_conversion_id'))->getLocator();
             $addClickDb = PostingClickTable::add(array('POSTING_ID' => $recipient['POSTING_ID'], 'RECIPIENT_ID' => $recipient['ID'], 'URL' => $fixedUrl));
             if ($addClickDb->isSuccess()) {
                 // send event
                 $eventData = array('URL' => $url, 'URL_FIXED' => $fixedUrl, 'CLICK_ID' => $addClickDb->getId(), 'RECIPIENT' => $recipient);
                 $event = new Event('sender', 'OnAfterRecipientClick', array($eventData));
                 $event->send();
             }
         }
     }
 }