예제 #1
0
 /**
  * @param                           $value
  * @param \Bitrix\Main\Entity\Field $field
  * @param null                      $errorPhrase
  *
  * @return mixed
  */
 protected function getErrorMessage($value, Entity\Field $field, $errorPhrase = null)
 {
     if ($errorPhrase === null) {
         $errorPhrase = $this->errorPhrase;
     }
     $langValues = array('#VALUE#' => $value, '#FIELD_NAME#' => $field->getName(), '#FIELD_TITLE#' => $field->getTitle());
     if (HasMessage($errorPhrase)) {
         return GetMessage($errorPhrase, $langValues);
     } else {
         return str_replace(array_keys($langValues), array_values($langValues), $errorPhrase);
     }
 }
예제 #2
0
 /**
  * Returns action response XML
  *
  * @param string $action
  * @return CDataXML
  * @throws CBitrixCloudException
  */
 protected function action($action)
 {
     /* @var CMain $APPLICATION */
     global $APPLICATION;
     $url = $this->getActionURL(array("action" => $action, "debug" => $this->debug ? "y" : "n"));
     $this->server = new CHTTP();
     if ($this->timeout > 0) {
         $this->server->http_timeout = $this->timeout;
     }
     $strXML = $this->server->Get($url);
     if ($strXML === false) {
         $e = $APPLICATION->GetException();
         if (is_object($e)) {
             throw new CBitrixCloudException($e->GetString(), "");
         } else {
             throw new CBitrixCloudException(GetMessage("BCL_CDN_WS_SERVER", array("#STATUS#" => "-1")), "");
         }
     }
     if ($this->server->status != 200) {
         throw new CBitrixCloudException(GetMessage("BCL_CDN_WS_SERVER", array("#STATUS#" => (string) $this->server->status)), "");
     }
     $obXML = new CDataXML();
     if (!$obXML->LoadString($strXML)) {
         throw new CBitrixCloudException(GetMessage("BCL_CDN_WS_XML_PARSE", array("#CODE#" => "1")), "");
     }
     $node = $obXML->SelectNodes("/error/code");
     if (is_object($node)) {
         $error_code = $node->textContent();
         $message_id = "BCL_CDN_WS_" . $error_code;
         /*
         GetMessage("BCL_CDN_WS_LICENSE_EXPIRE");
         GetMessage("BCL_CDN_WS_LICENSE_NOT_FOUND");
         GetMessage("BCL_CDN_WS_QUOTA_EXCEEDED");
         GetMessage("BCL_CDN_WS_CMS_LICENSE_NOT_FOUND");
         GetMessage("BCL_CDN_WS_DOMAIN_NOT_REACHABLE");
         GetMessage("BCL_CDN_WS_LICENSE_DEMO");
         GetMessage("BCL_CDN_WS_LICENSE_NOT_ACTIVE");
         GetMessage("BCL_CDN_WS_NOT_POWERED_BY_BITRIX_CMS");
         GetMessage("BCL_CDN_WS_WRONG_DOMAIN_SPECIFIED");
         */
         $debug_content = "";
         $node = $obXML->SelectNodes("/error/debug");
         if (is_object($node)) {
             $debug_content = $node->textContent();
         }
         if (HasMessage($message_id)) {
             throw new CBitrixCloudException(GetMessage($message_id), $error_code, $debug_content);
         } else {
             throw new CBitrixCloudException(GetMessage("BCL_CDN_WS_SERVER", array("#STATUS#" => $error_code)), $error_code, $debug_content);
         }
     }
     return $obXML;
 }
