42 lines
1.6 KiB
PHP
42 lines
1.6 KiB
PHP
<?php
|
|
$must_login = true ;
|
|
$require_path = '../../../' ;
|
|
$require_sub = '../../' ;
|
|
require( $require_sub.'header.php' ) ;
|
|
|
|
if ( $boolean_login ){
|
|
$status = '201' ;
|
|
|
|
$search_query = '' ;
|
|
if ( $array['category_id'] != '' ){
|
|
$search_query .= " AND a.category_id = '".$array['category_id']."'" ;
|
|
}
|
|
if ( $array['search'] != '' ){
|
|
$search_query .= " AND b.title LIKE '%".$array['search']."%'" ;
|
|
}
|
|
|
|
$query = "SELECT a.handbook_id, 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 . " ORDER BY a.sortable ASC, a.created_at DESC LIMIT " . getLimit( $current ) ) ;
|
|
|
|
if ( $mysqli_query->num_rows > 0 ){
|
|
|
|
$status = '200' ;
|
|
|
|
$list = [] ;
|
|
while ( $row = $mysqli_query->fetch_assoc() ){
|
|
$row['id'] = dataFilter( $row['handbook_id'] ) ;
|
|
$row['title'] = dataFilter( $row['title'] ) ;
|
|
$row['file'] = ( $row['file'] != '' ? PATH.'uploads/Handbook/b/'.$row['file'] : '' ) ;
|
|
$row['created_at'] = resetDateFormat( $row['created_at'] ) ;
|
|
$list[] = $row ;
|
|
}
|
|
|
|
$data['list'] = $list ;
|
|
|
|
}
|
|
}
|
|
|
|
require( $require_sub.'footer.php' ) ;
|
|
?>
|