LAPTOP-V9RRD1TL\Michelle's Computer f8f8fcaf96 first commit
2025-07-21 21:38:17 +08:00

88 lines
3.1 KiB
PHP

<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_sub.'header.php' ) ;
$html = '' ;
if ( $boolean_login ){
$status = '201' ;
$list = [] ;
if ( $array['iswebview'] == 'no' ){
$query = "SELECT a.file, a.created_at, b.title, b.content FROM profile_star a
LEFT JOIN profile_star_translation b ON ( a.star_id = b.star_id )
WHERE a.deleted_at IS NULL AND b.lang = '".$array['lang']."'" ;
$mysqli_query = $mysqli->query( $query ) ;
if ( $mysqli_query->num_rows > 0 ){
$status = '200' ;
$row = $mysqli_query->fetch_assoc() ;
$temp = [] ;
$temp['title'] = dataFilter( $row['title'] ) ;
$temp['content'] = dataFilter( $row['content'] ) ;
$temp['file'] = ( $row['file'] != '' ? PATH.'uploads/ProfileStar/b/'.$row['file'] : '' ) ;
$temp['created_at'] = resetDateFormat( $row['created_at'] ) ;
$list = $temp ;
}
$data['list'] = $list ;
}
// direct echo
if ( $array['iswebview'] == 'yes' ){
$get_monthly = getMonthlyAchievement( date('Y', time()), $staff_info['staff_id'] ) ;
$get_star[] = [ 'Month', 'Star' ] ;
foreach ( $get_monthly as $k => $v ){
$get_star[] = [ date('m', strtotime($v['reported_at'])), $v['staff_star'] ] ;
}
$html .= '
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<style> td{ padding: 5px; } </style>
</head>
<body>
<script type="text/javascript">
google.charts.load(\'current\', {\'packages\':[\'bar\']});
google.charts.setOnLoadCallback(drawStuff);
function drawStuff() {
var data = new google.visualization.arrayToDataTable( '.json_encode( $get_star ).' ) ;
var options = {
chart: { title: \'Yearly Star Report\' },
bars: \'vertical\'
} ;
var chart = new google.charts.Bar(document.getElementById(\'barchart\')) ;
chart.draw(data, options);
};
</script>
<div style="padding: 0 20px;">
<div id="barchart" style="width: 100%; height: 500px;"></div>
</div>
</body>
</html>' ;
}
}
if ( $array['iswebview'] == 'yes' ){
echo $html ;
exit ;
}
require( $require_sub.'footer.php' ) ;
?>