<?php
/*
 * Software Name: Eorisis Setup
 * Software URI: https://eorisis.com/shop/software/joomla/setup
 * Author: Eorisis
 * Author URI: https://eorisis.com
 * Copyright: Copyright (C) 2011-2025 EORISIS. All Rights Reserved.
 * License: GNU General Public License version 2; See https://eorisis.com/gpl
 * Terms of Service: https://eorisis.com/tos
 */
namespace eorisis_setup\framework\lib\core\view;
\defined('_JEXEC') or die;

use eorisis_setup\framework\lib\core\app\config as app_config;
use eorisis_setup\framework\lib\core\cms\language as cms_language;

class updates
{
	public function __construct() {}

	// --------------------------------------------------

	public static function html() : string
	{
		// jQuery in J4
		if (\version_compare(JVERSION, 4, '>='))
		{
			\eorisis_setup\framework\lib\core\model\jquery::load();
		}

		app_config::init();
		\eorisis_setup\framework\lib\core\model\language::jload('update');
		$arguments = [
			'title' => cms_language::text('EO_UPDATE_CHECK_TITLE'),
			'content' => cms_language::text('EO_UPDATE_CHECK')
		];

		$html  = \eorisis_setup\framework\lib\core\view\javascript::script_inline('var installed_ver="'.app_config::get('version').'"');
		$html .= '<div class="eo-info">';
		$html .=	'<div id="eo-upd-chk">';
		$html .=		'<h3>'.\eorisis_setup\framework\lib\core\view\link::a('#', $arguments).'</h3>';
		$html .=	'</div>';
		$html .=	'<div id="srv-ver" class="ver">';
		$html .=		'<h3><span id="eo-ver-no"></span></h3>';
		$html .=		'<span id="eo-latest"></span>';
		$html .=		'<span id="eo-dl-upd"></span>';
		$html .=	'</div>';
		$html .=	'<div id="eo-release">';
		$html .=		'<span id="eo-rel-date"></span>';
		$html .=		'<span id="eo-rel-notes"></span>';
		$html .=		'<span id="eo-infourl"></span>';
		$html .=	'</div>';
		$html .=	'<br>';
		$html .=	'<span class="group">';
		$html .=		'<h4>';
		$html .=			cms_language::text('EO_INSTALLED_VERSION').': '.app_config::get('version').' - ';
		$html .=			\eorisis_setup\framework\lib\core\model\geotime::to_local_date(app_config::get('creationDate'));
		$html .=			'<br>';
		$html .=			cms_language::text('EO_COMPATIBLE_WITH_JOOMLA');
		$html .=		'</h4>';
		$html .=	'</span>';
		$html .= '</div>';
		return $html;
	}
}
