1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
lastused.php
См. документацию.
1<?php
2namespace Bitrix\Landing\Update\Block;
3
4use Bitrix\Landing\Internals\BlockTable;
5use Bitrix\Main\Application;
6use Bitrix\Main\Config\Option;
7use Bitrix\Main\Update\Stepper;
8
9class LastUsed extends Stepper
10{
11 const OPTION_CODE = 'update_landing_lastused';
12
17 protected static $moduleId = 'landing';
18
24 private static function massInsertBlocks(int $userId): void
25 {
26 $sql = "DELETE FROM b_landing_block_last_used WHERE USER_ID={$userId};";
27 Application::getConnection()->query($sql);
28
29 $sql = "INSERT INTO b_landing_block_last_used (USER_ID, CODE, DATE_CREATE)
30 SELECT
31 CREATED_BY_ID as USER_ID, CODE, MAX(DATE_CREATE) DATE_CREATE
32 FROM
33 b_landing_block
34 WHERE
35 CREATED_BY_ID={$userId}
36 AND PUBLIC='N'
37 AND DELETED='N'
38 GROUP BY
39 CREATED_BY_ID, CODE
40 ORDER BY
41 DATE_CREATE DESC
42 ;";
43 Application::getConnection()->query($sql);
44 }
45
51 public function execute(array &$option): bool
52 {
53 $lastId = Option::get('landing', self::OPTION_CODE, 0);
54
55 if (!isset($option['steps']))
56 {
57 $option['steps'] = 0;
58 }
59
60 // total counts
61 $option['count'] = count(BlockTable::getList([
62 'select' => [
63 'CREATED_BY_ID',
65 'CNT', 'COUNT(*)'
66 )
67 ],
68 'filter' => [
69 '=PUBLIC' => 'N'
70 ],
71 'group' => [
72 'CREATED_BY_ID'
73 ]
74 ])->fetchAll());
75
76 // current step
77 $finished = true;
78 $resBlocks = BlockTable::getList([
79 'select' => [
80 'CREATED_BY_ID'
81 ],
82 'filter' => [
83 '=PUBLIC' => 'N',
84 '>CREATED_BY_ID' => $option['steps']
85 ],
86 'group' => [
87 'CREATED_BY_ID'
88 ],
89 'order' => [
90 'CREATED_BY_ID' => 'asc'
91 ]
92 ]);
93 if ($row = $resBlocks->fetch())
94 {
95 $finished = false;
96 $option['steps']++;
97 self::massInsertBlocks($row['CREATED_BY_ID']);
98 }
99
100 if (!$finished)
101 {
102 Option::set('landing', self::OPTION_CODE, $lastId);
103 return true;
104 }
105 else
106 {
107 Option::delete('landing', ['name' => self::OPTION_CODE]);
108 return false;
109 }
110 }
111}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
execute(array &$option)
Определения lastused.php:51
if(!\Bitrix\Main\Loader::includeModule('clouds')) $lastId
Определения sync.php:68
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
Определения ufield.php:9
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
$option
Определения options.php:1711