ticketdisplay.php
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:7k
- <?php
- // +-------------------------------------------------------------+
- // | DeskPRO v [2.0.1 Production]
- // | Copyright (C) 2001 - 2004 Headstart Solutions Limited
- // | Supplied by WTN-WDYL
- // | Nullified by WTN-WDYL
- // | Distribution via WebForum, ForumRU and associated file dumps
- // +-------------------------------------------------------------+
- // | DESKPRO IS NOT FREE SOFTWARE
- // +-------------------------------------------------------------+
- // | License ID : Full Enterprise License =) ...
- // | License Owner : WTN-WDYL Team
- // +-------------------------------------------------------------+
- // | $RCSfile: ticketdisplay.php,v $
- // | $Date: 2004/02/10 01:34:30 $
- // | $Revision: 1.29 $
- // +-------------------------------------------------------------+
- // | File Details:
- // | - Technician ticket display preferences
- // +-------------------------------------------------------------+
- error_reporting(E_ALL ^ E_NOTICE);
- include "./../global.php";
- tech_nav('settings');
- // default do
- $_REQUEST['do'] = trim($_REQUEST['do']);
- if (!isset($_REQUEST['do']) or $_REQUEST['do'] == "") {
- $_REQUEST['do'] = "view";
- }
- ############################### UNASSIGN FROM TICKETs ###############################
- if ($_REQUEST['do'] == "unassign") {
- $db->query("SELECT id FROM ticket WHERE tech = '$user[id]'");
- while ($tlog = $db->row_array()) {
- ticketlog($tlog[id], 'tech', $user[id], 0);
- }
- $db->query("UPDATE ticket SET tech = '0' WHERE tech = '$user[id]' " . iff($_REQUEST[type], " AND is_open") . "");
- alert('Tickets unassigned');
- $_REQUEST['do'] = 'view';
- }
- ############################### UPDATE SETTINGS ###############################
- if ($_REQUEST['do'] == "update") {
- if (is_array($_REQUEST['fields']['default'])) {
- while (list ($key, $value) = each ($_REQUEST['fields']['default'])) {
- $field_array['default'][] = $key;
- }
- } else {
- $field_array['default'] = array();
- }
- if (is_array($_REQUEST['fields']['custom'])) {
- while (list ($key, $value) = each ($_REQUEST['fields']['custom'])) {
- $field_array['custom'][] = $key;
- }
- } else {
- $field_array['custom'] = array();
- }
- if (is_array($_REQUEST['fields']['admin'])) {
- while (list ($key, $value) = each ($_REQUEST['fields']['admin'])) {
- $field_array['admin'][] = $key;
- }
- } else {
- $field_array['admin'] = array();
- }
- if (is_array($_REQUEST['fields']['other'])) {
- while (list ($key, $value) = each ($_REQUEST['fields']['other'])) {
- $field_array['other'][] = $key;
- }
- } else {
- $field_array['other'] = array();
- }
- $fields = serialize($field_array);
-
- $db->query("UPDATE tech SET fielddisplay = '" . mysql_escape_string($fields) . "' WHERE id = $user[id]");
- $user = $db->query_return("SELECT * FROM tech WHERE id = '$user[id]'");
- $results = $db->query_return("SELECT results FROM search WHERE id = '$_REQUEST[saved_search]'");
- $results = explode(',', $results['results']);
- if ($_REQUEST['saved_search']) {
- if ($results[0]) {
- jump("../tickets/load_results.php?searchid=$_REQUEST[saved_search]&num=0&id=$results[0]", 'Options updated');
- exit;
- } else {
- jump("../tickets/search.php?do=basic", "Settings updated.");
- exit;
- }
- } else {
- $_REQUEST['do'] = "view";
- }
- }
- ############################### VIEW SETTINGS ###############################
- if ($_REQUEST['do'] == "view") {
- $tech = $db->query_return("SELECT fielddisplay FROM tech WHERE id = '$user[id]'");
- $fields = unserialize($tech[fielddisplay]);
- // if we have never set any settings then we need to use the same that we use in ticketsearch
- if (!is_array($fields)) { $fields = unserialize($user[fielddisplay]);
- $fields = array(
- 'default' => array('category', 'priority', 'email', 'techowner', 'timetech', 'timestart'),
- 'admin' => array(),
- 'custom' => array(),
- 'other' => array('actions')
- );
- }
- // the default fields
- $table[] = table_midheader_noarray('Default Fields ' . thelp('Settings', 'Ticket Display'));
- $table[] = form_checkbox_single('openclosed', 1, @in_array('openclosed', $fields['default']), 'fields[default]') . " <b>Open / Closed</b>";
- $table[] = form_checkbox_single('awaitingtu', 1, @in_array('awaitingtu', $fields['default']), 'fields[default]') . " <b>Awaiting Tech / User</b>";
- $table[] = form_checkbox_single('category', 1, @in_array('category', $fields['default']), 'fields[default]') . " <b>Category</b>";
- $table[] = form_checkbox_single('priority', 1, @in_array('priority', $fields['default']), 'fields[default]') . " <b>Priority</b>";
- $table[] = form_checkbox_single('email', 1, @in_array('email', $fields['default']), 'fields[default]') . " <b>User/Email</b>";
- $table[] = form_checkbox_single('techowner', 1, @in_array('techowner', $fields['default']), 'fields[default]') . " <b>Tech Owner</b>";
- $table[] = form_checkbox_single('timetech', 1, @in_array('timetech', $fields['default']), 'fields[default]') . " <b>Time awaiting a tech reply</b>";
- $table[] = form_checkbox_single('timestart', 1, @in_array('timestart', $fields['default']), 'fields[default]') . " <b>Time since ticket created</b>";
- $db->query("SELECT id, display_name FROM ticket_def WHERE tech_viewable AND name LIKE 'custom%'");
- if ($db->num_rows()) {
- $table[] = table_midheader_noarray('Other Fields');
- }
- while ($user_def = $db->row_array()) {
- $user_def[display_name] = unserialize($user_def[display_name]);
- $user_def[display_name] = $user_def[display_name][$settings[default_language]];
- if (@in_array($user_def[id], $fields['custom'])) {
- $val = 1;
- } else {
- $val = 0;
- }
- $table[] = form_checkbox_single($user_def[id], 1, $val, 'fields[custom]') . " <b>$user_def[display_name]</b>";
- }
- // field definitions created by the admin
- $db->query("SELECT id, name, example FROM ticket_fielddisplay");
- if ($db->num_rows() > 0) {
- $table[] = table_midheader_noarray('Admin Created Fields');
- while ($result = $db->row_array()) {
- if (is_array($fields['admin'])) {
- if (in_array($result[id], $fields['admin'])) {
- $val = 1;
- } else {
- $val = 0;
- }
- } else {
- $val = 0;
- }
- $table[] = form_checkbox_single($result[id], 1, $val, 'fields[admin]') . " <b>$result[name]</b><br /><I>Example:</I> $result[example]";
- }
- }
- // some other options
- $table[] = table_midheader_noarray('Other Ticket Listing Options');
- $table[] = form_checkbox_single('actions', 1, @in_array('actions', $fields['other']), 'fields[other]') . " <b>Show Ticket Actions</b>" . form_hidden('saved_search', $_REQUEST['saved_search']);
- table_header('Select Fields to Display in Search Results', 'ticketdisplay.php', array('do' => 'update'));
- table_content('', $table);
- table_footer('Update Selections');
- echo "<hr><UL>";
- echo jprompt('Are you sure you want unassign yourself from all your tickets?', 'ticketdisplay.php?do=unassign', '<LI>Unassign myself from all my tickets</LI>', $danger=1);
- echo "<br /><br />";
- echo jprompt('Are you sure you want unassign yourself from all your open tickets?', 'ticketdisplay.php?do=unassign&type=open', '<LI>Unassign myself from my open tickets</LI>', $danger=1);
- echo "</UL><br />";
- }
- tech_footer();
- ?>