includes(); add_filter( 'set-screen-option', array( $this, 'save_screen_options' ), 10, 3 ); // Add a column in users list to show if it's a service provider add_filter( 'manage_users_custom_column', array( $this, 'render_provider_user_column' ), 10, 3 ); add_filter( 'manage_users_columns', array( $this, 'add_users_columns' ) ); add_action( 'admin_menu', array( $this, 'admin_init' ) ); // Creates admin settings window add_action( 'admin_notices', array( $this, 'admin_notices' ) ); // Warns admin add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) ); // Load scripts add_action( 'admin_enqueue_scripts', array( $this, 'edit_posts_scripts' ) ); add_action( 'admin_print_styles', array( $this, 'admin_css' ) ); add_action( 'admin_notices', array( $this, 'admin_notices_new' ) ); add_action( 'wp_ajax_appointments_dismiss_notice', array( $this, 'dismiss_notice' ) ); // Add quick link to plugin settings from plugins list page. add_filter( 'plugin_action_links_' . plugin_basename( APP_PLUGIN_FILE ), array( $this, 'add_settings_link' ) ); new Appointments_Admin_Dashboard_Widget(); $this->user_profile = new Appointments_Admin_User_Profile(); include( APP_PLUGIN_DIR . '/admin/admin-helpers.php' ); } private function includes() { include_once( appointments_plugin_dir() . 'admin/class-app-list-table.php' ); include_once( appointments_plugin_dir() . 'admin/widgets/class-app-dashboard-widget.php' ); include_once( appointments_plugin_dir() . 'admin/class-app-admin-user-profile.php' ); } public function save_screen_options( $status, $option, $value ) { if ( 'appointments_records_per_page' == $option ) { return $value; } return $status; } public function add_users_columns( $columns ) { $columns['provider'] = __( 'Appointments Provider', 'appointments' ); return $columns; } public function render_provider_user_column( $content, $column, $user_id ) { if ( 'provider' === $column && appointments_is_worker( $user_id ) && App_Roles::get_capability( 'manage_options', App_Roles::CTX_PAGE_SHORTCODES ) ) { $link = admin_url( 'admin.php?page=app_settings&tab=workers' ); $content = ' ' . __( 'Edit', 'appointments' ) . ''; } return $content; } public function admin_notices_new() { $notices = _appointments_get_admin_notices(); $noticed = false; foreach ( $notices as $notice_slug => $notice ) { if ( ! current_user_can( $notice['cap'] ) ) { continue; } $user_dismissed_notices = _appointments_get_user_dismissed_notices( get_current_user_id() ); if ( $notice_text = _appointments_get_admin_notice( $notice_slug ) ) { if ( in_array( $notice_slug, $user_dismissed_notices ) ) { continue; } $noticed = true; ?>
plugin_url . '/css/admin.css', false, $appointments->version ); $screen = get_current_screen(); $title = sanitize_title( __( 'Appointments', 'appointments' ) ); $allow_profile = ! empty( $appointments->options['allow_worker_wh'] ) && 'yes' == $appointments->options['allow_worker_wh']; if ( empty( $screen->base ) || ( ! preg_match( '/(^|\b|_)appointments($|\b|_)/', $screen->base ) && ! preg_match( '/(^|\b|_)' . preg_quote( $title, '/' ) . '($|\b|_)/', $screen->base ) // Super-weird admin screen base being translatable!!! && ( ! $allow_profile || ! preg_match( '/profile/', $screen->base ) || ! (defined( 'IS_PROFILE_PAGE' ) && IS_PROFILE_PAGE)) ) ) { return; } wp_enqueue_style( 'jquery-colorpicker-css', $appointments->plugin_url . '/css/colorpicker.css', false, $appointments->version ); wp_enqueue_style( 'jquery-datepick', $appointments->plugin_url . '/css/jquery.datepick.css', false, $appointments->version ); wp_enqueue_style( 'jquery-multiselect', $appointments->plugin_url . '/css/jquery.multiselect.css', false, $appointments->version ); do_action( 'app-admin-admin_styles' ); } function edit_posts_scripts() { $screen = get_current_screen(); if ( $screen->base === 'post' || $screen->base === 'edit' ) { _appointments_enqueue_jquery_ui_datepicker(); } } // Enqeue js on admin pages function admin_scripts() { global $appointments; $screen = get_current_screen(); $title = sanitize_title( __( 'Appointments', 'appointments' ) ); $allow_profile = ! empty( $appointments->options['allow_worker_wh'] ) && 'yes' == $appointments->options['allow_worker_wh']; if ( empty( $screen->base ) ) { return false; } if ( ! preg_match( '/(^|\b|_)appointments($|\b|_)/', $screen->base ) && ! preg_match( '/(^|\b|_)' . preg_quote( $title, '/' ) . '($|\b|_)/', $screen->base ) // Super-weird admin screen base being translatable!!! && ( ! $allow_profile || ! preg_match( '/profile/', $screen->base ) || ! ( defined( 'IS_PROFILE_PAGE' ) && IS_PROFILE_PAGE ) ) && 'user-edit' !== $screen->base ) { return false; } _appointments_enqueue_jquery_ui_datepicker(); wp_enqueue_script( 'jquery-colorpicker', $appointments->plugin_url . '/js/colorpicker.js', array( 'jquery' ), $appointments->version ); wp_enqueue_script( 'app-multi-datepicker', appointments_plugin_url() . 'admin/js/admin-multidatepicker.js', array( 'jquery-ui-datepicker' ), appointments_get_db_version(), true ); wp_enqueue_script( 'jquery-multiselect', $appointments->plugin_url . '/includes/external/jquery-ui-multiselect-widget/src/jquery.multiselect.min.js', array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position' ), '2.0.1' ); // Make a locale check to update locale_error flag if ( empty( $appointments->options['disable_js_check_admin'] ) ) { wp_enqueue_script( 'app-js-check', $appointments->plugin_url . '/js/js-check.js', array( 'jquery' ), $appointments->version ); } wp_enqueue_script( 'appointments-admin', $appointments->plugin_url . '/admin/js/admin.js', array( 'jquery' ), $appointments->version ); wp_localize_script('appointments-admin', '_app_admin_data', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'strings' => array( 'preparing_export' => __( 'Preparing for export, please hold on...', 'appointments' ), ), )); do_action( 'app-admin-admin_scripts' ); } /** * Dismiss warning messages for the current user for the session * @since 1.1.7 */ function dismiss() { global $current_user; $keys = array( 'app_dismiss', 'app_dismiss_google', 'app_dismiss_confirmation_lacking', 'app_dismiss_app_paypal_lacking' ); foreach ( $keys as $key ) { if ( isset( $_REQUEST[ $key ] ) ) { update_user_meta( $current_user->ID, $key, true ); ?>' . __( '[Appointments+] You must define at least once service.', 'appointments' ) . '
' . __( '[Appointments+] One of your services has a duration smaller than time base. Please visit Services tab and after making your corrections save new settings.', 'appointments' ) . '
' . __( '[Appointments+] One of your services is not divisible by the time base. Please visit Services tab and after making your corrections save new settings.', 'appointments' ) . '
' . __( '[Appointments+] One of your services has a duration greater than 24 hours. Appointments+ does not support services exceeding 1440 minutes (24 hours). ', 'appointments' ) . '
' . __( '[Appointments+] One of your services does not have a service provider assigned. Delete services you are not using.', 'appointments' ) . ' '.__( 'Dismiss', 'appointments' ).''. '
' . __( '[Appointments+] Appointments+ database tables need to be updated. Please deactivate and reactivate the plugin (DO NOT DELETE the plugin). You will not lose any saved information.', 'appointments' ) . '
' . __( '[Appointments+] More than one instance of services, service providers, confirmation, Paypal or login shortcodes on the same page may cause problems.
', 'appointments' ). '' . __( '[Appointments+] Confirmation shortcode [app_confirmation] is always required to complete an appointment.', 'appointments' ) . ' '.__( 'Dismiss', 'appointments' ).''. '
' . __( '[Appointments+] Paypal shortcode [app_paypal] is always required to complete an appointment with pending status.', 'appointments' ) . ' '.__( 'Dismiss', 'appointments' ).''. '
