Example #1
0
$calcVariations = $arResult['calcVariations'] = call_user_func(array($arParams['REPORT_HELPER_CLASS'], 'getCalcVariations'));
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="filter compare variations">
$compareVariations = $arResult['compareVariations'] = call_user_func(array($arParams['REPORT_HELPER_CLASS'], 'getCompareVariations'));
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="period types">
$periodTypes = $arResult['periodTypes'] = array('month', 'month_ago', 'week', 'week_ago', 'days', 'after', 'before', 'interval', 'all');
// </editor-fold>
try {
    // <editor-fold defaultstate="collapsed" desc="common initiazlize">
    $ownerId = call_user_func(array($arParams['REPORT_HELPER_CLASS'], 'getOwnerId'));
    $entityName = call_user_func(array($arParams['REPORT_HELPER_CLASS'], 'getEntityName'));
    $entityFields = call_user_func(array($arParams['REPORT_HELPER_CLASS'], 'getColumnList'));
    $initEntity = Entity\Base::getInstance($entityName);
    $strChains = $entityFields;
    $chains = CReport::generateChains($strChains, $initEntity, '');
    $arResult['chains'] = $chains;
    $arResult['fieldsTree'] = CReport::generateColumnTree($chains, $initEntity, $arParams['REPORT_HELPER_CLASS']);
    $fieldList = CReport::getUniqueFieldsByTree($arResult['fieldsTree']);
    // </editor-fold>
    // <editor-fold defaultstate="collapsed" desc="validation">
    if ($arParams['ACTION'] == 'edit' || $arParams['ACTION'] == 'copy' || $arParams['ACTION'] == 'delete') {
        $result = Bitrix\Report\ReportTable::getById($arParams['REPORT_ID']);
        $report = $result->fetch();
        if (empty($report)) {
            throw new BXUserException(sprintf(GetMessage('REPORT_NOT_FOUND'), $arParams['REPORT_ID']));
        }
        if ($report['CREATED_BY'] != $USER->GetID()) {
            throw new BXUserException(GetMessage('REPORT_VIEW_PERMISSION_DENIED'));
        }
        $arResult['report'] = $report;
Example #2
0
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="chart types">
if ($arParams['USE_CHART']) {
    $arResult['chartTypes'] = array(array('id' => 'line', 'name' => GetMessage('REPORT_CHART_TYPE_LINE1'), 'value_types' => array('float', 'integer')), array('id' => 'bar', 'name' => GetMessage('REPORT_CHART_TYPE_BAR1'), 'value_types' => array('float', 'integer')), array('id' => 'pie', 'name' => GetMessage('REPORT_CHART_TYPE_PIE'), 'value_types' => array('float', 'integer')));
}
// </editor-fold>
try {
    // <editor-fold defaultstate="collapsed" desc="common initiazlize">
    $ownerId = call_user_func(array($arParams['REPORT_HELPER_CLASS'], 'getOwnerId'));
    $entityName = call_user_func(array($arParams['REPORT_HELPER_CLASS'], 'getEntityName'));
    $entityFields = call_user_func(array($arParams['REPORT_HELPER_CLASS'], 'getColumnList'));
    $arResult['ufEnumerations'] = call_user_func(array($arParams['REPORT_HELPER_CLASS'], 'getUFEnumerations'));
    // customize entity
    $initEntity = clone Entity\Base::getInstance($entityName);
    call_user_func(array($arParams['REPORT_HELPER_CLASS'], 'setRuntimeFields'), $initEntity, '');
    $chains = CReport::generateChains($entityFields, $initEntity, '');
    $arResult['fieldsTree'] = CReport::generateColumnTree($chains, $initEntity, $arParams['REPORT_HELPER_CLASS']);
    $fieldList = CReport::getUniqueFieldsByTree($arResult['fieldsTree']);
    $bGroupingMode = false;
    // custom columns types
    $customColumnTypes = call_user_func(array($arParams['REPORT_HELPER_CLASS'], 'getCustomColumnTypes'));
    if (!is_array($customColumnTypes)) {
        $customColumnTypes = array();
    }
    $arResult['customColumnTypes'] = $customColumnTypes;
    // </editor-fold>
    // <editor-fold defaultstate="collapsed" desc="validation">
    if ($arParams['ACTION'] == 'edit' || $arParams['ACTION'] == 'copy' || $arParams['ACTION'] == 'delete') {
        $result = Bitrix\Report\ReportTable::getById($arParams['REPORT_ID']);
        $report = $result->fetch();
        if (empty($report)) {