当前位置: 首页>>代码示例>>PHP>>正文


PHP CModule类代码示例

本文整理汇总了PHP中CModule的典型用法代码示例。如果您正苦于以下问题:PHP CModule类的具体用法?PHP CModule怎么用?PHP CModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CModule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setComponent

 /**
  * Sets a component, while taking care to restore it in the tear down.
  *
  * @param \CModule $obj
  * @param string   $name
  * @param mixed    $val
  *
  * @return null
  */
 protected function setComponent(\CModule $obj, $name, $val)
 {
     // Save the original value for tearDown()
     $this->_originalComponentValues[] = array($obj, $name, $obj->getComponent($name));
     // Set the new one
     $obj->setComponent($name, $val);
 }
开发者ID:kentonquatman,项目名称:portfolio,代码行数:16,代码来源:BaseTest.php

示例2: ClearCheckCache

	public static function ClearCheckCache()
	{
		// init module cache
		$CModule = new CModule();
		$CModule->IsInstalled();

		CAgent::RemoveAgent("CPullOptions::ClearAgent();", "pull");
		CAgent::AddAgent("CPullOptions::ClearAgent();", "pull", "N", 30, "", "Y", ConvertTimeStamp(time()+CTimeZone::GetOffset()+30, "FULL"));
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:9,代码来源:pull_options.php

示例3: Execute

 public function Execute()
 {
     if (!CModule::IncludeModule("intranet")) {
         return CBPActivityExecutionStatus::Closed;
     }
     $absenceIblockId = COption::GetOptionInt("intranet", 'iblock_absence', 0);
     if ($absenceIblockId <= 0) {
         return CBPActivityExecutionStatus::Closed;
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $documentService = $this->workflow->GetService("DocumentService");
     $arAbsenceUserTmp = $this->AbsenceUser;
     $arAbsenceUser = CBPHelper::ExtractUsers($arAbsenceUserTmp, $documentId, false);
     $arAbsenceTypes = array();
     $dbTypeRes = CIBlockPropertyEnum::GetList(array("SORT" => "ASC", "VALUE" => "ASC"), array('IBLOCK_ID' => $absenceIblockId, 'PROPERTY_ID' => 'ABSENCE_TYPE'));
     while ($arTypeValue = $dbTypeRes->GetNext()) {
         $arAbsenceTypes[$arTypeValue['XML_ID']] = $arTypeValue['ID'];
     }
     foreach ($arAbsenceUser as $absenceUser) {
         $arFields = array("ACTIVE" => "Y", "IBLOCK_ID" => $absenceIblockId, 'ACTIVE_FROM' => $this->AbsenceFrom, 'ACTIVE_TO' => $this->AbsenceTo, "NAME" => $this->AbsenceName, "PREVIEW_TEXT" => $this->AbsenceDesrc, "PREVIEW_TEXT_TYPE" => "text", "PROPERTY_VALUES" => array("USER" => $absenceUser, "STATE" => $this->AbsenceState, "FINISH_STATE" => $this->AbsenceFinishState, "ABSENCE_TYPE" => $arAbsenceTypes[$this->AbsenceType]));
         $el = new CIBlockElement();
         $el->Add($arFields);
     }
     return CBPActivityExecutionStatus::Closed;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:26,代码来源:absenceactivity.php

示例4: toEdit

 /**
  * @return array
  */
 protected function toEdit()
 {
     /** @global CUser $USER */
     global $USER;
     if (!$USER->IsAuthorized()) {
         return array('status' => 'error', 'error' => 'auth_error');
     }
     if (!check_bitrix_sessid()) {
         return array('status' => 'error', 'error' => 'sessid_check_failed');
     }
     if ($this->request['action'] !== 'otp_check_activate') {
         return array('status' => 'error', 'error' => 'unknown_action');
     }
     if (!CModule::includeModule('security')) {
         return array('status' => 'error', 'error' => 'security_not_installed');
     }
     try {
         $otp = Otp::getByUser($USER->getid());
         $binarySecret = pack('H*', $this->request->getPost('secret'));
         $otp->regenerate($binarySecret)->syncParameters($this->request->getPost('sync1'), $this->request->getPost('sync2'))->save();
         return array('status' => 'ok');
     } catch (\Bitrix\Security\Mfa\OtpException $e) {
         return array('status' => 'error', 'error' => $e->getMessage());
     }
 }
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:28,代码来源:class.php

示例5: CSeoPageChecker

 function CSeoPageChecker($site, $url, $get = true, $check_errors = true)
 {
     global $APPLICATION;
     if (CModule::IncludeModule('search')) {
         $this->bSearch = true;
     } else {
         $APPLICATION->ThrowException(GetMessage('SEO_ERROR_NO_SEARCH'));
     }
     // don't return false or set bError!
     $this->__bCheckErrors = $check_errors;
     $this->__site = $site;
     $dbRes = CSite::GetByID($this->__site);
     if ($arRes = $dbRes->Fetch()) {
         $this->__lang = $arRes['LANGUAGE_ID'];
         $this->__server_name = $arRes['SERVER_NAME'];
         if (strlen($this->__server_name) <= 0) {
             $this->__server_name = COption::GetOptionString('main', 'server_name', '');
         }
         if (strlen($this->__server_name) > 0) {
             $this->__url = 'http://' . $this->__server_name . $url;
             return $get ? $this->GetHTTPData() : true;
         } else {
             $this->bError = true;
             $APPLICATION->ThrowException(str_replace('#SITE_ID#', $this->__site, GetMessage('SEO_ERROR_NO_SERVER_NAME')));
             return false;
         }
     }
     return false;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:29,代码来源:seo_page_checker.php

示例6: GetList

	public static function GetList($arSort=array(), $arFilter=array(), $arNavParams=false, $arUserField)
	{
		$rs = false;

		if(\CModule::IncludeModule("statistic"))
		{
			$arAliases = array("ID" => "CITY_ID", "NAME" => "CITY_NAME");

			$ob = new \CCity();
			$rs = new CUserTypeLocationEnum($ob->GetList(
				static::__makeArrayFromAlias($arSort, $arAliases),
				static::__makeArrayFromAlias($arFilter, $arAliases)
			));

			// getlist is not supported pagenavigation yet
			if(is_array($arNavParams) && is_set($arNavParams, "nTopCount"))
			{
				$arr = array();
				while($ar = $rs->Fetch())
				{
					if(count($arr) >= intval($arNavParams["nTopCount"]))
						break;
					$arr[] = $ar;
				}
				$rs = new CUserTypeLocationEnum();
				$rs->InitFromArray($arr);
			}
		}

		return $rs;
	}
开发者ID:alexshipil,项目名称:bitrix.simple.module,代码行数:31,代码来源:location.php

示例7: afterUpdateTrigger

 /**
  * Method will be invoked after an database record updated.
  *
  * @param array $oldRecord All fields before update.
  * @param array $newRecord All fields after update.
  *
  * @return void
  */
 public static function afterUpdateTrigger(array $oldRecord, array $newRecord)
 {
     if ($oldRecord['TITLE'] !== $newRecord['TITLE']) {
         if (\CModule::IncludeModule("pull")) {
             $ar = \CIMChat::GetRelationById($newRecord['CHAT_ID']);
             foreach ($ar as $rel) {
                 \CIMContactList::CleanChatCache($rel['USER_ID']);
                 \CPullStack::AddByUser($rel['USER_ID'], array('module_id' => 'im', 'command' => 'chatRename', 'params' => array('chatId' => $newRecord['CHAT_ID'], 'chatTitle' => htmlspecialcharsbx($newRecord['TITLE']))));
             }
         }
     }
     if ($oldRecord['AVATAR'] !== $newRecord['AVATAR']) {
         if (\CModule::IncludeModule('pull')) {
             $avatarImage = \CIMChat::GetAvatarImage($newRecord['AVATAR']);
             $ar = \CIMChat::GetRelationById($newRecord['CHAT_ID']);
             foreach ($ar as $relation) {
                 \CIMContactList::CleanChatCache($relation['USER_ID']);
                 \CPullStack::AddByUser($relation['USER_ID'], array('module_id' => 'im', 'command' => 'chatAvatar', 'params' => array('chatId' => $newRecord['CHAT_ID'], 'chatAvatar' => $avatarImage)));
             }
         }
     }
     if ($oldRecord['COLOR'] !== $newRecord['COLOR']) {
         if (\CModule::IncludeModule('pull')) {
             $ar = \CIMChat::GetRelationById($newRecord['CHAT_ID']);
             foreach ($ar as $relation) {
                 \CIMContactList::CleanChatCache($relation['USER_ID']);
                 \CPullStack::AddByUser($relation['USER_ID'], array('module_id' => 'im', 'command' => 'chatChangeColor', 'params' => array('chatId' => $newRecord['CHAT_ID'], 'chatColor' => \Bitrix\Im\Color::getColor($newRecord['COLOR']))));
             }
         }
     }
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:39,代码来源:chathandler.php

示例8: InstallDB

 function InstallDB($arParams = array())
 {
     global $DB, $DBType, $APPLICATION;
     $this->errors = false;
     // Database tables creation
     $bDBInstall = !$DB->Query("SELECT 'x' FROM b_workflow_document WHERE 1=0", true);
     if ($bDBInstall) {
         $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/workflow/install/db/" . $DBType . "/install.sql");
     }
     if ($this->errors !== false) {
         $APPLICATION->ThrowException(implode("<br>", $this->errors));
         return false;
     } else {
         RegisterModule("workflow");
         CModule::IncludeModule("workflow");
         if ($bDBInstall) {
             $obWorkflowStatus = new CWorkflowStatus();
             $obWorkflowStatus->Add(array("~TIMESTAMP_X" => $DB->GetNowFunction(), "C_SORT" => 300, "ACTIVE" => "Y", "TITLE" => GetMessage("FLOW_INSTALL_PUBLISHED"), "IS_FINAL" => "Y", "NOTIFY" => "N"));
             $obWorkflowStatus->Add(array("~TIMESTAMP_X" => $DB->GetNowFunction(), "C_SORT" => 100, "ACTIVE" => "Y", "TITLE" => GetMessage("FLOW_INSTALL_DRAFT"), "IS_FINAL" => "N", "NOTIFY" => "N"));
             $obWorkflowStatus->Add(array("~TIMESTAMP_X" => $DB->GetNowFunction(), "C_SORT" => 200, "ACTIVE" => "Y", "TITLE" => GetMessage("FLOW_INSTALL_READY"), "IS_FINAL" => "N", "NOTIFY" => "Y"));
         }
         RegisterModuleDependences("main", "OnPanelCreate", "workflow", "CWorkflow", "OnPanelCreate", "200");
         RegisterModuleDependences("main", "OnChangeFile", "workflow", "CWorkflow", "OnChangeFile");
         //agents
         CAgent::RemoveAgent("CWorkflow::CleanUp();", "workflow");
         CAgent::AddAgent("CWorkflow::CleanUp();", "workflow", "N");
         return true;
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:29,代码来源:index.php

示例9: GetPropertiesDialog

 public static function GetPropertiesDialog($documentType, $activityName, $arWorkflowTemplate, $arWorkflowParameters, $arWorkflowVariables, $arCurrentValues = null, $formName = '')
 {
     if (!CModule::IncludeModule('crm')) {
         return false;
     }
     $runtime = CBPRuntime::GetRuntime();
     $arMap = array('EventType' => 'event_type', 'EventText' => 'event_text');
     if (!is_array($arWorkflowParameters)) {
         $arWorkflowParameters = array();
     }
     if (!is_array($arWorkflowVariables)) {
         $arWorkflowVariables = array();
     }
     if (!is_array($arCurrentValues)) {
         $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
         if (is_array($arCurrentActivity['Properties'])) {
             foreach ($arMap as $k => $v) {
                 if (array_key_exists($k, $arCurrentActivity['Properties'])) {
                     $arCurrentValues[$arMap[$k]] = $arCurrentActivity['Properties'][$k];
                 } else {
                     $arCurrentValues[$arMap[$k]] = '';
                 }
             }
         } else {
             foreach ($arMap as $k => $v) {
                 $arCurrentValues[$arMap[$k]] = '';
             }
         }
     }
     return $runtime->ExecuteResourceFile(__FILE__, 'properties_dialog.php', array('arCurrentValues' => $arCurrentValues, 'arTypes' => CCrmStatus::GetStatusList('EVENT_TYPE'), 'formName' => $formName));
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:crmeventaddactivity.php

示例10: getCradoBaners

 /**
  * ’эндлер, отслеживающий изменени¤ в инфоблоках
  * @param $arFields
  * @return bool
  */
 static function getCradoBaners()
 {
     //$arResult = array();
     CModule::IncludeModule('iblock');
     global $DB;
     $result = $DB->Query('SELECT * FROM b_cradobaners');
     $arResult = array();
     $i = 0;
     while ($res = $result->fetch()) {
         $arResult[$i]['ID'] = $res['ID'];
         $arResult[$i]['COUNT_CLICK'] = $res['UF_COUNTCLICK'];
         $arResult[$i]['COUNT_VIEW'] = $res['UF_COUNTVIEW'];
         $arResult[$i]['DATE_LAST_CLICK'] = $res['UF_DATECLICK'];
         $obElement = CIBlockElement::GetByID($res['UF_IDBANERS']);
         if ($arEl = $obElement->GetNext()) {
             //$arResult[$i]['BANNER'] = $arEl;
             $arResult[$i]['BANNER']['ID'] = $arEl['ID'];
             $arResult[$i]['BANNER']['NAME'] = $arEl['NAME'];
             //Баннер в категории
             if ($arEl['PREVIEW_PICTURE'] != '') {
                 $arResult[$i]['BANNER']['BANNER_CATEGORY'] = CFile::ResizeImageGet($arEl['PREVIEW_PICTURE'], array('width' => 140, 'height' => 95), BX_RESIZE_IMAGE_PROPORTIONAL, true);
             }
             if ($arEl['DETAIL_PICTURE'] != '') {
                 $arResult[$i]['BANNER']['BANNER_ELEMENT'] = CFile::ResizeImageGet($arEl['DETAIL_PICTURE'], array('width' => 82, 'height' => 140), BX_RESIZE_IMAGE_PROPORTIONAL, true);
             }
         }
         $i++;
     }
     return $arResult;
 }
开发者ID:CheBurashka334,项目名称:crado,代码行数:35,代码来源:cCradoBaners.php

示例11: sendMes

 /**
  * @param int $idUserFrom
  * @param int $idUserTo
  * @param string $title
  * @param string $type
  * @param string $idQuestion
  * @param string $textMessage
  * @return int
  */
 public static function sendMes($idUserFrom = 1, $idUserTo = 1, $title, $idQuestion, $textMessage = "", $type = "P")
 {
     $res = false;
     $senderUserID = $idUserFrom;
     $targetUserID = $idUserTo;
     $arFieldsMes = array("FROM_USER_ID" => $senderUserID, "TO_USER_ID" => $targetUserID, "TITLE" => $title, "MESSAGE" => $idQuestion, "DATE_CREATE" => date("d.m.Y H:i:s", time() - DIFFERENT_WITH_MOSCOW_TIME), "DATE_VIEW" => false, "MESSAGE_TYPE" => $type, "FROM_DELETED" => "N", "TO_DELETED" => "N", "SEND_MAIL" => "Y");
     if (CModule::IncludeModule("socialnetwork")) {
         $res = CSocNetMessages::Add($arFieldsMes);
         if ($res) {
             if (CModule::IncludeModule("iblock")) {
                 if (CModule::IncludeModule('payments')) {
                     $userInfo = new CLawPayment();
                     $InfoUserFrom = $userInfo->userInfo($idUserFrom);
                     $InfoUserTo = $userInfo->userInfo($idUserTo);
                     $emailFrom = $InfoUserFrom["EMAIL"];
                     $emailUser = $InfoUserTo["EMAIL"];
                     SendMessage::sendMessOnEmail($emailFrom, $emailUser, $title, $textMessage);
                 }
             }
         } else {
             $errorMessage = "";
             if ($err = $GLOBALS["APPLICATION"]->GetException()) {
                 $errorMessage = $err->GetString();
             }
             if (StrLen($errorMessage) <= 0) {
                 $errorMessage = GetMessage("SONET_UR_ERROR_CREATE_MESSAGE");
             }
             $GLOBALS["APPLICATION"]->ThrowException($errorMessage, "ERROR_CREATE_MESSAGE");
         }
     }
     return $res;
 }
开发者ID:TzepART,项目名称:functionsAndClasses,代码行数:41,代码来源:send_messege.php

示例12: GetUserWorkflowTaskCount

 public static function GetUserWorkflowTaskCount($workflowIDs, $userID = 0)
 {
     if (!is_array($workflowIDs)) {
         return 0;
     }
     if (!(IsModuleInstalled('bizproc') && CModule::IncludeModule('bizproc'))) {
         return 0;
     }
     $userID = intval($userID);
     if ($userID <= 0) {
         $userID = CCrmSecurityHelper::GetCurrentUserID();
     }
     $filter = array('USER_ID' => $userID);
     $workflowQty = count($workflowIDs);
     if ($workflowQty > 1) {
         //IMPORTANT: will produce SQL error due to CBPTaskService::GetList bug
         //$filter['@WORKFLOW_ID'] = $workflowIDs;
         $filter['WORKFLOW_ID'] = $workflowIDs[0];
     }
     /*elseif($workflowQty === 1)
     		{
     			$filter['WORKFLOW_ID'] = $workflowIDs[0];
     		}*/
     $result = CBPTaskService::GetList(array(), $filter, array(), false, array());
     return is_int($result) ? $result : 0;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:26,代码来源:crm_bizproc_helper.php

示例13: createSmartFilterSeoXML

function createSmartFilterSeoXML()
{
    if (CModule::IncludeModule("iblock")) {
        $resElDB = CIBlockElement::GetList(array("SORT" => "ASC"), array('IBLOCK_ID' => SEO_IBLOCK), false, false, array('PROPERTY_TARGET_ON', 'PROPERTY_INDEX', 'PROPERTY_FOLLOW', 'IBLOCK_ID', 'ID', 'NAME'));
        $protocol = CMain::IsHTTPS() ? "https" : "http";
        $host = $_SERVER['HTTP_HOST'];
        if ($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443 && $_SERVER['SERVER_PORT'] > 0 && strpos($_SERVER['HTTP_HOST'], ":") === false) {
            $host .= ":" . $_SERVER['SERVER_PORT'];
        }
        $curDate = date("Y-m-d\\TH:i:s P");
        $strBeginSmartFilter = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
        $index = 0;
        while ($res = $resElDB->fetch()) {
            $exp = explode('*', $res['PROPERTY_TARGET_ON_VALUE']['TEXT']);
            $urlFilter = trim($exp[0]);
            //clean url of smart filter
            if ($index == 0) {
                $strBeginSmartFilter .= "\t<url>\n\t\t";
                $index++;
            } else {
                $strBeginSmartFilter .= "<url>\n\t\t";
            }
            $strBeginSmartFilter .= "<loc>" . $protocol . "://" . $host . $urlFilter . "</loc>\n\t\t";
            $strBeginSmartFilter .= "<lastmod>" . $curDate . "</lastmod>\n\t";
            $strBeginSmartFilter .= "</url>";
        }
        $strBeginSmartFilter .= "</urlset\n>";
        $smartXmlFileName = 'sitemap_iblock_' . SEO_IBLOCK . '.xml';
        $el = fopen($_SERVER['DOCUMENT_ROOT'] . '/' . $smartXmlFileName, "w");
        fwrite($el, $strBeginSmartFilter);
        fclose($el);
        return "createSmartFilterSeoXML();";
    }
}
开发者ID:VitaliiSestrenskyi,项目名称:sest,代码行数:34,代码来源:createSmartFilterSeoXML.php

示例14: toView

 /**
  * @return array
  */
 protected function toView()
 {
     /* @global CUser $USER */
     global $USER;
     if (!CModule::includeModule('security')) {
         return array('MESSAGE' => Loc::getMessage('SECURITY_AUTH_OTP_MANDATORY_MODULE_ERROR'));
     }
     if (!Otp::isOtpRequiredByMandatory()) {
         return array('MESSAGE' => Loc::getMessage('SECURITY_AUTH_OTP_MANDATORY_NOT_REQUIRED'));
     }
     if ($USER->IsAuthorized()) {
         return array('MESSAGE' => Loc::getMessage('SECURITY_AUTH_OTP_MANDATORY_AUTH_ERROR'));
     }
     $deferredParams = Otp::getDeferredParams();
     if (!$deferredParams['USER_ID']) {
         return array('MESSAGE' => Loc::getMessage('SECURITY_AUTH_OTP_MANDATORY_UNKNOWN_ERROR'));
     }
     $result = array();
     $otp = Otp::getByUser($deferredParams['USER_ID']);
     $otp->regenerate();
     $result['SECRET'] = $otp->getHexSecret();
     $result['TYPE'] = $otp->getType();
     $result['APP_SECRET'] = $otp->getAppSecret();
     $result['APP_SECRET_SPACED'] = chunk_split($result['APP_SECRET'], 4, ' ');
     $result['PROVISION_URI'] = $otp->getProvisioningUri();
     $result['SUCCESSFUL_URL'] = $this->arParams['SUCCESSFUL_URL'];
     $result['TWO_CODE_REQUIRED'] = $otp->getAlgorithm()->isTwoCodeRequired();
     $result['OTP'] = $otp;
     return $result;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:33,代码来源:class.php

示例15: Request

 function Request($server, $page, $port, $method, $namespace, $login, $password, $arParams)
 {
     if (!CModule::IncludeModule("webservice")) {
         return false;
     }
     global $APPLICATION;
     $client = new CSOAPClient($server, $page, $port);
     $client->setLogin($login);
     $client->setPassword($password);
     $request = new CSOAPRequest($method, $namespace, $arParams);
     $response = $client->send($request);
     if (is_object($response) && $response->isFault()) {
         if (XDI_XML_ERROR_DEBUG) {
             CXDImport::WriteToLog("ERROR: Incorrect webservice response. Raw response: " . $client->getRawResponse(), "RXML");
         }
         return false;
     } else {
         if (XDI_XML_DEBUG) {
             CXDImport::WriteToLog("Successfull webservice response. Raw response: " . $client->getRawResponse(), "RXML");
         }
         if (is_object($response)) {
             return $response->Value;
         } else {
             return false;
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:27,代码来源:lf_scheme_xml.php


注:本文中的CModule类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。