PluginProbe
School Management System – WPSchoolPress / trunk
School Management System – WPSchoolPress vtrunk
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-classForm.php

wpsp-classForm.php in School Management System – WPSchoolPress trunk, at includes/wpsp-classForm.php

220 lines 10.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) exit('No Such File');
3 $c_fee_type = '';
4 $ctable = $wpdb->prefix . "wpsp_class";
5 $teacher_table = $wpdb->prefix . "wpsp_teacher";
6 $teacher_data = $wpdb->get_results("select wp_usr_id,CONCAT_WS(' ', first_name, middle_name, last_name ) AS full_name from $teacher_table order by tid");
7 $classname = $classnumber = $classcapacity = $classlocation = $classstartingdate = $classendingdate = $teacherid = '';
8 if (isset($_GET['id'])) {
9 $classid = intval($_GET['id']);
10 //$wpsp_classes = $wpdb->get_results("select * from $ctable where cid='" . esc_sql($classid) . "'");
11 $wpsp_classes = $wpdb->get_results($wpdb->prepare("SELECT * FROM $ctable WHERE cid = %d",$classid));
12 foreach ($wpsp_classes as $wpsp_editclass){
13 $classname = $wpsp_editclass->c_name;
14 $classnumber = $wpsp_editclass->c_numb;
15 $classcapacity = $wpsp_editclass->c_capacity;
16 $classlocation = $wpsp_editclass->c_loc;
17 $classstartingdate1 = $wpsp_editclass->c_sdate;
18 $classstartingdate = date("m/d/Y", strtotime($classstartingdate1));
19 $classendingdate1 = $wpsp_editclass->c_edate;
20 $classendingdate = date("m/d/Y", strtotime($classendingdate1));
21 $teacherid = $wpsp_editclass->teacher_id;
22 if ($wpsp_editclass->c_fee_type != ''){
23 $c_fee_type = $wpsp_editclass->c_fee_type;
24 }
25 }
26 }
27 $formname = isset($_GET['id']) ? 'ClassEditForm' : 'ClassAddForm';
28 $buttonname = isset($_GET['id']) ? 'Update' : 'Submit';
29 /**
30 * Which class must exist for the "Paid" fee-type option to be shown.
31 * Hooked so any payment add-on (not just the legacy WooCommerce one)
32 * can unlock it by returning its own main class name here.
33 */
34 $propayment_gate_class = apply_filters('wpsp_payment_addon_gate_class', 'pay_WooCommerce');
35 $propayment = wpsp_check_pro_version($propayment_gate_class);
36 $propayment = !$propayment['status'] ? 'notinstalled' : 'installed';
37 ?>
38 <!-- This form is used for Add/Update Class -->
39 <div id="formresponse"></div>
40 <form name="<?php echo esc_attr($formname); ?>" id="<?php echo esc_attr($formname); ?>" method="post">
41 <?php if (isset($_GET['id'])) { ?>
42 <input type="hidden" name="cid" value="<?php echo esc_attr($classid); ?>">
43 <?php } ?>
44 <div class="wpsp-row">
45 <div class="wpsp-col-xs-12">
46 <div class="wpsp-card">
47 <div class="wpsp-card-head">
48 <h3 class="wpsp-card-title"><?php echo isset($_GET['id']) ? esc_html__('Update Class Information', 'wpschoolpress') : esc_html__('Add Class Information', 'wpschoolpress'); ?></h3>
49 </div>
50 <div class="wpsp-card-body">
51 <?php wp_nonce_field('ClassAction', 'caction_nonce', '', true) ?>
52 <div class="wpsp-row">
53 <?php do_action('wpsp_before_class_detail_fields');
54 $is_required_item = apply_filters('wpsp_class_is_required', array());
55 $item = apply_filters('wpsp_class_title_item', esc_html("Class Name", "wpschoolpress"));
56 ?>
57 <div class="wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
58 <div class="wpsp-form-group ">
59 <label class="wpsp-label" for="Name">
60 <?php esc_html_e("Class Name", "wpschoolpress");
61 /*Check Required Field*/
62 if (isset($is_required_item['Name'])) {
63 $is_required = esc_html($is_required_item['Name'], "wpschoolpress");
64 } else {
65 $is_required = true;
66 }
67 ?>
68 <span class="wpsp-required"><?php echo esc_html(($is_required)) ? "*" : ""; ?></span>
69 </label>
70 <input type="text" data-is_required="<?php echo esc_attr($is_required); ?>" class="wpsp-form-control" name="Name" value="<?php echo esc_attr($classname); ?>">
71 </div>
72 </div>
73 <div class="wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
74 <div class="wpsp-form-group">
75 <label class="wpsp-label" for="Number">
76 <?php esc_html_e("Class Number", "wpschoolpress");
77 /*Check Required Field*/
78 if (isset($is_required_item['Number'])) {
79 $is_required = esc_html($is_required_item['Number'], "wpschoolpress");
80 } else {
81 $is_required = true;
82 }
83 ?>
84 <span class="wpsp-required"><?php echo esc_html(($is_required)) ? "*" : ""; ?></span>
85 </label>
86 <input data-is_required="<?php echo esc_attr($is_required); ?>" type="text" pattern="[0-9]*" class="wpsp-form-control" name="Number" value="<?php echo esc_attr($classnumber); ?>">
87 <input type="hidden" id="wpsp_locationginal" value="<?php echo esc_url(admin_url()); ?>" />
88 </div>
89 </div>
90 <div class="wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
91 <div class="wpsp-form-group">
92 <label class="wpsp-label" for="Capacity">
93 <?php esc_html_e("Class Capacity", "wpschoolpress");
94 /*Check Required Field*/
95 if (isset($is_required_item['capacity'])) {
96 $is_required = esc_html($is_required_item['capacity'], 'wpschoolpress');
97 } else {
98 $is_required = true;
99 }
100 ?>
101 <span class="wpsp-required"><?php echo esc_html(($is_required)) ? "*" : ""; ?></span>
102 </label>
103 <input type="text" data-is_required="<?php echo esc_attr($is_required); ?>" pattern="[0-9]*" class="wpsp-form-control numbers" name="capacity" id="c_capacity" value="<?php echo esc_attr($classcapacity); ?>" min="0">
104 </div>
105 </div>
106 </div>
107 <div class="wpsp-row">
108 <div class="wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
109 <div class="wpsp-form-group">
110 <label class="wpsp-label" for="Selectteacher">
111 <?php esc_html_e("Class Teacher", "wpschoolpress") . "<span> (Incharge)</span>";
112 /*Check Required Field*/
113 if (isset($is_required_item['ClassTeacherID'])) {
114 $is_required = esc_html($is_required_item['ClassTeacherID'], 'wpschoolpress');
115 } else {
116 $is_required = true;
117 }
118 ?>
119 <span class="wpsp-required"><?php echo esc_html(($is_required)) ? "*" : ""; ?></span>
120 </label>
121 <select data-is_required="<?php echo esc_attr($is_required); ?>" name="ClassTeacherID" class="wpsp-form-control">
122 <option value=""><?php echo esc_html("Select Teacher", "wpschoolpress"); ?></option>
123 <?php
124 if (!empty($teacher_data)) {
125 foreach ($teacher_data as $teacher_list) {
126 $teacherlistid = $teacher_list->wp_usr_id;
127 ?>
128 <option value="<?php echo esc_attr($teacherlistid); ?>" <?php if ($teacherlistid == $teacherid) echo esc_html("selected", "wpschoolpress"); ?>><?php echo esc_html($teacher_list->full_name); ?></option>
129 <?php }
130 } ?>
131 </select>
132 </div>
133 </div>
134 <div class="wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
135 <div class="wpsp-form-group">
136 <label class="wpsp-label" for="Starting">
137 <?php esc_html_e("Class Starting on", "wpschoolpress");
138 /*Check Required Field*/
139 if (isset($is_required_item['Sdate'])) {
140 $is_required = esc_html($is_required_item['Sdate'], "wpschoolpress");
141 } else {
142 $is_required = true;
143 }
144 ?>
145 <span class="wpsp-required"><?php echo esc_html(($is_required)) ? "*" : ""; ?></span>
146 </label>
147 <input type="text" data-is_required="<?php echo esc_attr($is_required); ?>" class="wpsp-form-control select_date wpsp-start-date" name="Sdate" value="<?php echo esc_attr($classstartingdate); ?>" readonly>
148 </div>
149 </div>
150 <div class="wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
151 <div class="wpsp-form-group">
152 <label class="wpsp-label" for="Ending">
153 <?php esc_html_e("Class Ending on", "wpschoolpress");
154 /*Check Required Field*/
155 if (isset($is_required_item['Edate'])) {
156 $is_required = esc_html($is_required_item['Edate'], "wpschoolpress");
157 } else {
158 $is_required = true;
159 }
160 ?>
161 <span class="wpsp-required"><?php echo esc_html(($is_required)) ? "*" : ""; ?></span>
162 </label>
163 <input type="text" data-is_required="<?php echo esc_attr($is_required); ?>" class="wpsp-form-control select_date wpsp-end-date" name="Edate" value="<?php echo esc_attr($classendingdate); ?>" readonly>
164 </div>
165 </div>
166 </div>
167 <div class="wpsp-row">
168 <div class="wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
169 <div class="wpsp-form-group">
170 <label class="wpsp-label" for="Location">
171 <?php esc_html_e("Class Location", "wpschoolpress");
172 /*Check Required Field*/
173 if (isset($is_required_item['Location'])) {
174 $is_required = esc_html($is_required_item['Location'], "wpschoolpress");
175 } else {
176 $is_required = false;
177 }
178 ?>
179 <span class="wpsp-required"><?php echo esc_html(($is_required)) ? "*" : ""; ?></span>
180 </label>
181 <input type="text" class="wpsp-form-control" data-is_required="<?php echo esc_attr($is_required); ?>" name="Location" value="<?php echo esc_attr($classlocation); ?>">
182 </div>
183 </div>
184 <div class="wpsp-col-md-4 wpsp-col-sm-4 wpsp-col-xs-12">
185 <div class="wpsp-form-group">
186 <label class="wpsp-label" for="Location">
187 <?php esc_html_e("Class Fee Type", "wpschoolpress");
188 /*Check Required Field*/
189 if (isset($is_required_item['classfeetype'])) {
190 $is_required = esc_html($is_required_item['classfeetype'], "wpschoolpress");
191 } else {
192 $is_required = true;
193 }
194 ?>
195 <span class="wpsp-required"><?php echo esc_html(($is_required)) ? "*" : ""; ?></span>
196 </label>
197 <select data-is_required="<?php echo esc_attr($is_required); ?>" name="classfeetype" class="wpsp-form-control">
198 <option value="" selected disabled><?php echo esc_html("Select Class Fee Type", "wpschoolpress"); ?></option>
199 <?php if ($propayment == "installed") {
200 echo esc_html($c_fee_type); ?>
201 <option value="paid" <?php if ($c_fee_type == "paid") echo esc_html("selected", "wpschoolpress"); ?>><?php echo esc_html("Paid", "wpschoolpress"); ?></option>
202 <?php } ?>
203 <option value="free" <?php if ($c_fee_type == "free") echo esc_html("selected", "wpschoolpress"); ?>><?php echo esc_html("Free", "wpschoolpress"); ?></option>
204 </select>
205 </div>
206 </div>
207 <?php do_action('wpsp_after_class_detail_fields', $c_fee_type, isset($classid) ? $classid : 0); ?>
208 </div>
209 <div class="wpsp-row">
210 <div class="wpsp-col-xs-12 wpsp-btnsubmit-section">
211 <button type="submit" class="wpsp-btn wpsp-btn-success" id="c_submit"><?php echo esc_html($buttonname); ?></button>
212 <a href="<?php echo esc_url(wpsp_admin_url() . 'sch-class') ?>" class="wpsp-btn wpsp-dark-btn"><?php echo esc_html("Back", "wpschoolpress"); ?></a>
213 </div>
214 </div>
215 </div>
216 </div>
217 </div>
218 </div>
219 </form>
220 <!-- End of Add/Update New Class Form -->