<?php
wp_enqueue_script( 'ulp_ckeditor', ULP_URL . 'assets/js/ckeditor/ckeditor.js', [], false, false);
///croppic
wp_register_script('ulp_uploadFeatureImage', ULP_URL . 'assets/js/uploadFeatureImage.js', [], null);
wp_localize_script('ulp_uploadFeatureImage', 'ulp_plugin_url', ULP_URL);
wp_enqueue_script('ulp_mouse_wheel', ULP_URL . 'assets/js/jquery.mousewheel.min.js', array(), null);
wp_enqueue_script('ulp_croppic', ULP_URL . 'assets/js/croppic.js', array(), null);
wp_enqueue_script('ulp_uploadFeatureImage');
wp_enqueue_style('ulp_croppic', ULP_URL . 'assets/css/croppic.css', array(), null);
?>

<style>
#js_ulp_upload_image_trigger {
    width: 100%;
    height: 300px;
    position: relative;
}
</style>

<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-question">
<h2><?php _e('Add/Edit Question', 'ulp');?></h2>

<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-6">
    <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 Description', 'ulp');?></h4>
        <textarea name="post_content" id="post_content" class="ulp-form-control" style="width: 100%;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-12">
    <div class="ulp-form-section">
						<h4><?php _e('Categories', 'ulp');?></h4>
						<div class="ulp-instructor-categories-wrapper">
								<?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>
<div class="ulp-instructor-edit-line-break"></div>
<?php endif;?>

<!--div class="ulp-instructor-edit-row">
  <div class="ulp-inst-col-12">
    <div class="ulp-form-section">
         <h3  class="ulp-instructor-edit-top-title"><?php _e('Feature image', 'ulp');?></h3>

           <?php if (!empty($data['featureImage'])):?>
               		<div id="js_ulp_upload_image_trigger" class="ulp-upload-feat-image-wrapp ulp-edit-image">
	               <img src="<?php echo $data['featureImage'];?>" class="ulp-feat-img-old-pic"/>
                   </div>
	           <?php else:?>
               		<div id="js_ulp_upload_image_trigger" class="ulp-upload-feat-image-wrapp ulp-add-image"></div>
			   <?php endif;?>

        <input type="hidden" id="ulp_feat_image_input" name="ulp_feat_image_input" value="<?php echo $data['featureImage'];?>" />
    </div>
 </div>
</div -->

<div class="ulp-instructor-edit-line-break"></div>
<div class="ulp-instructor-edit-row">
  <div class="ulp-inst-col-12">
  <h3  class="ulp-instructor-edit-top-title ulp-instructor-edit-question-answers-section"><?php _e('Question Answer', 'ulp');?></h3>
  <div class="ulp-instructor-answers">
    <?php include ULP_PATH . 'views/templates/instructor_dashboard/questions_answer.php';?>
    </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>
