| 1 |
<?php |
| 2 |
if (!defined( 'ABSPATH' ) )exit('No Such File'); |
| 3 |
wpsp_header(); |
| 4 |
if( is_user_logged_in() ) { |
| 5 |
global $current_user, $wp_roles, $wpdb; |
| 6 |
$current_user_role=$current_user->roles[0]; |
| 7 |
if($current_user_role=='administrator' || $current_user_role=='teacher') { |
| 8 |
wpsp_topbar(); |
| 9 |
wpsp_sidebar(); |
| 10 |
wpsp_body_start(); |
| 11 |
?> |
| 12 |
<div class="wpsp-card"> |
| 13 |
<div class="wpsp-card-head"> |
| 14 |
<div class="subject-inner wpsp-left wpsp-class-filter"> |
| 15 |
<form name="StudentClass" id="StudentClass" method="post" action=""> |
| 16 |
<label class="wpsp-labelMain"><?php esc_html_e( 'Select Role:', 'wpschoolpress' ); ?></label> |
| 17 |
<select name="ClassID" id="ClassID" class="wpsp-form-control"> |
| 18 |
<?php |
| 19 |
$sel_classid = isset( $_POST['ClassID'] ) ? $_POST['ClassID'] : ''; |
| 20 |
$temp_table = $wpdb->prefix."wpsp_temp"; |
| 21 |
$sel_class = $wpdb->get_results("select t_type from $temp_table Order By t_id ASC"); |
| 22 |
$usertype = array(); |
| 23 |
?> |
| 24 |
<?php if($current_user_role=='administrator' ) { ?> |
| 25 |
<option value="all" <?php if($sel_classid=='all') echo esc_html("selected","wpschoolpress"); ?>><?php esc_html_e( 'All', 'wpschoolpress' ); ?></option> |
| 26 |
<?php } foreach( $sel_class as $classes ) { |
| 27 |
if (in_array($classes->t_type, $usertype)) {} else { ?> |
| 28 |
<option value="<?php echo esc_attr($classes->t_type);?>" <?php if($sel_classid==$classes->t_type) echo esc_html("selected","wpschoolpress"); ?>><?php echo esc_html(ucfirst($classes->t_type));?></option> |
| 29 |
<?php } array_push($usertype, $classes->t_type); } ?> |
| 30 |
</select> |
| 31 |
</form> |
| 32 |
</div> |
| 33 |
</div> |
| 34 |
<div class="wpsp-card-body"> |
| 35 |
<div class="subject-head"> |
| 36 |
<div class="wpsp-bulkaction"> |
| 37 |
<select name="bulkaction" class="wpsp-form-control" id="bulkactionreqest"> |
| 38 |
<option value=""><?php esc_html_e( 'Select Action', 'wpschoolpress' ); ?></option> |
| 39 |
<option value="bulkUsersApprove"><?php esc_html_e( 'Approve', 'wpschoolpress' ); ?></option> |
| 40 |
<option value="bulkUsersDisapprove"><?php esc_html_e( 'Disapprove', 'wpschoolpress' ); ?></option> |
| 41 |
</select> |
| 42 |
</div> |
| 43 |
<table id="request_table" class="wpsp-table" cellspacing="0" width="100%" style="width:100%"> |
| 44 |
<thead> |
| 45 |
<tr> |
| 46 |
<th class="nosort"> |
| 47 |
<input type="checkbox" id="selectall" name="selectall" class="ccheckbox"> |
| 48 |
</th> |
| 49 |
<th><?php esc_html_e( 'Full Name', 'wpschoolpress' ); ?></th> |
| 50 |
<th class="sort"><?php esc_html_e( 'Email', 'wpschoolpress' ); ?> </th> |
| 51 |
<th class="sort"><?php esc_html_e( 'Class type', 'wpschoolpress' ); ?> </th> |
| 52 |
<th><?php esc_html_e( 'User Role', 'wpschoolpress' ); ?> </th> |
| 53 |
<th><?php esc_html_e( 'Date Of Registration', 'wpschoolpress' ); ?></th> |
| 54 |
<th align="center" class="nosort"><?php esc_html_e( 'Action', 'wpschoolpress' ); ?></th> |
| 55 |
</tr> |
| 56 |
</thead> |
| 57 |
<tbody> |
| 58 |
<?php |
| 59 |
$student_table = $wpdb->prefix."wpsp_temp"; |
| 60 |
$class_table = $wpdb->prefix."wpsp_class"; |
| 61 |
$class_id=''; |
| 62 |
if( isset($_POST['ClassID'] ) ) { |
| 63 |
$class_id= sanitize_text_field($_POST['ClassID']); |
| 64 |
}else if( !empty( $sel_class ) ) { |
| 65 |
$class_id = 'all'; |
| 66 |
} |
| 67 |
$classquery = " where t_type='".esc_sql($class_id)."' "; |
| 68 |
if($class_id=='NULL'){ |
| 69 |
$classquery = ""; |
| 70 |
}elseif($class_id=='all'){ |
| 71 |
$classquery=""; |
| 72 |
} |
| 73 |
$students = $wpdb->get_results("select * from $student_table $classquery Order By t_id DESC"); |
| 74 |
foreach($students as $stinfo){ |
| 75 |
$cname = ''; |
| 76 |
if(!empty($stinfo->t_cid)){ |
| 77 |
$cname = $wpdb->get_var( $wpdb->prepare("SELECT c_name FROM $class_table WHERE cid = %d",$stinfo->t_cid)); |
| 78 |
} |
| 79 |
?> |
| 80 |
<tr <?php if($stinfo->t_active == 0) {echo "style='background-color:#fcdddd'";}?>> |
| 81 |
<td> |
| 82 |
<input type="checkbox" class="ccheckbox strowselect" name="UID[]" value="<?php echo esc_attr($stinfo->t_id);?>"> |
| 83 |
</td> |
| 84 |
<td><?php echo esc_html($stinfo->t_name);?></td> |
| 85 |
<td><?php echo esc_html($stinfo->t_email);?></td> |
| 86 |
<td><?php echo (!empty($cname) ? $cname : ''); ?></td> |
| 87 |
<td><?php echo esc_html(ucfirst($stinfo->t_type));?></td> |
| 88 |
<td><?php echo esc_html($stinfo->t_date);?></td> |
| 89 |
<td align="center"> |
| 90 |
<div class="wpsp-action-col"> |
| 91 |
<?php $nonce = wp_create_nonce( 'WPSRegRequest'); ?> |
| 92 |
<a href="javascript:;" data-nonce="<?php echo esc_attr($nonce);?>" id="approved_is" data-pop="ViewModal" data-id="<?php echo esc_attr($stinfo->t_id);?>" title="Approve"><?php esc_html_e( 'Approve', 'wpschoolpress' ); ?> |</a> |
| 93 |
<a href="javascript:;" data-nonce="<?php echo esc_attr($nonce);?>" id="d_teacher" class="wpsp-popclick" data-pop="DisapproveModal" title="Disapprove" data-id="<?php echo esc_attr($stinfo->t_id);?>" ><?php esc_html_e( 'Disapprove', 'wpschoolpress' ); ?></a> |
| 94 |
</div> |
| 95 |
</td> |
| 96 |
</tr> |
| 97 |
<?php }?> |
| 98 |
</tbody> |
| 99 |
<tfoot> |
| 100 |
<tr> |
| 101 |
<th></th> |
| 102 |
<th><?php esc_html_e( 'Full Name', 'wpschoolpress' ); ?></th> |
| 103 |
<th><?php esc_html_e( 'Email', 'wpschoolpress' ); ?> </th> |
| 104 |
<th class="sort"><?php esc_html_e( 'Class type', 'wpschoolpress' ); ?> </th> |
| 105 |
<th><?php esc_html_e( 'User Role', 'wpschoolpress' ); ?> </th> |
| 106 |
<th><?php esc_html_e( 'Date Of Registration', 'wpschoolpress' ); ?></th> |
| 107 |
<th align="center"><?php esc_html_e( 'Action', 'wpschoolpress' ); ?></th> |
| 108 |
</tr> |
| 109 |
</tfoot> |
| 110 |
</table> |
| 111 |
</div> |
| 112 |
</div><!-- /.box-body --> |
| 113 |
</div> |
| 114 |
<?php wpsp_body_end(); |
| 115 |
wpsp_footer(); } ?> |
| 116 |
<div class="wpsp-popupMain" id="ViewModal"> |
| 117 |
<div class="wpsp-overlayer"></div> |
| 118 |
<div class="wpsp-popBody"> |
| 119 |
<div class="wpsp-popInner"> |
| 120 |
<a href="javascript:;" class="wpsp-closePopup"></a> |
| 121 |
<div id="ViewModalContent"></div> |
| 122 |
</div> |
| 123 |
</div> |
| 124 |
</div> |
| 125 |
<div class="wpsp-popupMain wpsp-popVisible" id="DisapproveModal" data-pop="DisapproveModal" style="display:none;"> |
| 126 |
<div class="wpsp-overlayer"></div> |
| 127 |
<div class="wpsp-popBody wpsp-alert-body"> |
| 128 |
<div class="wpsp-popInner"> |
| 129 |
<a href="javascript:;" class="wpsp-closePopup"></a> |
| 130 |
<div class="wpsp-popup-cont wpsp-alertbox wpsp-alert-danger"> |
| 131 |
<div class="wpsp-alert-icon-box"> |
| 132 |
<i class="icon wpsp-icon-question-mark"></i> |
| 133 |
</div> |
| 134 |
<div class="wpsp-alert-data"> |
| 135 |
<h4><?php esc_html_e( 'Confirmation Needed', 'wpschoolpress' ); ?></h4> |
| 136 |
<p><?php esc_html_e( 'Are you sure want to disapprove?', 'wpschoolpress' ); ?></p> |
| 137 |
</div> |
| 138 |
<div class="wpsp-alert-btn"> |
| 139 |
<input type="hidden" name="teacherid" id="teacherid"> |
| 140 |
<!-- <//?php wp_nonce_field( 'WPSDecativateReg', 'wps_deacreg_nonce', '', true ); ?> --> |
| 141 |
<a class="wpsp-btn wpsp-btn-danger ClassDeleteBt">Ok</a> |
| 142 |
<a href="javascript:;" class="wpsp-btn wpsp-dark-btn wpsp-popup-cancel"><?php esc_html_e( 'Cancel', 'wpschoolpress' ); ?></a> |
| 143 |
</div> |
| 144 |
</div> |
| 145 |
</div> |
| 146 |
</div> |
| 147 |
</div> |
| 148 |
<?php |
| 149 |
}else { |
| 150 |
include_once( WPSP_PLUGIN_PATH.'/includes/wpsp-login.php');//Include login |
| 151 |
} |
| 152 |
?> |
| 153 |
|