Пример #1
0
 public function prepare_property_attributes($attributes_map, $app_data)
 {
     $arr_attributes = array();
     $map = new Mapping();
     foreach ($attributes_map as $attr_id => $app_field_name) {
         if (!is_array($app_field_name)) {
             $arr_attributes[$attr_id] = $app_data['app_details'][0][$app_field_name];
         } else {
             $app_table_value = array();
             foreach ($app_field_name as $app_table => $app_table_field_names) {
                 if (isset($app_data[$map->get_flipped_mappped_value($app_table)])) {
                     foreach ($app_table_field_names as $field_name) {
                         if ($field_name == 'flooringType1') {
                             $app_table_value[] = $app_data[$map->get_flipped_mappped_value($app_table)][0]['flooringType'];
                         } elseif ($field_name == 'flooringType2') {
                             $app_table_value[] = $app_data[$map->get_flipped_mappped_value($app_table)][1]['flooringType'];
                         } else {
                             $app_table_value[] = join(array($map->get_app_field_name($field_name), $map->get_app_field_value($app_data[$map->get_flipped_mappped_value($app_table)][1][$field_name])), ' : ');
                         }
                     }
                 }
             }
             $arr_attributes[$attr_id] = join($app_table_value, ', ');
             //$arr_attributes[$attr_id] = $app_table_value;
         }
     }
     return $arr_attributes;
 }