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

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

273 lines 19.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if (!defined('ABSPATH')) exit('No Such File');
2 $teacher_table = $wpdb->prefix . "wpsp_teacher";
3 $class_table = $wpdb->prefix . "wpsp_class";
4 $users_table = $wpdb->prefix . "users";
5 $tid = intval($_GET['id']);
6 $msg = '';
7 if (isset($_GET['edit']) && sanitize_text_field($_GET['edit']) == 'true'){
8 if ($current_user_role == 'administrator' || ($current_user_role == 'teacher' && sanitize_text_field($current_user->ID) == $tid)){
9 $edit = true;
10 }else{
11 $edit = false;
12 }
13 if (isset($_POST['tedit_nonce']) && wp_verify_nonce(sanitize_text_field($_POST['tedit_nonce']) , 'TeacherEdit')){
14 ob_start();
15 wpsp_UpdateTeacher();
16 $msg = ob_get_clean();
17 }
18 }else{
19 $edit = false;
20 }
21 //$tinfo = $wpdb->get_row("select teacher.*,user.user_email from $teacher_table teacher LEFT JOIN $users_table user ON user.ID=teacher.wp_usr_id where teacher.wp_usr_id='".esc_sql($tid)."'");
22 $tinfo = $wpdb->get_row($wpdb->prepare("SELECT teacher.*,user.user_email from $teacher_table teacher LEFT JOIN $users_table user ON user.ID=teacher.wp_usr_id WHERE teacher.wp_usr_id = %d",$tid));
23 if (!empty($tinfo)){ ?>
24 <div id="formresponse"> <?php echo esc_html($msg); ?> </div>
25 <div class="wpsp-row">
26 <?php if ($edit){ ?>
27 <form name="TeacherEditForm" id="TeacherEditForm" method="POST" enctype="multipart/form-data"> <?php
28 } ?>
29 <div class="wpsp-col-xs-12">
30 <div class="wpsp-card">
31 <div class="wpsp-card-head">
32 <h3 class="wpsp-card-title"><?php esc_html_e( 'Personal Details', 'wpschoolpress' ); ?></h3>
33 </div>
34 <div class="wpsp-card-body">
35 <div class="wpsp-row">
36 <div class="wpsp-col-lg-3 wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
37 <div class="wpsp-form-group">
38 <label class="wpsp-label"><?php esc_html_e( 'Profile Image', 'wpschoolpress' ); ?></label>
39 <div class="wpsp-profileUp">
40 <?php $loc_avatar = get_user_meta($tid, 'simple_local_avatar', true);
41 $img_url = $loc_avatar ? $loc_avatar['full'] : WPSP_PLUGIN_URL . 'img/default_avtar.jpg'; ?>
42 <img class="wpsp-upAvatar" id="img_preview_teacher" src="<?php echo esc_url($img_url); ?>">
43 <div class="wpsp-upload-button"> <?php if ($edit){ ?> <i class="fa fa-camera"></i>
44 <input type="file" name="displaypicture" class="wpsp-file-upload" id="displaypicture"> <?php } ?>
45 </div>
46 </div>
47 <p class="wpsp-form-notes">*<?php esc_html_e( 'Only JPEG and JPG supported, * Max 3 MB Upload', 'wpschoolpress' ); ?></p>
48 <label id="displaypicture-error" class="error" for="displaypicture" style="display: none;"><?php esc_html_e( 'Please Upload Profile Image', 'wpschoolpress' ); ?></label>
49 <p id="test" style="color:red"></p>
50 </div>
51 </div>
52 <div class="wpsp-col-lg-9 wpsp-col-md-8 wpsp-col-sm-12 wpsp-col-xs-12">
53 <div class="wpsp-form-group">
54 <label class="wpsp-label" for="gender"><?php esc_html_e( 'Gender', 'wpschoolpress' ); ?></label>
55 <div class="wpsp-radio-inline">
56 <?php if ($edit){ ?>
57 <div class="wpsp-radio">
58 <input type="radio" name="Gender" <?php if ($tinfo->gender == 'Male') echo "checked"; ?> value="Male">
59 <label for="Male"><?php esc_html_e( 'Male', 'wpschoolpress' ); ?></label>
60 </div>
61 <div class="wpsp-radio">
62 <input type="radio" name="Gender" <?php if ($tinfo->gender == 'Female') echo "checked"; ?> value="Female">
63 <label for="Female"><?php esc_html_e( 'Female', 'wpschoolpress' ); ?></label>
64 </div>
65 <div class="wpsp-radio">
66 <input type="radio" name="Gender" <?php if ($tinfo->gender == 'other') echo "checked"; ?> value="other">
67 <label for="other"><?php esc_html_e( 'Other', 'wpschoolpress' ); ?></label>
68 </div>
69 <?php } else { echo esc_html($tinfo->gender); } ?>
70 </div>
71 </div>
72 </div>
73 <?php wp_nonce_field('TeacherRegister', 'tregister_nonce', '', true) ?>
74 <div class="clearfix wpsp-ipad-show"></div>
75 <div class="wpsp-col-lg-3 wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
76 <div class="wpsp-form-group">
77 <label class="wpsp-label" for="firstname"><?php esc_html_e( 'First Name', 'wpschoolpress' ); ?>
78 <span class="wpsp-required">*</span>
79 </label>
80 <input type="text" onkeypress="return (event.charCode > 64 && event.charCode < 91) || (event.charCode > 96 && event.charCode < 123)" data-is_required="<?php echo esc_attr($is_required); ?>" class="wpsp-form-control" value="<?php echo esc_attr($tinfo->first_name); ?>" id="firstname" name="firstname" placeholder="First Name">
81 <input type="hidden" id="wpsp_locationginal" value="<?php echo esc_url(admin_url()); ?>" />
82 <input type="hidden" id="UserID" name="UserID" value="<?php echo esc_attr($tinfo->wp_usr_id); ?>">
83 </div>
84 </div>
85 <div class="wpsp-col-lg-3 wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
86 <div class="wpsp-form-group">
87 <label class="wpsp-label" for="middlename"><?php esc_html_e( 'Middle Name', 'wpschoolpress' ); ?></label>
88 <input onkeypress="return (event.charCode > 64 && event.charCode < 91) || (event.charCode > 96 && event.charCode < 123)" data-is_required="<?php echo esc_attr($is_required); ?>" type="text" class="wpsp-form-control" id="name" name="middlename" value="<?php echo esc_attr($tinfo->middle_name); ?>" placeholder="Middle Name">
89 </div>
90 </div>
91 <div class="wpsp-col-lg-3 wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
92 <div class="wpsp-form-group">
93 <label class="wpsp-label" for="lastname"><?php esc_html_e( 'Last Name', 'wpschoolpress' ); ?>
94 <?php if ($edit){ ?> <span class="wpsp-required">*</span> <?php } ?> </span>
95 </label>
96 <input type="text" onkeypress="return (event.charCode > 64 && event.charCode < 91) || (event.charCode > 96 && event.charCode < 123)" data-is_required="<?php echo esc_attr($is_required); ?>" class="wpsp-form-control" id="name" name="lastname" value="<?php echo esc_attr($tinfo->last_name); ?>" placeholder="Last Name">
97 </div>
98 </div>
99 <div class="clearfix"></div>
100 <div class="wpsp-col-lg-3 wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
101 <div class="wpsp-form-group">
102 <label class="wpsp-label" for="dateofbirth"><?php esc_html_e( 'Date of Birth', 'wpschoolpress' ); ?></label> <?php if ($edit) { ?>
103 <input type="text" class="wpsp-form-control" value="<?php if ($tinfo->dob == "0000-00-00"){ }else{ echo esc_attr(wpsp_viewDate($tinfo->dob));} ?>" id="Dob" name="Dob" placeholder="Date of Birth"> <?php } else { echo esc_html(wpsp_viewDate($tinfo->dob),'wpschoolpress'); } ?>
104 </div>
105 </div>
106 <div class="wpsp-col-lg-3 wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
107 <div class="wpsp-form-group">
108 <label class="wpsp-label" for="Email"><?php esc_html_e( 'Email Address', 'wpschoolpress' ); ?>
109 <span class="wpsp-required"> *</span>
110 </label> <?php if ($edit) { ?>
111 <input type="email" class="wpsp-form-control" id="Email" name="Email" value="<?php echo esc_attr($tinfo->user_email); ?>" placeholder="Teacher Email">
112 <?php } else echo esc_html($tinfo->user_email); ?>
113 </div>
114 </div>
115 <div class="wpsp-col-lg-3 wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
116 <div class="wpsp-form-group">
117 <label class="wpsp-label" for="address"><?php esc_html_e( 'Current Address', 'wpschoolpress' ); ?>
118 <span class="wpsp-required"> * </label>
119 <?php if ($edit){ ?> <textarea name="Address" class="wpsp-form-control" rows="1"><?php echo esc_textarea($tinfo->address); ?></textarea>
120 <?php } else echo esc_html($tinfo->address); ?>
121 </div>
122 </div>
123 <div class="wpsp-col-lg-3 wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
124 <div class="wpsp-form-group">
125 <label class="wpsp-label" for="CityName"><?php esc_html_e( 'City Name', 'wpschoolpress' ); ?></label>
126 <?php if ($edit) { ?>
127 <input type="text" onkeypress="return (event.charCode > 64 && event.charCode < 91) || (event.charCode > 96 && event.charCode < 123)" data-is_required="<?php echo esc_attr($is_required); ?>" class="wpsp-form-control" id="CityName" name="city" placeholder="City Name" value="<?php echo esc_attr($tinfo->city); ?>"> <?php } else echo esc_html($tinfo->city); ?>
128 </div>
129 </div>
130 <div class="wpsp-col-lg-3 wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
131 <div class="wpsp-form-group">
132 <label class="wpsp-label" for="Country"><?php esc_html_e( 'Country', 'wpschoolpress' ); ?></label>
133 <?php if ($edit){ $countrylist = wpsp_county_list(); ?>
134 <select class="wpsp-form-control" id="Country" name="country">
135 <option value=""><?php esc_html_e( 'Select Country', 'wpschoolpress' ); ?></option>
136 <?php foreach ($countrylist as $key => $value) { ?>
137 <option value="<?php echo esc_attr($value); ?>" <?php echo selected($tinfo->country, $value); ?>>
138 <?php echo esc_html($value); ?> </option> <?php } ?>
139 </select> <?php } else echo esc_html($stinfo->country); ?>
140 </div>
141 </div>
142 <div class="wpsp-col-lg-3 wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
143 <div class="wpsp-form-group">
144 <label class="wpsp-label" for="Zip Code"><?php esc_html_e( 'Pin Code', 'wpschoolpress' ); ?>
145 <span class="wpsp-required"> * </label>
146 </label> <?php if ($edit){ ?>
147 <input type="text" name="zipcode" class="wpsp-form-control" value="<?php echo esc_attr($tinfo->zipcode); ?>"> <?php } else echo esc_html($stinfo->zipcode); ?>
148 </div>
149 </div>
150 <div class="wpsp-col-lg-3 wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
151 <div class="wpsp-form-group">
152 <label class="wpsp-label" for="Phone"><?php esc_html_e( 'Phone Number', 'wpschoolpress' ); ?></label>
153 <?php if ($edit) { ?>
154 <input type="text" class="wpsp-form-control" id="Phone" name="Phone" value="<?php echo esc_attr($tinfo->phone); ?>" placeholder="(XXX)-(XXX)-(XXXX)"> <?php } else echo esc_html($tinfo->phone); ?>
155 </div>
156 </div>
157 <div class="wpsp-col-lg-3 wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
158 <div class="wpsp-form-group">
159 <label class="wpsp-label" for="Blood"><?php esc_html_e( 'Blood Group', 'wpschoolpress' ); ?></label>
160 <?php if ($edit) { ?>
161 <select class="wpsp-form-control" id="Bloodgroup" name="Bloodgroup">
162 <option value=""><?php esc_html_e( 'Select Blood Group', 'wpschoolpress' ); ?></option>
163 <option <?php if ($tinfo->bloodgrp == 'O+') echo esc_html("selected","wpschoolpress"); ?> value="O+"> <?php echo esc_html("O +","wpschoolpress");?> </option>
164 <option <?php if ($tinfo->bloodgrp == 'O-') echo esc_html("selected","wpschoolpress"); ?> value="O-"><?php echo esc_html("O -","wpschoolpress");?> </option>
165 <option <?php if ($tinfo->bloodgrp == 'A+') echo esc_html("selected","wpschoolpress"); ?> value="A+"><?php echo esc_html("A +","wpschoolpress");?> </option>
166 <option <?php if ($tinfo->bloodgrp == 'A-') echo esc_html("selected","wpschoolpress"); ?> value="A-"><?php echo esc_html("A -","wpschoolpress");?> </option>
167 <option <?php if ($tinfo->bloodgrp == 'B+') echo esc_html("selected","wpschoolpress"); ?> value="B+"><?php echo esc_html("B +","wpschoolpress");?> </option>
168 <option <?php if ($tinfo->bloodgrp == 'B-') echo esc_html("selected","wpschoolpress"); ?> value="B-"><?php echo esc_html("B -","wpschoolpress");?> </option>
169 <option <?php if ($tinfo->bloodgrp == 'AB+') echo esc_html("selected","wpschoolpress"); ?> value="AB+"><?php echo esc_html("AB +","wpschoolpress");?> </option>
170 <option <?php if ($tinfo->bloodgrp == 'AB-') echo esc_html("selected","wpschoolpress"); ?> value="AB-"><?php echo esc_html("AB -","wpschoolpress");?> </option>
171 </select> <?php } else echo esc_html($tinfo->bloodgrp); ?>
172 </div>
173 </div>
174 <div class="wpsp-col-lg-3 wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
175 <div class="wpsp-form-group">
176 <label class="wpsp-label" for="Qualification"><?php esc_html_e( 'Qualification', 'wpschoolpress' ); ?></label>
177 <?php if ($edit){ ?>
178 <input type="text" class="wpsp-form-control" id="Qual" name="Qual" value="<?php echo esc_attr($tinfo->qualification); ?>" placeholder="Qualification"> <?php } else echo esc_html($tinfo->qualification); ?>
179 </div>
180 </div>
181 <div class="wpsp-col-xs-12"> <?php if ($edit) { ?> <button type="submit" id="u_teacher" class="wpsp-btn wpsp-btn-success"><?php esc_html_e( 'Next', 'wpschoolpress' ); ?></button>
182 <!-- <a href='
183 <?php echo esc_url(wpsp_admin_url()); ?>sch-teacher' class="wpsp-btn wpsp-dark-btn">Back</a> --> <?php } else{ ?>
184 <a href="?id=<?php echo esc_attr($tinfo->wp_usr_id); ?>&edit=true" type="button" class="wpsp-btn wpsp-btn-sm wpsp-btn-warning"><i class="icon dashicons dashicons-edit wpsp-edit-icon"></i></a>
185 <a data-original-title="Remove this user" type="button" class="wpsp-btn wpsp-btn-sm wpsp-btn-danger"> <i class="icon dashicons dashicons-trash wpsp-delete-icon"></i></a> <?php } ?>
186 </div>
187 </div>
188 </div>
189 </div>
190 </div>
191 <div class="wpsp-col-xs-12">
192 <div class="wpsp-card">
193 <div class="wpsp-card-head">
194 <h3 class="wpsp-card-title"><?php esc_html_e( 'School Details', 'wpschoolpress' ); ?></h3>
195 </div>
196 <div class="wpsp-card-body">
197 <div class="wpsp-row">
198 <div class="wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
199 <div class="wpsp-form-group">
200 <label class="wpsp-label" for="Join"><?php esc_html_e( 'Joining Date (mm/dd/yyyy)', 'wpschoolpress' ); ?></label>
201 <?php if ($edit) { ?>
202 <input type="text" class="wpsp-form-control select_date" value="<?php if (wpsp_viewDate($tinfo->doj) == "0000-00-00"){}else{ echo esc_attr(wpsp_viewDate($tinfo->doj));} ?>" id="Doj" name="Doj" placeholder="Date of Join"> <?php } else echo esc_html(wpsp_viewDate($tinfo->doj),'wpschoolpress'); ?>
203 </div>
204 </div>
205 <div class="wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
206 <div class="wpsp-form-group">
207 <label class="wpsp-label" for="Releaving"><?php esc_html_e( 'Leaving Date (mm/dd/yyyy)', 'wpschoolpress' ); ?></label>
208 <?php if ($edit){ ?>
209 <input type="text" class="wpsp-form-control select_date" value="<?php if (wpsp_viewDate($tinfo->dol) == "0000-00-00"){ }else{ echo esc_attr(wpsp_viewDate($tinfo->dol)); } ?>" id="Dol" name="dol" placeholder="Date of Leave"> <?php } else echo esc_html(wpsp_viewDate($tinfo->dol),'wpschoolpress'); ?>
210 </div>
211 </div>
212 <div class="wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
213 <div class="wpsp-form-group">
214 <label class="wpsp-label" for="Working"><?php esc_html_e( 'Working Hours', 'wpschoolpress' ); ?></label>
215 <?php if ($edit){ ?>
216 <input type="text" name="whours" class="wpsp-form-control" value="<?php echo esc_attr($tinfo->whours); ?>"> <?php } else echo esc_html($tinfo->whours); ?>
217 </div>
218 </div>
219 <div class="wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
220 <div class="wpsp-form-group">
221 <label class="wpsp-label" for="Position"><?php esc_html_e( 'Current Position', 'wpschoolpress' ); ?></label> <?php if ($edit) { ?>
222 <input type="text" class="wpsp-form-control" id="Position" name="Position" value="<?php echo esc_attr($tinfo->position); ?>" placeholder="Position"><?php } else echo esc_html($tinfo->position); ?>
223 </div>
224 </div>
225 <div class="wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
226 <div class="wpsp-form-group">
227 <label class="wpsp-label" for="Employee"><?php esc_html_e( 'Employee Code', 'wpschoolpress' ); ?></label>
228 <?php if ($edit){ if ($current_user_role == 'administrator'){ ?>
229 <input type="text" class="wpsp-form-control" id="Empcode" name="Empcode" value="<?php echo esc_attr($tinfo->empcode); ?>" placeholder="Empcode"> <?php } } else { echo esc_html($tinfo->empcode); } ?>
230 </div>
231 </div>
232 <div class="wpsp-col-xs-12">
233 <?php if ($edit) { ?>
234 <button type="submit" id="u_teacher" class="wpsp-btn wpsp-btn-success"><?php esc_html_e( 'Update', 'wpschoolpress' ); ?></button>
235 <a href='<?php echo esc_url(wpsp_admin_url()."sch-teacher")?>' class="wpsp-btn wpsp-dark-btn"><?php esc_html_e( 'Back', 'wpschoolpress' ); ?></a> <?php
236 }
237 else
238 { ?>
239 <a href="?id=<?php echo esc_attr($tinfo->wp_usr_id); ?>&edit=true" type="button" class="btn btn-sm btn-warning"><i class="glyphicon glyphicon-edit"></i></a>
240 <a data-original-title="Remove this user" type="button" class="btn btn-sm btn-danger">
241 <i class="glyphicon glyphicon-remove"></i></a> <?php
242 } ?>
243 </form>
244 </div>
245 </div>
246 </div>
247 </div>
248 </div>
249 </div> <?php
250 }
251 else
252 {
253 echo esc_html("Sorry! No Data Retriverd","wpschoolpress");
254 } ?>
255 <!--<a href="javascript:;" id="sucess_teacher" class="wpsp-popclick" data-pop="SuccessModal" title="Delete" style="display:none;">a</a> -->
256 <div class="wpsp-popupMain wpsp-popVisible" id="SuccessModal" data-pop="SuccessModal" style="display:none;">
257 <div class="wpsp-overlayer"></div>
258 <div class="wpsp-popBody wpsp-alert-body">
259 <div class="wpsp-popInner">
260 <a href="javascript:;" class="wpsp-closePopup"></a>
261 <div class="wpsp-popup-cont wpsp-alertbox wpsp-alert-success">
262 <div class="wpsp-alert-icon-box">
263 <i class="icon wpsp-icon-tick-mark"></i>
264 </div>
265 <div class="wpsp-alert-data">
266 <input type="hidden" name="teacherid" id="teacherid">
267 <h4><?php echo esc_html("Success","wpschoolpress");?></h4>
268 <p><?php echo esc_html("Data Saved Successfully.","wpschoolpress");?></p>
269 </div>
270 </div>
271 </div>
272 </div>
273 </div>