本文整理汇总了PHP中Ticket::getTicketTypeName方法的典型用法代码示例。如果您正苦于以下问题:PHP Ticket::getTicketTypeName方法的具体用法?PHP Ticket::getTicketTypeName怎么用?PHP Ticket::getTicketTypeName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ticket
的用法示例。
在下文中一共展示了Ticket::getTicketTypeName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getActionValue
/**
* Return a "display" value associated with a pattern associated to a criteria
*
* @param $ID the given action
* @param $type the type of action
* @param $value the value
**/
function getActionValue($ID, $type, $value)
{
$action = $this->getAction($ID);
if (isset($action['type'])) {
switch ($action['type']) {
case "dropdown":
if ($type == 'fromuser' || $type == 'fromitem') {
return Dropdown::getYesNo($value);
}
// $type == assign
$tmp = Dropdown::getDropdownName($action["table"], $value);
return $tmp == ' ' ? NOT_AVAILABLE : $tmp;
case "dropdown_status":
return Ticket::getStatus($value);
case "dropdown_assign":
case "dropdown_users":
case "dropdown_users_validate":
return getUserName($value);
case "dropdown_groups_validate":
return Dropdown::getDropdownName('glpi_groups', $value);
case "dropdown_validation_percent":
return Dropdown::getValueWithUnit($value, '%');
case "yesonly":
case "yesno":
return Dropdown::getYesNo($value);
case "dropdown_urgency":
return Ticket::getUrgencyName($value);
case "dropdown_impact":
return Ticket::getImpactName($value);
case "dropdown_priority":
return Ticket::getPriorityName($value);
case "dropdown_tickettype":
return Ticket::getTicketTypeName($value);
case "dropdown_management":
return Dropdown::getGlobalSwitch($value);
default:
return $this->displayAdditionRuleActionValue($value);
}
}
return $value;
}
示例2: isset
case 'locations_tree':
$parent = isset($_GET['champ']) ? $_GET['champ'] : 0;
$cond = "(`id` = '{$parent}' OR `locations_id` = '{$parent}')";
// nobreak;
// nobreak;
case 'locations_id':
$val1 = $_GET['id'];
$val2 = '';
$values = Stat::getItems($_GET['itemtype'], $_GET['date1'], $_GET['date2'], $_GET['type'], $parent);
$title = sprintf(__('%1$s: %2$s'), __('Location'), Dropdown::getDropdownName('glpi_locations', $_GET['id']));
break;
case "type":
$val1 = $_GET["id"];
$val2 = "";
$values = Stat::getItems($_GET["itemtype"], $_GET["date1"], $_GET["date2"], $_GET["type"]);
$title = sprintf(__('%1$s: %2$s'), __('Type'), Ticket::getTicketTypeName($_GET["id"]));
break;
case 'group_tree':
case 'groups_tree_assign':
$parent = isset($_GET['champ']) ? $_GET['champ'] : 0;
$cond = " (`id` = '{$parent}' OR `groups_id` = '{$parent}')\n AND " . ($_GET["type"] == 'group_tree' ? '`is_requester`' : '`is_assign`');
// nobreak;
// nobreak;
case "group":
$val1 = $_GET["id"];
$val2 = "";
$values = Stat::getItems($_GET["itemtype"], $_GET["date1"], $_GET["date2"], $_GET["type"], $parent);
$title = sprintf(__('%1$s: %2$s'), __('Group'), Dropdown::getDropdownName("glpi_groups", $_GET["id"]));
break;
case "groups_id_assign":
$val1 = $_GET["id"];
示例3: listSpecialDropdown
/**
* return the content of hardcoded dropdown
*
* @param $name of the dropdown
*
* @return array (or false if unknown name)
**/
private static function listSpecialDropdown($name = '')
{
global $CFG_GLPI;
$resp = array();
switch (strtolower($name)) {
case 'ticketstatus':
$tab = Ticket::getAllStatusArray();
foreach ($tab as $id => $label) {
$resp[] = array('id' => $id, 'name' => $label);
}
break;
case 'ticketurgency':
for ($i = 1; $i <= 5; $i++) {
if ($i == 3 || $CFG_GLPI['urgency_mask'] & 1 << $i) {
$resp[] = array('id' => $i, 'name' => Ticket::getUrgencyName($i));
}
}
break;
case 'ticketimpact':
for ($i = 1; $i <= 5; $i++) {
if ($i == 3 || $CFG_GLPI['impact_mask'] & 1 << $i) {
$resp[] = array('id' => $i, 'name' => Ticket::getImpactName($i));
}
}
break;
case 'tickettype':
foreach (array(Ticket::INCIDENT_TYPE, Ticket::DEMAND_TYPE) as $type) {
$resp[] = array('id' => $type, 'name' => Ticket::getTicketTypeName($type));
}
break;
case 'ticketpriority':
for ($i = 1; $i <= 5; $i++) {
$resp[] = array('id' => $i, 'name' => Ticket::getPriorityName($i));
}
break;
case 'ticketglobalvalidation':
$tab = TicketValidation::getAllStatusArray(false, true);
foreach ($tab as $id => $label) {
$resp[] = array('id' => $id, 'name' => $label);
}
break;
case 'ticketvalidationstatus':
$tab = TicketValidation::getAllStatusArray();
foreach ($tab as $id => $label) {
$resp[] = array('id' => $id, 'name' => $label);
}
break;
default:
$resp = false;
}
return $resp;
}
示例4: strtolower
//category
$sql_cat = "SELECT name\n\t\t\t\tFROM glpi_itilcategories\n\t\t\t\tWHERE id = " . $row['cat'] . " ";
$result_cat = $DB->query($sql_cat);
$row_cat = $DB->fetch_assoc($result_cat);
// associated element
$sql_item = "SELECT itemtype, items_id\n\t\t\t\tFROM glpi_items_tickets \n\t\t\t\tWHERE glpi_items_tickets.tickets_id = " . $row['id'] . "";
$result_item = $DB->query($sql_item);
$row_item = $DB->fetch_assoc($result_item);
$type = strtolower($row_item['itemtype']);
$url_type = $CFG_GLPI['url_base'] . "/front/" . $type . ".form.php?id=";
$sql_ass = "SELECT id, name\n\t\t\t\tFROM glpi_" . $type . "s\n\t\t\t\tWHERE id = " . $row_item['items_id'] . " ";
$result_ass = $DB->query($sql_ass);
if ($result_ass != '') {
$row_item = $DB->fetch_assoc($result_ass);
}
echo "\n\t\t<tr>\n\t\t\t<td style='vertical-align:middle; text-align:center;'><a href=" . $CFG_GLPI['url_base'] . "/front/ticket.form.php?id=" . $row['id'] . " target=_blank >" . $row['id'] . "</a></td>\n\t\t\t<td style='vertical-align:middle; font-size:10px;'><img src=" . $CFG_GLPI['url_base'] . "/pics/" . $status1 . ".png title='" . Ticket::getStatus($row['status']) . "' style=' cursor: pointer; cursor: hand;'/> " . Ticket::getStatus($row['status']) . " </td>\n\t\t\t<td style='vertical-align:middle;'> " . Ticket::getTicketTypeName($row['TYPE']) . " </td>\n\t\t\t<td style='vertical-align:middle;'> " . substr($row['descr'], 0, 55) . " </td>\n\t\t\t<td style='vertical-align:middle;'> " . $row_user['name'] . " " . $row_user['sname'] . " </td>\n\t\t\t<td style='vertical-align:middle;'> " . $row_tec['name'] . " " . $row_tec['sname'] . " </td>\n\t\t\t<td style='vertical-align:middle;'> " . $row_cat['name'] . " </td>\n\t\t\t<td style='vertical-align:middle;'> <a href=" . $url_type . $row_item['id'] . " target=_blank >" . $row_item['name'] . " </a></td>\t\t\t\n\t\t\t<td style='vertical-align:middle;'> " . conv_data_hora($row['date']) . " </td>\n\t\t\t<td style='vertical-align:middle;'> " . conv_data_hora($row['closedate']) . " </td>\n\t\t\t<td style='vertical-align:middle;'> " . time_ext($row['time_sec']) . " </td>\n\t\t</tr>";
}
echo "</tbody> \n\t\t\t\t</table>\n\t\t\t\t</div>";
?>
<script type="text/javascript" charset="utf-8">
$('#t_ent')
.removeClass( 'display' )
.addClass('table table-striped table-bordered table-hover');
$(document).ready(function() {
oTable = $('#t_ent').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bFilter": false,
示例5: methodGetTicket
/**
* Get a ticket information, with its followup
* for an authenticated user
*
* @param $params array of options (ticket, id2name)
* @param $protocol the communication protocol used
*
* @return array of hashtable
**/
static function methodGetTicket($params, $protocol)
{
global $DB, $CFG_GLPI;
if (isset($params['help'])) {
return array('ticket' => 'integer,mandatory', 'id2name' => 'bool,optional', 'help' => 'bool,optional');
}
if (!Session::getLoginUserID()) {
return self::Error($protocol, WEBSERVICES_ERROR_NOTAUTHENTICATED);
}
$ticket = new Ticket();
if (!isset($params['ticket'])) {
return self::Error($protocol, WEBSERVICES_ERROR_MISSINGPARAMETER, '', 'ticket');
}
if (!is_numeric($params['ticket'])) {
return self::Error($protocol, WEBSERVICES_ERROR_BADPARAMETER, '', 'ticket=' . $params['ticket']);
}
if (!$ticket->can($params['ticket'], 'r')) {
return self::Error($protocol, WEBSERVICES_ERROR_NOTFOUND);
}
$resp = $ticket->fields;
if ($resp['itemtype']) {
$item = getItemForItemtype($resp['itemtype']);
} else {
$item = false;
}
$resp['solution'] = Html::clean(Toolbox::unclean_cross_side_scripting_deep($resp['solution']));
$nextaction = new SlaLevel_Ticket();
if ($ticket->fields['slas_id'] && $nextaction->getFromDBForTicket($ticket->fields['id'])) {
$resp['slalevels_next_id'] = $nextaction->fields['slalevels_id'];
$resp['slalevels_next_date'] = $nextaction->fields['date'];
} else {
$resp['slalevels_next_id'] = 0;
$resp['slalevels_next_date'] = '';
}
if (isset($params['id2name'])) {
$resp['users_name_recipient'] = Html::clean(getUserName($ticket->fields['users_id_recipient']));
$resp['users_name_lastupdater'] = Html::clean(getUserName($ticket->fields['users_id_lastupdater']));
$resp['ticketcategories_name'] = Html::clean(Dropdown::getDropdownName('glpi_itilcategories', $ticket->fields['itilcategories_id']));
$resp['entities_name'] = Html::clean(Dropdown::getDropdownName('glpi_entities', $resp['entities_id']));
$resp['status_name'] = Html::clean($ticket->getStatus($resp['status']));
$resp['requesttypes_name'] = Html::clean(Dropdown::getDropdownName('glpi_requesttypes', $resp['requesttypes_id']));
$resp['solutiontypes_name'] = Html::clean(Dropdown::getDropdownName('glpi_solutiontypes', $resp['solutiontypes_id']));
$resp['slas_name'] = Html::clean(Dropdown::getDropdownName('glpi_slas', $resp['slas_id']));
$resp['slalevels_name'] = Html::clean(Dropdown::getDropdownName('glpi_slalevels', $resp['slalevels_id']));
$resp['slalevels_next_name'] = Html::clean(Dropdown::getDropdownName('glpi_slalevels', $resp['slalevels_next_id']));
$resp['urgency_name'] = Ticket::getUrgencyName($resp['urgency']);
$resp['impact_name'] = Ticket::getImpactName($resp['impact']);
$resp['priority_name'] = Ticket::getPriorityName($resp['priority']);
$resp['type_name'] = Ticket::getTicketTypeName($resp['type']);
$resp['global_validation_name'] = TicketValidation::getStatus($resp['global_validation']);
$resp['locations_name'] = Html::clean(Dropdown::getDropdownName('glpi_locations', $resp['locations_id']));
if ($item && $item->getFromDB($resp['items_id'])) {
$resp['items_name'] = Html::clean($item->getNameID());
$resp['itemtype_name'] = Html::clean($item->getTypeName());
} else {
$resp['items_name'] = __('General');
$resp['itemtype_name'] = '';
}
}
$resp['users'] = array();
$resp['groups'] = array();
$resp['followups'] = array();
$resp['tasks'] = array();
$resp['documents'] = array();
$resp['events'] = array();
$resp['validations'] = array();
$resp['satisfaction'] = array();
if (Session::haveRight('observe_ticket', '1')) {
// Followups
$query = "SELECT *\n FROM `glpi_ticketfollowups`\n WHERE `tickets_id` = '" . $params['ticket'] . "' ";
if (!Session::haveRight("show_full_ticket", "1")) {
$query .= " AND (`is_private`='0'\n OR `users_id` ='" . Session::getLoginUserID() . "' ) ";
}
$query .= " ORDER BY `date` DESC";
foreach ($DB->request($query) as $data) {
if (isset($params['id2name'])) {
$data['users_name'] = Html::clean(getUserName($data['users_id']));
$data['requesttypes_name'] = Html::clean(Dropdown::getDropdownName('glpi_requesttypes', $data['requesttypes_id']));
}
$resp['followups'][] = $data;
}
// Tasks
$query = "SELECT *\n FROM `glpi_tickettasks`\n WHERE `tickets_id` = '" . $params['ticket'] . "' ";
if (!Session::haveRight("show_full_ticket", "1")) {
$query .= " AND (`is_private`='0'\n OR `users_id` ='" . Session::getLoginUserID() . "' ) ";
}
$query .= " ORDER BY `date` DESC";
foreach ($DB->request($query) as $data) {
if (isset($params['id2name'])) {
$data['users_name'] = Html::clean(getUserName($data['users_id']));
$data['taskcategories_name'] = Html::clean(Dropdown::getDropdownName('glpi_taskcategories', $data['taskcategories_id']));
//.........这里部分代码省略.........
示例6: getCentral
//.........这里部分代码省略.........
echo "<td width='{$colsize2}%'>";
Html::showDateTimeFormItem("solvedate", $ticket->fields["solvedate"], 1, false, $canupdate);
echo "</td>";
if (in_array($ticket->fields["status"], $ticket->getClosedStatusArray())) {
echo "<th width='{$colsize3}%'>" . __('Close date') . "</th>";
echo "<td width='{$colsize4}%'>";
Html::showDateTimeFormItem("closedate", $ticket->fields["closedate"], 1, false, $canupdate);
echo "</td>";
} else {
echo "<td colspan='2'> </td>";
}
echo "</tr>";
}
if ($ID) {
echo "</table>";
echo "<table class='tab_cadre_fixe' id='mainformtable2'>";
}
echo "<tr class='tab_bg_1'>";
echo "<th width='{$colsize1}%'>" . sprintf(__('%1$s%2$s'), __('Type'), $tt->getMandatoryMark('type')) . "</th>";
echo "<td width='{$colsize2}%'>";
// Permit to set type when creating ticket without update right
if ($canupdate || !$ID) {
$opt = array('value' => $ticket->fields["type"]);
/// Auto submit to load template
if (!$ID) {
$opt['on_change'] = 'submit()';
}
$rand = Ticket::dropdownType('type', $opt);
if ($ID) {
$params = array('type' => '__VALUE__', 'entity_restrict' => $ticket->fields['entities_id'], 'value' => $ticket->fields['itilcategories_id'], 'currenttype' => $ticket->fields['type']);
Ajax::updateItemOnSelectEvent("dropdown_type{$rand}", "show_category_by_type", $CFG_GLPI["root_doc"] . "/ajax/dropdownTicketCategories.php", $params);
}
} else {
echo Ticket::getTicketTypeName($ticket->fields["type"]);
}
echo "</td>";
echo "<th width='{$colsize3}%'>" . sprintf(__('%1$s%2$s'), __('Category'), $tt->getMandatoryMark('itilcategories_id')) . "</th>";
echo "<td width='{$colsize4}%'>";
// Permit to set category when creating ticket without update right
if ($canupdate || !$ID || $canupdate_descr) {
$opt = array('value' => $ticket->fields["itilcategories_id"], 'entity' => $ticket->fields["entities_id"]);
if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
$opt['condition'] = "`is_helpdeskvisible`='1' AND ";
} else {
$opt['condition'] = '';
}
/// Auto submit to load template
if (!$ID) {
$opt['on_change'] = 'submit()';
}
/// if category mandatory, no empty choice
/// no empty choice is default value set on ticket creation, else yes
if (($ID || $values['itilcategories_id']) && $tt->isMandatoryField("itilcategories_id") && $ticket->fields["itilcategories_id"] > 0) {
$opt['display_emptychoice'] = false;
}
switch ($ticket->fields["type"]) {
case Ticket::INCIDENT_TYPE:
$opt['condition'] .= "`is_incident`='1'";
break;
case Ticket::DEMAND_TYPE:
$opt['condition'] .= "`is_request`='1'";
break;
default:
break;
}
echo "<span id='show_category_by_type'>";
示例7: getValueToMatch
/**
* Return a value associated with a pattern associated to a criteria to compare it
*
* @param $condition condition used
* @param $initValue the pattern
**/
function getValueToMatch($condition, &$initValue)
{
global $LANG;
$type = $this->getType();
if (!empty($type) && ($condition != Rule::PATTERN_IS && $condition != Rule::PATTERN_IS_NOT)) {
switch ($this->getType()) {
case "dropdown":
return Dropdown::getDropdownName($this->getTable(), $initValue);
case "dropdown_users":
return getUserName($initValue);
case "dropdown_tracking_itemtype":
if (class_exists($initValue)) {
$item = new $initValue();
return $item->getTypeName();
} else {
if (empty($initValue)) {
return $LANG['help'][30];
}
}
break;
case "dropdown_urgency":
return Ticket::getUrgencyName($initValue);
case "dropdown_impact":
return Ticket::getImpactName($initValue);
case "dropdown_priority":
return Ticket::getPriorityName($initValue);
case "dropdown_tickettype":
return Ticket::getTicketTypeName($initValue);
}
}
return $initValue;
}
示例8: showTicketTemplate
function showTicketTemplate($items_id)
{
global $CFG_GLPI;
$ticketTemplate = new TicketTemplate();
echo "<form method='post' name='form_addquestion' action='" . $CFG_GLPI['root_doc'] . "/plugins/surveyticket/front/tickettemplate.form.php'>";
echo "<table class='tab_cadre' width='700'>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Ticket template') . " :</td>";
echo "<td>";
$a_used = array();
Dropdown::show("TicketTemplate", array("name" => "tickettemplates_id", "used" => $a_used));
echo "</td>";
echo "<td>" . __('Type') . " :</td>";
echo "<td>";
Ticket::dropdownType("type");
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Simplified interface') . " :</td>";
echo "<td>";
Dropdown::showYesNo("is_helpdesk");
echo "</td>";
echo "<td>" . __('Standard interface') . " :</td>";
echo "<td>";
Dropdown::showYesNo("is_central");
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td class='tab_bg_2 top' colspan='4'>";
echo "<input type='hidden' name='plugin_surveyticket_surveys_id' value='" . $items_id . "'>";
echo "<div class='center'>";
echo "<input type='submit' name='add' value=\"" . __('Add') . "\" class='submit'>";
echo "</div></td></tr>";
echo "</table>";
Html::closeForm();
// list templates
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'>";
echo "<th>";
echo __('Ticket template');
echo "</th>";
echo "<th>";
echo __('Type');
echo "</th>";
echo "<th>";
echo __('Simplified interface');
echo "</th>";
echo "<th>";
echo __('Standard interface');
echo "</th>";
echo "<th>";
echo "</th>";
echo "</tr>";
$_tickettempaltes = $this->find("`plugin_surveyticket_surveys_id`='" . $items_id . "'");
foreach ($_tickettempaltes as $data) {
echo "<tr class='tab_bg_1'>";
echo "<td>";
$ticketTemplate->getFromDB($data['tickettemplates_id']);
echo $ticketTemplate->getLink(1);
echo "</td>";
echo "<td>";
echo Ticket::getTicketTypeName($data['type']);
echo "</td>";
echo "<td>";
echo Dropdown::getYesNo($data['is_helpdesk']);
echo "</td>";
echo "<td>";
echo Dropdown::getYesNo($data['is_central']);
echo "</td>";
echo "<td align='center'>";
echo "<form method='post' name='form_delettickettemplate' action='" . $CFG_GLPI['root_doc'] . "/plugins/surveyticket/front/tickettemplate.form.php'>";
echo "<input type='hidden' name='id' value='" . $data['id'] . "'>";
echo "<input type='submit' name='delete' value=\"" . _sx('button', 'Delete permanently') . "\" class='submit'>";
Html::closeForm();
echo "</td>";
echo "</tr>";
}
echo "</table>";
}
示例9: avg
if ($status1 == "2") {
$status1 = "assign";
}
if ($status1 == "3") {
$status1 = "plan";
}
if ($status1 == "4") {
$status1 = "waiting";
}
if ($status1 == "5") {
$status1 = "solved";
}
if ($status1 == "6") {
$status1 = "closed";
}
$type = Ticket::getTicketTypeName($row['type']);
if ($satisfacao != '' || $satisfacao > 0) {
$query_satc = "SELECT `glpi_ticketsatisfactions`.satisfaction AS sat, avg( glpi_ticketsatisfactions.satisfaction ) AS sat1\n\t\tFROM `glpi_ticketsatisfactions`\n\t\tWHERE glpi_ticketsatisfactions.tickets_id = " . $row['id'] . " ";
$result_satc = $DB->query($query_satc);
$satc = $DB->fetch_assoc($result_satc);
$satc1 = $satc['sat'];
$nota1 = round($satc1['sat1'] / 5 * 100, 1);
echo "\n\t\t<tr>\n\t\t<td style='vertical-align:middle; text-align:center;'><a href=" . $CFG_GLPI['url_base'] . "/front/ticket.form.php?id=" . $row['id'] . " target=_blank >" . $row['id'] . "</a></td>\n\t\t<td style='vertical-align:middle;'><img src=" . $CFG_GLPI['url_base'] . "/pics/" . $status1 . ".png title='" . Ticket::getStatus($row['status']) . "' style=' cursor: pointer; cursor: hand;'/> " . Ticket::getStatus($row['status']) . " </td>\n\t\t<td style='vertical-align:middle;'> " . $type . " </td>\n\t\t<td style='vertical-align:middle;'> " . substr($row['name'], 0, 75) . " </td>\n\t\t<td style='vertical-align:middle; text-align:center;'> " . conv_data_hora($row['date']) . " </td>\n\t\t<td style='vertical-align:middle; text-align:center;'> " . conv_data_hora($row['closedate']) . " </td>\n\t\t<td style='vertical-align:middle; text-align:center;'> " . time_ext($row['time']) . "</td>\n\t\t<td style='vertical-align:middle;'> <img src='../img/s" . $satc1 . ".png' alt='" . $nota1 . " %' title='" . $nota1 . " %'> </td>\n\t\t</tr>";
} else {
echo "\n\t\t<tr>\n\t\t<td style='vertical-align:middle; text-align:center;'><a href=" . $CFG_GLPI['url_base'] . "/front/ticket.form.php?id=" . $row['id'] . " target=_blank >" . $row['id'] . "</a></td>\n\t\t<td style='vertical-align:middle;'><img src=" . $CFG_GLPI['url_base'] . "/pics/" . $status1 . ".png title='" . Ticket::getStatus($row['status']) . "' style=' cursor: pointer; cursor: hand;'/> " . Ticket::getStatus($row['status']) . " </td>\n\t\t<td style='vertical-align:middle;'> " . $type . " </td>\n\t\t<td style='vertical-align:middle;'> " . substr($row['name'], 0, 75) . " </td>\n\t\t<td style='vertical-align:middle; text-align:center;'> " . conv_data_hora($row['date']) . " </td>\n\t\t<td style='vertical-align:middle; text-align:center;'> " . conv_data_hora($row['closedate']) . " </td>\n\t\t<td style='vertical-align:middle; text-align:center;'> " . time_ext($row['time']) . "</td>\n\t\t</tr>";
}
}
echo "</tbody>\n\t\t</table>\n\t\t</div>";
?>
<script type="text/javascript" charset="utf-8">
示例10: giveItem
//.........这里部分代码省略.........
return $data[$NAME . $num];
case "glpi_auth_tables.name":
return Auth::getMethodName($data[$NAME . $num], $data[$NAME . $num . "_2"], 1, $data[$NAME . $num . "_3"] . $data[$NAME . $num . "_4"]);
case "glpi_reservationitems.comment":
if (empty($data[$NAME . $num])) {
return "<a title=\"" . $LANG['reservation'][22] . "\"\n href='" . $CFG_GLPI["root_doc"] . "/front/reservationitem.form.php?id=" . $data["refID"] . "' >" . $LANG['common'][49] . "</a>";
}
return "<a title=\"" . $LANG['reservation'][22] . "\"\n href='" . $CFG_GLPI["root_doc"] . "/front/reservationitem.form.php?id=" . $data['refID'] . "' >" . resume_text($data[$NAME . $num]) . "</a>";
case 'glpi_notifications.mode':
return Notification::getMode($data[$NAME . $num]);
case 'glpi_notifications.event':
$item = NotificationTarget::getInstanceByType($data['itemtype']);
if ($item) {
$events = $item->getAllEvents();
return $events[$data[$NAME . $num]];
}
return '';
case 'glpi_crontasks.description':
$tmp = new CronTask();
return $tmp->getDescription($data['id']);
case 'glpi_crontasks.state':
return CronTask::getStateName($data[$NAME . $num]);
case 'glpi_crontasks.mode':
return CronTask::getModeName($data[$NAME . $num]);
case 'glpi_crontasks.itemtype':
if ($plug = isPluginItemType($data[$NAME . $num])) {
return $plug['plugin'];
}
return '';
case 'glpi_tickets.status':
$status = Ticket::getStatus($data[$NAME . $num]);
return "<img src=\"" . $CFG_GLPI["root_doc"] . "/pics/" . $data[$NAME . $num] . ".png\"\n alt=\"{$status}\" title=\"{$status}\"> {$status}";
case 'glpi_tickets.type':
return Ticket::getTicketTypeName($data[$NAME . $num]);
case 'glpi_tickets.priority':
return Ticket::getPriorityName($data[$NAME . $num]);
case 'glpi_tickets.urgency':
return Ticket::getUrgencyName($data[$NAME . $num]);
case 'glpi_tickets.impact':
return Ticket::getImpactName($data[$NAME . $num]);
case 'glpi_tickets.items_id':
if (!empty($data[$NAME . $num . "_2"]) && class_exists($data[$NAME . $num . "_2"])) {
$item = new $data[$NAME . $num . "_2"]();
if ($item->getFromDB($data[$NAME . $num])) {
return $item->getLink(true);
}
}
return ' ';
case 'glpi_tickets.name':
$link = getItemTypeFormURL('Ticket');
$out = "<a id='ticket" . $data[$NAME . $num . "_2"] . "' href=\"" . $link;
$out .= strstr($link, '?') ? '&' : '?';
$out .= 'id=' . $data[$NAME . $num . "_2"];
// Force solution tab if solved
if ($data[$NAME . $num . "_4"] == 'solved') {
$out .= "&forcetab=4";
}
$out .= "\">" . $data[$NAME . $num];
if ($_SESSION["glpiis_ids_visible"] || empty($data[$NAME . $num])) {
$out .= " (" . $data[$NAME . $num . "_2"] . ")";
}
$out .= "</a>";
$out .= showToolTip(nl2br($data[$NAME . $num . "_3"]), array('applyto' => 'ticket' . $data[$NAME . $num . "_2"], 'display' => false));
return $out;
case "glpi_tickets.due_date":
// No due date in waiting status
示例11: getCriteriaDisplayPattern
/**
* Return a value associated with a pattern associated to a criteria to display it
*
* @param $ID the given criteria
* @param $condition condition used
* @param $pattern the pattern
**/
function getCriteriaDisplayPattern($ID, $condition, $pattern)
{
global $LANG;
if ($condition == self::PATTERN_EXISTS || $condition == self::PATTERN_DOES_NOT_EXISTS || $condition == self::PATTERN_FIND) {
return $LANG['choice'][1];
} else {
if ($condition == self::PATTERN_IS || $condition == self::PATTERN_IS_NOT) {
$crit = $this->getCriteria($ID);
if (isset($crit['type'])) {
switch ($crit['type']) {
case "yesonly":
case "yesno":
return Dropdown::getYesNo($pattern);
case "dropdown":
$addentity = "";
if ($this->isEntityAssign()) {
$itemtype = getItemTypeForTable($crit["table"]);
$item = new $itemtype();
if ($item->isEntityAssign() && $item->getFromDB($pattern)) {
$addentity = ' (' . Dropdown::getDropdownName('glpi_entities', $item->getEntityID()) . ')';
}
}
return Dropdown::getDropdownName($crit["table"], $pattern) . $addentity;
case "dropdown_users":
return getUserName($pattern);
case "dropdown_tracking_itemtype":
if (class_exists($pattern)) {
$item = new $pattern();
return $item->getTypeName();
}
if (empty($pattern)) {
return $LANG['help'][30];
}
break;
case "dropdown_priority":
return Ticket::getPriorityName($pattern);
case "dropdown_urgency":
return Ticket::getUrgencyName($pattern);
case "dropdown_impact":
return Ticket::getImpactName($pattern);
case "dropdown_tickettype":
return Ticket::getTicketTypeName($pattern);
}
}
}
}
if ($result = $this->getAdditionalCriteriaDisplayPattern($ID, $condition, $pattern)) {
return $result;
}
return $pattern;
}
示例12: foreach
}
}
}
}
}
$row_num++;
$num = 1;
echo Search::showNewLine($output_type);
echo Search::showItem($output_type, $data['id'], $num, $row_num);
echo Search::showItem($output_type, Dropdown::getDropdownName('glpi_entities', $data['entities_id']), $num, $row_num);
echo Search::showItem($output_type, Ticket::getStatus($data["status"]), $num, $row_num);
echo Search::showItem($output_type, Html::convDateTime($data['date']), $num, $row_num);
echo Search::showItem($output_type, Html::convDateTime($data['date_mod']), $num, $row_num);
echo Search::showItem($output_type, Ticket::getPriorityName($data['priority']), $num, $row_num);
echo Search::showItem($output_type, $userdata, $num, $row_num);
echo Search::showItem($output_type, Ticket::getTicketTypeName($data['type']), $num, $row_num);
echo Search::showItem($output_type, Dropdown::getDropdownName("glpi_itilcategories", $data["itilcategories_id"]), $num, $row_num);
$out = $ticket->getLink();
echo Search::showItem($output_type, $out, $num, $row_num);
echo Search::showItem($output_type, Html::convDateTime($data['closedate']), $num, $row_num);
echo Search::showItem($output_type, Dropdown::getDropdownName('glpi_requesttypes', $data["requesttypes_id"]), $num, $row_num);
if ($output_type == Search::HTML_OUTPUT || $output_type == Search::PDF_OUTPUT_PORTRAIT || $output_type == Search::PDF_OUTPUT_LANDSCAPE) {
echo Search::showItem($output_type, Html::timestampToString($data["takeintoaccount_delay_stat"]), $num, $row_num);
} else {
echo Search::showItem($output_type, Html::formatNumber($data["takeintoaccount_delay_stat"] / 3600, false, 5), $num, $row_num);
}
echo Search::showItem($output_type, Dropdown::getDropdownName('glpi_slas', $data["slas_id"]), $num, $row_num);
$time = 0;
if (!empty($mylevels)) {
foreach ($mylevels as $key => $val) {
if (array_key_exists($key, $timelevels)) {
示例13: 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);
//.........这里部分代码省略.........
示例14: showForm
function showForm(Ticket $ticket)
{
global $CFG_GLPI;
echo "<form method='post' name='' id='' action=\"" . $CFG_GLPI['root_doc'] . "/plugins/escalation/front/ticketcopy.form.php\">";
echo "<table width='950' class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th colspan='3'>";
echo "Copie de ticket (Liste des champs à copier)";
echo "</th>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='3' align='center'>";
echo "<a href=\"javascript:showHideDiv('listfields','imgcat0','../../pics/folder.png'," . "'../../pics/folder-open.png');\">";
echo "Voir tous les champs</a>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>";
echo "</td>";
echo "<td>";
echo "Lier au ticket";
echo "</td>";
echo "<td>";
Dropdown::showYesNo('link');
echo "</td>";
echo "</tr>";
$this->displayField(__('Title'), "name", $ticket->fields['name'], '', 'checked');
$this->displayField(__('Description'), "content", $ticket->fields['content'], '', 'checked');
echo "</table>";
echo "<div id='listfields' style='display:none;'>";
echo "<table width='950' class='tab_cadre_fixe'>";
$this->displayField(__('Status'), "status", Ticket::getStatus($ticket->fields['status']), $ticket->fields['status']);
$this->displayField(__('Type'), "type", Ticket::getTicketTypeName($ticket->fields['type']), $ticket->fields['type']);
$this->displayField(__('Urgency'), "urgency", Ticket::getUrgencyName($ticket->fields['urgency']), $ticket->fields['urgency']);
$this->displayField(__('Impact'), "impact", Ticket::getImpactName($ticket->fields['impact']), $ticket->fields['impact']);
$this->displayField(__('Priority'), "priority", Ticket::getPriorityName($ticket->fields['priority']), $ticket->fields['priority']);
$this->displayField(__('Due date'), "due_date", Html::convDateTime($ticket->fields['due_date']), $ticket->fields['due_date']);
$this->displayField(__('Category'), "itilcategories_id", Dropdown::getDropdownName('glpi_itilcategories', $ticket->fields['itilcategories_id']), $ticket->fields['itilcategories_id']);
if ($ticket->fields['items_id'] > 0) {
$this->displayField(__('Associated element') . ' - ' . __('Type'), "itemtype", call_user_func(array($ticket->fields['itemtype'], 'getTypeName')), $ticket->fields['itemtype']);
$this->displayField(__('Associated element'), "items_id", Dropdown::getDropdownName(getTableForItemType($ticket->fields['itemtype']), $ticket->fields['items_id']), $ticket->fields['items_id']);
}
$this->displayField(__('Request source'), "requesttypes_id", Dropdown::getDropdownName('glpi_requesttypes', $ticket->fields['requesttypes_id']), $ticket->fields['requesttypes_id']);
$this->displayField(__('SLA'), "slas_id", Dropdown::getDropdownName('glpi_slas', $ticket->fields['slas_id']), $ticket->fields['slas_id']);
$ticket_User = new Ticket_User();
$a_ticket_users = $ticket_User->find("`tickets_id`='" . $ticket->getID() . "'\n AND `type`='1'");
foreach ($a_ticket_users as $data) {
$name = '';
if ($data['users_id'] == 0) {
$name = $data['alternative_email'];
} else {
$name = Dropdown::getDropdownName('glpi_users', $data['users_id']);
}
$this->displayField(__('Requester'), "_users_id_requester", $name, $data['id']);
}
$group_Ticket = new Group_Ticket();
$a_group_tickets = $group_Ticket->find("`tickets_id`='" . $ticket->getID() . "'\n AND `type`='1'");
foreach ($a_group_tickets as $data) {
$this->displayField(__('Requester group'), "_groups_id_requester", Dropdown::getDropdownName('glpi_groups', $data['groups_id']), $data['groups_id']);
}
// Techs
$peConfig = new PluginEscalationConfig();
if ($peConfig->getValue('workflow', $ticket->fields['entities_id']) == '0') {
$a_ticket_uers = $ticket_User->find("`tickets_id`='" . $ticket->getID() . "'\n AND `type`='2'");
foreach ($a_ticket_uers as $data) {
$name = '';
if ($data['users_id'] == 0) {
$name = $data['alternative_email'];
} else {
$name = Dropdown::getDropdownName('glpi_users', $data['users_id']);
}
$this->displayField(__('Technician'), "_users_id_assign", $name, $data['id']);
}
$a_group_tickets = $group_Ticket->find("`tickets_id`='" . $ticket->getID() . "'\n AND `type`='2'");
foreach ($a_group_tickets as $data) {
$this->displayField(__('Group in charge of the ticket'), "_groups_id_assign", Dropdown::getDropdownName('glpi_groups', $data['groups_id']), $data['groups_id']);
}
}
$ticketFollowup = new TicketFollowup();
$followups = $ticketFollowup->find("`tickets_id`='" . $ticket->getID() . "'");
foreach ($followups as $data) {
$this->displayField(__('Follow-up'), "followup-" . $data['id'], $data['content'], $data['id']);
}
$ticketTask = new TicketTask();
$tasks = $ticketTask->find("`tickets_id`='" . $ticket->getID() . "'");
foreach ($tasks as $data) {
$this->displayField(__('Task'), "task-" . $data['id'], $data['content'], $data['id']);
}
// Documents
// $document_Item = new Document_Item();
// $docs = $document_Item->find("`items_id`='".$ticket->getID()."'
// AND `itemtype`='Ticket'");
// foreach ($docs as $data) {
// $this->displayField($LANG['document'][18], "filename",
// Dropdown::getDropdownName("glpi_documents", $data['documents_id']),
// $data['documents_id']);
// }
// // filename[]
echo "</table>";
echo "</div>";
//.........这里部分代码省略.........
示例15: getSpecificValueToDisplay
/**
* @since version 0.84 (before in entitydata.class)
*
* @param $field
* @param $values
* @param $options array
**/
static function getSpecificValueToDisplay($field, $values, array $options = array())
{
if (!is_array($values)) {
$values = array($field => $values);
}
switch ($field) {
case 'use_licenses_alert':
case 'use_contracts_alert':
case 'use_infocoms_alert':
case 'is_notif_enable_default':
if ($values[$field] == self::CONFIG_PARENT) {
return __('Inheritance of the parent entity');
}
return Dropdown::getYesNo($values[$field]);
case 'use_reservations_alert':
switch ($values[$field]) {
case self::CONFIG_PARENT:
return __('Inheritance of the parent entity');
case 0:
return __('Never');
}
return sprintf(_n('%d hour', '%d hours', $values[$field]), $values[$field]);
case 'default_cartridges_alarm_threshold':
case 'default_consumables_alarm_threshold':
switch ($values[$field]) {
case self::CONFIG_PARENT:
return __('Inheritance of the parent entity');
case 0:
return __('Never');
}
return $values[$field];
case 'send_contracts_alert_before_delay':
case 'send_infocoms_alert_before_delay':
case 'send_licenses_alert_before_delay':
switch ($values[$field]) {
case self::CONFIG_PARENT:
return __('Inheritance of the parent entity');
case 0:
return __('No');
}
return sprintf(_n('%d day', '%d days', $values[$field]), $values[$field]);
case 'cartridges_alert_repeat':
case 'consumables_alert_repeat':
switch ($values[$field]) {
case self::CONFIG_PARENT:
return __('Inheritance of the parent entity');
case self::CONFIG_NEVER:
case 0:
// For compatibility issue
return __('Never');
case DAY_TIMESTAMP:
return __('Each day');
case WEEK_TIMESTAMP:
return __('Each week');
case MONTH_TIMESTAMP:
return __('Each month');
default:
// Display value if not defined
return $values[$field];
}
break;
case 'notclosed_delay':
// 0 means never
switch ($values[$field]) {
case self::CONFIG_PARENT:
return __('Inheritance of the parent entity');
case 0:
return __('Never');
}
return sprintf(_n('%d day', '%d days', $values[$field]), $values[$field]);
case 'auto_assign_mode':
return self::getAutoAssignMode($values[$field]);
case 'tickettype':
if ($values[$field] == self::CONFIG_PARENT) {
return __('Inheritance of the parent entity');
}
return Ticket::getTicketTypeName($values[$field]);
case 'autofill_buy_date':
case 'autofill_order_date':
case 'autofill_delivery_date':
case 'autofill_use_date':
case 'autofill_warranty_date':
switch ($values[$field]) {
case self::CONFIG_PARENT:
return __('Inheritance of the parent entity');
case Infocom::COPY_WARRANTY_DATE:
return __('Copy the start date of warranty');
case Infocom::COPY_BUY_DATE:
return __('Copy the date of purchase');
case Infocom::COPY_ORDER_DATE:
return __('Copy the order date');
case Infocom::COPY_DELIVERY_DATE:
return __('Copy the delivery date');
//.........这里部分代码省略.........