function __MPF_ImageResizeHandler(&$arCustomFile, $params = array(), $result = array()) { static $arParams = array(); if (!empty($params)) { $arParams = $params; } static $arResult = array(); if (!empty($result)) { $arResult = $result; } $fileIdForDelete = 0; $arFields = array(); foreach (array("MELODY_WELCOME", "MELODY_WAIT", "MELODY_HOLD", "MELODY_VOICEMAIL") as $controlID => $inputName) { if ($_REQUEST["controlID"] == "voximplant" . $controlID) { $fileIdForDelete = $arResult["ITEM"][$inputName]; $arFields = array($inputName => $arCustomFile["fileID"]); break; } } if (!empty($arFields)) { $arFile = CFile::GetFileArray($arCustomFile['fileID']); $arCustomFile["fileURL"] = CHTTP::URN2URI($arFile["SRC"]); Bitrix\Voximplant\ConfigTable::update($arParams["ID"], $arFields); CFile::Delete($fileIdForDelete); } }
} else { if (LANGUAGE_ID == 'ru') { $arResult['LINK_TO_BUY'] = 'http://www.1c-bitrix.ru/buy/intranet.php#tab-call-link'; } else { if (LANGUAGE_ID == 'ua') { //$arResult['LINK_TO_BUY'] = 'http://www.1c-bitrix.ua/buy/intranet.php#tab-call-link'; } else { if (LANGUAGE_ID == 'kz') { } else { if (LANGUAGE_ID == 'de') { $arResult['LINK_TO_BUY'] = 'https://www.bitrix24.de/prices/calls.php'; } else { $arResult['LINK_TO_BUY'] = 'https://www.bitrix24.com/prices/calls.php'; } } } } $arResult['LINK_TO_DOC'] = in_array(LANGUAGE_ID, array("ru", "kz", "ua", "by")) ? 'https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=48&CHAPTER_ID=02699' : 'https://www.bitrixsoft.com/support/training/course/index.php?COURSE_ID=26&LESSON_ID=6734'; } $res = Bitrix\Voximplant\ConfigTable::getList(array('filter' => array('=PORTAL_MODE' => CVoxImplantConfig::MODE_SIP))); while ($row = $res->fetch()) { if (strlen($row['PHONE_NAME']) <= 0) { $row['PHONE_NAME'] = substr($row['SEARCH_ID'], 0, 3) == 'reg' ? GetMessage('VI_CONFIG_SIP_CLOUD_TITLE') : GetMessage('VI_CONFIG_SIP_OFFICE_TITLE'); $row['PHONE_NAME'] = str_replace('#ID#', $row['ID'], $row['PHONE_NAME']); } $arResult['LIST_SIP_NUMBERS'][$row['ID']] = array('PHONE_NAME' => htmlspecialcharsbx($row['PHONE_NAME'])); } if (!(isset($arParams['TEMPLATE_HIDE']) && $arParams['TEMPLATE_HIDE'] == 'Y')) { $this->IncludeComponentTemplate(); } return $arResult;
if ($_POST['NUMBER_ID'] > 0) { $result = Bitrix\Voximplant\ConfigTable::getById($_POST['NUMBER_ID']); if ($row = $result->fetch()) { $result = CVoxImplantPhone::EnqueueDeactivatePhoneNumber($row['SEARCH_ID']); if (!$result) { $arSend['ERROR'] = 'ERROR'; } } } echo CUtil::PhpToJsObject($arSend); } else { if ($_POST['VI_CANCEL_UNLINK_NUMBER'] == 'Y') { $arSend['ERROR'] = ''; $_POST['NUMBER_ID'] = intval($_POST['NUMBER_ID']); if ($_POST['NUMBER_ID'] > 0) { $result = Bitrix\Voximplant\ConfigTable::getById($_POST['NUMBER_ID']); if ($row = $result->fetch()) { $result = CVoxImplantPhone::CancelDeactivatePhoneNumber($row['SEARCH_ID']); if (!$result) { $arSend['ERROR'] = 'ERROR'; } } } echo CUtil::PhpToJsObject($arSend); } else { echo CUtil::PhpToJsObject(array('ERROR' => 'UNKNOWN_ERROR')); } } } } }
} else { $post["WORKTIME_DAYOFF_NUMBER"] = ''; } $arFields = array("DIRECT_CODE" => $post["DIRECT_CODE"], "DIRECT_CODE_RULE" => $post["DIRECT_CODE_RULE"], "CRM" => $post["CRM"], "CRM_RULE" => $post["CRM_RULE"], "CRM_CREATE" => $post["CRM_CREATE"], "CRM_FORWARD" => $post["CRM_FORWARD"], "QUEUE_TIME" => $post["QUEUE_TIME"], "TIMEMAN" => $post["TIMEMAN"], "NO_ANSWER_RULE" => $post["NO_ANSWER_RULE"], "FORWARD_NUMBER" => $post["FORWARD_NUMBER"], "RECORDING" => $post["RECORDING"], "MELODY_LANG" => $post["MELODY_LANG"], "MELODY_WELCOME" => $post["MELODY_WELCOME"], "MELODY_WELCOME_ENABLE" => $post["MELODY_WELCOME_ENABLE"], "MELODY_WAIT" => $post["MELODY_WAIT"], "MELODY_HOLD" => $post["MELODY_HOLD"], "MELODY_VOICEMAIL" => $post["MELODY_VOICEMAIL"], "WORKTIME_ENABLE" => isset($post["WORKTIME_ENABLE"]) ? "Y" : "N", "WORKTIME_FROM" => $workTimeFrom, "WORKTIME_TO" => $workTimeTo, "WORKTIME_HOLIDAYS" => $workTimeHolidays, "WORKTIME_DAYOFF" => $workTimeDayOff, "WORKTIME_TIMEZONE" => $post["WORKTIME_TIMEZONE"], "WORKTIME_DAYOFF_RULE" => $post["WORKTIME_DAYOFF_RULE"], "WORKTIME_DAYOFF_NUMBER" => $post["WORKTIME_DAYOFF_NUMBER"], "WORKTIME_DAYOFF_MELODY" => $post["WORKTIME_DAYOFF_MELODY"]); $post["QUEUE"] = is_array($post["QUEUE"]) ? $post["QUEUE"] : array(); $post["QUEUE"]["U"] = is_array($post["QUEUE"]["U"]) ? $post["QUEUE"]["U"] : array(); $queue = array(); if (is_array($post["QUEUE"]) && is_array($post["QUEUE"]["U"])) { foreach ($post["QUEUE"] as $type => $k) { $queue[$type] = str_replace($type, "", $k); } } if ($skipSaving) { $error = $viSip->GetError()->msg; } else { if (($res = Bitrix\Voximplant\ConfigTable::update($arParams["ID"], $arFields)) && $res->isSuccess()) { // TODO We should work with other socialnetwork entities $toDrop = array_diff($arResult["~QUEUE"], $queue["U"]); $toAdd = array_diff($queue["U"], array_keys($arResult["QUEUE"])); foreach ($toDrop as $primary => $id) { Bitrix\Voximplant\QueueTable::delete($primary); } foreach ($toAdd as $k) { Bitrix\Voximplant\QueueTable::add(array("CONFIG_ID" => $arParams["ID"], "USER_ID" => $k, "STATUS" => "OFFLINE")); } LocalRedirect(CVoxImplantMain::GetPublicFolder() . 'lines.php?MODE=' . $arResult["ITEM"]["PORTAL_MODE"]); } $error = $res->getErrorMessages(); } $arResult = array("ERROR" => $error, "ITEM" => array_merge($arResult["ITEM"], $arFields), "QUEUE" => array_flip($queue["U"]), "SIP_CONFIG" => array_merge($arResult["SIP_CONFIG"], $arFieldsSip)); }