CheckInstallation(); } public function GetTitle() { return 'Welcome to '.ITOP_APPLICATION.' version '.ITOP_VERSION; } /** * Returns the label for the " Next >> " button * @return string The label for the button */ public function GetNextButtonLabel() { return 'Continue'; } public function GetPossibleSteps() { return [WizStepInstallOrUpgrade::class]; } public function UpdateWizardStateAndGetNextStep($bMoveForward = true): WizardState { return new WizardState(WizStepInstallOrUpgrade::class); } public function Display(SetupPage $oPage): void { // Store the misc_options for the future... $aMiscOptions = utils::ReadParam('option', [], false, 'raw_data'); $sMiscOptions = $this->oWizard->GetParameter('misc_options', json_encode($aMiscOptions)); $this->oWizard->SetParameter('misc_options', $sMiscOptions); $oPage->add(""); $oPage->add_ready_script( << 0) { alert("Internet Explorer version 10 or older is NOT supported! (Check that IE is not running in compatibility mode)"); } EOF ); $oPage->add('

'.ITOP_APPLICATION.' Installation Wizard

'); $sStyle = 'style="display:none;overflow:auto;"'; $sToggleButtons = ''; if (count($this->aErrors) > 0) { $sStyle = 'style="overflow:auto;"'; $sTitle = count($this->aErrors).' Error(s), '.count($this->aWarnings).' Warning(s).'; $sH2Class = 'text-error'; } elseif (count($this->aWarnings) > 0) { $sTitle = count($this->aWarnings).' Warning(s) '.$sToggleButtons; $sH2Class = 'text-warning'; } else { $sTitle = 'Ok. '.$sToggleButtons; $sH2Class = 'text-valid'; } $oPage->add( <<Prerequisites validation: $sTitle
HTML ); foreach ($this->aErrors as $sText) { $oPage->error($sText); } foreach ($this->aWarnings as $sText) { $oPage->warning($sText); } foreach ($this->aInfo as $sText) { $oPage->ok($sText); } $oPage->add('
'); if (!$this->bCanMoveForward) { $oPage->p('Sorry, the installation cannot continue. Please fix the errors and reload this page to launch the installation again.'); $oPage->p(''); } $oPage->add_ready_script('CheckDirectoryConfFilesPermissions("'.utils::GetItopVersionWikiSyntax().'")'); } /** * Add post display stuff to the setup screen * @param \SetupPage $oPage * * @return void */ public function PostFormDisplay(SetupPage $oPage) { if ($this->bCanMoveForward) { $sBuildConfigFile = APPCONF.ITOP_DEFAULT_ENV.'/'.ITOP_CONFIG_FILE; if (file_exists($sBuildConfigFile)) { $oPage->add( <<
HTML ); } } } public function CanMoveForward() { return $this->bCanMoveForward; } /** */ public function CheckInstallation(): void { $aResults = SetupUtils::CheckPhpAndExtensions(); $this->bCanMoveForward = true; $this->aInfo = []; $this->aWarnings = []; $this->aErrors = []; foreach ($aResults as $oCheckResult) { switch ($oCheckResult->iSeverity) { case CheckResult::ERROR: $this->aErrors[] = $oCheckResult->sLabel; $this->bCanMoveForward = false; break; case CheckResult::WARNING: $this->aWarnings[] = $oCheckResult->sLabel; break; case CheckResult::INFO: $this->aInfo[] = $oCheckResult->sLabel; break; case CheckResult::TRACE: SetupLog::Ok($oCheckResult->sLabel); break; } } } }