package = $package; parent::__construct(); } function InitStep() { $package = $this->package; $this->SetTitle(GetMessage("MAIN_WIZARD_WELCOME_TITLE")); } function OnPostForm() { } function ShowStep() { $package = $this->package; if ($this->content == '') $this->content = GetMessage("MAIN_WIZARD_WELCOME_TEXT"); } } class CPackageLicense extends CWizardStep { var $package; public function __construct($package) { $this->package = $package; parent::__construct(); } function InitStep() { $package = $this->package; $this->SetTitle(GetMessage("MAIN_WIZARD_LICENSE_STEP_TITLE")); $this->SetSubTitle(GetMessage("MAIN_WIZARD_LICENSE_STEP_SUBTITLE")); $this->SetCancelStep(BX_WIZARD_CANCEL_ID); } function OnPostForm() { $wizard = $this->GetWizard(); $package = $this->package; if ($wizard->IsPrevButtonClick()) return; $agree = $wizard->GetVar("__agree_license"); if ($agree != "Y") $this->SetError(GetMessage("MAIN_WIZARD_LICENSE_STEP_ERROR")); } function ShowStep() { $wizard = $this->GetWizard(); $package = $this->package; if ($this->content == '') $this->content .= GetMessage("MAIN_WIZARD_LICENSE_STEP_CONTENT"); $licensePath = $package->__GetLicensePath(); $this->content .= '
'; $this->content .= $this->ShowCheckboxField("__agree_license", "Y", Array("id" => "agree_license_id")); $this->content .= ''; } } class CPackageSelectSite extends CWizardStep { var $package; public function __construct($package) { $this->package = $package; parent::__construct(); } function InitStep() { $this->SetTitle(GetMessage("MAIN_WIZARD_SELECT_SITE_TITLE")); $this->SetSubTitle(GetMessage("MAIN_WIZARD_SELECT_SITE_DESC")); $this->SetCancelStep(BX_WIZARD_CANCEL_ID); } function OnPostForm() { $wizard = $this->GetWizard(); $package = $this->package; if ($wizard->IsNextButtonClick()) { $siteID = $package->siteID; if ($siteID != "" && array_key_exists($siteID, $package->arSites)) { if ($package->_InitSubStep("select", $package->arSites[$siteID], false)) { $wizard->SetCurrentStep($package->__obFirstStep->GetStepID()); $package->__obFirstStep->SetPrevStep(BX_WIZARD_SELECT_SITE_ID); } else { if ($package->groupExists && $package->templateExists) $wizard->SetCurrentStep(BX_WIZARD_SELECT_GROUP_ID); elseif ($package->templateExists) $wizard->SetCurrentStep(BX_WIZARD_SELECT_TEMPLATE_ID); elseif ($package->serviceExists) $wizard->SetCurrentStep(BX_WIZARD_SELECT_SERVICE_ID); elseif ($package->structureExists) $wizard->SetCurrentStep(BX_WIZARD_SELECT_STRUCTURE_ID); else $wizard->SetCurrentStep(BX_WIZARD_START_INSTALL_ID); } } else $this->SetError(GetMessage("MAIN_WIZARD_ERROR_WRONG_SITE"), "__siteID"); } } function ShowStep() { $wizard = $this->GetWizard(); $package = $this->package; $this->content .= ''; foreach ($package->arSites as $siteID => $arSite) { if (isset($arSite["DEFAULT"])) $wizard->SetDefaultVar("__siteID", $siteID); $this->content .= ''; $this->content .= ''; $this->content .= ''; $this->content .= ''; $this->content .= ''; } $this->content .= '
'.$this->ShowRadioField("__siteID", $siteID, Array("id" => $siteID)).''; if (isset($arSite["SCREENSHOT"]) && isset($arSite["PREVIEW"])) $this->content .= CFile::Show2Images($package->path."/".$arSite["PREVIEW"], $package->path."/".$arSite["SCREENSHOT"], 150, 150, ' border="0"')."

"; elseif (isset($arSite["SCREENSHOT"])) $this->content .= CFile::ShowImage($package->path."/".$arSite["SCREENSHOT"], 150, 150, ' border="0"', "", true)."

"; $this->content .='
'; $this->content .= ''; if (isset($arSite["DESCRIPTION"]) && $arSite["DESCRIPTION"] <> '') $this->content .= '
'; $this->content .='
'; } } //Select template group class CPackageSelectGroup extends CWizardStep { var $package; public function __construct($package) { $this->package = $package; parent::__construct(); } function InitStep() { $this->SetCancelStep(BX_WIZARD_CANCEL_ID); $this->SetTitle(GetMessage("MAIN_WIZARD_SELECT_GROUP_TITLE")); $this->SetSubTitle(GetMessage("MAIN_WIZARD_SELECT_GROUP_DESC")); $this->SetDisplayVars(Array("__groupID")); } function OnPostForm() { $wizard = $this->GetWizard(); $package = $this->package; if ($wizard->IsNextButtonClick()) { $groupID = $package->groupID; if ($groupID == "") { $this->SetError(GetMessage("MAIN_WIZARD_ERROR_WRONG_GROUP"), "__groupID"); return; } $arGroups = $package->GetTemplateGroups(Array("SITE_ID" => $package->siteID)); if (!array_key_exists($groupID, $arGroups)) { $this->SetError(GetMessage("MAIN_WIZARD_ERROR_WRONG_GROUP"), "__groupID"); return; } } } function ShowStep() { $package = $this->package; $wizard = $this->GetWizard(); $arGroups = $package->GetTemplateGroups(Array("SITE_ID" => $package->siteID)); if (empty($arGroups)) return; $this->content .= ''; $colsNumber = 3; $counter = 1; $cellSize = count($arGroups); foreach ($arGroups as $groupID => $arGroup) { if (isset($arGroup["DEFAULT"])) $wizard->SetDefaultVar("__groupID", $groupID); $this->content .= '"; //Close table cells if (!($counter % $colsNumber) && $cellSize != $counter) $this->content .= ""; if ($cellSize == $counter && ($cellSize % $colsNumber)>0) { for ($a=1;$a<=($colsNumber - ($cellSize % $colsNumber) );$a++) $this->content .= ""; } $counter++; } $this->content .= "
'; if (isset($arGroup["SCREENSHOT"]) && isset($arGroup["PREVIEW"])) $this->content .= CFile::Show2Images($package->path."/".$arGroup["PREVIEW"], $package->path."/".$arGroup["SCREENSHOT"], 150, 150, ' border="0"')."
"; elseif (isset($arGroup["SCREENSHOT"])) $this->content .= CFile::ShowImage($package->path."/".$arGroup["SCREENSHOT"], 150, 150, ' border="0"', "", true)."
"; $this->content .= '
'; $this->content .= $this->ShowRadioField("__groupID", $groupID, Array("id" => $groupID)); $this->content .= ''; $this->content .= ''; $this->content .= '
'; $this->content .= "
 
"; } } class CPackageSelectTemplate extends CWizardStep { var $package; public function __construct($package) { $this->package = $package; parent::__construct(); } function InitStep() { $this->SetTitle(GetMessage("MAIN_WIZARD_SELECT_TEMPLATE_TITLE")); $this->SetSubTitle(GetMessage("MAIN_WIZARD_SELECT_TEMPLATE_DESC")); $this->SetCancelStep(BX_WIZARD_CANCEL_ID); $this->SetDisplayVars(Array("__templateID")); } function OnPostForm() { $wizard = $this->GetWizard(); $package = $this->package; if ($wizard->IsNextButtonClick()) { $templateID = $package->templateID; if ($templateID != "" && array_key_exists($templateID, $package->arTemplates)) { if ($package->_InitSubStep("select", $package->arTemplates[$templateID], false)) { $wizard->SetCurrentStep($package->__obFirstStep->GetStepID()); $package->__obFirstStep->SetPrevStep(BX_WIZARD_SELECT_TEMPLATE_ID); } else { if ($package->serviceExists) $wizard->SetCurrentStep(BX_WIZARD_SELECT_SERVICE_ID); elseif ($package->structureExists) $wizard->SetCurrentStep(BX_WIZARD_SELECT_STRUCTURE_ID); else $wizard->SetCurrentStep(BX_WIZARD_START_INSTALL_ID); } } else $this->SetError(GetMessage("MAIN_WIZARD_ERROR_WRONG_TEMPLATE"), "__templateID"); } } function ShowStep() { $package = $this->package; $wizard = $this->GetWizard(); $arTemplates = $package->GetTemplates( Array( "SITE_ID" => $package->siteID, "GROUP_ID" => $package->groupID ) ); if (empty($arTemplates)) return; $this->content .= ''; $colsNumber = 3; $counter = 1; $cellSize = count($arTemplates); foreach ($arTemplates as $arTemplate) { if (isset($arTemplate["DEFAULT"])) $wizard->SetDefaultVar("__templateID", $arTemplate["ID"]); $this->content .= '"; //Close table cells if (!($counter % $colsNumber) && $cellSize != $counter) $this->content .= ""; if ($cellSize == $counter && ($cellSize % $colsNumber)>0) { for ($a=1;$a<=($colsNumber - ($cellSize % $colsNumber) );$a++) $this->content .= ""; } $counter++; } $this->content .= "
'; if ($arTemplate["SCREENSHOT"] && $arTemplate["PREVIEW"]) $this->content .= CFile::Show2Images($arTemplate["PREVIEW"], $arTemplate["SCREENSHOT"], 150, 150, ' border="0"')."
"; else $this->content .= CFile::ShowImage($arTemplate["SCREENSHOT"], 150, 150, ' border="0"', "", true)."
"; $this->content .= ''; $this->content .= '
'; $this->content .= $this->ShowRadioField("__templateID", $arTemplate["ID"], Array("id" => $arTemplate["ID"])); $this->content .= ''; $this->content .= '
'; $this->content .= ($arTemplate["DESCRIPTION"] <> '' ? "
".$arTemplate["DESCRIPTION"] : "").''; $this->content .= "
 
"; } } class CPackageSelectService extends CWizardStep { var $package; public function __construct($package) { $this->package = $package; parent::__construct(); } function InitStep() { $this->SetCancelStep(BX_WIZARD_CANCEL_ID); $this->SetTitle(GetMessage("MAIN_WIZARD_SELECT_SERVICE_TITLE")); $this->SetSubTitle(GetMessage("MAIN_WIZARD_SELECT_SERVICE_DESC")); } function OnPostForm() { $wizard = $this->GetWizard(); $package = $this->package; if ($wizard->IsNextButtonClick()) { $arServices = $package->serviceID; if (!is_array($arServices)) { if ($package->serviceExists) $wizard->SetCurrentStep(BX_WIZARD_SELECT_STRUCTURE_ID); else $wizard->SetCurrentStep(BX_WIZARD_START_INSTALL_ID); return; } foreach ($arServices as $service) { if (!array_key_exists($service, $package->arServices)) continue; if ($package->_InitSubStep("select", $package->arServices[$service], false)) { $wizard->SetCurrentStep($package->__obFirstStep->GetStepID()); $package->__obFirstStep->SetPrevStep(BX_WIZARD_SELECT_SERVICE_ID); break; } else { if ($package->serviceExists) $wizard->SetCurrentStep(BX_WIZARD_SELECT_STRUCTURE_ID); else $wizard->SetCurrentStep(BX_WIZARD_START_INSTALL_ID); //$wizard->SetCurrentStep("__start_install"); } } } } function ShowStep() { $package = $this->package; $wizard = $this->GetWizard(); $arServices = $package->GetServices(Array("SITE_ID" => $package->siteID)); $i = 0; $this->ShowCheckboxField("__serviceID[]", null); $this->content .= $this->ShowHiddenField("__serviceID", ""); $this->content .= ''; foreach ($arServices as $serviceID => $arService) { $type = "checkbox"; $group = ""; if (array_key_exists("FORM", $arService) && is_array($arService["FORM"])) { if (array_key_exists("TYPE", $arService["FORM"])) $type = mb_strtolower($arService["FORM"]["TYPE"]); if (array_key_exists("GROUP", $arService["FORM"])) $group = mb_strtolower(preg_replace("~[^a-zA-Z0-9_]~i", "", $arService["FORM"]["GROUP"])); if (array_key_exists("DEFAULT", $arService["FORM"]) && $type != "required") { if ($group == "") $wizard->SetDefaultVar("__serviceID[".$i++."]", $serviceID); else $wizard->SetDefaultVar("__serviceID[".$group."][".$i++."]", $serviceID); } } if ($type == "radio") { $this->content .= ''; $this->content .= ''; $this->content .= ''; $this->content .= ''; $this->content .= ''; } elseif ($type == "required") { $this->content .= ''; $this->content .= ''; $this->content .= ''; $this->content .= ''; $this->content .= ''; } else { $this->content .= ''; $this->content .= ''; $this->content .= ''; $this->content .= ''; $this->content .= ''; } } $this->content .= '
'.$this->ShowRadioField("__serviceID[".$group."]", $serviceID, Array("id" => $serviceID)).''; if (isset($arService["ICON"]) && $arService["ICON"] <> '') $this->content .= ''; $this->content .= ''; $this->content .= '
'; if (isset($arService["DESCRIPTION"]) && $arService["DESCRIPTION"] <> '') $this->content .= '
'; $this->content .= '
'; if (isset($arService["ICON"]) && $arService["ICON"] <> '') $this->content .= ''; $this->content .= ''; $this->content .= " ".$arService["NAME"].'
'; if (isset($arService["DESCRIPTION"]) && $arService["DESCRIPTION"] <> '') $this->content .= '
'.$arService["DESCRIPTION"].'
'; $this->content .= $this->ShowHiddenField("__serviceID[]", $serviceID); $this->content .= '
'.$this->ShowCheckboxField("__serviceID[]", $serviceID, Array("id" => $serviceID)).''; if (isset($arService["ICON"]) && $arService["ICON"] <> '') $this->content .= ''; $this->content .= ''; $this->content .= '
'; if (isset($arService["DESCRIPTION"]) && $arService["DESCRIPTION"] <> '') $this->content .= '
'; $this->content .= '
'; } } class CPackageSelectStructure extends CWizardStep { var $package; public function __construct($package) { $this->package = $package; parent::__construct(); } function InitStep() { $this->SetTitle(GetMessage("MAIN_WIZARD_SELECT_STRUCTURE_TITLE")); $this->SetSubTitle(GetMessage("MAIN_WIZARD_SELECT_STRUCTURE_DESC")); $this->SetCancelStep(BX_WIZARD_CANCEL_ID); } function DisplayTree(&$arStructure, $systemTree = false) { $strTree = ""; if (!is_array($arStructure)) return $strTree; static $labelID = 0; foreach ($arStructure as $pageID => $arPage) { $pageID = ($arPage["ID"] ?? $pageID); $isService = (isset($arPage["TYPE"]) && $arPage["TYPE"] == "SERVICE"); $isRoot = (!$isService && isset($arPage["CHILD"]) && is_array($arPage["CHILD"]) && !empty($arPage["CHILD"])); $labelID++; $strTree .= '
  • '; if (isset($arPage["ICON"]) && mb_strlen($arPage["ICON"]) > 3 ) $strTree .= ' '; else { if ($isService) $strTree .= ''; else $strTree .= ''; } $strTree .= ''; if ($isRoot) { $strTree .= ""; } $strTree .='
  • '; } return $strTree; } function ShowStep() { $wizard = $this->GetWizard(); $package = $this->package; $structureID = $package->structureID; $arOriginalStructure = $package->GetStructure( Array( "SITE_ID" => $package->siteID, "SERVICE_ID" => $package->serviceID ) ); if ($structureID !== null) $arStructure = $package->__GetNewStructure($structureID, $arOriginalStructure); else $arStructure = $arOriginalStructure; $strTree = $this->DisplayTree($arStructure); $strTrash = $this->DisplayTree($arOriginalStructure, $systemTree = true); $formName = $wizard->GetFormName(); $nextButton = $wizard->GetNextButtonID(); $prevButton = $wizard->GetPrevButtonID(); $prefix = $wizard->GetVarPrefix(); $langStandartPages = GetMessage("MAIN_WIZARD_STANDART_PAGES"); $langSiteStructure = GetMessage("MAIN_WIZARD_SITE_STRUCTURE"); $langPagePosition = GetMessage("MAIN_WIZARD_PAGE_POSITION"); $this->content .= << ul.site-tree { list-style:none; margin:0; padding:0; } ul.site-tree ul { list-style:none; margin-top:0; margin-bottom:0; }
     {$langStandartPages}  {$langSiteStructure} {$langPagePosition}
      {$strTrash}





      {$strTree}









    TABLE; } } class CPackageStartInstall extends CWizardStep { var $package; var $arSelected; public function __construct($package, $arSelected) { $this->package = $package; $this->arSelected = $arSelected; parent::__construct(); } function InitStep() { $package = $this->package; $this->SetTitle(GetMessage("MAIN_WIZARD_START_INSTALL_TITLE")); $this->SetNextCaption(GetMessage("MAIN_WIZARD_INSTALL_CAPTION")); } function OnPostForm() { } function ShowStep() { $package = $this->package; if ($this->content == '') $this->content .= GetMessage("MAIN_WIZARD_START_INSTALL_DESC"); $siteID = $this->arSelected["siteID"]; if (isset($siteID) && isset($package->arSites[$siteID]["NAME"])) $this->content .= "  ".GetMessage("MAIN_WIZARD_SITE_TYPE").": ".$package->arSites[$siteID]["NAME"]."
    "; $templateID = $this->arSelected["templateID"]; if (isset($templateID) && isset($package->arTemplates[$templateID]["NAME"])) $this->content .= "  ".GetMessage("MAIN_WIZARD_SITE_TEMPLATE").": ".$package->arTemplates[$templateID]["NAME"]."
    "; $arServices = $this->arSelected["arServices"]; $strService = ""; foreach ($arServices as $serviceID) { if (array_key_exists($serviceID, $package->arServices) && isset($package->arServices[$serviceID]["NAME"])) $strService .= ($strService <> '' ? ", " : "")."".$package->arServices[$serviceID]["NAME"].""; } if ($strService <> '') $this->content .= "  ".GetMessage("MAIN_WIZARD_SITE_SERVICES").": ".$strService; } } class CPackageInstallSite extends CWizardStep { var $package; var $siteID; public function __construct($package, $siteID) { $this->package = $package; $this->siteID = $siteID; parent::__construct(); $this->SetAutoSubmit(); $this->SetTitle(GetMessage("MAIN_WIZARD_RUN_INSTALLATION")); } function OnPostForm() { $package = $this->package; $package->__InstallSite($this->siteID); } function ShowStep() { if ($this->content == '') $this->content = GetMessage("MAIN_WIZARD_SITE_INSTALL"); } } class CPackageInstallTemplate extends CWizardStep { var $package; var $templateID; public function __construct($package, $templateID) { $this->package = $package; $this->templateID = $templateID; parent::__construct(); $this->SetAutoSubmit(); $this->SetTitle(GetMessage("MAIN_WIZARD_RUN_INSTALLATION")); } function OnPostForm() { $package = $this->package; $package->__InstallTemplate($this->templateID); } function ShowStep() { if ($this->content == '') $this->content = GetMessage("MAIN_WIZARD_TEMPLATE_INSTALL"); } } class CPackageInstallService extends CWizardStep { var $package; var $serviceID; public function __construct($package, $serviceID) { $this->package = $package; $this->serviceID = $serviceID; parent::__construct(); $this->SetAutoSubmit(); $this->SetTitle(GetMessage("MAIN_WIZARD_RUN_INSTALLATION")); } function OnPostForm() { $package = $this->package; $package->__InstallService($this->serviceID); } function ShowStep() { $package = $this->package; $serviceName = ""; if (array_key_exists($this->serviceID, $package->arServices) && array_key_exists("NAME", $package->arServices[$this->serviceID])) $serviceName = $package->arServices[$this->serviceID]["NAME"]; if ($this->content == '') $this->content = GetMessage("MAIN_WIZARD_SERVICE_INSTALL").' "'.htmlspecialcharsEx($serviceName).'" ...'; } } class CPackageInstallStructure extends CWizardStep { public function __construct() { parent::__construct(); } function InitStep() { $this->SetAutoSubmit(); $this->SetTitle(GetMessage("MAIN_WIZARD_RUN_INSTALLATION")); } function OnPostForm() { $wizard = $this->GetWizard(); $package = $wizard->GetPackage(); $package->__InstallStructure(); } function ShowStep() { if ($this->content == '') $this->content = GetMessage("MAIN_WIZARD_INSTALL_STRUCTURE"); } } class CPackageFinish extends CWizardStep { var $package; public function __construct($package) { $this->package = $package; parent::__construct(); } function InitStep() { $package = $this->package; $this->SetTitle(GetMessage("MAIN_WIZARD_FINISH_TITLE")); $this->SetCancelCaption(GetMessage("MAIN_WIZARD_FINISH_CAPTION")); } function OnPostForm() { } function ShowStep() { if ($this->content == '') $this->content = GetMessage("MAIN_WIZARD_FINISH_DESC"); } } class CPackageCancel extends CWizardStep { var $package; public function __construct($package) { $this->package = $package; parent::__construct(); } function InitStep() { $package = $this->package; $this->SetTitle(GetMessage("MAIN_WIZARD_CANCEL_TITLE")); $this->SetCancelCaption(GetMessage("MAIN_WIZARD_FINISH_CAPTION")); } function OnPostForm() { } function ShowStep() { if ($this->content == '') $this->content .= GetMessage("MAIN_WIZARD_CANCEL_DESC"); } } class CPackageError extends CWizardStep { var $package; public function __construct($package) { $this->package = $package; parent::__construct(); } function InitStep() { $package = $this->package; $this->SetCancelStep(BX_WIZARD_CANCEL_ID); $this->SetTitle(GetMessage("MAIN_WIZARD_ERROR_STEP_TITLE")); foreach ($package->arErrors as $arError) $this->SetError($arError[0], $arError[1]); } function OnPostForm() { } function ShowStep() { } } ?>