<?php wp_enqueue_script( 'ulp_comments_box', ULP_URL . 'assets/js/comments_box.js', [], false, false );?>
<?php wp_enqueue_script( 'ulp_ckeditor', ULP_URL . 'assets/js/ckeditor/ckeditor.js', [], false, false);?>

<script>
  var CKEDITOR_BASEPATH = '<?php echo ULP_URL . 'assets/js/ckeditor/';?>';
  jQuery(document).ready(function(){
      CKEDITOR.replace( 'post_content' )
  })
</script>

<div class="ulp-instructor-edit ulp-instructor-edit-qanda">
<h3><?php _e('Add/Edit Question', 'ulp');?></h3>

<form action="<?php echo $data['saveLink'];?>" method="post">
		<input type="hidden" name="ID" value="<?php echo @$data['post_data']['ID'];?>" />
        <div class="ulp-instructor-edit-row">
  	<div class="ulp-inst-col-12">
    <div class="ulp-form-section">
        <h4><?php _e('Question Title', 'ulp');?></h4>
        <input type="text" name="post_title"  class="ulp-form-control" value="<?php echo $data['post_data']['post_title'];?>" />
 </div>
   </div>
 </div>
 <div class="ulp-instructor-edit-line-break"></div>
<div class="ulp-instructor-edit-row">
  	<div class="ulp-inst-col-4">
    <div class="ulp-form-section">
				<h4><?php _e('Privacy', 'ulp');?></h4>
				<select name="post_status" class="ulp-form-control" >
						<?php if ($data['is_senior'] || $data['post_data']['post_status']=='publish'):?>
						<option value="publish" <?php echo $data['post_data']['post_status']=='publish' ? 'selected' : '';?> ><?php _e('Publish', 'ulp');?></option>
						<?php endif;?>
						<option value="pending" <?php echo $data['post_data']['post_status']=='pending' ? 'selected' : '';?> ><?php _e('Pending', 'ulp');?></option>
						<option value="draft" <?php echo $data['post_data']['post_status']=='draft' ? 'selected' : '';?> ><?php _e('Draft', 'ulp');?></option>
				</select>
 </div>
   </div>
 </div>
 <div class="ulp-instructor-edit-line-break"></div>

  <div class="ulp-instructor-edit-row">
  	<div class="ulp-inst-col-12">
    <div class="ulp-form-section">
        <h4><?php _e('Question Content', 'ulp');?></h4>
        <textarea name="post_content" id="post_content"  class="ulp-form-control" style="width: 90%; height: 200px;"><?php echo $data['post_data']['post_content'];?></textarea>
            </div>
   </div>
 </div>

 <div class="ulp-instructor-edit-line-break"></div>

		<?php if ($data['categories']):?>

		 <div class="ulp-instructor-edit-row">
  	<div class="ulp-inst-col-5">
    <div class="ulp-form-section">
						<label><?php _e('Categories', 'ulp');?></label>
								<?php foreach ($data['categories'] as $category):?>
										<?php $checked = in_array($category->term_id, $data['post_cats']) ? 'checked' : '';?>
										<div class="ulp-instructor-multiple-choice">
												<input type="checkbox" name="categories[]" value="<?php echo $category->term_id;?>" <?php echo $checked;?> /> <?php echo $category->name;?>
										</div>
								<?php endforeach;?>

            </div>
   </div>
 </div>

 <div class="ulp-instructor-edit-line-break"></div>
		<?php endif;?>

 <div class="ulp-instructor-edit-row">
  	<div class="ulp-inst-col-5">
    <div class="ulp-form-section">
        <h4><?php _e('Course assignation', 'ulp');?></h4>
        <select name="ulp_qanda_course_id" class="ulp-form-control">
            <?php foreach ($data['courses'] as $courseObject):?>
                <option value="<?php echo $courseObject->post_id;?>" <?php if ($courseObject->post_id==$data['ulp_qanda_course_id']) echo 'selected';?> ><?php echo $courseObject->post_title;?></option>
            <?php endforeach;?>
        </select>
    	</div>
   </div>
 </div>
  <div class="ulp-instructor-edit-line-break"></div>
 <div class="ulp-instructor-edit-row">
  	<div class="ulp-inst-col-12">
    <div class="ulp-form-section">
		<?php if ($data['commentsBox']):?>
				<?php echo $data['commentsBox'];?>
		<?php endif;?>
	</div>
   </div>
 </div>
 <div class="ulp-instructor-edit-line-break"></div>
 <div class="ulp-instructor-edit-row">
  	<div class="ulp-inst-col-12">
    <div class="ulp-form-section">
        <input type="submit" name="submit" value="<?php _e('Save Changes', 'ulp');?>" class="btn btn-primary pointer ulp-submit-button" />
   </div>
 </div>
 </div>
</form>
</div>
