本文整理匯總了PHP中Ticket_User::getField方法的典型用法代碼示例。如果您正苦於以下問題:PHP Ticket_User::getField方法的具體用法?PHP Ticket_User::getField怎麽用?PHP Ticket_User::getField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Ticket_User
的用法示例。
在下文中一共展示了Ticket_User::getField方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: afterAdd
static function afterAdd(Ticket_User $item)
{
global $DB;
$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_ticketnewtech', $ticket);
}
}
}
// Check is the connected user is a tech
if (!is_numeric(Session::getLoginUserID(false)) || !Session::haveRight('ticket', Ticket::OWN)) {
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_tickets_users', $crit) as $data) {
if ($data['id'] != $item->getID()) {
$gu = new Ticket_User();
$gu->delete($data);
}
}
if ($config->getField('single_tech_mode') == 2) {
foreach ($DB->request('glpi_groups_tickets', $crit) as $data) {
$gu = new Group_Ticket();
$gu->delete($data);
}
}
}
}
示例2:
static function plugin_vip_item_update_user(Ticket_User $ticket)
{
global $DB;
$ticketid = $ticket->getField('tickets_id');
$vipticket = self::isTicketVip($ticketid);
$vipdbticket = "";
$ticketquery = "SELECT isvip\n\t\t\t\t\t\t FROM glpi_plugin_vip_tickets\n\t\t\t\t \t\t WHERE id = " . $ticketid;
$vipticketres = $DB->query($ticketquery);
$vipdbticket = mysqli_fetch_object($vipticketres);
if ($vipticket) {
$vipdbquery = "UPDATE glpi_plugin_vip_tickets\n SET isvip = 1\n WHERE id = " . $ticketid;
} else {
$vipdbquery = "UPDATE glpi_plugin_vip_tickets\n SET isvip = 0\n WHERE id = " . $ticketid;
}
$updatevipdb = $DB->query($vipdbquery);
}
示例3: _testTicketUser
protected function _testTicketUser(Ticket $ticket, $actor, $role, $notify, $alternateEmail)
{
if ($actor > 0) {
$user = new User();
$user->getFromDB($actor);
$this->assertFalse($user->isNewItem());
$ticketUser = new Ticket_User();
$ticketUser->getFromDBForItems($ticket, $user);
$this->assertFalse($ticketUser->isNewItem());
$this->assertEquals($role, $ticketUser->getField('type'));
$this->assertEquals($notify, $ticketUser->getField('use_notification'));
} else {
$ticketId = $ticket->getID();
$ticketUser = new Ticket_User();
$ticketUser->getFromDBByQuery("WHERE `tickets_id` = '{$ticketId}' AND `users_id` = '0' AND `alternative_email` = '{$alternateEmail}'");
$this->assertFalse($ticketUser->isNewItem());
$this->assertEquals($role, $ticketUser->getField('type'));
$this->assertEquals($notify, $ticketUser->getField('use_notification'));
}
}