| 1 |
<?php |
| 2 |
if (!defined( 'ABSPATH' ) )exit('No Such File'); |
| 3 |
$subjectclassid = intval($_GET['classid']); |
| 4 |
$teacher_table= $wpdb->prefix."wpsp_teacher"; |
| 5 |
$teacher_data = $wpdb->get_results("select * from $teacher_table"); |
| 6 |
$class_table = $wpdb->prefix."wpsp_class"; |
| 7 |
//$classQuery = $wpdb->get_results("select * from $class_table where cid='".esc_sql($subjectclassid)."'"); |
| 8 |
$classQuery = $wpdb->get_results($wpdb->prepare("SELECT * FROM $class_table WHERE cid = %d",$subjectclassid)); |
| 9 |
foreach($classQuery as $classdata){ |
| 10 |
$cid= intval($classdata->cid); |
| 11 |
} |
| 12 |
?> |
| 13 |
<!-- This form is used for Add New Subject Form --> |
| 14 |
<div class="formresponse"></div> |
| 15 |
<form name="SubjectEntryForm" action="#" id="SubjectEntryForm" method="post"> |
| 16 |
<?php wp_nonce_field( 'SubjectRegister', 'subregister_nonce', '', true ); ?> |
| 17 |
<div class="wpsp-card"> |
| 18 |
<div class="wpsp-card-head"> |
| 19 |
<div class="wpsp-row"> |
| 20 |
<div class="wpsp-col-xs-12"> |
| 21 |
<h3 class="wpsp-card-title"><?php echo esc_html__( 'New Subject Entry', 'wpschoolpress' ); ?></h3> |
| 22 |
</div> |
| 23 |
</div> |
| 24 |
</div> |
| 25 |
|
| 26 |
<input type="hidden" id="wpsp_locationginal1" value="<?php echo esc_url(admin_url());?>"/> |
| 27 |
<div class="wpsp-card-body"> |
| 28 |
<div class="wpsp-row"> |
| 29 |
<div class="wpsp-col-md-12 line_box"> |
| 30 |
<?php wp_nonce_field( 'SubjectRegister', 'subregister_nonce', '', true ); ?> |
| 31 |
<div class="wpsp-row"> |
| 32 |
<?php |
| 33 |
do_action('wpsp_before_subject_detail_fields'); |
| 34 |
/*Required field Hook*/ |
| 35 |
$is_required_item = apply_filters('wpsp_subject_fields_is_required',array()); |
| 36 |
?> |
| 37 |
<div class="wpsp-col-lg-12 wpsp-col-md-12 wpsp-col-sm-12 wpsp-col-xs-12"> |
| 38 |
<div class="wpsp-form-group"> |
| 39 |
<label class="wpsp-label" for="Name"> |
| 40 |
<?php |
| 41 |
esc_html_e("Class","wpschoolpress"); |
| 42 |
/*Check Required Field*/ |
| 43 |
if(isset($is_required_item['SCID'])){ |
| 44 |
$is_required = esc_html($is_required_item['SCID'],"wpschoolpress"); |
| 45 |
}else{ |
| 46 |
$is_required = true; |
| 47 |
} |
| 48 |
?> |
| 49 |
<span class="wpsp-required"><?php echo esc_html(($is_required))?"*":""; ?></span> |
| 50 |
</label> |
| 51 |
<select name="SCID" data-is_required="<?php echo esc_attr($is_required); ?>" id="SCID" class="wpsp-form-control" required> |
| 52 |
<option value="" ><?php echo esc_html("Please Select Class","wpschoolpress");?></option> |
| 53 |
<?php |
| 54 |
foreach($sel_class as $classes) { $sel_classid = ''; ?> |
| 55 |
<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> |
| 56 |
<?php } ?> |
| 57 |
|
| 58 |
</select> |
| 59 |
<!-- <?php foreach($classQuery as $classdata){ |
| 60 |
$cid= $classdata->cid; ?> |
| 61 |
<label class="wpsp-labelMain" for="Name">Class Name : <?php if($cid == $subjectclassid) echo esc_attr($classdata->c_name);?></label> |
| 62 |
<input type="hidden" class="wpsp-form-control" id="SCID" name="SCID" value="<?php if($cid == $subjectclassid) echo esc_attr($classdata->cid);?>"> |
| 63 |
<?php } ?> --> |
| 64 |
</div> |
| 65 |
</div> |
| 66 |
</div> |
| 67 |
<?php for($i=1;$i<=5;$i++){?> |
| 68 |
<div class="wpsp-row"> |
| 69 |
<div class="wpsp-col-lg-3 wpsp-col-md-6 wpsp-col-sm-6 wpsp-col-xs-12"> |
| 70 |
<div class="wpsp-form-group"> |
| 71 |
<?php |
| 72 |
/*Check Required Field*/ |
| 73 |
if(isset($is_required_item['SNames'])){ |
| 74 |
$is_required = esc_html($is_required_item['SNames'],"wpschoolpress"); |
| 75 |
}else{ |
| 76 |
$is_required = true; |
| 77 |
} |
| 78 |
?> |
| 79 |
<label class="wpsp-label" for="Name"><?php echo esc_html_e("Subject Name","wpschoolpress")." ".intval($i);?><?php if($i=='1') { ?><span class="wpsp-required"><?php echo esc_html(($is_required))?"*":""; ?> |
| 80 |
<?php } ?></label> |
| 81 |
<input type="text" data-is_required="<?php echo esc_attr($is_required); ?>" class="wpsp-form-control" name="SNames[]"> |
| 82 |
</div> |
| 83 |
</div> |
| 84 |
|
| 85 |
<div class="wpsp-col-lg-3 wpsp-col-md-6 wpsp-col-sm-6 wpsp-col-xs-12"> |
| 86 |
<div class="wpsp-form-group"> |
| 87 |
<label class="wpsp-label" for="Name"><?php |
| 88 |
esc_html_e("Subject Code","wpschoolpress"); |
| 89 |
/*Check Required Field*/ |
| 90 |
if(isset($is_required_item['SCodes'])){ |
| 91 |
$is_required = esc_html($is_required_item['SCodes'],"wpschoolpress"); |
| 92 |
}else{ |
| 93 |
$is_required = false; |
| 94 |
} |
| 95 |
?> |
| 96 |
<span class="wpsp-required"><?php echo esc_html(($is_required))?"*":""; ?> |
| 97 |
</label> |
| 98 |
<input type="text" data-is_required="<?php echo esc_attr($is_required); ?>" class="wpsp-form-control" name="SCodes[]"> |
| 99 |
</div> |
| 100 |
</div> |
| 101 |
<div class="wpsp-col-lg-3 wpsp-col-md-6 wpsp-col-sm-6 wpsp-col-xs-12"> |
| 102 |
<div class="wpsp-form-group"> |
| 103 |
<label class="wpsp-label" for="Name"> |
| 104 |
<?php |
| 105 |
esc_html_e("Subject Teacher","wpschoolpress")."<span> (Incharge)</span>"; |
| 106 |
/*Check Required Field*/ |
| 107 |
if(isset($is_required_item['STeacherID'])){ |
| 108 |
$is_required = esc_html($is_required_item['STeacherID'],"wpschoolpress"); |
| 109 |
}else{ |
| 110 |
$is_required = false; |
| 111 |
} |
| 112 |
?> |
| 113 |
<span class="wpsp-required"><?php echo esc_html(($is_required))?"*":""; ?> |
| 114 |
</label> |
| 115 |
<select name="STeacherID[]" data-is_required="<?php echo esc_attr($is_required); ?>" class="wpsp-form-control"> |
| 116 |
<option value=""><?php echo esc_html_e("Please Select Teacher","wpschoolpress");?></option> |
| 117 |
<?php |
| 118 |
foreach ($teacher_data as $teacher_list) { |
| 119 |
$teacherlistid= $teacher_list->wp_usr_id;?> |
| 120 |
<option value="<?php echo esc_attr($teacherlistid);?>" ><?php echo esc_html($teacher_list->first_name ." ". $teacher_list->last_name);?></option> |
| 121 |
<?php |
| 122 |
} |
| 123 |
?> |
| 124 |
</select> |
| 125 |
</div> |
| 126 |
</div> |
| 127 |
<div class="wpsp-col-lg-3 wpsp-col-md-6 wpsp-col-sm-6 wpsp-col-xs-12"> |
| 128 |
<div class="wpsp-form-group"> |
| 129 |
<label class="wpsp-label" for="BName"> <?php |
| 130 |
esc_html_e("Book Name","wpschoolpress"); |
| 131 |
/*Check Required Field*/ |
| 132 |
if(isset($is_required_item['BNames'])){ |
| 133 |
$is_required = esc_html($is_required_item['BNames'],"wpschoolpress"); |
| 134 |
}else{ |
| 135 |
$is_required = false; |
| 136 |
} |
| 137 |
?> |
| 138 |
<span class="wpsp-required"><?php echo esc_html(($is_required))?"*":""; ?></label> |
| 139 |
<input type="text" class="wpsp-form-control" name="BNames[]" placeholder="Book Name"> |
| 140 |
</div> |
| 141 |
</div> |
| 142 |
<?php if($i!='5') { ?> |
| 143 |
<hr style="border-top:1px solid #5C779E"/> |
| 144 |
<?php }?> |
| 145 |
|
| 146 |
</div> |
| 147 |
<?php } ?> |
| 148 |
<?php do_action('wpsp_after_subject_detail_fields'); ?> |
| 149 |
</div> |
| 150 |
<div class="wpsp-col-md-12"> |
| 151 |
<button type="submit" class="wpsp-btn wpsp-btn-success" id="s_submit"><?php echo esc_html(apply_filters( 'wpsp_subject_button_submit_label',"Submit"),'wpschoolpress');?></button> |
| 152 |
<a href="<?php echo esc_url(wpsp_admin_url().'sch-subject')?>" class="wpsp-btn wpsp-dark-btn" ><?php echo esc_html(apply_filters( 'wpsp_subject_button_back_label',"Back"),'wpschoolpress');?></a> |
| 153 |
</div> |
| 154 |
</div> |
| 155 |
</div> |
| 156 |
</div> |
| 157 |
</form> |
| 158 |
<!-- End of Add Subject Form --> |
| 159 |
|