<?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-announcement">
<h3><?php _e('Add/Edit Announcement', '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('Announcement Title', 'ulp');?></h4>
        <input type="text" class="ulp-form-control" name="post_title" 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('Announcement Content', 'ulp');?></h4>
        <textarea name="post_content" class="ulp-form-control" id="post_content" style="width: 90%; height: 200px;"><?php echo $data['post_data']['post_content'];?></textarea>
        </div>
   </div>
 </div>

 <div class="ulp-instructor-edit-line-break"></div>
 <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_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_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>
