Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Moving functions from file to file

  • Loading branch information...
commit 1462ea102bbea776cdd59d90a8a30e56f905bd9f 1 parent 85117a0
Michal Migurski authored
View
45 site/lib/output.php
@@ -229,4 +229,49 @@ function die_with_code($code, $message)
die($message);
}
+ function activity_to_geojson($activity)
+ {
+ $geojson = array(
+ 'type' => 'FeatureCollection',
+ 'features' => array()
+ );
+
+ foreach($activity as $action)
+ {
+ if($action['type'] == 'print') {
+ $geojson['features'][] = print_to_geojson_feature($action['print']);
+
+ } elseif($action['type'] == 'scan') {
+ $geojson['features'][] = scan_to_geojson_feature($action['scan']);
+
+ } elseif($action['type'] == 'note') {
+ $geojson['features'][] = scan_note_to_geojson_feature($action['note']);
+ }
+ }
+
+ return json_encode($geojson);
+ }
+
+ function activity_to_csv($activity)
+ {
+ $lines = array();
+
+ foreach($activity as $action)
+ {
+ if($action['type'] == 'print') {
+ $lines[] = print_to_csv_row($action['print']);
+
+ } elseif($action['type'] == 'scan') {
+ $lines[] = scan_to_csv_row($action['scan']);
+
+ } elseif($action['type'] == 'note') {
+ $lines[] = scan_note_to_csv_row($action['note']);
+ }
+ }
+
+ array_unshift($lines, 'type,href,created,person_href,geometry,atlas_page_href,snapshot_href,note');
+
+ return join("\n", $lines);
+ }
+
?>
View
2  site/templates/print.html.tpl
@@ -271,7 +271,7 @@
</div>
<div id="atlas-export-column">
- <h4>Export Geodata</h4>
+ <h4>Export Data</h4>
<ul>
<li><a href="{$base_dir}/activity.php?print={$print.id|escape}&amp;type=json">GeoJSON</a></li>
<li><a href="{$base_dir}/activity.php?print={$print.id|escape}&amp;type=csv">Plain Text (CSV)</a></li>
View
45 site/www/activity.php
@@ -92,51 +92,6 @@
array_multisort($times, SORT_ASC, $activity);
$context->sm->assign('activity', $activity);
- function activity_to_geojson($activity)
- {
- $geojson = array(
- 'type' => 'FeatureCollection',
- 'features' => array()
- );
-
- foreach($activity as $action)
- {
- if($action['type'] == 'print') {
- $geojson['features'][] = print_to_geojson_feature($action['print']);
-
- } elseif($action['type'] == 'scan') {
- $geojson['features'][] = scan_to_geojson_feature($action['scan']);
-
- } elseif($action['type'] == 'note') {
- $geojson['features'][] = scan_note_to_geojson_feature($action['note']);
- }
- }
-
- return json_encode($geojson);
- }
-
- function activity_to_csv($activity)
- {
- $lines = array();
-
- foreach($activity as $action)
- {
- if($action['type'] == 'print') {
- $lines[] = print_to_csv_row($action['print']);
-
- } elseif($action['type'] == 'scan') {
- $lines[] = scan_to_csv_row($action['scan']);
-
- } elseif($action['type'] == 'note') {
- $lines[] = scan_note_to_csv_row($action['note']);
- }
- }
-
- array_unshift($lines, 'type,href,created,person_href,geometry,atlas_page_href,snapshot_href,note');
-
- return join("\n", $lines);
- }
-
if($context->type == 'text/csv') {
header("Content-Type: text/csv");
header('Content-Disposition: filename="activity-'.$print['id'].'.csv"');
Please sign in to comment.
Something went wrong with that request. Please try again.