__('First Name', 'wpschoolpress'),
'p_mname' => __('Middle Name', 'wpschoolpress'),
'p_lname' => __('Last Name', 'wpschoolpress'),
's_fname' => __('Student Name', 'wpschoolpress'),
'user_email' => __('Parent Email ID', 'wpschoolpress'),
'p_edu' => __('Education', 'wpschoolpress'),
'p_gender' => __('Gender', 'wpschoolpress'),
'p_profession' => __('Profession', 'wpschoolpress'),
'p_bloodgrp' => __('Blood Group', 'wpschoolpress'),
);
$sel_classid = isset( $_POST['ClassID'] ) ? sanitize_text_field($_POST['ClassID']) : '';
$class_table = $wpdb->prefix."wpsp_class";
$classQuery = "select cid,c_name from $class_table Order By cid ASC";
$sel_class = $wpdb->get_results( $classQuery );
global $current_user;
$role = $current_user->roles;
$cuserId = $current_user->ID;
?>
'.esc_html($msg).'
';
} else { ?>
|
|
|
|
prefix."wpsp_student";
$users_table = $wpdb->prefix."users";
$class_id='';
if( isset($_POST['ClassID'] ) && $_POST['ClassID'] != 'all' ) {
$class_id=intval($_POST['ClassID']);
$stl = [];
// $parentlist = $wpdb->get_results("select class_id, sid from $student_table WHERE parent_wp_usr_id!='0'");
$parentlist = $wpdb->get_results($wpdb->prepare("SELECT class_id, sid FROM $student_table WHERE parent_wp_usr_id != %d",0));
foreach ($parentlist as $stu) {
if(is_numeric($stu->class_id) ){
if($stu->class_id == $class_id){
$stl[] = $stu->sid;
}
}else{
$class_id_array = unserialize( $stu->class_id );
if(is_array($class_id_array)){
if(in_array($class_id, $class_id_array)){
$stl[] = $stu->sid;
}
}
}
}
}else if(!isset($_POST['ClassID']) || $_POST['ClassID'] == 'all' ){
if($current_user_role =='administrator'){
// $studentlists = $wpdb->get_results("select sid from $student_table WHERE parent_wp_usr_id!='0'");
$studentlists = $wpdb->get_results($wpdb->prepare("SELECT sid FROM $student_table WHERE parent_wp_usr_id != %d",0));
foreach ($studentlists as $stu) {
$stl[] = $stu->sid;
}
}else if($current_user_role =='teacher'){
// print_r($sel_class);
$stl = [];
foreach ($sel_class as $key => $value) {
//$studentlists = $wpdb->get_results("select class_id, sid from $student_table WHERE parent_wp_usr_id!='0'");
$studentlists = $wpdb->get_results($wpdb->prepare("SELECT class_id, sid FROM $student_table WHERE parent_wp_usr_id != %d",0));
foreach ($studentlists as $stu) {
if(is_numeric($stu->class_id) ){
if($stu->class_id == $value->cid){
$stl[] = $stu->sid;
}
}else{
$class_id_array = unserialize( $stu->class_id );
if(is_array($class_id_array)){
if(in_array($value->cid, $class_id_array)){
$stl[] = $stu->sid;
}
}
}
}
}
}
}
$parent_ids=array();
foreach($stl as $plist){
$parent_ids[]= $wpdb->get_row("SELECT DISTINCT u.user_email, CONCAT_WS(' ', p_fname, p_mname, p_lname ) AS full_name, p.s_fname,p.s_lname, p.wp_usr_id, p.parent_wp_usr_id from $student_table p LEFT JOIN $users_table u ON u.ID = p.parent_wp_usr_id WHERE p.sid = $plist ");
}
foreach($parent_ids as $key=>$pinfo){
?>
| full_name);?> |
s_fname." ".$pinfo->s_lname); ?> |
user_email);?> |
|
|
|
|
|