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


PHP Notifications::addInfo方法代码示例

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


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

示例1: closeTransaction

 public function closeTransaction($succesMessage = 'Updated', $checkAllConjucts = true, $databaseCommit = false, $setNewContent = true)
 {
     $session = Session::singleton();
     Hooks::callHooks('preDatabaseCloseTransaction', get_defined_vars());
     Notifications::addLog('========================= CLOSING TRANSACTION =========================', 'DATABASE');
     if ($checkAllConjucts) {
         Notifications::addLog("Check all conjuncts", 'DATABASE');
         // Evaluate all invariant conjuncts. Conjuncts are cached.
         $invariantRulesHold = RuleEngine::checkInvariantRules();
         // Evaluate all signal conjuncts. Conjuncts are cached
         RuleEngine::checkProcessRules();
     } else {
         Notifications::addLog("Check all affected conjuncts", 'DATABASE');
         // Evaluate all affected invariant conjuncts. Conjuncts are cached.
         $invariantRulesHold = RuleEngine::checkInvariantRules(RuleEngine::getAffectedInvConjuncts($this->affectedConcepts, $this->affectedRelations), true);
         // Evaluate all affected signal conjuncts. Conjuncts are cached
         RuleEngine::checkConjuncts(RuleEngine::getAffectedSigConjuncts($this->affectedConcepts, $this->affectedRelations), true);
         // Check only those process rules that are relevant for the activate roles
         RuleEngine::checkProcessRules($session);
     }
     unset($this->affectedConcepts, $this->affectedRelations);
     $this->affectedConcepts = array();
     $this->affectedRelations = array();
     if ($setNewContent && isset($session->atom)) {
         $session->atom->setNewContent($session->interface);
     }
     // e.g. not needed in Atom::delete() function
     if ($invariantRulesHold && $databaseCommit) {
         $this->commitTransaction();
         // commit database transaction
         Notifications::addSuccess($succesMessage);
     } elseif (Config::get('ignoreInvariantViolations', 'transactions') && COMMIT_INV_VIOLATIONS) {
         $this->commitTransaction();
         Notifications::addError("Transaction committed with invariant violations");
     } elseif ($invariantRulesHold) {
         $this->rollbackTransaction();
         // rollback database transaction
         Notifications::addInfo($succesMessage);
     } else {
         $this->rollbackTransaction();
         // rollback database transaction
     }
     Hooks::callHooks('postDatabaseCloseTransaction', get_defined_vars());
     return $invariantRulesHold;
 }
开发者ID:4ZP6Capstone2015,项目名称:ampersand,代码行数:45,代码来源:Database.php

示例2: getSignalsFromDB

 public static function getSignalsFromDB($conjunctIds)
 {
     $db = Database::singleton();
     $result = array();
     $conjunctIds = array_unique($conjunctIds);
     // remove duplicates
     if (count($conjunctIds) > 0) {
         // TODO: DB Query can be changed to WHERE `conjId` IN (<conjId1>, <conjId2>, etc)
         $query = "SELECT * FROM `__all_signals__` WHERE " . implode(' OR ', array_map(function ($conjunctId) {
             return "`conjId` = '{$conjunctId}'";
         }, $conjunctIds));
         $result = $db->Exe($query);
     } else {
         Notifications::addInfo("No conjunctIds provided (can be that this role does not maintain any rule)");
     }
     return $result;
 }
开发者ID:4ZP6Capstone2015,项目名称:Capstone,代码行数:17,代码来源:RuleEngine.php

示例3: checkRule

 public static function checkRule($rule, $cacheConjuncts = true)
 {
     $db = Database::singleton();
     $violations = array();
     Notifications::addLog("Checking rule '" . $rule['name'] . "'", 'RuleEngine');
     try {
         foreach ($rule['conjunctIds'] as $conjunctId) {
             $result = array_merge((array) $result, RuleEngine::checkConjunct($conjunctId, $cacheConjuncts));
         }
         if (count($result) == 0) {
             Notifications::addInfo("Rule '" . $rule['name'] . "' holds", 'RuleEngineRulesThatHold', 'Rules that hold');
         } else {
             $violations = $result;
         }
         return $violations;
     } catch (Exception $e) {
         Notifications::addError("While evaluating rule '" . $rule['name'] . "': " . $e->getMessage());
     }
 }
开发者ID:4ZP6Capstone2015,项目名称:ampersand,代码行数:19,代码来源:RuleEngine.php

