60 lines
3.2 KiB
PHP
60 lines
3.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.association_id = '".$array['id']."'" ;
|
|
|
|
$join_filter = "" ;
|
|
$join_query = "" ;
|
|
if ( $array['mode'] == 'view' ){
|
|
$join_filter .= ", c.association_so, c.status as association_status, c.remark as association_remark, c.rated as association_rated, c.comment as association_comment" ;
|
|
$join_query .= " LEFT JOIN staff_association c ON ( a.association_id = c.association_id )" ;
|
|
$search_query .= " AND c.view_id = '".$array['view_id']."' AND c.staff_id = '".$staff_info['staff_id']."'" ;
|
|
}
|
|
|
|
$query = "SELECT a.association_id, a.association_type, a.date_start, a.date_end, a.file, a.status, a.created_at, b.title, b.content ".$join_filter." FROM association a
|
|
LEFT JOIN association_translation b ON ( a.association_id = b.association_id )
|
|
".$join_query."
|
|
WHERE a.deleted_at IS NULL AND b.lang = '".$array['lang']."' " . $search_query ;
|
|
$mysqli_query = $mysqli->query( $query ) ;
|
|
|
|
if ( $mysqli_query->num_rows > 0 ){
|
|
$status = '200' ;
|
|
|
|
$generatecode = generateQrcode( '', $row['association_so'], $row['association_so'] ) ;
|
|
|
|
$row = $mysqli_query->fetch_assoc() ;
|
|
$row['id'] = dataFilter( $row['association_id'] ) ;
|
|
$row['sonumber'] = dataFilter( $row['association_so'] ) ;
|
|
$row['qrcode'] = $generatecode['url'] ;
|
|
$row['title'] = dataFilter( $row['title'] ) ;
|
|
$row['content'] = dataFilter( $row['content'] ) ;
|
|
$row['file'] = ( $row['file'] != '' ? PATH.'uploads/Association/b/'.$row['file'] : '' ) ;
|
|
|
|
$is_association = 'no' ;
|
|
if ( $row['status'] == 'active' ){
|
|
if ( $row['association_type'] == 'all' || ( $row['association_type'] == 'date' && $row['date_start'] <= TODAYDAY && $row['date_end'] >= TODAYDAY ) ){
|
|
$is_association = 'yes' ;
|
|
}
|
|
}
|
|
$row['is_association'] = $is_association ;
|
|
$row['date_start'] = resetDateFormat( $row['date_start'] ) ;
|
|
$row['date_end'] = resetDateFormat( $row['date_end'] ) ;
|
|
$row['created_at'] = resetDateFormat( $row['created_at'] ) ;
|
|
$row['association_status'] = ( checkExists( $row['association_status'] ) != '' ? $row['association_status'] : '') ;
|
|
$row['association_remark'] = dataFilter( checkExists( $row['association_remark'] ) != '' ? $row['association_remark'] : '') ;
|
|
$row['association_rated'] = dataFilter( checkExists( $row['association_rated'] ) != '' ? $row['association_rated'] : 0) ;
|
|
$row['association_comment'] = dataFilter( checkExists( $row['association_comment'] ) != '' ? $row['association_comment'] : '') ;
|
|
|
|
$data['list'] = $row ;
|
|
}
|
|
}
|
|
|
|
require( $require_sub.'footer.php' ) ;
|
|
?>
|