예제 #3
0
 /**
  * Returns action response XML
  *
  * @param string $action
  * @return CDataXML
  *
  */
 protected function action($action)
 {
     global $APPLICATION;
     $url = $this->getActionURL(array("action" => $action));
     $server = new CHTTP();
     $strXML = $server->Get($url);
     if ($strXML === false) {
         $e = $APPLICATION->GetException();
         if (is_object($e)) {
             throw new CBitrixCloudException($e->GetString(), "");
         } else {
             throw new CBitrixCloudException(GetMessage("BCL_CDN_WS_SERVER", array("#STATUS#" => "-1")), "");
         }
     }
     if ($server->status != 200) {
         throw new CBitrixCloudException(GetMessage("BCL_CDN_WS_SERVER", array("#STATUS#" => (string) $server->status)), "");
     }
     $obXML = new CDataXML();
     if (!$obXML->LoadString($strXML)) {
         throw new CBitrixCloudException(GetMessage("BCL_CDN_WS_XML_PARSE", array("#CODE#" => "1")), "");
     }
     $node = $obXML->SelectNodes("/error/code");
     if (is_object($node)) {
         $error_code = $node->textContent();
         $message_id = "BCL_CDN_WS_" . $error_code;
         /*
         GetMessage("BCL_CDN_WS_LICENSE_EXPIRE");
         GetMessage("BCL_CDN_WS_LICENSE_NOT_FOUND");
         GetMessage("BCL_CDN_WS_QUOTA_EXCEEDED");
         */
         if (HasMessage($message_id)) {
             throw new CBitrixCloudException(GetMessage($message_id), $error_code);
         } else {
             throw new CBitrixCloudException(GetMessage("BCL_CDN_WS_SERVER", array("#STATUS#" => $error_code)), $error_code);
         }
     }
     return $obXML;
 }
예제 #4
0
    }
    if ($uptimeRate < 1 && $saleIncluded) {
        $base = CCurrency::GetBaseCurrency();
        $r = CSaleOrder::GetList(array(), array(">=DATE_INSERT" => ConvertTimeStamp(time() - $monitoring->getInterval() * 24 * 3400, "SHORT")), array("LID", "CURRENCY", "SUM" => "PRICE"));
        while ($a = $r->fetch()) {
            $sum += CCurrencyRates::ConvertCurrency($a["PRICE"], $a["CURRENCY"], $base);
        }
        $sum *= 1 - $uptimeRate;
        if ($sum <= 0.0) {
            $sumHtml = number_format((1 - $uptimeRate) * 100, 2, '.', ' ') . "%";
            $alertIntervalText = $intervalLang["uptime"][$monitoring->getInterval()];
        } else {
            $sumHtml = CurrencyFormat($sum, $base);
            $alertIntervalText = $intervalLang["sale"][$monitoring->getInterval()];
        }
    } elseif ($testCount === 1 && HasMessage("GD_BITRIXCLOUD_MONITOR_" . strtoupper($testAlert->getName()))) {
        $uptimeRate = 1;
        $resultText = FormatDate("ddiff", time(), $testAlert->getResult());
        $sumHtml = GetMessage("GD_BITRIXCLOUD_MONITOR_" . strtoupper($testAlert->getName()), array("#DOMAIN#" => $converter->Decode($testDomain), "#DAYS#" => $resultText));
    } elseif ($uptimeRate < 1) {
        $sumHtml = number_format((1 - $uptimeRate) * 100, 2, '.', ' ') . "%";
        $alertIntervalText = $intervalLang["uptime"][$monitoring->getInterval()];
    } else {
        $sumHtml = GetMessage("GD_BITRIXCLOUD_MONITOR_PROBLEMS", array("#COUNT#" => $testCount));
    }
}
?>
<div class="bx-gadgets-content-layout-inspector">
	<div class="bx-gadgets-title"><?php 
