Поддержка серверов

CCrmLiveFeedComponent::getValue: метод Битрикс

Постоянная ссылка: http://bxapi.ru/src/?id=183069

//    CCrmLiveFeedComponent::getValue()
//    /bitrix/modules/crm/classes/general/livefeed.php:5929

    private function getValue($value_code)
    {
        if (!is_array($value_code))
        {
            if (strpos($value_code, "COMBI_") === 0)
            {
                $arFieldName = explode("/", substr($value_code, 6));
                if (is_array($arFieldName))
                {
                    $arReturn = array();

                    foreach($arFieldName as $fieldName)
                    {
                        if (strpos($fieldName, "EVENT_PARAMS_") === 0)
                        {
                            $key = substr($fieldName, 13);
                        }
                        elseif (strpos($fieldName, "ACTIVITY_") === 0)
                        {
                            $key = substr($fieldName, 9);
                        }
                        elseif (strpos($fieldName, "INVOICE_") === 0)
                        {
                            $key = substr($fieldName, 8);
                        }
                        else
                        {
                            $key = $fieldName;
                        }

                        if (strpos($key, "CONTACT_ID") !== false)
                        {
                            $key = "CONTACT_ID";
                        }
                        elseif (strpos($key, "LAST_NAME") !== false)
                        {
                            $key = "CONTACT_LAST_NAME";
                        }
                        elseif (strpos($key, "SECOND_NAME") !== false)
                        {
                            $key = "CONTACT_SECOND_NAME";
                        }
                        elseif (strpos($key, "NAME") !== false)
                        {
                            $key = "CONTACT_NAME";
                        }
                        elseif (strpos($key, "COMPANY_TITLE") !== false)
                        {
                            $key = "COMPANY_TITLE";
                        }
                        elseif (strpos($key, "COMPANY_ID") !== false)
                        {
                            $key = "COMPANY_ID";
                        }
                        elseif (
                            strpos($key, "TITLE") !== false
                            || strpos($key, "ORDER_TOPIC") !== false
                            || strpos($key, "SUBJECT") !== false
                        )
                        {
                            $key = "TITLE";
                        }
                        elseif (strpos($key, "ENTITY_ID") !== false)
                        {
                            $key = "ENTITY_ID";
                        }
                        elseif (strpos($key, "PHOTO_ID") !== false)
                        {
                            $key = "PHOTO_ID";
                        }
                        elseif (strpos($key, "LOGO_ID") !== false)
                        {
                            $key = "LOGO_ID";
                        }
                        elseif (strpos($key, "START_STATUS_ID") !== false)
                        {
                            $key = "STAGE_ID";
                        }
                        elseif (strpos($key, "FINAL_STATUS_ID") !== false)
                        {
                            $key = "STAGE_ID";
                        }
                        elseif (strpos($key, "STAGE_ID") !== false)
                        {
                            $key = "STAGE_ID";
                        }
                        elseif (strpos($key, "CATEGORY_ID") !== false)
                        {
                            $key = "CATEGORY_ID";
                        }
                        elseif (strpos($key, "ID") !== false)
                        {
                            $key = "ID";
                        }
                        elseif ($key === "ACCOUNT_NUMBER")
                        {
                            $key = "ID";
                        }

                        $arReturn[$key] = $this->getValue($fieldName);
                    }

                    return $arReturn;
                }
            }
            elseif (strpos($value_code, "EVENT_PARAMS_") === 0)
            {
                if (is_array($this->eventParams[substr($value_code, 13)]))
                {
                    array_walk($this->eventParams[substr($value_code, 13)], array($this, '__htmlspecialcharsbx'));
                    return $this->eventParams[substr($value_code, 13)];
                }
                elseif(array_key_exists(substr($value_code, 13), $this->eventParams))
                {
                    return htmlspecialcharsbx($this->eventParams[substr($value_code, 13)]);
                }
                else
                {
                    return '';
                }
            }
            elseif (strpos($value_code, "ACTIVITY_ONCLICK") === 0)
            {
                return "BX.CrmActivityEditor.viewActivity('livefeed', ".$this->activity["ID"].", { 'enableInstantEdit':true, 'enableEditButton':true });";
            }
            elseif (strpos($value_code, "ACTIVITY_") === 0)
            {
                $realKey = substr($value_code, 9);

                if (is_array($this->activity[$realKey]))
                {
                    array_walk($this->activity[$realKey], array($this, '__htmlspecialcharsbx'));
                    return $this->activity[$realKey];
                }
                else
                {
                    if (
                        empty($this->activity[$realKey])
                        && $realKey == "SUBJECT"
                    )
                    {
                        return GetMessage('C_CRM_LF_SUBJECT_TITLE_EMPTY');
                    }
                    else
                    {
                        return htmlspecialcharsbx($this->activity[$realKey]);
                    }
                }
            }
            elseif (strpos($value_code, "INVOICE_") === 0)
            {
                if (is_array($this->activity[substr($value_code, 9)]))
                {
                    array_walk($this->invoice[substr($value_code, 8)], array($this, '__htmlspecialcharsbx'));
                    return $this->invoice[substr($value_code, 8)];
                }
                else
                {
                    return htmlspecialcharsbx($this->invoice[substr($value_code, 8)]);
                }
            }
            else
            {
                if (is_array($this->activity[substr($value_code, 9)]))
                {
                    array_walk($this->fields[$value_code], array($this, '__htmlspecialcharsbx'));
                    return $this->fields[$value_code];
                }
                else
                {
                    return htmlspecialcharsbx($this->fields[$value_code]);
                }
            }
        }
        else
        {
            $arReturn = array();
            foreach($value_code as $key_tmp => $value_tmp)
            {
                $arReturn[$key_tmp] = $this->getValue($value_tmp);
            }
            return $arReturn;
        }
    }

Блог разработчика

9 августа 2016 ResizeImageGet и простой водяной знак налету

Сегодня поговорим о том как проще всего воткнуть водяной знак на картинки в Битрикс. Например, на все изображения каталога.

21 июля 2016 Добавление вкладки в CRM коробки Битрикс24

В этом посте я покажу, как легко и просто добавить вкладку в сущность CRM. И не просто добавить, а вывести там свой контент.

21 июля 2016 Как просто обращаться из коробки Битрикс24 на сайт на базе Битрикс

К примеру вам хочется внутренним скриптом дернуть с сайта-магазина информацию, которая там, в свою очередь, закрыта некоторыми правами. Например, админскими. Можно конечно мутить свой REST, или иной формат общения, но проще всего воспользоваться штатным инструментом:

Текст сообщения*
Загрузить изображение