本文整理汇总了PHP中Bitrix\Main\Localization\Loc类的典型用法代码示例。如果您正苦于以下问题:PHP Loc类的具体用法?PHP Loc怎么用?PHP Loc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Loc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEditHtml
/**
* @inheritdoc
*/
protected function getEditHtml()
{
$style = $this->getSettings('STYLE');
$size = $this->getSettings('SIZE');
$link = '';
if ($this->getSettings('TRANSLIT')) {
//TODO: refactor this!
$uniqId = get_class($this->entityName) . '_' . $this->getCode();
$nameId = 'name_link_' . $uniqId;
$linkedFunctionName = 'set_linked_' . get_class($this->entityName) . '_CODE';
//FIXME: hardcode here!!!
if (isset($this->entityName->{$this->entityName->pk()})) {
$pkVal = $this->entityName->{$this->entityName->pk()};
} else {
$pkVal = '_new_';
}
$nameId .= $pkVal;
$linkedFunctionName .= $pkVal;
$link = '<image id="' . $nameId . '" title="' . Loc::getMessage("IBSEC_E_LINK_TIP") . '" class="linked" src="/bitrix/themes/.default/icons/iblock/link.gif" onclick="' . $linkedFunctionName . '()" />';
}
return '<input type="text"
name="' . $this->getEditInputName() . '"
value="' . static::prepareToTagAttr($this->getValue()) . '"
size="' . $size . '"
style="' . $style . '"/>' . $link;
}
示例2: getComboBox
/**
* Возвращает ХТМЛ-код с комбобоксом.
*
* @param bool $multiple Множественный режим.
* @param bool $forFilter Комбобокс будет выводиться в блоке с фильтром.
*
* @return string
*/
protected function getComboBox($multiple = false, $forFilter = false)
{
if ($multiple) {
$value = $this->getMultipleValue();
} else {
$value = $this->getValue();
}
$style = $this->getSettings('STYLE');
$variants = $this->getVariants();
if (!$multiple) {
array_unshift($variants, array('ID' => null, 'TITLE' => null));
}
if (empty($variants)) {
$comboBox = Loc::getMessage('DIGITALWAND_AH_MISSING_VARIANTS');
} else {
$name = $forFilter ? $this->getFilterInputName() : $this->getEditInputName();
$comboBox = '<select name="' . $name . ($multiple ? '[]' : null) . '"
' . ($multiple ? 'multiple="multiple"' : null) . '
style="' . $style . '">';
foreach ($variants as $variant) {
$selected = false;
if ($variant['ID'] == $value) {
$selected = true;
}
if ($multiple && in_array($variant['ID'], $value)) {
$selected = true;
} elseif ($variant['ID'] === $value) {
$selected = true;
}
$comboBox .= "<option value='" . static::prepareToTagAttr($variant['ID']) . "' " . ($selected ? "selected" : "") . ">" . static::prepareToTagAttr($variant['TITLE']) . "</option>";
}
$comboBox .= '</select>';
}
return $comboBox;
}
示例3: getDataToShow
public function getDataToShow()
{
$event = \CCalendarEvent::getById($this->entityId);
if (empty($event)) {
return array();
}
$members = array();
if ($event['IS_MEETING']) {
if (is_array($event['~ATTENDEES'])) {
foreach ($event['~ATTENDEES'] as $user) {
$members[] = array("NAME" => $user['DISPLAY_NAME'], "LINK" => \CComponentEngine::makePathFromTemplate($this->getPathToUser(), array("user_id" => $user['USER_ID'])), 'AVATAR_SRC' => $user['AVATAR'], "IS_EXTRANET" => "N");
}
}
} else {
$by = "id";
$order = "asc";
$userRow = \CUser::getList($by, $order, array("ID_EQUAL_EXACT" => $event['CREATED_BY'], "ACTIVE" => "Y"), array("SELECT" => array('ID', 'NAME', 'LAST_NAME', 'LOGIN', 'PERSONAL_PHOTO')))->fetch();
if ($userRow) {
$name = trim($userRow['NAME'] . ' ' . $userRow['LAST_NAME']);
if ($name == '') {
$name = trim($userRow['LOGIN']);
}
$members[] = array("NAME" => $name, "LINK" => \CComponentEngine::makePathFromTemplate($this->getPathToUser(), array("user_id" => $event['CREATED_BY'])), 'AVATAR_SRC' => Ui\Avatar::getPerson($userRow['PERSONAL_PHOTO']), "IS_EXTRANET" => "N");
}
}
return array('TITLE' => Loc::getMessage('DISK_UF_CAL_EVENT_CONNECTOR_TITLE') . ": " . $event['NAME'], 'DETAIL_URL' => null, 'DESCRIPTION' => Ui\Text::killTags($event['DESCRIPTION']), 'MEMBERS' => $members);
}
示例4: showTab
public static function showTab($div, $iblockElementInfo)
{
$engineList = array();
if (Option::get('main', 'vendor', '') == '1c_bitrix') {
$engineList[] = array("DIV" => "yandex_direct", "TAB" => Loc::getMessage("SEO_ADV_YANDEX_DIRECT"), "TITLE" => Loc::getMessage("SEO_ADV_YANDEX_DIRECT_TITLE"), "HANDLER" => IO\Path::combine(Application::getDocumentRoot(), BX_ROOT, "/modules/seo/admin/tab/seo_search_yandex_direct.php"));
}
if (count($engineList) > 0) {
$engineTabControl = new \CAdminViewTabControl("engineTabControl", $engineList);
?>
<tr>
<td colspan="2">
<?php
$engineTabControl->begin();
foreach ($engineList as $engineTab) {
$engineTabControl->beginNextTab();
$file = new IO\File($engineTab["HANDLER"]);
if ($file->isExists()) {
require $file->getPath();
}
}
$engineTabControl->end();
?>
</td>
</tr>
<?php
}
}
示例5: GetSettingsHTML
public function GetSettingsHTML($arFields, $strHTMLControlName, &$arPropertyFields)
{
$arPropertyFields = array("HIDE" => array("ROW_COUNT", "COL_COUNT", "MULTIPLE_CNT", "MULTIPLE"), "SET" => array("MULTIPLE" => "N"), 'USER_TYPE_SETTINGS_TITLE' => Loc::getMessage('BT_UT_SKU_SETTING_TITLE'));
$arSettings = self::PrepareSettings($arFields);
if (isset($arSettings['USER_TYPE_SETTINGS'])) {
$arSettings = $arSettings['USER_TYPE_SETTINGS'];
}
$strResult = '<tr>
<td>' . Loc::getMessage('BT_UT_SKU_SETTING_VIEW') . '</td>
<td>' . SelectBoxFromArray($strHTMLControlName["NAME"] . '[VIEW]', self::GetPropertyViewsList(true), htmlspecialcharsbx($arSettings['VIEW'])) . '</td>
</tr>
<tr>
<td>' . Loc::getMessage('BT_UT_SKU_SETTING_MAX_WIDTH') . '</td>
<td><input type="text" name="' . $strHTMLControlName["NAME"] . '[MAX_WIDTH]" value="' . intval($arSettings['MAX_WIDTH']) . '"> ' . Loc::getMessage('BT_UT_SKU_SETTING_COMMENT_MAX_WIDTH') . '</td>
</tr>
<tr>
<td>' . Loc::getMessage('BT_UT_SKU_SETTING_MIN_HEIGHT') . '</td>
<td><input type="text" name="' . $strHTMLControlName["NAME"] . '[MIN_HEIGHT]" value="' . intval($arSettings['MIN_HEIGHT']) . '"> ' . Loc::getMessage('BT_UT_SKU_SETTING_COMMENT_MIN_HEIGHT') . '</td>
</tr>
<tr>
<td>' . Loc::getMessage('BT_UT_SKU_SETTING_MAX_HEIGHT') . '</td>
<td><input type="text" name="' . $strHTMLControlName["NAME"] . '[MAX_HEIGHT]" value="' . intval($arSettings['MAX_HEIGHT']) . '"> ' . Loc::getMessage('BT_UT_SKU_SETTING_COMMENT_MAX_HEIGHT') . '</td>
</tr>
<tr>
<td>' . Loc::getMessage('BT_UT_SKU_SETTING_BAN_SYMBOLS') . '</td>
<td><input type="text" name="' . $strHTMLControlName["NAME"] . '[BAN_SYM]" value="' . htmlspecialcharsbx($arSettings['BAN_SYM']) . '"></td>
</tr>
<tr>
<td>' . Loc::getMessage('BT_UT_SKU_SETTING_REP_SYMBOL') . '</td>
<td>' . SelectBoxFromArray($strHTMLControlName["NAME"] . '[REP_SYM]', parent::GetReplaceSymList(true), htmlspecialcharsbx($arSettings['REP_SYM'])) . ' <input type="text" name="' . $strHTMLControlName["NAME"] . '[OTHER_REP_SYM]" size="1" maxlength="1" value="' . $arSettings['OTHER_REP_SYM'] . '"></td>
</tr>';
return $strResult;
}
示例6: onBeforeHTMLEditorScriptRuns
public static function onBeforeHTMLEditorScriptRuns()
{
$asset = Asset::getInstance();
$asset->addJs('/bitrix/js/newkaliningrad.typografru/typograf.js');
$messages = Loc::loadLanguageFile(Path::normalize(__FILE__));
$asset->addString(sprintf('<script>BX.message(%s)</script>', Json::encode($messages, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE)));
}
示例7: onGetRateTypes
public static function onGetRateTypes()
{
$scale = array(0.5, 1, 1.5, 2, 5);
$format = array('SUM' => function ($value, $format = null) {
return Config::formatToBaseCurrency($value, $format);
});
$units = array('SUM' => Config::getBaseCurrencyUnit());
// TODO deprecated
return array('sale_payment' => array('NAME' => Loc::getMessage('SALE_CONVERSION_RATE_PAYMENT_NAME'), 'SCALE' => $scale, 'FORMAT' => $format, 'UNITS' => $units, 'MODULE' => 'sale', 'SORT' => 1100, 'COUNTERS' => array('conversion_visit_day', 'sale_payment_add_day', 'sale_payment_sum_add'), 'CALCULATE' => function (array $counters) {
$denominator = $counters['conversion_visit_day'] ?: 0;
$numerator = $counters['sale_payment_add_day'] ?: 0;
$sum = $counters['sale_payment_sum_add'] ?: 0;
return array('DENOMINATOR' => $denominator, 'NUMERATOR' => $numerator, 'RATE' => $denominator ? $numerator / $denominator : 0, 'SUM' => $sum);
}), 'sale_order' => array('NAME' => Loc::getMessage('SALE_CONVERSION_RATE_ORDER_NAME'), 'SCALE' => $scale, 'FORMAT' => $format, 'UNITS' => $units, 'MODULE' => 'sale', 'SORT' => 1200, 'COUNTERS' => array('conversion_visit_day', 'sale_order_add_day', 'sale_order_sum_add'), 'CALCULATE' => function (array $counters) {
$denominator = $counters['conversion_visit_day'] ?: 0;
$numerator = $counters['sale_order_add_day'] ?: 0;
$sum = $counters['sale_order_sum_add'] ?: 0;
return array('DENOMINATOR' => $denominator, 'NUMERATOR' => $numerator, 'RATE' => $denominator ? $numerator / $denominator : 0, 'SUM' => $sum);
}), 'sale_cart' => array('NAME' => Loc::getMessage('SALE_CONVERSION_RATE_CART_NAME'), 'SCALE' => $scale, 'FORMAT' => $format, 'UNITS' => $units, 'MODULE' => 'sale', 'SORT' => 1300, 'COUNTERS' => array('conversion_visit_day', 'sale_cart_add_day', 'sale_cart_sum_add'), 'CALCULATE' => function (array $counters) {
$denominator = $counters['conversion_visit_day'] ?: 0;
$numerator = $counters['sale_cart_add_day'] ?: 0;
$sum = $counters['sale_cart_sum_add'] ?: 0;
return array('DENOMINATOR' => $denominator, 'NUMERATOR' => $numerator, 'RATE' => $denominator ? $numerator / $denominator : 0, 'SUM' => $sum);
}));
}
示例8: getLocalizedMessage
public function getLocalizedMessage()
{
Main\Localization\Loc::loadMessages(__FILE__);
$code = $this->getCode();
$entityTypeID = $this->getTargetEntityTypeID();
$entityTypeName = \CCrmOwnerType::ResolveName($entityTypeID);
if ($code === EntityConversionException::NOT_FOUND) {
return GetMessage("CRM_CONV_EX_{$entityTypeName}_NOT_FOUND");
} elseif ($code === EntityConversionException::EMPTY_FIELDS) {
return GetMessage("CRM_CONV_EX_{$entityTypeName}_EMPTY_FIELDS");
} elseif ($code === EntityConversionException::HAS_WORKFLOWS) {
return GetMessage("CRM_CONV_EX_{$entityTypeName}_HAS_WORKFLOWS");
} elseif ($code === EntityConversionException::AUTOCREATION_DISABLED) {
return GetMessage("CRM_CONV_EX_{$entityTypeName}_AUTOCREATION_DISABLED");
} elseif ($code === EntityConversionException::INVALID_FIELDS) {
return GetMessage("CRM_CONV_EX_{$entityTypeName}_INVALID_FIELDS") . preg_replace('/<br\\s*\\/?>/i', "\r\n", $this->extMessage);
} elseif ($code === EntityConversionException::CREATE_DENIED) {
return GetMessage("CRM_CONV_EX_{$entityTypeName}_CREATE_DENIED");
} elseif ($code === EntityConversionException::CREATE_FAILED) {
return GetMessage("CRM_CONV_EX_{$entityTypeName}_CREATE_FAILED") . preg_replace('/<br\\s*\\/?>/i', "\r\n", $this->extMessage);
} elseif ($code === EntityConversionException::READ_DENIED) {
return GetMessage("CRM_CONV_EX_{$entityTypeName}_READ_DENIED");
} elseif ($code === EntityConversionException::UPDATE_DENIED) {
return GetMessage("CRM_CONV_EX_{$entityTypeName}_UPDATE_DENIED");
} elseif ($code === EntityConversionException::NOT_SUPPORTED) {
return GetMessage('CRM_CONV_EX_ENTITY_NOT_SUPPORTED', array('#ENTITY_TYPE_NAME#' => \CCrmOwnerType::GetDescription($entityTypeID)));
}
return $this->getMessage();
}
示例9: getGridData
private function getGridData($gridId)
{
$grid = array('ID' => $gridId);
$securityContext = $this->storage->getCurrentUserSecurityContext();
$parameters = array('with' => array('FILE', 'CREATE_USER'), 'filter' => array('IS_EXPIRED' => false, 'OBJECT.STORAGE_ID' => $this->storage->getId(), 'CREATED_BY' => $this->getUser()->getId()));
$parameters = Driver::getInstance()->getRightsManager()->addRightsCheck($securityContext, $parameters, array('OBJECT_ID', 'OBJECT.CREATED_BY'));
$items = ExternalLink::getModelList($parameters);
Collection::sortByColumn($items, array('CREATE_TIME' => array(SORT_NUMERIC, SORT_ASC)));
$urlManager = Driver::getInstance()->getUrlManager();
$rows = array();
foreach ($items as $externalLink) {
/** @var ExternalLink $externalLink */
$exportData = $externalLink->toArray();
$nameSpecialChars = htmlspecialcharsbx($externalLink->getFile()->getName());
$createDateText = htmlspecialcharsbx((string) $externalLink->getCreateTime());
$columnName = "\n\t\t\t\t<table class=\"bx-disk-object-name\"><tr>\n\t\t\t\t\t\t<td style=\"width: 45px;\"><div data-object-id=\"{$externalLink->getId()}\" class=\"draggable bx-file-icon-container-small bx-disk-file-icon\"></div></td>\n\t\t\t\t\t\t<td><a class=\"bx-disk-folder-title\" id=\"disk_obj_{$externalLink->getId()}\" href=\"\" data-bx-dateModify=\"{$createDateText}\">{$nameSpecialChars}</a></td>\n\t\t\t\t</tr></table>\n\t\t\t";
$createdByLink = \CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_USER'], array("user_id" => $externalLink->getCreatedBy()));
$rows[] = array('data' => $exportData, 'columns' => array('CREATE_TIME' => formatDate('x', $externalLink->getCreateTime()->getTimestamp(), time() + CTimeZone::getOffset()), 'UPDATE_TIME' => formatDate('x', $externalLink->getCreateTime()->getTimestamp(), time() + CTimeZone::getOffset()), 'NAME' => $columnName, 'FORMATTED_SIZE' => CFile::formatSize($externalLink->getFile()->getSize()), 'CREATE_USER' => "\n\t\t\t\t\t\t<div class=\"bx-disk-user-link\"><a target='_blank' href=\"{$createdByLink}\" id=\"\">" . htmlspecialcharsbx($externalLink->getCreateUser()->getFormattedName()) . "</a></div>\n\t\t\t\t\t"), 'actions' => array(array("PSEUDO_NAME" => "download", "DEFAULT" => true, "ICONCLASS" => "download", "TEXT" => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_ACT_DOWNLOAD'), "ONCLICK" => "jsUtils.Redirect(arguments, '" . $urlManager->getUrlForDownloadFile($externalLink->getFile()) . "')"), array("PSEUDO_NAME" => "disable_external_link", "ICONCLASS" => "disable_external_link", "TEXT" => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_ACT_DISABLE_EXTERNAL_LINK'), "SHORT_TEXT" => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_ACT_DISABLE_EXTERNAL_LINK_SHORT'), "ONCLICK" => "BX.Disk['ExternalLinkListClass_{$this->getComponentId()}'].disableExternalLink({$externalLink->getId()}, {$externalLink->getObjectId()})")));
}
unset($externalLink);
$grid['MODE'] = 'list';
$grid['HEADERS'] = array(array('id' => 'ID', 'name' => 'ID', 'default' => false, 'show_checkbox' => true), array('id' => 'NAME', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_NAME'), 'default' => true), array('id' => 'CREATE_TIME', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_CREATE_TIME'), 'default' => true), array('id' => 'CREATE_USER', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_CREATE_USER'), 'default' => false), array('id' => 'FORMATTED_SIZE', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_FORMATTED_SIZE'), 'default' => true));
$grid['ROWS'] = $rows;
$grid['ROWS_COUNT'] = count($rows);
$grid['FOOTER'] = array();
return $grid;
}
示例10: processActionShowSubFolders
protected function processActionShowSubFolders()
{
if (!$this->checkRequiredPostParams(array('objectId'))) {
$this->sendJsonErrorResponse();
}
$showOnlyDeleted = (bool) $this->request->getPost('showOnlyDeleted');
$isRoot = (bool) $this->request->getPost('isRoot');
/** @var Folder $folder */
$folder = Folder::loadById((int) $this->request->getPost('objectId'), array('STORAGE'));
if (!$folder) {
$this->errorCollection->add(array(new Error(Loc::getMessage('DISK_BREADCRUMBS_ERROR_COULD_NOT_FIND_FOLDER'), self::ERROR_COULD_NOT_FIND_FOLDER)));
$this->sendJsonErrorResponse();
}
$securityContext = $folder->getStorage()->getCurrentUserSecurityContext();
$subFolders = array();
$filter = array('TYPE' => ObjectTable::TYPE_FOLDER);
if ($showOnlyDeleted) {
$filter['!=DELETED_TYPE'] = ObjectTable::DELETED_TYPE_NONE;
}
if ($showOnlyDeleted && $isRoot) {
$filter['DELETED_TYPE'] = ObjectTable::DELETED_TYPE_ROOT;
$children = $folder->getDescendants($securityContext, array('filter' => $filter));
} else {
$children = $folder->getChildren($securityContext, array('filter' => $filter));
}
foreach ($children as $subFolder) {
/** @var Folder $subFolder */
$subFolders[] = array('id' => $subFolder->getId(), 'name' => $subFolder->getName(), 'isLink' => $subFolder->isLink());
}
unset($subFolder);
\Bitrix\Main\Type\Collection::sortByColumn($subFolders, 'name');
$this->sendJsonSuccessResponse(array('items' => $subFolders));
}
示例11: CheckFields
function CheckFields($ACTION, &$arFields, $ID = 0)
{
global $APPLICATION;
if ((is_set($arFields, "PRODUCT_ID") || $ACTION == "ADD") && intval($arFields["PRODUCT_ID"]) <= 0) {
$APPLICATION->ThrowException(Loc::getMessage("KGP_EMPTY_PRODUCT"), "EMPTY_PRODUCT_ID");
return false;
}
if ((is_set($arFields, "CATALOG_GROUP_ID") || $ACTION == "ADD") && intval($arFields["CATALOG_GROUP_ID"]) <= 0) {
$APPLICATION->ThrowException(Loc::getMessage("KGP_EMPTY_CATALOG_GROUP"), "EMPTY_CATALOG_GROUP_ID");
return false;
}
if ((is_set($arFields, "CURRENCY") || $ACTION == "ADD") && strlen($arFields["CURRENCY"]) <= 0) {
$APPLICATION->ThrowException(Loc::getMessage("KGP_EMPTY_CURRENCY"), "EMPTY_CURRENCY");
return false;
}
if (isset($arFields['CURRENCY'])) {
if (!($arCurrency = CCurrency::GetByID($arFields["CURRENCY"]))) {
$APPLICATION->ThrowException(Loc::getMessage("KGP_NO_CURRENCY", array('#ID#' => $arFields["CURRENCY"])), "CURRENCY");
return false;
}
}
if (is_set($arFields, "PRICE") || $ACTION == "ADD") {
$arFields["PRICE"] = str_replace(",", ".", $arFields["PRICE"]);
$arFields["PRICE"] = DoubleVal($arFields["PRICE"]);
}
if ((is_set($arFields, "QUANTITY_FROM") || $ACTION == "ADD") && intval($arFields["QUANTITY_FROM"]) <= 0) {
$arFields["QUANTITY_FROM"] = false;
}
if ((is_set($arFields, "QUANTITY_TO") || $ACTION == "ADD") && intval($arFields["QUANTITY_TO"]) <= 0) {
$arFields["QUANTITY_TO"] = false;
}
return true;
}
示例12: getEditHtml
/**
* {@inheritdoc}
*/
public function getEditHtml()
{
$iblockId = (int) $this->getSettings('IBLOCK_ID');
$inputSize = (int) $this->getSettings('INPUT_SIZE');
$windowWidth = (int) $this->getSettings('WINDOW_WIDTH');
$windowHeight = (int) $this->getSettings('WINDOW_HEIGHT');
$name = 'FIELDS';
$key = $this->getCode();
$elementId = $this->getValue();
if (!empty($elementId)) {
$rsElement = ElementTable::getById($elementId);
if (!($element = $rsElement->fetchAll())) {
$element['NAME'] = Loc::getMessage('IBLOCK_ELEMENT_NOT_FOUND');
}
} else {
$elementId = '';
}
return '<input name="' . $this->getEditInputName() . '"
id="' . $name . '[' . $key . ']"
value="' . $elementId . '"
size="' . $inputSize . '"
type="text">' . '<input type="button"
value="..."
onClick="jsUtils.OpenWindow(\'/bitrix/admin/iblock_element_search.php?lang=' . LANGUAGE_ID . '&IBLOCK_ID=' . $iblockId . '&n=' . $name . '&k=' . $key . '\', ' . $windowWidth . ', ' . $windowHeight . ');">' . ' <span id="sp_' . md5($name) . '_' . $key . '" >' . static::prepareToOutput($element['NAME']) . '</span>';
}
示例13: mysqlAddSlave
/**
* MYSQL_ADD_SLAVE action modifyer
* @param string $actionId - action idenifyer
* @param array $actionParams - action parameterss
* @param string $hostname - server hostname
* @return array - modifyed action params
* @throws NeedMoreUserInfoException
*/
public static function mysqlAddSlave($actionId, $actionParams, $hostname)
{
$action = new Action("MYSQL_ADD_SLAVE_MODIFYER", array("START_COMMAND_TEMPLATE" => "sudo -u root /opt/webdir/bin/bx-mysql -a options -o json", "LOG_LEVEL" => Logger::LOG_LEVEL_DISABLE), "", array());
$action->start();
$actRes = $action->getResult();
$needModeInfo = false;
if (isset($actRes["MYSQL_ADD_SLAVE_MODIFYER"]["OUTPUT"]["DATA"]["params"]["options"]) && is_array($actRes["MYSQL_ADD_SLAVE_MODIFYER"]["OUTPUT"]["DATA"]["params"]["options"])) {
foreach ($actRes["MYSQL_ADD_SLAVE_MODIFYER"]["OUTPUT"]["DATA"]["params"]["options"] as $option) {
if ($option == "cluster_password" || $option == "replica_password") {
$actionParams["START_COMMAND_TEMPLATE"] .= " --" . $option . "=" . \Bitrix\Scale\Helper::generatePass();
} elseif ($option == "mysql_password") {
$actionParams["START_COMMAND_TEMPLATE"] .= " --" . $option . "=##USER_PARAMS:MYSQL_PASS##";
if (!isset($actionParams["USER_PARAMS"])) {
$actionParams["USER_PARAMS"] = array();
}
$actionParams["USER_PARAMS"]["MYSQL_PASS"] = array("NAME" => Loc::getMessage("SCALE_AM_MYAR_MYSQL_PASS"), "TYPE" => "PASSWORD", "REQUIRED" => "Y", "VERIFY_TWICE" => "Y");
$needModeInfo = true;
}
}
if ($needModeInfo) {
throw new NeedMoreUserInfoException("Need more user's info", $actionParams);
}
}
return $actionParams;
}
示例14: getSettingsFields
public static function getSettingsFields($type, $extFormat = false)
{
$extFormat = $extFormat === true;
$result = array();
$type = (string) $type;
if ($type !== '') {
switch ($type) {
case self::FIELDS_ELEMENT:
$result = array('IE_XML_ID' => array('value' => 'IE_XML_ID', 'field' => 'XML_ID', 'important' => 'Y', 'name' => Loc::getMessage('CATI_FI_UNIXML_EXT') . ' (B_IBLOCK_ELEMENT.XML_ID)'), 'IE_NAME' => array('value' => 'IE_NAME', 'field' => 'NAME', 'important' => 'Y', 'name' => Loc::getMessage('CATI_FI_NAME') . ' (B_IBLOCK_ELEMENT.NAME)'), 'IE_ACTIVE' => array('value' => 'IE_ACTIVE', 'field' => 'ACTIVE', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_ACTIV') . ' (B_IBLOCK_ELEMENT.ACTIVE)'), 'IE_ACTIVE_FROM' => array('value' => 'IE_ACTIVE_FROM', 'field' => 'ACTIVE_FROM', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_ACTIVFROM') . ' (B_IBLOCK_ELEMENT.ACTIVE_FROM)'), 'IE_ACTIVE_TO' => array('value' => 'IE_ACTIVE_TO', 'field' => 'ACTIVE_TO', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_ACTIVTO') . ' (B_IBLOCK_ELEMENT.ACTIVE_TO)'), 'IE_SORT' => array('value' => 'IE_SORT', 'field' => 'SORT', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_SORT_EXT') . ' (B_IBLOCK_ELEMENT.SORT)'), 'IE_PREVIEW_PICTURE' => array('value' => 'IE_PREVIEW_PICTURE', 'field' => 'PREVIEW_PICTURE', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_CATIMG_EXT') . ' (B_IBLOCK_ELEMENT.PREVIEW_PICTURE)'), 'IE_PREVIEW_TEXT' => array('value' => 'IE_PREVIEW_TEXT', 'field' => 'PREVIEW_TEXT', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_CATDESCR_EXT') . ' (B_IBLOCK_ELEMENT.PREVIEW_TEXT)'), 'IE_PREVIEW_TEXT_TYPE' => array('value' => 'IE_PREVIEW_TEXT_TYPE', 'field' => 'PREVIEW_TEXT_TYPE', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_CATDESCRTYPE_EXT') . ' (B_IBLOCK_ELEMENT.PREVIEW_TEXT_TYPE)'), 'IE_DETAIL_PICTURE' => array('value' => 'IE_DETAIL_PICTURE', 'field' => 'DETAIL_PICTURE', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_DETIMG_EXT') . ' (B_IBLOCK_ELEMENT.DETAIL_PICTURE)'), 'IE_DETAIL_TEXT' => array('value' => 'IE_DETAIL_TEXT', 'field' => 'DETAIL_TEXT', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_DETDESCR_EXT') . ' (B_IBLOCK_ELEMENT.DETAIL_TEXT)'), 'IE_DETAIL_TEXT_TYPE' => array('value' => 'IE_DETAIL_TEXT_TYPE', 'field' => 'DETAIL_TEXT_TYPE', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_DETDESCRTYPE_EXT') . ' (B_IBLOCK_ELEMENT.DETAIL_TEXT_TYPE)'), 'IE_CODE' => array('value' => 'IE_CODE', 'field' => 'CODE', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_CODE_EXT') . ' (B_IBLOCK_ELEMENT.CODE)'), 'IE_TAGS' => array('value' => 'IE_TAGS', 'field' => 'TAGS', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_TAGS') . ' (B_IBLOCK_ELEMENT.TAGS)'), 'IE_ID' => array('value' => 'IE_ID', 'field' => 'ID', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_ID') . ' (B_IBLOCK_ELEMENT.ID)'));
break;
case self::FIELDS_CATALOG:
$result = array('CP_QUANTITY' => array('value' => 'CP_QUANTITY', 'field' => 'QUANTITY', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_QUANT') . ' (B_CATALOG_PRODUCT.QUANTITY)'), 'CP_QUANTITY_TRACE' => array('value' => 'CP_QUANTITY_TRACE', 'field' => 'QUANTITY_TRACE', 'field_orig' => 'QUANTITY_TRACE_ORIG', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_QUANTITY_TRACE') . ' (B_CATALOG_PRODUCT.QUANTITY_TRACE)'), 'CP_CAN_BUY_ZERO' => array('value' => 'CP_CAN_BUY_ZERO', 'field' => 'CAN_BUY_ZERO', 'field_orig' => 'CAN_BUY_ZERO_ORIG', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_CAN_BUY_ZERO') . ' (B_CATALOG_PRODUCT.CAN_BUY_ZERO)'), 'CP_NEGATIVE_AMOUNT_TRACE' => array('value' => 'CP_NEGATIVE_AMOUNT_TRACE', 'field' => 'NEGATIVE_AMOUNT_TRACE', 'field_orig' => 'NEGATIVE_AMOUNT_ORIG', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_NEGATIVE_AMOUNT_TRACE') . ' (B_CATALOG_PRODUCT.NEGATIVE_AMOUNT_TRACE)'), 'CP_WEIGHT' => array('value' => 'CP_WEIGHT', 'field' => 'WEIGHT', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_WEIGHT') . ' (B_CATALOG_PRODUCT.WEIGHT)'), 'CP_WIDTH' => array('value' => 'CP_WIDTH', 'field' => 'WIDTH', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_WIDTH') . ' (B_CATALOG_PRODUCT.WIDTH)'), 'CP_HEIGHT' => array('value' => 'CP_HEIGHT', 'field' => 'HEIGHT', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_HEIGHT') . ' (B_CATALOG_PRODUCT.HEIGHT)'), 'CP_LENGTH' => array('value' => 'CP_LENGTH', 'field' => 'LENGTH', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_LENGTH') . ' (B_CATALOG_PRODUCT.LENGTH)'), 'CP_PURCHASING_PRICE' => array('value' => 'CP_PURCHASING_PRICE', 'field' => 'PURCHASING_PRICE', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_PURCHASING_PRICE') . ' (B_CATALOG_PRODUCT.PURCHASING_PRICE)'), 'CP_PURCHASING_CURRENCY' => array('value' => 'CP_PURCHASING_CURRENCY', 'field' => 'PURCHASING_CURRENCY', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_PURCHASING_CURRENCY') . ' (B_CATALOG_PRODUCT.PURCHASING_CURRENCY)'), 'CP_PRICE_TYPE' => array('value' => 'CP_PRICE_TYPE', 'field' => 'PRICE_TYPE', 'important' => 'N', 'name' => Loc::getMessage('I_PAY_TYPE') . ' (B_CATALOG_PRODUCT.PRICE_TYPE)'), 'CP_RECUR_SCHEME_LENGTH' => array('value' => 'CP_RECUR_SCHEME_LENGTH', 'field' => 'RECUR_SCHEME_LENGTH', 'important' => 'N', 'name' => Loc::getMessage('I_PAY_PERIOD_LENGTH') . ' (B_CATALOG_PRODUCT.RECUR_SCHEME_LENGTH)'), 'CP_RECUR_SCHEME_TYPE' => array('value' => 'CP_RECUR_SCHEME_TYPE', 'field' => 'RECUR_SCHEME_TYPE', 'important' => 'N', 'name' => Loc::getMessage('I_PAY_PERIOD_TYPE') . ' (B_CATALOG_PRODUCT.RECUR_SCHEME_TYPE)'), 'CP_TRIAL_PRICE_ID' => array('value' => 'CP_TRIAL_PRICE_ID', 'field' => 'TRIAL_PRICE_ID', 'important' => 'N', 'name' => Loc::getMessage('I_TRIAL_FOR') . ' (B_CATALOG_PRODUCT.TRIAL_PRICE_ID)'), 'CP_WITHOUT_ORDER' => array('value' => 'CP_WITHOUT_ORDER', 'field' => 'WITHOUT_ORDER', 'important' => 'N', 'name' => Loc::getMessage('I_WITHOUT_ORDER') . ' (B_CATALOG_PRODUCT.WITHOUT_ORDER)'), 'CP_VAT_ID' => array('value' => 'CP_VAT_ID', 'field' => 'VAT_ID', 'important' => 'N', 'name' => Loc::getMessage('I_VAT_ID') . ' (B_CATALOG_PRODUCT.VAT_ID)'), 'CP_VAT_INCLUDED' => array('value' => 'CP_VAT_INCLUDED', 'field' => 'VAT_INCLUDED', 'important' => 'N', 'name' => Loc::getMessage('I_VAT_INCLUDED') . ' (B_CATALOG_PRODUCT.VAT_INCLUDED)'), 'CP_MEASURE' => array('value' => 'CP_MEASURE', 'field' => 'MEASURE', 'important' => 'N', 'name' => Loc::getMessage('BX_CAT_CSV_SETTINGS_PRODUCT_FIELD_NAME_MEASURE_ID') . ' (B_CATALOG_PRODUCT.MEASURE)'));
break;
case self::FIELDS_PRICE:
$result = array('CV_PRICE' => array('value' => 'CV_PRICE', 'value_size' => 8, 'field' => 'PRICE', 'important' => 'N', 'name' => Loc::getMessage('I_NAME_PRICE') . ' (B_CATALOG_PRICE.PRICE)'), 'CV_CURRENCY' => array('value' => 'CV_CURRENCY', 'value_size' => 11, 'field' => 'CURRENCY', 'important' => 'N', 'name' => Loc::getMessage('I_NAME_CURRENCY') . ' (B_CATALOG_PRICE.CURRENCY)'), 'CV_EXTRA_ID' => array('value' => 'CV_EXTRA_ID', 'value_size' => 11, 'field' => 'EXTRA_ID', 'important' => 'N', 'name' => Loc::getMessage('I_NAME_EXTRA_ID') . ' (B_CATALOG_PRICE.EXTRA_ID)'));
break;
case self::FIELDS_PRICE_EXT:
$result = array('CV_QUANTITY_FROM' => array('value' => 'CV_QUANTITY_FROM', 'field' => 'QUANTITY_FROM', 'important' => 'N', 'name' => Loc::getMessage('I_NAME_QUANTITY_FROM') . ' (B_CATALOG_PRICE.QUANTITY_FROM)'), 'CV_QUANTITY_TO' => array('value' => 'CV_QUANTITY_TO', 'field' => 'QUANTITY_TO', 'important' => 'N', 'name' => Loc::getMessage('I_NAME_QUANTITY_TO') . ' (B_CATALOG_PRICE.QUANTITY_TO)'));
break;
case self::FIELDS_SECTION:
$result = array('IC_ID' => array('value' => 'IC_ID', 'field' => 'ID', 'important' => 'N', 'name' => Loc::getMessage('CATI_FI_ID') . ' (B_IBLOCK_SECTION.ID)'), 'IC_XML_ID' => array('value' => 'IC_XML_ID', 'field' => 'XML_ID', 'important' => 'Y', 'name' => Loc::getMessage('CATI_FG_UNIXML_EXT') . ' (B_IBLOCK_SECTION.XML_ID)'), 'IC_GROUP' => array('value' => 'IC_GROUP', 'field' => 'NAME', 'important' => 'Y', 'name' => Loc::getMessage('CATI_FG_NAME') . ' (B_IBLOCK_SECTION.NAME)'), 'IC_ACTIVE' => array('value' => 'IC_ACTIVE', 'field' => 'ACTIVE', 'important' => 'N', 'name' => Loc::getMessage('CATI_FG_ACTIV') . ' (B_IBLOCK_SECTION.ACTIVE)'), 'IC_SORT' => array('value' => 'IC_SORT', 'field' => 'SORT', 'important' => 'N', 'name' => Loc::getMessage('CATI_FG_SORT_EXT') . ' (B_IBLOCK_SECTION.SORT)'), 'IC_DESCRIPTION' => array('value' => 'IC_DESCRIPTION', 'field' => 'DESCRIPTION', 'important' => 'N', 'name' => Loc::getMessage('CATI_FG_DESCR') . ' (B_IBLOCK_SECTION.DESCRIPTION)'), 'IC_DESCRIPTION_TYPE' => array('value' => 'IC_DESCRIPTION_TYPE', 'field' => 'DESCRIPTION_TYPE', 'important' => 'N', 'name' => Loc::getMessage('CATI_FG_DESCRTYPE') . ' (B_IBLOCK_SECTION.DESCRIPTION_TYPE)'), 'IC_CODE' => array('value' => 'IC_CODE', 'field' => 'CODE', 'important' => 'N', 'name' => Loc::getMessage('CATI_FG_CODE_EXT2') . ' (B_IBLOCK_SECTION.CODE)'), 'IC_PICTURE' => array('value' => 'IC_PICTURE', 'field' => 'PICTURE', 'important' => 'N', 'name' => Loc::getMessage('CATI_FG_PICTURE') . ' (B_IBLOCK_SECTION.PICTURE)'), 'IC_DETAIL_PICTURE' => array('value' => 'IC_DETAIL_PICTURE', 'field' => 'DETAIL_PICTURE', 'important' => 'N', 'name' => Loc::getMessage('CATI_FG_DETAIL_PICTURE') . ' (B_IBLOCK_SECTION.DETAIL_PICTURE)'));
break;
}
}
return $extFormat ? $result : array_values($result);
}
示例15: checkUpdatePermissions
protected function checkUpdatePermissions()
{
if (!$this->attachedModel->canUpdate($this->getUser()->getId())) {
$this->errorCollection->add(array(new Error(Loc::getMessage('DISK_UF_DOCUMENT_CONTROLLER_ERROR_BAD_RIGHTS'), self::ERROR_BAD_RIGHTS)));
$this->sendJsonErrorResponse();
}
}