Пример #1
0
     break;
 case "add_comment_full_report":
     $bReturnRes = true;
     $ID = intval($_POST["report_id"]);
     $dbReport = CTimeManReportFull::GetByID($ID);
     $report = $dbReport->Fetch();
     if ($report && CModule::IncludeModule("forum")) {
         $OWNER = intval($report["USER_ID"]);
         $CURRENT_USER = $USER->GetID();
         $arAccessUsers = CTimeMan::GetAccess();
         $bCanEditAll = in_array('*', $arAccessUsers['WRITE']);
         $bCanReadAll = in_array('*', $arAccessUsers['READ']);
         $bCanAddComment = in_array($OWNER, $arAccessUsers['WRITE']) || CTimeMan::IsAdmin() || $bCanEditAll || $OWNER == $CURRENT_USER;
         if ($_POST["add_comment"] == "Y" && $bCanAddComment) {
             $arFields = array("REPORT_ID" => $ID, "COMMENT_TEXT" => $_POST["comment_text"], "USER_ID" => $CURRENT_USER, "REPORT_OWNER" => $OWNER);
             $comment_id = CReportNotifications::AddCommentToLog($arFields);
             ob_start();
             $APPLICATION->IncludeComponent("bitrix:timeman.topic.reviews", "", array("REPORT_ID" => $ID), false);
             $res["COMMENTS"] = ob_get_contents();
             ob_end_clean();
             $count = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $report['FORUM_TOPIC_ID']), true);
             $res["COMMENTS_COUNT"] = $count;
         } else {
             $res = array("ERROR" => "ADD COMMENT ERROR");
         }
     } else {
         $res = array("ERROR" => "ADD COMMENT ERROR");
     }
     break;
 case "add_comment_entry":
     $bReturnRes = true;