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


PHP TicketValidation::add方法代码示例

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


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

示例1: doSpecificMassiveActions

 /**
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case "link_ticket":
             if (isset($input['link']) && isset($input['tickets_id_1'])) {
                 if ($this->getFromDB($input['tickets_id_1'])) {
                     foreach ($input["item"] as $key => $val) {
                         if ($val == 1) {
                             $input2 = array();
                             $input2['id'] = $input['tickets_id_1'];
                             $input2['_link']['tickets_id_1'] = $input['tickets_id_1'];
                             $input2['_link']['link'] = $input['link'];
                             $input2['_link']['tickets_id_2'] = $key;
                             if ($this->can($input['tickets_id_1'], 'w')) {
                                 if ($this->update($input2)) {
                                     $res['ok']++;
                                 } else {
                                     $res['ko']++;
                                 }
                             } else {
                                 $res['noright']++;
                             }
                         }
                     }
                 }
             }
             break;
         case "submit_validation":
             $valid = new TicketValidation();
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     $input2 = array('tickets_id' => $key, 'users_id_validate' => $input['users_id_validate'], 'comment_submission' => $input['comment_submission']);
                     if ($valid->can(-1, 'w', $input2)) {
                         if ($valid->add($input2)) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     } else {
                         $res['noright']++;
                     }
                 }
             }
             break;
         case "add_followup":
             $fup = new TicketFollowup();
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     $input2 = array('tickets_id' => $key, 'is_private' => $input['is_private'], 'requesttypes_id' => $input['requesttypes_id'], 'content' => $input['content']);
                     if ($fup->can(-1, 'w', $input2)) {
                         if ($fup->add($input2)) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     } else {
                         $res['noright']++;
                     }
                 }
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:70,代码来源:ticket.class.php

示例2: manageValidationAdd

 /**
  * Manage Validation add from input
  *
  * @since version 0.85
  *
  * @param $input array : input array
  *
  * @return nothing
  **/
 function manageValidationAdd($input)
 {
     //Action for send_validation rule
     if (isset($input["_add_validation"])) {
         if (isset($input['entities_id'])) {
             $entid = $input['entities_id'];
         } else {
             if (isset($this->fields['entities_id'])) {
                 $entid = $this->fields['entities_id'];
             } else {
                 return false;
             }
         }
         $validations_to_send = array();
         if (!is_array($input["_add_validation"])) {
             $input["_add_validation"] = array($input["_add_validation"]);
         }
         foreach ($input["_add_validation"] as $key => $validation) {
             switch ($validation) {
                 case 'requester_supervisor':
                     if (isset($input['_groups_id_requester']) && $input['_groups_id_requester']) {
                         $users = Group_User::getGroupUsers($input['_groups_id_requester'], "is_manager='1'");
                         foreach ($users as $data) {
                             $validations_to_send[] = $data['id'];
                         }
                     }
                     // Add to already set groups
                     foreach ($this->getGroups(CommonITILActor::REQUESTER) as $d) {
                         $users = Group_User::getGroupUsers($d['groups_id'], "is_manager='1'");
                         foreach ($users as $data) {
                             $validations_to_send[] = $data['id'];
                         }
                     }
                     break;
                 case 'assign_supervisor':
                     if (isset($input['_groups_id_assign']) && $input['_groups_id_assign']) {
                         $users = Group_User::getGroupUsers($input['_groups_id_assign'], "is_manager='1'");
                         foreach ($users as $data) {
                             $validations_to_send[] = $data['id'];
                         }
                     }
                     foreach ($this->getGroups(CommonITILActor::ASSIGN) as $d) {
                         $users = Group_User::getGroupUsers($d['groups_id'], "is_manager='1'");
                         foreach ($users as $data) {
                             $validations_to_send[] = $data['id'];
                         }
                     }
                     break;
                 default:
                     // Group case from rules
                     if ($key === 'group') {
                         foreach ($validation as $groups_id) {
                             $validation_right = 'validate_incident';
                             if (isset($input['type']) && $input['type'] == Ticket::DEMAND_TYPE) {
                                 $validation_right = 'validate_request';
                             }
                             $opt = array('groups_id' => $groups_id, 'right' => $validation_right, 'entity' => $entid);
                             $data_users = TicketValidation::getGroupUserHaveRights($opt);
                             foreach ($data_users as $user) {
                                 $validations_to_send[] = $user['id'];
                             }
                         }
                     } else {
                         $validations_to_send[] = $validation;
                     }
             }
         }
         // Validation user added on ticket form
         if (isset($input['users_id_validate'])) {
             if (array_key_exists('groups_id', $input['users_id_validate'])) {
                 foreach ($input['users_id_validate'] as $key => $validation_to_add) {
                     if (is_numeric($key)) {
                         $validations_to_send[] = $validation_to_add;
                     }
                 }
             } else {
                 foreach ($input['users_id_validate'] as $key => $validation_to_add) {
                     if (is_numeric($key)) {
                         $validations_to_send[] = $validation_to_add;
                     }
                 }
             }
         }
         // Keep only one
         $validations_to_send = array_unique($validations_to_send);
         $validation = new TicketValidation();
         if (count($validations_to_send)) {
             $values = array();
             $values['tickets_id'] = $this->fields['id'];
             if (isset($input['id']) && $input['id'] != $this->fields['id']) {
                 $values['_ticket_add'] = true;
//.........这里部分代码省略.........
开发者ID:glpi-project,项目名称:glpi,代码行数:101,代码来源:ticket.class.php

示例3: foreach

     foreach ($_POST["item"] as $key => $val) {
         if ($val == 1) {
             $input = array('tickets_id' => $key, 'is_private' => $_POST['is_private'], 'requesttypes_id' => $_POST['requesttypes_id'], 'content' => $_POST['content']);
             if ($fup->can(-1, 'w', $input)) {
                 $fup->add($input);
             }
         }
     }
     break;
 case "submit_validation":
     $valid = new TicketValidation();
     foreach ($_POST["item"] as $key => $val) {
         if ($val == 1) {
             $input = array('tickets_id' => $key, 'users_id_validate' => $_POST['users_id_validate'], 'comment_submission' => $_POST['comment_submission']);
             if ($valid->can(-1, 'w', $input)) {
                 $valid->add($input);
             }
         }
     }
     break;
 case "add_task":
     $task = new TicketTask();
     foreach ($_POST["item"] as $key => $val) {
         if ($val == 1) {
             $input = array('tickets_id' => $key, 'taskcategories_id' => $_POST['taskcategories_id'], 'content' => $_POST['content']);
             if ($task->can(-1, 'w', $input)) {
                 $task->add($input);
             }
         }
     }
     break;
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:massiveaction.php


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