本文整理汇总了PHP中Ticket::getPriorityName方法的典型用法代码示例。如果您正苦于以下问题:PHP Ticket::getPriorityName方法的具体用法?PHP Ticket::getPriorityName怎么用?PHP Ticket::getPriorityName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ticket
的用法示例。
在下文中一共展示了Ticket::getPriorityName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSubName
function getSubName()
{
if (!$this->getParameterValue()) {
$priority = __('All');
} else {
if ($this->getParameterValue() < 0) {
$priority = sprintf(__('%1$s %2$s'), __('At least', 'reports'), Ticket::getPriorityName(abs($this->getParameterValue())));
} else {
$priority = Ticket::getPriorityName($this->getParameterValue());
}
}
return " " . $this->getCriteriaLabel() . " : " . $priority;
}
示例2: getVal
public static function getVal(&$val1, &$val2, &$next, &$prev, &$title)
{
global $LANG, $DB;
$next = 0;
$prev = 0;
$title = "";
$job = new Ticket();
switch ($_GET["type"]) {
case "technicien":
$val1 = $_GET["id"];
$val2 = "";
$next = getNextItem("glpi_users", $_GET["id"]);
$prev = getPreviousItem("glpi_users", $_GET["id"]);
$title = $LANG['stats'][16] . " : " . Ticket::getAssignName($_GET["id"], 'User', 1);
break;
case "technicien_followup":
$val1 = $_GET["id"];
$val2 = "";
$next = getNextItem("glpi_users", $_GET["id"]);
$prev = getPreviousItem("glpi_users", $_GET["id"]);
$title = $LANG['stats'][16] . " : " . Ticket::getAssignName($_GET["id"], 'User', 1);
break;
case "enterprise":
$val1 = $_GET["id"];
$val2 = "";
$next = getNextItem("glpi_suppliers", $_GET["id"]);
$prev = getPreviousItem("glpi_suppliers", $_GET["id"]);
$title = $LANG['stats'][44] . " : " . Ticket::getAssignName($_GET["id"], 'Supplier', 1);
break;
case "user":
$val1 = $_GET["id"];
$val2 = "";
$job->fields["users_id"] = $_GET["id"];
$next = getNextItem("glpi_users", $_GET["id"]);
$prev = getPreviousItem("glpi_users", $_GET["id"]);
//$title = $LANG['stats'][20]." : ".$job->getAuthorName();
//user footer
$title = $LANG['stats'][20] . " : " . getUserName($_GET["id"]);
break;
case "users_id_recipient":
$val1 = $_GET["id"];
$val2 = "";
$job->fields["users_id"] = $_GET["id"];
$next = getNextItem("glpi_users", $_GET["id"]);
$prev = getPreviousItem("glpi_users", $_GET["id"]);
//$title = $LANG['stats'][20]." : ".$job->getAuthorName();
$title = $LANG['stats'][20] . " : ";
break;
case "ticketcategories_id":
$val1 = $_GET["id"];
$val2 = "";
$next = getNextItem("glpi_itilcategories", $_GET["id"], '', 'completename');
$prev = getPreviousItem("glpi_itilcategories", $_GET["id"], '', 'completename');
$title = $LANG['common'][36] . " : " . Dropdown::getDropdownName("glpi_itilcategories", $_GET["id"]);
break;
case "group":
$val1 = $_GET["id"];
$val2 = "";
$next = getNextItem("glpi_groups", $_GET["id"]);
$prev = getPreviousItem("glpi_groups", $_GET["id"]);
$title = $LANG['common'][35] . " : " . Dropdown::getDropdownName("glpi_groups", $_GET["id"]);
break;
case "groups_id_assign":
$val1 = $_GET["id"];
$val2 = "";
$next = getNextItem("glpi_groups", $_GET["id"]);
$prev = getPreviousItem("glpi_groups", $_GET["id"]);
$title = $LANG['common'][35] . " : " . Dropdown::getDropdownName("glpi_groups", $_GET["id"]);
break;
case "priority":
$val1 = $_GET["id"];
$val2 = "";
$next = $prev = 0;
if ($val1 < 6) {
$next = $val1 + 1;
}
if ($val1 > 1) {
$prev = $val1 - 1;
}
$title = $LANG['joblist'][2] . " : " . Ticket::getPriorityName($_GET["id"]);
break;
case "urgency":
$val1 = $_GET["id"];
$val2 = "";
$next = $prev = 0;
if ($val1 < 5) {
$next = $val1 + 1;
}
if ($val1 > 1) {
$prev = $val1 - 1;
}
$title = $LANG['joblist'][29] . " : " . Ticket::getUrgencyName($_GET["id"]);
break;
case "impact":
$val1 = $_GET["id"];
$val2 = "";
$next = $prev = 0;
if ($val1 < 5) {
$next = $val1 + 1;
}
//.........这里部分代码省略.........
示例3: showEquals
public function showEquals($searchopt, $value, $edit = true)
{
$inputname = $searchopt['linkfield'];
switch ($searchopt['table'] . "." . $searchopt['linkfield']) {
case "glpi_tickets.status":
if ($edit) {
Ticket::dropdownStatus($inputname, $value, 1);
} else {
echo Ticket::getStatus($value);
}
break;
case "glpi_tickets.priority":
if ($edit) {
Ticket::dropdownPriority($inputname, $value, true, true);
} else {
echo Ticket::getPriorityName(trim($value));
}
break;
case "glpi_tickets.impact":
if ($edit) {
Ticket::dropdownImpact($inputname, $value, true);
} else {
echo Ticket::getImpactName($value);
}
break;
case "glpi_tickets.urgency":
if ($edit) {
Ticket::dropdownUrgency($inputname, $value, true);
} else {
echo Ticket::getUrgencyName($value);
}
break;
case "glpi_tickets.global_validation":
if ($edit) {
TicketValidation::dropdownStatus($inputname, array('value' => $value, 'all' => 1));
} else {
TicketValidation::getStatus($value);
}
break;
case "glpi_users.name":
if ($edit) {
User::dropdown(array('name' => $inputname, 'value' => $value, 'comments' => false, 'all' => -1, 'right' => 'all'));
} else {
echo getUserName($value);
}
break;
case "glpi_ticketvalidations.status":
if ($edit) {
TicketValidation::dropdownStatus($inputname, array('value' => $value, 'all' => 1));
} else {
echo TicketValidation::getStatus($value);
}
break;
}
}
示例4: constructHistory
/**
* Construct history for an item
*
* @param $item CommonDBTM object
* @param $oldvalues array of old values updated
* @param $values array of all values of the item
*
* @return boolean for success (at least 1 log entry added)
**/
static function constructHistory(CommonDBTM $item, &$oldvalues, &$values)
{
global $LANG;
if (!count($oldvalues)) {
return false;
}
// needed to have $SEARCHOPTION
if ($item->getType() == 'TicketSatisfaction') {
$real_type = 'Ticket';
$real_id = $item->fields['tickets_id'];
} else {
if ($item->getType() == 'Infocom') {
$real_type = $item->fields['itemtype'];
$real_id = $item->fields['items_id'];
} else {
$real_type = $item->getType();
$real_id = $item->fields['id'];
}
}
$searchopt = Search::getOptions($real_type);
if (!is_array($searchopt)) {
return false;
}
$result = 0;
foreach ($oldvalues as $key => $oldval) {
$changes = array();
if ($real_type == 'Infocom') {
// Parsing $SEARCHOPTION to find infocom
foreach ($searchopt as $key2 => $val2) {
if ($val2["field"] == $key && strpos($val2['table'], 'infocoms') || $key == 'budgets_id' && $val2['table'] == 'glpi_budgets' || $key == 'suppliers_id' && $val2['table'] == 'glpi_suppliers') {
$id_search_option = $key2;
// Give ID of the $SEARCHOPTION
if ($val2["table"] == "glpi_infocoms") {
// 1st case : text field -> keep datas
$changes = array($id_search_option, addslashes($oldval), $values[$key]);
} else {
if ($val2["table"] == "glpi_suppliers") {
// 2nd case ; link field -> get data from glpi_suppliers
$changes = array($id_search_option, addslashes(Dropdown::getDropdownName("glpi_suppliers", $oldval)), addslashes(Dropdown::getDropdownName("glpi_suppliers", $values[$key])));
} else {
// 3rd case ; link field -> get data from dropdown (budget)
$changes = array($id_search_option, addslashes(Dropdown::getDropdownName($val2["table"], $oldval)), addslashes(Dropdown::getDropdownName($val2["table"], $values[$key])));
}
}
break;
// foreach exit
}
}
} else {
// Not an Infocom
// Parsing $SEARCHOPTION to find changed field
foreach ($searchopt as $key2 => $val2) {
// Linkfield or standard field not massive action enable
if ($val2["linkfield"] == $key || $key == $val2["field"] && $val2["table"] == $item->getTable()) {
$id_search_option = $key2;
// Give ID of the $SEARCHOPTION
// 1st case : Ticket specific dropdown case (without table)
if ($real_type == 'Ticket' && in_array($key, array('status', 'urgency', 'impact', 'priority', 'global_validation'))) {
switch ($key) {
case 'global_validation':
$changes = array($id_search_option, addslashes(TicketValidation::getStatus($oldval)), addslashes(TicketValidation::getStatus($values[$key])));
break;
case 'status':
$changes = array($id_search_option, addslashes(Ticket::getStatus($oldval)), addslashes(Ticket::getStatus($values[$key])));
break;
case 'urgency':
$changes = array($id_search_option, addslashes(Ticket::getUrgencyName($oldval)), addslashes(Ticket::getUrgencyName($values[$key])));
break;
case 'impact':
$changes = array($id_search_option, addslashes(Ticket::getImpactName($oldval)), addslashes(Ticket::getImpactName($values[$key])));
break;
case 'priority':
$changes = array($id_search_option, addslashes(Ticket::getPriorityName($oldval)), addslashes(Ticket::getPriorityName($values[$key])));
break;
}
} else {
if ($val2["table"] == $item->getTable()) {
// 2nd case : text field -> keep datas
$changes = array($id_search_option, addslashes($oldval), $values[$key]);
} else {
// if ($val2['table'] == 'glpi_users_validation') {
// $val2['table'] = 'glpi_users';
// }
// other cases ; link field -> get data from dropdown
if ($val2["table"] != 'glpi_complete_entities') {
$changes = array($id_search_option, addslashes(Dropdown::getDropdownName($val2["table"], $oldval)), addslashes(Dropdown::getDropdownName($val2["table"], $values[$key])));
}
}
}
break;
}
//.........这里部分代码省略.........
示例5: 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;
}
示例6: 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 {
//.........这里部分代码省略.........
示例7: getDatasForTemplate
//.........这里部分代码省略.........
$tmp['##update.description##'] = "---";
} else {
$description = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $this->target_object->oldvalues['description']));
$tmp['##update.description##'] = Html::clean($description);
}
}
if (isset($this->target_object->oldvalues['show_gantt'])) {
if (empty($this->target_object->oldvalues['show_gantt'])) {
$tmp['##update.gantt##'] = "---";
} else {
$tmp['##update.gantt##'] = Dropdown::getYesNo($this->target_object->oldvalues['show_gantt']);
}
}
if (isset($this->target_object->oldvalues['is_helpdesk_visible'])) {
if (empty($this->target_object->oldvalues['is_helpdesk_visible'])) {
$tmp['##update.helpdesk##'] = "---";
} else {
$tmp['##update.helpdesk##'] = Dropdown::getYesNo($this->target_object->oldvalues['is_helpdesk_visible']);
}
}
$this->datas['updates'][] = $tmp;
}
// Projet followup
$restrict = "`plugin_projet_projets_id`='" . $this->obj->getField('id') . "'";
if (isset($options['followups_id']) && $options['followups_id']) {
$restrict .= " AND `glpi_plugin_projet_followups`.`id` = '" . $options['followups_id'] . "'";
}
$restrict .= " ORDER BY `date` DESC";
$followups = getAllDatasFromTable('glpi_plugin_projet_followups', $restrict);
$this->datas['##lang.followup.description##'] = __('Content');
$this->datas['##lang.followup.date##'] = __('Date');
$this->datas['##lang.followup.recipient##'] = __('Writer');
if (!empty($followups)) {
$this->datas['##lang.followup.title##'] = _n('Associated followup', 'Associated followups', 2, 'projet');
foreach ($followups as $followup) {
$tmp = array();
$tmp['##followup.recipient##'] = Html::clean(getUserName($followup['users_id']));
$tmp['##followup.date##'] = Html::convDate($followup['date']);
$content = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $followup['content']));
$tmp['##followup.description##'] = Html::clean($content);
$this->datas['followups'][] = $tmp;
}
}
//task infos
$restrict = "`plugin_projet_projets_id`='" . $this->obj->getField('id') . "'";
if (isset($options['tasks_id']) && $options['tasks_id']) {
$restrict .= " AND `glpi_plugin_projet_tasks`.`id` = '" . $options['tasks_id'] . "'";
}
$restrict .= " ORDER BY `name` DESC";
$tasks = getAllDatasFromTable('glpi_plugin_projet_tasks', $restrict);
$this->datas['##lang.task.title##'] = _n('Associated task', 'Associated tasks', 2, 'projet');
$this->datas['##lang.task.name##'] = __('Name');
$this->datas['##lang.task.users##'] = __('User');
$this->datas['##lang.task.groups##'] = __('Group');
$this->datas['##lang.task.contacts##'] = __('Supplier');
$this->datas['##lang.task.type##'] = __('Type');
$this->datas['##lang.task.status##'] = __('State');
$this->datas['##lang.task.advance##'] = __('Progress');
$this->datas['##lang.task.priority##'] = __('Priority');
$this->datas['##lang.task.comment##'] = __('Comments');
$this->datas['##lang.task.sub##'] = __('Results');
$this->datas['##lang.task.others##'] = __('Others participants', 'projet');
$this->datas['##lang.task.affect##'] = __('Affected people', 'projet');
$this->datas['##lang.task.parenttask##'] = __('Parent task', 'projet');
$this->datas['##lang.task.gantt##'] = __('Display on the Gantt', 'projet');
$this->datas['##lang.task.depends##'] = __('Dependent', 'projet');
$this->datas['##lang.task.realtime##'] = __('Effective duration', 'projet');
$this->datas['##lang.task.location##'] = __('Location');
$this->datas['##lang.task.projet##'] = _n('Project', 'Projects', 2, 'projet');
if (!empty($tasks)) {
$this->datas['##task.title##'] = _n('Associated task', 'Associated tasks', 2, 'projet');
foreach ($tasks as $task) {
$tmp = array();
$tmp['##task.name##'] = $task['name'];
$tmp['##task.users##'] = Html::clean(getUserName($task['users_id']));
$tmp['##task.groups##'] = Dropdown::getDropdownName('glpi_groups', $task['groups_id']);
$tmp['##task.contacts##'] = Dropdown::getDropdownName('glpi_contacts', $task['contacts_id']);
$tmp['##task.type##'] = Dropdown::getDropdownName('glpi_plugin_projet_tasktypes', $task['plugin_projet_tasktypes_id']);
$tmp['##task.status##'] = Dropdown::getDropdownName('glpi_plugin_projet_taskstates', $task['plugin_projet_taskstates_id']);
$tmp['##task.advance##'] = PluginProjetProjet::displayProgressBar('100', $task['advance'], array('simple' => true));
$tmp['##task.priority##'] = Ticket::getPriorityName($task['priority']);
$comment = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $task['comment']));
$tmp['##task.comment##'] = Html::clean($comment);
$sub = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $task['sub']));
$tmp['##task.sub##'] = Html::clean($sub);
$others = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $task['others']));
$tmp['##task.others##'] = Html::clean($others);
$affect = stripslashes(str_replace(array('\\r\\n', '\\n', '\\r'), "<br/>", $task['affect']));
$tmp['##task.affect##'] = Html::clean($affect);
$tmp['##task.parenttask##'] = PluginProjetTask_Task::displayLinkedProjetTasksTo($task['id'], true);
$tmp['##task.gantt##'] = Dropdown::getYesNo($task['show_gantt']);
$tmp['##task.depends##'] = Dropdown::getYesNo($task['depends']);
$tmp['##task.realtime##'] = Ticket::getActionTime($task["actiontime"]);
$tmp['##task.location##'] = Dropdown::getDropdownName('glpi_locations', $task['locations_id']);
$tmp['##task.projet##'] = Dropdown::getDropdownName('glpi_plugin_projet_projets', $task['plugin_projet_projets_id']);
$this->datas['tasks'][] = $tmp;
}
}
}
}
示例8: 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;
}
示例9: giveItem
//.........这里部分代码省略.........
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
if ($data[$NAME . $num . '_2'] == 'waiting') {
$data[$NAME . $num] = "";
示例10: getCriteriaValue
/**
* Return a value associated with a pattern associated to a criteria to display it
*
* @param $ID the given criteria
* @param $condition condition used
* @param $value the pattern
**/
function getCriteriaValue($ID, $condition, $value)
{
global $LANG;
if ($condition != self::PATTERN_IS && $condition != self::PATTERN_IS_NOT) {
$crit = $this->getCriteria($ID);
if (isset($crit['type'])) {
switch ($crit['type']) {
case "dropdown":
return Dropdown::getDropdownName($crit["table"], $value);
case "dropdown_assign":
case "dropdown_users":
return getUserName($value);
case "yesonly":
case "yesonly":
case "yesno":
if ($value) {
return $LANG['choice'][1];
}
return $LANG['choice'][0];
case "dropdown_impact":
return Ticket::getImpactName($value);
case "dropdown_urgency":
return Ticket::getUrgencyName($value);
case "dropdown_priority":
return Ticket::getPriorityName($value);
}
}
}
return $value;
}
示例11:
} else {
$tasklevels[$key] = $time;
}
}
}
}
}
$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)) {
示例12: 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);
//.........这里部分代码省略.........
示例13: 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>";
//.........这里部分代码省略.........
示例14: getNextItem
$val2 = "";
$next = getNextItem("glpi_groups", $_GET["id"]);
$prev = getPreviousItem("glpi_groups", $_GET["id"]);
$title = $LANG['common'][35] . " : " . Dropdown::getDropdownName("glpi_groups", $_GET["id"]);
break;
case "priority":
$val1 = $_GET["id"];
$val2 = "";
$next = $prev = 0;
if ($val1 < 6) {
$next = $val1 + 1;
}
if ($val1 > 1) {
$prev = $val1 - 1;
}
$title = $LANG['joblist'][2] . " : " . Ticket::getPriorityName($_GET["id"]);
break;
case "urgency":
$val1 = $_GET["id"];
$val2 = "";
$next = $prev = 0;
if ($val1 < 5) {
$next = $val1 + 1;
}
if ($val1 > 1) {
$prev = $val1 - 1;
}
$title = $LANG['joblist'][29] . " : " . Ticket::getUrgencyName($_GET["id"]);
break;
case "impact":
$val1 = $_GET["id"];
示例15: displayPlanningItem
/**
* Display a Planning Item
*
* @param $parm Array of the item to display
* @return Nothing (display function)
**/
static function displayPlanningItem(array $val, $who, $type = "", $complete = 0)
{
global $CFG_GLPI;
$rand = mt_rand();
echo "<a href='" . $CFG_GLPI["root_doc"] . "/plugins/projet/front/task.form.php?id=" . $val["id"] . "'";
echo " onmouseout=\"cleanhide('content_task_" . $val["id"] . $rand . "')\" \n onmouseover=\"cleandisplay('content_task_" . $val["id"] . $rand . "')\"";
echo ">";
switch ($type) {
case "in":
//TRANS: %1$s is the start time of a planned item, %2$s is the end
$beginend = sprintf(__('From %1$s to %2$s :'), date("H:i", strtotime($val["begin"])), date("H:i", strtotime($val["end"])));
printf(__('%1$s %2$s'), $beginend, Html::resume_text($val["name"], 80));
break;
case "begin":
$start = sprintf(__('Start at %s'), date("H:i", strtotime($val["begin"])));
printf(__('%1$s: %2$s'), $start, Html::resume_text($val["name"], 80));
break;
case "end":
$end = sprintf(__('End at %s'), date("H:i", strtotime($val["end"])));
printf(__('%1$s: %2$s'), $end, Html::resume_text($val["name"], 80));
break;
}
if ($val["users_id"] && $who == 0) {
echo " - " . __('User') . " " . getUserName($val["users_id"]);
}
echo "</a><br>";
echo PluginProjetProjet::getTypeName(1) . " : <a href='" . $CFG_GLPI["root_doc"] . "/plugins/projet/front/projet.form.php?id=" . $val["plugin_projet_projets_id"] . "'";
echo ">" . $val["project"] . "</a>";
echo "<div class='over_link' id='content_task_" . $val["id"] . $rand . "'>";
if ($val["end"]) {
echo "<strong>" . __('End date') . "</strong> : " . Html::convdatetime($val["end"]) . "<br>";
}
if ($val["type"]) {
echo "<strong>" . PluginProjetTaskType::getTypeName(1) . "</strong> : " . $val["type"] . "<br>";
}
if ($val["state"]) {
echo "<strong>" . __('State') . "</strong> : " . $val['state'] . "<br>";
}
if ($val["location"]) {
echo "<strong>" . _n('Location', 'Locations', 1) . "</strong>: " . $val["location"] . "<br>";
}
if ($val["priority"]) {
echo "<strong>" . __('Priority') . "</strong> : " . Ticket::getPriorityName($val["priority"]) . "<br>";
}
if ($val["content"]) {
echo "<strong>" . __('Description') . "</strong> : " . $val["content"];
}
echo "</div>";
}