<?php 
/** 
 * @package JREALTIMEANALYTICS::CPANEL::administrator::components::com_com_jrealtimeanalytics
 * @subpackage views
 * @subpackage cpanel
 * @subpackage tmpl
 * @author Joomla! Extensions Store
 * @copyright (C) 2013 - Joomla! Extensions Store
 * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html 
 */
defined ( '_JEXEC' ) or die ( 'Restricted access' );
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
?>
<!-- CPANEL ICONS -->
<div class="row no-margin">
	<div class="card card-default accordion-group col-lg-5 p-0 span5">
		<div class="card-header accordion-toggle accordion_lightblue p-3 noaccordion">
			<h3 class="card-title m-0"><span class="icon-pencil" aria-hidden="true"></span><?php echo Text::_('COM_JREALTIME_CPANEL_TASKS' ); ?></h3>
		</div>
		<div id="placeholder_cpanelicons" class="card-body card-block card-block-whitebg accordion-body pl-3 pt-2">
			<div id="cpanel">
				<?php echo $this->icons; ?>
				
				<div id="updatestatus">
					<?php 
					if(is_object($this->updatesData)) {
						if(version_compare($this->updatesData->latest, $this->currentVersion, '>')) {
							$updatesACLClass = $this->app->getIdentity()->authorise('core.manage', 'com_installer') ? 'bg-danger' : 'bg-warning';?>
							<a href="http://storejextensions.org/extensions/jrealtime_analytics.html" target="_blank" alt="storejoomla link">
								<label data-bs-content="<?php echo Text::sprintf('COM_JREALTIME_GET_LATEST', $this->currentVersion, $this->updatesData->latest, $this->updatesData->relevance);?>" class="badge <?php echo $updatesACLClass;?> hasPopover">
									<span class="icon-warning" aria-hidden="true"></span>
									<?php echo Text::sprintf('COM_JREALTIME_OUTDATED', $this->updatesData->latest);?>
								</label>
							</a>
						<?php } else { ?>
							<label data-bs-content="<?php echo Text::sprintf('COM_JREALTIME_YOUHAVE_LATEST', $this->currentVersion);?>" class="badge bg-success hasPopover">
								<span class="icon-checkmark" aria-hidden="true"></span>
								<?php echo Text::sprintf('COM_JREALTIME_UPTODATE', $this->updatesData->latest);?>
							</label>	
						<?php }
					}
					?>
				</div>
			</div>
		</div>
	</div>
	
	<div class="col-lg-7 span7 accordion" id="jrealtime_accordion_cpanel">
		<div class="card card-default accordion-group">
	    	<div class="card-header p-0 accordion-heading">
	    		<div class="accordion-toggle" data-bs-toggle="collapse" data-bs-target="#jrealtime_stats">
		      		<h4 class="card-title m-3 accordion-title">
		      			<span class="icon-chart" aria-hidden="true"></span>
		      			<?php echo Text::sprintf('COM_JREALTIME_CPANEL_STATS', $this->cParams->get('cpanelstats_period_interval', 'week')); ?>
	      			</h4>
	      		</div>
	    	</div>
	    	
			<div id="jrealtime_stats" data-bs-parent="#jrealtime_accordion_cpanel" class="card-body card-block card-block-whitebg accordion-body accordion-chart collapse">
				<div class="accordion-inner">
					<div class="statslabel_container">
						<div class="statslabel blue">
							<span class="statslabel_value icon-users"><span class="statslabel_numeric"><?php echo $this->infoData['chart_period_canvas'] ['totalusers'];?></span></span>
							<span class="statslabel_text"><?php echo Text::_('COM_JREALTIME_TOTALUSERS_CHART');?></span>
						</div>
						<div class="statslabel green">
							<span class="statslabel_value icon-copy"><span class="statslabel_numeric"><?php echo $this->infoData['chart_period_canvas'] ['totalpages'];?></span></span>
							<span class="statslabel_text"><?php echo Text::_('COM_JREALTIME_TOTALPAGES_CHART');?></span>
						</div>
					</div>
					<div class="chart_container">
						<canvas data-bind="{chart_period_canvas}"></canvas>
					</div>
					
					<div class="statslabel_container">
						<div class="statslabel yellow">
							<span class="statslabel_value icon-key"><span class="statslabel_numeric"><?php echo $this->infoData['chart_generic_canvas'] ['systemusers'];?></span></span>
							<span class="statslabel_text"><?php echo Text::_('COM_JREALTIME_SYSTEMUSERS_CHART');?></span>
						</div>
						<div class="statslabel red">
							<span class="statslabel_value icon-lightning"><span class="statslabel_numeric"><?php echo $this->infoData['chart_generic_canvas'] ['systemevents'];?></span></span>
							<span class="statslabel_text"><?php echo Text::_('COM_JREALTIME_SYSTEMEVENTS_CHART');?></span>
						</div>
					</div>
					<div class="chart_container">
						<canvas data-bind="{chart_generic_canvas}"></canvas>
					</div>
				</div>
			</div>
		</div>
		
		<div class="card card-default accordion-group">
		    <div class="card-header p-0 accordion-heading">
				<div class="accordion-toggle" data-bs-toggle="collapse" data-bs-target="#jrealtime_status">
					<h4 class="card-title m-3 accordion-title">
						<span class="icon-help" aria-hidden="true"></span>
						<?php echo Text::_('COM_JREALTIME_ABOUT');?>
					</h4>
		      	</div>
	    	</div>
		    <div id="jrealtime_status" data-bs-parent="#jrealtime_accordion_cpanel" class="card-body card-block accordion-body collapse">
		 		<div class="accordion-inner">
					<div class="single_container">
				 		<label class="badge bg-warning"><?php echo Text::_('COM_JREALTIME_CURRENT_VERSION') . $this->currentVersion;?></label>
			 		</div>
			 		
			 		<div class="single_container">
				 		<label class="badge bg-info"><?php echo Text::_('COM_JREALTIME_AUTHOR_COMPONENT');?></label>
			 		</div>
			 		
			 		<div class="single_container">
				 		<label class="badge bg-info"><?php echo Text::_('COM_JREALTIME_SUPPORTLINK');?></label>
			 		</div>
			 		
			 		<div class="single_container">
				 		<label class="badge bg-info"><?php echo Text::_('COM_JREALTIME_DEMOLINK');?></label>
			 		</div>
				</div>
		    </div>
	 	</div>
	</div>
