<?php
include($_SERVER['DOCUMENT_ROOT'] .'/script/HeaderInc.php');
if ((true === isset($_SESSION['SessionAuth']['SvtAdmin']['reg']) && 1 == $_SESSION['SessionAuth']['SvtAdmin']['reg']) ||
    (true === isset($_SESSION['SessionAuth']['SvtOperatorAdv']['reg']) && 1 == $_SESSION['SessionAuth']['SvtOperatorAdv']['reg']) ||
    (true === isset($_SESSION['SessionAuth']['SvtOperator']['reg']) && 1 == $_SESSION['SessionAuth']['SvtOperator']['reg'])
   ){
  if(true === isset($_GET['repair_id']) && true === is_numeric($_GET['repair_id'])){
    $ObjRepairMod = new RepairMod($MS_SP);
    $ArrRepair = $ObjRepairMod->GetFromDb('SqlAll', 'GetRow', "a.repair_id = '". $_GET['repair_id'] ."'");
    $smarty->assign('ArrRepair', $ArrRepair);
    //SiteLibs::GetVarDump($ArrRepair);
    $ObjSvtMod = new SvtMod($MS_SP);
    $ArrSvt = $ObjSvtMod->GetFromDb('SqlAll', 'GetRow', "a.svt_id = '". $ArrRepair['svt_id'] ."'");
    $smarty->assign('ArrSvt', $ArrSvt);
    //SiteLibs::GetVarDump($ArrSvt);

    $ObjSvtStatusMod = new SvtStatusMod($MS_SP);
    $ArrSvtStatus = $ObjSvtStatusMod->GetFromDb('SqlAllLeft', 'GetAll', "b.svt_id = '". $ArrRepair['svt_id'] ."'");
    $smarty->assign('ArrSvtStatus', $ArrSvtStatus);
    $VarPagesTxt .= $smarty->fetch('DemandTransport/Form.tpl');
  }
  else{
    $smarty->assign('VarError', $MS_SP->Sp_LangMessage['error']['ErrSettingWrong']);
    $VarPagesTxt .= $smarty->fetch('error.tpl');
  }
}
else{
  $smarty->assign('VarError', $MS_SP->Sp_LangMessage['error']['ErrAuthAccessDenied']);
  $VarPagesTxt .= $smarty->fetch('AccessDenied.tpl');
}

$smarty->assign('VarPagesTxt', @$VarPagesTxt);
if (true === isset($MS_SP->SP_CurrPage['template_file']) && '' != $MS_SP->SP_CurrPage['template_file']){
	$smarty->display($MS_SP->SP_CurrPage['template_file']);
}
else {
	$smarty->display('Page.tpl');
}
include($_SERVER['DOCUMENT_ROOT'] .'/script/FooterInc.php');
?>
