<?php 

function view_upload_library_cb() {
	if(!isset($_GET['id'])) return_method("upload-libraries");
	$post = new post;
	$library_meta = $post->get_post_meta($_GET['id']);
	$files = (is_serialized($library_meta['files'])) ? unserialize($library_meta['files']) : array();
	$table = new table("library-files", $files);
	$table->set_display_columns([
		"sn" => "SN",
		"file_name" => "Preview",
		"size" => "File Size",
		"title" => "Title",
		"date_added" => "Date Added"
	]);
	$table->set_dynamic_columns([
		"file_name" => "_tf_get_file_preview",
		"size" => "_tf_get_file_size",
		"date_added" => "_tf_get_date"
	]);
	$table->set_notexport_columns(array("file_name"));
	// $table->set_action_links([
	// 	"View Library" => 'view-upload-library'
	// ]);
	// $table->set_action_access([
	// 	"View Library" => 'view_upload_library'
	// ]);
	// // $table->set_action_callback([
	// // 	"Delete Ticket" => "delete_support_ticket"
	// // ]);
	// $table->set_action_args([
	// 	"View Library" => ["id" => "id"],
	// ]);
	?>
	<div class="row">
		<div class="col-md-12">
			<div class="card card-primary">
				<div class="card-header">
					<h3>Files in <?php echo $library_meta['ref'] ?> library</h3>
				</div>
				<div class="card-body">
					<?php $table->display(); ?>
				</div>
			</div>
		</div>
	</div>
	<?php
}