_moduleInfo = $moduleInfo;
$this->_helper = $helper;
parent::__construct($context, $authSession, $jsHelper, $data);
}
public function checkModulesVersion( $moduleName ) {
$index = 0;
if ( !empty( $moduleName ) && is_array( $moduleName ) ){
foreach ( $moduleName as $name ) {
$module = $this->_moduleInfo->getModuleInfo( 'Olegnax_' . $name );
if (empty($module)) {
$module = [
'update_status' => false,
'setup_version' => ''
];
}
if ( $module[ 'update_status' ] )
$index++;
}
}
return $index;
}
/**
* Retrieve HTML markup for given form element
*
* @param AbstractElement $element
* @return string
*/
public function render(AbstractElement $element)
{
$modulesList= array('Athlete2','Quickview','MegaMenu','ProductLabel','BrandSlider','BannerSlider','Athlete2Slideshow','ProductSlider','ProductReviewsSummary','Core');
$license = $this->_helper->get();
$code = $this->_helper->getSystemDefaultValue('athlete2_license/general/code');
$status = !empty($license)
&& isset($license->data->the_key)
&& $license->data->the_key == $code
&& $license->data->status == "active";
$devLicense = $status && isset($license->notices->develop);
$supportExpired = $status && $license->data->has_expired;
$notice = [];
$notice[] = '';
$notice[] = '
' . __('Athlete2') . '
';
if ($devLicense) {
$notice[] = '' . __('Dev License Activated.
Do not use on live store.') . '
';
}
if ($status) {
$module = $this->_moduleInfo->getModuleInfo($this->getModuleName());
$theme = $this->_moduleInfo->getThemeInfo('frontend/Olegnax/athlete2', 'Athlete2');
if (empty($theme)) {
$theme = $this->_moduleInfo->getThemeInfo('frontend/Olegnax/Athlete2', 'Athlete2');
}
if (empty($theme)) {
$theme = [
'update_status' => false,
'setup_version' => ''
];
}
$isExpired = '';
if($theme['update_status']){
$isExpired = ' expired';
}
$notice[] = '';
// Current Theme version
$notice[] = '
Theme v' . $this->escapeHtml($theme['setup_version']);
// Check if Theme is expired
if ($theme['update_status']) {
$notice[] = '
v'.$this->escapeHtml($theme['server_version']).'' . __("What's New") . '';
}
$notice[] = '
';
// check if Athlete2 Module is expired
/* if ($module['update_status']) {
$notice[] = '
Athlete2 Module - v' . $this->escapeHtml($module['setup_version']) . '
v'.$this->escapeHtml($module['server_version']).'';
if (array_key_exists('url_changelog', $module)) {
$notice[] = '
' . __("What's New") . '';
}
$notice[] = '
';
}*/
// check if any of Olegnax Modules are expired
$expiredModules = $this->checkModulesVersion($modulesList);
if($expiredModules > 0){
$notice[] = '
';
}
//close ox-info-block__version
$notice[] = '
';
$notice[] = '';
$notice[] = '
';
$notice[] = '
';
} else {
$notice[] = 'Theme is not Activated.';
}
$html = sprintf(
('%s
'),
implode('', $notice)
);
if ($element->getIsNested()) {
$html = '| ' . $html . ' |
';
}
return $html;
}
}