1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
components_lib.php
См. документацию.
1<?
2IncludeModuleLangFile(__FILE__);
4{
5 public static function GetDateTimeFormat($name="", $parent="")
6 {
7 $timestamp = mktime(7,30,45,2,22,2007);
8 return array(
9 "PARENT" => $parent,
10 "NAME" => $name,
11 "TYPE" => "LIST",
12 "VALUES" => array(
13 "d-m-Y H:i:s" => CForumFormat::DateFormat("d-m-Y H:i:s", $timestamp),//"22-02-2007 7:30",
14 "m-d-Y H:i:s" => CForumFormat::DateFormat("m-d-Y H:i:s", $timestamp),//"02-22-2007 7:30",
15 "Y-m-d H:i:s" => CForumFormat::DateFormat("Y-m-d H:i:s", $timestamp),//"2007-02-22 7:30",
16 "d.m.Y H:i:s" => CForumFormat::DateFormat("d.m.Y H:i:s", $timestamp),//"22.02.2007 7:30",
17 "m.d.Y H:i:s" => CForumFormat::DateFormat("m.d.Y H:i:s", $timestamp),//"02.22.2007 7:30",
18 "j M Y H:i:s" => CForumFormat::DateFormat("j M Y H:i:s", $timestamp),//"22 Feb 2007 7:30",
19 "M j, Y H:i:s" => CForumFormat::DateFormat("M j, Y H:i:s", $timestamp),//"Feb 22, 2007 7:30",
20 "j F Y H:i:s" => CForumFormat::DateFormat("j F Y H:i:s", $timestamp),//"22 February 2007 7:30",
21 "F j, Y H:i:s" => CForumFormat::DateFormat("F j, Y H:i:s", $timestamp),//"February 22, 2007",
22 "d.m.y g:i A" => CForumFormat::DateFormat("d.m.y g:i A", $timestamp),//"22.02.07 1:30 PM",
23 "d.m.y G:i" => CForumFormat::DateFormat("d.m.y G:i", $timestamp),//"22.02.07 7:30",
24 "d.m.Y H:i:s" => CForumFormat::DateFormat("d.m.Y H:i:s", $timestamp),//"22.02.2007 07:30",
25 ),
26 "DEFAULT" => $GLOBALS["DB"]->DateFormatToPHP(CSite::GetDateFormat("FULL")),
27 "ADDITIONAL_VALUES" => "Y",
28 );
29 }
30
31 public static function GetDateFormat($name="", $parent="")
32 {
33 $timestamp = mktime(7,30,45,2,22,2007);
34 return array(
35 "PARENT" => $parent,
36 "NAME" => $name,
37 "TYPE" => "LIST",
38 "VALUES" => array(
39 "d-m-Y" => CForumFormat::DateFormat("d-m-Y", $timestamp),//"22-02-2007 7:30",
40 "m-d-Y" => CForumFormat::DateFormat("m-d-Y", $timestamp),//"02-22-2007 7:30",
41 "Y-m-d" => CForumFormat::DateFormat("Y-m-d", $timestamp),//"2007-02-22 7:30",
42 "d.m.Y" => CForumFormat::DateFormat("d.m.Y", $timestamp),//"22.02.2007 7:30",
43 "m.d.Y" => CForumFormat::DateFormat("m.d.Y", $timestamp),//"02.22.2007 7:30",
44 "j M Y" => CForumFormat::DateFormat("j M Y", $timestamp),//"22 Feb 2007 7:30",
45 "M j, Y" => CForumFormat::DateFormat("M j, Y", $timestamp),//"Feb 22, 2007 7:30",
46 "j F Y" => CForumFormat::DateFormat("j F Y", $timestamp),//"22 February 2007 7:30",
47 "F j, Y" => CForumFormat::DateFormat("F j, Y", $timestamp),//"February 22, 2007",
48 "d.m.y" => CForumFormat::DateFormat("d.m.y", $timestamp),//"22.02.07 1:30 PM",
49 ),
50 "DEFAULT" => $GLOBALS["DB"]->DateFormatToPHP(CSite::GetDateFormat("SHORT")),
51 "ADDITIONAL_VALUES" => "Y",
52 );
53 }
54
55 public static function GetForumsMultiSelect($name="", $parent="")
56 {
57 return array(
58 "PARENT" => $parent,
59 "NAME" => $name,
60 "TYPE" => "LIST",
61 "MULTIPLE" => "Y",
63 "DEFAULT" => "",
64 );
65 }
66
67 public static function GetForumsList()
68 {
69 $arGroup = array();
70 $arForum = array();
71 $db_res = CForumGroup::GetListEx(array(), array("LID" => LANG));
72 if ($db_res && ($res = $db_res->GetNext()))
73 {
74 do
75 {
76 $arGroup[intval($res["ID"])] = $res["~NAME"];
77 }while ($res = $db_res->GetNext());
78 }
79
80 $db_res = CForumNew::GetListEx(array("FORUM_GROUP_SORT"=>"ASC", "FORUM_GROUP_ID"=>"ASC", "SORT"=>"ASC", "NAME"=>"ASC"), array());
81 if ($db_res && ($res = $db_res->GetNext()))
82 {
83 do
84 {
85 $arForum[intval($res["ID"])] = $res["~NAME"];
86 if ((intval($res["FORUM_GROUP_ID"]) > 0) && array_key_exists($res["FORUM_GROUP_ID"], $arGroup))
87 {
88 $arForum[intval($res["ID"])] .= " [".$arGroup[$res["FORUM_GROUP_ID"]]."]";
89 }
90 if ($res["ACTIVE"] != "Y")
91 {
92 $arForum[intval($res["ID"])] .= " N/A";
93 }
94 }while ($res = $db_res->GetNext());
95 }
96 return $arForum;
97 }
98
99 public static function GetSendMessageRights($name="", $parent="", $default = "A", $object = "MAIL")
100 {
101 if ($object == "ICQ")
102 {
103 if ((COption::GetOptionString("forum", "SHOW_ICQ_CONTACT", "N") != "Y")):
104 return array(
105 "PARENT" => $parent,
106 "NAME" => $name,
107 "TYPE" => "LIST",
108 "VALUES" => array(
109 "A" => GetMessage("FORUM_NO_ONE")
110 ),
111 "DEFAULT" => "A"
112 );
113 else:
114 return array(
115 "PARENT" => $parent,
116 "NAME" => $name,
117 "TYPE" => "LIST",
118 "VALUES" => array(
119 "A" => GetMessage("FORUM_NO_ONE"),
120 "E" => GetMessage("FORUM_AUTHORIZED_USERS"),
121 "Y" => GetMessage("FORUM_ALL"),
122 ),
123 "DEFAULT" => $default
124 );
125 endif;
126 }
127
128 return array(
129 "PARENT" => $parent,
130 "NAME" => $name,
131 "TYPE" => "LIST",
132 "VALUES" => array(
133 "A" => GetMessage("FORUM_NO_ONE"),
134 "E" => GetMessage("FORUM_AUTHORIZED_USERS"),
135 "U" => GetMessage("FORUM_ALL_WITH_CAPTCHA"),
136 "Y" => GetMessage("FORUM_ALL"),
137 ),
138 "DEFAULT" => $default
139 );
140 }
141
142 public static function GetSetNavigation($name="", $parent="")
143 {
144 return array(
145 "PARENT" => $parent,
146 "NAME" => $name,
147 "TYPE" => "CHECKBOX",
148 "MULTIPLE" => "N",
149 "DEFAULT" => "Y"
150 );
151 }
152
153 public static function GetWordLength($name="", $parent="ADDITIONAL_SETTINGS")
154 {
155 if (empty($name))
156 $name = GetMessage("F_WORD_LENGTH");
157 return array(
158 "PARENT" => $parent,
159 "NAME" => $name,
160 "TYPE" => "STRING",
161 "DEFAULT" => "50"
162 );
163
164 }
165
166 public static function GetWordWrapCut($name="", $parent="ADDITIONAL_SETTINGS")
167 {
168 if (empty($name))
169 $name = GetMessage("F_WORD_WRAP_CUT");
170 return array(
171 "PARENT" => $parent,
172 "NAME" => $name,
173 "TYPE" => "LIST",
174 "MULTIPLE" => "N",
175 "VALUES" => array(
176 "0" => GetMessage("F_WORD_WRAP"),
177 "23" => GetMessage("F_WORD_CUT")." (23)",
178 ),
179 "DEFAULT" => "23",
180 "ADDITIONAL_VALUES" => "Y",
181 );
182
183 }
184
185 public static function GetAjaxType($name="", $parent="ADDITIONAL_SETTINGS")
186 {
187 if (empty($name))
188 $name = GetMessage("F_AJAX_TYPE");
189 return array(
190 "PARENT" => $parent,
191 "NAME" => $name,
192 "TYPE" => "CHECKBOX",
193 "DEFAULT" => "Y");
194 }
195
196 public static function AddPagerSettings(&$arComponentParameters, $sTitle = "", $arParams = array(
197 // "bAddGroupOnly" => false,
198 // "bDescNumbering" => true
199 ))
200 {
201 $arParams = (!is_array($arParams) ? array($arParams) : $arParams);
202 $arParamsDefault = array(
203 "bAddGroupOnly" => false,
204 "bDescNumbering" => true);
205
206 foreach ($arParamsDefault as $key => $val)
207 $arParams[$key] = ((is_set($arParams, $key) ? $arParams[$key]: $arParamsDefault[$key]) == true);
208
209 $arComponentParameters["GROUPS"]["PAGER_SETTINGS"] = array(
210 "NAME" => GetMessage("FORUM_PAGER_SETTINGS"));
211
212 if (!$arParams["bAddGroupOnly"])
213 {
214 if ($arParams["bDescNumbering"])
215 {
216 $arComponentParameters["PARAMETERS"]["PAGER_DESC_NUMBERING"] = Array(
217 "PARENT" => "PAGER_SETTINGS",
218 "NAME" => GetMessage("FORUM_PAGER_DESC_NUMBERING"),
219 "TYPE" => "CHECKBOX",
220 "DEFAULT" => "Y");
221 }
222 $arComponentParameters["PARAMETERS"]["PAGER_SHOW_ALWAYS"] = Array(
223 "PARENT" => "PAGER_SETTINGS",
224 "NAME" => GetMessage("FORUM_PAGER_SHOW_ALWAYS"),
225 "TYPE" => "CHECKBOX",
226 "DEFAULT" => "N");
227 $arComponentParameters["PARAMETERS"]["PAGER_TITLE"] = Array(
228 "PARENT" => "PAGER_SETTINGS",
229 "NAME" => GetMessage("FORUM_PAGER_TITLE"),
230 "TYPE" => "STRING",
231 "DEFAULT" => $sTitle);
232 $arComponentParameters["PARAMETERS"]["PAGER_TEMPLATE"] = Array(
233 "PARENT" => "PAGER_SETTINGS",
234 "NAME" => GetMessage("FORUM_PAGER_TEMPLATE"),
235 "TYPE" => "STRING",
236 "DEFAULT" => "");
237 }
238
239 }
240}
241
243{
244 public static function DateFormat($format="", $timestamp="")
245 {
246 global $DB;
247
248 switch($format)
249 {
250 case "SHORT":
251 return FormatDate($DB->dateFormatToPHP(FORMAT_DATE), $timestamp);
252 case "FULL":
253 return FormatDate($DB->dateFormatToPHP(FORMAT_DATETIME), $timestamp);
254 default:
255 return FormatDate($format, $timestamp);
256 }
257 }
258
259 public static function FormatDate($strDate, $format="DD.MM.YYYY HH:MI:SS", $new_format="DD.MM.YYYY HH:MI:SS")
260 {
261 global $DB;
262
263 $strDate = trim($strDate);
264
265 $new_format = str_replace("MI","I", $new_format);
266 $new_format = preg_replace("/([DMYIHS])\\1+/isu", "\\1", $new_format);
267 $arFormat = preg_split("/[^0-9a-z]/is", mb_strtoupper($format));
268 $arDate = preg_split("/[^0-9]/", $strDate);
269 $arParsedDate=Array();
270 $bound = min(count($arFormat), count($arDate));
271
272 for($i=0; $i<$bound; $i++)
273 {
274 //if ($intval) $r = IntVal($arDate[$i]); else
275 if (preg_match("/^[0-9]/", $arDate[$i]))
276 $r = $DB->ForSql($arDate[$i], 4);
277 else
278 $r = intval($arDate[$i]);
279
280 $arParsedDate[mb_substr($arFormat[$i], 0, 2)] = $r;
281 }
282 if (intval($arParsedDate["DD"])<=0 || intval($arParsedDate["MM"])<=0 || intval($arParsedDate["YY"])<=0)
283 return false;
284
285 $strResult = "";
286
287 if(intval($arParsedDate["YY"])>1970 && intval($arParsedDate["YY"])<2038)
288 {
289 $ux_time = mktime(
290 intval($arParsedDate["HH"]),
291 intval($arParsedDate["MI"]),
292 intval($arParsedDate["SS"]),
293 intval($arParsedDate["MM"]),
294 intval($arParsedDate["DD"]),
295 intval($arParsedDate["YY"])
296 );
297
298 for ($i=0; $i < mb_strlen($new_format); $i++)
299 {
300 $simbol = mb_substr($new_format, $i, 1);
301 switch ($simbol)
302 {
303 case "F":$match=GetMessage("FORUM_MONTH_".date("n", $ux_time));break;
304 case "M":$match=GetMessage("FORUM_MON_".date("n", $ux_time));break;
305 case "l":$match=GetMessage("FORUM_DAY_OF_WEEK_".date("w", $ux_time));break;
306 case "D":$match=GetMessage("FORUM_DOW_".date("w", $ux_time));break;
307 default: $match = date(mb_substr($new_format, $i, 1), $ux_time); break;
308 }
309 $strResult .= $match;
310 }
311 }
312 else
313 {
314 if($arParsedDate["MM"]<1 || $arParsedDate["MM"]>12)
315 $arParsedDate["MM"] = 1;
316 for ($i=0; $i < mb_strlen($new_format); $i++)
317 {
318 $simbol = mb_substr($new_format, $i, 1);
319 switch ($simbol)
320 {
321 case "F":
322 $match = str_pad($arParsedDate["MM"], 2, "0", STR_PAD_LEFT);
323 if (intval($arParsedDate["MM"]) > 0)
324 $match=GetMessage("FORUM_MONTH_".intval($arParsedDate["MM"]));
325 break;
326 case "M":
327 $match = str_pad($arParsedDate["MM"], 2, "0", STR_PAD_LEFT);
328 if (intval($arParsedDate["MM"]) > 0)
329 $match=GetMessage("FORUM_MON_".intval($arParsedDate["MM"]));
330 break;
331 case "l":
332 $match = str_pad($arParsedDate["DD"], 2, "0", STR_PAD_LEFT);
333 if (intval($arParsedDate["DD"]) > 0)
334 $match = GetMessage("FORUM_DAY_OF_WEEK_".intval($arParsedDate["DD"]));
335 break;
336 case "D":
337 $match = str_pad($arParsedDate["DD"], 2, "0", STR_PAD_LEFT);
338 if (intval($arParsedDate["DD"]) > 0)
339 $match = GetMessage("FORUM_DOW_".intval($arParsedDate["DD"]));
340 break;
341 case "d": $match = str_pad($arParsedDate["DD"], 2, "0", STR_PAD_LEFT); break;
342 case "m": $match = str_pad($arParsedDate["MM"], 2, "0", STR_PAD_LEFT); break;
343 case "j": $match = str_pad($arParsedDate["DD"], 2, "0", STR_PAD_LEFT); break;
344 case "Y": $match = str_pad($arParsedDate["YY"], 4, "0", STR_PAD_LEFT); break;
345 case "y":
346 $match = mb_substr($arParsedDate["YY"], 2);break;
347 case "H": $match = str_pad($arParsedDate["HH"], 2, "0", STR_PAD_LEFT); break;
348 case "i": $match = str_pad($arParsedDate["MI"], 2, "0", STR_PAD_LEFT); break;
349 case "S": $match = str_pad($arParsedDate["SS"], 2, "0", STR_PAD_LEFT); break;
350 case "g":
351 $match = intval($arParsedDate["HH"]);
352 if ($match > 12)
353 $match = $match-12;
354 case "a":
355 case "A":
356 $match = intval($arParsedDate["HH"]);
357 if ($match > 12)
358 $match = ($match-12)." PM";
359 else
360 $match .= " AM";
361
362 if (mb_substr($new_format, $i, 1) == "a")
363 $match = mb_strtolower($match);
364
365 default:
366 $match = mb_substr($new_format, $i, 1); break;
367 }
368 $strResult .= $match;
369 }
370 }
371 return $strResult;
372 }
373}
374/*
375GetMessage("FORUM_BOTTOM_PAGER");
376GetMessage("FORUM_DAY_OF_WEEK_0");
377GetMessage("FORUM_DAY_OF_WEEK_1");
378GetMessage("FORUM_DAY_OF_WEEK_2");
379GetMessage("FORUM_DAY_OF_WEEK_3");
380GetMessage("FORUM_DAY_OF_WEEK_4");
381GetMessage("FORUM_DAY_OF_WEEK_5");
382GetMessage("FORUM_DAY_OF_WEEK_6");
383GetMessage("FORUM_DOW_0");
384GetMessage("FORUM_DOW_1");
385GetMessage("FORUM_DOW_2");
386GetMessage("FORUM_DOW_3");
387GetMessage("FORUM_DOW_4");
388GetMessage("FORUM_DOW_5");
389GetMessage("FORUM_DOW_6");
390GetMessage("FORUM_MONTH_1");
391GetMessage("FORUM_MONTH_10");
392GetMessage("FORUM_MONTH_11");
393GetMessage("FORUM_MONTH_12");
394GetMessage("FORUM_MONTH_2");
395GetMessage("FORUM_MONTH_3");
396GetMessage("FORUM_MONTH_4");
397GetMessage("FORUM_MONTH_5");
398GetMessage("FORUM_MONTH_6");
399GetMessage("FORUM_MONTH_7");
400GetMessage("FORUM_MONTH_8");
401GetMessage("FORUM_MONTH_9");
402GetMessage("FORUM_MON_1");
403GetMessage("FORUM_MON_10");
404GetMessage("FORUM_MON_11");
405GetMessage("FORUM_MON_12");
406GetMessage("FORUM_MON_2");
407GetMessage("FORUM_MON_3");
408GetMessage("FORUM_MON_4");
409GetMessage("FORUM_MON_5");
410GetMessage("FORUM_MON_6");
411GetMessage("FORUM_MON_7");
412GetMessage("FORUM_MON_8");
413GetMessage("FORUM_MON_9");
414GetMessage("FORUM_NAVIGATION");
415GetMessage("FORUM_TOP_PAGER");
416
417*/
$arParams
Определения access_dialog.php:21
$db_res
Определения options_user_settings.php:8
static GetListEx($arOrder=array("SORT"=>"ASC"), $arFilter=array())
Определения forum_new.php:2102
static GetListEx($arOrder=Array("SORT"=>"ASC"), $arFilter=Array(), $bCount=false, $iNum=0, $arAddParams=array())
Определения forum_new.php:936
Определения components_lib.php:243
static DateFormat($format="", $timestamp="")
Определения components_lib.php:244
static FormatDate($strDate, $format="DD.MM.YYYY HH:MI:SS", $new_format="DD.MM.YYYY HH:MI:SS")
Определения components_lib.php:259
static GetDateTimeFormat($name="", $parent="")
Определения components_lib.php:5
static GetSendMessageRights($name="", $parent="", $default="A", $object="MAIL")
Определения components_lib.php:99
static GetForumsMultiSelect($name="", $parent="")
Определения components_lib.php:55
static GetSetNavigation($name="", $parent="")
Определения components_lib.php:142
static GetForumsList()
Определения components_lib.php:67
static GetDateFormat($name="", $parent="")
Определения components_lib.php:31
static GetWordLength($name="", $parent="ADDITIONAL_SETTINGS")
Определения components_lib.php:153
static GetAjaxType($name="", $parent="ADDITIONAL_SETTINGS")
Определения components_lib.php:185
static GetWordWrapCut($name="", $parent="ADDITIONAL_SETTINGS")
Определения components_lib.php:166
static AddPagerSettings(&$arComponentParameters, $sTitle="", $arParams=array())
Определения components_lib.php:196
</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
global $DB
Определения cron_frame.php:29
endif
Определения csv_new_setup.php:990
const FORMAT_DATETIME
Определения include.php:64
const FORMAT_DATE
Определения include.php:63
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
is_set($a, $k=false)
Определения tools.php:2133
GetMessage($name, $aReplace=null)
Определения tools.php:3397
$name
Определения menu_edit.php:35
if(empty($signedUserToken)) $key
Определения quickway.php:257
$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
$val
Определения options.php:1793
$GLOBALS['_____370096793']
Определения update_client.php:1