public function template($contents)
{
global $language_array;
$xtpl = new XTemplate('updatetheme.tpl', NV_ROOTDIR . '/install/tpl');
$xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
$xtpl->assign('LANG_VARIABLE', NV_LANG_VARIABLE);
$xtpl->assign('NV_LANG_UPDATE', NV_LANG_UPDATE);
$xtpl->assign('LANG', $this->lang);
$xtpl->assign('CONFIG', $this->config);
if (!empty($this->config['formodule'])) {
// Lay module_file lam tieu de luon
$xtpl->assign('SITE_TITLE', $this->config['type'] == 1 ? sprintf($this->lang['updatemod_title_update'], $this->config['formodule']) : sprintf($this->lang['updatemod_title_upgrade'], $this->config['formodule']));
} else {
$xtpl->assign('SITE_TITLE', $this->config['type'] == 1 ? $this->lang['update_site_title_update'] : $this->lang['update_site_title_upgrade']);
}
$xtpl->assign('CONTENT_TITLE', $this->lang['update_step_title_' . $this->config['step']]);
$xtpl->assign('MODULE_CONTENT', $contents);
$xtpl->assign('LANGTYPESL', NV_LANG_UPDATE);
$langname = $language_array[NV_LANG_UPDATE]['name'];
$xtpl->assign('LANGNAMESL', $langname);
foreach ($this->config['allow_lang'] as $languageslist_i) {
if (!empty($languageslist_i) and NV_LANG_UPDATE != $languageslist_i) {
$xtpl->assign('LANGTYPE', $languageslist_i);
$langname = $language_array[$languageslist_i]['name'];
$xtpl->assign('LANGNAME', $langname);
$xtpl->parse('main.looplang');
}
}
$step_bar = array($this->lang['update_step_1'], $this->lang['update_step_2'], $this->lang['update_step_3']);
foreach ($step_bar as $i => $step_bar_i) {
$n = $i + 1;
$class = '';
if ($this->config['step'] >= $n) {
$class = " class=\"";
$class .= $this->config['step'] > $n ? 'passed_step' : '';
$class .= $this->config['step'] == $n ? 'current_step' : '';
$class .= "\"";
}
$xtpl->assign('CLASS_STEP', $class);
$xtpl->assign('STEP_BAR', $step_bar_i);
$xtpl->assign('NUM', $n);
$xtpl->parse('main.step_bar.loop');
}
$xtpl->parse('main.step_bar');
$xtpl->parse('main');
return $xtpl->text('main');
}