Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
logfollow.php
1<?php
9
10use Bitrix\Main;
15
16Loc::loadMessages(__FILE__);
17
34class LogFollowTable extends Entity\DataManager
35{
36 public static function getTableName()
37 {
38 return 'b_sonet_log_follow';
39 }
40
41 public static function getMap()
42 {
43 $fieldsMap = array(
44 'USER_ID' => array(
45 'data_type' => 'integer',
46 'primary' => true
47 ),
48 'CODE' => array(
49 'data_type' => 'string',
50 'primary' => true
51 ),
52 'TYPE' => array(
53 'data_type' => 'boolean',
54 'values' => array('N','Y')
55 ),
56 );
57
58 return $fieldsMap;
59 }
60
61 public static function getDefaultValue($params = array())
62 {
63 global $USER;
64
65 $siteId = (
66 isset($params['SITE_ID'])
67 ? $params['SITE_ID']
68 : SITE_ID
69 );
70
71 $defaultValue = Option::get("socialnetwork", "follow_default_type", "Y", $siteId);
72
73 $userId = (
74 isset($params['USER_ID'])
75 ? $params['USER_ID']
76 : ($USER->isAuthorized() ? $USER->getId() : false)
77 );
78
79 if (intval($userId) <= 0)
80 {
81 return $defaultValue;
82 }
83
84 $res = self::getList(array(
85 'filter' => array(
86 "USER_ID" => $userId,
87 "=CODE" => "**"
88 ),
89 'select' => array('TYPE')
90 )
91 );
92 if ($follow = $res->fetch())
93 {
94 $defaultValue = $follow['TYPE'];
95 }
96
97 return $defaultValue;
98 }
99
100 public static function add(array $data)
101 {
102 throw new NotImplementedException("Use add() method of the class.");
103 }
104
105 public static function update($primary, array $data)
106 {
107 throw new NotImplementedException("Use update() method of the class.");
108 }
109}
static loadMessages($file)
Definition loc.php:64
static getDefaultValue($params=array())
Definition logfollow.php:61
static update($primary, array $data)