示例4: getAtom

 /**
  * @url GET resource/{concept}/{srcAtomId}/{interfaceId}
  * @url GET resource/{concept}/{srcAtomId}/{interfaceId}/{tgtAtomId}
  * @param string $concept
  * @param string $srcAtomId
  * @param string $interfaceId
  * @param string $tgtAtomId
  * @param array $roleIds
  * @param boolean $inclLinktoData
  * @param string $arrayType
  * @param boolean $metaData
  */
 public function getAtom($concept, $srcAtomId, $interfaceId, $tgtAtomId = null, $roleIds = null, $inclLinktoData = false, $arrayType = "assoc", $metaData = true)
 {
     try {
         $session = Session::singleton();
         $session->activateRoles($roleIds);
         $session->setInterface($interfaceId);
         $result = array();
         if ($session->interface->srcConcept != $concept) {
             throw new Exception("Concept '{$concept}' cannot be used as source concept for interface '" . $session->interface->label . "'", 400);
         }
         if (!$session->interface->crudR) {
             throw new Exception("GET is not allowed for interface " . $session->interface->label, 405);
         }
         $atom = new Atom($srcAtomId, $concept);
         if (!$atom->atomExists()) {
             throw new Exception("Resource '{$srcAtomId}' not found", 404);
         }
         $result = (array) $atom->getContent($session->interface, true, $tgtAtomId, $inclLinktoData, $arrayType, $metaData);
         if (empty($result)) {
             Notifications::addInfo("No results found");
         }
         if (is_null($tgtAtomId)) {
             // return array of atoms (i.e. tgtAtoms of the interface given srcAtomId)
             return array_values($result);
             // array_values transforms assoc array to non-assoc array
         } else {
             // return 1 atom (i.e. tgtAtomId)
             return current($result);
         }
     } catch (Exception $e) {
         throw new RestException($e->getCode(), $e->getMessage());
     }
 }
开发者ID:4ZP6Capstone2015,项目名称:ampersand,代码行数:45,代码来源:Api.php

示例5: fixViolations

 public static function fixViolations($rule, $violations)
 {
     if (count($violations)) {
         Notifications::addLog('ExecEngine fixing violations for rule: ' . $rule['name'], 'ExecEngine');
         foreach ($violations as $violation) {
             $theMessage = ExecEngine::getPairView($violation['src'], $rule['srcConcept'], $violation['tgt'], $rule['tgtConcept'], $rule['pairView']);
             // This function tries to return a string with all NULL bytes, HTML and PHP tags stripped from a given str. Strip_tags() is binary safe.
             // $theCleanMessage = strip_tags($theMessage);
             // Determine actions/functions to be taken
             $functionsToBeCalled = explode('{EX}', $theMessage);
             // Execute actions/functions
             foreach ($functionsToBeCalled as $functionToBeCalled) {
                 if (empty($functionToBeCalled)) {
                     continue;
                 }
                 // skips to the next iteration if $functionToBeCalled is empty. This is the case when violation text starts with delimiter {EX}
                 // Determine delimiter
                 if (substr($functionToBeCalled, 0, 2) == '_;') {
                     $delimiter = '_;';
                     $functionToBeCalled = substr($functionToBeCalled, 2);
                 } else {
                     $delimiter = ';';
                 }
                 $params = explode($delimiter, $functionToBeCalled);
                 // Split off variables
                 $params = array_map('trim', $params);
                 // Trim all params
                 $params = array_map('phpArgumentInterpreter', $params);
                 // Evaluate phpArguments, using phpArgumentInterpreter function
                 $function = array_shift($params);
                 // First parameter is function name
                 $classMethod = (array) explode('::', $function);
                 if (function_exists($function) || method_exists($classMethod[0], $classMethod[1])) {
                     $successMessage = call_user_func_array($function, $params);
                     Notifications::addLog($successMessage, 'ExecEngine');
                 } else {
                     $errorMessage = "Function '" . $function . "' does not exists. Create function with " . count($params) . " parameters";
                     throw new Exception($errorMessage, 500);
                 }
             }
         }
         Notifications::addInfo(self::$roleName . ' fixed violations for rule: ' . $rule['name'], 'ExecEngineSuccessMessage', self::$roleName . ' fixed violations');
     }
 }
开发者ID:4ZP6Capstone2015,项目名称:ampersand,代码行数:44,代码来源:ExecEngine.php


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