<?php
include($_SERVER['DOCUMENT_ROOT'] .'/script/HeaderInc.php');
if(true === isset($_SESSION['SessionAuth']['id']) && 0 < $_SESSION['SessionAuth']['id']) {
  $smarty->assign('VarMenuMain', $VarMenu);
  $ObjUsersMod = new UsersMod($MS_SP);
  $ArrUsers = $ObjUsersMod->GetFromDb('SqlAll', 'GetRow', "u.users_id = '". $_SESSION['SessionAuth']['id'] ."'");
  $smarty->assign('ArrUsers', $ArrUsers);

  $smarty->assign('VarStructureOrganizationSelect', '1');
  $VarStructureOrganization = $smarty->fetch('StructureOrganization/TreeSelect.tpl');
  $smarty->assign('VarStructureOrganization', $VarStructureOrganization);

  require_once('File/Util.php');
  $ArrUiName = File_Util::listDir($MS_SP->Sp_PathTop.$MS_SP->Sp_PathToJquery .'/css/jqueryui/', FILE_LIST_DIRS, FILE_SORT_NONE);
  $smarty->assign('ArrUiName', $ArrUiName);
  //SiteLibs::GetVarDump($MS_SP->SP_UsersPref);
  $VarUsersProfileForm = $smarty->fetch('Users/Form.tpl');
  $smarty->assign('VarUsersProfileForm', $VarUsersProfileForm);
  $VarUsersPrefForm = $smarty->fetch('Users/FormPrefEdit.tpl');
  $smarty->assign('VarUsersPrefForm', $VarUsersPrefForm);

  $VarPagesTxt .= $smarty->fetch('Users/MyPref.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');
?>