Ejemplo n.º 1
0
$arResult['CURRENCY_LIST'] = CCrmCurrencyHelper::PrepareListItems();
$arResult['FILTER'] = array();
$arResult['GRID_ID'] = 'CRM_DEAL_FUNNEL';
if (!$bInternal) {
    $arResult['FILTER2LOGIC'] = array();
    ob_start();
    $GLOBALS['APPLICATION']->IncludeComponent('bitrix:crm.entity.selector', '', array('ENTITY_TYPE' => 'CONTACT', 'INPUT_NAME' => 'CONTACT_ID', 'INPUT_VALUE' => isset($_REQUEST['CONTACT_ID']) ? intval($_REQUEST['CONTACT_ID']) : '', 'FORM_NAME' => $arResult['GRID_ID'], 'MULTIPLE' => 'N', 'FILTER' => true), false, array('HIDE_ICONS' => 'Y'));
    $sValContact = ob_get_contents();
    ob_end_clean();
    ob_start();
    $GLOBALS['APPLICATION']->IncludeComponent('bitrix:crm.entity.selector', '', array('ENTITY_TYPE' => 'COMPANY', 'INPUT_NAME' => 'COMPANY_ID', 'INPUT_VALUE' => isset($_REQUEST['COMPANY_ID']) ? intval($_REQUEST['COMPANY_ID']) : '', 'FORM_NAME' => $arResult['GRID_ID'], 'MULTIPLE' => 'N', 'FILTER' => true), false, array('HIDE_ICONS' => 'Y'));
    $sValCompany = ob_get_contents();
    ob_end_clean();
    $arResult['FILTER'] = array(array('id' => 'OPPORTUNITY', 'name' => GetMessage('CRM_COLUMN_OPPORTUNITY'), 'type' => 'number'), array('id' => 'CURRENCY_ID', 'name' => GetMessage('CRM_COLUMN_CURRENCY_ID'), 'type' => 'list', 'items' => array('' => '') + CCrmCurrencyHelper::PrepareListItems()), array('id' => 'PROBABILITY', 'name' => GetMessage('CRM_COLUMN_PROBABILITY'), 'type' => 'number'), array('id' => 'CLOSED', 'name' => GetMessage('CRM_COLUMN_CLOSED'), 'type' => 'list', 'items' => array('' => '', 'Y' => GetMessage('MAIN_YES'), 'N' => GetMessage('MAIN_NO'))), array('id' => 'TYPE_ID', 'name' => GetMessage('CRM_COLUMN_TYPE_ID'), 'default' => 'Y', 'type' => 'list', 'items' => array('' => '') + CCrmStatus::GetStatusList('DEAL_TYPE')), array('id' => 'BEGINDATE', 'name' => GetMessage('CRM_COLUMN_BEGINDATE'), 'type' => 'date'), array('id' => 'CLOSEDATE', 'name' => GetMessage('CRM_COLUMN_CLOSEDATE'), 'type' => 'date'), array('id' => 'DATE_CREATE', 'name' => GetMessage('CRM_COLUMN_DATE_CREATE'), 'default' => 'Y', 'type' => 'date'), array('id' => 'DATE_MODIFY', 'name' => GetMessage('CRM_COLUMN_DATE_MODIFY'), 'default' => 'Y', 'type' => 'date'), array('id' => 'MODIFY_BY_ID', 'name' => GetMessage('CRM_COLUMN_MODIFY_BY'), 'enable_settings' => false, 'type' => 'user'), array('id' => 'ASSIGNED_BY_ID', 'name' => GetMessage('CRM_COLUMN_ASSIGNED_BY'), 'default' => 'Y', 'enable_settings' => false, 'type' => 'user'), array('id' => 'CONTACT_ID', 'name' => GetMessage('CRM_COLUMN_CONTACT_LIST'), 'type' => 'custom', 'value' => $sValContact), array('id' => 'COMPANY_ID', 'name' => GetMessage('CRM_COLUMN_COMPANY_LIST'), 'type' => 'custom', 'value' => $sValCompany));
    $CCrmUserType->ListAddFilterFields($arResult['FILTER'], $arResult['FILTER2LOGIC'], $arResult['GRID_ID']);
    $arResult['FILTER_PRESETS'] = array('filter_week' => array('name' => GetMessage('CRM_PRESET_WEEK'), 'fields' => array('DATE_MODIFY_datesel' => 'week')), 'filter_week_prev' => array('name' => GetMessage('CRM_PRESET_WEEK_PREV'), 'fields' => array('DATE_MODIFY_datesel' => 'week_ago')), 'filter_month' => array('name' => GetMessage('CRM_PRESET_MONTH'), 'fields' => array('DATE_MODIFY_datesel' => 'month')), 'filter_month_prev' => array('name' => GetMessage('CRM_PRESET_MONTH_PREV'), 'fields' => array('DATE_MODIFY_datesel' => 'month_ago')), 'filter_my_week' => array('name' => GetMessage('CRM_PRESET_MY_WEEK'), 'fields' => array('DATE_MODIFY_datesel' => 'week', "ASSIGNED_BY_ID" => __format_user4search(), "ASSIGNED_BY_ID[]" => $GLOBALS['USER']->GetID())), 'filter_my_week_ago' => array('name' => GetMessage('CRM_PRESET_MY_WEEK_AGO'), 'fields' => array('DATE_MODIFY_datesel' => 'week_ago', "ASSIGNED_BY_ID" => __format_user4search(), "ASSIGNED_BY_ID[]" => $GLOBALS['USER']->GetID())));
}
if ($arParams['USE_AMCHARTS']) {
    $arResult['HEADERS'] = array(array('id' => 'TITLE', 'name' => GetMessage('CRM_COLUMN_TITLE'), 'sort' => false, 'default' => true, 'editable' => false), array('id' => 'PROCENT', 'name' => GetMessage('CRM_COLUMN_PROCENT'), 'sort' => false, 'default' => true, 'editable' => false, 'align' => 'right'), array('id' => 'COUNT_FUNNEL', 'name' => GetMessage('CRM_COLUMN_COUNT'), 'sort' => false, 'default' => true, 'editable' => false, 'align' => 'right'));
} else {
    $arResult['HEADERS'] = array(array('id' => 'FUNNEL', 'name' => GetMessage('CRM_COLUMN_FUNNEL'), 'sort' => false, 'default' => false, 'editable' => false, 'align' => 'center'), array('id' => 'TITLE', 'name' => GetMessage('CRM_COLUMN_TITLE'), 'sort' => false, 'default' => true, 'editable' => false), array('id' => 'PROCENT', 'name' => GetMessage('CRM_COLUMN_PROCENT'), 'sort' => false, 'default' => true, 'editable' => false, 'align' => 'right'), array('id' => 'COUNT_FUNNEL', 'name' => GetMessage('CRM_COLUMN_COUNT'), 'sort' => false, 'default' => true, 'editable' => false, 'align' => 'right'));
}
$i = 0;
foreach ($arResult['CURRENCY_LIST'] as $k => $v) {
    $arResult['HEADERS'][] = array('id' => $k, 'name' => GetMessage('CRM_COLUMN_SUMM', array('#CURRENCY#' => htmlspecialcharsbx($v))), 'sort' => false, 'default' => $i == 0, 'editable' => false, 'align' => 'right');
    $i++;
}
$CGridOptions = new CCrmGridOptions($arResult['GRID_ID']);
if (isset($_REQUEST['clear_filter']) && $_REQUEST['clear_filter'] == 'Y') {
    $urlParams = array();
    foreach ($arResult['FILTER'] as $id => $arFilter) {
Ejemplo n.º 2
0
    foreach ($arResult['USER_FIELDS'] as $fieldCode => $field) {
        $arHeaders[] = array("id" => $fieldCode, "name" => htmlspecialcharsbx($field['EDIT_FORM_LABEL']), "sort" => false, "default" => false);
    }
}
$arPresets = array("filter_today" => array("name" => GetMessage("WD_PRESET_TODAY"), "fields" => array("timestamp_datesel" => "today")), "filter_yesterday" => array("name" => GetMessage("WD_PRESET_YESTERDAY"), "fields" => array("timestamp_datesel" => "yesterday")), "filter_my" => array("name" => GetMessage("WD_PRESET_MY"), "fields" => array("user_name" => __format_user4search(), "user[]" => $GLOBALS['USER']->GetID())), "filter_documents" => array("name" => GetMessage("WD_PRESET_DOCUMENTS"), "fields" => array("doctype" => "acf489b4")), "filter_images" => array("name" => GetMessage("WD_PRESET_IMAGES"), "fields" => array("doctype" => "5b53cf82")));
/********************************************************************
				Filter
********************************************************************/
for ($i = 0, $cnt = sizeof($arResult["FILTER"]); $i < $cnt; $i++) {
    if ($arResult["FILTER"][$i]["type"] === "user") {
        $userID = isset($_REQUEST[$arResult["FILTER"][$i]["id"]]) ? intval($_REQUEST[$arResult["FILTER"][$i]["id"]][0]) : 0;
        if ($userID === 0 || isset($_REQUEST["clear_filter"]) && $_REQUEST["clear_filter"] == "Y") {
            $userID = "";
            $userName = "";
        } else {
            $userName = __format_user4search($userID, $arParams["NAME_TEMPLATE"]);
        }
        ob_start();
        $APPLICATION->IncludeComponent("bitrix:intranet.user.selector.new", ".default", array("MULTIPLE" => "N", "NAME" => $arResult["FILTER"][$i]["id"], "VALUE" => $userID, "POPUP" => "Y", "ON_CHANGE" => "BXWDOnFilterAuthorSelect", "SITE_ID" => SITE_ID), $component, array("HIDE_ICONS" => "Y"));
        $val = ob_get_clean();
        $arResult["FILTER"][$i]["type"] = "custom";
        $val .= "\n\t\t\t<div id=\"wd_filter_author_name\"></div>\n\t\t\t<div id=\"user_selector_control\" >{$val}</div>\n\t\t\t<a href=\"javascript:void(0);\" class=\"webform-field-action-link\" onclick=\"BXWDFilterAuthorSelect(this);\">" . GetMessage('WD_SELECT_USER') . "</a>";
        $val .= <<<EOS
\t\t\t<script>
\t\t\t\tfunction BXWDFilterAuthorSelect(el)
\t\t\t\t{
\t\t\t\t\tfld = 'author';
\t\t\t\t\tif (!window['BXFilterAuthorSelector_' + fld])
\t\t\t\t\t{
\t\t\t\t\t\twindow['BXFilterAuthorSelector_' + fld] = BX.PopupWindowManager.create("filter-"+fld+"-popup", el, {
\t\t\t\t\t\t\toffsetTop : 1,
Ejemplo n.º 3
0
		BX.CDialog.btnCancel
	];
	d.ClearButtons();
	d.SetButtons(_BTN);
	d.Show();
}
</script>
<?php 
for ($i = 0, $ic = sizeof($arResult['FILTER']); $i < $ic; $i++) {
    if ($arResult['FILTER'][$i]['type'] === 'user') {
        $userID = isset($_REQUEST[$arResult['FILTER'][$i]['id']]) ? intval($_REQUEST[$arResult['FILTER'][$i]['id']][0]) : 0;
        if ($userID === 0 || isset($_REQUEST['clear_filter']) && $_REQUEST['clear_filter'] == 'Y') {
            $userID = '';
            $userName = '';
        } else {
            $userName = __format_user4search($userID);
        }
        ob_start();
        $APPLICATION->IncludeComponent('bitrix:intranet.user.selector', 'minimized', array('INPUT_NAME' => $arResult['FILTER'][$i]['id'], 'INPUT_NAME_STRING' => $arResult['FILTER'][$i]['id'] . '_name', 'INPUT_VALUE' => $userID, 'INPUT_VALUE_STRING' => htmlspecialcharsback($userName), 'EXTERNAL' => 'I', 'MULTIPLE' => 'N', 'NAME_TEMPLATE' => $arParams['NAME_TEMPLATE']), $component);
        $val = ob_get_clean();
        $arResult["FILTER"][$i]["type"] = "custom";
        $arResult['FILTER'][$i]['value'] = $val;
    }
}
$arResult['GRID_DATA'] = array();
foreach ($arResult['TASK'] as $sKey => $arTask) {
    $arActions = array();
    $arActions[] = array('ICONCLASS' => 'view', 'TITLE' => GetMessage('CRM_TASK_SHOW_TITLE'), 'TEXT' => GetMessage('CRM_TASK_SHOW'), 'ONCLICK' => "jsUtils.Redirect([], '" . CUtil::JSEscape($arTask['PATH_TO_TASK_SHOW']) . "');", 'DEFAULT' => true);
    $arActions[] = array('ICONCLASS' => 'edit', 'TITLE' => GetMessage('CRM_TASK_EDIT_TITLE'), 'TEXT' => GetMessage('CRM_TASK_EDIT'), 'ONCLICK' => "jsUtils.Redirect([], '" . CUtil::JSEscape($arTask['PATH_TO_TASK_EDIT']) . "');");
    $arActions[] = array('SEPARATOR' => true);
    $arActions[] = array('ICONCLASS' => 'delete', 'TITLE' => GetMessage('CRM_TASK_DELETE_TITLE'), 'TEXT' => GetMessage('CRM_TASK_DELETE'), 'ONCLICK' => "crm_activity_task_delete_grid('" . CUtil::JSEscape(GetMessage('CRM_TASK_DELETE_TITLE')) . "', '" . CUtil::JSEscape(GetMessage('CRM_TASK_DELETE_CONFIRM')) . "', '" . CUtil::JSEscape(GetMessage('CRM_TASK_DELETE')) . "', '" . CUtil::JSEscape($arTask['PATH_TO_TASK_DELETE']) . "')");
Ejemplo n.º 4
0
$arNavParams = array('nPageSize' => $arParams['ACTIVITY_TASK_COUNT']);
$arNavigation = CDBResult::GetNavParams($arNavParams);
global $APPLICATION;
$arResult['GRID_ID'] = 'CRM_ACTIVITY_TASK_LIST' . ($bInternal ? '_' . $arParams['GRID_ID_SUFFIX'] : '');
$arResult['STATUS_LIST'] = array(1 => GetMessage('TASKS_STATUS_1'), 2 => GetMessage('TASKS_STATUS_2'), 3 => GetMessage('TASKS_STATUS_3'), 4 => GetMessage('TASKS_STATUS_4'), 5 => GetMessage('TASKS_STATUS_5'), 6 => GetMessage('TASKS_STATUS_6'), 7 => GetMessage('TASKS_STATUS_7'));
$arResult['PRIORITY_LIST'] = array(0 => GetMessage('TASKS_PRIORITY_0'), 1 => GetMessage('TASKS_PRIORITY_1'), 2 => GetMessage('TASKS_PRIORITY_2'));
$arResult['FILTER'] = array();
$arResult['FILTER_PRESETS'] = array();
if (!$bInternal) {
    $arEntityType = array('' => '', 'LEAD' => GetMessage('CRM_ENTITY_TYPE_LEAD'), 'CONTACT' => GetMessage('CRM_ENTITY_TYPE_CONTACT'), 'COMPANY' => GetMessage('CRM_ENTITY_TYPE_COMPANY'), 'DEAL' => GetMessage('CRM_ENTITY_TYPE_DEAL'));
    ob_start();
    $GLOBALS["APPLICATION"]->IncludeComponent('bitrix:crm.entity.selector', '', array('ENTITY_TYPE' => array('LEAD', 'CONTACT', 'COMPANY', 'DEAL'), 'INPUT_NAME' => 'UF_CRM_TASK', 'INPUT_VALUE' => isset($_REQUEST['UF_CRM_TASK']) ? $_REQUEST['UF_CRM_TASK'] : '', 'FORM_NAME' => $arResult['GRID_ID'], 'MULTIPLE' => 'N', 'FILTER' => true), false, array('HIDE_ICONS' => 'Y'));
    $sVal = ob_get_contents();
    ob_end_clean();
    $arResult['FILTER'] = array(array('id' => 'ID', 'name' => GetMessage('CRM_COLUMN_ID')), array('id' => 'UF_CRM_TASK', 'name' => GetMessage('CRM_COLUMN_UF_CRM_TASK'), 'type' => 'custom', 'value' => $sVal), array('id' => 'ENTITY_TYPE', 'name' => GetMessage('CRM_COLUMN_ENTITY_TYPE'), 'type' => 'list', 'items' => $arEntityType), array('id' => 'TITLE', 'name' => GetMessage('CRM_COLUMN_TITLE'), 'default' => 'Y'), array('id' => 'REAL_STATUS', 'default' => 'Y', 'name' => GetMessage('CRM_COLUMN_REAL_STATUS'), 'type' => 'list', 'items' => array('' => '') + $arResult['STATUS_LIST']), array('id' => 'PRIORITY', 'default' => 'Y', 'name' => GetMessage('CRM_COLUMN_PRIORITY'), 'type' => 'list', 'items' => array('' => '') + $arResult['PRIORITY_LIST']), array('id' => 'CREATED_DATE', 'default' => 'Y', 'name' => GetMessage('CRM_COLUMN_DATE_CREATE'), 'type' => 'date'), array('id' => 'CHANGED_DATE', 'default' => 'Y', 'name' => GetMessage('CRM_COLUMN_DATE_MODIFY'), 'type' => 'date'), array('id' => 'DATE_START', 'name' => GetMessage('CRM_COLUMN_DATE_START'), 'type' => 'date'), array('id' => 'CLOSED_DATE', 'name' => GetMessage('CRM_COLUMN_CLOSED_DATE'), 'type' => 'date'), array('id' => 'RESPONSIBLE_ID', 'name' => GetMessage('CRM_COLUMN_RESPONSIBLE_BY'), 'default' => false, 'enable_settings' => false, 'type' => 'user'), array('id' => 'CHANGED_ID', 'name' => GetMessage('CRM_COLUMN_CHANGED_BY'), 'default' => false, 'enable_settings' => false, 'type' => 'user'));
    $arResult['FILTER_PRESETS'] = array('filter_new' => array('name' => GetMessage('CRM_PRESET_NEW'), 'fields' => array('REAL_STATUS' => '1')), 'filter_my' => array('name' => GetMessage('CRM_PRESET_MY'), 'fields' => array('RESPONSIBLE_ID' => __format_user4search(), 'RESPONSIBLE_ID[]' => $GLOBALS['USER']->GetID())), 'filter_change_today' => array('name' => GetMessage('CRM_PRESET_CHANGE_TODAY'), 'fields' => array('CHANGED_DATE_datesel' => 'today')), 'filter_change_yesterday' => array('name' => GetMessage('CRM_PRESET_CHANGE_YESTERDAY'), 'fields' => array('CHANGED_DATE_datesel' => 'yesterday')), 'filter_change_my' => array('name' => GetMessage('CRM_PRESET_CHANGE_MY'), 'fields' => array('CHANGED_ID' => __format_user4search(), 'CHANGED_ID[]' => $GLOBALS['USER']->GetID())));
}
$arResult['HEADERS'] = array(array('id' => 'ID', 'name' => GetMessage('CRM_COLUMN_ID'), 'sort' => 'id', 'editable' => false, 'type' => 'int'), array('id' => 'TITLE', 'name' => GetMessage('CRM_COLUMN_TITLE'), 'sort' => 'title', 'default' => true, 'editable' => true));
if ($arResult['ACTIVITY_ENTITY_LINK'] == 'Y') {
    $arResult['HEADERS'][] = array('id' => 'ENTITY_TYPE', 'name' => GetMessage('CRM_COLUMN_ENTITY_TYPE'), 'sort' => false, 'default' => true, 'editable' => false);
    $arResult['HEADERS'][] = array('id' => 'ENTITY_TITLE', 'name' => GetMessage('CRM_COLUMN_ENTITY_TITLE'), 'sort' => false, 'default' => true, 'editable' => false);
}
$arResult['HEADERS'] = array_merge($arResult['HEADERS'], array(array('id' => 'REAL_STATUS', 'name' => GetMessage('CRM_COLUMN_REAL_STATUS'), 'sort' => 'real_status', 'default' => true, 'editable' => array(), 'type' => 'list'), array('id' => 'PRIORITY', 'name' => GetMessage('CRM_COLUMN_PRIORITY'), 'sort' => 'priority', 'default' => true, 'editable' => array(), 'type' => 'list'), array('id' => 'CREATED_DATE', 'name' => GetMessage('CRM_COLUMN_DATE_CREATE'), 'sort' => 'created_date', 'default' => true), array('id' => 'CHANGED_DATE', 'name' => GetMessage('CRM_COLUMN_DATE_MODIFY'), 'sort' => 'changed_date', 'default' => false), array('id' => 'DATE_START', 'name' => GetMessage('CRM_COLUMN_DATE_START'), 'sort' => 'date_start', 'default' => false, 'editable' => true, 'type' => 'date'), array('id' => 'CLOSED_DATE', 'name' => GetMessage('CRM_COLUMN_CLOSED_DATE'), 'sort' => 'closed_date', 'default' => true, 'editable' => true, 'type' => 'date'), array('id' => 'RESPONSIBLE_ID', 'name' => GetMessage('CRM_COLUMN_RESPONSIBLE_BY'), 'sort' => 'responsible_id', 'default' => true, 'editable' => false)));
if ($_SERVER['REQUEST_METHOD'] == 'GET' && check_bitrix_sessid() && isset($_GET['action_' . $arResult['GRID_ID']])) {
    if ($_GET['action_' . $arResult['GRID_ID']] == 'delete') {
        global $USER_FIELD_MANAGER;
        $_GET['ID'] = (int) $_GET['ID'];
        $_GET['RESPONSIBLE_ID'] = (int) $_GET['RESPONSIBLE_ID'];
        $arUserFields = $USER_FIELD_MANAGER->GetUserFields('TASKS_TASK', $_GET['ID'], LANGUAGE_ID);
        if (isset($arUserFields['UF_CRM_TASK'])) {
            if (count($arUserFields['UF_CRM_TASK']['VALUE']) > 1) {