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

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

	$search_query      = '' ;
	if ( $array['search'] != '' ){
        $search_query .= " AND documentation_subject LIKE '%".$array['search']."%'" ;
    }

    $query        = "SELECT documentation_id, documentation_format, documentation_subject, documentation_message, documentation_video, documentation_file_type, documentation_file, created_at FROM documentation
                     WHERE deleted_at IS NULL AND staff_id LIKE '%(".$staff_info['staff_id'].")%' " . $search_query ;
    $mysqli_query = $mysqli->query( $query . " ORDER BY created_at DESC LIMIT " . getLimit( $current) ) ;
    if ( $mysqli_query->num_rows > 0 ){

        $status        = '1' ;
        $message       = 'Success.' ;

        $list  = [] ;
        while ( $row = $mysqli_query->fetch_assoc() ){
            $row['documentation_message'] = html_entity_decode( stripslashes( $row['documentation_message'] ) ) ;
            $list[] = $row ;
        }
        $data = [
            'list' => [
                "current_page"  => $current,
                "data"          => $list,
                "from"          => '',
                "last_page"     => $pagination['last_page'],
                "next_page_url" => '',
                "path"          => '',
                "per_page"      => $limit,
                "prev_page_url" => '',
                "to"            => '',
                "total"         => $pagination['total']
            ],
            'file_path' => PATH.'uploads/Documentation/'
        ] ;

    }
}

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