當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TicketValidation::getGroupUserHaveRights方法代碼示例

本文整理匯總了PHP中TicketValidation::getGroupUserHaveRights方法的典型用法代碼示例。如果您正苦於以下問題:PHP TicketValidation::getGroupUserHaveRights方法的具體用法?PHP TicketValidation::getGroupUserHaveRights怎麽用?PHP TicketValidation::getGroupUserHaveRights使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TicketValidation的用法示例。


在下文中一共展示了TicketValidation::getGroupUserHaveRights方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: unset

     $param['groups_id'] = '__VALUE__';
     Ajax::updateItemOnSelectEvent("dropdown_{$name}{$rand}", "show_list_users", $CFG_GLPI["root_doc"] . "/ajax/dropdownValidator.php", $param);
     if ($value) {
         $param['validatortype'] = 'list_users';
         $param['groups_id'] = $value;
         unset($param['users_id_validate']['groups_id']);
         Ajax::updateItem('show_list_users', $CFG_GLPI["root_doc"] . "/ajax/dropdownValidator.php", $param);
     }
     echo "<br><span id='show_list_users'>&nbsp;</span>\n";
     break;
 case 'list_users':
     if (isset($_POST['users_id_validate']['groups_id'])) {
         $_POST['users_id_validate'] = array();
     }
     $opt = array('groups_id' => $_POST["groups_id"], 'right' => $_POST['right'], 'entity' => $_POST["entity"]);
     $data_users = TicketValidation::getGroupUserHaveRights($opt);
     $users = array();
     $param['values'] = array();
     $values = array();
     if (isset($_POST['users_id_validate']) && is_array($_POST['users_id_validate'])) {
         $values = $_POST['users_id_validate'];
     }
     foreach ($data_users as $data) {
         $users[$data['id']] = formatUserName($data['id'], $data['name'], $data['realname'], $data['firstname']);
         if (in_array($data['id'], $values)) {
             $param['values'][] = $data['id'];
         }
     }
     // Display all users
     if (isset($_POST['all_users']) && $_POST['all_users']) {
         $param['values'] = array_keys($users);
開發者ID:paisdelconocimiento,項目名稱:glpi-smartcities,代碼行數:31,代碼來源:dropdownValidator.php


注:本文中的TicketValidation::getGroupUserHaveRights方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。