if(CModule::IncludeModule('iblock'))
{
$res = CIBlockElement::GetList(
array("SHOW_COUNTER"=>"DESC"), // сортировка по количеству просмотров;
array("IBLOCK_ID"=>1," ACTIVE"=>"Y"), //Получаем активные элементы , в данном случае из инфоблока с ID = 1;
false,
array("nTopCount"=>5), //ограничиваем количество элементов - только 5.
array("NAME","PREVIEW_PICTURE", "DETAIL_PAGE_URL")// Выбираем только указанные поля
);
while($ar = $res->GetNext())
{
$arTheBest[]=$ar; //массив с данными 5 самых просматриваемых элементов инфоблока
}
}
\Bitrix\Main\Loader::includeModule('crm');
$rs = Bitrix\Crm\Timeline\Entity\TimelineTable::getList(array(
'order' => array("ID" => "DESC"),
'filter' => array('=TYPE_ID' => 7),
'select'=>array("ID", "BINDINGS")
));
while($ar = $rs->Fetch())
{
echo '<pre>';
print_r($ar);
echo '</pre>';
}
Array
(
[ID] => 1537
[CRM_TIMELINE_ENTITY_TIMELINE_BINDINGS_OWNER_ID] => 1537
[CRM_TIMELINE_ENTITY_TIMELINE_BINDINGS_ENTITY_TYPE_ID] => 1
[CRM_TIMELINE_ENTITY_TIMELINE_BINDINGS_ENTITY_ID] => 134
[CRM_TIMELINE_ENTITY_TIMELINE_BINDINGS_IS_FIXED] =>
)
$rs = Bitrix\Crm\Timeline\Entity\TimelineTable::getList(array(
'order' => array("ID" => "DESC"),
'filter' => array('=TYPE_ID' => 7)
));
while($ar = $rs->Fetch())
{
echo '<pre>';
print_r($ar);
echo '</pre>';
}
Array
(
[ID] => 263472
[TYPE_ID] => 7
[TYPE_CATEGORY_ID] => 0
[CREATED] => Bitrix\Main\Type\DateTime Object
(
[value:protected] => DateTime Object
(
[date] => 2019-03-18 15:26:16.000000
[timezone_type] => 3
[timezone] => Europe/Moscow
)
)
[AUTHOR_ID] => 14
[ASSOCIATED_ENTITY_ID] => 0
[ASSOCIATED_ENTITY_TYPE_ID] => 0
[COMMENT] => повторное обращение
[SETTINGS] => Array
(
[HAS_FILES] => N
)
)
//Устанавливаем дело-звонок и напоминание для сделки
$arFieldsDelo = array(
'TYPE_ID' => CCrmActivityType::Call,
'PROVIDER_ID' => 'VOXIMPLANT_CALL',
'ASSOCIATED_ENTITY_ID' => $_GET['deal'],
'SUBJECT' => "Тема",
'COMPLETED' => 'N',
'RESPONSIBLE_ID' => "ID отвественного",
'NOTIFY_TYPE' => \CCrmActivityNotifyType::Min,
'NOTIFY_VALUE' => 20,
'DESCRIPTION' => "Описание",
'START_TIME' => $_GET['datetime'],
'END_TIME' => $_GET['datetime'],
'PRIORITY' => CCrmActivityPriority::Medium,
'AUTHOR_ID' => $_GET['assigned'],
'ORIGIN_ID' => 'XYZ_1',
'DIRECTION' => CCrmActivityDirection::Outgoing,
'OWNER_ID' => $_GET['deal'],
'OWNER_TYPE_ID' => CCrmOwnerType::Deal,
);
$arComms = array(
array(
'ID' => 0,
'TYPE' => 'PHONE',
'VALUE' => $_GET['contactTel'],
'ENTITY_ID' => $_GET['deal'],
'ENTITY_TYPE_ID' => 'DEAL'
)
);
$ID = CCrmActivity::Add($arFieldsDelo, false, true, array('REGISTER_SONET_EVENT' => false));
if($ID > 0)
{
//сохраняем дело в календарь
CCrmActivity::SaveCommunications($ID, $arComms, $arFieldsDelo, true, false);
}
}
/tasks.task.update?taskId=3564&fields[TAGS][]=тег1&fields[TAGS][]=тег2