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

575 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 = 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', 'sch-addons',
184 array( $this, 'wpsp_addons' )
185 );
186 add_submenu_page( 'wpschoolpress', 'wpschoolpress', '<i class="fa fa-pencil-square-o"></i>&nbsp; Customization',
187 'manage_options', 'sch-customization',
188 array( $this, 'wpsp_customization' )
189 );
190 }
191 /*
192 * Call html of purchase code validation and contact
193 * @package WPSchoolPress
194 * @since 2.0.0
195 */
196 function wpsp_admin_details()
197 {
198 require_once (WPSP_PLUGIN_PATH . 'lib/wpsp-admin-options.php');
199 }
200 function wpsp_addons()
201 {
202 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-addons.php');
203 }
204 function wpsp_customization()
205 {
206 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-customization.php');
207 }
208 function wpsp_callback_dashboard()
209 {
210 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-dashboard.php');
211 }
212 function wpsp_callback_payment()
213 {
214 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-payment.php');
215 }
216 function wpsp_callback_editprofile()
217 {
218 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-editprofile.php');
219 }
220 function wpsp_callback_students()
221 {
222 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-student.php');
223 }
224 function wpsp_callback_request()
225 {
226 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-registration-request.php');
227 }
228 function wpsp_callback_teachers()
229 {
230 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-teacher.php');
231 }
232 function wpsp_callback_messages()
233 {
234 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-messages.php');
235 }
236 function wpsp_callback_parents()
237 {
238 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-parent.php');
239 }
240 function wpsp_callback_classes()
241 {
242 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-class.php');
243 }
244 function wpsp_callback_attendance()
245 {
246 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-attendance.php');
247 }
248 function wpsp_callback_subject()
249 {
250 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-subject.php');
251 }
252 function wpsp_callback_marks()
253 {
254 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-marks.php');
255 }
256 function wpsp_callback_exams()
257 {
258 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-exams.php');
259 }
260 function wpsp_callback_events()
261 {
262 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-events.php');
263 }
264 function wpsp_callback_timetable()
265 {
266 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-timetable.php');
267 }
268 function wpsp_callback_importhistory()
269 {
270 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-importhistory.php');
271 }
272 function wpsp_callback_notify()
273 {
274 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-notify.php');
275 }
276 function wpsp_callback_transport()
277 {
278 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-transport.php');
279 }
280 function wpsp_callback_teacherattendance()
281 {
282 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-teacher-attendance.php');
283 }
284 function wpsp_callback_settings()
285 {
286 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-settings.php');
287 }
288 function wpsp_callback_changepassword()
289 {
290 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-changepassword.php');
291 }
292 function wpsp_callback_leavecalendar()
293 {
294 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-leavecalendar.php');
295 }
296 function wpsp_callback_schhistory()
297 {
298 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-history.php');
299 }
300
301 function wpsp_callback_posts()
302 {
303 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-posts.php');
304 }
305 function wpsp_callback_postsprofile()
306 {
307 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-postsprofile.php');
308 }
309 function wpsp_callback_reported_post()
310 {
311 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-reportedposts.php');
312 }
313 function wpsp_callback_posts_notification()
314 {
315 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-posts-notification.php');
316 }
317 function wpsp_callback_documents()
318 {
319 require_once (WPSP_PLUGIN_PATH . 'pages/wpsp-documents.php');
320 }
321 /*
322 * Add required css and js for purchase code validation page
323 * @package WPSchoolPress
324 * @since 2.0.0
325 */
326 function wpsp_add_admin_scripts($hook)
327 {
328 // ── Only load WPSP assets on WPSP admin screens ──────────────────────────
329 // All sub-pages register under 'wpschoolpress_page_sch-*'.
330 // The top-level entry uses 'toplevel_page_wpschoolpress'.
331 // Every other admin screen (Posts, Pages, Plugins, etc.) bails here.
332 $is_wpsp_page = (
333 $hook === 'toplevel_page_wpschoolpress' ||
334 strpos( $hook, 'wpschoolpress_page_sch-' ) === 0
335 );
336
337 if ( ! $is_wpsp_page ) {
338 return;
339 }
340
341 // wpsp_check_pro_version() is already statically cached inside the function
342 // itself so calling it here costs nothing on subsequent calls this request.
343 $prohistory = wpsp_check_pro_version( 'wpsp_mc_version' );
344 $prodisablehistory = ! $prohistory['status'] ? 'notinstalled' : 'installed';
345
346 // ── Core CSS (every WPSP page) ───────────────────────────────────────────
347 wp_register_style( 'wpsp_wp_admin_font_awesome', WPSP_PLUGIN_URL . 'css/font-awesome.min.css', false, '1.0.0' );
348 wp_enqueue_style( 'wpsp_wp_admin_font_awesome' );
349 wp_register_style( 'wpsp_wp_admin_ionicons', WPSP_PLUGIN_URL . 'css/ionicons.min.css', false, '1.0.0' );
350 wp_enqueue_style( 'wpsp_wp_admin_ionicons' );
351 wp_register_style( 'wpsp_wp_admin_wpsp-grid', WPSP_PLUGIN_URL . 'css/wpsp-grid.css', false, '1.0.0' );
352 wp_enqueue_style( 'wpsp_wp_admin_wpsp-grid' );
353 wp_register_style( 'wpsp_wp_admin_dataTablesresp', WPSP_PLUGIN_URL . 'css/datepicker.min.css', false, '1.0.0' );
354 wp_enqueue_style( 'wpsp_wp_admin_dataTablesresp' );
355 wp_register_style( 'wpsp_wp_admin_dataTablesbootresp2', WPSP_PLUGIN_URL . 'plugins/datatables/responsive.bootstrap.min.css', false, '1.0.0' );
356 wp_enqueue_style( 'wpsp_wp_admin_dataTablesbootresp2' );
357 wp_register_style( 'wpsp_wp_admin_wpsp-icons', WPSP_PLUGIN_URL . 'css/wpsp-icons.css', false, '1.0.0' );
358 wp_enqueue_style( 'wpsp_wp_admin_wpsp-icons' );
359 wp_register_style( 'wpsp_wp_admin_wpsp-widget', WPSP_PLUGIN_URL . 'css/wpsp-widget.css', false, '1.0.0' );
360 wp_enqueue_style( 'wpsp_wp_admin_wpsp-widget' );
361 wp_register_style( 'wpsp_wp_admin_wpsp-style', WPSP_PLUGIN_URL . 'css/wpsp-style.css', false, '1.0.0' );
362 wp_enqueue_style( 'wpsp_wp_admin_wpsp-style' );
363 wp_register_style( 'wpsp_wp_admin_wpsp-style-resposive', WPSP_PLUGIN_URL . 'css/wpsp-resposive.css', false, '1.0.0' );
364 wp_enqueue_style( 'wpsp_wp_admin_wpsp-style-resposive' );
365 wp_register_style( 'wpsp_wp_admin_wpsp-style-select', WPSP_PLUGIN_URL . 'css/bootstrap-select.min.css', false, '1.0.0' );
366 wp_enqueue_style( 'wpsp_wp_admin_wpsp-style-select' );
367 wp_register_style( 'wpsp_wp_admin_wpsp-style-multiselect', WPSP_PLUGIN_URL . 'css/bootstrap-multiselect.css', false, '1.0.0' );
368 wp_enqueue_style( 'wpsp_wp_admin_wpsp-style-multiselect' );
369
370 // ── Page-specific CSS ────────────────────────────────────────────────────
371 if ( $hook === 'wpschoolpress_page_sch-dashboard' ) {
372 wp_register_style( 'wpsp_wp_admin_fullcalendar', WPSP_PLUGIN_URL . 'plugins/fullcalendar/fullcalendar.min.css', false, '1.0.0' );
373 wp_enqueue_style( 'wpsp_wp_admin_fullcalendar' );
374 }
375 if ( $hook === 'wpschoolpress_page_sch-events' ) {
376 wp_register_style( 'wpsp_wp_admin_fullcalendar', WPSP_PLUGIN_URL . 'plugins/fullcalendar/fullcalendar.min.css', false, '1.0.0' );
377 wp_enqueue_style( 'wpsp_wp_admin_fullcalendar' );
378 wp_register_style( 'wpsp_wp_admin_timepicker', WPSP_PLUGIN_URL . 'plugins/timepicker/bootstrap-timepicker.css', false, '1.0.0' );
379 wp_enqueue_style( 'wpsp_wp_admin_timepicker' );
380 }
381 if ( $hook === 'wpschoolpress_page_sch-settings' || $hook === 'wpschoolpress_page_sch-teacher' ) {
382 wp_register_style( 'wpsp_wp_admin_boottimepicker', WPSP_PLUGIN_URL . 'plugins/timepicker/bootstrap-timepicker.css', false, '1.0.0' );
383 wp_enqueue_style( 'wpsp_wp_admin_boottimepicker' );
384 }
385 if ( $hook === 'wpschoolpress_page_sch-messages' || $hook === 'wpschoolpress_page_sch-parent' ) {
386 wp_register_style( 'wpsp_wp_admin_multiselect', WPSP_PLUGIN_URL . 'plugins/multiselect/jquery.multiselect.css', false, '1.0.0' );
387 wp_enqueue_style( 'wpsp_wp_admin_multiselect' );
388 }
389
390 // ── Core JS (every WPSP page) ────────────────────────────────────────────
391 wp_enqueue_script( 'wpsp_wp_admin_jquery2', WPSP_PLUGIN_URL . 'js/lib/bootstrap.min.js', array( 'jquery' ), '1.0.0', true );
392 wp_enqueue_script( 'wpsp_wp_admin_jquery303', WPSP_PLUGIN_URL . 'js/bootstrap-multiselect.js', array( 'jquery' ), '1.0.0', true );
393 wp_enqueue_script( 'wpsp_wp_admin_jquery1', WPSP_PLUGIN_URL . 'plugins/otherjs/wpsp.validate.min.js', array( 'jquery' ), '1.0.0', true );
394 wp_enqueue_script( 'wpsp_wp_admin_jquery90', WPSP_PLUGIN_URL . 'js/wpsp-wp-admin.js', array( 'jquery' ), '1.0.0', true );
395 wp_enqueue_script( 'wpsp_wp_admin_jquery4', WPSP_PLUGIN_URL . 'js/lib/app.js', array( 'jquery' ), '1.0.0', true );
396 wp_enqueue_script( 'wpsp_wp_admin_jquery6', WPSP_PLUGIN_URL . 'plugins/slimScroll/jquery.slimscroll.min.js', array( 'jquery' ), '1.0.0', true );
397 wp_enqueue_script( 'wpsp_wp_admin_jquery7', WPSP_PLUGIN_URL . 'js/bootstrap-datepicker.min.js', array( 'jquery' ), '1.0.0', true );
398 wp_enqueue_script( 'wpsp_wp_admin_jquery100', WPSP_PLUGIN_URL . 'js/wpsp-settingtab.js', array( 'jquery' ), '1.0.0', true );
399 wp_enqueue_script( 'wpsp_wp_admin_jquery8', WPSP_PLUGIN_URL . 'plugins/datatables/jquery.datatables.js', array( 'jquery' ), '1.0.0', true );
400 wp_enqueue_script( 'wpsp_wp_admin_jquery999', WPSP_PLUGIN_URL . 'js/wpsp-custome.js', array( 'jquery' ), '1.0.0', true );
401
402 // ── Page-specific JS ─────────────────────────────────────────────────────
403 if ( $hook === 'wpschoolpress_page_sch-request' ) {
404 wp_enqueue_script( 'wpsp_wp_admin_jquery1011', WPSP_PLUGIN_URL . 'js/wpsp-sch-request.js', array( 'jquery' ), '1.0.0', true );
405 }
406 if ( $hook === 'wpschoolpress_page_sch-dashboard' ) {
407 wp_enqueue_script( 'wpsp_wp_admin_jquery10', WPSP_PLUGIN_URL . 'plugins/fullcalendar/moment.min.js', array( 'jquery' ), '1.0.0', true );
408 wp_enqueue_script( 'wpsp_wp_admin_jquery11', WPSP_PLUGIN_URL . 'plugins/fullcalendar/fullcalendar.min.js', array( 'jquery' ), '1.0.0', true );
409 wp_enqueue_script( 'wpsp_wp_admin_jquery12', WPSP_PLUGIN_URL . 'plugins/timepicker/bootstrap-timepicker.js', array( 'jquery' ), '1.0.0', true );
410 wp_enqueue_script( 'wpsp_wp_admin_jquery13', WPSP_PLUGIN_URL . 'js/wpsp-dashboard.js', array( 'jquery' ), '1.0.0', true );
411 }
412 if ( $hook === 'wpschoolpress_page_sch-student' ) {
413 wp_enqueue_script( 'wpsp_wp_admin_jquery171', WPSP_PLUGIN_URL . 'js/wpsp-student.js', array( 'jquery' ), '1.0.0', true );
414 if ( $prodisablehistory === 'installed' ) {
415 wp_enqueue_script( 'wpsp_wp_admin_jquery007', WPSP_PLUGIN_URL . 'js/wpsp-custom-multicls.js', array( 'jquery' ), '1.0.0', true );
416 }
417 }
418 if ( $hook === 'wpschoolpress_page_sch-editprofile' ) {
419 wp_enqueue_script( 'wpsp_wp_admin_jquery17', WPSP_PLUGIN_URL . 'js/wpsp-editprofile.js', array( 'jquery' ), '1.0.0', true );
420 }
421 if ( $hook === 'wpschoolpress_page_sch-teacher' ) {
422 wp_enqueue_script( 'wpsp_wp_admin_jquery18', WPSP_PLUGIN_URL . 'js/wpsp-teacher.js', array( 'jquery' ), '1.0.0', true );
423 }
424 if ( $hook === 'wpschoolpress_page_sch-parent' ) {
425 wp_enqueue_script( 'wpsp_wp_admin_jquery19', WPSP_PLUGIN_URL . 'js/wpsp-parent.js', array( 'jquery' ), '1.0.0', true );
426 }
427 if ( $hook === 'wpschoolpress_page_sch-class' ) {
428 wp_enqueue_script( 'wpsp_wp_admin_jquery20', WPSP_PLUGIN_URL . 'js/wpsp-class.js', array( 'jquery' ), '1.0.0', true );
429 }
430 if ( $hook === 'wpschoolpress_page_sch-attendance' ) {
431 wp_enqueue_script( 'wpsp_wp_admin_jquery21', WPSP_PLUGIN_URL . 'js/wpsp-attendance.js', array( 'jquery' ), '1.0.0', true );
432 }
433 if ( $hook === 'wpschoolpress_page_sch-subject' ) {
434 wp_enqueue_script( 'wpsp_wp_admin_jquery22', WPSP_PLUGIN_URL . 'js/wpsp-subject.js', array( 'jquery' ), '1.0.0', true );
435 }
436 if ( $hook === 'wpschoolpress_page_sch-exams' ) {
437 wp_enqueue_script( 'wpsp_wp_admin_jquery23', WPSP_PLUGIN_URL . 'js/wpsp-exam.js', array( 'jquery' ), '1.0.0', true );
438 }
439 if ( $hook === 'wpschoolpress_page_sch-marks' ) {
440 wp_enqueue_script( 'wpsp_wp_admin_jquery24', WPSP_PLUGIN_URL . 'js/wpsp-mark.js', array( 'jquery' ), '1.0.0', true );
441 }
442 if ( $hook === 'wpschoolpress_page_sch-timetable' ) {
443 wp_deregister_script( 'jquery-ui-core' );
444 wp_enqueue_script( 'wpsp_wp_admin_jquery25', WPSP_PLUGIN_URL . 'plugins/otherui/wpsp_easyui.min.js', array( 'jquery' ), '1.0.0', true );
445 wp_enqueue_script( 'wpsp_wp_admin_jquery201', WPSP_PLUGIN_URL . 'js/lib/jquery.draggable.js', array( 'jquery' ), '1.0.0', true );
446 wp_enqueue_script( 'wpsp_wp_admin_jquery26', WPSP_PLUGIN_URL . 'js/wpsp_timetable.js', array( 'jquery' ), '1.0.0', true );
447 }
448 if ( $hook === 'wpschoolpress_page_sch-settings' ) {
449 wp_enqueue_script( 'wpsp_wp_admin_jquery27', WPSP_PLUGIN_URL . 'plugins/timepicker/bootstrap-timepicker.js', array( 'jquery' ), '1.0.0', true );
450 wp_enqueue_script( 'wpsp_wp_admin_jquery28', WPSP_PLUGIN_URL . 'js/wpsp-settings.js', array( 'jquery' ), '1.0.0', true );
451 }
452 if ( $hook === 'wpschoolpress_page_sch-importhistory' ) {
453 wp_enqueue_script( 'wpsp_wp_admin_jquery29', WPSP_PLUGIN_URL . 'js/wpsp-importhistory.js', array( 'jquery' ), '1.0.0', true );
454 }
455 if ( $hook === 'wpschoolpress_page_sch-transport' ) {
456 wp_enqueue_script( 'wpsp_wp_admin_jquery30', WPSP_PLUGIN_URL . 'js/wpsp-transport.js', array( 'jquery' ), '1.0.0', true );
457 }
458 if ( $hook === 'wpschoolpress_page_sch-teacherattendance' ) {
459 wp_enqueue_script( 'wpsp_wp_admin_jquery31', WPSP_PLUGIN_URL . 'js/wpsp-teacherattendance.js', array( 'jquery' ), '1.0.0', true );
460 }
461 if ( $hook === 'wpschoolpress_page_sch-notify' ) {
462 wp_enqueue_script( 'wpsp_wp_admin_jquery32', WPSP_PLUGIN_URL . 'js/wpsp-notify.js', array( 'jquery' ), '1.0.0', true );
463 }
464 if ( $hook === 'wpschoolpress_page_sch-events' ) {
465 wp_enqueue_script( 'wpsp_wp_admin_jquery33', WPSP_PLUGIN_URL . 'plugins/fullcalendar/moment.min.js', array( 'jquery' ), '1.0.0', true );
466 wp_enqueue_script( 'wpsp_wp_admin_jquery34', WPSP_PLUGIN_URL . 'plugins/fullcalendar/fullcalendar.min.js', array( 'jquery' ), '1.0.0', true );
467 wp_enqueue_script( 'wpsp_wp_admin_jquery35', WPSP_PLUGIN_URL . 'plugins/timepicker/bootstrap-timepicker.js', array( 'jquery' ), '1.0.0', true );
468 wp_enqueue_script( 'wpsp_wp_admin_jquery36', WPSP_PLUGIN_URL . 'js/wpsp-events.js', array( 'jquery' ), '1.0.0', true );
469 }
470 if ( $hook === 'wpschoolpress_page_sch-messages' ) {
471 wp_enqueue_script( 'wpsp_wp_admin_jquery39', WPSP_PLUGIN_URL . 'js/wpsp-messages.js', array( 'jquery' ), '1.0.0', true );
472 }
473 if ( $hook === 'wpschoolpress_page_sch-changepassword' ) {
474 wp_enqueue_script( 'wpsp_wp_admin_jquery40', WPSP_PLUGIN_URL . 'js/wpsp-changepassword.js', array( 'jquery' ), '1.0.0', true );
475 }
476 if ( $hook === 'wpschoolpress_page_sch-payment' ) {
477 wp_enqueue_script( 'wpsp_wp_admin_jquery41', WPSP_PLUGIN_URL . 'plugins/multiselect/jquery.multiselect.js', array( 'jquery' ), '1.0.0', true );
478 }
479 if ( $hook === 'wpschoolpress_page_sch-leavecalendar' ) {
480 wp_enqueue_script( 'wpsp_wp_admin_jquery42', WPSP_PLUGIN_URL . 'js/wpsp-leavecalendar.js', array( 'jquery' ), '1.0.0', true );
481 }
482 if ( $hook === 'wpschoolpress_page_sch-addons' || $hook === 'wpschoolpress_page_sch-customization' ) {
483 wp_register_style( 'wpsp_addons_customization', WPSP_PLUGIN_URL . 'css/wpsp-addons-customization.css', false, WPSP_PLUGIN_VERSION );
484 wp_enqueue_style( 'wpsp_addons_customization' );
485 }
486 if ( $hook === 'wpschoolpress_page_sch-customization' ) {
487 wp_enqueue_script( 'wpsp_customization_js', WPSP_PLUGIN_URL . 'js/wpsp-customization.js', array( 'jquery' ), WPSP_PLUGIN_VERSION, true );
488 wp_localize_script( 'wpsp_customization_js', 'wpspCustomization', array(
489 'ajax_url' => admin_url( 'admin-ajax.php' ),
490 'i18n' => array(
491 'sending' => esc_html__( 'Sending...', 'wpschoolpress' ),
492 'submit' => esc_html__( 'Submit Request', 'wpschoolpress' ),
493 'error' => esc_html__( 'Something went wrong. Please try again.', 'wpschoolpress' ),
494 'name_error' => esc_html__( 'Please enter a valid name (min 2 characters).', 'wpschoolpress' ),
495 'email_error' => esc_html__( 'Please enter a valid email address.', 'wpschoolpress' ),
496 'type_error' => esc_html__( 'Please select a customization type.', 'wpschoolpress' ),
497 'subject_error' => esc_html__( 'Please enter a subject (min 5 characters).', 'wpschoolpress' ),
498 'desc_error' => esc_html__( 'Please enter a description (min 20 characters).', 'wpschoolpress' ),
499 ),
500 ) );
501 }
502 }
503 /*
504 * Add pages in menu default
505 * @package WPSchoolPress
506 * @since 2.0.0
507 */
508 function wpsp_add_adminbar()
509 {
510 global $wp_admin_bar;
511 $wpsp_wpschooldashboard_url = site_url() . '/wp-admin/admin.php?page=sch-dashboard';
512 $wpsp_wpschoolstudent_url = site_url() . '/wp-admin/admin.php?page=sch-student';
513 $wpsp_wpschoolteacher_url = site_url() . '/wp-admin/admin.php?page=sch-teacher';
514 $wpsp_wpschoolclass_url = site_url() . '/wp-admin/admin.php?page=sch-class';
515 $wpsp_wpschoolparent_url = site_url() . '/wp-admin/admin.php?page=sch-parent';
516 $wp_admin_bar->add_menu(array(
517 'parent' => false,
518 'id' => 'dashboard',
519 'title' => __('WPSchoolPress Dashboard','wpschoolpress') ,
520 'href' => $wpsp_wpschooldashboard_url
521 ));
522 $wp_admin_bar->add_menu(array(
523 'parent' => 'dashboard',
524 'id' => 'teacher',
525 'title' => __('Teacher','wpschoolpress') ,
526 'href' => $wpsp_wpschoolteacher_url
527 ));
528 $wp_admin_bar->add_menu(array(
529 'parent' => 'dashboard',
530 'id' => 'student',
531 'title' => __('Student','wpschoolpress') ,
532 'href' => $wpsp_wpschoolstudent_url
533 ));
534 $wp_admin_bar->add_menu(array(
535 'parent' => 'dashboard',
536 'id' => 'class',
537 'title' => __('Class','wpschoolpress') ,
538 'href' => $wpsp_wpschoolclass_url
539 ));
540 $wp_admin_bar->add_menu(array(
541 'parent' => 'dashboard',
542 'id' => 'parent',
543 'title' => __('Parent','wpschoolpress') ,
544 'href' => $wpsp_wpschoolparent_url
545 ));
546 }
547 function add_hooks()
548 {
549 function wpsp_custom_loginlogo()
550 {
551 global $current_user, $wpdb, $wpsp_settings_data,$post,$current_user_name;
552 $url = plugin_dir_url( __FILE__ ).'img/wpschoolpresslogo.jpg';
553 $imglogo = isset( $wpsp_settings_data['sch_logo'] ) ? sanitize_text_field($wpsp_settings_data['sch_logo']) : $url;
554 echo '<style type="text/css">
555 .login h1 a {background-image: url(' . $imglogo . ') !important; }
556 </style>';
557 }
558 // Add menu page for purchase code validation
559 add_action('admin_menu', array(
560 $this,
561 'wpsp_admin_menu'
562 ));
563 add_action('login_enqueue_scripts', 'wpsp_custom_loginlogo');
564 // Add css and js
565 add_action('admin_enqueue_scripts', array(
566 $this,
567 'wpsp_add_admin_scripts'
568 ));
569 // Add pages into admin menu
570 add_action('wp_before_admin_bar_render', array(
571 $this,
572 'wpsp_add_adminbar'
573 ));
574 }
575 }