本文整理汇总了PHP中Bitrix\Main\ModuleManager类的典型用法代码示例。如果您正苦于以下问题:PHP ModuleManager类的具体用法?PHP ModuleManager怎么用?PHP ModuleManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModuleManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DoUninstall
public function DoUninstall()
{
$this->uninstallFiles();
\Bitrix\Main\Config\Option::delete($this->MODULE_ID);
\Bitrix\Main\ModuleManager::unRegisterModule($this->MODULE_ID);
return true;
}
示例2: DoUninstall
public function DoUninstall()
{
$this->UnInstallFiles();
ModuleManager::unRegisterModule($this->MODULE_ID);
$eventManager = \Bitrix\Main\EventManager::getInstance();
$eventManager->unRegisterEventHandler("fileman", "OnBeforeHTMLEditorScriptRuns", $this->MODULE_ID, '\\Newkaliningrad\\Typografru\\Typograf', "onBeforeHTMLEditorScriptRuns");
}
示例3: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
if (!Loader::includeModule('search')) {
throw new BitrixException('Search module is not installed');
}
$searchResult = array();
$bar = new ProgressBar($output, 0);
do {
$bar->display();
$searchResult = \CSearch::ReIndexAll($input->getOption('full'), static::UPDATE_TIME, $searchResult);
$bar->advance();
$bar->clear();
if (is_array($searchResult) && $searchResult['MODULE'] == 'main') {
list(, $path) = explode("|", $searchResult["ID"], 2);
$output->writeln("\r " . $path, OutputInterface::VERBOSITY_VERBOSE);
}
} while (is_array($searchResult));
$bar->finish();
$bar->clear();
$output->write("\r");
if (ModuleManager::isModuleInstalled('socialnetwork')) {
$output->writeln('<info>The Social Network module needs to be reindexed using the Social Network component in the public section of site.</info>');
}
$output->writeln(sprintf('<info>Reindexed</info> %d element%s.', $searchResult, $searchResult > 1 ? 's' : ''));
return 0;
}
示例4: getSecurityContextByUser
/**
* Gets security context (access provider) for user.
* Attention! File/Folder can use anywhere and SecurityContext have to check rights anywhere (any module).
* @param mixed $user User which use for check rights.
* @return SecurityContext
*/
public function getSecurityContextByUser($user)
{
if ($this->isCurrentUser($user)) {
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
if (Loader::includeModule('socialnetwork') && \CSocnetUser::isCurrentUserModuleAdmin()) {
return new FakeSecurityContext($user);
}
if (UserModel::isCurrentUserAdmin()) {
return new FakeSecurityContext($user);
}
} else {
$userId = UserModel::resolveUserId($user);
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
if ($userId && Loader::includeModule('socialnetwork') && \CSocnetUser::isUserModuleAdmin($userId)) {
return new FakeSecurityContext($user);
}
try {
if ($userId && ModuleManager::isModuleInstalled('bitrix24') && Loader::includeModule('bitrix24') && \CBitrix24::isPortalAdmin($userId)) {
return new FakeSecurityContext($user);
} elseif ($userId) {
//Check user group 1 ('Admins')
$tmpUser = new \CUser();
$arGroups = $tmpUser->getUserGroup($userId);
if (in_array(1, $arGroups)) {
return new FakeSecurityContext($user);
}
}
} catch (\Exception $e) {
}
}
return new DiskSecurityContext($user);
}
示例5: DoUninstall
function DoUninstall()
{
$this->unInstallDB();
$this->unInstallFiles();
ModuleManager::unRegisterModule($this->MODULE_ID);
$GLOBALS['APPLICATION']->IncludeAdminFile(GetMessage("UMBM_UNINSTALL_TITLE"), $this->install_source . 'unstep.php');
}
示例6: UnInstallDB
public function UnInstallDB($arParams = array())
{
global $errors;
//COption::RemoveOption($this->getModuleId());
\Bitrix\Main\ModuleManager::unRegisterModule($this->MODULE_ID);
return true;
}
示例7: doUninstall
public function doUninstall()
{
ModuleManager::unregisterModule($this->MODULE_ID);
$this->UnInstallFiles();
$this->uninstallDB();
UnRegisterModuleDependences('iblock', 'OnBeforeIBlockElementDelete', $this->MODULE_ID, '\Iiko\Event', 'onIBlockElementDelete');
}
示例8: getActiveUsersCount
public static function getActiveUsersCount()
{
$sql = "SELECT COUNT(ID) " . "FROM b_user " . "WHERE ACTIVE = 'Y' " . " AND LAST_LOGIN IS NOT NULL";
if (ModuleManager::isModuleInstalled("intranet")) {
$sql = "SELECT COUNT(U.ID) " . "FROM b_user U " . "WHERE U.ACTIVE = 'Y' " . " AND U.LAST_LOGIN IS NOT NULL " . " AND EXISTS(" . " SELECT 'x' " . " FROM b_utm_user UF, b_user_field F " . " WHERE F.ENTITY_ID = 'USER' " . " AND F.FIELD_NAME = 'UF_DEPARTMENT' " . " AND UF.FIELD_ID = F.ID " . " AND UF.VALUE_ID = U.ID " . " AND UF.VALUE_INT IS NOT NULL " . " AND UF.VALUE_INT <> 0" . " )";
}
$connection = Application::getConnection();
return $connection->queryScalar($sql);
}
示例9: isExternalUser
/**
* Check if user is extranet user
* @param integer $userID User ID
* @return boolean
*/
public static function isExternalUser($userID)
{
if (!ModuleManager::isModuleInstalled('extranet')) {
return false;
}
$dbResult = \CUser::getList($o = 'ID', $b = 'ASC', array('ID_EQUAL_EXACT' => $userID), array('FIELDS' => array('ID'), 'SELECT' => array('UF_DEPARTMENT')));
$user = $dbResult->Fetch();
return !(is_array($user) && isset($user['UF_DEPARTMENT']) && isset($user['UF_DEPARTMENT'][0]) && $user['UF_DEPARTMENT'][0] > 0);
}
示例10: isPaidLicense
public static function isPaidLicense()
{
if (self::$isLicensePaid !== null) {
return self::$isLicensePaid;
}
if (!(ModuleManager::isModuleInstalled('bitrix24') && Loader::includeModule('bitrix24')) && method_exists('CBitrix24', 'IsLicensePaid')) {
return self::$isLicensePaid = false;
}
return self::$isLicensePaid = \CBitrix24::IsLicensePaid();
}
示例11: UnInstallDB
function UnInstallDB($arParams = array())
{
UnRegisterModuleDependences('conversion', 'OnGetCounterTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetCounterTypes');
UnRegisterModuleDependences('conversion', 'OnGetAttributeTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetAttributeTypes');
UnRegisterModuleDependences('conversion', 'OnGetAttributeGroupTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetAttributeGroupTypes');
UnRegisterModuleDependences('conversion', 'OnSetDayContextAttributes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onSetDayContextAttributes');
UnRegisterModuleDependences('main', 'OnProlog', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onProlog');
global $DB;
$DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/conversion/install/db/' . strtolower($DB->type) . '/uninstall.sql');
ModuleManager::unRegisterModule('conversion');
return true;
}
示例12: IsAdmin
public static function IsAdmin($userID = 0)
{
if (!is_int($userID)) {
$userID = is_numeric($userID) ? (int) $userID : 0;
}
$result = false;
if ($userID <= 0) {
$user = CCrmSecurityHelper::GetCurrentUser();
$userID = $user->GetID();
if ($userID <= 0) {
false;
}
if (isset(self::$USER_ADMIN_FLAGS[$userID])) {
return self::$USER_ADMIN_FLAGS[$userID];
}
$result = $user->IsAdmin();
if ($result) {
self::$USER_ADMIN_FLAGS[$userID] = true;
return true;
}
try {
if (\Bitrix\Main\ModuleManager::isModuleInstalled('bitrix24') && CModule::IncludeModule('bitrix24')) {
if (class_exists('CBitrix24') && method_exists('CBitrix24', 'IsPortalAdmin')) {
// New style check
$result = CBitrix24::IsPortalAdmin($userID);
} else {
// Check user group 1 ('Portal admins')
$arGroups = $user->GetUserGroup($userID);
$result = in_array(1, $arGroups);
}
}
} catch (Exception $e) {
}
} else {
if (isset(self::$USER_ADMIN_FLAGS[$userID])) {
return self::$USER_ADMIN_FLAGS[$userID];
}
try {
if (IsModuleInstalled('bitrix24') && CModule::IncludeModule('bitrix24') && class_exists('CBitrix24') && method_exists('CBitrix24', 'IsPortalAdmin')) {
// Bitrix24 context new style check
$result = CBitrix24::IsPortalAdmin($userID);
} else {
//Check user group 1 ('Admins')
$user = new CUser();
$arGroups = $user->GetUserGroup($userID);
$result = in_array(1, $arGroups);
}
} catch (Exception $e) {
}
}
self::$USER_ADMIN_FLAGS[$userID] = $result;
return $result;
}
示例13: initDiscountSettings
public static function initDiscountSettings()
{
if (self::$useSaleDiscount === null)
{
self::$useSaleDiscount = ModuleManager::isModuleInstalled('sale') && (string)Option::get('sale', 'use_sale_discount_only') == 'Y';
}
if (self::$getPercentFromBasePrice === null)
{
$moduleID = (self::$useSaleDiscount ? 'sale' : 'catalog');
self::$getPercentFromBasePrice = (string)Option::get($moduleID, 'get_discount_percent_from_base_price') == 'Y';
}
}
示例14: onUserLoginSocserv
public static function onUserLoginSocserv($params)
{
global $USER;
if ($params['EXTERNAL_AUTH_ID'] === \CSocServBitrix24Net::ID && \Bitrix\Main\ModuleManager::isModuleInstalled('bitrix24')) {
$notificationOptions = \CUserOptions::getOption("socialservices", "notifications", array());
$lastDate = 0;
if (isset($notificationOptions["CONTACTS_NOTIFY_DATE"])) {
$lastDate = $notificationOptions["CONTACTS_NOTIFY_DATE"];
}
if ($lastDate < time() - 86400) {
static::notifyPossible($USER->getId());
$notificationOptions["CONTACTS_NOTIFY_DATE"] = time();
\CUserOptions::setOption("socialservices", "notifications", $notificationOptions);
}
}
}
示例15: UnInstallDB
function UnInstallDB($params = array())
{
UnRegisterModuleDependences('conversion', 'OnGetCounterTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetCounterTypes');
UnRegisterModuleDependences('conversion', 'OnGetAttributeTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetAttributeTypes');
UnRegisterModuleDependences('conversion', 'OnGetAttributeGroupTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetAttributeGroupTypes');
UnRegisterModuleDependences('conversion', 'OnSetDayContextAttributes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onSetDayContextAttributes');
UnRegisterModuleDependences('main', 'OnProlog', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onProlog');
ModuleManager::unRegisterModule('conversion');
if ($params['SAVE_TABLES'] !== 'Y') {
global $DB;
$DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/conversion/install/db/' . strtolower($DB->type) . '/uninstall.sql');
Option::delete('conversion', array('name' => 'START_DATE_TIME'));
Option::delete('conversion', array('name' => 'BASE_CURRENCY'));
Option::delete('conversion', array('name' => 'GENERATE_INITIAL_DATA'));
}
return true;
}