⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 escalate.php

📁 jsp程序开发系统
💻 PHP
字号:
<?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: escalate.php,v $
// | $Date: 2004/02/10 01:34:25 $
// | $Revision: 1.14 $
// +-------------------------------------------------------------+
// | File Details:
// | - Ticket auto-escalation options (administration interface)
// +-------------------------------------------------------------+

error_reporting(E_ALL & ~E_NOTICE);
require_once('./global.php');
//Nullify WTN-WDYL Team

// default do
$_REQUEST['do'] = trim($_REQUEST['do']);
if (!isset($_REQUEST['do']) or $_REQUEST['do'] == "") {
	$_REQUEST['do'] = "view";
}

// globalise variables
$global = array	(
			array('id', 'number')
);
rg($global);

############################### DELETE ESCALATION ###############################

if ($_REQUEST['do'] == 'delete') {
	$db->query("DELETE FROM escalate WHERE id = '$id'");
	jump('escalate.php', 'Escalation criteria deleted');
}

############################### NEW ESCALATION (2) ###############################

if ($_REQUEST['do'] == 'new2') {
	if ($_REQUEST['dayswaiting'] OR $_REQUEST['daysopen']) {
		if (is_array($_REQUEST['email'])) {
			foreach ($_REQUEST['email'] AS $key => $var) {
				$techemail .= $var . ',';
			}
			$techemail = substr($techemail, 0, -1);
		}

		$db->query("INSERT INTO escalate SET
			category = '" . mysql_escape_string($_REQUEST['category']) . "',
			priority = '" . mysql_escape_string($_REQUEST['priority']) . "',
			tech = '" . mysql_escape_string($_REQUEST['tech']) . "',
			techemail = '$techemail',
			dayswaiting = '" . ((int)$_REQUEST['dayswaiting']) . "',
			daysopen = '" . ((int)$_REQUEST['daysopen']) . "'
		");

		jump('escalate.php', 'New escalation criteria created');
	} else {
		alert('You must set a number of days for escalation');
		$escalate = $_REQUEST;
		$_REQUEST['do'] = 'new';
	}
}	

############################### EDIT ESCALATION (2) ###############################

if ($_REQUEST['do'] == 'edit2') {
	if ($_REQUEST['dayswaiting'] OR $_REQUEST['daysopen']) {
		if (is_array($_REQUEST['email'])) {
			foreach ($_REQUEST['email'] AS $key => $var) {
				$techemail .= $var . ',';
			}
			$techemail = substr($techemail, 0, -1);
		}

		$db->query("UPDATE escalate SET
			category = '" . mysql_escape_string($_REQUEST['category']) . "',
			priority = '" . mysql_escape_string($_REQUEST['priority']) . "',
			tech = '" . mysql_escape_string($_REQUEST['tech']) . "',
			techemail = '$techemail',
			dayswaiting = '" . ((int)$_REQUEST['dayswaiting']) . "',
			daysopen = '" . ((int)$_REQUEST['daysopen']) . "'
			WHERE id = '$id'
		");

		jump('escalate.php', 'Escalation criteria created updated');
	} else {
		alert('You must set a number of days for escalation');
		$_REQUEST['do'] = 'edit';
	}
}	

############################### NEW / EDIT ESCALATION ###############################

if (($_REQUEST['do'] == 'new') OR ($_REQUEST['do'] == 'edit')) {
	if ($_REQUEST['do'] == 'edit') {
		admin_header('Escalations', 'Edit Escalation');
		$escalate = $db->query_return("SELECT * FROM escalate WHERE id = '$id'");
	} else {
		admin_header('Escalations', 'New Escalation');
	}

	$cats[0] = 'Do not change';
	$db->query("SELECT id, name FROM ticket_cat");
	while ($result = $db->row_array()) {
		$cats[$result['id']] = $result['name'];
	}

	$pris[0] = 'Do not change';
	$db->query("SELECT id, name FROM ticket_pri");
	while ($result = $db->row_array()) {
		$pris[$result['id']] = $result['name'];
	}

	$techs[0] = 'Do not change';
	$db->query("SELECT id, username FROM tech");
	while ($result = $db->row_array()) {
		$techs[$result['id']] = $result['username'];
	}

	$table[] = array('<b>Days user has been waiting</b><br />Days since last user message with no tech response', form_select('dayswaiting', make_numberarray(1, 120, 1), '', $escalate['dayswaiting']));
	$table[] = array('<b>Days ticket has been open</b><br />Number of days since ticket opened', form_select('daysopen', make_numberarray(1, 120, 1), '', $escalate['daysopen']));
	$table[] = table_midheader('Actions upon escalation');
	$table[] = array('<b>Assign ticket to technician</b>', form_select('tech', $techs, '', $escalate['tech']));
	unset($techs[0]);

	$escalate['techemail'] = explode(',', $escalate['techemail']);

	$table[] = array('<b>Email specific technicians</b><br />This lets techs know that the ticket requires urgent attention.', form_select('email', $techs, '', $escalate['techemail'], '', '', 5));
	$table[] = array('<b>Change Priority</b>', form_select('priority', $pris, '', $escalate['priority']));
	$table[] = array('<b>Change Category</b>', form_select('category', $cats, '', $escalate['category']));

	if ($_REQUEST['do'] == 'new') {
		$title = 'Create Escalations';
		$button = 'Create';
		$hidden = array('do' => 'new2');
	} else {
		$title = 'Edit Escalations';
		$button = 'Edit';
		$hidden = array('do' => 'edit2', 'id' => $id);
	}

	table_header($title, 'escalate.php', $hidden);
	table_content($cols, $table);
	table_footer($button);
}

############################### VIEW ESCALATION CRITERIA ###############################

if ($_REQUEST['do'] == 'view') {
	admin_header('Escalations', 'View Escalations');

	$db->query("SELECT id, username FROM tech");
	while ($result = $db->row_array()) {
		$techs[$result[id]] = $result['username'];
	}

	$db->query("SELECT escalate.*, ticket_cat.name AS catname, ticket_pri.name AS priname
				FROM escalate
				LEFT JOIN ticket_cat ON (escalate.category = ticket_cat.id)
				LEFT JOIN ticket_pri ON (escalate.priority = ticket_pri.id)
			");
	
	while ($result = $db->row_array()) {

		unset($techarray);
		$techtmp = split(',', $result['techemail']);
		if (is_array($techtmp)) {
			foreach ($techtmp AS $key => $var) {
				if ($var) {
					$techarray[] = $techs[$var];
				}
			}
		}

		$table[] = array(
			'<b>' . iff($result['dayswaiting'], $result['dayswaiting'], '&nbsp;') . '</b>',
			'<b>' . iff($result['daysopen'], $result['daysopen'], '&nbsp;') . '</b>',
			$techs[$result['tech']],
			$result['catname'],
			$result['priname'],
			iff(is_array($techarray), @form_select($result['id'], $techarray)),
			"<a href=\"escalate.php?do=edit&id=$result[id]\">edit</a>",
			jprompt('Please confirm you wish to delete this escalation procedure', "escalate.php?do=delete&id=$result[id]", 'delete')
		);

	}
			
	$cols = array('Days Waiting', 'Days Open', 'Change Tech Owner', 'Category Change', 'Priority Change', 'Email Techs', 'Edit', 'Delete');
	table_header('Current Escalation Procedures');
	table_content($cols, $table);
	table_footer($button);		
}

##############################################################

admin_footer();

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -