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

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

    $list            = [] ;

    $query           = "SELECT a.tier_id, a.file, a.created_at, b.title, b.sub, b.content FROM profile_tier a
                        LEFT JOIN profile_tier_translation b ON ( a.tier_id = b.tier_id )
                        WHERE a.deleted_at IS NULL AND b.lang = '".$array['lang']."' ORDER BY a.sortable ASC" ;
    $mysqli_query    = $mysqli->query( $query ) ;

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

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

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

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