<?php

/**
* Admin Menu
*/
class Esi_Management_Radar {

	/**
	* The ID of this plugin.
	*
	* @since    1.0.0
	* @access   private
	* @var      string    $plugin_name    The ID of this plugin.
	*/
	private $plugin_name;

	/**
	* The version of this plugin.
	*
	* @since    1.0.0
	* @access   private
	* @var      string    $version    The current version of this plugin.
	*/
	private $version;

	/**
	* Initialize the class and set its properties.
	*
	* @since    1.0.0
	* @param      string    $plugin_name       The name of this plugin.
	* @param      string    $version    The version of this plugin.
	*/
	public function __construct( $plugin_name, $version ) {

		$this->plugin_name = $plugin_name;
		$this->version = $version;

	}

	// /**
	// * Add menu items
	// *
	// * @return void
	// */
	// public function admin_menu() {
	//
	// 	/** Top Menu **/
	// 	add_submenu_page( $this->plugin_name, __( 'Radar', 'esi' ), __( 'Radar', 'esi' ), 'manage_options', 'esi-management-radar', array( $this, 'plugin_page' ) );
	// }

	/**
	* Handles the plugin page
	*
	* @return void
	*/
	public function plugin_page() {
		$action = isset( $_GET['action'] ) ? $_GET['action'] : 'list';
		$id     = isset( $_GET['id'] ) ? intval( $_GET['id'] ) : 0;

		switch ($action) {
			case 'view':
			case 'edit':
			case 'new':
			$arrSelectedIndustry = esi_get_radar_industry_array($id);
			$arrSelectedFunction = esi_get_radar_function_array($id);
			$template = dirname( __FILE__ ) . '/partials/esi-management-radar-form.php';
			break;

			case 'delete':
            esi_delete_radar($id);
			$template = dirname( __FILE__ ) . '/partials/esi-management-radar-list.php';
			break;

			default:
			$template = dirname( __FILE__ ) . '/partials/esi-management-radar-list.php';
			break;
		}

		if ( file_exists( $template ) ) {
			include $template;
		}
	}
}
