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


PHP Ticket::getUsers方法代码示例

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


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

示例1: pdfForItem

 static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item, $tree = false)
 {
     global $DB, $CFG_GLPI;
     $ID = $item->getField('id');
     $type = $item->getType();
     if (!Session::haveRight("show_all_ticket", "1")) {
         return;
     }
     switch ($item->getType()) {
         case 'User':
             $restrict = "(`glpi_tickets_users`.`users_id` = '" . $item->getID() . "'\n                            AND `glpi_tickets_users`.`type` = " . CommonITILActor::REQUESTER . ")";
             $order = '`glpi_tickets`.`date_mod` DESC';
             break;
         case 'SLA':
             $restrict = "(`slas_id` = '" . $item->getID() . "')";
             $order = '`glpi_tickets`.`due_date` DESC';
             break;
         case 'Supplier':
             $restrict = "(`glpi_suppliers_tickets`.`suppliers_id` = '" . $item->getID() . "'\n                           AND `glpi_suppliers_tickets`.`type` = " . CommonITILActor::ASSIGN . ")";
             $order = '`glpi_tickets`.`date_mod` DESC';
             break;
         case 'Group':
             if ($tree) {
                 $restrict = "IN (" . implode(',', getSonsOf('glpi_groups', $item->getID())) . ")";
             } else {
                 $restrict = "='" . $item->getID() . "'";
             }
             $restrict = "(`glpi_groups_tickets`.`groups_id` {$restrict}\n                            AND `glpi_groups_tickets`.`type` = " . CommonITILActor::REQUESTER . ")";
             $order = '`glpi_tickets`.`date_mod` DESC';
             break;
         default:
             $restrict = "(`items_id` = '" . $item->getID() . "'  AND `itemtype` = '{$type}')";
             $order = '`glpi_tickets`.`date_mod` DESC';
     }
     $query = "SELECT " . Ticket::getCommonSelect() . "\n                FROM glpi_tickets " . Ticket::getCommonLeftJoin() . "\n                WHERE {$restrict} " . getEntitiesRestrictRequest("AND", "glpi_tickets") . "\n                ORDER BY {$order}\n                LIMIT " . intval($_SESSION['glpilist_limit']);
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     $pdf->setColumnsSize(100);
     if (!$number) {
         $pdf->displayTitle('<b>' . __('Last tickets') . '</b>');
     } else {
         $pdf->displayTitle("<b>" . sprintf(__('Last %d ticket') . "</b>", $number));
         $job = new Ticket();
         while ($data = $DB->fetch_assoc($result)) {
             if (!$job->getFromDB($data["id"])) {
                 continue;
             }
             $pdf->setColumnsAlign('center');
             $col = '<b><i>ID ' . $job->fields["id"] . '</i></b>, ' . sprintf(__('%1$s: %2$s'), __('Status'), Ticket::getStatus($job->fields["status"]));
             if (count($_SESSION["glpiactiveentities"]) > 1) {
                 if ($job->fields['entities_id'] == 0) {
                     $col = sprintf(__('%1$s (%2$s)'), $col, __('Root entity'));
                 } else {
                     $col = sprintf(__('%1$s (%2$s)'), $col, Dropdown::getDropdownName("glpi_entities", $job->fields['entities_id']));
                 }
             }
             $pdf->displayLine($col);
             $pdf->setColumnsAlign('left');
             $col = '<b><i>' . sprintf(__('Opened on %s') . '</i></b>', Html::convDateTime($job->fields['date']));
             if ($job->fields['begin_waiting_date']) {
                 $col = sprintf(__('%1$s, %2$s'), $col, '<b><i>' . sprintf(__('Put on hold on %s') . '</i></b>', Html::convDateTime($job->fields['begin_waiting_date'])));
             }
             if (in_array($job->fields["status"], $job->getSolvedStatusArray()) || in_array($job->fields["status"], $job->getClosedStatusArray())) {
                 $col = sprintf(__('%1$s, %2$s'), $col, '<b><i>' . sprintf(__('Solved on %s') . '</i></b>', Html::convDateTime($job->fields['solvedate'])));
             }
             if (in_array($job->fields["status"], $job->getClosedStatusArray())) {
                 $col = sprintf(__('%1$s, %2$s'), $col, '<b><i>' . sprintf(__('Closed on %s') . '</i></b>', Html::convDateTime($job->fields['closedate'])));
             }
             if ($job->fields['due_date']) {
                 $col = sprintf(__('%1$s, %2$s'), $col, '<b><i>' . sprintf(__('%1$s: %2$s') . '</i></b>', __('Due date'), Html::convDateTime($job->fields['due_date'])));
             }
             $pdf->displayLine($col);
             $col = '<b><i>' . sprintf(__('%1$s: %2$s'), __('Priority') . '</i></b>', Ticket::getPriorityName($job->fields["priority"]));
             if ($job->fields["itilcategories_id"]) {
                 $col = sprintf(__('%1$s - %2$s'), $col, '<b><i>' . sprintf(__('%1$s: %2$s') . '</i></b>', __('Category'), Dropdown::getDropdownName('glpi_itilcategories', $job->fields["itilcategories_id"])));
             }
             $pdf->displayLine($col);
             $col = '';
             $users = $job->getUsers(CommonITILActor::REQUESTER);
             if (count($users)) {
                 foreach ($users as $d) {
                     if (empty($col)) {
                         $col = getUserName($d['users_id']);
                     } else {
                         $col = sprintf(__('%1$s, %2$s'), $col, getUserName($d['users_id']));
                     }
                 }
             }
             $grps = $job->getGroups(CommonITILActor::REQUESTER);
             if (count($grps)) {
                 if (empty($col)) {
                     $col = sprintf(__('%1$s %2$s'), $col, _n('Group', 'Groups', 2) . ' </i></b>');
                 } else {
                     $col = sprintf(__('%1$s - %2$s'), $col, _n('Group', 'Groups', 2) . ' </i></b>');
                 }
                 $first = true;
                 foreach ($grps as $d) {
                     if ($first) {
                         $col = sprintf(__('%1$s  %2$s'), $col, Dropdown::getDropdownName("glpi_groups", $d['groups_id']));
                     } else {
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:ticket.class.php

示例2: doLevelForTicket

 /**
  * Do a specific SLAlevel for a ticket
  *
  * @param $data array data of an entry of slalevels_tickets
  *
  * @return nothing
  **/
 static function doLevelForTicket(array $data)
 {
     $ticket = new Ticket();
     $slalevelticket = new self();
     // existing ticket and not deleted
     if ($ticket->getFromDB($data['tickets_id']) && !$ticket->isDeleted()) {
         // search all actors of a ticket
         foreach ($ticket->getUsers(CommonITILActor::REQUESTER) as $user) {
             $ticket->fields['_users_id_requester'][] = $user['users_id'];
         }
         foreach ($ticket->getUsers(CommonITILActor::ASSIGN) as $user) {
             $ticket->fields['_users_id_assign'][] = $user['users_id'];
         }
         foreach ($ticket->getUsers(CommonITILActor::OBSERVER) as $user) {
             $ticket->fields['_users_id_observer'][] = $user['users_id'];
         }
         foreach ($ticket->getGroups(CommonITILActor::REQUESTER) as $group) {
             $ticket->fields['_groups_id_requester'][] = $group['groups_id'];
         }
         foreach ($ticket->getGroups(CommonITILActor::ASSIGN) as $group) {
             $ticket->fields['_groups_id_assign'][] = $group['groups_id'];
         }
         foreach ($ticket->getGroups(CommonITILActor::OBSERVER) as $groups) {
             $ticket->fields['_groups_id_observer'][] = $group['groups_id'];
         }
         foreach ($ticket->getSuppliers(CommonITILActor::ASSIGN) as $supplier) {
             $ticket->fields['_suppliers_id_assign'][] = $supplier['suppliers_id'];
         }
         $slalevel = new SlaLevel();
         $sla = new SLA();
         // Check if sla datas are OK
         if ($ticket->fields['slas_id'] > 0 && $ticket->fields['slalevels_id'] == $data['slalevels_id']) {
             if ($ticket->fields['status'] == CommonITILObject::CLOSED) {
                 // Drop line when status is closed
                 $slalevelticket->delete(array('id' => $data['id']));
             } else {
                 if ($ticket->fields['status'] != CommonITILObject::SOLVED) {
                     // If status = solved : keep the line in case of solution not validated
                     $input['id'] = $ticket->getID();
                     $input['_auto_update'] = true;
                     if ($slalevel->getRuleWithCriteriasAndActions($data['slalevels_id'], 1, 1) && $sla->getFromDB($ticket->fields['slas_id'])) {
                         $doit = true;
                         if (count($slalevel->criterias)) {
                             $doit = $slalevel->checkCriterias($ticket->fields);
                         }
                         // Process rules
                         if ($doit) {
                             $input = $slalevel->executeActions($input, array());
                         }
                     }
                     // Put next level in todo list
                     $next = $slalevel->getNextSlaLevel($ticket->fields['slas_id'], $ticket->fields['slalevels_id']);
                     $input['slalevels_id'] = $next;
                     $ticket->update($input);
                     $sla->addLevelToDo($ticket);
                     // Action done : drop the line
                     $slalevelticket->delete(array('id' => $data['id']));
                 }
             }
         } else {
             // Drop line
             $slalevelticket->delete(array('id' => $data['id']));
         }
     } else {
         // Drop line
         $slalevelticket->delete(array('id' => $data['id']));
     }
 }
开发者ID:pvasener,项目名称:glpi,代码行数:75,代码来源:slalevel_ticket.class.php

示例3: foreach

 if (!empty($mylevels)) {
     foreach ($mylevels as $key => $val) {
         showTitle($output_type, $num, $key, '', false);
         showTitle($output_type, $num, __('Duration by', 'timelineticket') . "&nbsp;" . $key, '', false);
     }
 }
 showTitle($output_type, $num, __('Total duration of ticket', 'timelineticket'), 'TOTAL', false);
 echo Search::showEndLine($output_type);
 $row_num = 1;
 while ($data = $DB->fetch_assoc($res)) {
     //Requesters
     $userdata = '';
     $ticket = new Ticket();
     $ticket->getFromDB($data['id']);
     if ($ticket->countUsers(CommonITILActor::REQUESTER)) {
         foreach ($ticket->getUsers(CommonITILActor::REQUESTER) as $d) {
             $k = $d['users_id'];
             if ($k) {
                 $userdata .= getUserName($k);
             }
             if ($ticket->countUsers(CommonITILActor::REQUESTER) > 1) {
                 $userdata .= "<br>";
             }
         }
     }
     //Time by level group
     $timegroups = array();
     $ticketgroups = array();
     $restrict = " `tickets_id` = " . $data["id"] . " ORDER BY date";
     $groups = getAllDatasFromTable("glpi_plugin_timelineticket_assigngroups", $restrict);
     if (!empty($groups)) {
开发者ID:pluginsGLPI,项目名称:timelineticket,代码行数:31,代码来源:statSpentTimeByGroup.php

示例4: checkAssignUser

 static function checkAssignUser(Ticket $ticket)
 {
     global $DB;
     $ok = 0;
     $ptConfig = new PluginTimelineticketConfig();
     $ptConfig->getFromDB(1);
     if ($ptConfig->fields["add_waiting"] == 0) {
         $ok = 1;
     }
     if ($ok && in_array("status", $ticket->updates) && isset($ticket->oldvalues["status"]) && $ticket->oldvalues["status"] == Ticket::WAITING) {
         if ($ticket->countUsers(CommonITILActor::ASSIGN)) {
             foreach ($ticket->getUsers(CommonITILActor::ASSIGN) as $d) {
                 $ptAssignUser = new PluginTimelineticketAssignUser();
                 $calendar = new Calendar();
                 $calendars_id = Entity::getUsedConfig('calendars_id', $ticket->fields['entities_id']);
                 $datedebut = $ticket->fields['date'];
                 if ($calendars_id > 0 && $calendar->getFromDB($calendars_id)) {
                     $delay = $calendar->getActiveTimeBetween($datedebut, $_SESSION["glpi_currenttime"]);
                 } else {
                     // cas 24/24 - 7/7
                     $delay = strtotime($_SESSION["glpi_currenttime"]) - strtotime($datedebut);
                 }
                 $input = array();
                 $input['tickets_id'] = $ticket->getID();
                 $input['users_id'] = $d["users_id"];
                 $input['date'] = $_SESSION["glpi_currenttime"];
                 $input['begin'] = $delay;
                 $ptAssignUser->add($input);
             }
         }
     } else {
         if ($ok && in_array("status", $ticket->updates) && isset($ticket->fields["status"]) && $ticket->fields["status"] == Ticket::WAITING) {
             if ($ticket->countUsers(CommonITILActor::ASSIGN)) {
                 foreach ($ticket->getUsers(CommonITILActor::ASSIGN) as $d) {
                     $calendar = new Calendar();
                     $calendars_id = Entity::getUsedConfig('calendars_id', $ticket->fields['entities_id']);
                     $ptAssignUser = new PluginTimelineticketAssignUser();
                     $query = "SELECT MAX(`date`) AS datedebut, id\n                         FROM `" . $ptAssignUser->getTable() . "`\n                         WHERE `tickets_id` = '" . $ticket->getID() . "'\n                           AND `users_id`='" . $d["users_id"] . "'\n                           AND `delay` IS NULL";
                     $result = $DB->query($query);
                     $datedebut = '';
                     $input = array();
                     if ($result && $DB->numrows($result)) {
                         $datedebut = $DB->result($result, 0, 'datedebut');
                         $input['id'] = $DB->result($result, 0, 'id');
                     } else {
                         return;
                     }
                     if (!$datedebut) {
                         $delay = 0;
                         // Utilisation calendrier
                     } else {
                         if ($calendars_id > 0 && $calendar->getFromDB($calendars_id)) {
                             $delay = $calendar->getActiveTimeBetween($datedebut, $_SESSION["glpi_currenttime"]);
                         } else {
                             // cas 24/24 - 7/7
                             $delay = strtotime($_SESSION["glpi_currenttime"]) - strtotime($datedebut);
                         }
                     }
                     $input['delay'] = $delay;
                     $ptAssignUser->update($input);
                 }
             }
         } else {
             if (in_array("status", $ticket->updates) && isset($ticket->input["status"]) && ($ticket->input["status"] == Ticket::SOLVED || $ticket->input["status"] == Ticket::CLOSED)) {
                 if ($ticket->countUsers(CommonITILActor::ASSIGN)) {
                     foreach ($ticket->getUsers(CommonITILActor::ASSIGN) as $d) {
                         $calendar = new Calendar();
                         $calendars_id = Entity::getUsedConfig('calendars_id', $ticket->fields['entities_id']);
                         $ptAssignUser = new PluginTimelineticketAssignUser();
                         $query = "SELECT MAX(`date`) AS datedebut, id\n                         FROM `" . $ptAssignUser->getTable() . "`\n                         WHERE `tickets_id` = '" . $ticket->getID() . "'\n                           AND `users_id`='" . $d["users_id"] . "'\n                           AND `delay` IS NULL";
                         $result = $DB->query($query);
                         $datedebut = '';
                         $input = array();
                         if ($result && $DB->numrows($result)) {
                             $datedebut = $DB->result($result, 0, 'datedebut');
                             $input['id'] = $DB->result($result, 0, 'id');
                         } else {
                             return;
                         }
                         if (!$datedebut) {
                             $delay = 0;
                             // Utilisation calendrier
                         } else {
                             if ($calendars_id > 0 && $calendar->getFromDB($calendars_id)) {
                                 $delay = $calendar->getActiveTimeBetween($datedebut, $_SESSION["glpi_currenttime"]);
                             } else {
                                 // cas 24/24 - 7/7
                                 $delay = strtotime($_SESSION["glpi_currenttime"]) - strtotime($datedebut);
                             }
                         }
                         $input['delay'] = $delay;
                         $ptAssignUser->update($input);
                     }
                 }
             }
         }
     }
 }
开发者ID:pluginsGLPI,项目名称:timelineticket,代码行数:98,代码来源:assignuser.class.php

示例5: getDatasForTemplate

 /**
  * Get all data needed for template processing
  **/
 function getDatasForTemplate($event, $options = array())
 {
     global $LANG, $CFG_GLPI;
     //----------- Ticket infos -------------- //
     if ($event != 'alertnotclosed') {
         $fields = array('ticket.title' => 'name', 'ticket.content' => 'content', 'ticket.description' => 'content', 'ticket.costfixed' => 'cost_fixed', 'ticket.costmaterial' => 'cost_material');
         foreach ($fields as $tag => $table_field) {
             $this->datas['##' . $tag . '##'] = $this->obj->getField($table_field);
         }
         $this->datas['##ticket.id##'] = sprintf("%07d", $this->obj->getField("id"));
         $this->datas['##ticket.url##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=ticket_" . $this->obj->getField("id"));
         $this->datas['##ticket.urlapprove##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=ticket_" . $this->obj->getField("id") . "_4");
         $this->datas['##ticket.urlvalidation##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=ticket_" . $this->obj->getField("id") . "_7");
         $this->datas['##ticket.entity##'] = Dropdown::getDropdownName('glpi_entities', $this->getEntity());
         $events = $this->getAllEvents();
         if ($event == 'validation' && isset($options['validation_status'])) {
             $this->datas['##ticket.action##'] = $LANG['validation'][0] . ' - ' . TicketValidation::getStatus($options['validation_status']);
         } else {
             $this->datas['##ticket.action##'] = $events[$event];
         }
         $this->datas['##ticket.storestatus##'] = $this->obj->getField('status');
         $this->datas['##ticket.status##'] = Ticket::getStatus($this->obj->getField('status'));
         $this->datas['##ticket.globalvalidation##'] = TicketValidation::getStatus($this->obj->getField('global_validation'));
         $this->datas['##ticket.type##'] = Ticket::getTicketTypeName($this->obj->getField('type'));
         $this->datas['##ticket.requesttype##'] = Dropdown::getDropdownName('glpi_requesttypes', $this->obj->getField('requesttypes_id'));
         $this->datas['##ticket.urgency##'] = Ticket::getUrgencyName($this->obj->getField('urgency'));
         $this->datas['##ticket.impact##'] = Ticket::getImpactName($this->obj->getField('impact'));
         $this->datas['##ticket.priority##'] = Ticket::getPriorityName($this->obj->getField('priority'));
         $this->datas['##ticket.time##'] = Ticket::getActionTime($this->obj->getField('actiontime'));
         $this->datas['##ticket.costtime##'] = $this->obj->getField('cost_time');
         $this->datas['##ticket.creationdate##'] = convDateTime($this->obj->getField('date'));
         $this->datas['##ticket.closedate##'] = convDateTime($this->obj->getField('closedate'));
         $this->datas['##ticket.solvedate##'] = convDateTime($this->obj->getField('solvedate'));
         $this->datas['##ticket.duedate##'] = convDateTime($this->obj->getField('due_date'));
         $entitydata = new EntityData();
         $autoclose_value = $CFG_GLPI['autoclose_delay'];
         if ($entitydata->getFromDB($this->getEntity())) {
             $autoclose_value = $entitydata->getField('autoclose_delay');
             // Set global config value
             if ($autoclose_value == -1) {
                 $autoclose_value = $CFG_GLPI['autoclose_delay'];
             }
         }
         if ($autoclose_value > 0) {
             $this->datas['##ticket.autoclose##'] = $autoclose_value;
             $this->datas['##lang.ticket.autoclosewarning##'] = $LANG['job'][54] . " " . $autoclose_value . " " . $LANG['stats'][31];
         } else {
             $this->datas['##ticket.autoclose##'] = $LANG['setup'][307];
             $this->datas['##lang.ticket.autoclosewarning##'] = "";
         }
         if ($this->obj->getField('ticketcategories_id')) {
             $this->datas['##ticket.category##'] = Dropdown::getDropdownName('glpi_ticketcategories', $this->obj->getField('ticketcategories_id'));
         } else {
             $this->datas['##ticket.category##'] = '';
         }
         if ($this->obj->getField('slas_id')) {
             $this->datas['##ticket.sla##'] = Dropdown::getDropdownName('glpi_slas', $this->obj->getField('slas_id'));
         } else {
             $this->datas['##ticket.sla##'] = '';
         }
         if ($this->obj->countUsers(Ticket::REQUESTER)) {
             $users = array();
             foreach ($this->obj->getUsers(Ticket::REQUESTER) as $uid => $tmp) {
                 $user_tmp = new User();
                 $user_tmp->getFromDB($uid);
                 $users[$uid] = $user_tmp->getName();
                 $tmp = array();
                 $tmp['##author.id##'] = $uid;
                 $tmp['##author.name##'] = $user_tmp->getName();
                 if ($user_tmp->getField('locations_id')) {
                     $tmp['##author.location##'] = Dropdown::getDropdownName('glpi_locations', $user_tmp->getField('locations_id'));
                 } else {
                     $tmp['##author.location##'] = '';
                 }
                 $tmp['##author.phone##'] = $user_tmp->getField('phone');
                 $tmp['##author.phone2##'] = $user_tmp->getField('phone2');
                 $this->datas['authors'][] = $tmp;
             }
             $this->datas['##ticket.authors##'] = implode(', ', $users);
         } else {
             $this->datas['##ticket.authors##'] = '';
         }
         if ($this->obj->getField('users_id_recipient')) {
             $user_tmp = new User();
             $user_tmp->getFromDB($this->obj->getField('users_id_recipient'));
             $this->datas['##ticket.openbyuser##'] = $user_tmp->getName();
         } else {
             $this->datas['##ticket.openbyuser##'] = '';
         }
         if ($this->obj->countUsers(Ticket::ASSIGN)) {
             $users = array();
             foreach ($this->obj->getUsers(Ticket::ASSIGN) as $uid => $tmp) {
                 $user_tmp = new User();
                 $user_tmp->getFromDB($uid);
                 $users[$uid] = $user_tmp->getName();
             }
             $this->datas['##ticket.assigntousers##'] = implode(', ', $users);
//.........这里部分代码省略.........
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:101,代码来源:notificationtargetticket.class.php


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