| 1 |
<?php |
| 2 |
/** =====================( Features Details )====================== |
| 3 |
|
| 4 |
# Educare Marksheed Systems |
| 5 |
|
| 6 |
* Using this features admin (teacher) can add subject wise multiple student results at a same time. So, it's most usefull for (single) teacher. There are different teachers for each subject. Teachers can add marks for their specific subject using this feature. And can print all student marks as a marksheet. After, the mark addition is done for all the subjects, students can view and print their results when admin publish it as results. Also, teacher can publish single subject results. (We call it - THE GOLDEN FEATURES FOR TEACHER!). |
| 7 |
|
| 8 |
* @since 1.2.4 |
| 9 |
* @last-update 1.2.4 |
| 10 |
|
| 11 |
===================( Features for Marksheed )=================== **/ |
| 12 |
|
| 13 |
if (educare_database_check('educare_marks')) { |
| 14 |
educare_database_table('educare_marks'); |
| 15 |
} |
| 16 |
|
| 17 |
?> |
| 18 |
|
| 19 |
<div class="educare_post imoport"> |
| 20 |
<h1>Add Marks</h1> |
| 21 |
<?php |
| 22 |
echo educare_guide_for("Using this features admin (teacher) can add subject wise multiple student results at a same time. So, it's most usefull for (single) teacher. There are different teachers for each subject. Teachers can add marks for their specific subject using this feature. And can print all student marks as a marksheet. After, the mark addition is done for all the subjects, students can view and print their results when admin publish it as results. Also, teacher can publish single subject results. (We call it - <b>THE GOLDEN FEATURES FOR TEACHER!</b>)"); |
| 23 |
?> |
| 24 |
|
| 25 |
<?php |
| 26 |
if (isset($_POST['students_list'])) { |
| 27 |
$Class = sanitize_text_field($_POST['Class']); |
| 28 |
$Exam = sanitize_text_field($_POST['Exam']); |
| 29 |
$Subject = sanitize_text_field($_POST['Subject']); |
| 30 |
$Year = sanitize_text_field($_POST['Year']); |
| 31 |
} |
| 32 |
?> |
| 33 |
|
| 34 |
<form method='post' action="" class="add_results"> |
| 35 |
<div class="content"> |
| 36 |
<div class="select"> |
| 37 |
<select id="Class" name="Class" class="form-control"> |
| 38 |
<option value="">Select Class</option> |
| 39 |
<?php educare_get_options('Class', $Class);?> |
| 40 |
</select> |
| 41 |
|
| 42 |
<select id="Exam" name="Exam" class="form-control"> |
| 43 |
<?php educare_get_options('Exam', $Exam);?> |
| 44 |
</select> |
| 45 |
</div> |
| 46 |
|
| 47 |
<div class="select"> |
| 48 |
<select id="Subject" name="Subject" class="form-control"> |
| 49 |
<option value="">Select Subject</option> |
| 50 |
</select> |
| 51 |
|
| 52 |
<select id="Year" name="Year" class="form-control"> |
| 53 |
<?php educare_get_options('Year', $Year);?> |
| 54 |
</select> |
| 55 |
</div> |
| 56 |
|
| 57 |
<p>Students Per Page: <input id="student_per_page" type="number" value="30"></p> |
| 58 |
|
| 59 |
<input type="submit" name="students_list" class="educare_button" value="Students List"> |
| 60 |
</div> |
| 61 |
</form> |
| 62 |
|
| 63 |
<div id="msgs"></div> |
| 64 |
|
| 65 |
</div> |
| 66 |
|
| 67 |
<script type="text/javascript"> |
| 68 |
$(document).on("change", "#Class", function(event) { |
| 69 |
event.preventDefault(); |
| 70 |
var current = $(this); |
| 71 |
var form_data = $(this).parents('form').serialize(); |
| 72 |
var action_for = $(this).attr("name"); |
| 73 |
$.ajax({ |
| 74 |
url: "<?php echo esc_url(admin_url('admin-ajax.php')); ?>", |
| 75 |
data: { |
| 76 |
action: 'educare_process_marks', |
| 77 |
form_data: form_data, |
| 78 |
action_for: 'get_subject' |
| 79 |
}, |
| 80 |
type: 'POST', |
| 81 |
beforeSend: function(data) { |
| 82 |
$('#Subject').html('<option value="">Loading Subject</option>'); |
| 83 |
}, |
| 84 |
success: function(data) { |
| 85 |
if ($.trim(data)) { |
| 86 |
$('#Subject').html(data); |
| 87 |
} else { |
| 88 |
$('#Subject').html('<option value="">Subject Not Found</option>'); |
| 89 |
} |
| 90 |
}, |
| 91 |
error: function(data) { |
| 92 |
$('#Subject').html('<option value="">Loading Error</option>'); |
| 93 |
}, |
| 94 |
complete: function() { |
| 95 |
// do some |
| 96 |
}, |
| 97 |
}); |
| 98 |
}); |
| 99 |
|
| 100 |
$(document).on("click", "[type=submit]", function(event) { |
| 101 |
event.preventDefault(); |
| 102 |
var current = $(this); |
| 103 |
var form_data = $(this).parents('form').serialize(); |
| 104 |
var action_for = $(this).attr("name"); |
| 105 |
$.ajax({ |
| 106 |
url: "<?php echo esc_url(admin_url('admin-ajax.php')); ?>", |
| 107 |
data: { |
| 108 |
action: 'educare_process_marks', |
| 109 |
form_data: form_data, |
| 110 |
action_for |
| 111 |
}, |
| 112 |
type: 'POST', |
| 113 |
success: function(data) { |
| 114 |
$('#msgs').html(data); |
| 115 |
}, |
| 116 |
error: function(data) { |
| 117 |
$('#msgs').html("<?php echo educare_guide_for('db_error')?>"); |
| 118 |
}, |
| 119 |
complete: function() { |
| 120 |
// event.remove(); |
| 121 |
}, |
| 122 |
}); |
| 123 |
}); |
| 124 |
|
| 125 |
$(document).on("click", ".notice-dismiss", function(event) { |
| 126 |
event.preventDefault(); |
| 127 |
$(this).parent('div').fadeOut(); |
| 128 |
$('#update_button').fadeIn(); |
| 129 |
}); |
| 130 |
|
| 131 |
$(document).on("click", "#print", function(event) { |
| 132 |
event.preventDefault(); |
| 133 |
|
| 134 |
var content = $('.educare_print').html(); |
| 135 |
var headerContent = '<style>body {padding: 4%;} .view_results {width: 100%;} th:nth-child(2), td:nth-child(2), button {display: none;} thead {background-color: #00ac4e !important; color: white !important; -webkit-print-color-adjust: exact;} table, td, th {border: 1px solid black; text-align: left; padding: 8px; border-collapse: collapse;} input {border: none;}</style>'; |
| 136 |
var realContent = document.body.innerHTML; |
| 137 |
var mywindow = window.open(); |
| 138 |
mywindow.document.write(headerContent + content); |
| 139 |
mywindow.document.title = "Marksheed"; |
| 140 |
mywindow.document.close(); // necessary for IE >= 10 |
| 141 |
mywindow.focus(); // necessary for IE >= 10*/ |
| 142 |
mywindow.print(); |
| 143 |
document.body.innerHTML = realContent; |
| 144 |
mywindow.close(); |
| 145 |
return true; |
| 146 |
}); |
| 147 |
|
| 148 |
$(document).on("click", ".notice-dismiss", function(event) { |
| 149 |
$(this).parent('div').fadeOut(); |
| 150 |
$('#update_button').fadeIn(); |
| 151 |
}); |
| 152 |
|
| 153 |
</script> |
| 154 |
|
| 155 |
|