function ShowStep() { $wizard =& $this->GetWizard(); $templateID = $wizard->GetSiteTemplateID(); $themePath = DemoSiteUtil::GetTemplatesPath($wizard->GetPath()) . "/" . $templateID . "/themes"; $arThemes = DemoSiteUtil::GetThemes($_SERVER["DOCUMENT_ROOT"] . $themePath); $this->content .= '<table cellspacing="0" cellpadding="2" width="540"><tr>'; $colsNumber = 3; $counter = 1; $cellSize = count($arThemes); foreach ($arThemes as $arTheme) { $path = $themePath . "/" . $arTheme["ID"]; $this->content .= '<td valign="top" style="padding-bottom:0px;" width="33%">'; if ($arTheme["SCREENSHOT"] && $arTheme["PREVIEW"]) { $this->content .= CFile::Show2Images($path . "/preview.gif", $path . "/screen.gif", 150, 150, ' border="0"') . "<br />"; } else { $this->content .= CFile::ShowImage($path . "/screen.gif", 150, 150, ' border="0"', "", true) . "<br />"; } $themeVarName = $templateID . "_themeID"; if (isset($arTheme["DEFAULT"]) && $arTheme["DEFAULT"] == "Y") { $wizard->SetDefaultVar($themeVarName, $arTheme["ID"]); } $this->content .= '<table><tr><td valign="top">'; $this->content .= $this->ShowRadioField($themeVarName, $arTheme["ID"], array("id" => $arTheme["ID"])); $this->content .= '</td><td>'; $this->content .= '<label for="' . $arTheme["ID"] . '">'; $this->content .= $arTheme["NAME"]; $this->content .= '</label>'; $this->content .= '</td></tr></table>'; $this->content .= "</td>"; //Close table cells if (!($counter % $colsNumber) && $cellSize != $counter) { $this->content .= "</tr><tr>"; } if ($cellSize == $counter && $cellSize % $colsNumber > 0) { for ($a = 1; $a <= $colsNumber - $cellSize % $colsNumber; $a++) { $this->content .= "<td> </td>"; } } $counter++; } $this->content .= "</tr></table>"; }
function OnPostForm() { $wizard =& $this->GetWizard(); $templateID = $wizard->GetSiteTemplateID(); $templatePath = BX_PERSONAL_ROOT . "/templates/" . $templateID; $arReplace = array("COMPANY_NAME" => $wizard->GetVar("company_name"), "COMPANY_SLOGAN" => $wizard->GetVar("company_slogan")); CWizardUtil::ReplaceMacros($_SERVER["DOCUMENT_ROOT"] . $templatePath . "/include_areas/company_name.php", $arReplace); $server_name = $_SERVER["HTTP_HOST"] != '' ? $_SERVER["HTTP_HOST"] : $_SERVER["SERVER_NAME"]; if ($_SERVER["SERVER_PORT"] != 80 && $_SERVER["SERVER_PORT"] != 443 && $_SERVER["SERVER_PORT"] > 0 && strpos($_SERVER["HTTP_HOST"], ":") === false) { $server_name .= ":" . $_SERVER["SERVER_PORT"]; } COption::SetOptionString("main", "server_name", $server_name); COption::SetOptionString("main", "site_name", htmlspecialcharsEx($wizard->GetVar("company_name"))); COption::SetOptionString("main", "wizard_company_slogan", $wizard->GetVar("company_slogan")); $themeVarName = $templateID . "_themeID"; $themeID = $wizard->GetVar($themeVarName); $themeID = Rel2Abs("/", $themeID); $themePath = $_SERVER["DOCUMENT_ROOT"] . DemoSiteUtil::GetTemplatesPath($wizard->GetPath()) . "/" . $templateID . "/themes/" . $themeID; CopyDirFiles($themePath, $_SERVER["DOCUMENT_ROOT"] . $templatePath, $rewrite = true, $recursive = true, $delete_after_copy = false, $exclude = "description.php"); $companyLogo = $wizard->GetVar("company_logo"); CWizardUtil::CopyFile($companyLogo, $templatePath . "/images/logo.gif", false); COption::SetOptionString("main", "wizard_site_logo", $companyLogo); }