PluginProbe
School Management System – WPSchoolPress / 2.2.43
School Management System – WPSchoolPress v2.2.43
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-studentList.php

wpsp-studentList.php in School Management System – WPSchoolPress 2.2.43, at includes/wpsp-studentList.php

310 lines 17.8 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('No Such File');
3 $proversion = wpsp_check_pro_version();
4 $proclass = !$proversion['status'] && isset( $proversion['class'] )? $proversion['class'] : '';
5 $protitle = !$proversion['status'] && isset( $proversion['message'] )? $proversion['message'] : '';
6 $prodisable = !$proversion['status'] ? 'disabled="disabled"' : '';
7 $studentFieldList = array( 's_rollno' => __('Roll Number', 'wpschoolpress'),
8 's_fname' => __('Student First Name', 'wpschoolpress'),
9 's_mname' => __('Student Middle Name', 'wpschoolpress'),
10 's_lname' => __('Student Last Name', 'wpschoolpress'),
11 's_zipcode' => __('Zip Code', 'wpschoolpress'),
12 's_country' => __('Country', 'wpschoolpress'),
13 's_gender' => __('Gender', 'wpschoolpress'),
14 's_address' => __('Current Address', 'wpschoolpress'),
15 's_paddress' => __('Permanent Address', 'wpschoolpress'),
16 'p_fname ' => __('Parent First Name', 'wpschoolpress'),
17 's_bloodgrp' => __('Blood Group', 'wpschoolpress'),
18 's_dob' => __('Date Of Birth', 'wpschoolpress'),
19 's_doj' => __('Date Of Join', 'wpschoolpress'),
20 's_phone' => __('Phone Number', 'wpschoolpress'),
21 );
22 $teacherId = 0;
23 global $current_user;
24 $role = $current_user->roles;
25 $cuserId = $current_user->ID;
26 $proversion1 = wpsp_check_pro_version('wpsp_addon_version');
27 $prodisable1 = !$proversion1['status'] ? 'notinstalled' : 'installed';
28 $propayment = wpsp_check_pro_version('pay_WooCommerce');
29 $propayment = !$propayment['status'] ? 'notinstalled' : 'installed';
30 $prohistory = wpsp_check_pro_version('wpsp_mc_version');
31 $prodisablehistory = !$prohistory['status'] ? 'notinstalled' : 'installed';
32 ?>
33 <div class="wpsp-card">
34 <div class="wpsp-card-head">
35 <div class="subject-inner wpsp-left wpsp-class-filter">
36 <form name="StudentClass" id="StudentClass" method="post" action="">
37 <label class="wpsp-labelMain"><?php esc_html_e( 'Select Class Name', 'wpschoolpress' ); ?></label>
38 <select name="ClassID" id="ClassID" class="wpsp-form-control">
39 <?php
40 $sel_classid = isset( $_POST['ClassID'] ) ? intval($_POST['ClassID']) : '';
41 $class_table = $wpdb->prefix."wpsp_class";
42 $sel_class = $wpdb->get_results("select cid,c_name from $class_table Order By cid ASC");
43 ?>
44 <?php if($current_user_role=='administrator' || $current_user_role=='teacher') { ?>
45 <option value="all" <?php if($sel_classid=='all') echo esc_html("selected","wpschoolpress"); ?>><?php esc_html_e( 'All', 'wpschoolpress' ); ?></option>
46 <?php } foreach( $sel_class as $classes ) {
47 ?>
48 <option value="<?php echo esc_attr($classes->cid);?>" <?php if($sel_classid==$classes->cid) echo esc_html("selected","wpschoolpress"); ?>><?php echo esc_html($classes->c_name);?></option>
49 <?php } ?>
50 </select>
51 </form>
52 </div>
53 <div class="wpsp-right wpsp-import-export">
54 <div class="wpsp-btn-lists" <?php echo esc_html($prodisable);?> title="<?php echo esc_attr($protitle);?>">
55 <div class="wpsp-btn-list" <?php if($proversion['status'] != "1") {?> wpsp-tooltip="<?php echo esc_attr($protitle);?>" <?php } ?>>
56 <div class="wpsp-button-group wpsp-dropdownmain wpsp-left">
57 <button type="button" class="wpsp-btn wpsp-btn-success print" id="PrintStudent" <?php echo esc_html($prodisable);?> title="<?php //echo esc_attr($protitle);?>">
58 <i class="fa fa-print"></i> <?php esc_html_e( 'Print', 'wpschoolpress'); ?>
59 </button>
60 <button type="button" class="wpsp-btn wpsp-btn-success wpsp-dropdown-toggle" <?php echo esc_html($prodisable);?> title="<?php //echo esc_attr($protitle);?>">
61 <!-- <span class="sr-only"><?php esc_html_e( 'Toggle Dropdown', 'wpschoolpress' );?></span> -->
62 </button>
63 <div class="wpsp-dropdown wpsp-dropdown-md">
64 <ul>
65 <li class="wpsp-drop-title wpsp-checkList"><?php esc_html_e( 'Select Columns to Print', 'wpschoolpress' );?> </li>
66 <form id="StudentColumnForm" name="StudentColumnForm" method="POST">
67 <?php foreach( $studentFieldList as $key=>$value ) { ?>
68 <li class="wpsp-checkList">
69 <input type="checkbox" name="StudentColumn[]" value="<?php echo esc_attr($key); ?>" id="<?php echo esc_attr($key); ?>" checked="checked">
70 <label for="<?php echo esc_attr($key); ?>"><?php echo esc_html($value); ?></label>
71 </li>
72 <?php } ?>
73 <?php $currentSelectClass = isset($_POST['ClassID']) ? intval($_POST['ClassID']) : '0'; ?>
74 <input type="hidden" name="ClassID" value="<?php echo esc_attr($currentSelectClass); ?>">
75 <input type="hidden" name="exportstudent" value="exportstudent">
76 </form>
77 </ul>
78 </div>
79 </div>
80 </div>
81 <?php if ( in_array( 'administrator', $role ) ) {?>
82 <div class="wpsp-btn-list" <?php if($proversion['status'] != "1") {?> wpsp-tooltip="<?php echo esc_attr($protitle);?>" <?php } ?>>
83 <button id="ImportStudent" class="wpsp-btn wpsp-dark-btn wpsp-popclick impt" <?php echo esc_html($prodisable);?> title="<?php //echo esc_attr($protitle);?>" data-pop="ImportModal"><i class="fa fa-upload"></i> <?php echo esc_html("Import","wpschoolpress");?> </button>
84 </div>
85 <?php }?>
86 <div class="wpsp-btn-list" <?php if($proversion['status'] != "1") {?> wpsp-tooltip="<?php echo esc_attr($protitle);?>" <?php } ?>>
87 <div class="wpsp-dropdownmain wpsp-button-group">
88 <button type="button" class="wpsp-btn print" id="ExportStudents" <?php echo esc_html($prodisable);?> title="<?php //echo esc_attr($protitle);?>"><i class="fa fa-download"></i> <?php esc_html_e( 'Export', 'wpschoolpress'); ?> </button>
89 <button type="button" class="wpsp-btn wpsp-btn-blue wpsp-dropdown-toggle" <?php echo esc_html($prodisable);?> title="<?php //echo esc_attr($protitle);?>">
90 <!-- <span class="sr-only"><?php esc_html_e( 'Toggle Dropdown', 'wpschoolpress' );?></span> -->
91 </button>
92 <div id="exportcontainer" style="display:none;"></div>
93 <div class="wpsp-dropdown wpsp-dropdown-md wpsp-dropdown-right">
94 <ul>
95 <li class="wpsp-drop-title wpsp-checkList"><?php esc_html_e( 'Select Columns to Export', 'wpschoolpress' );?> </li>
96 <form id="ExportColumnForm" name="ExportStudentColumn" method="POST">
97 <?php foreach( $studentFieldList as $key=>$value ) {?>
98 <li class="wpsp-checkList">
99 <input type="checkbox" name="StudentColumn[]" value="<?php echo esc_attr($key); ?>" id="<?php echo esc_attr($key); ?>" checked="checked">
100 <label class="wpsp-label" for="<?php echo esc_attr($key); ?>"><?php echo esc_html($value); ?></label>
101 </li>
102 <?php }?>
103 <input type="hidden" name="ClassID" value="<?php echo esc_html($currentSelectClass); ?>">
104 <input type="hidden" name="exportstudent" value="exportstudent">
105 </form>
106 </ul>
107 </div>
108 </div>
109 </div>
110 </div>
111 </div>
112 </div>
113 <div class="wpsp-card-body">
114 <div class="subject-head">
115 <?php if ( in_array( 'administrator', $role ) ) { ?>
116 <div class="wpsp-bulkaction">
117 <select name="bulkaction" class="wpsp-form-control" id="bulkaction">
118 <option value=""><?php echo esc_html("Select Action","wpschoolpress");?></option>
119 <option value="bulkUsersDelete"><?php echo esc_html("Delete","wpschoolpress");?></option>
120 </select>
121 </div>
122 <?php } ?>
123 <table id="student_table" class="wpsp-table" cellspacing="0" width="100%" style="width:100%">
124 <thead>
125 <tr>
126 <th class="nosort">
127 <?php if ( in_array( 'administrator', $role ) ) { ?><input type="checkbox" id="selectall" name="selectall" class="ccheckbox"><?php } else echo esc_html('Sr. No.','wpschoolpress'); ?>
128 </th>
129 <th><?php echo esc_html__('Roll No.','wpschoolpress');?></th>
130 <th><?php echo esc_html__('Full Name','wpschoolpress');?></th>
131 <th><?php echo esc_html__('Parent','wpschoolpress');?></th>
132 <th><?php echo esc_html__('Street Address','wpschoolpress');?></th>
133 <?php if($propayment =='installed'){?>
134 <th><?php echo esc_html__('Payment Status','wpschoolpress');?></th>
135 <?php } ?>
136 <?php if($proversion1['status']){?>
137 <th><?php echo esc_html__('Class Status','wpschoolpress');?></th>
138 <?php } ?>
139 <th><?php echo esc_html__('Phone','wpschoolpress');?></th>
140 <th align="center" class="nosort"><?php echo esc_html__('Action','wpschoolpress');?></th>
141 </tr>
142 </thead>
143 <tbody>
144 <?php
145 $student_table = $wpdb->prefix."wpsp_student";
146 $users_table = $wpdb->prefix."users";
147 $tfees = $wpdb->prefix."wpsp_fees";
148 $class_id='';
149 if( isset($_POST['ClassID'] ) && $_POST['ClassID'] != 'all' ) {
150 $class_id=intval($_POST['ClassID']);
151 $stl = [];
152 $studentlists = $wpdb->get_results("select class_id, sid from $student_table");
153 foreach ($studentlists as $stu) {
154 if(is_numeric($stu->class_id) ){
155 if($stu->class_id == $class_id){
156 $stl[] = $stu->sid;
157 }
158 }else{
159 $class_id_array = unserialize( $stu->class_id );
160 if(is_array($class_id_array)){
161 if(in_array($class_id, $class_id_array)){
162 $stl[] = $stu->sid;
163 }
164 }
165 }
166 }
167 }else if(!isset($_POST['ClassID']) || $_POST['ClassID'] == 'all' ){
168 $studentlists = $wpdb->get_results("select sid from $student_table");
169 foreach ($studentlists as $stu) {
170 $stl[] = $stu->sid;
171 }
172 }
173 if (!empty($stl)) {
174 $key =0;
175 foreach ($stl as $id ) {
176 $id = esc_sql($id);
177 // $students = $wpdb->get_results("select * from $student_table s, $users_table u where u.ID=s.wp_usr_id AND sid = '$id' and user_login != 'student' order by sid desc");
178 $students = $wpdb->get_results($wpdb->prepare("SELECT * FROM $student_table s, $users_table u where u.ID=s.wp_usr_id AND sid = %d and user_login != %s ORDER BY sid desc",$id,'student'));
179 $plugins_url=plugins_url();
180 $pendingcount =0;
181 foreach($students as $stinfo){
182 if($stinfo->class_id != ''){
183 if(is_numeric($stinfo->class_id) ){
184 $cid[] = $stinfo->class_id;
185 }else{
186 $class_id_array = unserialize( $stinfo->class_id );
187 $cid = $class_id_array;
188 }
189 }
190 $cidds = implode(",",$cid);
191 // $subject_ids = explode(',', $cidds);
192 // $subject_ids = array_map('intval', $subject_ids);
193 // $placeholders = implode(',', array_fill(0, count($subject_ids), '%d'));
194 // $teacherId = $wpdb->get_var("select teacher_id from $class_table WHERE cid IN($cidds)");
195 // $teacherId = $wpdb->prepare("SELECT teacher_id FROM $class_table WHERE cid IN ($placeholders)",...$subject_ids);
196 $courses = get_user_meta( $stinfo->parent_wp_usr_id, '_pay_woocommerce_enrolled_class_access_counter', true );
197 $results = $wpdb->get_results("SELECT s.wp_usr_id,f.student_id,f.order_id FROM $student_table AS s INNER JOIN $tfees AS f ON f.student_id = s.wp_usr_id");
198 foreach($results as $res){
199 $siid[] = $res->wp_usr_id;
200 }
201 if(empty($siid)){
202 $paid = esc_html("Pending","wpschoolpress");
203 }else{
204 if (in_array($stinfo->wp_usr_id,$siid)){
205 $paid = esc_html("Paid","wpschoolpress");
206 }else{
207 $paid = esc_html("Pending","wpschoolpress");
208 }
209 }
210 $key++;
211 if($proversion1['status']){?>
212 <tr <?php if($stinfo->s_lname == "") {echo "style='background-color:#fcdddd'";} else {
213 echo "style='background-color:#c9f7c9'";}?>>
214 <?php }else {?>
215 <tr>
216 <?php } ?>
217 <td>
218 <?php if ( in_array( 'administrator', $role ) ) { ?>
219 <input type="checkbox" class="ccheckbox strowselect" name="UID[]" value="<?php echo esc_attr($stinfo->wp_usr_id);?>">
220 <?php }else echo esc_html($key); ?>
221 </td>
222 <td><?php echo esc_html($stinfo->s_rollno);?></td>
223 <td><?php
224 $mname = $stinfo->s_mname;
225 $lname = $stinfo->s_lname;
226 echo esc_html($stinfo->s_fname .' '. $mname .' '. $lname);?>
227 </td>
228 <td><?php echo esc_html($stinfo->p_fname." ".$stinfo->p_lname); ?>
229 </td>
230 <td><?php
231 $country = !empty( $stinfo->s_country ) ? ", ".$stinfo->s_country : '';
232 $city = !empty( $stinfo->s_city ) ? ", ".$stinfo->s_city : '';
233 $zipcode = !empty( $stinfo->s_zipcode ) ? ", ".$stinfo->s_zipcode : '';
234 echo esc_html($stinfo->s_address.' '.$city. ' ' . $country.' '.$zipcode);
235 ?>
236 </td>
237 <?php if($propayment == 'installed'){?>
238 <td><?php echo esc_html($paid); ?>
239 <a href="<?php echo esc_url(wpsp_admin_url().'sch-payment&id='.base64_encode(intval($stinfo->wp_usr_id)));?>" class="wpsp-popclick1" title="View"><i class="icon dashicons dashicons-visibility wpsp-view-icon"></i></a>
240 </td>
241 <?php } ?>
242 <?php if($proversion1['status']){?>
243 <td>
244 <?php
245 $stl = array();
246 if($stinfo->class_id != ''){
247 if(is_numeric($stinfo->class_id) ){
248 $stl[] = $stinfo->class_id;
249 }else{
250 $class_id_array = unserialize($stinfo->class_id);
251 foreach ($class_id_array as $id) {
252 $stl[] = $id;
253 }
254 }
255 }else{
256 $stl[] = 0;
257 }
258 if($stl[0] == 0 ){ echo esc_html("Unassigned","wpschoolpress"); } else { echo esc_html("Assigned","wpschoolpress"); }
259 ?>
260 </td>
261 <?php } ?>
262 <td><?php echo esc_html($stinfo->s_phone);?></td>
263 <td align="center">
264 <div class="wpsp-action-col">
265 <a href="javascript:;" class="ViewStudent wpsp-popclick" data-pop="ViewModal" data-id="<?php echo esc_attr($stinfo->wp_usr_id);?>" title="View"><i class="icon dashicons dashicons-visibility wpsp-view-icon"></i></a>
266 <a href="<?php echo "?id=".esc_attr($stinfo->wp_usr_id);?>javascript:;" data-id="<?php echo esc_attr($stinfo->wp_usr_id);?>" data-pop="ViewModal" class="viewAttendance wpsp-popclick" title="Attendance">
267 <i class="icon dashicons dashicons-admin-users wpsp-attendance-icon"></i>
268 </a>
269 <a href="<?php echo esc_url(wpsp_admin_url().'sch-student&id='. esc_attr($stinfo->wp_usr_id).'&edit=true');?>" title="Edit"><i class="icon dashicons dashicons-edit wpsp-edit-icon"></i></a>
270 <?php if ( in_array( 'administrator', $role )) { ?>
271 <a href="javascript:;" id="d_teacher" class="wpsp-popclick" data-pop="DeleteModal" title="Delete" data-id="<?php echo esc_attr($stinfo->sid);?>">
272 <i class="icon dashicons dashicons-trash wpsp-delete-icon" data-id="<?php echo esc_attr($stinfo->sid);?>"></i>
273 </a>
274 <?php }
275 if($prodisablehistory == "installed"){?>
276 <a href="<?php echo esc_url(wpsp_admin_url().'sch-history&id='.base64_encode($stinfo->wp_usr_id));?>" title="History">
277 <i class="icon dashicons dashicons-image-rotate wpsp-view-icon" data-id="<?php echo esc_attr($stinfo->sid);?>"></i>
278 </a>
279 <?php } ?>
280 </div>
281 </td>
282 </tr>
283 <?php
284 }
285 }
286 }
287 ?>
288 </tbody>
289 <tfoot>
290 <tr>
291 <th><?php if ( in_array( 'administrator', $role ) ) { }
292 else esc_html_e("Sr. No","wpschoolpress"); ?></th>
293 <th><?php esc_html_e("Roll No.","wpschoolpress");?></th>
294 <th><?php esc_html_e("Full Name","wpschoolpress");?></th>
295 <th><?php esc_html_e("Parent","wpschoolpress");?></th>
296 <th><?php esc_html_e("Street Address","wpschoolpress");?></th>
297 <?php if($propayment =='installed'){?>
298 <th><?php esc_html_e("Payment Status","wpschoolpress");?></th>
299 <?php } ?>
300 <?php if($proversion1['status']){?>
301 <th><?php esc_html_e("Class Status","wpschoolpress");?></th>
302 <?php } ?>
303 <th><?php esc_html_e("Phone","wpschoolpress");?></th>
304 <th align="center"><?php esc_html_e("Action","wpschoolpress");?></th>
305 </tr>
306 </tfoot>
307 </table>
308 </div>
309 </div><!-- /.box-body -->
310 </div>