1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
logpinned.php
См. документацию.
1<?php
8namespace Bitrix\Socialnetwork;
9
10use Bitrix\Main;
11use Bitrix\Main\Entity;
12use Bitrix\Main\Localization\Loc;
13use Bitrix\Main\NotImplementedException;
14
15Loc::loadMessages(__FILE__);
16
33class LogPinnedTable extends Entity\DataManager
34{
35 public static function getTableName()
36 {
37 return 'b_sonet_log_pinned';
38 }
39
40 public static function getMap()
41 {
42 $fieldsMap = [
43 'LOG_ID' => [
44 'data_type' => 'integer',
45 'primary' => true
46 ],
47 'USER_ID' => [
48 'data_type' => 'integer',
49 'primary' => true
50 ],
51 'PINNED_DATE' => [
52 'data_type' => 'datetime',
53 ],
54 ];
55
56 return $fieldsMap;
57 }
58
59
60 public static function set(array $params = [])
61 {
62 global $USER;
63
64 $logId = (isset($params['logId']) ? intval($params['logId']) : 0);
65 $userId = (isset($params['userId']) ? intval($params['userId']) : (is_object($USER) && $USER instanceof \CUser ? $USER->getId() : 0));
66
67 if ($logId <= 0)
68 {
69 throw new Main\SystemException("Empty logId.");
70 }
71
72 if ($userId <= 0)
73 {
74 throw new Main\SystemException("Empty userId.");
75 }
76
78 $helper = $connection->getSqlHelper();
79
80 $insertFields = [
81 'LOG_ID' => $logId,
82 'USER_ID' => $userId,
83 'PINNED_DATE' => new \Bitrix\Main\DB\SqlExpression($helper->getCurrentDateTimeFunction()),
84 ];
85
86 $updateFields = [
87 'PINNED_DATE' => new \Bitrix\Main\DB\SqlExpression($helper->getCurrentDateTimeFunction()),
88 ];
89
90 $merge = $helper->prepareMerge(
91 static::getTableName(),
92 [ 'LOG_ID', 'USER_ID' ],
93 $insertFields,
94 $updateFields
95 );
96
97 if ($merge[0] != "")
98 {
99 $connection->query($merge[0]);
100 }
101 }
102
103 public static function add(array $data)
104 {
105 throw new NotImplementedException("Use set() method of the class.");
106 }
107
108 public static function update($primary, array $data)
109 {
110 throw new NotImplementedException("Use set() method of the class.");
111 }
112}
$connection
Определения actionsdefinitions.php:38
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
static getConnection($name="")
Определения application.php:638
static add(array $data)
Определения logpinned.php:103
static update($primary, array $data)
Определения logpinned.php:108
static getTableName()
Определения logpinned.php:35
$data['IS_AVAILABLE']
Определения .description.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
global $USER
Определения csv_new_run.php:40
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799