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


PHP RuleAction::getTypeName方法代码示例

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


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

示例1: getTabNameForItem

 /**
  * @see CommonGLPI::getTabNameForItem()
  **/
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (!$withtemplate) {
         $nb = 0;
         switch ($item->getType()) {
             case 'Entity':
                 if ($_SESSION['glpishow_count_on_tabs']) {
                     $types = array();
                     $collection = new RuleRightCollection();
                     if ($collection->canList()) {
                         $types[] = 'RuleRight';
                     }
                     $collection = new RuleImportEntityCollection();
                     if ($collection->canList()) {
                         $types[] = 'RuleImportEntity';
                     }
                     $collection = new RuleMailCollectorCollection();
                     if ($collection->canList()) {
                         $types[] = 'RuleMailCollector';
                     }
                     if (count($types)) {
                         $nb = countElementsInTable(array('glpi_rules', 'glpi_ruleactions'), "`glpi_ruleactions`.`rules_id` = `glpi_rules`.`id`\n                                                  AND `glpi_rules`.`sub_type`\n                                                         IN ('" . implode("','", $types) . "')\n                                                  AND `glpi_ruleactions`.`field` = 'entities_id'\n                                                  AND `glpi_ruleactions`.`value`\n                                                            = '" . $item->getID() . "'");
                     }
                 }
                 return self::createTabEntry(self::getTypeName(Session::getPluralNumber()), $nb);
             case 'SLA':
                 if ($_SESSION['glpishow_count_on_tabs']) {
                     $nb = countElementsInTable('glpi_ruleactions', "`field` = 'slas_id'\n                                                AND `value` = '" . $item->getID() . "'");
                 }
                 return self::createTabEntry(self::getTypeName(Session::getPluralNumber()), $nb);
             default:
                 if ($item instanceof Rule) {
                     $ong = array();
                     $nbcriteria = 0;
                     $nbaction = 0;
                     if ($_SESSION['glpishow_count_on_tabs']) {
                         $nbcriteria = countElementsInTable(getTableForItemType($item->getRuleCriteriaClass()), "`" . $item->getRuleIdField() . "` = '" . $item->getID() . "'");
                         $nbaction = countElementsInTable(getTableForItemType($item->getRuleActionClass()), "`" . $item->getRuleIdField() . "` = '" . $item->getID() . "'");
                     }
                     $ong[1] = self::createTabEntry(RuleCriteria::getTypeName(Session::getPluralNumber()), $nbcriteria);
                     $ong[2] = self::createTabEntry(RuleAction::getTypeName(Session::getPluralNumber()), $nbaction);
                     return $ong;
                 }
         }
     }
     return '';
 }
开发者ID:pvasener,项目名称:glpi,代码行数:50,代码来源:rule.class.php


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