<?php 

function cp_edit_material_cb() {
	if(!isset($_GET['id'])) return_method();
	$post = new post;
	$material = $post->get_post_meta($_GET['id']);
	do_action("drag_n_drop_uploader", [
        "ref" => $material['ref'],
        "accepts" => "application/pdf, image/*",
        "id" => "cp_upload_material"
    ]);
	?>
	<form id="lesson-material-form" action="contents/plugins/classroom_plus/ajax.php" data-callback="refreshPage">
		<input type="hidden" name="ref" value="<?php echo $material['ref']; ?>" id="ref">
		<input type="hidden" name="id" value="<?php echo $material['id']; ?>" id="id">
		<?php 
			input(['label' => 'Title', 'id' => 'material-title', 'required' => 'required', 'value' => $material['material-title']]);
			textarea(['label' => 'Description(Optional)', 'id' => 'material-description', 'value' => $material['material-description']]);
			submit_btn("edit_lesson_material", "Update");
		 ?>
	</form>
	<?php
	global $post_meta;
	add_page_javascript('app/assets/js/page-scripts/js-functions.js');
	add_page_javascript('app/assets/js/page-scripts/submit.js');
}