forked from hznuoj-dev/hznuoj
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
609 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
|
||
<?php | ||
require_once('./include/db_info.inc.php'); | ||
|
||
|
||
$current_year = date("Y"); | ||
|
||
$sql = "SELECT * FROM dailydetails"; | ||
$res = $mysqli->query($sql); | ||
$row = $res->fetch_assoc(); | ||
|
||
$lastday = date("Y-m-d", strtotime($row['start_time'])); | ||
$today = date("Y-m-d", strtotime($row['end_time'])); | ||
?> | ||
|
||
<?php | ||
if ($_GET['user']) $user = $_GET['user']; | ||
else $user = $_POST['daliy_detail']; | ||
if (!is_valid_user_name($user)) { | ||
echo "No such User!"; | ||
exit(0); | ||
} | ||
$user_mysql = $mysqli->real_escape_string($user); | ||
|
||
// 获取热力图相关数据 | ||
$sql = "SELECT MIN(judgetime) as actime | ||
FROM solution | ||
WHERE user_id = '$user_mysql' AND result = 4 | ||
GROUP BY problem_id;"; | ||
$result = $mysqli->query($sql); | ||
|
||
$daliy_detail_data = array(); | ||
if ($result->num_rows > 0) { | ||
// 输出每行数据 | ||
while ($row = $result->fetch_assoc()) { | ||
$daliy_detail_data[] = $row["actime"]; | ||
} | ||
} | ||
|
||
$daliy_detail_data_json = json_encode($daliy_detail_data); | ||
$result->free(); | ||
|
||
|
||
|
||
/////////////////////////Template | ||
require("template/".$OJ_TEMPLATE."/daliy_detail.php"); | ||
/////////////////////////Common foot | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php $title = "Study Detail"; ?> | ||
<?php | ||
require_once('./include/db_info.inc.php'); | ||
|
||
require_once("study_detail_data.php"); | ||
?> | ||
|
||
<?php | ||
$user = $_GET['user']; | ||
if (!is_valid_user_name($user)) { | ||
echo "No such User!"; | ||
exit(0); | ||
} | ||
|
||
$studydata = array(); | ||
$studydata = array_fill_keys($studytags, 0); | ||
//studydata['xx']=0; | ||
|
||
$sql = "SELECT pt.tag, COUNT(DISTINCT s.problem_id) as count | ||
FROM solution s | ||
JOIN problem_tag pt ON s.problem_id = pt.problem_id | ||
WHERE s.user_id = '$user' AND s.result = 4 AND pt.tag IN ('" . implode("', '", $studytags) . "') | ||
GROUP BY pt.tag;"; | ||
$result = $mysqli->query($sql); | ||
|
||
while ($row = $result->fetch_assoc()) { | ||
$studydata[$row['tag']] = $row['count']; | ||
} | ||
|
||
$result->free(); | ||
|
||
///////////////////////////////////////////////////////////////////////////////cs | ||
// if($user == "admin") | ||
// foreach ($studytags as $tag) | ||
// $studydata[$tag] = 1; | ||
|
||
///////////////////////////////////////////////////////////////////////////////cs | ||
|
||
//此处修改层次颜色 | ||
$pointcolor = ['#e5e5e5', '#d0f0c0', '#aadf8f', '#85c96e']; | ||
|
||
$neednum = array(); | ||
$neednum = array_fill_keys($studytags, [0, 1, 2, 4]); | ||
//neednum['xx'] = [0, 1, 2, 4]; | ||
|
||
|
||
foreach ($studytags3 as $tag) { | ||
$studydata[$tagfa[$tag]] = 0; | ||
$neednum[$tagfa[$tag]] = [0, 0, 0, 0]; | ||
} | ||
foreach ($studytags2 as $tag) { | ||
$studydata[$tagfa[$tag]] = 0; | ||
$neednum[$tagfa[$tag]] = [0, 0, 0, 0]; | ||
} | ||
|
||
foreach ($studytags3 as $tag) { | ||
$studydata[$tagfa[$tag]] += $studydata[$tag]; | ||
$counts = $neednum[$tag]; | ||
for ($i = 0; $i < count($counts); $i++) { | ||
$neednum[$tagfa[$tag]][$i] += $counts[$i]; | ||
} | ||
} | ||
foreach ($studytags2 as $tag) { | ||
$studydata[$tagfa[$tag]] += $studydata[$tag]; | ||
$counts = $neednum[$tag]; | ||
for ($i = 0; $i < count($counts); $i++) { | ||
$neednum[$tagfa[$tag]][$i] += $counts[$i]; | ||
} | ||
} | ||
|
||
|
||
$nowcolor = array(); | ||
|
||
foreach ($studytags as $tag) { | ||
for ($i = 3; $i >= 0; $i--) { | ||
if ($studydata[$tag] >= $neednum[$tag][$i]) { | ||
$nowcolor[$tag] = $pointcolor[$i]; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
|
||
/////////////////////////Template | ||
require("template/" . $OJ_TEMPLATE . "/study_detail.php"); | ||
/////////////////////////Common foot | ||
|
||
?> |
Oops, something went wrong.