<?php
include($_SERVER['DOCUMENT_ROOT'] .'/script/HeaderInc.php');
if('XMLHttpRequest' == $_SERVER['HTTP_X_REQUESTED_WITH'] && true === isset($_SESSION['SessionAuth']['id']) && 0 < $_SESSION['SessionAuth']['id']) {
  $ObjUsersMod = new UsersMod($MS_SP);
  $VarWhereAdd = 'us.webservices_id = -1';
  if(true === isset($_SESSION['SessionAuth']['id']) && true === is_numeric($_SESSION['SessionAuth']['id'])){
    $VarWhereAdd = 'u.users_id = "'. $_SESSION['SessionAuth']['id'] .'"';
  }
  if(true === isset($_SESSION['SessionAuth']['SvtAdmin']['reg']) && 1 == $_SESSION['SessionAuth']['SvtAdmin']['reg']){
    $VarWhereAdd = 'us.webservices_id IN (1,2,3)';
  }
  $ArrUsersMaster = $ObjUsersMod->GetFromDb('SqlServices', 'GetAll', $VarWhereAdd);
  $smarty->assign('ArrUsersMaster', $ArrUsersMaster);
  if(true === isset($_GET['svtgiveout_id']) && true === is_numeric($_GET['svtgiveout_id'])){
    $ObjSvtGiveoutMod = new SvtGiveoutMod($MS_SP);
    $ArrSvtGiveout = $ObjSvtGiveoutMod->GetFromDb('SqlAll', 'GetRow', "a.svtgiveout_id = '". $_GET['svtgiveout_id'] ."'");
    $smarty->assign('ArrSvtGiveout', $ArrSvtGiveout);
  }
  $VarReturn = $smarty->fetch('SvtGiveout/Form.tpl');
}
else{
  $VarReturn = $MS_SP->Sp_LangMessage['error']['ErrFuncAccessDenied'];
}
echo $VarReturn;
include($_SERVER['DOCUMENT_ROOT'] .'/script/FooterInc.php');
?>