<?php 

function cp_add_objective_question_cb() {
	if(!isset($_GET['id'])) return_method();
	$post = new post;
	$quiz_meta = $post->get_post_meta($_GET['id']);
	$course_name = get_course_name($quiz_meta['course']);
	$class_name = get_class_name($quiz_meta['class']);
	$term_name = get_term_name($quiz_meta['term']);
	$term_meta = $post->get_post_meta($quiz_meta['term']);
	?>
	<div class="card" id="add-lesson-container">
        <div class="card-header">
            <span class="badge badge-warning pull"><?php echo $class_name ?></span></br><span class="badge badge-success"><?php echo $course_name ?></span>
        </div>
        <div class="card-body">
        
            <form id="add-lesson-form" method="post" action="contents/plugins/classroom_plus/ajax.php" data-clearform=1 data-callback="refreshPage">
                <input type="hidden" name="class" id="class" value="<?php echo $quiz_meta['class']; ?>">
                <input type="hidden" name="course" id="course" value="<?php echo $quiz_meta['course']; ?>">
                <input type="hidden" name="term" id="term" value="<?php echo $term_meta['order']; ?>">
                <input type="hidden" name="quiz[term]" id="q-term" value="<?php echo $quiz_meta['term']; ?>">
                <input type="hidden" name="quiz[id]" id="q-id" value="<?php echo $quiz_meta['id']; ?>">
                <input type="hidden" name="quiz[total_marks]" id="q-total_marks" value="<?php echo $quiz_meta['total_marks']; ?>">
                <div class="row">
                    <div class="col-md-12">
                    	<?php 
			                textarea(['label' => 'Question', 'id' => 'question', 'required' => 'required'], true);
			             ?>
                    </div>
                    <div class="col-sm-12">
                    	<?php 
							checkbox(['label' => 'Compulsory', 'id' => 'compulsory'], false);
                         ?>
                    </div>
                    <div class="col-md-12">
                    	<h3>Options</h3>
                    	<div class="table-responsive">
		      				<table class="table" id="items-table">
			      				<thead>
			      					<tr>
			      						<th></th>
			      						<th>Value</th>
			      						<th>ACTION</th>
			      					</tr>
			      				</thead>
			      				<tbody></tbody>
			      				<tfoot>
			      					<tr>
			      						<td></td>
			      						<td><textarea id="new-optionvalue" name="new[optionvalue]" class="form-control"></textarea></td>
			      						<td><button class="btn btn-primary" id="add-btn" disabled>Add</button></td>
			      					</tr>
			      				</tfoot>
			      			</table>
		      			</div>
		      			<?php submit_btn("add_objective_question") ?>
                    </div>
            </form>
                
        </div>
    </div>
    <?php
    global $post_meta;
    add_page_javascript('app/elements/form.js');
    add_page_javascript('app/assets/js/page-scripts/koweb.js');
  	add_page_javascript('app/assets/js/page-scripts/js-functions.js');
  	add_page_javascript('contents/plugins/classroom_plus/js/add-question.js');
  	add_page_javascript('app/assets/js/page-scripts/submit.js');
}