</div>

<div class="clr vspacer"></div>

<div class="row no-margin">
	<div class="p-0 col-lg-6 span6">
		<div class="card card-default accordion-group">
			<div class="card-header p-0 accordion-heading opened">
				<div class="accordion-toggle accordion_lightblue noaccordion">
					<h3 class="card-title m-3 accordion-title"><span class="icon-dashboard" aria-hidden="true"></span><?php echo Text::_('COM_JREALTIME_CPANEL_SITESPEED' ); ?>
						<button id="execute_sitespeed_test" class="btn btn-primary btn-sm">
							<span class="icon-loop" aria-hidden="true"></span><?php echo Text::_('COM_JREALTIME_TESTNOW');?> 
						</button>
						<input type="text" id="sitespeed_url" data-role="sitespeed_url" value="<?php echo Uri::root();?>"/>
					</h3>
				</div>
			</div>
			<div id="sitespeed_container" data-bind="{jr-sitespeed}" class="placeholder_lowstats card-body card-block accordion-body accordion-inner"></div>
		</div>
	</div>
	
	<div id="jrealtime_accordion_cpanel_map" class="col-lg-6 span6">
		<div class="card card-default accordion-group">
			<div class="card-header p-0 accordion-heading opened">
				<div class="accordion-toggle accordion_lightblue noaccordion">
					<h3 class="card-title m-3 accordion-title"><span class="icon-picture" aria-hidden="true"></span><?php echo Text::sprintf('COM_JREALTIME_CPANEL_VISITSMAP', $this->cParams->get('cpanelstats_period_interval', 'week')); ?></h3>
				</div>
			</div>
			<div data-bind="{jr-mapcharts}" class="placeholder_lowstats card-body card-block accordion-body accordion-inner"></div>
		</div>
	</div>
</div>
	
	

<form name="adminForm" id="adminForm" action="index.php">
	<input type="hidden" name="option" value="<?php echo $this->option;?>"/>
	<input type="hidden" name="task" value=""/>
</form>