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

54 lines
2.2 KiB
PHP

<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_sub.'header.php' ) ;
if ( $boolean_login ){
$status = '201' ;
$search_query = '' ;
$search_query .= " AND a.handbook_id = '".$array['id']."'" ;
$query = "SELECT a.handbook_id, a.content, a.view_format, a.file, a.file_type, a.video_url, a.is_showagree, a.created_at, b.title FROM handbook a
LEFT JOIN handbook_translation b ON ( a.handbook_id = b.handbook_id )
WHERE a.deleted_at IS NULL AND b.lang = '".$array['lang']."' AND a.branch LIKE '%/".$array['branch_id']."/%' AND ( ( a.receiver_type IN ( '0' ) ) OR ( a.receiver_type IN ( '1', '2' ) AND a.staff_id LIKE '%/".$staff_info['staff_id']."/%' ) ) " . $search_query ;
$mysqli_query = $mysqli->query( $query ) ;
if ( $mysqli_query->num_rows > 0 ){
$status = '200' ;
$row = $mysqli_query->fetch_assoc() ;
$file = '' ;
if ( $row['file'] != '' ){
if ( $row['file_type'] == 'pdf' ){
$file = PATH.'uploads/Handbook/'.$row['file'] ;
}else{
$file = PATH.'uploads/Handbook/b/'.$row['file'] ;
}
}
// check if agree or not
$is_agreed = 'no' ;
$select_agree = $mysqli->query( "SELECT * FROM staff_handbook
WHERE deleted_at IS NULL AND handbook_id = '".$array['id']."' AND staff_id = '".$staff_info['staff_id']."' LIMIT 1" ) ;
if ( $select_agree->num_rows > 0 ){
$is_agreed = 'yes' ;
}
$row['id'] = dataFilter( $row['handbook_id'] ) ;
$row['title'] = dataFilter( $row['title'] ) ;
$row['content'] = dataFilter( $row['content'] ) ;
$row['file'] = $file ;
$row['created_at'] = dataFilter( $row['created_at'] ) ;
$row['is_agreed'] = $is_agreed ;
$data['list'] = $row ;
}
}
require( $require_sub.'footer.php' ) ;
?>