-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathproblem_data.php
64 lines (55 loc) · 3.17 KB
/
problem_data.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
include_once("conn.php");
$pid=$_GET['pid'];
$path=$_SERVER['PHP_SELF'];
$dir=explode("/",$path);
$ref="http://".$_SERVER['SERVER_NAME'];
for ($i=0;$i<count($dir)-1;$i++) $ref=$ref.$dir[$i]."/";
include 'php-ofc-library/open-flash-chart.php';
$title=new title( 'Statistatics Of Problem '.$pid.'' );
$title->set_style('color: #000000; font-size: 20px');
list($nac)=mysql_fetch_array(mysql_query("select count(*) from status where pid='$pid' and result='Accepted'"));
list($nce)=mysql_fetch_array(mysql_query("select count(*) from status where pid='$pid' and result='Compile Error'"));
list($nwa)=mysql_fetch_array(mysql_query("select count(*) from status where pid='$pid' and result='Wrong Answer'"));
list($npe)=mysql_fetch_array(mysql_query("select count(*) from status where pid='$pid' and result='Presentation Error'"));
list($nre)=mysql_fetch_array(mysql_query("select count(*) from status where pid='$pid' and result='Runtime Error'"));
list($ntle)=mysql_fetch_array(mysql_query("select count(*) from status where pid='$pid' and result='Time Limit Exceed'"));
list($nmle)=mysql_fetch_array(mysql_query("select count(*) from status where pid='$pid' and result='Memory Limit Exceed'"));
list($nole)=mysql_fetch_array(mysql_query("select count(*) from status where pid='$pid' and result='Output Limit Exceed'"));
list($nrf)=mysql_fetch_array(mysql_query("select count(*) from status where pid='$pid' and result='Restricted Function'"));
list($ntot)=mysql_fetch_array(mysql_query("select count(*) from status where pid='$pid'"));
$not=$ntot-$nac-$nce-$nwa-$npe-$nre-$ntle-$nmle-$nole-$nrf;
$d = array(
new pie_value(intval($nac), "Accepted"),
new pie_value(intval($nce), "Compile Error"),
new pie_value(intval($nwa), "Wrong Answer"),
new pie_value(intval($npe), "Presentation Error"),
new pie_value(intval($nre), "Runtime Error"),
new pie_value(intval($ntle), "Time Limit Exceed"),
new pie_value(intval($nmle), "Memory Limit Exceed"),
new pie_value(intval($nole), "Output Limit Exceed"),
new pie_value(intval($nrf), "Restricted Function"),
new pie_value(intval($not), "Others")
);
$d[0]->on_click($ref."status.php?showpid=$pid&showres=Accepted");
$d[1]->on_click($ref."status.php?showpid=$pid&showres=Compile+Error");
$d[2]->on_click($ref."status.php?showpid=$pid&showres=Wrong+Answer");
$d[3]->on_click($ref."status.php?showpid=$pid&showres=Presentation+Error");
$d[4]->on_click($ref."status.php?showpid=$pid&showres=Runtime+Error");
$d[5]->on_click($ref."status.php?showpid=$pid&showres=Time+Limit+Exceed");
$d[6]->on_click($ref."status.php?showpid=$pid&showres=Memory+Limit+Exceed");
$d[7]->on_click($ref."status.php?showpid=$pid&showres=Output+Limit+Exceed");
$d[8]->on_click($ref."status.php?showpid=$pid&showres=Restricted+Function");
$pie = new pie();
$pie->alpha(0.5)
->add_animation( new pie_fade() )
->start_angle( 0 )
->tooltip( 'Num:#val# Percent:#percent#' )
->colours(array("#0060ff","#008347","#FF0000","#ffb128","#854242","#ff2400","#9400fc","#00959a","#000000","#00a8ff"))
->values( $d )
->radius(100);
$chart = new open_flash_chart();
//$chart->set_title( $title );
$chart->add_element( $pie );
$chart->set_bg_colour('#e6e9f2');
?>