|
Server : Apache/2.4.41 (Ubuntu) System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 8.2.12 Disable Function : NONE Directory : /var/www/parasoffline.edukrypt.in/application/modules/admin/views/quiz/ |
Upload File : |
<?php
if(isset($message))
{
echo '<div class="alert alert-success" role="alert">'.$message.'</div>';
}
?>
<div class="row">
<div class="col-md-6">
<div class="box box-primary">
<?php
if( $this->session->flashdata('e_message') )
{
echo '<br />';
echo $this->session->flashdata('e_message');
}
?>
<div class="box-body">
<form action="<?php echo base_url('admin/quiz/pdf_upload'); ?>" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="course">Course</label>
<select required class="form-control" id="course" name="course">
<option value="">--select-course--</option>
<?php
foreach($course as $cs)
{
echo '<option value="'.$cs->id.'">'.$cs->course.'</option>';
}
?>
</select>
</div>
<div class="form-group">
<label for="subject">Subject</label>
<select required class="form-control" id="subject" name="subject">
<option value="">--select-subject--</option>
</select>
</div>
<div class="form-group">
<label for="chapter">Chapter</label>
<select class="form-control" required id="chapter" name="chapter">
<option value="">--select-chapter--</option>
</select>
</div>
<!-- <label for="file_name">Your File Name</label>
<div class="input-group">
<input name="file_name" id="file_name" type="text" class="form-control" placeholder="your file name" aria-describedby="basic-addon2">
<span class="input-group-addon" id="basic-addon2">_(SerialNo.)</span>
</div>
<br/> -->
<div class="form-group">
<label for="chapter">Upload Pdf List</label>
<input class="form-control" type="file" name="doc_id[]" accept=".pdf" multiple required />
<!-- <select class="form-control" required name="doc_id[]" id="mcq_id" multiple>
<option value="" disabled>--select-mcq--</option>
<?php
if( isset( $quiz ) && $quiz )
{
foreach( $quiz as $quiz2 )
{
?>
<option value="<?php echo $quiz2->id; ?>|<?php echo $quiz2->title; ?>"><?php echo $quiz2->title; ?></option>
<?php
}
}
?>
</select> -->
</div>
<br />
<!-- <div class="form-group">
<label for="upload_file">Upload File</label>
<input id="upload_file" accept=".enc" class="form-control" multiple required type="file" name="upload_file" />
</div> -->
<button type="submit" class="btn btn-primary">Submit</button>
<button type="reset" class="btn btn-danger">Reset</button>
</form>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
// $('#submit').click({
// alert("sdf");
// });
// $('form').bind('click', function (event) {
//
//event.preventDefault();// using this page stop being refreshing
//
// $.ajax({
// type: 'POST',
// url: '#',
// data: $('form').serialize(),
// success: function () {
// alert('form was submitted');
// }
// });
//
// });
//
$('body').on('change','#course',function(){
$.ajax({
type: "POST",
url: "<?php echo base_url('admin/lecture/get_subject'); ?>",
datatype: "html",
beforeSend: function() {
$('#response').fadeIn(100);
},
data : {
course_id : $(this).val()
},
success: function(data)
{
$('#response').fadeOut(100);
$('#subject').empty();
$('#subject').append('<option value="">--select-subject--</option>');
$('#subject').append(data);
$('#chapter').empty();
$('#chapter').append('<option value="">--select-chapter--</option>');
}
});
});
$('body').on('change','#subject',function(){
$.ajax({
type: "POST",
url: "<?php echo base_url('admin/lecture/get_chapter'); ?>",
datatype: "html",
beforeSend: function() {
$('#response').fadeIn(100);
},
data : {
subject_id : $(this).val()
},
success: function(data)
{
$('#response').fadeOut(100);
$('#chapter').empty();
$('#chapter').append('<option value="">--select-chapter--</option>');
$('#chapter').append(data);
}
});
});
$('body').on('change','#subject',function(){
$.ajax({
type: "POST",
url: "<?php echo base_url('admin/lecture/get_chapter'); ?>",
datatype: "html",
beforeSend: function() {
$('#response').fadeIn(100);
},
data : {
subject_id : $(this).val()
},
success: function(data)
{
$('#response').fadeOut(100);
$('#chapter').empty();
$('#chapter').append('<option value="">--select-chapter--</option>');
$('#chapter').append(data);
}
});
});
$('body').on('change','#chapter',function(){
var str = $( "#subject option:selected" ).text()+'_'+$( "#chapter option:selected" ).text();
$('#file_name').val(str.replace(/\s+/g, ''));
});
$('#upload_form').submit(function(e) {
e.preventDefault();
$.ajax({
type: 'POST',
url: '<?php echo base_url("admin/quiz/upload"); ?>',
data:{
chapter : $('#chapter').val(),
mcq_id : $('#mcq_id').val()
},
datatype: 'json',
beforeSend: function(){
$('#response').fadeIn(100);
},
complete: function(){
$('#response').fadeOut(1000);
},
success: function (data) {
if(data)
{
alert('Well done! You successfully Uploaded Files.');
}
else
{
alert('Try Again Plz!!!');
}
location.reload();
},
error: function(XHR, exception) {
console.log(XHR.responseText);
}
});
});
});
</script>