<?php
include($_SERVER['DOCUMENT_ROOT'] .'/script/HeaderInc.php');
if('XMLHttpRequest' == $_SERVER['HTTP_X_REQUESTED_WITH'] && true === isset($_GET['demands_id']) && true === is_numeric($_GET['demands_id'])){
  $ObjDemandsCommentsMod = new DemandsCommentsMod($MS_SP);
  $ArrDemandsComments = $ObjDemandsCommentsMod->GetFromDb('SqlAll', 'GetAll', "a.demands_id = '". $_GET['demands_id'] ."'", 'demandscomments_date DESC');
  //SiteLibs::GetVarDump($ArrDemandsComments);
  $ArrDemandsComments = SiteLibs::array2tree($ArrDemandsComments, 0, 'sub', 'demandscomments_id', 'demandscommentsparent_id');
  $smarty->assign('ArrDemandsComments', $ArrDemandsComments);
//  SiteLibs::GetVarDump($ArrDemandsComments);
  $VarPagesTxt = $smarty->fetch('Demands/OpDemandsDetailCommentsFirst.tpl');
}
else{
  $smarty->assign('VarError', $MS_SP->Sp_LangMessage['error']['ErrSettingWrong']);
  $VarPagesTxt = $smarty->fetch('error.tpl');
}
echo $VarPagesTxt;
include($_SERVER['DOCUMENT_ROOT'] .'/script/FooterInc.php');
?>