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

📄 graph.php

📁 本代码是为客户联系管理而做的系统
💻 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: graph.php,v $
// | $Date: 2004/02/10 01:34:30 $
// | $Revision: 1.20 $
// +-------------------------------------------------------------+
// | File Details:
// | - Generate graphs for technician reports page.
// +-------------------------------------------------------------+

error_reporting(E_ALL ^ E_NOTICE);

include "./../global.php";
require_once(INCLUDE_PATH.'functions/calendar_functions.php');
require_once(INCLUDE_PATH.'graph/jpgraph.php');
require_once(INCLUDE_PATH.'graph/jpgraph_pie.php');
require_once(INCLUDE_PATH.'graph/jpgraph_pie3d.php');

$graph = 0;

if ($_REQUEST['type'] == 'category') {
	$db->query("
		SELECT COUNT(*) AS total, ticket_cat.name AS category FROM ticket
		LEFT JOIN ticket_cat ON ticket.category = ticket_cat.id
		WHERE tech = '$user[id]'
			AND ticket.is_open 
			AND ticket.awaiting_tech
		GROUP BY category
	");

	while ($res = $db->row_array()) {
		if (!$res['category']) {
			$res['category'] = "No category";
		}
		if (strlen($res['category']) > 20) {
			$res['category'] = substr($res['category'], 0, 20);
		}
		$data[$res['category']] = $res['total'];
		$graph = 1;
	}

} else {
	$db->query("
		SELECT COUNT(*) AS total, ticket_pri.name AS priority FROM ticket
		LEFT JOIN ticket_pri ON ticket.priority = ticket_pri.id
		WHERE tech = '$user[id]'
			AND ticket.is_open 
			AND ticket.awaiting_tech
		GROUP BY priority
	");

	while ($res = $db->row_array()) {
		if (!$res['priority']) {
			$res['priority'] = "No priority";
		}
		if (strlen($res['priority']) > 20) {
			$res['priority'] = substr($res['priority'], 0, 20);
		}
		$data[$res['priority']] = $res['total'];
		$graph = 1;
	}
}

if (!$graph) {
	exit;
}

$graph = new PieGraph(350, 175);
$piegraph = new PiePlot3D(array_values($data));
$piegraph->SetCenter(0.35,0.5);
$piegraph->value->SetFont(FF_VERDANA,FS_NORMAL,8);
$graph->legend->SetFont(FF_VERDANA,FS_NORMAL,7);
$piegraph->SetLegends(array_keys($data));
$piegraph->SetLabelType(PIE_VALUE_ABS);
$piegraph->value->SetFormat('%d');
$piegraph->SetSize(0.40);
$graph->Add($piegraph);
$graph->legend->Pos(0.02,0.02);
$graph->SetMarginColor('silver');
$graph->Stroke();

⌨️ 快捷键说明

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