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


PHP Event::getResults方法代码示例

本文整理汇总了PHP中Bitrix\Main\Event::getResults方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::getResults方法的具体用法?PHP Event::getResults怎么用?PHP Event::getResults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bitrix\Main\Event的用法示例。


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

示例1: getInstance

 private static function getInstance()
 {
     if (self::$instance) {
         return self::$instance;
     }
     $loader = new BitrixLoader($_SERVER['DOCUMENT_ROOT']);
     $c = Configuration::getInstance();
     $config = $c->get('maximaster');
     $twigConfig = (array) $config['tools']['twig'];
     $defaultConfig = array('debug' => false, 'charset' => SITE_CHARSET, 'cache' => $_SERVER['DOCUMENT_ROOT'] . '/bitrix/cache/maximaster/tools.twig', 'auto_reload' => isset($_GET['clear_cache']) && strtoupper($_GET['clear_cache']) == 'Y', 'autoescape' => false);
     $twigOptions = array_merge($defaultConfig, $twigConfig);
     $twig = new \Twig_Environment($loader, $twigOptions);
     if ($twig->isDebug()) {
         $twig->addExtension(new \Twig_Extension_Debug());
     }
     $twig->addExtension(new BitrixExtension());
     $twig->addExtension(new CustomFunctionsExtension());
     $event = new Event('', 'onAfterTwigTemplateEngineInited', array($twig));
     $event->send();
     if ($event->getResults()) {
         foreach ($event->getResults() as $evenResult) {
             if ($evenResult->getType() == \Bitrix\Main\EventResult::SUCCESS) {
                 $twig = current($evenResult->getParameters());
             }
         }
     }
     return self::$instance = $twig;
 }
开发者ID:mlavrinenko,项目名称:tools.twig,代码行数:28,代码来源:TemplateEngine.php

示例2: initClassesList

 public static function initClassesList()
 {
     if (static::$classes !== null) {
         return true;
     }
     $classes = array('\\Bitrix\\Sale\\Delivery\\ExtraServices\\Enum' => 'lib/delivery/extra_services/enum.php', '\\Bitrix\\Sale\\Delivery\\ExtraServices\\Store' => 'lib/delivery/extra_services/store.php', '\\Bitrix\\Sale\\Delivery\\ExtraServices\\String' => 'lib/delivery/extra_services/string.php', '\\Bitrix\\Sale\\Delivery\\ExtraServices\\Checkbox' => 'lib/delivery/extra_services/checkbox.php');
     \Bitrix\Main\Loader::registerAutoLoadClasses('sale', $classes);
     unset($classes['\\Bitrix\\Sale\\Delivery\\ExtraServices\\Store']);
     static::$classes = array_keys($classes);
     $event = new Event('sale', 'onSaleDeliveryExtraServicesClassNamesBuildList');
     $event->send();
     $resultList = $event->getResults();
     if (is_array($resultList) && !empty($resultList)) {
         $customClasses = array();
         foreach ($resultList as $eventResult) {
             /** @var  EventResult $eventResult*/
             if ($eventResult->getType() != EventResult::SUCCESS) {
                 throw new SystemException("Can't add custom tracking class successfully");
             }
             $params = $eventResult->getParameters();
             if (!empty($params) && is_array($params)) {
                 $customClasses = array_merge($customClasses, $params);
             }
         }
         if (!empty($customClasses)) {
             \Bitrix\Main\Loader::registerAutoLoadClasses(null, $customClasses);
             $classes = array_merge($customClasses, $classes);
         }
     }
     static::$classes = array_merge(array_keys($classes), static::$classes);
     return static::$classes;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:32,代码来源:manager.php

示例3: generateInitEvent

 /**
  * Создается событие для внесения в Twig изменения из проекта
  */
 private function generateInitEvent()
 {
     $eventName = 'onAfterTwigTemplateEngineInited';
     $event = new Event('', $eventName, array($this->engine));
     $event->send();
     if ($event->getResults()) {
         foreach ($event->getResults() as $evenResult) {
             if ($evenResult->getType() == \Bitrix\Main\EventResult::SUCCESS) {
                 $twig = current($evenResult->getParameters());
                 if (!$twig instanceof \Twig_Environment) {
                     throw new \LogicException("Событие '{$eventName}' должно возвращать экземпляр класса '\\Twig_Environment' при успешной отработке");
                 }
                 $this->engine = $twig;
             }
         }
     }
 }
开发者ID:maximaster,项目名称:tools.twig,代码行数:20,代码来源:TemplateEngine.php

示例4: isSuccess

 public static function isSuccess(\Bitrix\Main\Event $event)
 {
     foreach ($event->getResults() as $result) {
         if ($result->getType() === EventResult::ERROR) {
             return false;
         }
     }
     return true;
 }
开发者ID:irpsv,项目名称:juggernaut.bitrix,代码行数:9,代码来源:Event.php

示例5: getList

 /**
  * @return array
  */
 public static function getList()
 {
     $resultList = array();
     $event = new Event('sender', 'OnPresetTemplateList');
     $event->send();
     if ($event->getResults()) {
         foreach ($event->getResults() as $eventResult) {
             if ($eventResult->getType() == EventResult::ERROR) {
                 continue;
             }
             $eventResultParameters = $eventResult->getParameters();
             if (!empty($eventResultParameters)) {
                 $resultList = array_merge($resultList, $eventResultParameters);
             }
         }
     }
     return $resultList;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:21,代码来源:template.php

示例6: addExtensions

 /**
  * Добавляет расширения, в том числе расширение для битрикса,
  * в котором добавляются нужные глобальные переменные и т.п.
  */
 private function addExtensions()
 {
     $this->getEnvironment()->addExtension(new \Twig_Extension_Debug());
     $this->getEnvironment()->addExtension(new BitrixExtension());
     $event = new Event('wlbl.twigrix', 'onAddExtensions');
     $event->send();
     foreach ($event->getResults() as $result) {
         if ($result->getType() == EventResult::SUCCESS) {
             foreach ($result->getParameters() as $extension) {
                 if ($extension instanceof \Twig_Extension) {
                     $this->getEnvironment()->addExtension($extension);
                 }
             }
         }
     }
 }
开发者ID:wlbl,项目名称:twigrix,代码行数:20,代码来源:templateengine.php

示例7: __construct

 protected function __construct()
 {
     $event = new Main\Event("main", "OnApplicationsBuildList");
     $event->send();
     foreach ($event->getResults() as $eventResult) {
         $result = $eventResult->getParameters();
         if (is_array($result)) {
             if (!is_array($result[0])) {
                 $result = array($result);
             }
             foreach ($result as $app) {
                 $this->applications[$app["ID"]] = $app;
             }
         }
     }
     Main\Type\Collection::sortByColumn($this->applications, "SORT");
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:17,代码来源:applicationmanager.php

示例8: getUserByPassword

 public static function getUserByPassword($login, $password, $passwordIsOriginal = true)
 {
     if (empty($login)) {
         throw new Main\ArgumentNullException("login");
     }
     $event = new Main\Event("main", "OnBeforeUserLogin", array(array("LOGIN" => $login, "PASSWORD" => $password, "PASSWORD_ORIGINAL" => $passwordIsOriginal)));
     $event->send();
     if (($eventResults = $event->getResults()) !== null) {
         foreach ($eventResults as $eventResult) {
             if ($eventResult->getResultType() === Main\EventResult::ERROR) {
                 static::$lastError = $eventResult->getParameters();
                 return null;
             } elseif ($eventResult->getResultType() === Main\EventResult::SUCCESS) {
                 if (($resultParams = $eventResult->getParameters()) && is_array($resultParams)) {
                     if (isset($resultParams["LOGIN"])) {
                         $login = $resultParams["LOGIN"];
                     }
                     if (isset($resultParams["PASSWORD"])) {
                         $password = $resultParams["PASSWORD"];
                     }
                     if (isset($resultParams["PASSWORD_ORIGINAL"])) {
                         $passwordIsOriginal = $resultParams["PASSWORD_ORIGINAL"];
                     }
                 }
             }
         }
     }
     $user = null;
     $event = new Main\Event("main", "OnUserLoginExternal", array(array("LOGIN" => $login, "PASSWORD" => $password, "PASSWORD_ORIGINAL" => $passwordIsOriginal)));
     $event->send();
     if (($eventResults = $event->getResults()) !== null) {
         foreach ($eventResults as $eventResult) {
             if ($eventResult->getResultType() === Main\EventResult::SUCCESS) {
                 $userId = $eventResult->getParameters();
                 if (!Main\Type\Int::isInteger($userId)) {
                     throw new SecurityException();
                 }
                 $user = new CurrentUser($userId);
                 break;
             }
         }
     }
     $connection = Main\Application::getDbConnection();
     $sqlHelper = $connection->getSqlHelper();
     if (is_null($user)) {
         $sql = "SELECT U.ID, U.PASSWORD, U.LOGIN_ATTEMPTS " . "FROM b_user U  " . "WHERE U.LOGIN = '" . $sqlHelper->forSql($login) . "' " . "\tAND (U.EXTERNAL_AUTH_ID IS NULL OR U.EXTERNAL_AUTH_ID = '') " . "   AND U.ACTIVE = 'Y' ";
         $userRecordset = $connection->query($sql);
         if ($userRecord = $userRecordset->fetch()) {
             $userTmp = new CurrentUser($userRecord["ID"]);
             $salt = substr($userRecord["PASSWORD"], 0, -32);
             $passwordFromDb = substr($userRecord["PASSWORD"], -32);
             if ($passwordIsOriginal) {
                 $passwordFromUser = md5($salt . $password);
             } else {
                 $passwordFromUser = strlen($password) > 32 ? substr($password, -32) : $password;
             }
             $policy = $userTmp->getPolicy();
             $policyLoginAttempts = intval($policy["LOGIN_ATTEMPTS"]);
             $userLoginAttempts = intval($userRecord["LOGIN_ATTEMPTS"]) + 1;
             if ($policyLoginAttempts > 0 && $userLoginAttempts > $policyLoginAttempts) {
                 //					$_SESSION["BX_LOGIN_NEED_CAPTCHA"] = true;
                 //					if (!$APPLICATION->captchaCheckCode($_REQUEST["captcha_word"], $_REQUEST["captcha_sid"]))
                 //					{
                 //						$passwordUser = false;
                 //					}
             }
             if ($passwordFromDb === $passwordFromUser) {
                 $user = $userTmp;
                 //update digest hash for http digest authorization
                 if ($passwordIsOriginal && Main\Config\Option::get('main', 'use_digest_auth', 'N') == 'Y') {
                     static::updateDigest($user->getUserId(), $password);
                 }
             } else {
                 $connection->query("UPDATE b_user SET " . "   LOGIN_ATTEMPTS = " . $userLoginAttempts . " " . "WHERE ID = " . intval($userRecord["ID"]));
             }
         }
     }
     if (is_null($user)) {
         if (Main\Config\Option::get("main", "event_log_login_fail", "N") === "Y") {
             \CEventLog::log("SECURITY", "USER_LOGIN", "main", $login, "LOGIN_FAILED");
         }
         return null;
     }
     if ($user->getUserId() !== 1) {
         $limitUsersCount = intval(Main\Config\Option::get("main", "PARAM_MAX_USERS", 0));
         if ($limitUsersCount > 0) {
             $usersCount = Main\UserTable::getActiveUsersCount();
             if ($usersCount > $limitUsersCount) {
                 $sql = "SELECT 'x' " . "FROM b_user " . "WHERE ACTIVE = 'Y' " . "   AND ID = " . intval($user->getUserId()) . " " . "   AND LAST_LOGIN IS NULL ";
                 $recordset = $connection->query($sql);
                 if ($recordset->fetch()) {
                     $user = null;
                     static::$lastError = array("CODE" => "LIMIT_USERS_COUNT", "MESSAGE" => Main\Localization\Loc::getMessage("LIMIT_USERS_COUNT"));
                 }
             }
         }
     }
     if (is_null($user)) {
         if (Main\Config\Option::get("main", "event_log_login_fail", "N") === "Y") {
             \CEventLog::log("SECURITY", "USER_LOGIN", "main", $login, "LIMIT_USERS_COUNT");
//.........这里部分代码省略.........
开发者ID:Satariall,项目名称:izurit,代码行数:101,代码来源:authentication.php

示例9: read

 /**
  * @param array $arData
  * @return bool
  */
 public static function read(array $arData)
 {
     if (array_key_exists('MODULE_ID', $arData)) {
         $filter = array($arData['MODULE_ID']);
     } else {
         $filter = null;
     }
     $event = new \Bitrix\Main\Event("main", "OnMailEventMailRead", array($arData['FIELDS']), $filter);
     $event->send();
     foreach ($event->getResults() as $eventResult) {
         if ($eventResult->getType() == \Bitrix\Main\EventResult::ERROR) {
             return false;
         }
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:20,代码来源:tracking.php

示例10: unsubscribe

 /**
  * @param $arData
  * @return bool
  */
 public static function unsubscribe($arData)
 {
     if (!is_array($arData['FIELDS'])) {
         return false;
     }
     $event = new Event("main", "OnMailEventSubscriptionDisable", array($arData['FIELDS']), array($arData['MODULE_ID']));
     $event->send();
     foreach ($event->getResults() as $eventResult) {
         if ($eventResult->getType() == EventResult::ERROR) {
             return false;
         }
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:18,代码来源:tracking.php

示例11: save

 /**
  * @return Entity\Result|bool
  * @throws \Bitrix\Main\ArgumentException
  * @throws \Bitrix\Main\ArgumentNullException
  */
 public function save()
 {
     $result = new Result();
     /** @var Order $order */
     $order = $this->getOrder();
     $itemsFromDb = array();
     $filter = array();
     if (!$order) {
         /** @var Main\Entity\Event $event */
         $event = new Main\Event('sale', EventActions::EVENT_ON_BASKET_BEFORE_SAVED, array('ENTITY' => $this));
         $event->send();
         if ($event->getResults()) {
             /** @var Main\EventResult $eventResult */
             foreach ($event->getResults() as $eventResult) {
                 if ($eventResult->getType() == Main\EventResult::ERROR) {
                     $errorMsg = new ResultError(Main\Localization\Loc::getMessage('SALE_EVENT_ON_BEFORE_BASKET_SAVED'), 'SALE_EVENT_ON_BEFORE_BASKET_SAVED');
                     if ($eventResultData = $eventResult->getParameters()) {
                         if (isset($eventResultData) && $eventResultData instanceof ResultError) {
                             /** @var ResultError $errorMsg */
                             $errorMsg = $eventResultData;
                         }
                     }
                     $result->addError($errorMsg);
                 }
             }
             if (!$result->isSuccess()) {
                 return $result;
             }
         }
     }
     $isNew = $order && $order->isNew() ? true : false;
     if ($order && !$isNew) {
         $filter['ORDER_ID'] = $order->getId();
     } else {
         if ($this->isLoadForFuserId()) {
             $filter = array('FUSER_ID' => $this->getFUserId(), 'ORDER_ID' => null, 'LID' => $this->getSiteId());
         }
         if ($isNew) {
             $fUserId = $this->getFUserId(true);
             if ($fUserId <= 0) {
                 $userId = $order->getUserId();
                 if (intval($userId) > 0) {
                     $fUserId = Fuser::getIdByUserId($userId);
                     if ($fUserId > 0) {
                         $this->setFUserId($fUserId);
                     }
                 }
             }
         }
     }
     if (!empty($filter)) {
         $itemsFromDbList = Internals\BasketTable::getList(array("filter" => $filter, "select" => array("ID", 'TYPE', 'SET_PARENT_ID', 'PRODUCT_ID', 'NAME', 'QUANTITY', 'FUSER_ID', 'ORDER_ID')));
         while ($itemsFromDbItem = $itemsFromDbList->fetch()) {
             if (intval($itemsFromDbItem['SET_PARENT_ID']) > 0 && intval($itemsFromDbItem['SET_PARENT_ID']) != $itemsFromDbItem['ID']) {
                 continue;
             }
             $itemsFromDb[$itemsFromDbItem["ID"]] = $itemsFromDbItem;
         }
     }
     if ($order && ($order->getId() > 0 && $this->getOrderId() == 0)) {
         $this->orderId = $order->getId();
     }
     $changeMeaningfulFields = array("PRODUCT_ID", "QUANTITY", "PRICE", "DISCOUNT_VALUE", "VAT_RATE", "NAME");
     /** @var BasketItem $basketItem */
     foreach ($this->collection as $index => $basketItem) {
         $isNew = (bool) ($basketItem->getId() <= 0);
         $isChanged = $basketItem->isChanged();
         if ($order && $order->getId() > 0 && $isChanged) {
             $logFields = array();
             $fields = $basketItem->getFields();
             $originalValues = $fields->getOriginalValues();
             foreach ($originalValues as $originalFieldName => $originalFieldValue) {
                 if (in_array($originalFieldName, $changeMeaningfulFields) && $basketItem->getField($originalFieldName) != $originalFieldValue) {
                     $logFields[$originalFieldName] = $basketItem->getField($originalFieldName);
                     $logFields['OLD_' . $originalFieldName] = $originalFieldValue;
                 }
             }
         }
         $r = $basketItem->save();
         if ($r->isSuccess()) {
             if ($order && $order->getId() > 0) {
                 if ($isChanged) {
                     OrderHistory::addLog('BASKET', $order->getId(), $isNew ? "BASKET_ITEM_ADD" : "BASKET_ITEM_UPDATE", $basketItem->getId(), $basketItem, $logFields, OrderHistory::SALE_ORDER_HISTORY_LOG_LEVEL_1);
                     OrderHistory::addAction('BASKET', $order->getId(), "BASKET_SAVED", $basketItem->getId(), $basketItem);
                 }
             }
         } else {
             $result->addErrors($r->getErrors());
         }
         if (isset($itemsFromDb[$basketItem->getId()]) && $basketItem->getQuantity() > 0) {
             unset($itemsFromDb[$basketItem->getId()]);
         }
     }
     if (!empty($filter)) {
         $itemEventName = BasketItem::getEntityEventName();
//.........这里部分代码省略.........
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:101,代码来源:basket.php

示例12: setFields

 /**
  *
  * @param array $values
  * @return Result
  * @throws Main\ArgumentOutOfRangeException
  * @throws Main\NotSupportedException
  * @throws \Exception
  */
 public function setFields(array $values)
 {
     $resultData = array();
     $result = new Result();
     $oldValues = null;
     foreach ($values as $key => $value) {
         $oldValues[$key] = $this->fields->get($key);
     }
     if ($eventName = static::getEntityEventName()) {
         $event = new Main\Event('sale', 'OnBefore' . $eventName . 'SetFields', array('ENTITY' => $this, 'VALUES' => $values, 'OLD_VALUES' => $oldValues));
         $event->send();
         if ($event->getResults()) {
             /** @var Main\EventResult $eventResult */
             foreach ($event->getResults() as $eventResult) {
                 if ($eventResult->getType() == Main\EventResult::SUCCESS) {
                     if ($eventResultData = $eventResult->getParameters()) {
                         if (isset($eventResultData['VALUES'])) {
                             $values = $eventResultData['VALUES'];
                         }
                     }
                 } elseif ($eventResult->getType() == Main\EventResult::ERROR) {
                     $errorMsg = new ResultError(Main\Localization\Loc::getMessage('SALE_EVENT_ON_BEFORE_' . strtoupper($eventName) . '_SET_FIELDS_ERROR'), 'SALE_EVENT_ON_BEFORE_' . strtoupper($eventName) . '_SET_FIELDS_ERROR');
                     if ($eventResultData = $eventResult->getParameters()) {
                         if (isset($eventResultData['ERROR']) && $eventResultData['ERROR'] instanceof ResultError) {
                             $errorMsg = $eventResultData['ERROR'];
                         }
                     }
                     $result->addError($errorMsg);
                 }
             }
         }
     }
     if (!$result->isSuccess()) {
         return $result;
     }
     $isStartField = $this->isStartField();
     foreach ($values as $key => $value) {
         $r = $this->setField($key, $value);
         if (!$r->isSuccess()) {
             $data = $r->getData();
             if (!empty($data) && is_array($data)) {
                 $resultData = array_merge($resultData, $data);
             }
             $result->addErrors($r->getErrors());
         }
     }
     if (!empty($resultData)) {
         $result->setData($resultData);
     }
     if ($isStartField) {
         $hasMeaningfulFields = $this->hasMeaningfulField();
         /** @var Result $r */
         $r = $this->doFinalAction($hasMeaningfulFields);
         if (!$r->isSuccess()) {
             $result->addErrors($r->getErrors());
         } else {
             if (($data = $r->getData()) && !empty($data) && is_array($data)) {
                 $result->setData($result->getData() + $data);
             }
         }
     }
     return $result;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:71,代码来源:entity.php

示例13: doFinalAction

 /**
  * @param bool $hasMeaningfulField
  * @return Result
  * @throws Main\ArgumentNullException
  * @throws Main\ObjectNotFoundException
  */
 public function doFinalAction($hasMeaningfulField = false)
 {
     $result = new Result();
     if (!$hasMeaningfulField) {
         $this->clearStartField();
         return $result;
     }
     if ($basket = $this->getBasket()) {
         $this->setMathActionOnly(true);
         if ($eventName = static::getEntityEventName()) {
             $event = new Main\Event('sale', 'OnBefore' . $eventName . 'FinalAction', array('ENTITY' => $this, 'HAS_MEANINGFUL_FIELD' => $hasMeaningfulField, 'BASKET' => $basket));
             $event->send();
             if ($event->getResults()) {
                 /** @var Main\EventResult $eventResult */
                 foreach ($event->getResults() as $eventResult) {
                     if ($eventResult->getType() == Main\EventResult::ERROR) {
                         $errorMsg = new ResultError(Main\Localization\Loc::getMessage('SALE_EVENT_ON_BEFORE_' . strtoupper($eventName) . '_FINAL_ACTION_ERROR'), 'SALE_EVENT_ON_BEFORE_' . strtoupper($eventName) . '_FINAL_ACTION_ERROR');
                         if ($eventResultData = $eventResult->getParameters()) {
                             if (isset($eventResultData['ERROR']) && $eventResultData['ERROR'] instanceof ResultError) {
                                 $errorMsg = $eventResultData['ERROR'];
                             }
                         }
                         $result->addError($errorMsg);
                     }
                 }
             }
             if (!$result->isSuccess()) {
                 return $result;
             }
         }
         // discount
         $discount = $this->getDiscount();
         $r = $discount->calculate();
         if (!$r->isSuccess()) {
             //				$this->clearStartField();
             //				$result->addErrors($r->getErrors());
             //				return $result;
         }
         if ($r->isSuccess() && ($discountData = $r->getData()) && !empty($discountData) && is_array($discountData)) {
             /** @var Result $r */
             $r = $this->applyDiscount($discountData);
             if (!$r->isSuccess()) {
                 $result->addErrors($r->getErrors());
                 return $result;
             }
         }
         if (!$this->isExternal()) {
             /** @var Tax $tax */
             $tax = $this->getTax();
             /** @var Result $r */
             $r = $tax->calculate();
             if (!$result->isSuccess()) {
                 return $r;
             }
             $r = $tax->calculateDelivery();
             if (!$result->isSuccess()) {
                 return $r;
             }
             $taxChanged = false;
             $taxResult = $r->getData();
             if (isset($taxResult['TAX_PRICE']) && floatval($taxResult['TAX_PRICE']) >= 0) {
                 if (!$this->isUsedVat()) {
                     $taxChanged = true;
                     $this->setField('TAX_PRICE', $taxResult['TAX_PRICE']);
                     $this->setFieldNoDemand("PRICE", $this->getBasket()->getPrice() + $this->getShipmentCollection()->getPriceDelivery() + $taxResult['TAX_PRICE']);
                 }
             }
             if ($taxChanged || $this->isUsedVat()) {
                 $taxValue = $this->isUsedVat() ? $this->getVatSum() : $this->getField('TAX_PRICE');
                 if (floatval($taxValue) != floatval($this->getField('TAX_VALUE'))) {
                     $this->setField('TAX_VALUE', floatval($taxValue));
                 }
             }
         }
     }
     //
     $this->setMathActionOnly(false);
     //
     /** @var Result $r */
     $r = $this->syncOrderAndPayments();
     if (!$r->isSuccess()) {
         $result->addErrors($r->getErrors());
     }
     $this->clearStartField();
     if ($eventName = static::getEntityEventName()) {
         $event = new Main\Event('sale', 'OnAfter' . $eventName . 'FinalAction', array('ENTITY' => $this));
         $event->send();
     }
     return $result;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:96,代码来源:order.php

示例14: microtime

            $bCanEdit = false;
        }
        //need fm_lpa for every .php file, even with no php code inside
        if ($bCanEdit && !$USER->CanDoOperation('edit_php') && in_array(GetFileExtension($currentFilePath), GetScriptFileExt()) && !$USER->CanDoFileOperation('fm_lpa', array(SITE_ID, $currentFilePath))) {
            $bCanEdit = false;
        }
        if ($bCanEdit && IsModuleInstalled("fileman") && !($USER->CanDoOperation("fileman_admin_files") && $USER->CanDoOperation("fileman_edit_existent_files"))) {
            $bCanEdit = false;
        }
        if ($bCanEdit) {
            echo $APPLICATION->IncludeStringBefore();
            $BX_GLOBAL_AREA_EDIT_ICON = true;
        }
    }
}
define("START_EXEC_PROLOG_AFTER_2", microtime());
$GLOBALS["BX_STATE"] = "WA";
$APPLICATION->RestartWorkarea(true);
//magically replacing the current file with another one
$event = new Main\Event("main", "OnFileRewrite", array("path" => Main\Context::getCurrent()->getRequest()->getScriptFile()));
$event->send();
foreach ($event->getResults() as $evenResult) {
    if (($result = $evenResult->getParameters()) != '') {
        $file = new Main\IO\File($_SERVER["DOCUMENT_ROOT"] . $result);
        if ($file->isExists()) {
            //only the first result matters
            include $file->getPhysicalPath();
            die;
        }
    }
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:prolog_after.php

示例15: calculate

 /**
  * Calculates delivery price
  * @param \Bitrix\Sale\Shipment $shipment.
  * @return \Bitrix\Sale\Delivery\CalculationResult
  */
 public function calculate(\Bitrix\Sale\Shipment $shipment = null)
 {
     if ($shipment && !$shipment->getCollection()) {
         return false;
     }
     $result = $this->calculateConcrete($shipment);
     if ($shipment) {
         $this->extraServices->setValues($shipment->getExtraServices());
         $extraServicePrice = $this->extraServices->getTotalCost();
         if (floatval($extraServicePrice) > 0) {
             $result->setExtraServicesPrice($extraServicePrice);
         }
     }
     $eventParams = array("RESULT" => $result, "SHIPMENT" => $shipment);
     $event = new Event('sale', self::EVENT_ON_CALCULATE, $eventParams);
     $event->send();
     $resultList = $event->getResults();
     if (is_array($resultList) && !empty($resultList)) {
         foreach ($resultList as &$eventResult) {
             if ($eventResult->getType() != EventResult::SUCCESS) {
                 continue;
             }
             $params = $eventResult->getParameters();
             if (isset($params["RESULT"])) {
                 $result = $params["RESULT"];
             }
         }
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:35,代码来源:base.php


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