echo GetMessage("GD_BITRIXCLOUD_MONITOR");
?>
예제 #5
0
 public static function checkFields($data, $action = 'update', $throwException = false)
 {
     if ($action === 'add') {
         static::checkFieldsBeforeAdd($data, true);
     } elseif ($action === 'update') {
         static::checkFieldsBeforeUpdate($data, true);
     } else {
         throw new \Exception(sprintf('Unknown action "%s" for %s', $action, __METHOD__));
     }
     // check data - fieldname & type & strlen etc.
     foreach ($data as $k => $v) {
         if (static::getEntity()->hasField($k) && static::getEntity()->getField($k) instanceof ScalarField) {
             $field = static::getEntity()->getField($k);
         } elseif (static::getEntity()->hasUField($k)) {
             // should be continue
             // checking is inside uf manager
             $field = static::getEntity()->getUField($k);
         } else {
             throw new \Exception(sprintf('Field `%s` not found in entity when trying to update %s row.', $k, static::getEntity()->getName()));
         }
         if (!$field->validateValue($v)) {
             // get message from entity
             $errMsgCode = $field->getLangCode() . '_INVALID';
             if (!HasMessage($errMsgCode)) {
                 // get default message
                 $errMsgCode = 'MAIN_ENTITY_FIELD_INVALID';
             }
             $errMsgText = GetMessage($errMsgCode, array("#FIELD_NAME#" => $field->getName(), "#FIELD_TITLE#" => $field->getLangText()));
             static::registerError($errMsgText, $throwException, $field->getName());
         }
     }
     if (!$throwException) {
         return static::getErrors();
     }
     /*if (static::getEntity()->getUfId() !== null)
     		{
     			$scalar_row_id = is_array($primary) && count($primary) == 1 ? end($primary) : null;
     
     			if (!$GLOBALS["USER_FIELD_MANAGER"]->CheckFields(static::getEntity()->getUfId(), $scalar_row_id, $data))
     			{
     				global $APPLICATION;
     
     				if(is_object($APPLICATION) && $APPLICATION->GetException())
     				{
     					$e = $APPLICATION->GetException();
     					static::registerError($e->GetString(), $throwException);
     					$APPLICATION->ResetException();
     				}
     				else
     				{
     					static::registerError('Unknown error', $throwException);
     				}
     			}
     		}*/
 }
예제 #6
0
파일: field.php 프로젝트: nProfessor/Mytb
 public function getLangText()
 {
     return HasMessage($this->getLangCode()) ? GetMessage($this->getLangCode()) : $this->getName();
 }
예제 #7
0
 foreach ($arResult["ITEMS"] as $domain => $info) {
     $arData = array();
     $arData["DETAIL_LINK"] = $info["DETAIL_LINK"];
     $domain = $converter->Decode($domain);
     $arData["TITLE"] = $domain;
     $arData["ID"] = md5($domain);
     if (isset($info["PROBLEM"]) && ($info["PROBLEM"] = true)) {
         $arData["TITLE_COLOR"] = "RED";
     } else {
         $arData["FOLDED"] = true;
     }
     foreach ($info as $paramId => $param) {
         if ($paramId == "HTTP_RESPONSE_TIME") {
             $arData['BOTTOM']['LEFT'] = GetMessage("BCLMMSL_MONITORING_HTTP_RESPONSE_TIME") . ": " . $param["DATA"];
         } else {
             if (HasMessage("BCLMMSL_MONITORING_" . $paramId)) {
                 $content = GetMessage("BCLMMSL_MONITORING_" . $paramId) . ": ";
                 if (isset($param["PROBLEM"]) && $param["PROBLEM"] == true) {
                     $content .= '<span style="color:red">' . $param["DATA"] . '</span>';
                 } else {
                     $content .= $param["DATA"];
                 }
                 $arData["ROW"][] = array("CONTENT" => $content, "TYPE" => "BULLET");
             }
         }
     }
     if (!isset($arData['BOTTOM']['LEFT'])) {
         $arData['BOTTOM']['LEFT'] = GetMessage("BCLMMSL_MONITORING_HTTP_RESPONSE_TIME") . ": " . GetMessage("BCLMMSL_NO_DATA");
     }
     $arParamsMAL["ITEMS"][] = $arData;
 }
예제 #8
0
											--><span class="pulse-num pulse-num-<?php 
    echo $number['code'];
    ?>
