function getMobileReports() { define('COLUMNS_COUNT_FOR_SIMPLE_TEMPLATE', 3); define('PATH_TO_MOBILE_REPORTS', '/bitrix/admin/mobile/sale_reports_view.php'); // Using report module if (!CModule::IncludeModule('report')) { return false; } // Using catalog module if (!CModule::IncludeModule('catalog')) { return false; } CBaseSaleReportHelper::initOwners(); $dbRepList = Bitrix\Report\ReportTable::getList(array('select' => array('ID', 'TITLE', 'SETTINGS'), 'filter' => array('=CREATED_BY' => $GLOBALS["USER"]->GetID(), '=OWNER_ID' => CBaseSaleReportHelper::getOwners()))); $arMenuItems = array(); while ($arReport = $dbRepList->fetch()) { $settings = unserialize($arReport['SETTINGS']); if (isset($settings['mobile']) && is_array($settings['mobile']) && isset($settings['mobile']['enabled']) && $settings['mobile']['enabled'] == true) { if (count($settings['select']) <= COLUMNS_COUNT_FOR_SIMPLE_TEMPLATE) { $template = "admin_mobile"; } else { $template = "admin_mobile_encl"; } $arMenuItems[] = array("text" => htmlspecialcharsbx($arReport['TITLE']), "data-url" => PATH_TO_MOBILE_REPORTS . '?ID=' . $arReport['ID'] . '&rep_templ=' . $template); } } if (empty($arMenuItems)) { return false; } else { return array("text" => GetMessage("SMOB_REPORTS"), "type" => "section", "items" => $arMenuItems); } }
"page_icon" => "sale_page_icon_statistic", "items_id" => "menu_sale_stat", "items" => array(), ); if(IsModuleInstalled('report')) { $arSaleReports = array(); if(method_exists($adminMenu, "IsSectionActive")) { if($adminMenu->IsSectionActive("menu_sale_report") && CModule::IncludeModule("report")) { CModule::IncludeModule("sale"); CBaseSaleReportHelper::initOwners(); $dbRepList = Bitrix\Report\ReportTable::getList(array( 'select' => array('ID', 'TITLE', 'DESCRIPTION'), 'filter' => array('=CREATED_BY' => $USER->GetID(), '=OWNER_ID' => CBaseSaleReportHelper::getOwners()) )); while($arReport = $dbRepList->fetch()) { $arSaleReports[] = array( "text" => htmlspecialcharsbx($arReport["TITLE"]), "title" => htmlspecialcharsbx($arReport["DESCRIPTION"]), "url" => "sale_report_view.php?lang=".LANGUAGE_ID."&ID=".$arReport["ID"], "more_url" => array("sale_report_construct.php?lang=".LANGUAGE_ID."&ID=".$arReport["ID"]), ); } } } $arMenu["items"][] = array( "text" => GetMessage("SALE_REPORTS_DESCR"),
// add fresh vReports CReport::addFreshDefaultReports($vReports, $ownerId); } } } } // create default reports by user request if ($isPost && !empty($_POST['CREATE_DEFAULT'])) { $dReports = call_user_func(array($helperClassName, 'getDefaultReports')); foreach ($dReports as $moduleVer => $vReports) { CReport::addFreshDefaultReports($vReports, $ownerId); } LocalRedirect($arParams['PATH_TO_REPORT_LIST']); } // main action $arResult['list'] = array(); $result = Bitrix\Report\ReportTable::getList(array('order' => array('ID' => 'ASC'), 'select' => array('ID', 'TITLE', 'DESCRIPTION', 'CREATED_DATE'), 'filter' => array('=CREATED_BY' => $USER->GetID(), '=OWNER_ID' => $ownerId))); while ($row = $result->fetch()) { $arResult['list'][] = $row; } // add default reports always if them isn't present if (empty($arResult['list'])) { $dReports = call_user_func(array($helperClassName, 'getDefaultReports')); foreach ($dReports as $moduleVer => $vReports) { CReport::addFreshDefaultReports($vReports, $ownerId); } LocalRedirect($arParams['PATH_TO_REPORT_LIST']); } global $DB; $arResult['dateFormat'] = $DB->DateFormatToPHP(CSite::GetDateFormat("SHORT")); $this->IncludeComponentTemplate();
public static function GetList($owner = '') { global $USER; return Bitrix\Report\ReportTable::getList(array('select' => array('ID', 'TITLE', 'DESCRIPTION', 'CREATED_DATE'), 'filter' => array('=CREATED_BY' => $USER->GetID(), '=OWNER_ID' => $owner))); }