<?php
$must_login          = true ;
$require_path        = '../../../' ;
$require_sub         = '../../' ;
require( $require_sub.'header.php' ) ;

if ( $boolean_login ){
    $status          = '201' ;

    $list            = [] ;

    $query           = "SELECT a.code, a.file, a.created_at, b.title, b.content FROM profile_achievement a
                        LEFT JOIN profile_achievement_translation b ON ( a.achievement_id = b.achievement_id )
                        WHERE deleted_at IS NULL AND b.lang = '".$array['lang']."'" ;
    $mysqli_query    = $mysqli->query( $query ) ;

    if ( $mysqli_query->num_rows > 0 ){
        $status       = '200' ;

        while ( $row  = $mysqli_query->fetch_assoc() ){
            $temp               = [] ;
            $temp['code']       = dataFilter( $row['code'] ) ;
            $temp['title']      = dataFilter( $row['title'] ) ;
            $temp['content']    = dataFilter( $row['content'] ) ;
            $temp['file']       = ( $row['file'] != '' ? PATH.'uploads/ProfileAchievement/b/'.$row['file'] : '' ) ;
            $temp['created_at'] = resetDateFormat( $row['created_at'] ) ;
            $list[]             = $temp ;
        }
        
        
    }

    $data['list']  = $list ;
}

require( $require_sub.'footer.php' ) ;
?>