/
sestrenskyiHLClass.php
60 lines (48 loc) · 1.39 KB
/
sestrenskyiHLClass.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
class sestHL extends sest{
/**
* getDataHL() - get all data from highload block
* $HL_ID - id
*/
public static function getDataHL( $HL_ID ){
CModule::IncludeModule("highloadblock");
$hlbl = $HL_ID;
$hlblock = Bitrix\Highloadblock\HighloadBlockTable::getById($hlbl)->fetch();
$entity = Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hlblock);
$entity_data_class = $entity->getDataClass();
$rsData = $entity_data_class::getList(array(
"select" => array("*"),
"order" => array("ID" => "ASC")
));
$res = array();
while($arData = $rsData->Fetch()){
$res[] = $arData;
}
return $res;
}
/**
* getByIdHL() - get data from HL from ID
* $HL_ID - id HL
* $idElement - id element
*/
public static function getByIdHL( $HL_ID, $idElement, $field = false, $valField ){
CModule::IncludeModule("highloadblock");
$hlbl = $HL_ID;
$hlblock = Bitrix\Highloadblock\HighloadBlockTable::getById($hlbl)->fetch();
if (!empty($hlblock)){
$entity = Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hlblock);
$entity_data_class = $entity->getDataClass();
$row = $entity_data_class::getById($idElement)->fetch();
if(!empty($row)){
if($field){
return $row[$valField];
}else{
return $row;
}
}else{
return false;
}
}
}
} //end HL_sest class
?>