<?php
class Rover_IDX_ADMINTEMPLATES
	{
	private Rover_IDX $rover_idx;

	public function __construct(Rover_IDX $rover_idx)
		{
		$this->rover_idx						= $rover_idx;
		}

	public function roveridx_panel_header() {

		if (!is_array($seo_options = get_option(roverOPTIONS::SEO)))
			$seo_options						= array();

		$rover_content							= $this->rover_idx->CONTENT->rover_content(
																		'ROVER_COMPONENT_SETTINGS_HEADER',
																		array(
																			'region'	=> $this->rover_idx->get_first_region(),
																			'regions'	=> implode(',', array_keys($this->rover_idx->all_selected_regions)),
																			'settings'	=> $seo_options
																			)
																		);
		return $rover_content['the_html'];
		}

	function roveridx_panel_footer($panel)	{

		$current_user	= wp_get_current_user();
		$upload_base	= wp_upload_dir();
		$label_id		= rand(1,9999);

		$the_html		= array();
		$the_html[]		= '<footer class="'.roverKEYS::IDX_PLUGIN_NAME.'" data-footer_type="'.$panel.'">';
		$the_html[]		=		'<div style="display:inline-block;width:50%;">';
		$the_html[]		=			'<center><strong>Rover IDX</strong> '.roverVERSIONS::FULL.' <span style="color:#999;font-size:13px;">on PHP version '.phpversion().'</span></center>';
		$the_html[]		=		'</div>';
		$the_html[]		=		'<div style="display:inline-block;width:50%;">';
		$the_html[]		=			'<center>';
		$the_html[]		=				'<a href="https://www.facebook.com/RoverIDX" title="Rover IDX Facebook page" target="_blank">';
		$the_html[]		=					'<img style="border:none;margin-left:10px;" src="'.ROVER_IDX_PLUGIN_URL.'images/facebook-icon.png" />';
		$the_html[]		=				'</a>';
		$the_html[]		=			'</center>';
		$the_html[]		=		'</div>';

		$the_html[]		=		'<input type="hidden" id="rover_idx" name="rover_idx" value="1" />';

		$the_html[]		=		'<input type="hidden" id="wp_security" name="security" value="'.wp_create_nonce(roverKEYS::NONCE_DEF).'" />';

		$the_html[]		=		'<input type="hidden" name="wp_name" value="'.sanitize_text_field( $current_user->display_name ).'" />';
		$the_html[]		=		'<input type="hidden" name="wp_email" value="'.sanitize_email( $current_user->user_email ).'" />';
		$the_html[]		=		'<input type="hidden" name="kit" value="'.roverSHARED::AFFILIATE.'" />';

		$the_html[]		=		'<input type="hidden" name="wp_site_url" class="no-serial" value="'.get_site_url().'" />';
		$the_html[]		=		'<div class="rover-confirm modal fade" role="dialog" aria-labelledby="#'.$label_id.'" aria-hidden="true" style="display:none;position:fixed;top:50%;left:25%;width:50%;z-index:1051;">';
		$the_html[]		=			'<div class="modal-dialog" style="max-width:100%;">';
		$the_html[]		=				'<div class="modal-content">';
		$the_html[]		=					'<div class="modal-header">';
		$the_html[]		=						'<h4 class="modal-title" style="float:left;margin:0;" id="'.$label_id.'">Your question goes here</h4>';
		$the_html[]		=						'<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>';
		$the_html[]		=						'<div style="clear:both;"></div>';
		$the_html[]		=						'</div>';
		$the_html[]		=					'<div class="modal-body">';
		$the_html[]		=						'<svg class="ri circle spin" viewBox="0 0 512 512" aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" style="visibility:hidden;">';
		$the_html[]		=							'<path d="M288 28.977v16.391c0 7.477 5.182 13.945 12.474 15.598C389.568 81.162 456 160.742 456 256c0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-95.244 66.422-174.837 155.526-195.034C218.818 59.313 224 52.845 224 45.368V28.981c0-10.141-9.322-17.76-19.246-15.675C91.959 37.004 7.373 137.345 8.004 257.332c.72 137.052 111.477 246.956 248.531 246.667C393.255 503.711 504 392.788 504 256c0-119.349-84.308-219.003-196.617-242.665C297.403 11.232 288 18.779 288 28.977z" fill="currentColor"></path>';
		$the_html[]		=						'</svg>';
		$the_html[]		=					'</div>';
		$the_html[]		=					'<div class="modal-footer">';
		$the_html[]		=						'<button type="button" class="yes btn btn-primary float-right" style="margin:0 5px;">Yes</button>';
		$the_html[]		=						'<button type="button" class="no btn btn-primary float-right"  style="margin:0 5px;">No</button>';
		$the_html[]		=					'</div>';
		$the_html[]		=				'</div><!-- /.modal-content -->';
		$the_html[]		=			'</div><!-- /.modal-dialog -->';
		$the_html[]		=		'</div><!-- /#edit_client -->';
		$the_html[]		= '</footer><!-- footer -->';

		return implode('', $the_html);
		}
	}

?>