1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
user_events.php
См. документацию.
1<?php
2
4
6{
7 /***************************************/
8 /******** DATA MODIFICATION **********/
9 /***************************************/
10 public static function CheckFields($ACTION, &$arFields, $ID = 0)
11 {
13
14 if ($ACTION != "ADD" && intval($ID) <= 0)
15 {
16 $GLOBALS["APPLICATION"]->ThrowException("System error 870164", "ERROR");
17 return false;
18 }
19
20 if ((is_set($arFields, "USER_ID") || $ACTION=="ADD") && intval($arFields["USER_ID"]) <= 0)
21 {
22 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UE_EMPTY_USER_ID"), "EMPTY_USER_ID");
23 return false;
24 }
25 elseif (is_set($arFields, "USER_ID"))
26 {
27 $dbResult = CUser::GetByID($arFields["USER_ID"]);
28 if (!$dbResult->Fetch())
29 {
30 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UE_ERROR_NO_USER_ID"), "ERROR_NO_USER_ID");
31 return false;
32 }
33 }
34
35 if ((is_set($arFields, "EVENT_ID") || $ACTION=="ADD") && $arFields["EVENT_ID"] == '')
36 {
37 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UE_EMPTY_EVENT_ID"), "EMPTY_EVENT_ID");
38 return false;
39 }
40 elseif (is_set($arFields, "EVENT_ID") && !in_array($arFields["EVENT_ID"], $arSocNetUserEvents))
41 {
42 $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["EVENT_ID"], GetMessage("SONET_UE_ERROR_NO_EVENT_ID")), "ERROR_NO_EVENT_ID");
43 return false;
44 }
45
46 if ((is_set($arFields, "SITE_ID") || $ACTION=="ADD") && $arFields["SITE_ID"] == '')
47 {
48 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UE_EMPTY_SITE_ID"), "EMPTY_SITE_ID");
49 return false;
50 }
51 elseif (is_set($arFields, "SITE_ID"))
52 {
53 $dbResult = CSite::GetByID($arFields["SITE_ID"]);
54 if (!$dbResult->Fetch())
55 {
56 $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["SITE_ID"], GetMessage("SONET_UE_ERROR_NO_SITE")), "ERROR_NO_SITE");
57 return false;
58 }
59 }
60
61 if ((is_set($arFields, "ACTIVE") || $ACTION=="ADD") && $arFields["ACTIVE"] != "Y" && $arFields["ACTIVE"] != "N")
62 $arFields["ACTIVE"] = "Y";
63
64 return True;
65 }
66
67 public static function Delete($ID)
68 {
69 global $DB;
70
71 if (!CSocNetGroup::__ValidateID($ID))
72 return false;
73
74 $ID = intval($ID);
75 $bSuccess = True;
76
77 if ($bSuccess)
78 $bSuccess = $DB->Query("DELETE FROM b_sonet_user_events WHERE ID = ".$ID."", true);
79
80 return $bSuccess;
81 }
82
83 public static function DeleteNoDemand($userID)
84 {
85 global $DB;
86
87 if (!CSocNetGroup::__ValidateID($userID))
88 return false;
89
90 $userID = intval($userID);
91 $bSuccess = True;
92
93 if ($bSuccess)
94 $bSuccess = $DB->Query("DELETE FROM b_sonet_user_events WHERE USER_ID = ".$userID."", true);
95
96 return $bSuccess;
97 }
98
99 public static function Update($ID, $arFields)
100 {
101 global $DB;
102
103 if (!CSocNetGroup::__ValidateID($ID))
104 return false;
105
106 $ID = intval($ID);
107
109
111 return false;
112
113 $strUpdate = $DB->PrepareUpdate("b_sonet_user_events", $arFields);
115
116 if ($strUpdate <> '')
117 {
118 $strSql =
119 "UPDATE b_sonet_user_events SET ".
120 " ".$strUpdate." ".
121 "WHERE ID = ".$ID." ";
122 $DB->Query($strSql);
123 }
124 else
125 {
126 $ID = False;
127 }
128
129 return $ID;
130 }
131
132 /***************************************/
133 /********** DATA SELECTION ***********/
134 /***************************************/
135 public static function GetByID($ID)
136 {
137 global $DB;
138
139 if (!CSocNetGroup::__ValidateID($ID))
140 return false;
141
142 $ID = intval($ID);
143
144 $dbResult = CSocNetUserEvents::GetList(Array(), Array("ID" => $ID));
145 if ($arResult = $dbResult->GetNext())
146 {
147 return $arResult;
148 }
149
150 return False;
151 }
152
153 /***************************************/
154 /********** COMMON METHODS ***********/
155 /***************************************/
156 public static function GetEventSite($userID, $event, $defSiteID)
157 {
158 global $arSocNetUserEvents;
159
160 $userID = intval($userID);
161 if ($userID <= 0)
162 return false;
163 $event = mb_strtoupper(Trim($event));
164 if (!in_array($event, $arSocNetUserEvents))
165 return false;
166
167 $arUserEvents = array();
168 if (isset($GLOBALS["SONET_USER_EVENTS_".$userID]) && is_array($GLOBALS["SONET_USER_EVENTS_".$userID]) && !in_array("SONET_USER_EVENTS_".$userID, $_REQUEST))
169 {
170 $arUserEvents = $GLOBALS["SONET_USER_EVENTS_".$userID];
171 }
172 else
173 {
174 $dbResult = CSocNetUserEvents::GetList(Array(), Array("USER_ID" => $userID));
175 while ($arResult = $dbResult->Fetch())
176 $arUserEvents[$arResult["EVENT_ID"]] = (($arResult["ACTIVE"] == "Y") ? $arResult["SITE_ID"] : false);
177 $GLOBALS["SONET_USER_EVENTS_".$userID] = $arUserEvents;
178 }
179
180 if (!array_key_exists($event, $arUserEvents))
181 return $defSiteID;
182
183 return $arUserEvents[$event];
184 }
185}
$arResult
Определения generate_coupon.php:16
static processEqualityFieldsToUpdate($fields1, &$update)
Определения util.php:239
static getEqualityFields(&$fields)
Определения util.php:207
static Delete($ID)
Определения user_events.php:67
static GetByID($ID)
Определения user_events.php:135
static CheckFields($ACTION, &$arFields, $ID=0)
Определения user_events.php:10
static Update($ID, $arFields)
Определения user_events.php:99
static GetEventSite($userID, $event, $defSiteID)
Определения user_events.php:156
static DeleteNoDemand($userID)
Определения user_events.php:83
static GetList($arOrder=Array("ID"=> "DESC"), $arFilter=Array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения user_events.php:39
$arFields
Определения dblapprove.php:5
</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
if($ajaxMode) $ID
Определения get_user.php:27
global $DB
Определения cron_frame.php:29
$ACTION
Определения csv_new_setup.php:27
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
is_set($a, $k=false)
Определения tools.php:2133
GetMessage($name, $aReplace=null)
Определения tools.php:3397
$event
Определения prolog_after.php:141
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
global $arSocNetUserEvents
Определения include.php:376
$GLOBALS['_____370096793']
Определения update_client.php:1
$dbResult
Определения updtr957.php:3