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


PHP Rule::getActionsByType方法代码示例

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


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

示例1: displayActionSelectPattern

 /**
  * @param $options   array
  **/
 function displayActionSelectPattern($options = array())
 {
     $display = false;
     $param['value'] = '';
     if (isset($options['value'])) {
         $param['value'] = $options['value'];
     }
     switch ($options["action_type"]) {
         //If a regex value is used, then always display an autocompletiontextfield
         case "regex_result":
         case "append_regex_result":
             Html::autocompletionTextField($this, "value", $param);
             break;
         case 'fromuser':
         case 'fromitem':
             Dropdown::showYesNo("value", $param['value'], 0);
             $display = true;
             break;
         default:
             $actions = Rule::getActionsByType($options["sub_type"]);
             if (isset($actions[$options["field"]]['type'])) {
                 switch ($actions[$options["field"]]['type']) {
                     case "dropdown":
                         $table = $actions[$options["field"]]['table'];
                         $param['name'] = "value";
                         if (isset($actions[$options["field"]]['condition'])) {
                             $param['condition'] = $actions[$options["field"]]['condition'];
                         }
                         Dropdown::show(getItemTypeForTable($table), $param);
                         $display = true;
                         break;
                     case "dropdown_tickettype":
                         Ticket::dropdownType('value', $param);
                         $display = true;
                         break;
                     case "dropdown_assign":
                         $param['name'] = 'value';
                         $param['right'] = 'own_ticket';
                         User::dropdown($param);
                         $display = true;
                         break;
                     case "dropdown_users":
                         $param['name'] = 'value';
                         $param['right'] = 'all';
                         User::dropdown($param);
                         $display = true;
                         break;
                     case "dropdown_urgency":
                         $param['name'] = 'value';
                         Ticket::dropdownUrgency($param);
                         $display = true;
                         break;
                     case "dropdown_impact":
                         $param['name'] = 'value';
                         Ticket::dropdownImpact($param);
                         $display = true;
                         break;
                     case "dropdown_priority":
                         if ($_POST["action_type"] != 'compute') {
                             $param['name'] = 'value';
                             Ticket::dropdownPriority($param);
                         }
                         $display = true;
                         break;
                     case "dropdown_status":
                         $param['name'] = 'value';
                         Ticket::dropdownStatus($param);
                         $display = true;
                         break;
                     case "yesonly":
                         Dropdown::showYesNo("value", $param['value'], 0);
                         $display = true;
                         break;
                     case "yesno":
                         Dropdown::showYesNo("value", $param['value']);
                         $display = true;
                         break;
                     case "dropdown_management":
                         $param['name'] = 'value';
                         $param['management_restrict'] = 2;
                         $param['withtemplate'] = false;
                         Dropdown::showGlobalSwitch(0, $param);
                         $display = true;
                         break;
                     case "dropdown_users_validate":
                         $used = array();
                         if ($item = getItemForItemtype($options["sub_type"])) {
                             $rule_data = getAllDatasFromTable('glpi_ruleactions', "`action_type` = 'add_validation'\n                                                           AND `field` = 'users_id_validate'\n                                                           AND `" . $item->getRuleIdField() . "`\n                                                            = '" . $options[$item->getRuleIdField()] . "'");
                             foreach ($rule_data as $data) {
                                 $used[] = $data['value'];
                             }
                         }
                         $param['name'] = 'value';
                         $param['right'] = array('validate_incident', 'validate_request');
                         $param['used'] = $used;
                         User::dropdown($param);
                         $display = true;
//.........这里部分代码省略.........
开发者ID:stweil,项目名称:glpi,代码行数:101,代码来源:ruleaction.class.php

示例2: header

* @brief
*/
// Direct access to file
if (strpos($_SERVER['PHP_SELF'], "ruleaction.php")) {
    include '../inc/includes.php';
    header("Content-Type: text/html; charset=UTF-8");
    Html::header_nocache();
}
if (!defined('GLPI_ROOT')) {
    die("Can not acces directly to this file");
}
Session::checkLoginUser();
// Non define case
if (isset($_POST["sub_type"]) && class_exists($_POST["sub_type"])) {
    if (!isset($_POST["field"])) {
        $_POST["field"] = key(Rule::getActionsByType($_POST["sub_type"]));
    }
    if (!($item = getItemForItemtype($_POST["sub_type"]))) {
        exit;
    }
    if (!isset($_POST[$item->getRuleIdField()])) {
        exit;
    }
    // Existing action
    if ($_POST['ruleactions_id'] > 0) {
        $already_used = false;
    } else {
        // New action
        $ra = getItemForItemtype($item->getRuleActionClass());
        $used = $ra->getAlreadyUsedForRuleID($_POST[$item->getRuleIdField()], $item->getType());
        $already_used = in_array($_POST["field"], $used);
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:31,代码来源:ruleaction.php

示例3: displayActionSelectPattern

 /**
  * @param $options   array
  **/
 function displayActionSelectPattern($options = array())
 {
     $display = false;
     switch ($_POST["action_type"]) {
         //If a regex value is used, then always display an autocompletiontextfield
         case "regex_result":
         case "append_regex_result":
             Html::autocompletionTextField($this, "value");
             break;
         case 'fromuser':
         case 'fromitem':
             Dropdown::showYesNo("value", 0, 0);
             $display = true;
             break;
         default:
             $actions = Rule::getActionsByType($options["sub_type"]);
             if (isset($actions[$options["field"]]['type'])) {
                 switch ($actions[$options["field"]]['type']) {
                     case "dropdown":
                         $table = $actions[$options["field"]]['table'];
                         $param = array('name' => "value");
                         if (isset($actions[$options["field"]]['condition'])) {
                             $param['condition'] = $actions[$options["field"]]['condition'];
                         }
                         Dropdown::show(getItemTypeForTable($table), $param);
                         $display = true;
                         break;
                     case "dropdown_tickettype":
                         Ticket::dropdownType('value');
                         $display = true;
                         break;
                     case "dropdown_assign":
                         User::dropdown(array('name' => 'value', 'right' => 'own_ticket'));
                         $display = true;
                         break;
                     case "dropdown_users":
                         User::dropdown(array('name' => 'value', 'right' => 'all'));
                         $display = true;
                         break;
                     case "dropdown_urgency":
                         Ticket::dropdownUrgency(array('name' => 'value'));
                         $display = true;
                         break;
                     case "dropdown_impact":
                         Ticket::dropdownImpact(array('name' => 'value'));
                         $display = true;
                         break;
                     case "dropdown_priority":
                         if ($_POST["action_type"] != 'compute') {
                             Ticket::dropdownPriority(array('name' => 'value'));
                         }
                         $display = true;
                         break;
                     case "dropdown_status":
                         Ticket::dropdownStatus(array('name' => "value"));
                         $display = true;
                         break;
                     case "yesonly":
                         Dropdown::showYesNo("value", 0, 0);
                         $display = true;
                         break;
                     case "yesno":
                         Dropdown::showYesNo("value");
                         $display = true;
                         break;
                     case "dropdown_management":
                         Dropdown::showGlobalSwitch(0, array('name' => 'value', 'management_restrict' => 2, 'withtemplate' => false));
                         $display = true;
                         break;
                     case "dropdown_users_validate":
                         User::dropdown(array('name' => "value", 'right' => array('validate_incident', 'validate_request')));
                         $display = true;
                         break;
                     default:
                         if ($rule = getItemForItemtype($options["sub_type"])) {
                             $display = $rule->displayAdditionalRuleAction($actions[$options["field"]]);
                         }
                         break;
                 }
             }
             if (!$display) {
                 Html::autocompletionTextField($this, "value");
             }
     }
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:88,代码来源:ruleaction.class.php


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