PluginProbe
School Management System – WPSchoolPress / 2.2.38
School Management System – WPSchoolPress v2.2.38
2.2.48 2.2.47 2.2.46 2.2.45 2.2.44 2.2.43 2.2.42 2.2.41 2.2.40 2.2.39 2.2.38 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 All 103 releases
wpschoolpress / includes / wpsp-viewMark.php

wpsp-viewMark.php in School Management System – WPSchoolPress 2.2.38, at includes/wpsp-viewMark.php

157 lines 7.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3 $class_id = sanitize_text_field($_POST['ClassID']);
4 $subject_id = intval($_POST['SubjectID']);
5 $exam_id = intval($_POST['ExamID']);
6 $error = '';
7
8 if( empty( $class_id ) ) {
9 $error .='<li>ClassID Missing!</li>';
10 } if( empty( $subject_id ) ) {
11 $error .='<li>SubjectID Missing!</li>';
12 } if( empty( $exam_id ) ) {
13 $error .='<li>ExamID Missing!</li>';
14 }
15 if(empty( $error ) && (wpsp_IsMarkEntered( $class_id, $subject_id, $exam_id ) ) ) {
16 $extra_tbl = $wpdb->prefix."wpsp_mark_fields";
17 $student_table = $wpdb->prefix."wpsp_student";
18 // $extra_fields = $wpdb->get_results("select * from $extra_tbl where subject_id='".esc_sql($subject_id)."'");
19 $extra_fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM $extra_tbl WHERE subject_id = %d",$subject_id));
20 $wpsp_marks = wpsp_GetMarks($class_id,$subject_id,$exam_id);
21 $wpsp_exmarks = wpsp_GetExMarks($subject_id,$exam_id);
22 if( isset($_POST['ClassID'] )) {
23 $class_id=sanitize_text_field($_POST['ClassID']);
24 $stl = [];
25 // $studentlists = $wpdb->get_results("select class_id, sid from $student_table");
26 $studentlists = $wpdb->get_results(
27 $wpdb->prepare("SELECT class_id, sid FROM $student_table")
28 );
29
30 foreach ($studentlists as $stu) {
31 if(is_numeric($stu->class_id) ){
32
33 if($stu->class_id == $class_id){
34 $stl[] = $stu->sid;
35 }
36 }
37 else{
38 $class_id_array = unserialize( $stu->class_id );
39 if(!empty($class_id_array)){
40 if(in_array($class_id, $class_id_array)){
41 $stl[] = $stu->sid;
42 }
43 }
44 }
45 }
46 }
47 $students_list = $extra_marks = array();
48 if (!empty($stl)) {
49 $stl = array_map('intval', $stl);
50 foreach ($stl as $id ) {
51 $id = esc_sql($id);
52 $q = $wpdb->prepare("SELECT s_rollno,wp_usr_id,s_fname,s_mname,s_lname FROM $student_table WHERE sid = %d",$id);
53 $class_students = $wpdb->get_results($q,ARRAY_A);
54 foreach($class_students as $cstud){
55 $students_list[$cstud['wp_usr_id']]=array('rollno'=>$cstud['s_rollno'],'name'=>$cstud['s_fname'].' '.$cstud['s_mname'].' '.$cstud['s_lname']);
56 }
57 }
58 }
59 foreach($wpsp_exmarks as $exmark){
60 $extra_marks[$exmark->student_id][$exmark->field_id]=$exmark->mark;
61 }
62 ?>
63 <div class="wpsp-col-md-12 wpsp-col-lg-12 wpsp-col-sm-12" id="marks-information">
64 <?php
65 $classTable = $wpdb->prefix.'wpsp_class';
66 // $className = $wpdb->get_var( "SELECT c_name FROM `$classTable` where cid='".esc_sql($class_id)."'" );
67 $className = $wpdb->get_var($wpdb->prepare("SELECT c_name FROM $classTable WHERE cid = %d",$class_id));
68 $subTable = $wpdb->prefix."wpsp_subject";
69 // $subName = $wpdb->get_var( "SELECT sub_name FROM `$subTable` where id='".esc_sql($subject_id)."'" );
70 $subName = $wpdb->get_var($wpdb->prepare("SELECT sub_name FROM $subTable WHERE id = %d",$subject_id));
71 $exTable = $wpdb->prefix.'wpsp_exam';
72 $examName = $wpdb->get_var( "SELECT e_name FROM `$exTable` where eid='".esc_sql($exam_id)."'" );
73 $subName = $wpdb->get_var($wpdb->prepare("SELECT e_name FROM $exTable WHERE eid = %s",$exam_id));
74 echo '<div class="wp-mark-info" style="display:none;">';
75 echo !empty( $className ) ? '<b>Class Name : </b>'.esc_html($className) : '';
76 echo !empty( $subName ) ? '<br><b>Subject Name : </b>'.esc_html($subName) : '';
77 echo !empty( $examName ) ? '<br><b>Exam Name : </b>'.esc_html($examName) : '';
78 echo '</div>';
79 ?>
80 <table class="wpsp-table wpsp-table-bordered table-striped table-responsive" id="wp-student-mark" style="width:100%">
81 <thead>
82 <tr>
83 <th width="10%" class="nosort">#</th>
84 <th><?php echo esc_html("RollNo.","wpschoolpress");?></th>
85 <th><?php echo esc_html("Name","wpschoolpress");?></th>
86 <th><?php echo esc_html("Mark","wpschoolpress");?></th>
87 <?php
88 if(!empty($extra_fields)){
89 foreach($extra_fields as $extf){?>
90 <th><?php echo esc_html($extf->field_text);?></th>
91 <?php }
92 } ?>
93 <th><?php echo esc_html("Remark","wpschoolpress");?></th>
94 </tr>
95 </thead>
96 <tbody>
97 <?php $sno=1; foreach($wpsp_marks as $mark){ //cho "<pre>";print_r($wpsp_marks);?>
98 <tr>
99 <td><?php echo esc_html($sno);?> </td>
100 <td> <?php echo isset( $students_list[$mark->student_id]['rollno'] ) ? esc_html($students_list[$mark->student_id]['rollno']) : '';?> </td>
101 <td> <?php echo isset( $students_list[$mark->student_id]['name'] ) ? esc_html($students_list[$mark->student_id]['name']) : '';?> </td>
102 <td><?php echo esc_html($mark->mark); ?> </td>
103 <?php if(!empty($extra_fields)){
104 foreach($extra_fields as $extf){?>
105 <td>
106 <?php echo isset( $extra_marks[$mark->student_id][$extf->field_id] ) ? esc_html($extra_marks[$mark->student_id][$extf->field_id]) : ''; ?> </td>
107 <?php }
108 } ?>
109 <td> <?php echo esc_html($mark->remarks); ?> </td>
110 </tr>
111 <?php $sno++; } ?>
112 </tbody>
113 </table>
114 </div>
115 <?php
116 $proversion = wpsp_check_pro_version();
117 $proclass = !$proversion['status'] && isset( $proversion['class'] )? $proversion['class'] : '';
118 $protitle = !$proversion['status'] && isset( $proversion['message'] )? $proversion['message'] : '';
119 $prodisable = !$proversion['status'] ? 'disabled="disabled"' : '';
120 ?>
121 <div class="wpsp-col-md-8 wpsp-col-md-offset-4">
122 <form id="ExportMarksForm" name="ExportMarks" method="POST">
123 <input type="hidden" name="ClassID" value="<?php echo esc_attr($class_id);?>">
124 <input type="hidden" name="SubjectID" value="<?php echo esc_attr($subject_id);?>">
125 <input type="hidden" name="ExamID" value="<?php echo esc_attr($exam_id);?>">
126 <input type="hidden" name="exportmarks" value="exportmarks">
127 <button type="button" class="wpsp-btn wpsp-btn-primary <?php echo esc_attr($proclass);?>" id="Exportmarksbutton" title="<?php echo esc_attr($protitle);?>" <?php echo esc_html($prodisable); ?>><i class="fa fa-download"></i> <?php echo esc_html("Export","wpschoolpress");?> </button>
128 <button type="button" class="wpsp-btn wpsp-btn-primary <?php echo esc_attr($proclass);?>" title="<?php echo esc_attr($protitle);?>" <?php echo esc_html($prodisable); ?> id="PrintMarks"><i class="fa fa-print"></i> <?php echo esc_html("Print","wpschoolpress");?> </button>
129 </form>
130 </div>
131 <?php
132 } else {
133 $error .="<li>Marks not yet entered!</li>";
134 ?>
135
136 <div class="wpsp-popupMain wpsp-popVisible" id="SuccessModal" style="display:block;">
137 <div class="wpsp-overlayer"></div>
138 <div class="wpsp-popBody wpsp-alert-body">
139 <div class="wpsp-popInner">
140 <a href="javascript:;" class="wpsp-closePopup"></a>
141 <div class="wpsp-popup-cont wpsp-alertbox wpsp-alert-danger">
142 <div class="wpsp-alert-icon-box">
143 <!-- <i class="icon wpsp-icon-tick-mark"></i> -->
144 <i class="icon wpsp-icon-question-mark"></i>
145 </div>
146 <div class="wpsp-alert-data">
147 <!-- <input type="hidden" name="teacherid" id="teacherid"> -->
148 <h4><?php echo esc_html( 'Error', 'wpschoolpress' ); ?></h4>
149 <p><?php echo wp_kses_post( $error); ?></p>
150 </div>
151 </div>
152 </div>
153 </div>
154 </div>
155
156 <?php }?>
157