Browse Source

Add assets to pages and initial admin resource page

develop^2
Sam Black 2 years ago
parent
commit
48fcd01464
Signed by: samwwwblack
GPG Key ID: 0FF0223994EA47D8
  1. 25
      admin/class-bespokomatic-ebs-admin.php
  2. 1
      bespokomatic-ebs.php
  3. 14
      includes/booked/lib/Common/SmartyPage.php
  4. 49
      includes/class-bespokomatic-ebs.php
  5. 8
      includes/templates/globalfooter.tpl
  6. 1
      includes/templates/globalheader.tpl
  7. 14
      public/class-bespokomatic-ebs-public.php

25
admin/class-bespokomatic-ebs-admin.php

@ -88,8 +88,10 @@ class Bespokomatic_Ebs_Admin {
* @since 0.1
*/
public function enqueue_styles() {
$css_admin_prefix = $this->plugin_name . '-css-admin';
$css_admin_booked_prefix = $css_admin_prefix . '-booked';
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/bespokomatic-ebs-admin.css', array(), $this->version, 'all' );
wp_enqueue_style( $css_admin_prefix, plugin_dir_url( __FILE__ ) . 'css/bespokomatic-ebs-admin.css', array(), $this->version, 'all' );
}
@ -181,6 +183,15 @@ class Bespokomatic_Ebs_Admin {
array( $this, 'admin_main' )
);
add_submenu_page(
$this->plugin_name,
'Booked Scheduler Resources',
'Resources',
'manage_options',
$this->plugin_name . '-resources',
array( $this, 'admin_resources' )
);
add_submenu_page(
$this->plugin_name,
'Booked Scheduler Settings',
@ -198,6 +209,18 @@ class Bespokomatic_Ebs_Admin {
require_once plugin_dir_path( __FILE__ ) . 'partials/bespokomatic-ebs-admin-display.php';
}
/**
* Admin resources page
*/
public function admin_resources() {
define( 'ROOT_DIR', BESPOKOMATIC_EBS_BOOKED_PATH );
require_once BESPOKOMATIC_EBS_BOOKED_PATH . 'Pages/Admin/ManageResourcesPage.php';
require_once BESPOKOMATIC_EBS_BOOKED_PATH . 'Presenters/Admin/ManageResourcesPresenter.php';
$page = new ManageResourcesPage();
$page->PageLoad();
}
/**
* Admin settings page
*/

1
bespokomatic-ebs.php

@ -35,6 +35,7 @@ define( 'BESPOKOMATIC_EBS_BOOKED_VERSION', '2.8.4' );
define( 'BESPOKOMATIC_EBS_BOOKED_MAJOR_VERSION', '2.8' );
define( 'BESPOKOMATIC_EBS_BOOKED_PATH', plugin_dir_path( __FILE__ ) . 'includes/booked/' );
define( 'BESPOKOMATIC_EBS_BOOKED_URL', plugins_url( 'includes/booked/Web/', __FILE__ ) );
define( 'BESPOKOMATIC_EBS_TEMPLATES_DIR', plugin_dir_path( __FILE__ ) . 'includes/templates/' );
define( 'BESPOKOMATIC_EBS_BOOKED_DB_VERSION', '2.8.4.20200810' );
define( 'BESPOKOMATIC_EBS_BOOKED_DB_PREFIX', 'bebs' );
define( 'BESPOKOMATIC_EBS_CONFIG_DB_VERSION', 'bebs_db_version' );

14
includes/booked/lib/Common/SmartyPage.php

@ -60,6 +60,11 @@ class SmartyPage extends Smarty
$base = dirname(__FILE__) . '/../../';
$this->debugging = isset($_GET['debug']);
if ( isset($_GET['page']) && strstr( $_GET['page'], BESPOKOMATIC_EBS_NAME )) {
$this->AddTemplateDirectory(BESPOKOMATIC_EBS_TEMPLATES_DIR);
}
$this->AddTemplateDirectory($base . 'tpl');
$this->compile_dir = $base . 'tpl_c';
$this->config_dir = $base . 'configs';
@ -79,7 +84,14 @@ class SmartyPage extends Smarty
}
$this->Resources = &$resources;
$this->RootPath = $rootPath;
if ( isset($_GET['page']) && strstr( $_GET['page'], BESPOKOMATIC_EBS_NAME )) {
$this->RootPath = BESPOKOMATIC_EBS_BOOKED_URL;
}
else
{
$this->RootPath = $rootPath;
}
$this->AddTemplateDirectory($base . 'lang/' . $this->Resources->CurrentLanguage);

49
includes/class-bespokomatic-ebs.php

@ -142,6 +142,49 @@ class Bespokomatic_Ebs {
}
public function enqueue_common_scripts() {
$js_prefix = $this->plugin_name . '-js';
$js_booked_prefix = $js_prefix . '-booked';
// Booked Scheduler common JS
wp_enqueue_script( $js_booked_prefix . '_jquery', BESPOKOMATIC_EBS_BOOKED_URL . 'scripts/js/jquery-3.3.1.min.js', array(), $this->version, false );
wp_enqueue_script( $js_booked_prefix . '_jquery_migrate', BESPOKOMATIC_EBS_BOOKED_URL . 'scripts/js/jquery-migrate-3.0.1.min.js', array( $js_booked_prefix . '_jquery' ), $this->version, false );
wp_enqueue_script( $js_booked_prefix . '_jqueryui', BESPOKOMATIC_EBS_BOOKED_URL . 'scripts/js/jquery-ui.1.12.1.custom.min.js', array( $js_booked_prefix . '_jquery' ), $this->version, false );
wp_enqueue_script( $js_booked_prefix . '_bootstrap', BESPOKOMATIC_EBS_BOOKED_URL . 'scripts/bootstrap/js/bootstrap.min.js', array( $js_booked_prefix . '_jquery' ), $this->version, false );
wp_enqueue_script( $js_booked_prefix . '_jqueryui_timepicker', BESPOKOMATIC_EBS_BOOKED_URL . 'scripts/js/jquery-ui-timepicker-addon.js', array( $js_booked_prefix . '_jqueryui' ), $this->version, false );
}
public function enqueue_common_styles() {
$css_prefix = $this->plugin_name . '-css';
$css_booked_prefix = $css_prefix . '-booked';
// Booked Scheduler common CSS
wp_enqueue_style( $css_booked_prefix . '_jqueryui', BESPOKOMATIC_EBS_BOOKED_URL . 'scripts/css/smoothness/jquery-ui.1.12.1.custom.min.css', array(), $this->version, 'all' );
wp_enqueue_style( $css_booked_prefix . '_fontawesome', BESPOKOMATIC_EBS_BOOKED_URL . 'css/font-awesome-4.7.0/css/font-awesome.min.css', array(), $this->version, 'all' );
wp_enqueue_style( $css_booked_prefix . '_bootstrap', BESPOKOMATIC_EBS_BOOKED_URL . 'scripts/bootstrap/css/bootstrap.css', array(), $this->version, 'all' );
wp_enqueue_style( $css_booked_prefix . '_bootstrap_validator', BESPOKOMATIC_EBS_BOOKED_URL . 'css/bootstrapValidator.min.css', array( $css_booked_prefix . '_bootstrap' ), $this->version, 'all' );
wp_enqueue_style( $css_booked_prefix . '_bootstrap_editable', BESPOKOMATIC_EBS_BOOKED_URL . 'scripts/js/x-editable/css/bootstrap-editable.css', array( $css_booked_prefix . '_bootstrap' ), $this->version, 'all' );
wp_enqueue_style( $css_booked_prefix . '_bootstrap_wysihtml5', BESPOKOMATIC_EBS_BOOKED_URL . 'scripts/js/wysihtml5/bootstrap3-wysihtml5.min.css', array( $css_booked_prefix . '_bootstrap' ), $this->version, 'all' );
wp_enqueue_style( $css_booked_prefix . '_qtip', BESPOKOMATIC_EBS_BOOKED_URL . 'css/jquery.qtip.min.css', array( $css_booked_prefix . '_jqueryui' ), $this->version, 'all' );
wp_enqueue_style( $css_booked_prefix . '_owl_base', BESPOKOMATIC_EBS_BOOKED_URL . 'scripts/js/owl-2.2.1/assets/owl.carousel.min.css', array(), $this->version, 'all' );
wp_enqueue_style( $css_booked_prefix . '_owl_theme', BESPOKOMATIC_EBS_BOOKED_URL . 'scripts/js/owl-2.2.1/assets/owl.theme.default.css', array( $css_booked_prefix . '_owl_base' ), $this->version, 'all' );
wp_enqueue_style( $css_booked_prefix . '_select2', BESPOKOMATIC_EBS_BOOKED_URL . 'scripts/css/select2/select2-4.0.5.min.css', array( $css_booked_prefix . '_jqueryui', $css_booked_prefix . '_bootstrap' ), $this->version, 'all' );
wp_enqueue_style( $css_booked_prefix . '_fullcalendar', BESPOKOMATIC_EBS_BOOKED_URL . 'scripts/css/fullcalendar.min.css', array(), $this->version, 'all' );
wp_enqueue_style( $css_booked_prefix . '_fullcalend_print', BESPOKOMATIC_EBS_BOOKED_URL . 'scripts/css/fullcalendar.print.css', array(), $this->version, 'print' );
wp_enqueue_style( $css_booked_prefix . '_timepicker', BESPOKOMATIC_EBS_BOOKED_URL . 'scripts/css/timePicker.css', array(), $this->version, 'all' );
wp_enqueue_style( $css_booked_prefix . '_jqueryui_timepicker', BESPOKOMATIC_EBS_BOOKED_URL . 'scripts/css/jquery-ui-timepicker-addon.css', array( $css_booked_prefix . '_jqueryui' ), $this->version, 'all' );
wp_enqueue_style( $css_booked_prefix, BESPOKOMATIC_EBS_BOOKED_URL . 'css/booked.css', array(), $this->version, 'all' );
}
/**
* Register all of the hooks related to the admin area functionality
* of the plugin.
@ -153,6 +196,9 @@ class Bespokomatic_Ebs {
$plugin_admin = new Bespokomatic_Ebs_Admin( $this->get_plugin_name(), $this->get_version() );
$this->loader->add_action( 'admin_enqueue_scripts', $this, 'enqueue_common_styles' );
$this->loader->add_action( 'admin_enqueue_scripts', $this, 'enqueue_common_scripts' );
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
@ -175,6 +221,9 @@ class Bespokomatic_Ebs {
$plugin_public = new Bespokomatic_Ebs_Public( $this->get_plugin_name(), $this->get_version() );
$this->loader->add_action( 'admin_enqueue_scripts', $this, 'enqueue_common_styles' );
$this->loader->add_action( 'admin_enqueue_scripts', $this, 'enqueue_common_scripts' );
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );

8
includes/templates/globalfooter.tpl

@ -0,0 +1,8 @@
</div>
<script type="text/javascript">
init();
$.blockUI.defaults.css.border = 'none';
$.blockUI.defaults.css.top = '25%';
</script>

1
includes/templates/globalheader.tpl

@ -0,0 +1 @@
<div id="main" class="container-fluid" style="padding-bottom:0;">

14
public/class-bespokomatic-ebs-public.php

@ -59,18 +59,8 @@ class Bespokomatic_Ebs_Public {
* @since 0.1
*/
public function enqueue_styles() {
/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in Bespokomatic_Ebs_Loader as all of the hooks are defined
* in that particular class.
*
* The Bespokomatic_Ebs_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
$css_public_prefix = $this->plugin_name . '-css-public';
$css_booked_public_prefix = $css_public_prefix . '-booked';
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/bespokomatic-ebs-public.css', array(), $this->version, 'all' );

Loading…
Cancel
Save