本文整理汇总了PHP中Bitrix\Main\Config\Option::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Option::set方法的具体用法?PHP Option::set怎么用?PHP Option::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Main\Config\Option
的用法示例。
在下文中一共展示了Option::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
protected static function save()
{
$ary = array();
foreach (self::$items as $entityTypeID => $time) {
$ary[\CCrmOwnerType::ResolveName($entityTypeID)] = $time->format(\DateTime::ISO8601);
}
Main\Config\Option::set('crm', 'crm_uf_history', serialize($ary), '');
}
示例2: InstallDB
function InstallDB($install_wizard = true)
{
global $DB, $DBType, $APPLICATION;
$errors = null;
if (!$DB->Query("SELECT 'x' FROM b_disk_storage", true)) {
$errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/disk/install/db/" . $DBType . "/install.sql");
}
$this->InstallTasks();
if (!empty($errors)) {
$APPLICATION->ThrowException(implode("", $errors));
return false;
}
$isWebdavInstalled = isModuleInstalled('webdav');
$this->RegisterModuleDependences(!$isWebdavInstalled);
RegisterModule("disk");
$this->InstallUserFields();
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
CAgent::addAgent('\\Bitrix\\Disk\\ExternalLink::removeExpiredWithTypeAuto();', 'disk', 'N');
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
CAgent::addAgent('\\Bitrix\\Disk\\Bitrix24Disk\\UploadFileManager::removeIrrelevant();', 'disk', 'N');
if (!$isWebdavInstalled) {
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/disk/lib/configuration.php";
\Bitrix\Main\Config\Option::set('disk', 'successfully_converted', 'Y');
\Bitrix\Main\Config\Option::set('disk', 'disk_revision_api', \Bitrix\Disk\Configuration::REVISION_API);
} else {
\CAdminNotify::add(array("MESSAGE" => Loc::getMessage("DISK_NOTIFY_MIGRATE_WEBDAV", array("#LINK#" => "/bitrix/admin/disk_from_webdav_convertor.php?lang=" . \Bitrix\Main\Application::getInstance()->getContext()->getLanguage())), "TAG" => "disk_migrate_from_webdav", "MODULE_ID" => "disk", "ENABLE_CLOSE" => "N"));
}
return true;
}
示例3: DoInstall
function DoInstall()
{
global $APPLICATION;
RegisterModule($this->MODULE_ID);
RegisterModuleDependences('main', 'OnBeforeEventSend', $this->MODULE_ID, '\\Um\\MailTemplate\\HandlerFacade', 'execute');
\Bitrix\Main\Config\Option::set($this->MODULE_ID, 'tpl_class_name', '\\Um\\MailTemplate\\TwigPoweredTemplateHandler');
\Bitrix\Main\Config\Option::set($this->MODULE_ID, 'tpl_class_path', '/bitrix/modules/' . $this->MODULE_ID . '/lib/twig_powered.template.handler.php');
$APPLICATION->IncludeAdminFile(GetMessage('UMT_INSTALL_TITLE'), $this->install_path . '/step.php');
}
示例4: save
public function save()
{
$this->isPersistent = false;
if ($this->name !== '') {
Main\Config\Option::set('crm', $this->name, serialize($this->externalize()), '');
$this->isPersistent = true;
}
return $this->isPersistent;
}
示例5: set
public function set($value)
{
$value = (int) $value;
if ($value === $this->default) {
Main\Config\Option::delete('crm', array('name' => $this->name));
} else {
Main\Config\Option::set('crm', $this->name, $value, '');
}
}
示例6: save
/**
* @return void
*/
public function save()
{
if ($this->bindings === null) {
return;
}
if (!empty($this->bindings)) {
Main\Config\Option::set('crm', $this->typeName, serialize($this->bindings));
} else {
Main\Config\Option::delete('crm', array('name' => $this->typeName));
}
}
示例7: InstallDB
function InstallDB($arParams = array())
{
ModuleManager::registerModule('conversion');
global $DB;
$DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/conversion/install/db/' . strtolower($DB->type) . '/install.sql');
RegisterModuleDependences('conversion', 'OnGetCounterTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetCounterTypes');
RegisterModuleDependences('conversion', 'OnGetAttributeTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetAttributeTypes');
RegisterModuleDependences('conversion', 'OnGetAttributeGroupTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetAttributeGroupTypes');
RegisterModuleDependences('conversion', 'OnSetDayContextAttributes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onSetDayContextAttributes');
RegisterModuleDependences('main', 'OnProlog', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onProlog');
if (Option::get('conversion', 'START_DATE_TIME', 'undefined') == 'undefined') {
Option::set('conversion', 'START_DATE_TIME', date('Y-m-d H:i:s'));
}
return true;
}
示例8: setEnable
/**
* Enables network communication. Returns true on success.
*
* @param boolean $enable Pass true to enable and false to disable.
*
* @return boolean
*/
public function setEnable($enable = true)
{
if ($this->isEnabled() && $enable) {
return true;
}
if (!$this->isEnabled() && !$enable) {
return true;
}
$query = \CBitrix24NetPortalTransport::init();
if (!$query) {
$this->errorCollection[] = new Error(Loc::getMessage('B24NET_SOCSERV_TRANSPORT_ERROR'), self::ERROR_SOCSERV_TRANSPORT);
return false;
}
$queryResult = $query->call('feature.enable', array('FEATURE' => 'replica', 'STATUS' => (bool) $enable));
Option::set('socialservices', 'network_enable', $enable ? 'Y' : 'N');
return true;
}
示例9: generateInitialData
public static function generateInitialData(Date $from)
{
if (($to = Option::get('conversion', 'START_DATE_TIME', 'undefined')) != 'undefined' && DateTime::isCorrect($to, 'Y-m-d H:i:s') && ($to = new DateTime($to, 'Y-m-d H:i:s')) && $to->format('Y-m-d H:i:s') > $from->format('Y-m-d H:i:s') && Option::get('conversion', 'GENERATE_INITIAL_DATA', 'undefined') == 'undefined') {
Option::set('conversion', 'GENERATE_INITIAL_DATA', 'generated');
$context = new self();
// generate data
$data = array();
foreach (EventManager::getInstance()->findEventHandlers('conversion', 'OnGenerateInitialData') as $handler) {
$result = ExecuteModuleEventEx($handler, array($from, $to));
// TODO validate
foreach ($result as $row) {
$context->id = null;
$context->attributes = array();
$context->setAttributes($row['ATTRIBUTES']);
$context->save();
if ($dayCounters =& $data[$context->id]) {
self::appendDayCounters($dayCounters, $row['DAY_COUNTERS']);
} else {
$dayCounters = $row['DAY_COUNTERS'];
}
}
}
unset($dayCounters);
// save data to database
$numerators = CounterManager::getTypes(array('GROUP' => 'day'));
unset($numerators['conversion_visit_day']);
foreach ($data as $id => $dayCounters) {
$context->id = $id;
foreach ($dayCounters as $day => $counters) {
$day = new Date($day, 'Y-m-d');
$visitSum = 0;
$visitQuantity = 0;
unset($counters['conversion_visit_day']);
foreach ($counters as $name => $value) {
$context->addCounter($day, $name, $value);
if ($numerators[$name]) {
$visitSum += $value;
$visitQuantity += 1;
}
}
$context->addCounter($day, 'conversion_visit_day', $visitQuantity ? round($visitSum / $visitQuantity * 100) + 1 : 1);
}
}
}
}
示例10: setDelayMinLimit
public static function setDelayMinLimit($limit, $type = 's')
{
$limit = (int) $limit;
switch ($type) {
case 'd':
$limit *= 3600 * 24;
break;
case 'h':
$limit *= 3600;
break;
case 'm':
$limit *= 60;
break;
default:
break;
}
\Bitrix\Main\Config\Option::set('bizproc', 'delay_min_limit', $limit);
}
示例11: setValue
public static function setValue($ID, $value)
{
$ID = (int) $ID;
if ($ID === self::KEEP_COMPLETED_CALLS) {
Main\Config\Option::set('crm', 'act_cal_show_compl_call', $value ? 'Y' : 'N', '');
} elseif ($ID === self::KEEP_COMPLETED_MEETINGS) {
Main\Config\Option::set('crm', 'act_cal_show_compl_meeting', $value ? 'Y' : 'N', '');
} elseif ($ID === self::KEEP_UNBOUND_TASKS) {
Main\Config\Option::set('crm', 'act_task_keep_unbound', $value ? 'Y' : 'N', '');
} elseif ($ID === self::KEEP_REASSIGNED_CALLS) {
Main\Config\Option::set('crm', 'act_cal_keep_reassign_call', $value ? 'Y' : 'N', '');
} elseif ($ID === self::KEEP_REASSIGNED_MEETINGS) {
Main\Config\Option::set('crm', 'act_cal_keep_reassign_meeting', $value ? 'Y' : 'N', '');
} elseif ($ID === self::MARK_FORWARDED_EMAIL_AS_OUTGOING) {
Main\Config\Option::set('crm', 'act_mark_fwd_emai_outgoing', $value ? 'Y' : 'N', '');
} else {
throw new Main\NotSupportedException("The setting '{$ID}' is not supported in current context");
}
}
示例12: InstallDB
function InstallDB($params = array())
{
global $DB;
if (!$DB->Query("SELECT 'x' FROM b_conv_context", true)) {
Option::set('conversion', 'START_DATE_TIME', date('Y-m-d H:i:s'));
if (ModuleManager::isModuleInstalled('sale') && ($currency = Option::get('sale', 'default_currency'))) {
Option::set('conversion', 'BASE_CURRENCY', $currency);
} elseif (Bitrix\Main\Loader::includeModule('currency')) {
Option::set('conversion', 'BASE_CURRENCY', Bitrix\Currency\CurrencyManager::getBaseCurrency());
}
if ($params['GENERATE_INITIAL_DATA'] !== 'Y') {
Option::set('conversion', 'GENERATE_INITIAL_DATA', 'generated');
}
$DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/conversion/install/db/' . strtolower($DB->type) . '/install.sql');
}
ModuleManager::registerModule('conversion');
RegisterModuleDependences('conversion', 'OnGetCounterTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetCounterTypes');
RegisterModuleDependences('conversion', 'OnGetAttributeTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetAttributeTypes');
RegisterModuleDependences('conversion', 'OnGetAttributeGroupTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetAttributeGroupTypes');
RegisterModuleDependences('conversion', 'OnSetDayContextAttributes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onSetDayContextAttributes');
RegisterModuleDependences('main', 'OnProlog', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onProlog');
return true;
}
示例13: unset
if (CBXFeatures::IsFeatureEnabled('CatDiscountSave')) {
$strDiscSaveApply = '';
if (isset($_REQUEST['discsave_apply'])) {
$strDiscSaveApply = (string) $_REQUEST['discsave_apply'];
}
if ($strDiscSaveApply != '' && isset($applyDiscSaveModeList[$strDiscSaveApply])) {
Option::set('catalog', 'discsave_apply', $strDiscSaveApply, '');
}
}
if (!$saleIsInstalled) {
$discountPercent = '';
if (isset($_REQUEST['get_discount_percent_from_base_price'])) {
$discountPercent = (string) $_REQUEST['get_discount_percent_from_base_price'];
}
if ($discountPercent == 'Y' || $discountPercent == 'N') {
Option::set('catalog', 'get_discount_percent_from_base_price', $discountPercent, '');
}
unset($discountPercent);
}
/* $strDiscountVat = (!empty($_REQUEST['discount_vat']) && $_REQUEST['discount_vat'] == 'N' ? 'N' : 'Y');
Option::set('catalog', 'discount_vat', $strDiscountVat, ''); */
}
$bNeedAgent = false;
$boolFlag = true;
$arCurrentIBlocks = array();
$arNewIBlocksList = array();
$rsIBlocks = CIBlock::GetList(array());
while ($arOneIBlock = $rsIBlocks->Fetch()) {
// Current info
$arOneIBlock['ID'] = (int) $arOneIBlock['ID'];
$arIBlockItem = array();
示例14: DoInstall
public function DoInstall()
{
try {
//Проверка зависимостей модуля
if (!IsModuleInstalled("sale")) {
throw new Exception(Loc::getMessage("DEVTM_ERIP_SALE_MODULE_NOT_INSTALL_ERROR"));
}
if (!function_exists("curl_init")) {
throw new Exception(Loc::getMessage("DEVTM_ERIP_CURL_NOT_INSTALL_ERROR"));
}
if (!function_exists("json_decode")) {
throw new Exception(Loc::getMessage("DEVTM_ERIP_JSON_NOT_INSTALL_ERROR"));
}
//регистраниция модуля
\Bitrix\Main\ModuleManager::registerModule($this->MODULE_ID);
//создание платёжной системы
$psid = $this->addPaysys();
if ($psid === false) {
throw new Exception(Loc::getMessage("DEVTM_ERIP_PS_ERROR_MESS"));
}
//сохранение ID пл. системы в настройках модуля
\Bitrix\Main\Config\Option::set($this->MODULE_ID, "payment_system_id", $psid);
//копируем файлы обработчика пл. системы
if (!$this->copyHandlerFiles()) {
throw new Exception(Loc::getMessage("DEVTM_ERIP_COPY_ERROR_MESS"));
}
//регистрируем обработчик пл. системы
$pay_handler_ids = $this->addPaysysHandler($psid);
if (empty($pay_handler_ids)) {
throw new Exception(Loc::getMessage("DEVTM_ERIP_PS_ACTION_ERROR_REG"));
}
//сохраняем id обработчиков пл. системы
\Bitrix\Main\Config\Option::set($this->MODULE_ID, "pay_handler_ids", implode("|", $pay_handler_ids));
//создание статуса заказа [ЕРИП]Ожидание оплаты
$o_status_code = $this->addOStatus();
if ($o_status_code === false) {
throw new Exception(Loc::getMessage("DEVTM_ERIP_ORDER_STATUS_ERROR_MESS"));
}
//сохранение кода статуса заказа в настройках модуля
\Bitrix\Main\Config\Option::set($this->MODULE_ID, "order_status_code_erip", $o_status_code);
//Создание типа почтового события
if ($this->addMailEvType() === false) {
throw new Exception(Loc::getMessage("DEVTM_ERIP_MAIL_EVENT_ADD_ERROR"));
}
//сохранение названия типа почтового события в настройках модуля
\Bitrix\Main\Config\Option::set($this->MODULE_ID, "mail_event_name", $this->mail_event_name);
//создание почтового шаблона
$mail_temp_id = $this->addMailTemplate();
if ($mail_temp_id === false) {
throw new Exception(Loc::getMessage("DEVTM_ERIP_MAIL_TEMPLATE_ADD_ERROR"));
}
//сохранение ID почтового шаблона в настройках модуля
\Bitrix\Main\Config\Option::set($this->MODULE_ID, "mail_template_id", $mail_temp_id);
//регистрация обработчика обновления заказа
if ($this->addHandlers() === false) {
throw new Exception(Loc::getMessage("DEVTM_ERIP_HANDLERS_ADD_ERROR"));
}
return true;
} catch (Exception $e) {
$this->DoUninstall();
$GLOBALS["APPLICATION"]->ThrowException($e->getMessage());
return false;
}
return true;
}
示例15: setGroupUsage
public static function setGroupUsage()
{
Config\Option::set("sale", self::PROJECT_USES_GROUPS_OPT, 'Y');
}