"><?php 
    echo $number['char'];
    ?>
</span><!--
										--><?php 
}
?>
									</span>
						</td>
						<td class="pulse-info-cell pulse-info-cell-center">
									<span class="pulse-info-involve-text">
										<?php 
if (HasMessage('INTRANET_USTAT_COMPANY_INV_BAR_' . $arResult['SECTION'])) {
    ?>
											<?php 
    echo GetMessage('INTRANET_USTAT_COMPANY_INV_BAR_' . $arResult['SECTION']);
    ?>
										<?php 
} else {
    ?>
											<?php 
    echo GetMessage('INTRANET_USTAT_COMPANY_INV_BAR_TOTAL');
    ?>
										<?php 
}
?>
										<span class="pulse-info-index-info" id="pulse-company-involvement-help-icon"></span>
									</span>
예제 #9
0
 protected static function attachLangToColumnTree(&$tree, $initEntity, $helper_class, $preTitle = array())
 {
     foreach ($tree as &$treeElem) {
         $ownerId = call_user_func(array($helper_class, 'getOwnerId'));
         if (!empty($treeElem['field'])) {
             // first: report-defined lang
             $rElementTitle = 'REPORT_' . $ownerId . '_' . $treeElem['fieldName'];
             // second: entity-defined lang
             $eElementTitle = $treeElem['field']->getLangCode();
             $elementTitle = HasMessage($rElementTitle) ? $rElementTitle : $eElementTitle;
         } else {
             // virtual field - subtree head
             $elementName = $treeElem['fieldName'];
             $elementTitle = 'REPORT_' . $ownerId . '_COLUMN_TREE_' . $elementName;
         }
         // PRCNT hack should not be here
         if (substr($elementTitle, -12) == '_PRCNT_FIELD') {
             $humanTitle = GetMessage(substr($elementTitle, 0, -12) . '_FIELD');
         } else {
             $humanTitle = GetMessage($elementTitle);
         }
         if (empty($humanTitle)) {
             $humanTitle = $treeElem['fieldName'];
         }
         if (substr($elementTitle, -12) == '_PRCNT_FIELD') {
             $humanTitle .= ' (%)';
         }
         if (empty($treeElem['branch'])) {
             $fullHumanTitle = $humanTitle;
             if (!empty($preTitle)) {
                 $fullHumanTitle = join(': ', $preTitle) . ': ' . $fullHumanTitle;
             }
             $treeElem['humanTitle'] = $humanTitle;
             $treeElem['fullHumanTitle'] = $fullHumanTitle;
         } else {
             $treeElem['humanTitle'] = $humanTitle;
             $treeElem['fullHumanTitle'] = $humanTitle;
             $sendPreTitle = array($humanTitle);
             self::attachLangToColumnTree($treeElem['branch'], $initEntity, $helper_class, $sendPreTitle);
         }
     }
 }
예제 #10
0
 /**
  * @param string $baseMessageKey
  * @param array $placeholders
  * @return string
  */
 protected static function getTitleText($baseMessageKey, array $placeholders = array())
 {
     if (HasMessage($baseMessageKey)) {
         $result = GetMessage($baseMessageKey, $placeholders);
     } else {
         $result = "";
     }
     return $result;
 }
예제 #11
0
 /**
  * @deprecated Use getTitle instead
  * @return mixed|string
  */
 public function getLangText()
 {
     if ($this->title !== null) {
         return $this->title;
     }
     return HasMessage($this->getLangCode()) ? GetMessage($this->getLangCode()) : $this->getName();
 }
