-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisualization.php
More file actions
105 lines (86 loc) · 3.57 KB
/
visualization.php
File metadata and controls
105 lines (86 loc) · 3.57 KB
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
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!DOCTYPE html>
<?php
include_once dirname(__FILE__). '../../../conf/config.php';
include_once dirname(__FILE__). '../../../php/header-main.php';
if ($detect->isMobile()):
?>
<script>
//Enable overflow on mobile so you can pinch and zoom
$(document).ready(function () {
$(".overflow-vis").css("overflow-y", "visible");
})
</script>
<?php endif; ?>
<script src="<?php echo $searchflow_path ?>js/visualization.js"></script>
<script>
<?php if (!$is_embed): ?>
$(document).ready( function () {
$(window).on("resize", function () {
let debug = <?php echo ($is_debug)?("true"):("false") ?>
let div_height = calcDivHeight(debug
, search_flow_config.vis_page_options.fit_to_page);
$("#visualization").css("min-height", div_height + "px")
});
$(window).trigger('resize');
});
<?php endif ?>
</script>
<div class="overflow-vis">
<div id="visualization" style="background-color:white;"></div>
</div>
<script>
var div_height = calcDivHeight(<?php echo ($is_debug)?("true"):("false") ?>
, search_flow_config.vis_page_options.fit_to_page);
<?php if (!$is_embed): ?>
$(".overflow-vis").css("min-height", div_height + "px")
$("#visualization").css("min-height", div_height + "px")
<?php endif ?>
</script>
<?php
// This script is loading the headstart.php script from the Headstart. It is
// contains imports of bundles that are necessary for the application.
// Getting parsed url with parts such as host or path that can be used later
$hs_url = parse_url($headstart_path);
// Relative path to the headstart.php
$rel_path = rtrim($hs_url['path'], '/') . '/dist/headstart.php';
// Getting absolute path to the current file
$current_path = dirname(__FILE__);
// Defining amount of levels in the headstart path
$path_parts = explode('/', trim($hs_url['path'], '/'));
$extra_levels = max(count($path_parts) - 1, 0); // <- minus one, because headstart is the root
// Defining relative root with basic level up ('/../../../') and
// defined amount of levels in the headstart path
$relative_root = $current_path . str_repeat('/..', 3 + $extra_levels);
// Defining project root
$project_root = realpath($relative_root);
// Preparing the full path to the headstart.php file
$result_path = $project_root . $rel_path;
// Check that headstart.php exists or showing understandable error in the logs
if (!file_exists($result_path)) {
error_log("ERROR: headstart.php not found at $result_path");
} else {
include $result_path;
}
?>
<script type="text/javascript">
$(document).ready(function () {
headstart.start();
})
</script>
<script>
if("options_<?php echo $service ?>" in search_flow_config.search_options.filter_options) {
data_config.options = search_flow_config.search_options.filter_options.options_<?php echo $service ?>.dropdowns;
}
<?php if($has_custom_title): ?>
data_config.create_title_from_context_style = "custom";
data_config.custom_title = "<?php echo $custom_title?>";
<?php endif ?>
<?php if($has_vis_type && $vis_type === "timeline"): ?>
data_config.is_streamgraph = true;
data_config.show_area = false;
data_config.faqs_button = false;
<?php endif; ?>
<?php if($is_embed): ?>
data_config.credit_embed = true;
<?php endif ?>
</script>