- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
function CreatePriceListArray($result_array)//TODO:Формирует древовидную форму прайс листа
{
//print_r($result_array);
$price_list=array();//Жилая недвижимость
$current_object_name="";
$current_section_name="none";
$current_section_id=0;
$current_object_array=null;
$current_section_array=null;
$current_kvartira_type=null;
$current_kvartira_type_name="";
$current_kvartira=null;
$current_kvartira_area="";
foreach($result_array as $value)
{
if($current_object_name != $value['object'])
{
if($current_object_array !=null)
{
$current_kvartira_type[]=array('name'=>$current_kvartira_area,'count_object'=>count($current_kvartira),'object_array'=>$current_kvartira);
$current_section_array[]=array('name'=>$current_kvartira_type_name,'count_object'=>count($current_kvartira_type),'object_array'=>$current_kvartira_type);
$current_object_array[]=array('name'=>$current_section_name,'id'=>$current_section_id,'count_object'=>count($current_section_array),'object_array'=>$current_section_array);
$price_list[]=array('name'=>$current_object_name,'count_object'=>count($current_object_array),'object_array'=>$current_object_array);
}
$current_object_array=array();
$current_object_name=$value['object'];
$current_section_name="none";
$current_section_id=0;
$current_section_array=null;
}
if($current_section_name != $value['section_name'])
{
// echo $current_kvartira_type['name']; echo ' | ';
//if($current_kvartira_type['name'] != '')
{
foreach ($current_kvartira_type as $value)
//print_r($current_kvartira_type);
$current_kvartira_type[]=array('name'=>$current_kvartira_area,'count_object'=>count($current_kvartira),'object_array'=>$current_kvartira);
$current_section_array[]=array('name'=>$current_kvartira_type_name,'count_object'=>count($current_kvartira_type),'object_array'=>$current_kvartira_type);
$current_object_array[]=array('name'=>$current_section_name,'id'=>$current_section_id,'count_object'=>count($current_section_array),'object_array'=>$current_section_array);
}
$current_section_array=array();
$current_section_name = $value['section_name'];
$current_section_id=$value['section_id'];
// $current_kvartira_type=null;
$current_kvartira_type_name="";
}
if($current_kvartira_type_name != $value['kvartira_name'])
{
// if($current_kvartira_type != null)
{
$current_kvartira_type[]=array('name'=>$current_kvartira_area,'count_object'=>count($current_kvartira),'object_array'=>$current_kvartira);
$current_section_array[]=array('name'=>$current_kvartira_type_name,'count_object'=>count($current_kvartira_type),'object_array'=>$current_kvartira_type);
}
$current_kvartira_type=array();
$current_kvartira_type_name = $value['kvartira_name'];
$current_kvartira=null;
$current_kvartira_area="";
}
if($current_kvartira_area != $value['area'])
{
// if($current_kvartira != null)
{
$current_kvartira_type[]=array('name'=>$current_kvartira_area,'count_object'=>count($current_kvartira),'object_array'=>$current_kvartira);
}
$current_kvartira=array();
$current_kvartira_area = $value['area'];
}
$current_kvartira[]=$value['floor'];
}
$current_kvartira_type[]=array('name'=>$current_kvartira_area,'count_object'=>count($current_kvartira),'object_array'=>$current_kvartira);
$current_section_array[]=array('name'=>$current_kvartira_type_name,'count_object'=>count($current_kvartira_type),'object_array'=>$current_kvartira_type);
$current_object_array[]=array('name'=>$current_section_name,'id'=>$current_section_id,'count_object'=>count($current_section_array),'object_array'=>$current_section_array);
//echo $current_object_name;
if($current_object_name!='') $price_list[]=array('name'=>$current_object_name,'count_object'=>count($current_object_array),'object_array'=>$current_object_array);
echo '<!--';
print_r($price_list);
echo '-->';
return $price_list;
}
Пытаюсь тут что-то найти... Идет второй час.