Example #1
0
    }
    // Footer under the table
    $strFooter = $count > 0 ? GetMessage('MB_CAL_EVENTS_COUNT', array("#COUNT#" => $count)) : GetMessage('MB_CAL_NO_EVENTS');
    // Kill unused sections
    if (!$bToday && !$bTomorrow) {
        $use_sections = "NO";
        $arSections = array();
    } else {
        $arSections_ = array();
        foreach ($arSections as $ind => $sect) {
            if ($sect['ID'] == 'today' && $bToday) {
                $arSections_[] = $sect;
            }
            if ($sect['ID'] == 'tomorrow' && $bTomorrow) {
                $arSections_[] = $sect;
            }
            if ($sect['ID'] == 'later' && $bLater) {
                $arSections_[] = $sect;
            }
        }
        $arSections = $arSections_;
    }
    $res = array("TABLE_SETTINGS" => array("footer" => CMobile::PrepareStrToJson($strFooter), "use_sections" => $use_sections));
    if ($use_sections != "NO") {
        $res["data"] = array("events" => $arResult['EVENTS']);
        $res["sections"] = array("events" => $arSections);
    } else {
        $res["data"] = $arResult['EVENTS'];
    }
    return $res;
}