function UserLoginHandler(&$arFields) { CModule::IncludeModule("iblock"); CModule::IncludeModule("highloadblock"); global $APPLICATION; $user = CUser::GetByID($arFields['USER_ID'])->Fetch(); if (intval($user['UF_USER_PARENT']) > 0 && $APPLICATION->get_cookie("MQ_REGISTRATION_TOKEN") && $user['UF_INVITE_STATUS'] != 1) { $fields = array_flip(getValuesList('UF_STATUS', 'USER', 'ID')); if ($fields[$user['UF_STATUS']] != 4) { changeUserStatus($user['ID'], $user['UF_USER_PARENT'], $user['UF_STATUS'], 4, "Приглашение принято"); } } }
function changeUserStatus($ID, $PARENT, $CURRENT, $NEW, $text) { CModule::IncludeModule("iblock"); CModule::IncludeModule("highloadblock"); global $APPLICATION; $fields = getValuesList('UF_STATUS', 'USER', 'ID'); $flipFields = array_flip($fields); $types = array(getValuesList('UF_TYPE', 'HLBLOCK_2', 'ID'), getValuesList('UF_TYPE_2', 'HLBLOCK_2', 'ID')); $raw = new CUser(); $raw->Update($ID, array('UF_INVITE_STATUS' => 1, 'UF_STATUS' => $fields[$NEW])); $hbKPI = HL\HighloadBlockTable::getById(2)->fetch(); $entityKPI = HL\HighloadBlockTable::compileEntity($hbKPI); $logKPI = $entityKPI->getDataClass(); $logKPI::add(array('UF_USER' => intval($ID), 'UF_AMPLIFIER' => intval($PARENT), 'UF_EVENT' => 0, 'UF_DATE_TIME' => date("Y-m-d H:i:s"), 'UF_ACTION_CODE' => 103, 'UF_ACTION_TEXT' => "change_status", 'UF_TYPE' => $CURRENT ? $types[0][$flipFields[$CURRENT]] : 1, 'UF_TYPE_2' => $types[1][$NEW])); $hbLOG = HL\HighloadBlockTable::getById(4)->fetch(); $entityLOG = HL\HighloadBlockTable::compileEntity($hbLOG); $logLOG = $entityLOG->getDataClass(); $res = $logLOG::add(array('UF_USER' => intval($ID), 'UF_AMPLIFIER' => intval($PARENT), 'UF_EVENT' => 0, 'UF_DATE_TIME' => date("d.m.Y H:i:s", time()), "UF_ACTION_CODE" => 104, "UF_ACTION_TEXT" => $text, "UF_TYPE" => $CURRENT ? $flipFields[$CURRENT] : 1, "UF_TYPE_2" => $NEW)); }
?> </th><?php } ?> </tr> </thead> <tbody> <?php } else { echo implode(";", $title) . "\r\n"; } $even = false; $total = 0; $events = array(0 => ""); CModule::IncludeModule("iblock"); $types = array_flip(getValuesList('UF_TYPE', 'HLBLOCK_2', 'ID')) + array_flip(getValuesList('UF_TYPE_2', 'HLBLOCK_2', 'ID')); while ($cells = $res->Fetch()) { if ($cells["UF_ACTION_TEXT"] == "change_status" && $types[$cells["UF_TYPE"]] == $types[$cells["UF_TYPE_2"]]) { continue; } if (!isset($events[$cells["UF_EVENT"]])) { $res_1 = CIBlockElement::GetList(array(), array("IBLOCK_ID" => 2, "ID" => $cells["UF_EVENT"])); while ($arRes_1 = $res_1->GetNextElement()) { $arItem = $arRes_1->GetFields(); $arItem["PROPERTIES"] = $arRes_1->GetProperties(); $arEvent = $arItem["PROPERTIES"]; //echo "<xmp>";print_r($arEvent);echo "</xmp>"; } } $row = array($cells["UF_AMPLIFIER"], $cells["a_login"], $cells["a_name"], $cells["a_last_name"], $arEvent["PLACE_EVENT"]["VALUE"], $cells["UF_DATE_TIME"], $cells["UF_EVENT"], $cells["UF_USER"], $cells["u_name"], $cells["u_last_name"], $cells["UF_TYPE_2"] == 39 ? "" : $cells["u_email"], $cells["u_phone_1"] . " " . $cells["u_phone_2"], implode(" ", unserialize($cells["UF_FB_PROFILE"])), implode(" ", unserialize($cells["UF_VK_PROFILE"])), implode(" ", unserialize($cells["UF_GP_PROFILE"])), $cells["u_birth_date"], $cells["UF_EVENT"] ? $cells["UF_TYPE"] == 34 || $cells["UF_TYPE_2"] == 39 ? "1" : "" : $cells["UF_TYPE_2"] == 39 ? "1" : "", $cells["UF_EVENT"] ? $cells["UF_TYPE"] == 36 || $cells["UF_TYPE_2"] == 41 ? "1" : "" : $cells["UF_TYPE_2"] == 41 ? "1" : "", $cells["UF_EVENT"] ? $cells["UF_TYPE"] == 35 || $cells["UF_TYPE_2"] == 40 ? "1" : "" : $cells["UF_TYPE_2"] == 40 ? "1" : "", $cells["UF_EVENT"] ? $cells["UF_TYPE"] == 37 || $cells["UF_TYPE_2"] == 42 ? "1" : "" : $cells["UF_TYPE_2"] == 42 ? "1" : "", $types[$cells["UF_TYPE"]] == 6 || $types[$cells["UF_TYPE_2"]] == 6 ? '1' : ''); if (!isset($_GET["csv"])) {