| 1 |
<?php if (!defined( 'ABSPATH' ) )exit('No Such File'); |
| 2 |
global $current_user, $wpdb; |
| 3 |
$current_user_role=$current_user->roles[0]; |
| 4 |
?> |
| 5 |
<!-- This form is used for Add New Parent --> |
| 6 |
<div id="formresponse"></div> |
| 7 |
<form name="ParentEntryForm" id="ParentEntryForm" method="post"> |
| 8 |
<div class="wpsp-card"> |
| 9 |
<div class="wpsp-card-head"> |
| 10 |
<h3 class="wpsp-card-title"><?php esc_html_e("New Parent entry","wpschoolpress");?></h3> |
| 11 |
</div> |
| 12 |
<div class="wpsp-card-body"> |
| 13 |
<div class="wpsp-col-md-6"> |
| 14 |
<?php wp_nonce_field( 'ParentRegister', 'pregister_nonce', '', true ) ?> |
| 15 |
<div class="wpsp-row"> |
| 16 |
<div class="wpsp-col-md-4"> |
| 17 |
<div class="wpsp-form-group"> |
| 18 |
<label class="wpsp-label" for="firstname"><?php echo esc_html_e("Firstname","wpschoolpress");?> <span class="wpsp-required">*</span></label> |
| 19 |
<input type="text" class="wpsp-form-control" id="firstname" name="firstname" placeholder="First Name"> |
| 20 |
</div> |
| 21 |
</div> |
| 22 |
<div class="wpsp-col-md-4"> |
| 23 |
<div class="wpsp-form-group"> |
| 24 |
<label class="wpsp-label" for="middlename"><?php echo esc_html_e("Middlename","wpschoolpress");?> <span class="wpsp-required">*</span></label> |
| 25 |
<input type="text" class="wpsp-form-control" id="middlename" name="middlename" placeholder="Middle Name"> |
| 26 |
</div> |
| 27 |
</div> |
| 28 |
<div class="wpsp-col-md-4"> |
| 29 |
<div class="wpsp-form-group"> |
| 30 |
<label class="wpsp-label" for="lastname"><?php echo esc_html_e("Lastname","wpschoolpress");?> <span class="wpsp-required">*</span></label> |
| 31 |
<input type="text" class="wpsp-form-control" id="lastname" name="lastname" placeholder="Last Name"> |
| 32 |
</div> |
| 33 |
</div> |
| 34 |
</div> |
| 35 |
|
| 36 |
<div class="wpsp-form-group"> |
| 37 |
<label class="wpsp-label" for="Username"><?php echo esc_html_e("Username","wpschoolpress");?> <span class="wpsp-required">*</span></label> |
| 38 |
<input type="text" class="wpsp-form-control" id="Username" name="Username" placeholder="Parent Username"> |
| 39 |
</div> |
| 40 |
<div class="wpsp-form-group"> |
| 41 |
<label class="wpsp-label" for="Email"><?php echo esc_html_e("Email address","wpschoolpress");?> <span class="wpsp-required">*</span></label> |
| 42 |
<input type="email" class="wpsp-form-control" id="Email" name="Email" placeholder="parent Email"> |
| 43 |
</div> |
| 44 |
<div class="wpsp-form-group"> |
| 45 |
<label class="wpsp-label" for="Password"><?php echo esc_html_e("Password","wpschoolpress");?> <span class="wpsp-required">*</span></label> |
| 46 |
<input type="password" class="wpsp-form-control" id="Password" name="Password" placeholder="Password"> |
| 47 |
</div> |
| 48 |
<div class="wpsp-form-group"> |
| 49 |
<label for="ConfirmPassword"><?php echo esc_html_e("Confirm Password","wpschoolpress");?> <span class="wpsp-required">*</span></label> |
| 50 |
<input type="password" class="wpsp-form-control" id="ConfirmPassword" name="ConfirmPassword" placeholder="Confirm Password"> |
| 51 |
</div> |
| 52 |
<div class="wpsp-form-group"> |
| 53 |
<label class="wpsp-label" for="educ"><?php echo esc_html_e("Education","wpschoolpress");?></label> |
| 54 |
<input type="text" class="wpsp-form-control" id="Qual" name="Qual" placeholder="Highest Education Degree"> |
| 55 |
</div> |
| 56 |
<div class="wpsp-form-group"> |
| 57 |
<label class="wpsp-label" for="dateofbirth"><?php echo esc_html_e("Date of Birth","wpschoolpress");?></label> |
| 58 |
<input type="text" class="wpsp-form-control " id="Dob" name="Dob" placeholder="Date of Birth"> |
| 59 |
</div> |
| 60 |
<div class="wpsp-form-group"> |
| 61 |
<label class="wpsp-label" for="displaypicture"><?php echo esc_html_e("Profile Image","wpschoolpress");?></label> |
| 62 |
<input type="file" name="displaypicture" id="displaypicture"> |
| 63 |
<p id="test" style="color:red"></p> |
| 64 |
</div> |
| 65 |
</div> |
| 66 |
<div class="wpsp-col-md-6"> |
| 67 |
<div class="wpsp-form-group parent-student-list"> |
| 68 |
<label class="wpsp-label" for="position"><?php echo esc_html_e("Select Student","wpschoolpress");?></label> |
| 69 |
<?php |
| 70 |
$class_table = $wpdb->prefix."wpsp_class"; |
| 71 |
$classQuery = "select cid,c_name from $class_table"; |
| 72 |
if( $current_user_role=='teacher' ) { |
| 73 |
$cuserId = intval($current_user->ID); |
| 74 |
// $classQuery = "select cid,c_name from $class_table where teacher_id='".esc_sql($cuserId)."'"; |
| 75 |
$classQuery = $wpdb->prepare("SELECT cid,c_name FROM $class_table WHERE teacher_id = %d",$cuserId); |
| 76 |
} |
| 77 |
$classList = $wpdb->get_results( $classQuery ); |
| 78 |
?> |
| 79 |
<select name="child_list[]" id="child_list" data-icon-base="fa" data-tick-icon="fa-check" multiple data-live-search="true" class="selectpicker wpsp-form-control"> |
| 80 |
<?php foreach( $classList as $classkey=>$classvalue ) { ?> |
| 81 |
<optgroup label="Class Name:<?php echo esc_attr($classvalue->c_name); ?>"> |
| 82 |
<?php |
| 83 |
$student_table = $wpdb->prefix."wpsp_student"; |
| 84 |
// $studentList = $wpdb->get_results("select wp_usr_id,s_fname from $student_table where class_id='$classvalue->cid'"); |
| 85 |
$studentList = $wpdb->get_results($wpdb->prepare("SELECT wp_usr_id,s_fname FROM $student_table WHERE class_id = %s",$classvalue->cid)); |
| 86 |
foreach( $studentList as $studentkey=> $studentvalue ) { |
| 87 |
?> |
| 88 |
<option value="<?php echo esc_attr(intval($studentvalue->wp_usr_id)); ?>"><?php echo esc_html($studentvalue->s_fname); ?></option> |
| 89 |
<?php } ?> |
| 90 |
</optgroup> |
| 91 |
<?php } ?> |
| 92 |
</select> |
| 93 |
</div> |
| 94 |
<div class="wpsp-form-group wpsp-gender-field"> |
| 95 |
<label class="wpsp-label" for="Class"><?php echo esc_html_e("Gender","wpschoolpress");?></label> <br /> |
| 96 |
<div class="radio"> |
| 97 |
<input type="radio" name="Gender" value="Male" checked="checked"> |
| 98 |
<label for="Male"><?php echo esc_html_e("Male","wpschoolpress");?></label> |
| 99 |
</div> |
| 100 |
<div class="radio"> |
| 101 |
<input type="radio" name="Gender" value="Female"> |
| 102 |
<label for="Female"><?php echo esc_html_e("Female","wpschoolpress");?></label> |
| 103 |
</div> |
| 104 |
<div class="radio"> |
| 105 |
<input type="radio" name="Gender" value="Other"> |
| 106 |
<label for="Female"><?php echo esc_html_e("Other","wpschoolpress");?></label> |
| 107 |
</div> |
| 108 |
</div> |
| 109 |
<div class="wpsp-form-group"> |
| 110 |
<label class="wpsp-label" for="position"><?php echo esc_html_e("Profession","wpschoolpress");?></label> |
| 111 |
<input type="text" class="wpsp-form-control" id="profession" name="Profession" placeholder="profession"> |
| 112 |
</div> |
| 113 |
<div class="wpsp-form-group"> |
| 114 |
<label class="wpsp-label" for="Address"><?php echo esc_html_e("Current Address","wpschoolpress");?></label> |
| 115 |
<textarea name="Address" class="wpsp-form-control" rows="4"></textarea> |
| 116 |
</div> |
| 117 |
<div class="wpsp-form-group"> |
| 118 |
<label class="wpsp-label" for="Address"><?php echo esc_html_e("Permanent Address","wpschoolpress");?></label> |
| 119 |
<textarea name="pAddress" class="wpsp-form-control" rows="5"></textarea> |
| 120 |
</div> |
| 121 |
<div class="wpsp-form-group"> |
| 122 |
<label class="wpsp-label" for="Country"><?php echo esc_html_e("Country","wpschoolpress");?></label> |
| 123 |
<?php $countrylist = wpsp_county_list();?> |
| 124 |
<select class="wpsp-form-control" id="Country" name="country"> |
| 125 |
<option value=""><?php echo esc_html("Country","wpschoolpress");?></option> |
| 126 |
<?php |
| 127 |
foreach( $countrylist as $key=>$value ) { ?> |
| 128 |
<option value="<?php echo esc_attr($value);?>"><?php echo esc_html($value,'wpschoolpress');?></option> |
| 129 |
<?php |
| 130 |
} |
| 131 |
?> |
| 132 |
</select> |
| 133 |
</div> |
| 134 |
|
| 135 |
<div class="wpsp-row"> |
| 136 |
<div class="wpsp-col-md-6"> |
| 137 |
<div class="wpsp-form-group"> |
| 138 |
<label class="wpsp-label" for="Zipcode"><?php echo esc_html_e("Zipcode","wpschoolpress");?></label> |
| 139 |
<input type="text" class="wpsp-form-control" id="Zipcode" name="zipcode" placeholder="Zipcode"> |
| 140 |
</div> |
| 141 |
</div> |
| 142 |
<div class="wpsp-col-md-6"> |
| 143 |
<div class="wpsp-form-group"> |
| 144 |
<label class="wpsp-label" for="phone"><?php echo esc_html_e("Phone","wpschoolpress");?></label> |
| 145 |
<input type="text" class="wpsp-form-control" id="phone" name="Phone" placeholder="Phone Number"> |
| 146 |
</div> |
| 147 |
</div> |
| 148 |
</div> |
| 149 |
<div class="wpsp-form-group"> |
| 150 |
<label class="wpsp-label" for="bloodgroup"><?php echo esc_html_e("Blood Group","wpschoolpress");?></label> |
| 151 |
<select class="wpsp-form-control" id="Bloodgroup" name="Bloodgroup"> |
| 152 |
<option value=""><?php echo esc_html("Blood Group","wpschoolpress");?></option> |
| 153 |
<option value="O+"><?php echo esc_html("O +","wpschoolpress");?></option> |
| 154 |
<option value="O-"><?php echo esc_html("O -","wpschoolpress");?></option> |
| 155 |
<option value="A+"><?php echo esc_html("A +","wpschoolpress");?></option> |
| 156 |
<option value="A-"><?php echo esc_html("A -","wpschoolpress");?></option> |
| 157 |
<option value="B+"><?php echo esc_html("B +","wpschoolpress");?></option> |
| 158 |
<option value="B-"><?php echo esc_html("B -","wpschoolpress");?></option> |
| 159 |
<option value="AB+"><?php echo esc_html("AB +","wpschoolpress");?></option> |
| 160 |
<option value="AB-"><?php echo esc_html("AB -","wpschoolpress");?></option> |
| 161 |
</select> |
| 162 |
</div> |
| 163 |
</div> |
| 164 |
<div class="wpsp-col-md-12"> |
| 165 |
<button type="submit" class="wpsp-btn wpsp-btn-primary" id="parentform"><?php echo esc_html("Submit","wpschoolpress");?></button> |
| 166 |
</div> |
| 167 |
</div> |
| 168 |
</div> |
| 169 |
</form> |
| 170 |
<!-- End of Add New Parent Form --> |