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 / wpsp-class-admin.php

wpsp-class-admin.php in School Management System – WPSchoolPress trunk, at wpsp-class-admin.php

576 lines 27.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // Exit if accessed directly
3 if (!defined('ABSPATH')) exit;
4 /**
5 * Admin Class
6 *
7 * Handles generic Admin functionality.
8 *
9 * @package WPSchoolPress
10 * @since 2.0.0
11 */
12 class Wpsp_Admin
13 {
14 public
15 function __construct()
16 {
17 }
18 /*
19 * Add menu for manage license code
20 * @package WPSchoolPress
21 * @since 2.0.0
22 */
23 function wpsp_admin_menu()
24 {
25 global $current_user;
26 $current_user_role=$current_user->roles[0];
27 $proversion1 = wpsp_check_pro_version('wpsp_addon_version');
28 $prodisable1 = !$proversion1['status'] ? 'notinstalled' : 'installed';
29 $propayment_gate_class = apply_filters('wpsp_payment_addon_gate_class', 'pay_WooCommerce');
30 $propayment = wpsp_check_pro_version($propayment_gate_class);
31 $propayment = !$propayment['status'] ? 'notinstalled' : 'installed';
32
33 $promessage2 = wpsp_check_pro_version('wpsp_message_version');
34 $prodisablemessage2 = !$promessage2['status'] ? 'notinstalled' : 'installed';
35
36 add_menu_page(__('wpschoolpress', 'wpschoolpress') , __('WPSchoolPress', 'wpschoolpress') , 'manage_options', 'wpschoolpress', array(
37 $this,
38 'wpsp_admin_details'
39 ) , WPSP_PLUGIN_URL . 'img/favicon.png');
40 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="dashicons dashicons-dashboard icon"></i>&nbsp; Dashboard', 'edit_posts', 'sch-dashboard', array(
41 $this,
42 'wpsp_callback_dashboard'
43 ));
44
45 /* Social Posts */
46 if( $current_user_role=='administrator' || $current_user_role=='teacher' || $current_user_role=='student' ||$current_user_role=='parent' )
47 {
48 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="dashicons-before dashicons-admin-post"></i>&nbsp; Posts', 'edit_posts', 'sch-posts', array(
49 $this,
50 'wpsp_callback_posts'
51 ));
52
53 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="dashicons-before dashicons-admin-post"></i>&nbsp; Social Profile', 'edit_posts', 'sch-postsprofile', array(
54 $this,
55 'wpsp_callback_postsprofile'
56 ));
57 if( $current_user_role=='administrator'){
58 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="dashicons-before dashicons-admin-post"></i>&nbsp; Reported Posts', 'edit_posts', 'sch-reported-posts', array(
59 $this,
60 'wpsp_callback_reported_post'
61 ));
62 }
63 //if( $current_user_role=='administrator'){
64 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="dashicons-before dashicons-admin-post"></i>&nbsp; Notification', 'edit_posts', 'sch-posts-notification', array(
65 $this,
66 'wpsp_callback_posts_notification'
67 ));
68 //}
69 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="dashicons-before dashicons-admin-post"></i>&nbsp; Documents', 'edit_posts', 'sch-documents', array(
70 $this,
71 'wpsp_callback_documents'
72 ));
73 }
74
75 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="fa fa-inbox"></i>&nbsp; Messages', 'edit_posts', 'sch-messages', array(
76 $this,
77 'wpsp_callback_messages'
78 ));
79
80 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="dashicons dashicons-id icon"></i>&nbsp; Students', 'edit_posts', 'sch-student', array(
81 $this,
82 'wpsp_callback_students'
83 ));
84 if($proversion1['status']){
85 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="dashicons dashicons-welcome-write-blog icon"></i>&nbsp; Registration Request', 'edit_posts', 'sch-request', array(
86 $this,
87 'wpsp_callback_request'
88 ));
89 }
90 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="dashicons dashicons-groups icon"></i>&nbsp; Teachers', 'edit_posts', 'sch-teacher', array(
91 $this,
92 'wpsp_callback_teachers'
93 ));
94 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="dashicons dashicons-businessman icon"></i>&nbsp; Parents', 'edit_posts', 'sch-parent', array(
95 $this,
96 'wpsp_callback_parents'
97 ));
98 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="dashicons dashicons-welcome-widgets-menus icon"></i>&nbsp; Classes', 'edit_posts', 'sch-class', array(
99 $this,
100 'wpsp_callback_classes'
101 ));
102 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="dashicons dashicons-clipboard icon"></i>&nbsp; Attendance', 'edit_posts', 'sch-attendance', array(
103 $this,
104 'wpsp_callback_attendance'
105 ));
106 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="fa fa-book"></i>&nbsp; Subjects', 'edit_posts', 'sch-subject', array(
107 $this,
108 'wpsp_callback_subject'
109 ));
110 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="fa fa-edit"></i>&nbsp; Exams', 'edit_posts', 'sch-exams', array(
111 $this,
112 'wpsp_callback_exams'
113 ));
114 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="fa fa-check-square-o"></i>&nbsp; Marks', 'edit_posts', 'sch-marks', array(
115 $this,
116 'wpsp_callback_marks'
117 ));
118 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="dashicons dashicons-calendar-alt"></i>&nbsp; Events', 'edit_posts', 'sch-events', array(
119 $this,
120 'wpsp_callback_events'
121 ));
122 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="fa fa-clock-o"></i>&nbsp; Time Table', 'edit_posts', 'sch-timetable', array(
123 $this,
124 'wpsp_callback_timetable'
125 ));
126 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="fa fa-upload"></i>&nbsp; Import History', 'edit_posts', 'sch-importhistory', array(
127 $this,
128 'wpsp_callback_importhistory'
129 ));
130 if( $current_user_role=='administrator' || $current_user_role=='teacher')
131 {
132 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="fa fa-bullhorn"></i>&nbsp; Notify', 'edit_posts', 'sch-notify', array(
133 $this,
134 'wpsp_callback_notify'
135 ));
136 }
137 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="fa fa-road"></i>&nbsp; Transport', 'edit_posts', 'sch-transport', array(
138 $this,
139 'wpsp_callback_transport'
140 ));
141 if($current_user_role=='administrator' || $current_user_role=='teacher'){
142 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="fa fa-signal"></i>&nbsp; Teacher Attendance', 'edit_posts', 'sch-teacherattendance', array(
143 $this,
144 'wpsp_callback_teacherattendance'
145 ));
146 }
147 if($current_user_role=='administrator' || $current_user_role=='teacher'){
148 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="fa fa-cog"></i>&nbsp; General Settings', 'edit_posts', 'sch-settings', array(
149 $this,
150 'wpsp_callback_settings'
151 ));
152 }
153 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="fa fa-check-square-o"></i>&nbsp; Subject Mark Fields', 'edit_posts', 'sch-settings&sc=subField', array(
154 $this,
155 'wpsp_callback_subfield'
156 ));
157 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="fa fa-clock-o"></i>&nbsp; Working Hours', 'edit_posts', 'sch-settings&sc=WrkHours', array(
158 $this,
159 'wpsp_callback_wrkhours'
160 ));
161 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="fa fa-key fa-fw"></i>&nbsp; Change Password', 'edit_posts', 'sch-changepassword', array(
162 $this,
163 'wpsp_callback_changepassword'
164 ));
165 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="fa fa-strikethrough"></i>&nbsp; Leave Calendar', 'edit_posts', 'sch-leavecalendar', array(
166 $this,
167 'wpsp_callback_leavecalendar'
168 ));
169 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="fa fa-key fa-fw"></i>&nbsp; Edit Profile', 'edit_posts', 'sch-editprofile', array(
170 $this,
171 'wpsp_callback_editprofile'
172 ));
173 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="fa fa-key fa-fw"></i>&nbsp; History', 'edit_posts', 'sch-history', array(
174 $this,
175 'wpsp_callback_schhistory'
176 ));
177 if($propayment == "installed"){
178 add_submenu_page('wpschoolpress', 'wpschoolpress', '<i class="fa fa-strikethrough"></i>&nbsp; Payment', 'edit_posts', 'sch-payment', array(
179 $this,
180 'wpsp_callback_payment'
181 ));
182 }
183 add_submenu_page( 'wpschoolpress', 'wpschoolpress', '<i class="dashicons dashicons-welcome-add-page"></i>&nbsp; Addons',
184 'edit_posts', 'sch-addons',
185 array( $this, 'wpsp_addons' )
186 );
187 add_submenu_page( 'wpschoolpress', 'wpschoolpress', '<i class="fa fa-pencil-square-o"></i>&nbsp; Customization',
188 'edit_posts', 'sch-customization',
189 array( $this, 'wpsp_customization' )
190 );
191 }
192 /*
193 * Call html of purchase code validation and contact
194 * @package WPSchoolPress
195 * @since 2.0.0
196 */
197 function wpsp_admin_details()
198 {
199 require_once (WPSP_PLUGIN_PATH . 'lib/wpsp-admin-options.php');
200 }
201 function wpsp_addons()
202 {
203 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-addons.php');
204 }
205 function wpsp_customization()
206 {
207 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-customization.php');
208 }
209 function wpsp_callback_dashboard()
210 {
211 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-dashboard.php');
212 }
213 function wpsp_callback_payment()
214 {
215 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-payment.php');
216 }
217 function wpsp_callback_editprofile()
218 {
219 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-editprofile.php');
220 }
221 function wpsp_callback_students()
222 {
223 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-student.php');
224 }
225 function wpsp_callback_request()
226 {
227 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-registration-request.php');
228 }
229 function wpsp_callback_teachers()
230 {
231 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-teacher.php');
232 }
233 function wpsp_callback_messages()
234 {
235 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-messages.php');
236 }
237 function wpsp_callback_parents()
238 {
239 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-parent.php');
240 }
241 function wpsp_callback_classes()
242 {
243 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-class.php');
244 }
245 function wpsp_callback_attendance()
246 {
247 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-attendance.php');
248 }
249 function wpsp_callback_subject()
250 {
251 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-subject.php');
252 }
253 function wpsp_callback_marks()
254 {
255 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-marks.php');
256 }
257 function wpsp_callback_exams()
258 {
259 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-exams.php');
260 }
261 function wpsp_callback_events()
262 {
263 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-events.php');
264 }
265 function wpsp_callback_timetable()
266 {
267 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-timetable.php');
268 }
269 function wpsp_callback_importhistory()
270 {
271 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-importhistory.php');
272 }
273 function wpsp_callback_notify()
274 {
275 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-notify.php');
276 }
277 function wpsp_callback_transport()
278 {
279 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-transport.php');
280 }
281 function wpsp_callback_teacherattendance()
282 {
283 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-teacher-attendance.php');
284 }
285 function wpsp_callback_settings()
286 {
287 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-settings.php');
288 }
289 function wpsp_callback_changepassword()
290 {
291 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-changepassword.php');
292 }
293 function wpsp_callback_leavecalendar()
294 {
295 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-leavecalendar.php');
296 }
297 function wpsp_callback_schhistory()
298 {
299 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-history.php');
300 }
301
302 function wpsp_callback_posts()
303 {
304 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-posts.php');
305 }
306 function wpsp_callback_postsprofile()
307 {
308 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-postsprofile.php');
309 }
310 function wpsp_callback_reported_post()
311 {
312 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-reportedposts.php');
313 }
314 function wpsp_callback_posts_notification()
315 {
316 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-posts-notification.php');
317 }
318 function wpsp_callback_documents()
319 {
320 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-documents.php');
321 }
322 /*
323 * Add required css and js for purchase code validation page
324 * @package WPSchoolPress
325 * @since 2.0.0
326 */
327 function wpsp_add_admin_scripts($hook)
328 {
329 // ── Only load WPSP assets on WPSP admin screens ──────────────────────────
330 // All sub-pages register under 'wpschoolpress_page_sch-*'.
331 // The top-level entry uses 'toplevel_page_wpschoolpress'.
332 // Every other admin screen (Posts, Pages, Plugins, etc.) bails here.
333 $is_wpsp_page = (
334 $hook === 'toplevel_page_wpschoolpress' ||
335 strpos( $hook, 'wpschoolpress_page_sch-' ) === 0
336 );
337
338 if ( ! $is_wpsp_page ) {
339 return;
340 }
341
342 // wpsp_check_pro_version() is already statically cached inside the function
343 // itself so calling it here costs nothing on subsequent calls this request.
344 $prohistory = wpsp_check_pro_version( 'wpsp_mc_version' );
345 $prodisablehistory = ! $prohistory['status'] ? 'notinstalled' : 'installed';
346
347 // ── Core CSS (every WPSP page) ───────────────────────────────────────────
348 wp_register_style( 'wpsp_wp_admin_font_awesome', WPSP_PLUGIN_URL . 'css/font-awesome.min.css', false, '1.0.0' );
349 wp_enqueue_style( 'wpsp_wp_admin_font_awesome' );
350 wp_register_style( 'wpsp_wp_admin_ionicons', WPSP_PLUGIN_URL . 'css/ionicons.min.css', false, '1.0.0' );
351 wp_enqueue_style( 'wpsp_wp_admin_ionicons' );
352 wp_register_style( 'wpsp_wp_admin_wpsp-grid', WPSP_PLUGIN_URL . 'css/wpsp-grid.css', false, '1.0.0' );
353 wp_enqueue_style( 'wpsp_wp_admin_wpsp-grid' );
354 wp_register_style( 'wpsp_wp_admin_dataTablesresp', WPSP_PLUGIN_URL . 'css/datepicker.min.css', false, '1.0.0' );
355 wp_enqueue_style( 'wpsp_wp_admin_dataTablesresp' );
356 wp_register_style( 'wpsp_wp_admin_dataTablesbootresp2', WPSP_PLUGIN_URL . 'plugins/datatables/responsive.bootstrap.min.css', false, '1.0.0' );
357 wp_enqueue_style( 'wpsp_wp_admin_dataTablesbootresp2' );
358 wp_register_style( 'wpsp_wp_admin_wpsp-icons', WPSP_PLUGIN_URL . 'css/wpsp-icons.css', false, '1.0.0' );
359 wp_enqueue_style( 'wpsp_wp_admin_wpsp-icons' );
360 wp_register_style( 'wpsp_wp_admin_wpsp-widget', WPSP_PLUGIN_URL . 'css/wpsp-widget.css', false, '1.0.0' );
361 wp_enqueue_style( 'wpsp_wp_admin_wpsp-widget' );
362 wp_register_style( 'wpsp_wp_admin_wpsp-style', WPSP_PLUGIN_URL . 'css/wpsp-style.css', false, '1.0.0' );
363 wp_enqueue_style( 'wpsp_wp_admin_wpsp-style' );
364 wp_register_style( 'wpsp_wp_admin_wpsp-style-resposive', WPSP_PLUGIN_URL . 'css/wpsp-resposive.css', false, '1.0.0' );
365 wp_enqueue_style( 'wpsp_wp_admin_wpsp-style-resposive' );
366 wp_register_style( 'wpsp_wp_admin_wpsp-style-select', WPSP_PLUGIN_URL . 'css/bootstrap-select.min.css', false, '1.0.0' );
367 wp_enqueue_style( 'wpsp_wp_admin_wpsp-style-select' );
368 wp_register_style( 'wpsp_wp_admin_wpsp-style-multiselect', WPSP_PLUGIN_URL . 'css/bootstrap-multiselect.css', false, '1.0.0' );
369 wp_enqueue_style( 'wpsp_wp_admin_wpsp-style-multiselect' );
370
371 // ── Page-specific CSS ────────────────────────────────────────────────────
372 if ( $hook === 'wpschoolpress_page_sch-dashboard' ) {
373 wp_register_style( 'wpsp_wp_admin_fullcalendar', WPSP_PLUGIN_URL . 'plugins/fullcalendar/fullcalendar.min.css', false, '1.0.0' );
374 wp_enqueue_style( 'wpsp_wp_admin_fullcalendar' );
375 }
376 if ( $hook === 'wpschoolpress_page_sch-events' ) {
377 wp_register_style( 'wpsp_wp_admin_fullcalendar', WPSP_PLUGIN_URL . 'plugins/fullcalendar/fullcalendar.min.css', false, '1.0.0' );
378 wp_enqueue_style( 'wpsp_wp_admin_fullcalendar' );
379 wp_register_style( 'wpsp_wp_admin_timepicker', WPSP_PLUGIN_URL . 'plugins/timepicker/bootstrap-timepicker.css', false, '1.0.0' );
380 wp_enqueue_style( 'wpsp_wp_admin_timepicker' );
381 }
382 if ( $hook === 'wpschoolpress_page_sch-settings' || $hook === 'wpschoolpress_page_sch-teacher' ) {
383 wp_register_style( 'wpsp_wp_admin_boottimepicker', WPSP_PLUGIN_URL . 'plugins/timepicker/bootstrap-timepicker.css', false, '1.0.0' );
384 wp_enqueue_style( 'wpsp_wp_admin_boottimepicker' );
385 }
386 if ( $hook === 'wpschoolpress_page_sch-messages' || $hook === 'wpschoolpress_page_sch-parent' ) {
387 wp_register_style( 'wpsp_wp_admin_multiselect', WPSP_PLUGIN_URL . 'plugins/multiselect/jquery.multiselect.css', false, '1.0.0' );
388 wp_enqueue_style( 'wpsp_wp_admin_multiselect' );
389 }
390
391 // ── Core JS (every WPSP page) ────────────────────────────────────────────
392 wp_enqueue_script( 'wpsp_wp_admin_jquery2', WPSP_PLUGIN_URL . 'js/lib/bootstrap.min.js', array( 'jquery' ), '1.0.0', true );
393 wp_enqueue_script( 'wpsp_wp_admin_jquery303', WPSP_PLUGIN_URL . 'js/bootstrap-multiselect.js', array( 'jquery' ), '1.0.0', true );
394 wp_enqueue_script( 'wpsp_wp_admin_jquery1', WPSP_PLUGIN_URL . 'plugins/otherjs/wpsp.validate.min.js', array( 'jquery' ), '1.0.0', true );
395 wp_enqueue_script( 'wpsp_wp_admin_jquery90', WPSP_PLUGIN_URL . 'js/wpsp-wp-admin.js', array( 'jquery' ), '1.0.0', true );
396 wp_enqueue_script( 'wpsp_wp_admin_jquery4', WPSP_PLUGIN_URL . 'js/lib/app.js', array( 'jquery' ), '1.0.0', true );
397 wp_enqueue_script( 'wpsp_wp_admin_jquery6', WPSP_PLUGIN_URL . 'plugins/slimScroll/jquery.slimscroll.min.js', array( 'jquery' ), '1.0.0', true );
398 wp_enqueue_script( 'wpsp_wp_admin_jquery7', WPSP_PLUGIN_URL . 'js/bootstrap-datepicker.min.js', array( 'jquery' ), '1.0.0', true );
399 wp_enqueue_script( 'wpsp_wp_admin_jquery100', WPSP_PLUGIN_URL . 'js/wpsp-settingtab.js', array( 'jquery' ), '1.0.0', true );
400 wp_enqueue_script( 'wpsp_wp_admin_jquery8', WPSP_PLUGIN_URL . 'plugins/datatables/jquery.datatables.js', array( 'jquery' ), '1.0.0', true );
401 wp_enqueue_script( 'wpsp_wp_admin_jquery999', WPSP_PLUGIN_URL . 'js/wpsp-custome.js', array( 'jquery' ), '1.0.0', true );
402
403 // ── Page-specific JS ─────────────────────────────────────────────────────
404 if ( $hook === 'wpschoolpress_page_sch-request' ) {
405 wp_enqueue_script( 'wpsp_wp_admin_jquery1011', WPSP_PLUGIN_URL . 'js/wpsp-sch-request.js', array( 'jquery' ), '1.0.0', true );
406 }
407 if ( $hook === 'wpschoolpress_page_sch-dashboard' ) {
408 wp_enqueue_script( 'wpsp_wp_admin_jquery10', WPSP_PLUGIN_URL . 'plugins/fullcalendar/moment.min.js', array( 'jquery' ), '1.0.0', true );
409 wp_enqueue_script( 'wpsp_wp_admin_jquery11', WPSP_PLUGIN_URL . 'plugins/fullcalendar/fullcalendar.min.js', array( 'jquery' ), '1.0.0', true );
410 wp_enqueue_script( 'wpsp_wp_admin_jquery12', WPSP_PLUGIN_URL . 'plugins/timepicker/bootstrap-timepicker.js', array( 'jquery' ), '1.0.0', true );
411 wp_enqueue_script( 'wpsp_wp_admin_jquery13', WPSP_PLUGIN_URL . 'js/wpsp-dashboard.js', array( 'jquery' ), '1.0.0', true );
412 }
413 if ( $hook === 'wpschoolpress_page_sch-student' ) {
414 wp_enqueue_script( 'wpsp_wp_admin_jquery171', WPSP_PLUGIN_URL . 'js/wpsp-student.js', array( 'jquery' ), '1.0.0', true );
415 if ( $prodisablehistory === 'installed' ) {
416 wp_enqueue_script( 'wpsp_wp_admin_jquery007', WPSP_PLUGIN_URL . 'js/wpsp-custom-multicls.js', array( 'jquery' ), '1.0.0', true );
417 }
418 }
419 if ( $hook === 'wpschoolpress_page_sch-editprofile' ) {
420 wp_enqueue_script( 'wpsp_wp_admin_jquery17', WPSP_PLUGIN_URL . 'js/wpsp-editprofile.js', array( 'jquery' ), '1.0.0', true );
421 }
422 if ( $hook === 'wpschoolpress_page_sch-teacher' ) {
423 wp_enqueue_script( 'wpsp_wp_admin_jquery18', WPSP_PLUGIN_URL . 'js/wpsp-teacher.js', array( 'jquery' ), '1.0.0', true );
424 }
425 if ( $hook === 'wpschoolpress_page_sch-parent' ) {
426 wp_enqueue_script( 'wpsp_wp_admin_jquery19', WPSP_PLUGIN_URL . 'js/wpsp-parent.js', array( 'jquery' ), '1.0.0', true );
427 }
428 if ( $hook === 'wpschoolpress_page_sch-class' ) {
429 wp_enqueue_script( 'wpsp_wp_admin_jquery20', WPSP_PLUGIN_URL . 'js/wpsp-class.js', array( 'jquery' ), '1.0.0', true );
430 }
431 if ( $hook === 'wpschoolpress_page_sch-attendance' ) {
432 wp_enqueue_script( 'wpsp_wp_admin_jquery21', WPSP_PLUGIN_URL . 'js/wpsp-attendance.js', array( 'jquery' ), '1.0.0', true );
433 }
434 if ( $hook === 'wpschoolpress_page_sch-subject' ) {
435 wp_enqueue_script( 'wpsp_wp_admin_jquery22', WPSP_PLUGIN_URL . 'js/wpsp-subject.js', array( 'jquery' ), '1.0.0', true );
436 }
437 if ( $hook === 'wpschoolpress_page_sch-exams' ) {
438 wp_enqueue_script( 'wpsp_wp_admin_jquery23', WPSP_PLUGIN_URL . 'js/wpsp-exam.js', array( 'jquery' ), '1.0.0', true );
439 }
440 if ( $hook === 'wpschoolpress_page_sch-marks' ) {
441 wp_enqueue_script( 'wpsp_wp_admin_jquery24', WPSP_PLUGIN_URL . 'js/wpsp-mark.js', array( 'jquery' ), '1.0.0', true );
442 }
443 if ( $hook === 'wpschoolpress_page_sch-timetable' ) {
444 wp_deregister_script( 'jquery-ui-core' );
445 wp_enqueue_script( 'wpsp_wp_admin_jquery25', WPSP_PLUGIN_URL . 'plugins/otherui/wpsp_easyui.min.js', array( 'jquery' ), '1.0.0', true );
446 wp_enqueue_script( 'wpsp_wp_admin_jquery201', WPSP_PLUGIN_URL . 'js/lib/jquery.draggable.js', array( 'jquery' ), '1.0.0', true );
447 wp_enqueue_script( 'wpsp_wp_admin_jquery26', WPSP_PLUGIN_URL . 'js/wpsp_timetable.js', array( 'jquery' ), '1.0.0', true );
448 }
449 if ( $hook === 'wpschoolpress_page_sch-settings' ) {
450 wp_enqueue_script( 'wpsp_wp_admin_jquery27', WPSP_PLUGIN_URL . 'plugins/timepicker/bootstrap-timepicker.js', array( 'jquery' ), '1.0.0', true );
451 wp_enqueue_script( 'wpsp_wp_admin_jquery28', WPSP_PLUGIN_URL . 'js/wpsp-settings.js', array( 'jquery' ), '1.0.0', true );
452 }
453 if ( $hook === 'wpschoolpress_page_sch-importhistory' ) {
454 wp_enqueue_script( 'wpsp_wp_admin_jquery29', WPSP_PLUGIN_URL . 'js/wpsp-importhistory.js', array( 'jquery' ), '1.0.0', true );
455 }
456 if ( $hook === 'wpschoolpress_page_sch-transport' ) {
457 wp_enqueue_script( 'wpsp_wp_admin_jquery30', WPSP_PLUGIN_URL . 'js/wpsp-transport.js', array( 'jquery' ), '1.0.0', true );
458 }
459 if ( $hook === 'wpschoolpress_page_sch-teacherattendance' ) {
460 wp_enqueue_script( 'wpsp_wp_admin_jquery31', WPSP_PLUGIN_URL . 'js/wpsp-teacherattendance.js', array( 'jquery' ), '1.0.0', true );
461 }
462 if ( $hook === 'wpschoolpress_page_sch-notify' ) {
463 wp_enqueue_script( 'wpsp_wp_admin_jquery32', WPSP_PLUGIN_URL . 'js/wpsp-notify.js', array( 'jquery' ), '1.0.0', true );
464 }
465 if ( $hook === 'wpschoolpress_page_sch-events' ) {
466 wp_enqueue_script( 'wpsp_wp_admin_jquery33', WPSP_PLUGIN_URL . 'plugins/fullcalendar/moment.min.js', array( 'jquery' ), '1.0.0', true );
467 wp_enqueue_script( 'wpsp_wp_admin_jquery34', WPSP_PLUGIN_URL . 'plugins/fullcalendar/fullcalendar.min.js', array( 'jquery' ), '1.0.0', true );
468 wp_enqueue_script( 'wpsp_wp_admin_jquery35', WPSP_PLUGIN_URL . 'plugins/timepicker/bootstrap-timepicker.js', array( 'jquery' ), '1.0.0', true );
469 wp_enqueue_script( 'wpsp_wp_admin_jquery36', WPSP_PLUGIN_URL . 'js/wpsp-events.js', array( 'jquery' ), '1.0.0', true );
470 }
471 if ( $hook === 'wpschoolpress_page_sch-messages' ) {
472 wp_enqueue_script( 'wpsp_wp_admin_jquery39', WPSP_PLUGIN_URL . 'js/wpsp-messages.js', array( 'jquery' ), '1.0.0', true );
473 }
474 if ( $hook === 'wpschoolpress_page_sch-changepassword' ) {
475 wp_enqueue_script( 'wpsp_wp_admin_jquery40', WPSP_PLUGIN_URL . 'js/wpsp-changepassword.js', array( 'jquery' ), '1.0.0', true );
476 }
477 if ( $hook === 'wpschoolpress_page_sch-payment' ) {
478 wp_enqueue_script( 'wpsp_wp_admin_jquery41', WPSP_PLUGIN_URL . 'plugins/multiselect/jquery.multiselect.js', array( 'jquery' ), '1.0.0', true );
479 }
480 if ( $hook === 'wpschoolpress_page_sch-leavecalendar' ) {
481 wp_enqueue_script( 'wpsp_wp_admin_jquery42', WPSP_PLUGIN_URL . 'js/wpsp-leavecalendar.js', array( 'jquery' ), '1.0.0', true );
482 }
483 if ( $hook === 'wpschoolpress_page_sch-addons' || $hook === 'wpschoolpress_page_sch-customization' ) {
484 wp_register_style( 'wpsp_addons_customization', WPSP_PLUGIN_URL . 'css/wpsp-addons-customization.css', false, WPSP_PLUGIN_VERSION );
485 wp_enqueue_style( 'wpsp_addons_customization' );
486 }
487 if ( $hook === 'wpschoolpress_page_sch-customization' ) {
488 wp_enqueue_script( 'wpsp_customization_js', WPSP_PLUGIN_URL . 'js/wpsp-customization.js', array( 'jquery' ), WPSP_PLUGIN_VERSION, true );
489 wp_localize_script( 'wpsp_customization_js', 'wpspCustomization', array(
490 'ajax_url' => admin_url( 'admin-ajax.php' ),
491 'i18n' => array(
492 'sending' => esc_html__( 'Sending...', 'wpschoolpress' ),
493 'submit' => esc_html__( 'Submit Request', 'wpschoolpress' ),
494 'error' => esc_html__( 'Something went wrong. Please try again.', 'wpschoolpress' ),
495 'name_error' => esc_html__( 'Please enter a valid name (min 2 characters).', 'wpschoolpress' ),
496 'email_error' => esc_html__( 'Please enter a valid email address.', 'wpschoolpress' ),
497 'type_error' => esc_html__( 'Please select a customization type.', 'wpschoolpress' ),
498 'subject_error' => esc_html__( 'Please enter a subject (min 5 characters).', 'wpschoolpress' ),
499 'desc_error' => esc_html__( 'Please enter a description (min 20 characters).', 'wpschoolpress' ),
500 ),
501 ) );
502 }
503 }
504 /*
505 * Add pages in menu default
506 * @package WPSchoolPress
507 * @since 2.0.0
508 */
509 function wpsp_add_adminbar()
510 {
511 global $wp_admin_bar;
512 $wpsp_wpschooldashboard_url = site_url() . '/wp-admin/admin.php?page=sch-dashboard';
513 $wpsp_wpschoolstudent_url = site_url() . '/wp-admin/admin.php?page=sch-student';
514 $wpsp_wpschoolteacher_url = site_url() . '/wp-admin/admin.php?page=sch-teacher';
515 $wpsp_wpschoolclass_url = site_url() . '/wp-admin/admin.php?page=sch-class';
516 $wpsp_wpschoolparent_url = site_url() . '/wp-admin/admin.php?page=sch-parent';
517 $wp_admin_bar->add_menu(array(
518 'parent' => false,
519 'id' => 'dashboard',
520 'title' => __('WPSchoolPress Dashboard','wpschoolpress') ,
521 'href' => $wpsp_wpschooldashboard_url
522 ));
523 $wp_admin_bar->add_menu(array(
524 'parent' => 'dashboard',
525 'id' => 'teacher',
526 'title' => __('Teacher','wpschoolpress') ,
527 'href' => $wpsp_wpschoolteacher_url
528 ));
529 $wp_admin_bar->add_menu(array(
530 'parent' => 'dashboard',
531 'id' => 'student',
532 'title' => __('Student','wpschoolpress') ,
533 'href' => $wpsp_wpschoolstudent_url
534 ));
535 $wp_admin_bar->add_menu(array(
536 'parent' => 'dashboard',
537 'id' => 'class',
538 'title' => __('Class','wpschoolpress') ,
539 'href' => $wpsp_wpschoolclass_url
540 ));
541 $wp_admin_bar->add_menu(array(
542 'parent' => 'dashboard',
543 'id' => 'parent',
544 'title' => __('Parent','wpschoolpress') ,
545 'href' => $wpsp_wpschoolparent_url
546 ));
547 }
548 function add_hooks()
549 {
550 function wpsp_custom_loginlogo()
551 {
552 global $current_user, $wpdb, $wpsp_settings_data, $post, $current_user_name;
553 $url = plugin_dir_url( __FILE__ ) . 'img/wpschoolpresslogo.jpg';
554 $imglogo = isset( $wpsp_settings_data['sch_logo'] ) ? sanitize_text_field( $wpsp_settings_data['sch_logo'] ) : $url;
555 echo '<style type="text/css">
556 .login h1 a {background-image: url(' . esc_url( $imglogo ) . ') !important; }
557 </style>';
558 }
559 // Add menu page for purchase code validation
560 add_action('admin_menu', array(
561 $this,
562 'wpsp_admin_menu'
563 ));
564 add_action('login_enqueue_scripts', 'wpsp_custom_loginlogo');
565 // Add css and js
566 add_action('admin_enqueue_scripts', array(
567 $this,
568 'wpsp_add_admin_scripts'
569 ));
570 // Add pages into admin menu
571 add_action('wp_before_admin_bar_render', array(
572 $this,
573 'wpsp_add_adminbar'
574 ));
575 }
576 }