<?php

/**
 * The dashboard-specific functionality of the plugin.
 *
 * @link       https://apps.coursevector.com/monitor/service.php
 * @since      1.0.0
 *
 * @package    CV_Manager
 * @subpackage CV_Manager/admin
 */

class CV_Monitor_Database {

	private $main;
	private $plugin;
	public $hook;
	public $slug = 'cv-monitor-database';

	/**
	 * Initialize the class and set its properties.
	 *
	 * @param      string    $plugin_name       The name of this plugin.
	 * @param      string    $version    The version of this plugin.
	 */
	public function __construct( $main ) {
		$this->main = $main;
		$this->plugin = $main->plugin;
	}

	public function init() {
		//
	}

	public function admin_init() {
		wp_register_style( "{$this->main->plugin_name}-style", plugin_dir_url( __FILE__ ) . 'css/admin-database.css', array(), $this->main->version, 'all' );
		wp_register_script( "{$this->main->plugin_name}-script", plugin_dir_url( __FILE__ ) . 'js/admin-database.js', array( 'jquery' ), $this->main->version, false );
		wp_register_script( "{$this->main->plugin_name}-script2", plugin_dir_url( __FILE__ ) . 'js/jquery.tablesorter.min.js', array( 'jquery' ), $this->main->version, false );
	}

	/**
	 * Register the stylesheets for the Dashboard.
	 *
	 * @since    1.0.0
	 */
	public function admin_enqueue_scripts($hook) {
		if ( $hook === $this->hook ) {
			wp_enqueue_style( "{$this->main->plugin_name}-style" );
			wp_enqueue_script( "{$this->main->plugin_name}-script" );
			wp_enqueue_script( "{$this->main->plugin_name}-script2" );
		}
	}

	public function display_page() {
		include_once ( $this->main->dir . 'admin/partials/page-database.php' );
	}
}