1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
blog_category.php
См. документацию.
1<?php
2
4
5$GLOBALS["BLOG_CATEGORY"] = Array();
6
8{
9 /*************** ADD, UPDATE, DELETE *****************/
10 public static function CheckFields($ACTION, &$arFields, $ID = 0)
11 {
12 if ((is_set($arFields, "NAME") || $ACTION=="ADD") && $arFields["NAME"] == '')
13 {
14 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GCT_EMPTY_NAME"), "EMPTY_NAME");
15 return false;
16 }
17
18 if ((is_set($arFields, "BLOG_ID") || $ACTION=="ADD") && intval($arFields["BLOG_ID"]) <= 0)
19 {
20 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GCT_EMPTY_BLOG_ID"), "EMPTY_BLOG_ID");
21 return false;
22 }
23 elseif (is_set($arFields, "BLOG_ID"))
24 {
26 if (!$arResult)
27 {
28 $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["BLOG_ID"], GetMessage("BLG_GCT_ERROR_NO_BLOG")), "ERROR_NO_BLOG");
29 return false;
30 }
31 }
32
33 if(is_set($arFields, "NAME"))
34 {
35 if(intval($arFields["BLOG_ID"])>0)
36 {
37 $blogID = $arFields["BLOG_ID"];
38 }
39 elseif(intval($ID)>0)
40 {
42 $blogID = $arCat["BLOG_ID"];
43 }
44 else
45 {
46 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GCT_EMPTY_BLOG_ID"), "EMPTY_BLOG_ID");
47 return false;
48 }
49
50 if(mb_strlen($arFields["NAME"]) > 255)
51 {
52 $arFields["NAME"] = mb_substr($arFields["NAME"], 0, 255);
53 }
54 $dbCategory = CBlogCategory::GetList(array(), array("BLOG_ID" => $blogID, "NAME" => $arFields["NAME"]));
55 while($arCategory = $dbCategory->Fetch())
56 {
57 if ($ID != $arCategory["ID"])
58 {
59 $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_ALREADY_EXIST"), "ALREADY_EXIST");
60 return false;
61 }
62 }
63 }
64
65 return True;
66 }
67
68 public static function Delete($ID)
69 {
70 global $DB;
71
72 $ID = intval($ID);
73
74 $DB->Query("UPDATE b_blog_post SET CATEGORY_ID = null WHERE CATEGORY_ID = ".$ID."", true);
75
76 unset($GLOBALS["BLOG_CATEGORY"]["BLOG_CATEGORY_CACHE_".$ID]);
77
78 return $DB->Query("DELETE FROM b_blog_category WHERE ID = ".$ID."", true);
79 }
80
81 //*************** SELECT *********************/
82 public static function GetByID($ID)
83 {
84 global $DB;
85
86 $ID = intval($ID);
87
88 if (isset($GLOBALS["BLOG_CATEGORY"]["BLOG_CATEGORY_CACHE_".$ID]) && is_array($GLOBALS["BLOG_CATEGORY"]["BLOG_CATEGORY_CACHE_".$ID]) && is_set($GLOBALS["BLOG_CATEGORY"]["BLOG_CATEGORY_CACHE_".$ID], "ID"))
89 {
90 return $GLOBALS["BLOG_CATEGORY"]["BLOG_CATEGORY_CACHE_".$ID];
91 }
92 else
93 {
94 $strSql =
95 "SELECT C.ID, C.BLOG_ID, C.NAME ".
96 "FROM b_blog_category C ".
97 "WHERE C.ID = ".$ID."";
98 $dbResult = $DB->Query($strSql);
99 if ($arResult = $dbResult->Fetch())
100 {
101 $GLOBALS["BLOG_CATEGORY"]["BLOG_CATEGORY_CACHE_".$ID] = $arResult;
102 return $arResult;
103 }
104 }
105
106 return False;
107 }
108}
$arResult
Определения generate_coupon.php:16
static Delete($ID)
Определения blog_category.php:68
static GetByID($ID)
Определения blog_category.php:82
static CheckFields($ACTION, &$arFields, $ID=0)
Определения blog_category.php:10
static GetByID($ID)
Определения blog.php:931
static GetList($arOrder=Array("ID"=> "DESC"), $arFilter=Array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения blog_category.php:97
$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
$GLOBALS["BLOG_CATEGORY"]
Определения blog_category.php:5
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
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
$GLOBALS['_____370096793']
Определения update_client.php:1
$dbResult
Определения updtr957.php:3