1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
dataexport.php
См. документацию.
1<?php
8namespace Bitrix\Sender\Internals;
9
10use Bitrix\Main\DB\Result;
11
17{
26 public static function toCsv(array $columns, $list, $rowCallback = null)
27 {
29
30 $eol = "\n";
31 $columnNames = [];
32 $isFirstLinePrinted = false;
33
34 echo chr(239) . chr(187) . chr(191);
35
36 foreach ($list as $item)
37 {
38 if ($rowCallback)
39 {
40 $item = call_user_func_array($rowCallback, [$item]);
41 }
42
43 $row = [];
44 foreach ($columns as $column)
45 {
46 if (!array_key_exists($column['id'], $item))
47 {
48 continue;
49 }
50
51 if (!$isFirstLinePrinted)
52 {
53 $columnNames[] = str_replace('"', '""', $column['name']);
54 }
55
56 $row[] = str_replace('"', '""', trim($item[$column['id']]));
57 }
58
59 if (!$isFirstLinePrinted)
60 {
61 echo '"' . implode('";"', $columnNames) . '"';
62 $isFirstLinePrinted = true;
63 }
64 echo $eol;
65 echo '"' . implode('";"', $row) . '"';
66 }
67
68 exit;
69 }
70
71 protected static function flushHeaders()
72 {
73 $GLOBALS['APPLICATION']->RestartBuffer();
74
75 header('Content-Description: File Transfer');
76 header('Content-Type: text/csv; charset='.LANG_CHARSET);
77 header('Content-Disposition: attachment; filename=address_list.csv');
78 header('Content-Transfer-Encoding: binary');
79 header('Expires: 0');
80 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
81 header('Pragma: public');
82 }
83}
static toCsv(array $columns, $list, $rowCallback=null)
Определения dataexport.php:26
static flushHeaders()
Определения dataexport.php:71
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
const LANG_CHARSET
Определения include.php:65
$GLOBALS['____1690880296']
Определения license.php:1