本文整理汇总了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;
//.........这里部分代码省略.........
示例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'> </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);