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


PHP Ticket::computePriority方法代码示例

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


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

示例1: executeActions

 /**
  * @param $output
  * @param $params
  **/
 function executeActions($output, $params)
 {
     if (count($this->actions)) {
         foreach ($this->actions as $action) {
             switch ($action->fields["action_type"]) {
                 case "send":
                     $ticket = new Ticket();
                     if ($ticket->getFromDB($output['id'])) {
                         NotificationEvent::raiseEvent('recall', $ticket);
                     }
                     break;
                 case "add_validation":
                     if (isset($output['_add_validation']) && !is_array($output['_add_validation'])) {
                         $output['_add_validation'] = array($output['_add_validation']);
                     }
                     switch ($action->fields['field']) {
                         case 'users_id_validate_requester_supervisor':
                             $output['_add_validation'][] = 'requester_supervisor';
                             break;
                         case 'users_id_validate_assign_supervisor':
                             $output['_add_validation'][] = 'assign_supervisor';
                             break;
                         case 'groups_id_validate':
                             $output['_add_validation']['group'][] = $action->fields["value"];
                             break;
                         case 'users_id_validate':
                             $output['_add_validation'][] = $action->fields["value"];
                             break;
                         case 'validation_percent':
                             $output[$action->fields["field"]] = $action->fields["value"];
                             break;
                         default:
                             $output['_add_validation'][] = $action->fields["value"];
                             break;
                     }
                     break;
                 case "assign":
                     $output[$action->fields["field"]] = $action->fields["value"];
                     // Special case of users_id_requester
                     if ($action->fields["field"] === '_users_id_requester') {
                         // Add groups of requester
                         if (!isset($output['_groups_id_of_requester'])) {
                             $output['_groups_id_of_requester'] = array();
                         }
                         foreach (Group_User::getUserGroups($action->fields["value"]) as $g) {
                             $output['_groups_id_of_requester'][$g['id']] = $g['id'];
                         }
                     }
                     break;
                 case "append":
                     $actions = $this->getActions();
                     $value = $action->fields["value"];
                     if (isset($actions[$action->fields["field"]]["appendtoarray"]) && isset($actions[$action->fields["field"]]["appendtoarrayfield"])) {
                         $value = $actions[$action->fields["field"]]["appendtoarray"];
                         $value[$actions[$action->fields["field"]]["appendtoarrayfield"]] = $action->fields["value"];
                     }
                     $output[$actions[$action->fields["field"]]["appendto"]][] = $value;
                     // Special case of users_id_requester
                     if ($action->fields["field"] === '_users_id_requester') {
                         // Add groups of requester
                         if (!isset($output['_groups_id_of_requester'])) {
                             $output['_groups_id_of_requester'] = array();
                         }
                         foreach (Group_User::getUserGroups($action->fields["value"]) as $g) {
                             $output['_groups_id_of_requester'][$g['id']] = $g['id'];
                         }
                     }
                     break;
                 case 'fromuser':
                     if ($action->fields['field'] == 'locations_id' && isset($output['users_locations'])) {
                         $output['locations_id'] = $output['users_locations'];
                     }
                     break;
                 case 'fromitem':
                     if ($action->fields['field'] == 'locations_id' && isset($output['items_locations'])) {
                         $output['locations_id'] = $output['items_locations'];
                     }
                     if ($action->fields['field'] == 'groups_id' && isset($output['items_groups'])) {
                         $output['groups_id'] = $output['items_groups'];
                     }
                     break;
                 case 'compute':
                     // Value could be not set (from test)
                     $urgency = isset($output['urgency']) ? $output['urgency'] : 3;
                     $impact = isset($output['impact']) ? $output['impact'] : 3;
                     // Apply priority_matrix from config
                     $output['priority'] = Ticket::computePriority($urgency, $impact);
                     break;
                 case "affectbyip":
                 case "affectbyfqdn":
                 case "affectbymac":
                     if (!isset($output["entities_id"])) {
                         $output["entities_id"] = $params["entities_id"];
                     }
                     if (isset($this->regex_results[0])) {
                         $regexvalue = RuleAction::getRegexResultById($action->fields["value"], $this->regex_results[0]);
//.........这里部分代码省略.........
开发者ID:korial29,项目名称:glpi,代码行数:101,代码来源:ruleticket.class.php

示例2: array

    $options = array();
    foreach ($available_options as $key) {
        if (isset($_GET[$key])) {
            $options[$key] = $_GET[$key];
        }
    }
    $track->showForm($_GET["id"], $options);
} else {
    commonHeader($LANG['job'][13], '', "maintain", "ticket");
    $users_id_requester = getLoginUserID();
    // No default requester if own ticket right = tech and update_ticket right to update requester
    if (haveRight('own_ticket', 1) && haveRight('update_ticket', 1)) {
        $users_id_requester = 0;
    }
    // Set default value...
    $values = array('_users_id_requester' => $users_id_requester, '_users_id_requester_notif' => array('use_notification' => 1), '_groups_id_requester' => 0, '_users_id_assign' => 0, '_users_id_assign_notif' => array('use_notification' => 1), '_groups_id_assign' => 0, '_users_id_observer' => 0, '_users_id_observer_notif' => array('use_notification' => 1), '_groups_id_observer' => 0, 'suppliers_id_assign' => 0, 'name' => '', 'content' => '', 'ticketcategories_id' => 0, 'urgency' => 3, 'impact' => 3, 'priority' => Ticket::computePriority(3, 3), 'requesttypes_id' => $_SESSION["glpidefault_requesttypes_id"], 'hour' => 0, 'minute' => 0, 'date' => $_SESSION["glpi_currenttime"], 'entities_id' => $_SESSION["glpiactive_entity"], 'status' => 'new', 'followup' => array(), 'itemtype' => '', 'items_id' => 0, 'plan' => array(), 'global_validation' => 'none', 'due_date' => '', 'slas_id' => 0, '_add_validation' => 0, 'type' => -1);
    // Restore saved value or override with page parameter
    foreach ($values as $name => $value) {
        if (isset($_REQUEST[$name])) {
            $values[$name] = $_REQUEST[$name];
        } else {
            if (isset($_SESSION["helpdeskSaved"][$name])) {
                $values[$name] = $_SESSION["helpdeskSaved"]["{$name}"];
            }
        }
    }
    // Clean text fields
    $values['name'] = stripslashes($values['name']);
    $values['content'] = cleanPostForTextArea($values['content']);
    if (isset($_SESSION["helpdeskSaved"])) {
        unset($_SESSION["helpdeskSaved"]);
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:ticket.form.php

示例3: header

it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
// Send UTF8 Headers
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
Session::checkLoginUser();
if (isset($_POST["urgency"]) && isset($_POST["impact"]) && isset($_POST["priority"])) {
    $priority = Ticket::computePriority($_POST["urgency"], $_POST["impact"]);
    if ($_POST["priority"]) {
        echo "<script type='text/javascript' >\n";
        echo "document.getElementById('" . $_POST["priority"] . "').value = {$priority};";
        echo "\n</script>";
    } else {
        echo Ticket::getPriorityName($priority);
    }
}
开发者ID:geldarr,项目名称:hack-space,代码行数:31,代码来源:priority.php

示例4: executeActions

 function executeActions($output, $params)
 {
     if (count($this->actions)) {
         foreach ($this->actions as $action) {
             switch ($action->fields["action_type"]) {
                 case "send":
                     $ticket = new Ticket();
                     if ($ticket->getFromDB($output['id'])) {
                         NotificationEvent::raiseEvent('recall', $ticket);
                     }
                     break;
                 case "add_validation":
                     $output['_add_validation'] = $action->fields["value"];
                     break;
                 case "assign":
                     $output[$action->fields["field"]] = $action->fields["value"];
                     break;
                 case 'compute':
                     // Value could be not set (from test)
                     $urgency = isset($output['urgency']) ? $output['urgency'] : 3;
                     $impact = isset($output['impact']) ? $output['impact'] : 3;
                     // Apply priority_matrix from config
                     $output['priority'] = Ticket::computePriority($urgency, $impact);
                     break;
                 case "affectbyip":
                 case "affectbyfqdn":
                 case "affectbymac":
                     if (!isset($output["entities_id"])) {
                         $output["entities_id"] = $params["entities_id"];
                     }
                     if (isset($this->regex_results[0])) {
                         $regexvalue = RuleAction::getRegexResultById($action->fields["value"], $this->regex_results[0]);
                     } else {
                         $regexvalue = $action->fields["value"];
                     }
                     switch ($action->fields["action_type"]) {
                         case "affectbyip":
                             $result = NetworkPort::getUniqueObjectIDByIPAddressOrMac($regexvalue, "IP", $output["entities_id"]);
                             break;
                         case "affectbyfqdn":
                             $result = NetworkPort::getUniqueObjectIDByFQDN($regexvalue, $output["entities_id"]);
                             break;
                         case "affectbymac":
                             $result = NetworkPort::getUniqueObjectIDByIPAddressOrMac($regexvalue, "MAC", $output["entities_id"]);
                             break;
                         default:
                             $result = array();
                     }
                     if (!empty($result)) {
                         $output["itemtype"] = $result["itemtype"];
                         $output["items_id"] = $result["id"];
                     }
                     break;
             }
         }
     }
     return $output;
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:58,代码来源:ruleticket.class.php


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