Beispiel #1
0
            }
        }
        if ($result = $this->db->query($queryMat)) {
            while ($row = $result->fetch_assoc()) {
                $dataMat[] = $row;
            }
        }
        return array('geometry' => $dataGeometry, 'loading' => $dataLoading, 'support' => $dataSpt, 'material' => $dataMat);
    }
}
$get = (object) $_GET;
$request = (object) $_REQUEST;
$post = json_decode(file_get_contents("php://input"));
@($database = !empty($request->database) ? $request->database : $post->database);
$generic = new Generic($database);
$data = $generic->get(104, 'true');
// $data = $generic->get($request->userid, $request->clear);
// die(json_encode($data));
// var_dump($data);
// var_dump($data['geometry']);
$nodes_g = array();
for ($i = 0; $i < sizeof($data['geometry']); $i++) {
    if ($i == 0) {
        array_push($nodes_g, $data['geometry'][$i]['start']);
        array_push($nodes_g, $data['geometry'][$i]['end']);
    } else {
        array_push($nodes_g, $data['geometry'][$i]['end']);
    }
}
print_r($nodes_g);
var_dump($data['loading']);
Beispiel #2
0
 private static function placeInExpanded($data, array &$nodes, array $expansion_data, $name_property = 'name', $children_property = 'children', $output_type = 'keep_type')
 {
     $keys = array_keys($expansion_data);
     $column = $keys[0];
     $data_to_store = array_shift($expansion_data);
     $found_node = null;
     foreach ($nodes as $node) {
         if (Generic::get($node, $name_property) == Generic::get($data, $column)) {
             $found_node = $node;
         }
     }
     if ($found_node == null) {
         $found_node = array();
         $found_node[$name_property] = Generic::get($data, $column);
         foreach ($data_to_store as $col) {
             $found_node[$col] = Generic::get($data, $col);
         }
         if (count($expansion_data)) {
             $found_node[$children_property] = array();
         }
         if ($output_type == 'object') {
             $found_node = (object) $found_node;
         }
         $nodes[] = $found_node;
     }
     if (count($expansion_data)) {
         Arrays::placeInExpanded($data, Generic::get($found_node, $children_property), $expansion_data, $name_property, $children_property, $output_type);
     }
 }