46 lines
1.5 KiB
PHP
46 lines
1.5 KiB
PHP
<?php
|
|
$must_login = true ;
|
|
$require_path = '../../../' ;
|
|
$require_sub = '../../' ;
|
|
require( $require_sub.'header.php' ) ;
|
|
|
|
if ( $boolean_login ){
|
|
$status = '201' ;
|
|
|
|
$join_filter = '' ;
|
|
$join_query = '' ;
|
|
$query_sortable = 'ORDER BY created_at DESC' ;
|
|
|
|
$search_query = '' ;
|
|
switch ( $array['filter'] ){
|
|
case 'myself' :
|
|
$search_query .= " AND staff_id = '".$staff_info['staff_id']."'" ;
|
|
break ;
|
|
case 'group' :
|
|
$search_query .= " AND branch_id = '".$array['branch_id']."' AND status = 'confirmed' AND category_id = '".$array['category_id']."'" ;
|
|
break ;
|
|
}
|
|
|
|
$query = "SELECT title, file, filetype, status, created_at FROM training_gallery
|
|
WHERE deleted_at IS NULL AND branch_id = '".$array['branch_id']."' " . $search_query ;
|
|
$mysqli_query = $mysqli->query( $query . " ".$query_sortable." LIMIT " . getLimit( $current ) ) ;
|
|
|
|
if ( $mysqli_query->num_rows > 0 ){
|
|
|
|
$status = '200' ;
|
|
|
|
$list = [] ;
|
|
while ( $row = $mysqli_query->fetch_assoc() ){
|
|
$row['date'] = resetDateFormat( $row['created_at'] ) ;
|
|
$row['time'] = resetTimeFormat( $row['created_at'] ) ;
|
|
$row['file'] = ( $row['file'] != '' ? PATH.'uploads/TrainingGallery/b/'.$row['file'] : '' ) ;
|
|
$list[] = $row ;
|
|
}
|
|
|
|
$data['list'] = $list ;
|
|
|
|
}
|
|
}
|
|
|
|
require( $require_sub.'footer.php' ) ;
|
|
?>
|