PluginProbe
School Management System – WPSchoolPress / 2.2.38
School Management System – WPSchoolPress v2.2.38
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 2.2.38, at wpsp-class-admin.php

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