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-teacherList.php

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

240 lines 14.2 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 $teacherFieldList = array( 'empcode' => __('Emp. Code', 'wpschoolpress'),
8 'first_name' => __('First Name', 'wpschoolpress'),
9 'middle_name' => __('Middle Name', 'wpschoolpress'),
10 'last_name' => __('Last Name', 'wpschoolpress'),
11 'user_email' => __('Teacher Email', 'wpschoolpress'),
12 'zipcode' => __('Zip Code', 'wpschoolpress'),
13 'country' => __('Country', 'wpschoolpress'),
14 'gender' => __('Gender', 'wpschoolpress'),
15 'address' => __('Address', 'wpschoolpress'),
16 'dob' => __('Date Of Birth', 'wpschoolpress'),
17 'doj' => __('Date Of Join', 'wpschoolpress'),
18 'dol' => __('Date Of Releaving', 'wpschoolpress'),
19 'phone' => __('Phone Number', 'wpschoolpress'),
20 'qualification' => __('Qualification', 'wpschoolpress'),
21 'gender' => __('Gender', 'wpschoolpress'),
22 'bloodgrp' => __('Blood Group', 'wpschoolpress'),
23 'position' => __('Position', 'wpschoolpress'),
24 'whours' => __('Working Hours', 'wpschoolpress'),
25 );
26 $teacher_table = $wpdb->prefix."wpsp_teacher";
27 $class_table = $wpdb->prefix."wpsp_class";
28 $subjects_table = $wpdb->prefix."wpsp_subject";
29 $role = sanitize_text_field( $current_user->roles);
30 $sel_classid = isset( $_POST['ClassID'] ) ? intval($_POST['ClassID']) : '';
31 $sub_handling = $cincharge = $teacher = array();
32 $classquery = $teacherQuery = '';
33 if( !empty( $sel_classid ) && $sel_classid!='all' ){
34 $classquery = " AND c.cid='".esc_sql($sel_classid)."' ";
35 }
36 $sub_han = $wpdb->get_results($wpdb->prepare("select sub_name,sub_teach_id,c.c_name from $subjects_table s, $class_table c where sub_teach_id>0 AND c.cid=s.class_id $classquery order by c.cid"));
37 foreach($sub_han as $subhan) {
38 $sub_handling[$subhan->sub_teach_id][]=$subhan->sub_name.' ('.$subhan->c_name.')';
39 $teacher[] = $subhan->sub_teach_id;
40 }
41 $incharges=$wpdb->get_results($wpdb->prepare("select c.c_name,c.teacher_id from $class_table c LEFT JOIN $teacher_table t ON t.wp_usr_id=c.teacher_id where c.teacher_id>0 $classquery"));
42 foreach($incharges as $incharge){
43 $cincharge[$incharge->teacher_id][]=$incharge->c_name;
44 }
45 if( !empty( $teacher ) && !empty( $sel_classid ) && $sel_classid!='all' ) {
46 $teacherQuery = 'WHERE wp_usr_id IN ('.implode( "," , $teacher ).") AND";
47 }
48 else{
49 $teacherQuery = 'WHERE';
50 }
51 $query = "SELECT * FROM $teacher_table $teacherQuery first_name != %s ORDER BY tid DESC";
52 $teachers = $wpdb->get_results($wpdb->prepare($query, 'teacher'));
53 // $teachers=$wpdb->get_results($wpdb->prepare("select * from $teacher_table $teacherQuery first_name != 'teacher' order by tid DESC"));
54 // echo "<pre>";print_r($sel_classid);
55 $plugins_url=plugins_url();
56 ?>
57 <div class="wpsp-card">
58 <div class="wpsp-card-head">
59 <div class="subject-inner wpsp-left wpsp-class-filter">
60 <form name="TeacherClass" id="TeacherClass" method="post" action="">
61 <label class="wpsp-labelMain"><?php esc_html_e( 'Select Class Name', 'wpschoolpress' ); ?></label>
62 <select name="ClassID" id="ClassID" class="wpsp-form-control">
63 <option value="all" <?php if($sel_classid=='all') echo esc_html("selected","wpschoolpress"); ?>><?php esc_html_e( 'All', 'wpschoolpress' ); ?></option>
64 <?php
65 $class_table = $wpdb->prefix."wpsp_class";
66 $sel_class = $wpdb->get_results($wpdb->prepare("select cid,c_name from $class_table Order By cid ASC"));
67 foreach( $sel_class as $classes ) {
68 ?>
69 <option value="<?php echo esc_attr(intval($classes->cid));?>" <?php if($sel_classid==$classes->cid) echo esc_html("selected","wpschoolpress"); ?>><?php echo esc_html($classes->c_name);?></option>
70 <?php } ?>
71 </select>
72 </form>
73 </div>
74 <div class="wpsp-right wpsp-import-export">
75 <div class="wpsp-btn-lists" <?php echo esc_html($prodisable);?> title="<?php echo esc_attr($protitle);?>">
76 <?php if ( $current_user_role=='teacher') {?>
77 <div class="wpsp-btn-list" <?php if($proversion['status'] != "1") {?> wpsp-tooltip="<?php echo esc_attr($protitle);?>" <?php } ?>>
78 <div class="wpsp-button-group wpsp-dropdownmain wpsp-left">
79 <button type="button" class="wpsp-btn wpsp-btn-success print" id="PrintTeacher" data-toggle="dropdown" <?php echo esc_html($prodisable);?> title="<?php //echo esc_attr($protitle);?>">
80 <i class="fa fa-print"></i> <?php esc_html_e( 'Print', 'wpschoolpress'); ?>
81 </button>
82 <button type="button" class="wpsp-btn wpsp-btn-success wpsp-dropdown-toggle" <?php echo esc_html($prodisable);?> title="<?php //echo $protitle;?>">
83 <!-- <span class="sr-only"><?php esc_html_e( 'Toggle Dropdown', 'wpschoolpress' );?></span> -->
84 </button>
85 <div class="wpsp-dropdown wpsp-dropdown-md">
86 <ul>
87 <li class="wpsp-drop-title wpsp-checkList"><?php esc_html_e( 'Select Columns to Print', 'wpschoolpress' );?> </li>
88 <form id="TeacherColumnForm" name="TeacherColumnForm" method="POST">
89 <?php foreach( $teacherFieldList as $key=>$value ) { ?>
90 <li class="wpsp-checkList" >
91 <label class="wpsp-label" for="<?php echo "print".esc_attr($key); ?>">
92 <input type="checkbox" name="TeacherColumn[]" value="<?php echo esc_attr($key); ?>" id="<?php echo "print".esc_attr($key); ?>" checked="checked"><?php echo esc_html($value); ?></label>
93 </li>
94 <?php } ?>
95 <input type="hidden" name="classid" id="classid" value="<?php echo esc_attr($sel_classid);?>">
96 </form>
97 </ul>
98 </div>
99 </div>
100 </div>
101 <?php }?>
102 <?php if ( $current_user_role=='administrator') {?>
103 <div class="wpsp-btn-list" <?php if($proversion['status'] != "1") {?> wpsp-tooltip="<?php echo esc_attr($protitle);?>" <?php } ?>>
104 <div class="wpsp-button-group wpsp-dropdownmain wpsp-left">
105 <button type="button" class="wpsp-btn wpsp-btn-success print" id="PrintTeacher" data-toggle="dropdown" <?php echo esc_html($prodisable);?> title="<?php //echo esc_attr($protitle);?>">
106 <i class="fa fa-print"></i> <?php esc_html_e( 'Print', 'wpschoolpress'); ?>
107 </button>
108 <button type="button" class="wpsp-btn wpsp-btn-success wpsp-dropdown-toggle" <?php echo esc_html($prodisable);?> title="<?php //echo esc_attr($protitle);?>">
109 <!-- <span class="sr-only"><?php esc_html_e( 'Toggle Dropdown', 'wpschoolpress' );?></span> -->
110 </button>
111 <div class="wpsp-dropdown wpsp-dropdown-md">
112 <ul>
113 <li class="wpsp-drop-title wpsp-checkList"><?php esc_html_e( 'Select Columns to Print', 'wpschoolpress' );?> </li>
114 <form id="TeacherColumnForm" name="TeacherColumnForm" method="POST">
115 <?php foreach( $teacherFieldList as $key=>$value ) { ?>
116 <li class="wpsp-checkList" >
117 <label class="wpsp-label" for="<?php echo "print".esc_attr($key); ?>"><input type="checkbox" name="TeacherColumn[]" value="<?php echo esc_attr($key); ?>" id="<?php echo "print".esc_attr($key); ?>" checked="checked"><?php echo esc_html($value); ?></label>
118 </li>
119 <?php } ?>
120 <input type="hidden" name="classid" id="classid" value="<?php echo esc_attr($sel_classid);?>">
121 </form>
122 </ul>
123 </div>
124 </div>
125 </div>
126 <?php }?>
127 <?php if($current_user_role=='administrator') { ?>
128 <div class="wpsp-btn-list" <?php if($proversion['status'] != "1") {?> wpsp-tooltip="<?php echo esc_attr($protitle);?>" <?php } ?>>
129 <button id="ImportTeacher" class="wpsp-btn wpsp-dark-btn impt wpsp-popclick" <?php echo esc_html($prodisable);?> title="<?php //echo esc_attr($protitle);?>" data-pop="ImportModal">
130 <i class="fa fa-upload"></i> <?php echo esc_html("Import","wpschoolpress");?>
131 </button>
132 </div>
133 <?php } ?>
134 <?php if ( $current_user_role=='administrator') {?>
135 <div class="wpsp-btn-list" <?php if($proversion['status'] != "1") {?> wpsp-tooltip="<?php echo esc_attr($protitle);?>" <?php } ?>>
136 <div class="wpsp-dropdownmain wpsp-button-group">
137 <button type="button" class="wpsp-btn print" id="ExportTeachers" <?php echo esc_html($prodisable);?> title="<?php //esc_attr(echo $protitle);?>">
138 <i class="fa fa-download"></i> <?php esc_html_e( 'Export', 'wpschoolpress'); ?>
139 </button>
140 <button type="button" class="wpsp-btn wpsp-btn-blue wpsp-dropdown-toggle" <?php echo esc_html($prodisable);?> title="<?php //echo esc_attr($protitle);?>">
141 <!-- <span class="caret"></span>
142 <span class="sr-only"><?php esc_html_e( 'Toggle Dropdown', 'wpschoolpress' );?></span> -->
143 </button>
144 <div id="exportcontainer" style="display:none;"></div>
145 <div class="wpsp-dropdown wpsp-dropdown-md wpsp-dropdown-right">
146 <ul >
147 <li class="wpsp-drop-title wpsp-checkList"><?php esc_html_e( 'Select Columns to Export', 'wpschoolpress' );?> </li>
148 <form id="ExportColumnForm" name="ExportTeacherColumn" method="POST">
149 <?php foreach( $teacherFieldList as $key=>$value ) { ?>
150 <li class="wpsp-checkList">
151 <label class="wpsp-label" for="<?php echo esc_attr($key); ?>"> <input type="checkbox" name="TeacherColumn[]" value="<?php echo esc_attr($key); ?>" id="<?php echo "export".esc_attr($key); ?>" checked="checked"> <?php echo esc_html($value); ?></label>
152 </li>
153 <?php } ?>
154 <?php $currentSelectClass = isset($_POST['ClassID']) ? intval($_POST['ClassID']) : '0'; ?>
155 <input type="hidden" name="exportteacher" value="exportteacher">
156 <input type="hidden" name="classid" id="export-classid" value="<?php echo esc_attr($currentSelectClass);?>">
157 </form>
158 </ul>
159 </div>
160 </div>
161 </div>
162 <?php } ?>
163 </div>
164 </div>
165 </div>
166 <div class="wpsp-card-body">
167 <?php if($current_user_role=='administrator') { ?>
168 <div class="wpsp-bulkaction d-none">
169 <button id="bulkDel" class="wpsp-btn wpsp-btn-danger">Delete</button>
170 <!-- <select name="bulkaction" class="wpsp-form-control" id="bulkaction">
171 <option value=""><//?php esc_html_e( 'Select Action', 'wpschoolpress' ); ?></option>
172 <option value="bulkUsersDelete" id="d_teacher"><//?php esc_html_e( 'Delete', 'wpschoolpress' ); ?></option>
173 </select> -->
174 </div>
175 <?php } ?>
176 <table id="teacher_table" class="wpsp-table" cellspacing="0" width="100%" style="width:100%">
177 <thead>
178 <tr>
179 <th class="nosort">
180 <?php if($current_user_role=='administrator') { ?>
181 <input type="checkbox" id="selectall" name="selectall" class="ccheckbox">
182 <?php } else if( $current_user_role=='teacher' ) { ?>
183 <?php esc_html_e( 'Sr. No.', 'wpschoolpress' ); ?>
184 <?php } ?>
185 </th>
186 <th> <?php esc_html_e( 'Employee Code', 'wpschoolpress' );?></th>
187 <th> <?php esc_html_e( 'Name', 'wpschoolpress' );?> </th>
188 <th> <?php esc_html_e( 'Incharge Class', 'wpschoolpress' );?></th>
189 <th> <?php esc_html_e( 'Subjects Handling', 'wpschoolpress' );?></th>
190 <th> <?php esc_html_e( 'Phone', 'wpschoolpress' );?></th>
191 <th align="center" class="nosort"><?php esc_html_e( 'Action', 'wpschoolpress' );?></th>
192 </tr>
193 </thead>
194 <tbody>
195 <?php
196 foreach($teachers as $key=>$tinfo) { ?>
197 <tr>
198 <td>
199 <?php if($current_user_role=='administrator') { ?>
200 <input type="checkbox" class="ccheckbox tcrowselect" name="UID[]" value="<?php echo esc_attr($tinfo->wp_usr_id);?>">
201 <?php } else if( $current_user_role=='teacher' ) { echo esc_html($key+1); } ?>
202 </td>
203 <td><?php echo esc_html($tinfo->empcode); ?></td>
204 <td><?php echo esc_html($tinfo->first_name." ".$tinfo->last_name);?></td>
205 <td><?php if( isset( $cincharge[$tinfo->wp_usr_id] ) ) { echo esc_html(implode( ", ", $cincharge[$tinfo->wp_usr_id] )); } else { echo '-';} ?></td>
206 <td><?php if( isset( $sub_handling[$tinfo->wp_usr_id] ) ) { echo wp_kses_post(implode( "<br> ", $sub_handling[$tinfo->wp_usr_id] )); } else { echo '-';} ?></td>
207 <td><?php echo esc_html($tinfo->phone); ?></td>
208 <td align="center">
209 <div class="wpsp-action-col">
210 <a href="<?php echo "?id=".esc_attr($tinfo->wp_usr_id);?>javascript:;" title="View" class="wpsp-popclick ViewTeacher" data-id="<?php echo esc_attr($tinfo->wp_usr_id);?>" data-pop="ViewModal"><i class="icon dashicons dashicons-visibility wpsp-view-icon"></i></a>
211 <?php if($current_user_role=='administrator') { ?>
212 <a href="<?php echo esc_url(wpsp_admin_url().'sch-teacher&id='.esc_attr($tinfo->wp_usr_id)."&edit=true");?>" title="Edit">
213 <i class="icon dashicons dashicons-edit wpsp-edit-icon"></i>
214 </a>
215 <a href="javascript:;" id="d_teacher" class="wpsp-popclick" data-pop="DeleteModal" title="Delete" data-id="<?php echo esc_attr($tinfo->tid);?>" >
216 <i class="icon dashicons dashicons-trash wpsp-delete-icon" data-id="<?php echo esc_attr($tinfo->tid);?>"></i>
217 </a>
218 <?php } ?>
219 </div>
220 </td>
221 </tr>
222 <?php } ?>
223 </tbody>
224 <tfoot>
225 <tr>
226 <th><?php if( $current_user_role=='teacher' ) { ?>
227 <?php esc_html_e( 'Sr. No.', 'wpschoolpress' ); ?>
228 <?php } ?>
229 </th>
230 <th><?php esc_html_e( 'Employee Code', 'wpschoolpress' );?></th>
231 <th><?php esc_html_e( 'Name', 'wpschoolpress' );?> </th>
232 <th><?php esc_html_e( 'Incharge Class', 'wpschoolpress' );?></th>
233 <th><?php esc_html_e( 'Subjects Handling', 'wpschoolpress' );?></th>
234 <th><?php esc_html_e( 'Phone', 'wpschoolpress' );?></th>
235 <th align="center"><?php esc_html_e( 'Action', 'wpschoolpress' );?></th>
236 </tr>
237 </tfoot>
238 </table>
239 </div>
240 </div><!-- /.box-body -->