Your IP : 52.15.69.226


Current Path : /home/bitrix/ext_www/home-comfort.in.ua/bitrix/wizards/grain/sale.props.create/
Upload File :
Current File : /home/bitrix/ext_www/home-comfort.in.ua/bitrix/wizards/grain/sale.props.create/wizard.php

<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();

$spath=pathinfo(__FILE__);
if (LANGUAGE_ID=="ru") __IncludeLang($spath["dirname"]."/lang/ru-".strtolower(LANG_CHARSET)."/".$spath["basename"]);

require_once($spath["dirname"]."/scripts/functions.php");
if (LANGUAGE_ID=="ru") __IncludeLang($spath["dirname"]."/lang/ru-".strtolower(LANG_CHARSET)."/scripts/functions.php");
else __IncludeLang($spath["dirname"]."/lang/en/scripts/functions.php");


class Step1 extends CWizardStep
{
	function InitStep()
	{
		$this->SetTitle(GetMessage('GSPC_STEP1_TITLE'));
		$this->SetStepID("step1");
		$this->SetCancelStep("cancel");

		$wizard = &$this->GetWizard();
				
		$wizard->SetDefaultVar("PERSON_TYPES", Array("fiz","ur","ip"));
	}

	function ShowStep()
	{
		
		if(CModule::IncludeModule("sale")) {
		
			$this->content = GetMessage("GSPC_STEP1_SELECT")."<br /><br />";
		
			$arTypes = Array("fiz","ur","ip");
		
			$i=1;
			foreach($arTypes as $type) {
				if($i>0) $this->content .= "<br />";
				$this->content .= $this->ShowCheckboxField("PERSON_TYPES[]",$type,Array("id"=>"WIZ_GSPC_PERSON_TYPES_".$i))."<label for=\"WIZ_GSPC_PERSON_TYPES_".$i."\"> ".GetMessage("GSPC_STEP1_PERSON_".$i)."</label>";
				$i++;
			}

			$this->content .= "<br /><br /><br />".GetMessage("GSPC_STEP1_SITE_ID").": ";

			$arSites = Array();			
			$rsSites = CSite::GetList($by="sort",$order="asc");
			while ($arSite = $rsSites->Fetch()) $arSites[$arSite["ID"]] = "[".$arSite["ID"]."] ".$arSite["NAME"];
			$this->content .= $this->ShowSelectField("SITE_ID",$arSites);

			$this->SetNextStep("final");
			
		} else {

			$this->SetError(GetMessage('GSPC_ERROR1'), "error1");

		}
		
	}

	function OnPostForm()
	{
		$wizard = &$this->GetWizard();
	
		global $DB;
	
		if ($wizard->IsNextButtonClick() || $wizard->IsFinishButtonClick())
		{
			$arErrors = Array();
			
			if (strlen($wizard->GetVar("SITE_ID"))<=0) $arErrors[] = GetMessage('GSPC_ERROR2');

			if(count($arErrors)>0) $this->SetError(implode("<br />", $arErrors), "error2");
			
		}
	}


}


class FinalStep extends CWizardStep
{
	function InitStep()
	{
		$this->SetTitle(GetMessage('GSPC_FINALSTEP_TITLE'));
		$this->SetStepID("final");
		$this->SetCancelStep("final");
		$this->SetCancelCaption(GetMessage('GSPC_FINALSTEP_BUTTONTITLE'));
	}

	function ShowStep()
	{
		global $APPLICATION,$DB,$USER;
		$this->content = GetMessage('GSPC_FINALSTEP_CONTENT');
		$wizard = &$this->GetWizard();
		if (LANGUAGE_ID=="ru") __IncludeLang($_SERVER["DOCUMENT_ROOT"].$wizard->GetPath()."/lang/ru-".strtolower(LANG_CHARSET)."/scripts/script.php");
		else __IncludeLang($_SERVER["DOCUMENT_ROOT"].$wizard->GetPath()."/lang/en/scripts/script.php");
		require_once($_SERVER["DOCUMENT_ROOT"].$wizard->GetPath()."/scripts/script.php");
		$this->content .= GrainWizardTools::ShowAdv($this);
	}
}


class CancelStep extends CWizardStep
{
	function InitStep()
	{
		$this->SetTitle(GetMessage('GSPC_CANCELSTEP_TITLE'));
		$this->SetStepID("cancel");
		$this->SetCancelStep("cancel");
		$this->SetCancelCaption(GetMessage('GSPC_CANCELSTEP_BUTTONTITLE'));
	}

	function ShowStep()
	{
		$this->content = GetMessage('GSPC_CANCELSTEP_CONTENT');
		$this->content .= GrainWizardTools::ShowAdv($this);		
	}
}
?>