예제 #12
0
    $dbSalesList = CCrmExternalSale::GetList(array(), array("ACTIVE" => "Y"));
    $enableWebStore = $dbSalesList->Fetch() !== false;
}
if ($enableWebStore) {
    $arResult['FIELDS']['tab_details'][] = array('id' => 'section_web_store', 'name' => GetMessage('CRM_SECTION_WEB_STORE'), 'type' => 'section');
    $arResult['FIELDS']['tab_details'][] = array('id' => 'SALE_ORDER', 'name' => GetMessage('CRM_FIELD_SALE_ORDER1'), 'type' => 'custom', 'value' => isset($strEditOrderHtml[0]) ? $strEditOrderHtml : htmlspecialcharsbx(GetMessage('MAIN_NO')));
}
// <-- WEB-STORE SECTION
if ($enableWebStore) {
    $strAdditionalInfoHtml = '';
    if ($isExternal && isset($arResult['ELEMENT']['ADDITIONAL_INFO'])) {
        $arAdditionalInfo = unserialize($arResult['ELEMENT']['~ADDITIONAL_INFO']);
        if (is_array($arAdditionalInfo) && count($arAdditionalInfo) > 0) {
            foreach ($arAdditionalInfo as $k => $v) {
                $msgID = 'CRM_SALE_' . $k;
                $k1 = HasMessage($msgID) ? GetMessage($msgID) : $k;
                if (is_bool($v)) {
                    $v = $v ? GetMessage('CRM_SALE_YES') : GetMessage('CRM_SALE_NO');
                }
                $strAdditionalInfoHtml .= '<span>' . htmlspecialcharsbx($k1) . '</span>: <span>' . htmlspecialcharsbx($v) . '</span><br/>';
            }
        }
    }
    $arResult['FIELDS']['tab_1'][] = array('id' => 'ADDITIONAL_INFO', 'name' => GetMessage('CRM_FIELD_ADDITIONAL_INFO'), 'type' => 'custom', 'value' => isset($strAdditionalInfoHtml[0]) ? $strAdditionalInfoHtml : htmlspecialcharsbx(GetMessage('MAIN_NO')));
}
// PRODUCT ROW SECTION -->
$arResult['FIELDS'][$arResult['PRODUCT_ROW_TAB_ID']][] = array('id' => 'section_product_rows', 'name' => GetMessage('CRM_SECTION_PRODUCT_ROWS'), 'type' => 'section');
$APPLICATION->AddHeadScript($this->GetPath() . '/sale.js');
$sProductsHtml = '<script type="text/javascript">var extSaleGetRemoteFormLocal = {"PRINT":"' . GetMessage("CRM_EXT_SALE_DEJ_PRINT") . '","SAVE":"' . GetMessage("CRM_EXT_SALE_DEJ_SAVE") . '","ORDER":"' . GetMessage("CRM_EXT_SALE_DEJ_ORDER") . '","CLOSE":"' . GetMessage("CRM_EXT_SALE_DEJ_CLOSE") . '"};</script>';
if ($isExternal) {
    $sProductsHtml .= '<input type="button" value="' . GetMessage("CRM_EXT_SALE_CD_EDIT") . '" onclick="ExtSaleGetRemoteForm(' . $arResult['ELEMENT']['ORIGINATOR_ID'] . ', \'EDIT\', ' . $arResult['ELEMENT']['ORIGIN_ID'] . ')">
예제 #13
0
 }
 $lAdmin->AddHeaders($arHeaders);
 $rsData = new CDBResult();
 $rsData->InitFromArray($arJobs);
 $rsData = new CAdminResult($rsData, $sTableID);
 while ($arRes = $rsData->GetNext()) {
     $row = $lAdmin->AddRow($arRes["URL"], $arRes);
     if ($arRes["STATUS"] == "") {
         $status = GetMessage("BCL_BACKUP_JOB_NEVER");
     } else {
         $status = $arRes["STATUS"];
     }
     $row->AddViewField("STATUS", $status);
     $week_days = array();
     foreach ($arRes["WEEK_DAYS"] as $dow) {
         if (HasMessage("DOW_" . $dow)) {
             $week_days[] = GetMessage("DOW_" . $dow);
         }
     }
     $row->AddViewField("WEEK_DAYS", implode(", ", $week_days));
     if ($_GET["allow_manage"] === "y") {
         $arActions = array(array("ICON" => "delete", "TEXT" => GetMessage("BCL_BACKUP_JOB_DELETE"), "ACTION" => "if(confirm('" . GetMessage("BCL_BACKUP_JOB_DELETE_CONF") . "')) " . $lAdmin->ActionDoGroup($arRes["URL"], "delete")));
         $row->AddActions($arActions);
     }
 }
 if (empty($arJobs) && $_GET["allow_manage"] === "y") {
     $aContext = array(array("TEXT" => GetMessage("BCL_BACKUP_JOB_ADD"), "LINK" => "javascript:show_upload_form()", "TITLE" => "", "ICON" => "btn_new"));
     $lAdmin->AddAdminContextMenu($aContext, false);
     $lAdmin->BeginPrologContent();
     if ($strError) {
         CAdminMessage::ShowMessage($strError);
예제 #14
0
 /**
  * @param string $pBaseMessageKey
  * @return string
  */
 protected static function getTitleText($pBaseMessageKey)
 {
     if (HasMessage($pBaseMessageKey)) {
         $result = GetMessage($pBaseMessageKey);
     } else {
         $result = "";
     }
     return $result;
 }
예제 #15
0
    return;
}
if (!CModule::IncludeModule('mobileapp')) {
    ShowError(GetMessage("SMOP_MA_NOT_INSTALLED"));
    return;
}
$arResult = array("CURRENT_PAGE" => $APPLICATION->GetCurPage(), "AJAX_URL" => $componentPath . "/ajax.php", "EVENTS" => array());
$arEvents = CSaleMobileOrderPush::getEvents();
$arSubscribedEvents = CSaleMobileOrderPush::getSubscriptions($userId);
$bSubscribedEarlier = !empty($arSubscribedEvents) ? true : false;
$subscribedAll = 'Y';
foreach ($arEvents as $eventId) {
    if ($bSubscribedEarlier) {
        if (isset($arSubscribedEvents[$eventId]) && $arSubscribedEvents[$eventId] == 'Y') {
            $subscribed = true;
        } else {
            $subscribed = false;
        }
        if ($subscribedAll == 'Y' && !$subscribed) {
            $subscribedAll = 'N';
        }
    } else {
        $subscribed = true;
    }
    if (HasMessage("SMOP_EVNT_" . $eventId)) {
        $arResult["EVENTS"][$eventId] = array("TITLE" => GetMessage("SMOP_EVNT_" . $eventId), "SUBSCRIBED" => $subscribed);
    }
}
$arResult["SUBSCRIBED_ALL"] = $subscribedAll;
CJSCore::Init('ajax');
$this->IncludeComponentTemplate();
	}
	$oFilter = new CAdminFilter($sTableID."_filter", $arFindFields);
	$oFilter->Begin();

	foreach($sDataClassName::getEntity()->getFields() as $field)
	{
		if(
			($field instanceof Bitrix\Main\Entity\ScalarField || $field instanceof Bitrix\Main\Entity\ExpressionField)
			&& in_array($field->getColumnName(), $arFilterFields)
		)
		{
			$id = $field->getColumnName();
			$fieldName = "find_" . $id;

			?><tr>
				<td><? echo HasMessage($module_id . "_FILTER_" . $id)
					? GetMessage($module_id . "_FILTER_" . $id)
					: $field->getTitle();
				?>:</td>
				<td><?

				if($field instanceof Bitrix\Main\Entity\BooleanField)
				{
					$arr = array(
						"REFERENCE_ID" => array(),
						"REFERENCE" => array(),
					);
					foreach($field->getValues() as $val)
					{
						$arr["REFERENCE"][] = ($val == "Y" ? GetMessage("MAIN_YES") : ($val == "N" ? GetMessage("MAIN_NO") : $val));
						$arr["REFERENCE_ID"][] = $val;