1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
prolog.php
См. документацию.
1<?php
3
13function perfmon_NumberFormat($num, $dec = 2, $mode = 0)
14{
15 switch ($mode)
16 {
17 case 1:
18 $str = number_format($num, $dec, '.', '');
19 break;
20 case 2:
21 $str = number_format($num, $dec, '.', ' ');
22 $str = str_replace(' ', '<span></span>', $str);
23 $str = '<span class="perfmon_number">' . $str . '</span>';
24 break;
25 default:
26 if (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'excel')
27 {
28 $str = perfmon_NumberFormat($num, $dec, 1);
29 }
30 else
31 {
32 $str = perfmon_NumberFormat($num, $dec, 2);
33 }
34 break;
35 }
36 return $str;
37}
38
40{
41 public $id = '';
42 public $info = [];
43
44 public function __construct($id, $info)
45 {
46 $this->id = $id;
47 $this->info = $info;
48 }
49
50 public function getRowView($arRes)
51 {
52 return false;
53 }
54
55 public function getRowEdit($arRes)
56 {
57 return false;
58 }
59
60 public function getFilterInput()
61 {
62 return '<input type="text" name="' . $this->info['filter'] . '" size="47" value="' . htmlspecialcharsbx($GLOBALS[$this->info['filter']]) . '">';
63 }
64}
65
67{
68 public $list = [];
69
70 public function __construct($id, $info, array $list = [])
71 {
72 parent::__construct($id, $info);
73 $this->list = $list;
74 }
75
76 public function getRowView($arRes)
77 {
78 $value = $arRes[$this->id];
79 return $this->list[$value];
80 }
81
82 public function getRowEdit($arRes)
83 {
84 return false;
85 }
86
87 public function getFilterInput()
88 {
89 $arr = [
90 'reference' => [],
91 'reference_id' => [],
92 ];
93 foreach ($this->list as $key => $value)
94 {
95 $arr['reference'][] = $value;
96 $arr['reference_id'][] = $key;
97 }
98 return SelectBoxFromArray($this->info['filter'], $arr, htmlspecialcharsbx($GLOBALS[$this->info['filter']]), GetMessage('MAIN_ALL'));
99 }
100}
101
103{
104 public $precision = 0;
105
106 public function __construct($id, $info, $precision)
107 {
108 $info['align'] = 'right';
109 parent::__construct($id, $info);
110 $this->precision = $precision;
111 }
112
113 public function getRowView($arRes)
114 {
115 if (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'excel')
116 {
117 return number_format($arRes[$this->id], $this->precision, '.', '');
118 }
119 else
120 {
121 return str_replace(' ', '&nbsp;', number_format($arRes[$this->id], $this->precision, '.', ' '));
122 }
123 }
124}
125
127{
128 protected $pageTitle = '';
129 protected $sTableID = '';
130 protected $navLabel = '';
131 protected $sort = null;
132 protected $list = null;
133 protected $data = null;
134 protected $columns = [];
135
142 public function __construct($pageTitle, $sTableID, $arSort = false, $navLabel = '')
143 {
144 $this->pageTitle = $pageTitle;
145 $this->sTableID = $sTableID;
146 $this->navLabel = $navLabel;
147 if (is_array($arSort))
148 {
149 $this->sort = new CAdminSorting($this->sTableID, key($arSort), current($arSort));
150 }
151 else
152 {
153 $this->sort = false;
154 }
155 $this->list = new CAdminList($this->sTableID, $this->sort);
156 }
157
158 public function addColumn(CAdminListColumn $column)
159 {
160 $this->columns[$column->id] = $column;
161 }
162
163 public function initFilter()
164 {
165 $FilterArr = [
166 'find',
167 'find_type',
168 ];
169 foreach ($this->columns as $column)
170 {
171 if (isset($column->info['filter']))
172 {
173 $FilterArr[] = $column->info['filter'];
174 }
175 }
176 $this->list->InitFilter($FilterArr);
177 }
178
179 public function getFilter()
180 {
181 global $find, $find_type;
182
183 $arFilter = [];
184 foreach ($this->columns as $column)
185 {
186 if (
187 isset($column->info['filter'])
188 && isset($column->info['filter_key'])
189 )
190 {
191 if (
192 isset($column->info['find_type'])
193 && $find !== ''
194 && $find_type === $column->info['find_type']
195 )
196 {
197 $arFilter[$column->info['filter_key']] = $find;
198 }
199 elseif (
200 isset($GLOBALS[$column->info['filter']])
201 )
202 {
203 $arFilter[$column->info['filter_key']] = $GLOBALS[$column->info['filter']];
204 }
205 }
206 }
207
208 foreach ($arFilter as $key => $value)
209 {
210 if ((string)$value === '')
211 {
212 unset($arFilter[$key]);
213 }
214 }
215
216 return $arFilter;
217 }
218
219 public function getHeaders()
220 {
221 $arHeaders = [];
222 foreach ($this->columns as $column)
223 {
224 $arHeaders[] = [
225 'id' => $column->id,
226 'content' => $column->info['content'],
227 'sort' => $column->info['sort'],
228 'align' => $column->info['align'] ?? '',
229 'default' => $column->info['default'] ?? '',
230 ];
231 }
232 return $arHeaders;
233 }
234
235 public function getSelectedFields()
236 {
237 $arSelectedFields = $this->list->GetVisibleHeaderColumns();
238 if (!is_array($arSelectedFields) || empty($arSelectedFields))
239 {
240 $arSelectedFields = [];
241 foreach ($this->columns as $column)
242 {
243 if ($column->info['default'])
244 {
245 $arSelectedFields[] = $column->id;
246 }
247 }
248 }
249 return $arSelectedFields;
250 }
251
252 public function getDataSource($arOrder, $arFilter, $arSelect)
253 {
254 $rsData = new CDBResult;
255 $rsData->InitFromArray([]);
256 return $rsData;
257 }
258
259 public function getOrder()
260 {
261 global $by, $order;
262 return [$by => $order];
263 }
264
265 public function getFooter()
266 {
267 return [];
268 }
269
270 public function getContextMenu()
271 {
272 return [];
273 }
274
275 public function displayFilter()
276 {
277 global $APPLICATION, $find, $find_type;
278
279 $findFilter = [
280 'reference' => [],
281 'reference_id' => [],
282 ];
283 $listFilter = [];
284 foreach ($this->columns as $column)
285 {
286 if (isset($column->info['filter']))
287 {
288 $listFilter[$column->info['filter']] = $column->info['content'];
289 if (isset($column->info['find_type']))
290 {
291 $findFilter['reference'][] = $column->info['content'];
292 $findFilter['reference_id'][] = $column->info['find_type'];
293 }
294 }
295 }
296
297 if (!empty($listFilter))
298 {
299 $this->filter = new CAdminFilter($this->sTableID . '_filter', $listFilter);
300 ?>
301 <form name="find_form" method="get" action="<?php echo $APPLICATION->GetCurPage(); ?>">
302 <?php $this->filter->Begin(); ?>
303 <?php if (!empty($findFilter['reference'])): ?>
304 <tr>
305 <td><b><?=GetMessage('PERFMON_HIT_FIND')?>:</b></td>
306 <td><input
307 type="text" size="25" name="find"
308 value="<?php echo htmlspecialcharsbx($find) ?>"><?php echo SelectBoxFromArray('find_type', $findFilter, $find_type, '', ''); ?>
309 </td>
310 </tr>
311 <?php endif; ?>
312 <?php
313 foreach ($this->columns as $column)
314 {
315 if (isset($column->info['filter']))
316 {
317 ?>
318 <tr>
319 <td><?php echo $column->info['content'] ?></td>
320 <td><?php echo $column->getFilterInput() ?></td>
321 </tr><?php
322 }
323 }
324 $this->filter->Buttons([
325 'table_id' => $this->sTableID,
326 'url' => $APPLICATION->GetCurPage(),
327 'form' => 'find_form',
328 ]);
329 $this->filter->End();
330 ?>
331 </form>
332 <?php
333 }
334 }
335
336 public function show()
337 {
338 global $APPLICATION;
339
340 $this->initFilter();
341 $this->list->AddHeaders($this->getHeaders());
342 $select = $this->getSelectedFields();
343
344 $dataSource = $this->getDataSource($this->getOrder(), $this->getFilter(), $select);
345 $this->data = new CAdminResult($dataSource, $this->sTableID);
346 $this->data->NavStart();
347 $this->list->NavText($this->data->GetNavPrint($this->navLabel));
348
349 $i = 0;
350 while ($arRes = $this->data->GetNext())
351 {
352 $row = $this->list->AddRow(++$i, $arRes);
353 foreach ($select as $fieldId)
354 {
356 $column = $this->columns[$fieldId] ?? '';
357 if ($column)
358 {
359 $view = $column->getRowView($arRes);
360 if ($view !== false)
361 {
362 $row->AddViewField($column->id, $view);
363 }
364 $edit = $column->getRowEdit($arRes);
365 if ($edit !== false)
366 {
367 $row->AddEditField($column->id, $edit);
368 }
369 }
370 }
371 }
372
373 $this->list->AddFooter($this->getFooter());
374 $this->list->AddAdminContextMenu($this->getContextMenu());
375 $this->list->CheckListMode();
376 $APPLICATION->SetTitle($this->pageTitle);
377 global
379 require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_admin_after.php';
380 $this->displayFilter();
381 $this->list->DisplayList();
382 }
383}
global $APPLICATION
Определения include.php:80
Определения admin_filter.php:13
Определения prolog.php:40
getFilterInput()
Определения prolog.php:60
__construct($id, $info)
Определения prolog.php:44
getRowEdit($arRes)
Определения prolog.php:55
getRowView($arRes)
Определения prolog.php:50
$info
Определения prolog.php:42
$id
Определения prolog.php:41
Определения prolog.php:67
getFilterInput()
Определения prolog.php:87
__construct($id, $info, array $list=[])
Определения prolog.php:70
$list
Определения prolog.php:68
getRowEdit($arRes)
Определения prolog.php:82
getRowView($arRes)
Определения prolog.php:76
getRowView($arRes)
Определения prolog.php:113
__construct($id, $info, $precision)
Определения prolog.php:106
$precision
Определения prolog.php:104
Определения admin_list.php:16
Определения prolog.php:127
getHeaders()
Определения prolog.php:219
$columns
Определения prolog.php:134
__construct($pageTitle, $sTableID, $arSort=false, $navLabel='')
Определения prolog.php:142
getFilter()
Определения prolog.php:179
$list
Определения prolog.php:132
$pageTitle
Определения prolog.php:128
getOrder()
Определения prolog.php:259
$navLabel
Определения prolog.php:130
$sort
Определения prolog.php:131
displayFilter()
Определения prolog.php:275
$data
Определения prolog.php:133
getContextMenu()
Определения prolog.php:270
initFilter()
Определения prolog.php:163
getDataSource($arOrder, $arFilter, $arSelect)
Определения prolog.php:252
getSelectedFields()
Определения prolog.php:235
addColumn(CAdminListColumn $column)
Определения prolog.php:158
$sTableID
Определения prolog.php:129
getFooter()
Определения prolog.php:265
Определения admin_lib.php:2054
Определения admin_lib.php:1890
$str
Определения commerceml2.php:63
$arr
Определения file_new.php:624
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$_REQUEST["admin_mnu_menu_id"]
Определения get_menu.php:8
$select
Определения iblock_catalog_list.php:194
global $adminMenu
Определения init_admin.php:7
global $adminPage
Определения init_admin.php:7
global $adminChain
Определения init_admin.php:7
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
global $USER
Определения csv_new_run.php:40
endif
Определения csv_new_setup.php:990
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
GetMessage($name, $aReplace=null)
Определения tools.php:3397
SelectBoxFromArray( $strBoxName, $db_array, $strSelectedVal="", $strDetText="", $field1="class='typeselect'", $go=false, $form="form1")
Определения tools.php:216
$order
Определения payment.php:8
perfmon_NumberFormat($num, $dec=2, $mode=0)
Определения prolog.php:13
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
if(empty($signedUserToken)) $key
Определения quickway.php:257
$i
Определения factura.php:643
font size
Определения invoice.php:442
$arRes
Определения options.php:104
$GLOBALS['_____370096793']
Определения update_client.php:1
if(file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/updater.log") &&is_file($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/updater.log") &&is_readable($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/updater.log")) $rsData
Определения update_log.php:102
$arFilter
Определения user_search.php:106