first commit
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../../' ;
|
||||
$require_sub = '../../' ;
|
||||
require( $require_path.'MPDF/mpdf.php' ) ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
if ( $boolean_login ){
|
||||
$status = '201' ;
|
||||
|
||||
$id = $array['id'] ;
|
||||
|
||||
$search_query = '' ;
|
||||
$search_query .= " AND a.announcement_id = '".$id."'" ;
|
||||
|
||||
$query = "SELECT a.announcement_id, a.file, a.is_showagree, a.created_at, b.title, b.content FROM announcement a
|
||||
LEFT JOIN announcement_translation b ON ( a.announcement_id = b.announcement_id )
|
||||
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' ;
|
||||
|
||||
$row = $mysqli_query->fetch_assoc() ;
|
||||
$content = dataFilter( $row['content'] ) ;
|
||||
$file = ( $row['file'] != '' ? PATH.'uploads/Announcement/b/'.$row['file'] : '' ) ;
|
||||
|
||||
// check if agree or not
|
||||
$is_agreed = 'no' ;
|
||||
$select_agree = $mysqli->query( "SELECT * FROM staff_announcement
|
||||
WHERE deleted_at IS NULL AND announcement_id = '".$array['id']."' AND staff_id = '".$staff_info['staff_id']."' LIMIT 1" ) ;
|
||||
if ( $select_agree->num_rows > 0 ){
|
||||
$is_agreed = 'yes' ;
|
||||
}
|
||||
|
||||
|
||||
$filename = 'pdfs/announcement-'.strPad( 3, $id ).'.pdf' ;
|
||||
$filename_save = $require_path . $filename ;
|
||||
$filename_source = PATH . $filename ;
|
||||
$header = '' ;
|
||||
$footer = '' ;
|
||||
$html = mergeImageWithContent( $file, $content ) ;
|
||||
|
||||
$mpdf = new mPDF( 'utf-8', 'A4', '', 'freesans', 15, 15, 15, 15, 5, 5 ) ;
|
||||
$mpdf->mirrorMargins = 1 ;
|
||||
$mpdf->useAdobeCJK = true ;
|
||||
$mpdf->SetHTMLHeader( $header ) ;
|
||||
$mpdf->SetHTMLHeader( $header,'E' ) ;
|
||||
$mpdf->SetHTMLFooter( $footer ) ;
|
||||
$mpdf->SetHTMLFooter( $footer,'E' ) ;
|
||||
$mpdf->WriteHTML( $html ) ;
|
||||
$mpdf->Output( $filename_save, 'F' ) ;
|
||||
|
||||
|
||||
$row['id'] = dataFilter( $row['announcement_id'] ) ;
|
||||
$row['title'] = dataFilter( $row['title'] ) ;
|
||||
$row['content'] = $content ;
|
||||
$row['file'] = $file ;
|
||||
$row['created_at'] = dataFilter( $row['created_at'] ) ;
|
||||
$row['is_agreed'] = $is_agreed ;
|
||||
$row['source'] = $filename_source ;
|
||||
|
||||
$data['list'] = $row ;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
Reference in New Issue
Block a user