本文整理匯總了PHP中Ticket_User::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP Ticket_User::delete方法的具體用法?PHP Ticket_User::delete怎麽用?PHP Ticket_User::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Ticket_User
的用法示例。
在下文中一共展示了Ticket_User::delete方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: afterAdd
static function afterAdd(Group_Ticket $item)
{
global $DB;
//Toolbox::logDebug(__METHOD__, $item);
$config = PluginBehaviorsConfig::getInstance();
if ($config->getField('add_notif')) {
if ($item->getField('type') == CommonITILActor::ASSIGN) {
$ticket = new Ticket();
if ($ticket->getFromDB($item->getField('tickets_id'))) {
NotificationEvent::raiseEvent('plugin_behaviors_ticketnewgrp', $ticket);
}
}
}
// Check is the connected user is a tech
if (!is_numeric(Session::getLoginUserID(false)) || !Session::haveRight('own_ticket', 1)) {
return false;
// No check
}
$config = PluginBehaviorsConfig::getInstance();
if ($config->getField('single_tech_mode') != 0 && $item->input['type'] == CommonITILActor::ASSIGN) {
$crit = array('tickets_id' => $item->input['tickets_id'], 'type' => CommonITILActor::ASSIGN);
foreach ($DB->request('glpi_groups_tickets', $crit) as $data) {
if ($data['id'] != $item->getID()) {
$gu = new Group_Ticket();
$gu->delete($data);
}
}
if ($config->getField('single_tech_mode') == 2) {
foreach ($DB->request('glpi_tickets_users', $crit) as $data) {
$gu = new Ticket_User();
$gu->delete($data);
}
}
}
}
示例2: sprintf
if ($track->restore($_POST)) {
Event::log($_POST["id"], "ticket", 4, "tracking", sprintf(__('%s restores an item'), $_SESSION["glpiname"]));
}
$track->redirectToList();
} else {
if (isset($_POST['sla_delete'])) {
$track->check($_POST["id"], 'w');
$track->deleteSLA($_POST["id"]);
Event::log($_POST["id"], "ticket", 4, "tracking", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
Html::redirect($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $_POST["id"]);
} else {
if (isset($_POST['delete_user'])) {
///TODO try to move it to specific form page
$ticket_user = new Ticket_User();
$ticket_user->check($_POST['id'], 'd');
$ticket_user->delete($_POST);
Event::log($_POST['tickets_id'], "ticket", 4, "tracking", sprintf(__('%s deletes an actor'), $_SESSION["glpiname"]));
Html::redirect($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $_POST['tickets_id']);
} else {
if (isset($_POST['delete_group'])) {
$group_ticket = new Group_Ticket();
$group_ticket->check($_POST['id'], 'd');
$group_ticket->delete($_POST);
Event::log($_POST['tickets_id'], "ticket", 4, "tracking", sprintf(__('%s deletes an actor'), $_SESSION["glpiname"]));
Html::redirect($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $_POST['tickets_id']);
} else {
if (isset($_POST['delete_supplier'])) {
$supplier_ticket = new Supplier_Ticket();
$supplier_ticket->check($_POST['id'], 'd');
$supplier_ticket->delete($_POST);
Event::log($_POST['tickets_id'], "ticket", 4, "tracking", sprintf(__('%s deletes an actor'), $_SESSION["glpiname"]));
示例3: array
$track->check($_POST["id"], 'w');
$track->deleteSLA($_POST["id"]);
Event::log($_POST["id"], "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
glpi_header($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $_POST["id"]);
} else {
if (isset($_REQUEST['delete_link'])) {
$ticket_ticket = new Ticket_Ticket();
$ticket_ticket->check($_REQUEST['id'], 'w');
$ticket_ticket->delete($_REQUEST);
Event::log($_REQUEST['tickets_id'], "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . $LANG['log'][120]);
glpi_header($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $_REQUEST['tickets_id']);
} else {
if (isset($_REQUEST['delete_user'])) {
$ticket_user = new Ticket_User();
$ticket_user->check($_REQUEST['id'], 'w');
$ticket_user->delete($_REQUEST);
Event::log($_REQUEST['tickets_id'], "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . $LANG['log'][122]);
glpi_header($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $_REQUEST['tickets_id']);
} else {
if (isset($_REQUEST['delete_group'])) {
$group_ticket = new Group_Ticket();
$group_ticket->check($_REQUEST['id'], 'w');
$group_ticket->delete($_REQUEST);
Event::log($_REQUEST['tickets_id'], "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . $LANG['log'][122]);
glpi_header($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $_REQUEST['tickets_id']);
} else {
if (isset($_REQUEST['addme_observer'])) {
$ticket_user = new Ticket_User();
$track->check($_REQUEST['tickets_id'], 'r');
$input = array('tickets_id' => $_REQUEST['tickets_id'], 'users_id' => getLoginUserID(), 'use_notification' => 1, 'type' => Ticket::OBSERVER);
$ticket_user->add($input);
示例4: fromcreatorDropUserAndGrouponTicket
static function fromcreatorDropUserAndGrouponTicket($ticketid)
{
global $DB;
$crit = array('tickets_id' => $ticketid, 'type' => 2);
foreach ($DB->request('glpi_groups_tickets', $crit) as $data) {
$gu = new Group_Ticket();
$gu->delete($data);
}
foreach ($DB->request('glpi_tickets_users', $crit) as $data) {
$gu = new Ticket_User();
$gu->delete($data);
}
return true;
}
示例5: Ticket
Html::back();
} else {
if (isset($_POST['update']) and $_POST['_users_id_assign'] > 0) {
$assign_ticket_right = $_SESSION['glpiactiveprofile']['assign_ticket'];
$_SESSION['glpiactiveprofile']['assign_ticket'] = 1;
// Add
$ticket = new Ticket();
$input = array();
$input['id'] = $_POST['tickets_id'];
$input['_itil_assign'] = array('_type' => 'user', 'users_id' => $_POST['_users_id_assign']);
$ticket->update($input);
$ticket_user = new Ticket_User();
$a_users = $ticket_user->find("`tickets_id`='" . $_POST['tickets_id'] . "'\n AND `type`='2'");
foreach ($a_users as $data) {
if ($data['users_id'] != $_POST['_users_id_assign']) {
$ticket_user->delete($data);
Event::log($_POST['tickets_id'], "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . __('Deletion of an actor to the ticket'));
}
}
$_SESSION['glpiactiveprofile']['assign_ticket'] = $assign_ticket_right;
Html::back();
} else {
if (isset($_POST['addgroup'])) {
$peGroup_Group = new PluginEscalationGroup_Group();
$peGroup_Group->add($_POST);
Html::back();
} else {
if (isset($_POST['deleteitem'])) {
$peGroup_Group = new PluginEscalationGroup_Group();
foreach ($_POST['delgroup'] as $id) {
$peGroup_Group->delete(array('id' => $id));
示例6: Ticket
include '../inc/includes.php';
}
$link = new Ticket_User();
$item = new Ticket();
Session::checkLoginUser();
Html::popHeader(__('Email followup'), $_SERVER['PHP_SELF']);
if (isset($_POST["update"])) {
$link->check($_POST["id"], UPDATE);
$link->update($_POST);
echo "<script type='text/javascript' >\n";
echo "window.parent.location.reload();";
echo "</script>";
} else {
if (isset($_POST['delete'])) {
$link->check($_POST['id'], DELETE);
$link->delete($_POST);
Event::log($link->fields['tickets_id'], "ticket", 4, "tracking", sprintf(__('%s deletes an actor'), $_SESSION["glpiname"]));
if ($item->can($link->fields["tickets_id"], READ)) {
Html::redirect($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $link->fields['tickets_id']);
}
Session::addMessageAfterRedirect(__('You have been redirected because you no longer have access to this item'), true, ERROR);
Html::redirect($CFG_GLPI["root_doc"] . "/front/ticket.php");
} else {
if (isset($_GET["id"])) {
$link->showUserNotificationForm($_GET["id"]);
} else {
Html::displayErrorAndDie('Lost');
}
}
}
Html::popFooter();
示例7: removeAssignUsers
/**
* Clean all assigned users for the ticket
* @param int $tickets_id
* @return nothing
*/
static function removeAssignUsers($tickets_id, $keep_users_id = false)
{
if ($_SESSION['plugins']['escalade']['config']['remove_tech'] == false) {
return true;
}
$where_keep = "";
if ($keep_users_id !== false) {
if (is_array($keep_users_id)) {
$where_keep = "AND users_id NOT IN (" . implode(",", $keep_users_id) . ")";
} else {
$where_keep = "AND users_id != {$keep_users_id}";
}
}
$ticket_user = new Ticket_User();
$found = $ticket_user->find("tickets_id = {$tickets_id} AND type = 2 {$where_keep}");
foreach ($found as $id => $tu) {
//if user must be keeped (see item_add_user function)
if (isset($_SESSION['plugin_escalade']['keep_users']) && is_array($_SESSION['plugin_escalade']['keep_users']) && in_array($tu['users_id'], $_SESSION['plugin_escalade']['keep_users'])) {
continue;
}
//delete user
$ticket_user->delete(array('id' => $id));
}
//clean session var (to prevent users be keeped post to this ticket update)
unset($_SESSION['plugin_escalade']['keep_users']);
//add a var to prevent status changes unwanted
$_SESSION['plugin_escalade']['remove_assign'] = true;
}
示例8: notMultiple
static function notMultiple($item)
{
if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
$peConfig = new PluginEscalationConfig();
$unique_assigned = $peConfig->getValue("unique_assigned", $item->fields['entities_id']);
if ($unique_assigned == '1') {
$ticket_User = new Ticket_User();
$group_Ticket = new Group_Ticket();
$group_User = new Group_User();
if (isset($item->input['_itil_assign'])) {
if ($item->input['_itil_assign']['_type'] == 'user') {
$in_group = 0;
$a_groups = $group_Ticket->find("`type`='2'\n AND `tickets_id`='" . $item->fields['id'] . "'");
$groups = Group_User::getUserGroups($item->input['_itil_assign']['users_id']);
if (count($a_groups) > 0) {
foreach ($a_groups as $data) {
foreach ($groups as $dat) {
if ($dat['id'] == $data['groups_id']) {
$in_group = 1;
}
}
}
}
//if ($in_group == '0') {
// unset($item->input['_itil_assign']['users_id']);
//}
} else {
if ($item->input['_itil_assign']['_type'] == 'group') {
$a_groups = $group_Ticket->find("`type`='2'\n AND `tickets_id`='" . $item->getID() . "'");
if (count($a_groups) > 0) {
foreach ($a_groups as $data) {
$group_Ticket->delete($data);
}
}
$a_users = $ticket_User->find("`type`='2'\n AND `tickets_id`='" . $item->getID() . "'");
foreach ($a_users as $data) {
if (countElementsInTable($group_User->getTable(), "`users_id`='" . $data['users_id'] . "'\n AND `groups_id`='" . $item->input['_itil_assign']['groups_id'] . "'") == '0') {
$ticket_User->delete($data);
}
}
}
}
}
}
}
}
示例9: manageTicket
private function manageTicket($closed = true)
{
global $DB, $CFG_GLPI;
$DB->connect();
$_SESSION['glpiactive_entity'] = 0;
$CFG_GLPI['root_doc'] = "http://127.0.0.1/fusion0.83/";
$plugin = new Plugin();
$plugin->getFromDBbyDir("timelineticket");
$plugin->activate($plugin->fields['id']);
Plugin::load("timelineticket");
Session::loadLanguage("en_GB");
$ticket = new Ticket();
$group = new Group();
$group_ticket = new Group_Ticket();
$GLPIlog = new GLPIlogs();
$ticket_User = new Ticket_User();
$_SESSION['plugin_timelineticket_date'] = array();
$group->add(array('name' => 'grtech1'));
$group->add(array('name' => 'grtech2'));
// * 01/
$_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s");
$a_storedate = array('1' => $_SESSION["glpi_currenttime"]);
$input = array();
$input['name'] = 'Pb with the ticket';
$input['content'] = 'I have a problem with the ticket';
$tickets_id = $ticket->add($input);
$GLPIlog->testSQLlogs('01/');
$GLPIlog->testPHPlogs('01/');
// * 02/
sleep(2);
// * 03/
$_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s");
$a_storedate[3] = $_SESSION["glpi_currenttime"];
$input = array();
$input['id'] = $tickets_id;
$input['_itil_assign']['_type'] = 'group';
$input['_itil_assign']['groups_id'] = 1;
$ticket->update($input);
$input['_itil_assign']['_type'] = 'user';
$input['_itil_assign']['users_id'] = 2;
$ticket->update($input);
$GLPIlog->testSQLlogs('03/');
$GLPIlog->testPHPlogs('03/');
$a_db = getAllDatasFromTable('glpi_groups_tickets');
$a_ref = array();
$a_ref[1] = array('id' => '1', 'tickets_id' => '1', 'groups_id' => '1', 'type' => '2');
$this->assertEquals($a_ref, $a_db, 'May have ticket assigned to group1');
$a_db = getAllDatasFromTable('glpi_tickets_users');
$a_ref = array();
$a_ref[1] = array('id' => '1', 'tickets_id' => '1', 'users_id' => '2', 'type' => '1', 'use_notification' => '1', 'alternative_email' => '');
$a_ref[2] = array('id' => '2', 'tickets_id' => '1', 'users_id' => '2', 'type' => '2', 'use_notification' => '1', 'alternative_email' => '');
$this->assertEquals($a_ref, $a_db, 'May have ticket assigned to user 2 (glpi)');
// * 04/
sleep(2);
// * 05/
$_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s");
$a_storedate[5] = $_SESSION["glpi_currenttime"];
$input = array();
$input['id'] = $tickets_id;
$input['status'] = Ticket::WAITING;
$ticket->update($input);
$GLPIlog->testSQLlogs('05/');
$GLPIlog->testPHPlogs('05/');
$ticket->getFromDB(1);
$this->assertEquals('waiting', $ticket->fields['status'], 'May have status waiting');
// * 06/
sleep(1);
// * 07/
$_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s");
$a_storedate[7] = $_SESSION["glpi_currenttime"];
$input = array();
$input['id'] = 2;
$input['itickets_id'] = $tickets_id;
$ticket_User->check($input['id'], 'w');
$ticket_User->delete($input);
$input = array();
$input['id'] = 1;
$input['itickets_id'] = $tickets_id;
$group_ticket->check($input['id'], 'w');
$group_ticket->delete($input);
$GLPIlog->testSQLlogs('07/');
$GLPIlog->testPHPlogs('07/');
$a_db = getAllDatasFromTable('glpi_groups_tickets');
$this->assertEquals(array(), $a_db, 'May have no group assigned');
// * 08/
sleep(1);
// * 09/
$_SESSION["glpi_currenttime"] = date("Y-m-d H:i:s");
$a_storedate[9] = $_SESSION["glpi_currenttime"];
$input = array();
$input['id'] = $tickets_id;
$input['_itil_assign']['_type'] = 'group';
$input['_itil_assign']['groups_id'] = 2;
$ticket->update($input);
$GLPIlog->testSQLlogs('09/');
$GLPIlog->testPHPlogs('09/');
$a_db = getAllDatasFromTable('glpi_groups_tickets');
$a_ref = array();
$a_ref[2] = array('id' => '2', 'tickets_id' => '1', 'groups_id' => '2', 'type' => '2');
$this->assertEquals($a_ref, $a_db, 'May have ticket assigned to group2');
//.........這裏部分代碼省略.........