53 if(self::$CategoryIB <= 0)
57 $arSubCategoryList =
array($CategoryCode);
58 $arSubCategoryListId =
array();
60 if(is_array($arCategoryList[$CategoryCode]) && $arCategoryList[$CategoryCode][
"ID"]>0)
61 $arSubCategoryListId[] = $arCategoryList[$CategoryCode][
"ID"];
63 if($arCategoryList && !empty($arSubCategoryListId))
65 foreach($arCategoryList as
$key=>$arCategory)
67 if(in_array($arCategory[
"IBLOCK_SECTION_ID"], $arSubCategoryListId))
69 $arSubCategoryList[] =
$key;
70 $arSubCategoryListId[] = $arCategory[
"ID"];
75 return array(
"CODE" => $arSubCategoryList,
"ID" => $arSubCategoryListId);
82 if(self::$CategoryIB <= 0 || !$CODE)
86 $arCategoryList =
array();
87 foreach($arCategoryListXML as $arCategory)
88 $arCategoryList[$arCategory[
"ID"]] = $arCategory;
90 $arSequnce =
array(
"CATEGORY_1" =>
false,
"CATEGORY_2" =>
false);
91 $CODE = mb_strtoupper($CODE);
93 $arFullSequence =
array();
94 while(array_key_exists($CODE, $arCategoryListXML))
96 array_unshift($arFullSequence, mb_strtolower($CODE));
97 if($arCategoryListXML[$CODE][
"IBLOCK_SECTION_ID"]>0 && $arCategoryList[$arCategoryListXML[$CODE][
"IBLOCK_SECTION_ID"]])
98 $CODE = mb_strtoupper($arCategoryList[$arCategoryListXML[$CODE][
"IBLOCK_SECTION_ID"]][
"CODE"]);
103 if(array_key_exists(0, $arFullSequence))
104 $arSequnce[
"CATEGORY_1"] = $arFullSequence[0];
105 if(
count($arFullSequence)>1)
106 $arSequnce[
"CATEGORY_2"] = end($arFullSequence);
108 $arSequnce[
"FULL"] = $arFullSequence;
115 if(self::$CategoryIB <= 0)
118 $arCategory =
array();
121 if(($CategoryIB = self::$CategoryIB) ===
false)
124 if(is_array($this->CacheStorage[
"CATEGORY_LIST"]) && array_key_exists($CategoryIB, $this->CacheStorage[
"CATEGORY_LIST"]))
125 return $this->CacheStorage[
"CATEGORY_LIST"][$CategoryIB];
127 $obCache =
new CPHPCache;
128 $life_time = 60*60*24*30;
129 $cache_id =
'idea_category_list_'.$CategoryIB;
130 $cache_path =
'/'.SITE_ID.
'/idea/category_list/'.$CategoryIB.
'/';
134 if($obCache->StartDataCache($life_time, $cache_id, $cache_path))
136 if(defined(
"BX_COMP_MANAGED_CACHE"))
142 $obSec = CIBlockSection::GetList(
array(
"left_margin"=>
"ASC"),
array(
"IBLOCK_ID" => $CategoryIB,
"ACTIVE" =>
"Y"));
143 while($r = $obSec->GetNext())
145 $arCategory[mb_strtoupper($r[
"CODE"])] = $r;
149 if(!empty($arCategory))
151 if(defined(
"BX_COMP_MANAGED_CACHE"))
154 $obCache->EndDataCache($arCategory);
157 $obCache->AbortDataCache();
160 $arCategory = $obCache->GetVars();
162 return $this->CacheStorage[
"CATEGORY_LIST"][$CategoryIB] = $arCategory;
169 if(!is_array($arStatusPriority))
170 $arStatusPriority =
array();
172 $arDefaultStatus =
array();
173 $arStatusPriority = array_unique($arStatusPriority);
176 foreach ($arStatusPriority as $StatusId)
178 if(array_key_exists($StatusId, $arStatusList))
180 $arDefaultStatus = $arStatusList[$StatusId];
185 if(!$arDefaultStatus)
187 foreach($arStatusList as $arStatus)
189 if(!$arDefaultStatus)
190 $arDefaultStatus = $arStatus;
192 if($arStatus[
"DEF"] ==
"Y")
194 $arDefaultStatus = $arStatus;
200 return $arDefaultStatus;
205 if(is_array($this->CacheStorage[
"STATUS_LIST"]) && array_key_exists(intval($XML_ID), $this->CacheStorage[
"STATUS_LIST"]))
206 return $this->CacheStorage[
"STATUS_LIST"][intval($XML_ID)];
208 $obCache =
new CPHPCache;
209 $life_time = 60*60*24*30;
210 $cache_id =
'idea_status_list';
211 $cache_path =
'/'.SITE_ID.
'/idea/status_list/';
214 if($obCache->StartDataCache($life_time, $cache_id, $cache_path))
216 $arStatusField = CUserTypeEntity::GetList(
219 "ENTITY_ID" =>
"BLOG_POST",
220 "FIELD_NAME" => CIdeaManagment::UFStatusField
225 $oStatus = CUserFieldEnum::GetList(
array(),
array(
"USER_FIELD_ID" => $arStatusField[
"ID"]));
226 while($r = $oStatus->Fetch())
227 $arStatus[$r[
"ID"]] = $r;
229 $obCache->EndDataCache($arStatus);
232 $obCache->AbortDataCache();
235 $arStatus = $obCache->GetVars();
239 $arStatusXML =
array();
240 foreach($arStatus as $Status)
241 $arStatusXML[$Status[
"XML_ID"]] = $Status;
242 $arStatus = $arStatusXML;
245 return $this->CacheStorage[
"STATUS_LIST"][intval($XML_ID)] = $arStatus;
258 array(
"ID" => $this->IdeaId),
261 array(
"ID", CIdeaManagment::UFStatusField)
266 if(array_key_exists($StatusId, $arStatusListXML))
267 $StatusId = $arStatusListXML[$StatusId][
"ID"];
269 if(array_key_exists($StatusId, $arStatusList))
270 $bUpdate = $arPost[CIdeaManagment::UFStatusField] != $StatusId;
272 if($arPost && $bUpdate)
276 CIdeaManagment::UFStatusField => $StatusId,
static Update($ID, $arFields, $bSearchIndex=true)
static GetList( $arOrder=["ID"=> "DESC"], $arFilter=[], $arGroupBy=false, $arNavStartParams=false, $arSelectFields=[])