* @license MIT * @link http://retailcrm.ru * @see http://retailcrm.ru/docs */ /** * Class RetailCrmCollector * * @category RetailCRM * @package RetailCRM\Collector */ class RetailCrmCollector { public static $MODULE_ID = 'intaro.retailcrm'; public static $CRM_COLL_KEY = 'coll_key'; public static $CRM_COLL = 'collector'; /** * Add Daemon Collector script * * @return bool */ public static function add() { $keys = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_COLL_KEY, 0)); $collector = COption::GetOptionString(self::$MODULE_ID, self::$CRM_COLL, 0); $request = \Bitrix\Main\Context::getCurrent()->getRequest(); if ($collector === 'Y' && !empty($keys[SITE_ID]) && $request->isAdminSection() !== true) { global $USER; $params = array(); if ($USER->IsAuthorized()) { $params['customerId'] = $USER->GetID(); } $str = ""; \Bitrix\Main\Page\Asset::getInstance()->addString($str, true); return true; } else { return false; } } }