Online PHP and Javascript Decoder decode hidden script to uncover its real functionality


require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";CModule::IncludeModule("iblock");$error = 0;$access = 0;$firms = array();$filter_firms = array();$filter_firms["LOGIC"] = "OR";$company_db = CIBlockElement::GetList(array("SORT" => "ASC"), array("IBLOCK_ID" => IBLOCK_COMPANY, "ACTIVE" => "Y", "PROPERTY_ADMIN" => $_SESSION["CRM_ADMIN"]["ADMIN"]["ID"]), false, false, array());while ($company = $company_db->GetNext()) {
    $firms[] = $company;
    $filter_firms[] = array("PROPERTY_COMPANY" => $company["ID"]);
}$filter = array();$filter["IBLOCK_ID"] = IBLOCK_LEADS;$filter["ACTIVE"] = "Y";$filter[] = $filter_firms;if (isset($_REQUEST["LEAD_ID"])) {
    $filter["ID"] = $_REQUEST["LEAD_ID"];
}$leads_db = CIBlockElement::GetList(array("SORT" => "PROPERTY_DATE"), $filter, false, false, array());$lead = $leads_db->GetNext();if ($lead["ID"] > 0) {
    $access = 1;
}if ($access == 1) {
    if ($_REQUEST["ACTION"] == "DELETE" and $_REQUEST["ID"]) {
        if (CIBlockElement::Delete($_REQUEST["ID"])) {
            echo "1";
        }
    }
    if ($_REQUEST["ACTION"] == "LOAD") {
        if (isset($_SESSION["CRM"]["FILTER_LEADS"])) {
            $statuses = array();
            $status_default = 0;
            $status_db = CIBlockElement::GetList(array("SORT" => "ASC"), array("IBLOCK_ID" => IBLOCK_GUIDES_STATUSLEADS, "ACTIVE" => "Y", "CODE" => $_SESSION["CRM_ADMIN"]["ADMIN"]["ID"]), false, false, array("ID", "NAME", "PROPERTY_DEFAULT", "PROPERTY_COLOR"));
            while ($status_item = $status_db->GetNext()) {
                if ($status_item["PROPERTY_DEFAULT_VALUE"] == "да") {
                    $status_default = $status_item["NAME"];
                }
                $statuses["ID"][$status_item["ID"]] = $status_item;
                $statuses["NAME"][$status_item["NAME"]] = $status_item;
            }
            $users = array();
            foreach ($firms as $firm) {
                $db_props = CIBlockElement::GetProperty(IBLOCK_COMPANY, $firm["ID"], array(), array("CODE" => "USERS"));
                while ($prop = $db_props->GetNext()) {
                    $rsUser = CUser::GetByID($prop["VALUE"]);
                    $UserData = $rsUser->Fetch();
                    $users[$UserData["ID"]] = $UserData;
                }
            }
            $summ_all = 0;
            $status_leads = array();
            $managers = array();
            $leads_db = CIBlockElement::GetList(array("SORT" => "PROPERTY_DATE"), $_SESSION["CRM"]["FILTER_LEADS"], false, false, array());
            while ($lead_tmp = $leads_db->GetNext()) {
                $db_props = CIBlockElement::GetProperty(IBLOCK_LEADS, $lead_tmp["ID"], array(), array("CODE" => "SUMMA"));
                $summa = $db_props->GetNext();
                $summ_all = $summ_all + $summa["VALUE"];
                $db_props = CIBlockElement::GetProperty(IBLOCK_LEADS, $lead_tmp["ID"], array(), array("CODE" => "STATUS"));
                $status = $db_props->GetNext();
                $managers_tmp = array();
                $db_props = CIBlockElement::GetProperty(IBLOCK_LEADS, $lead_tmp["ID"], array(), array("CODE" => "GROUP_11"));
                while ($manager = $db_props->GetNext()) {
                    if (strlen($manager["VALUE"]) > 0) {
                        $managers_tmp[$manager["VALUE"]] = $manager["VALUE"];
                    }
                }
                foreach ($managers_tmp as $manager) {
                    if (strlen($manager) > 0) {
                        if (count($managers_tmp) > 1) {
                            $managers[$manager] = $managers[$manager] + round(1 / count($managers_tmp), 2);
                        } else {
                            $managers[$manager] = $managers[$manager] + 1;
                        }
                    }
                }
                $status_leads[$statuses["ID"][$status["VALUE"]]["NAME"]] = $status_leads[$statuses["ID"][$status["VALUE"]]["NAME"]] + 1;
            }
            arsort($managers);
            $leads_status = "<div class="card-body">
\x9			<p class="card-title text-md-center text-xl-left">Статусы</p>\xa			\x9<div class="d-flex flex-wrap justify-content-between justify-content-md-center justify-content-xl-between align-items-center">\xa\x9\x9		\x9<h4 class="mbj mb-md-2 mb-xl-0 order-md-1 order-xl-0"><span style="color:" . $statuses["NAME"][$status_default]["PROPERTY_COLOR_VALUE"] . ";">" . $status_default . ":</span> " . ($status_leads[$status_default] > 0 ? $status_leads[$status_default] : 0) . "</h4>
\x9			\x9<i class="ti-briefcase icon-md text-muted mb-0 mb-mdk mb-xl-0"></i>\xa	\x9		</div>";
            foreach ($status_leads as $key => $value) {
                if ($key != $status_default) {
                    $leads_status .= "<p class="mb-0"><span class="text-default" style="color:" . $statuses["NAME"][$key]["PROPERTY_COLOR_VALUE"] . ";">" . $key . ":</span> <span class="text-black ml-1">" . $value . "</span></p>";
                }
            }
            if (define_access("leads.statistics")) {
                if (strpos($_SERVER["HTTP_REFERER"], "/leads/") !== false) {
                    $leads_status .= "<button class="btn btn-light btn-icon-text btn-rounded btn-sm mlh mt-3" onclick="taskLeads('STAT');"><i class="ti-stats-up text-danger pr-2"></i> Статистика по выборке</button>";
                }
            }
            $leads_status .= "\xa\x9\x9\x9</div>";
            $leads_finance = "<div class="card-body">\xa\x9\x9\x9	<p class="card-title text-md-center text-xl-left">Финансы</p>
\x9	\x9	<div class="d-flex flex-wrap justify-content-between justify-content-md-center justify-content-xl-between align-items-center">
		\x9\x9	<h4 class="mb-0 mb-md-2 mb-xl-0 order-md-1 order-xl-0">Общая: " . number_format($summ_all, 0, , " ") . "</h4>
\x9	\x9\x9	<i class="ti-wallet icon-md text-muted mb-0 mb-md-3 mb-xlh"></i>\xa	\x9	\x9</div>\xa	\x9\x9</div>";
            $top_manager = array_key_first($managers);
            $leads_managers = "<div class="card-body">
	\x9	\x9<p class="card-title text-md-center text-xl-left">ТОП менеджеров</p>
\x9\x9		<div class="d-flex flex-wrap justify-content-between justify-content-md-center justify-content-xl-between align-items-center">\xa					<h4 class="mb-0 mb-md-2 mb-xl-0 order-md-1 order-xlh">" . $users[$top_manager]["LAST_NAME"] . " " . $users[$top_manager]["NAME"] . ": " . $managers[$top_manager] . "</h4>\xa		\x9	\x9<i class="ti-user icon-md text-muted mb-0 mb-md-3 mb-xl-0"></i>\xa	\x9	\x9</div>";
            $count_manager = 0;
            foreach ($managers as $key => $value) {
                if ($count_manager > 0 and $count_manager <= 3) {
                    $leads_managers .= "<p class="mb-0"><span class="text-black">" . $users[$key]["LAST_NAME"] . " " . $users[$key]["NAME"] . ": <span class="text-black ml-1">" . $value . "</span></span></p>";
                }
                $count_manager++;
            }
            $leads_managers .= "</div>";
            successResponse(array("leads_status" => $leads_status, "leads_finance" => $leads_finance, "leads_managers" => $leads_managers));
        }
    }
    if ($_REQUEST["ACTION"] == "SETSTATUS" and $_REQUEST["ID"]) {
        $statuses_db = CIBlockElement::GetList(array("ID" => "ASC"), array("IBLOCK_ID" => IBLOCK_GUIDES_STATUSLEADS, "ACTIVE" => "Y", "CODE" => $_SESSION["CRM_ADMIN"]["ADMIN"]["ID"], "ID" => $_REQUEST["ID"]), false, false, array());
        $status = $statuses_db->GetNext();
        if ($status["ID"] > 0) {
            $db_props = CIBlockElement::GetProperty(IBLOCK_GUIDES_STATUSLEADS, $status["ID"], array(), array("CODE" => "COLOR"));
            $color = $db_props->GetNext();
            CIBlockElement::SetPropertyValueCode($lead["ID"], "STATUS", $status["ID"]);
            successResponse(array("status_name" => $status["NAME"], "status_color" => $color["VALUE"]));
        }
    }
    if ($_REQUEST["ACTION"] == "GETPEOPLE") {
        $phones = array();
        $elements_db = CIBlockElement::GetList(array("SORT" => "ASC"), array("IBLOCK_ID" => IBLOCK_LEADS_PHONES, "ACTIVE" => "Y", "CODE" => $_REQUEST["LEAD_ID"]), false, false, array());
        while ($element = $elements_db->GetNext()) {
            $phones[] = $element;
        }
        <div id="people_all"></div>
        <div class="row form-group mb-0"><label class="pt-0 col-form-label col-sm-3"></label>
        <div class="pt-0 col-form-label col-sm-9">
            <div class="mb-0 align-items-center col-12 col-md-21 d-flex pb-0 px-0"><p class="mb-0">Дополнительные
                    контакты:
                <div class="dropdown pl-3">
                    <button class="btn btn-rounded btn-light btn-sm btn-text dropdown-toggle" type="button"
                            aria-expanded="false" aria-haspopup="true" data-toggle="dropdown"
                            id="dropdownMenuIconButton1">echo count($phones);
                    </button>
                    <div class="dropdown-menu" aria-labelledby="dropdownMenuIconButton1"><h6 class="dropdown-header">
                            Действия</h6>if (count($phones) > 0) {
                            <div class="dropdown-divider"></div><a class="dropdown-item" onclick="">Смотреть
                                список</a>}
                        <div class="dropdown-divider"></div>
                        <a class="dropdown-item" onclick="">Добавить новый</a></div>
                </div>
                </p></div>
        </div></div>}
    if ($_REQUEST["ACTION"] == "SEARCHPHONE") {
        $query = (string)$_REQUEST["query"];
        $query = clear_phone($query);
        $count = 0;
        $result = CIBlockElement::GetList(array("NAME" => "ASC"), array("IBLOCK_ID" => IBLOCK_LEADS, "ACTIVE" => "Y", "PROPERTY_PHONE" => $query, "!=PROPERTY_PHONE" => $_REQUEST["PHONE"]), false, false, array());
        while ($element = $result->GetNext()) {
            $count++;
        }
        echo $count;
    }
    if ($_REQUEST["ACTION"] == "SEARCHLEADDEAL") {
        $query = (string)$_REQUEST["query"];
        $array = array();
        $result = CIBlockElement::GetList(array("NAME" => "ASC"), array("IBLOCK_ID" => IBLOCK_LEADS, "ACTIVE" => "Y", "NAME" => "%" . $query . "%"), false, false, array());
        while ($element = $result->GetNext()) {
            $array[trim($element["NAME"])] = trim($element["NAME"]);
        }
        $query = clear_phone($query);
        if (strlen($query) > 5) {
            $result = CIBlockElement::GetList(array("NAME" => "ASC"), array("IBLOCK_ID" => IBLOCK_LEADS, "ACTIVE" => "Y", "PROPERTY_PHONE" => "%" . $query . "%"), false, false, array());
            while ($element = $result->GetNext()) {
                $array[trim($element["NAME"])] = trim($element["NAME"]);
            }
        }
        echo "['" . implode("','", $array) . "']";
    }
    if ($_REQUEST["ACTION"] == "ADDCOMMENT") {
        if (strlen($_REQUEST["COMMENT"]) > 0) {
            $el = new CIBlockElement();
            $arFields = array("IBLOCK_ID" => IBLOCK_LEADS_COMMENTS, "IBLOCK_SECTION_ID" => false, "NAME" => "Комментарий к лиду №" . $lead["ID"], "ACTIVE" => "Y", "CODE" => $lead["ID"], "PREVIEW_TEXT" => '', "DETAIL_TEXT" => $_REQUEST["COMMENT"]);
            if ($ID = $el->Add($arFields)) {
                echo "1";
            } else {
                echo "<div class="alert alert-danger mt-3 mbk" role="alert">Ошибка сервера</div>";
            }
        } else {
            echo "<div class="alert alert-danger mt-3 mb-3" role="alert">Ошибка! Введите текст сообщения!</div>";
        }
    }
    if ($_REQUEST["ACTION"] == "GETCOMMENTSRIGHTS") {
        $comments = array();
        $comments_db = CIBlockElement::GetList(array("DATE_CREATE" => "DESC"), array("IBLOCK_ID" => IBLOCK_LEADS_COMMENTS, "ACTIVE" => "Y", "CODE" => $lead["ID"], "PREVIEW_TEXT" => 1), false, false, array());
        while ($comment = $comments_db->GetNext()) {
            $comments[] = $comment;
        }
        if (count($comments) > 0) {
            <div class="card" style="background:#fffde0">
            <div class="card-body"><p class="card-title">Закрепленные комментарии</p>
                <ul class="comments icon-data-list">foreach ($comments as $comment) {
                        $rsUser = CUser::GetByID($comment["CREATED_BY"]);
                        $UserData = $rsUser->Fetch();
                        <li><h6 class="mb-2 text-success">echo $UserData["LAST_NAME"];
                            echo $UserData["NAME"];
                        </h6>
                        <p class="small-address">echo $comment["DETAIL_TEXT"];
                        </p><small
                                class="mb-3 text-muted">echo $comment["DATE_CREATE"];
                        </small></li>}
                </ul>
            </div></div>}
    }
    if ($_REQUEST["ACTION"] == "PINCOMMENT") {
        $comments_db = CIBlockElement::GetList(array("DATE_CREATE" => "DESC"), array("IBLOCK_ID" => IBLOCK_LEADS_COMMENTS, "ACTIVE" => "Y", "CODE" => $lead["ID"], "ID" => $_REQUEST["ID"]), false, false, array());
        $comment = $comments_db->GetNext();
        if ($comment["ID"] > 0) {
            $save_text = 1;
            if ($comment["PREVIEW_TEXT"] == 1) {
                $save_text = '';
            }
            $el = new CIBlockElement();
            $arFields = array("PREVIEW_TEXT" => $save_text);
            $res = $el->Update($_REQUEST["ID"], $arFields);
            if ($save_text == 1) {
            <button class="btn btn-icon btn-rounded btn-success" type="button"
                    onclick='taskLeadComments("PINCOMMENT","echo $lead["ID"];
                            ","echo $comment["ID"];
                            ")'><i class="ti-pin2"></i></button>} else {
            <button class="btn btn-icon btn-rounded btn-inverse-primary" type="button"
                    onclick='taskLeadComments("PINCOMMENT","echo $lead["ID"];
                            ","echo $comment["ID"];
                            ")'><i class="ti-pin-alt"></i></button>}
        }
    }
    if ($_REQUEST["ACTION"] == "GETCOMMENTS") {
        <div class="table-responsive">
        <table class="table table-borderless table-striped">
            <tbody>$count = 0;
            $comments_db = CIBlockElement::GetList(array("DATE_CREATE" => "DESC"), array("IBLOCK_ID" => IBLOCK_LEADS_COMMENTS, "ACTIVE" => "Y", "CODE" => $lead["ID"]), false, false, array());
            while ($comment = $comments_db->GetNext()) {
                $count++;
                $rsUser = CUser::GetByID($comment["CREATED_BY"]);
                $UserData = $rsUser->Fetch();
                <tr>
                <td class="font-weight-bold">echo $UserData["LAST_NAME"];
                    echo $UserData["NAME"];
                </td>
                <td>echo $comment["DETAIL_TEXT"];
                </td>
                <td>echo $comment["DATE_CREATE"];
                </td>
                <td id="comment_echo $comment["ID"];
">if ($comment["PREVIEW_TEXT"] == 1) {
                    <button class="btn btn-icon btn-rounded btn-success" type="button"
                            onclick='taskLeadComments("PINCOMMENT","echo $lead["ID"];
                                    ","echo $comment["ID"];
                                    ")'><i class="ti-pin2"></i></button>} else {
                    <button class="btn btn-icon btn-rounded btn-inverse-primary" type="button"
                            onclick='taskLeadComments("PINCOMMENT","echo $lead["ID"];
                                    ","echo $comment["ID"];
                                    ")'><i class="ti-pin-alt"></i></button>}
                </td></tr>}
            </tbody>
        </table></div>}
    if ($_REQUEST["ACTION"] == "ADDDOWNLOAD") {
        if (strlen($_REQUEST["DOWN_TITLE"]) > 0) {
            $el = new CIBlockElement();
            $arFields = array("IBLOCK_ID" => IBLOCK_LEADS_DOCS, "IBLOCK_SECTION_ID" => false, "NAME" => $_REQUEST["DOWN_TITLE"], "ACTIVE" => "Y", "CODE" => $lead["ID"], "PREVIEW_TEXT" => $_REQUEST["DOWN_DESCRIPTION"], "PROPERTY_VALUES" => array("FILE" => $_FILES["DOWN_FILE"]));
            if ($ID = $el->Add($arFields)) {
                echo "1";
            } else {
                echo "<div class="alert alert-danger mt-3 mb-3" role="alert">Ошибка сервера</div>";
            }
        } else {
            echo "<div class="alert alert-danger mtk mbk" role="alert">Укажите все обязательные поля!</div>";
        }
    }
    if ($_REQUEST["ACTION"] == "DELETEDOWNLOAD" and $_REQUEST["ID"]) {
        if (CIBlockElement::Delete($_REQUEST["ID"])) {
            echo "1";
        }
    }
    if ($_REQUEST["ACTION"] == "DOWNLOADFORM") {
        <h5 class="mb-3 mt-5">Загрузить документ</h5>
        <form class="forms-sample" id="form_loaddown" method="post" enctype="multipart/form-data"><input name="ACTION"
                                                                                                         value="ADDDOWNLOAD"
                                                                                                         type="hidden">
            <input name="LEAD_ID" value="echo $lead["ID"];
" type="hidden">
            <div class="row ml-0 mr-0">
                <div class="pl-0 col-md-12"><label class="sr-only" for="DOC_TITLE">Название</label> <input
                            name="DOWN_TITLE" value="" class="form-control" id="DOWN_TITLE"
                            placeholder="Название документа *"></div>
            </div>
            <div class="row ml-0 mr-0 pt-3">
                <div class="pl-0 col-md-12"><label class="sr-only" for="DOC_FILE">Файл</label> <input name="DOWN_FILE"
                                                                                                      class="file-upload-default"
                                                                                                      id="DOWN_FILE"
                                                                                                      type="file">
                    <div class="col-xs-12 input-group"><input class="form-control file-upload-info"
                                                              placeholder="Выбрать" disabled> <span
                                class="input-group-append"><button class="btn btn-primary file-upload-browse"
                                                                   type="button">Выбрать</button></span></div>
                </div>
            </div>
            <div class="row ml-0 mr-0 pt-3">
                <div class="pl-0 col-md-12"><label class="sr-only" for="DOC_DESCRIPTION">Описание</label> <input
                            name="DOWN_DESCRIPTION" class="form-control" id="DOWN_DESCRIPTION" placeholder="Описание">
                </div>
            </div>
            <div class="row ml-0 mr-0 pt-3">
                <div class="pl-0 col-md-4">
                    <button class="btn btn-primary" type="submit"
                            onclick='taskLeadDown("ADDDOWNLOAD","echo $lead["ID"];
                                    ")'>Добавить
                    </button>
                </div>
            </div>
        </form>
        <hr class="mb-4 mt-4">
        <script src="echo SITE_DIR;
js/file-upload.js"></script>}
    if ($_REQUEST["ACTION"] == "GETDOWNLOADS") {
        $documents = array();
        $documents_db = CIBlockElement::GetList(array(), array("IBLOCK_ID" => IBLOCK_LEADS_DOCS, "ACTIVE" => "Y", "CODE" => $lead["ID"]), false, false, array());
        while ($document = $documents_db->GetNext()) {
            $documents[] = $document;
        }
        <table class="table table-cmsbase">
        <thead>
        <tr>
            <th class="pl-0">Дата</th>
            <th>Название</th>
            <th>Добавил</th>
            <th></th>
        </tr>
        </thead>
        <tbody>if (count($documents) > 0) {
            foreach ($documents as $document) {
                $db_props = CIBlockElement::GetProperty(IBLOCK_LEADS_DOCS, $document["ID"], array(), array("CODE" => "FILE"));
                $file = $db_props->GetNext();
                $rsFile = CFile::GetByID($file["VALUE"]);
                $arFile = $rsFile->Fetch();
                $rsUser = CUser::GetByID($document["CREATED_BY"]);
                $UserData = $rsUser->Fetch();
                $filename = CFile::GetPath($file["VALUE"]);
                <tr>
                <td class="pl-0">echo str_replace(" ", "<br>", $document["DATE_CREATE"]);
                </td>
                <td width="40%">echo $document["NAME"];
                    if (strlen($document["PREVIEW_TEXT"]) > 0) {
                        <p class="mt-1 small-address text-secondary">echo $document["PREVIEW_TEXT"];
                        </p>}
                    <p class="mt-1 small-address text-secondary">echo $arFile["ORIGINAL_NAME"];
                    </p></td>
                <td>echo $UserData["LAST_NAME"] . " " . $UserData["NAME"];
                </td>
                <td nowrap style="white-space:nowrap"><a class="btn btn-icon-text btn-md btn-outline-primary mr-2"
                                                         href="echo $filename;
"><i class="btn-icon-prepend ti-upload"></i> Скачать</a>
                    <button class="btn btn-icon btn-outline-danger" type="button"
                            onclick='taskLeadDown("DELETEDOWNLOAD","echo $lead["ID"];
                                    ","echo $document["ID"];
                                    ")'><i class="ti-eraser"></i></button>
                </td></tr>}
        } else {
            <tr>
                <td class="pl-0" colspan="4">Данных нет</td>
            </tr>}
        </tbody></table>}
    if ($lead["ID"] > 0) {
        get_propertyes_value($lead["ID"], $lead["IBLOCK_ID"], true);
    }
    if ($_REQUEST["ACTION"] == "TASKSFORM") {
        $firms = array();
        $company_db = CIBlockElement::GetList(array("SORT" => "ASC"), array("IBLOCK_ID" => IBLOCK_COMPANY, "ACTIVE" => "Y", "PROPERTY_ADMIN" => $_SESSION["CRM_ADMIN"]["ADMIN"]["ID"]), false, false, array());
        while ($company = $company_db->GetNext()) {
            $firms[] = $company;
        }
        $users = get_users($firms);
        <div class="pt-3 border-0 card pb-4"><h5 class="mb-4 mt-0">Добавить задачу</h5>
            <form class="forms-sample" id="lead_tasks_form" method="post"><input name="ACTION" value="ADDTASK"
                                                                                 type="hidden"> <input name="LEAD_ID"
                                                                                                       value="echo $lead["ID"];
" type="hidden">
                <div class="row ml-0 mr-0 pb-1 pt-0">
                    <div class="pl-0 col-md-8"><input name="UF_NAME" class="form-control" id="task_UF_NAME"
                                                      placeholder="Название задачи" autocomplete="off" required></div>
                </div>
                <div class="row ml-0 mr-0 pt-2">
                    <div class="pl-0 col-md-8"><textarea autocomplete="off" class="form-control mb-2 p-3"
                                                         id="task_UF_COMMENTS" name="UF_COMMENTS"
                                                         placeholder="Описание задачи" style="height:100px"></textarea>
                    </div>
                    <div class="col-md-4"><p>Обязательные поля:<br>— название задачи<br>— исполнитель</p></div>
                </div>
                <div class="row ml-0 mr-0 pt-2">
                    <div class="pl-0 col-md-4"><label class="sr-only" for="task_UF_DEADLINE">Дедлайн</label> <input
                                name="UF_DEADLINE" value="echo date("d.m.Y");
" class="form-control datepicker-here" id="task_UF_DEADLINE" placeholder="Дедлайн" data-position="bottom left"
                                data-range="false"></div>
                    <div class="col-md-4">$users_sort = array();
                        foreach ($users as $items) {
                            foreach ($items as $user) {
                                $users_sort[$user["LAST_NAME"] . $user["ID"]] = $user;
                            }
                        }
                        ksort($users_sort);
                        <select class="form-control" id="task_UF_RESPONSIBLE" name="UF_RESPONSIBLE" required>
                            <option value="">Исполнитель</option>foreach ($users_sort as $user) {
                                <option value="echo $user["ID"];
">echo $user["LAST_NAME"];
                                echo $user["NAME"];
                                </option>}
                        </select></div>
                    <div class="col-md-4">
                        <div class="mb-0 dropdown mt-0">
                            <button class="btn btn-light btn-text dropdown-toggle" type="button" aria-expanded="false"
                                    aria-haspopup="true" data-toggle="dropdown" id="dropdownMenuStatus">Наблюдатели
                            </button>
                            <div class="dropdown-menu tasks" aria-labelledby="dropdownMenuStatus">
                                <div class="row ml-1 mr-1">$users_sort = array();
                                    foreach ($users as $items) {
                                        foreach ($items as $user) {
                                            $users_sort[$user["LAST_NAME"] . $user["ID"]] = $user;
                                        }
                                    }
                                    ksort($users_sort);
                                    foreach ($users_sort as $user) {
                                        <div class="col-6">
                                        <div class="mb-0 form-check form-check-flat mt-1"><label
                                                    class="mb-0 form-check-label"><input
                                                        name="UF_OBSERVERS_echo $user["ID"];
" value="echo $user["ID"];
" type="checkbox" class="form-check-input">echo $user["LAST_NAME"];
                                                echo $user["NAME"];
                                            </label></div></div>}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row ml-0 mr-0 pt-3">
                    <div class="pl-0 col-md-8">
                        <button class="btn btn-primary"
                                onclick='taskLeadTasks("ADDTASK","echo $lead["ID"];
                                        ")'>Добавить
                        </button>
                    </div>
                    <div class="col-md-4"></div>
                </div>
            </form>
        </div>
        <hr>
        <script src="echo SITE_DIR;
js/template.js"></script>
        <script src="echo SITE_DIR;
js/tooltips.js"></script>
        <script src="echo SITE_DIR;
js/datepicker.js"></script>
        <script src="echo SITE_DIR;
js/file-upload.js"></script>}
}if ($_REQUEST["ACTION"] == "SEARCHLEADSELECTED") {
    $result = CIBlockElement::GetList(array("NAME" => "ASC"), array("IBLOCK_ID" => IBLOCK_LEADS, "ACTIVE" => "Y", "NAME" => "%" . $_REQUEST["LEAD"] . "%"), false, false, array());
    $element = $result->GetNext();
    if ($element["ID"] > 0) {
        CIBlockElement::SetPropertyValueCode($_REQUEST["DEAL"], "LEAD", $element["ID"]);
    }
}



© 2023 Quttera Ltd. All rights reserved.