1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
smile.php
См. документацию.
1<?php
2
4{
5 public static function PrintSmilesList($num_cols, $strLang = False, $strPath2Icons = False, $cacheTime = False)
6 {
7 $res_str = "";
8 $arSmile = array();
9 $return_array = intval($num_cols) > 0 ? false : true;
10 if ($strLang === False)
11 $strLang = LANGUAGE_ID;
12 if ($strPath2Icons === False)
13 $strPath2Icons = "/bitrix/images/socialnetwork/smile/";
14 $cache = new CPHPCache;
15 $cache_id = "socialnetwork_smiles_".$strLang.preg_replace("/[^a-z0-9]/is", "_", $strPath2Icons);
16
17 $cache_path = "/".SITE_ID."/socialnetwork/smiles/";
18 if ($cacheTime > 0 && $cache->InitCache($cacheTime, $cache_id, $cache_path))
19 {
20 $res = $cache->GetVars();
21 $arSmile = $res["arSmile"];
22 }
23
24 if (empty($arSmile))
25 {
26 $db_res = CSocNetSmile::GetList(array("SORT"=>"ASC"), array("TYPE"=>"S", "LID"=>LANGUAGE_ID));
27 if ($db_res && ($res = $db_res->Fetch()))
28 {
29 do
30 {
31 $arSmile[] = $res;
32 }
33 while ($res = $db_res->Fetch());
34 }
35 if ($cacheTime > 0)
36 {
37 $cache->StartDataCache($cacheTime, $cache_id, $cache_path);
38 $cache->EndDataCache(array("arSmile"=>$arSmile));
39 }
40 }
41
42 if ($return_array)
43 return $arSmile;
44
45 $res_str = "";
46 $ind = 0;
47 foreach ($arSmile as $res)
48 {
49 if ($ind == 0) {$res_str .= "<tr align=\"center\">";}
50 $res_str .= "<td width=\"".intval(100/$num_cols)."%\">";
51 $strTYPING = strtok($res['TYPING'], " ");
52 $res_str .= "<img src=\"".$strPath2Icons.$res['IMAGE']."\" alt=\"".$res['NAME']."\" title=\"".$res['NAME']."\" border=\"0\"";
53 if (intval($res['IMAGE_WIDTH'])>0) {$res_str .= " width=\"".$res['IMAGE_WIDTH']."\"";}
54 if (intval($res['IMAGE_HEIGHT'])>0) {$res_str .= " height=\"".$res['IMAGE_HEIGHT']."\"";}
55 $res_str .= " onclick=\"if(emoticon){emoticon('".$strTYPING."');}\" name=\"smile\" id='".$strTYPING."' ";
56 $res_str .= "/>&nbsp;</td>\n";
57 $ind++;
58 if ($ind >= $num_cols)
59 {
60 $ind = 0;
61 $res_str .= "</tr>";
62 }
63 }
64 if ($ind < $num_cols)
65 {
66 for ($i=0; $i<$num_cols-$ind; $i++)
67 {
68 $res_str .= "<td> </td>";
69 }
70 }
71
72 return $res_str;
73 }
74
75 //---------------> User insert, update, delete
76 public static function CheckFields($ACTION, &$arFields)
77 {
78 if ((is_set($arFields, "SMILE_TYPE") || $ACTION=="ADD") && $arFields["SMILE_TYPE"]!="I" && $arFields["SMILE_TYPE"]!="S") return False;
79 if ((is_set($arFields, "IMAGE") || $ACTION=="ADD") && $arFields["IMAGE"] == '') return False;
80
81 if ((is_set($arFields, "SORT") || $ACTION=="ADD") && intval($arFields["SORT"])<=0) $arFields["SORT"] = 150;
82
83 if (is_set($arFields, "LANG") || $ACTION=="ADD")
84 {
85 for ($i = 0; $i<count($arFields["LANG"]); $i++)
86 {
87 if (!is_set($arFields["LANG"][$i], "LID") || $arFields["LANG"][$i]["LID"] == '') return false;
88 if (!is_set($arFields["LANG"][$i], "NAME") || $arFields["LANG"][$i]["NAME"] == '') return false;
89 }
90
91 $db_lang = CLangAdmin::GetList("sort", "asc", array("ACTIVE" => "Y"));
92 while ($arLang = $db_lang->Fetch())
93 {
94 $bFound = False;
95 for ($i = 0; $i<count($arFields["LANG"]); $i++)
96 {
97 if ($arFields["LANG"][$i]["LID"]==$arLang["LID"])
98 $bFound = True;
99 }
100 if (!$bFound) return false;
101 }
102 }
103
104 return True;
105 }
106
107 public static function Delete($ID)
108 {
109 global $DB, $CACHE_MANAGER;
110 $ID = intval($ID);
111
112 $DB->Query("DELETE FROM b_sonet_smile_lang WHERE SMILE_ID = ".$ID, True);
113 $DB->Query("DELETE FROM b_sonet_smile WHERE ID = ".$ID, True);
114 $CACHE_MANAGER->Clean("b_sonet_smile");
115
116 return true;
117 }
118
119 public static function GetByID($ID)
120 {
121 global $DB;
122
123 $ID = intval($ID);
124 $strSql =
125 "SELECT FR.ID, FR.SORT, FR.SMILE_TYPE, FR.TYPING, FR.IMAGE, FR.CLICKABLE, ".
126 " FR.DESCRIPTION, FR.IMAGE_WIDTH, FR.IMAGE_HEIGHT ".
127 "FROM b_sonet_smile FR ".
128 "WHERE FR.ID = ".$ID."";
129 $db_res = $DB->Query($strSql);
130
131 if ($res = $db_res->Fetch())
132 {
133 return $res;
134 }
135 return False;
136 }
137
138 public static function GetByIDEx($ID, $strLang)
139 {
140 global $DB;
141
142 $ID = intval($ID);
143 $strSql =
144 "SELECT FR.ID, FR.SORT, FR.SMILE_TYPE, FR.TYPING, FR.IMAGE, FR.CLICKABLE, ".
145 " FRL.LID, FRL.NAME, FR.DESCRIPTION, FR.IMAGE_WIDTH, FR.IMAGE_HEIGHT ".
146 "FROM b_sonet_smile FR ".
147 " LEFT JOIN b_sonet_smile_lang FRL ON (FR.ID = FRL.SMILE_ID AND FRL.LID = '".$DB->ForSql($strLang)."') ".
148 "WHERE FR.ID = ".$ID."";
149 $db_res = $DB->Query($strSql);
150
151 if ($res = $db_res->Fetch())
152 {
153 return $res;
154 }
155 return False;
156 }
157
158 public static function GetLangByID($SMILE_ID, $strLang)
159 {
160 global $DB;
161
162 $SMILE_ID = intval($SMILE_ID);
163 $strSql =
164 "SELECT FRL.ID, FRL.SMILE_ID, FRL.LID, FRL.NAME ".
165 "FROM b_sonet_smile_lang FRL ".
166 "WHERE FRL.SMILE_ID = ".$SMILE_ID." ".
167 " AND FRL.LID = '".$DB->ForSql($strLang)."' ";
168 $db_res = $DB->Query($strSql);
169
170 if ($res = $db_res->Fetch())
171 {
172 return $res;
173 }
174 return False;
175 }
176}
$db_res
Определения options_user_settings.php:8
static GetList($by="sort", $order="asc", $arFilter=[])
Определения language.php:12
Определения smile.php:4
static Delete($ID)
Определения smile.php:107
static GetByID($ID)
Определения smile.php:119
static CheckFields($ACTION, &$arFields)
Определения smile.php:76
static GetByIDEx($ID, $strLang)
Определения smile.php:138
static GetLangByID($SMILE_ID, $strLang)
Определения smile.php:158
static PrintSmilesList($num_cols, $strLang=False, $strPath2Icons=False, $cacheTime=False)
Определения smile.php:5
static GetList($arOrder=Array("ID"=> "DESC"), $arFilter=Array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения smile.php:68
global $CACHE_MANAGER
Определения clear_component_cache.php:7
$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
$res
Определения filter_act.php:7
$bFound
Определения get_search.php:40
if($ajaxMode) $ID
Определения get_user.php:27
global $DB
Определения cron_frame.php:29
$ACTION
Определения csv_new_setup.php:27
is_set($a, $k=false)
Определения tools.php:2133
return false
Определения prolog_main_admin.php:185
$i
Определения factura.php:643
</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