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


PHP Rule::getRuleWithCriteriasAndActions方法代码示例

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


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

示例1: getRulesForCriteria

 /**
  * Return all rules from database
  *
  * @param $crit array of criteria (at least, 'field' and 'value')
  *
  * @return array of Rule objects
  **/
 function getRulesForCriteria($crit)
 {
     global $DB;
     $rules = array();
     /// TODO : not working for SLALevels : no sub_type
     //Get all the rules whose sub_type is $sub_type and entity is $ID
     $query = "SELECT `" . $this->getTable() . "`.`id`\n                FROM `" . getTableForItemType($this->ruleactionclass) . "`,\n                     `" . $this->getTable() . "`\n                WHERE `" . getTableForItemType($this->ruleactionclass) . "`." . $this->rules_id_field . "\n                           = `" . $this->getTable() . "`.`id`\n                      AND `" . $this->getTable() . "`.`sub_type` = '" . get_class($this) . "'";
     foreach ($crit as $field => $value) {
         $query .= " AND `" . getTableForItemType($this->ruleactionclass) . "`.`{$field}` = '{$value}'";
     }
     foreach ($DB->request($query) as $rule) {
         $affect_rule = new Rule();
         $affect_rule->getRuleWithCriteriasAndActions($rule["id"], 0, 1);
         $rules[] = $affect_rule;
     }
     return $rules;
 }
开发者ID:pvasener,项目名称:glpi,代码行数:24,代码来源:rule.class.php

示例2: getRulesForCriteria

 /**
  * Return all rules from database
  *
  * @param $crit array of criteria (at least, 'field' and 'value')
  *
  * @return array of Rule objects
  **/
 function getRulesForCriteria($crit)
 {
     global $DB;
     $rules = array();
     //Get all the rules whose sub_type is $sub_type and entity is $ID
     $query = "SELECT `glpi_rules`.`id`\n                FROM `glpi_ruleactions`,\n                     `glpi_rules`\n                WHERE `glpi_ruleactions`." . $this->rules_id_field . " = `glpi_rules`.`id`\n                      AND `glpi_rules`.`sub_type` = '" . get_class($this) . "'";
     foreach ($crit as $field => $value) {
         $query .= " AND `glpi_ruleactions`.`{$field}` = '{$value}'";
     }
     foreach ($DB->request($query) as $rule) {
         $affect_rule = new Rule();
         $affect_rule->getRuleWithCriteriasAndActions($rule["id"], 0, 1);
         $rules[] = $affect_rule;
     }
     return $rules;
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:23,代码来源:rule.class.php


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