annotate views/Extractapp/ExportTabDelimited.php @ 122:a36bb5a48af4 extractapp tip

1. remove redundancy server side code. 2. All pop up sub-windows are made with dialog component of bootstrap v3.3.2
author Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
date Thu, 28 Sep 2017 22:26:48 +0200
parents 0ef426b5a1b9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
92
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
1 <?php
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
2 /*
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
3 * ExportTabDelimited.php
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
4 * This file is part of Extraction-interface.
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
5 *
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
6 * Extraction-interface is free software: you can redistribute it and/or modify
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
8 * the Free Software Foundation, either version 3 of the License, or
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
9 * (at your option) any later version.
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
10 *
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
11 * Extraction-interface is distributed in the hope that it will be useful,
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
14 * GNU General Public License for more details.
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
15 *
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
17 * along with Extraction-interface. If not, see <http://www.gnu.org/licenses/>.
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
18 */
116
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
19 /*! \file
92
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
20 * This is the view for ExportTabDelimited.
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
21 */
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
22
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
23 // --- initialize ---
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
24 $outputTableArray = $viewmodel['outputTableArray'];
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
25 $bookId = $viewmodel['bookId'];
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
26 $sectionid = $viewmodel['section_id'];
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
27 $bookName = $viewmodel['bookName'];
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
28 $sectionName = $viewmodel['sectionName'];
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
29 $bookMeta = $viewmodel['bookMeta'];
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
30
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
31
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
32
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
33 $count=1;
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
34 foreach ( $outputTableArray as $trIndex =>$trValue ) {
116
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
35
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
36 if ( $trIndex==0 ) {
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
37 echo ",";
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
38 echo "Book ID,";
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
39 echo "Section ID,";
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
40 echo "Book Name,";
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
41 echo "Section Name,";
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
42 echo "Book Year,";
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
43 echo "Edition Year,";
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
44 echo "Addres,";
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
45 echo "Longitude,"; // longitude
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
46 echo "Latitude,"; // latitude
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
47 echo "Description,"; // description
94
b0cecc104639 new: modified tags can work on tagged text
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents: 92
diff changeset
48
92
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
49 } else {
116
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
50 echo $count++.",";
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
51 echo $bookId.",";
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
52 echo $sectionid.",";
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
53 echo $bookName.",";
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
54 echo $sectionName.",";
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
55 echo $bookMeta->book_year.",";
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
56 echo $bookMeta->edition_year.",";
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
57 echo $bookMeta->place_name.",";
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
58 echo $bookMeta->x.",";
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
59 echo $bookMeta->y.",";
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
60 echo $bookName."_".$sectionName.","; // description for LGMap
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
61
92
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
62 }
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
63 if ( isset( $trValue["page"] ) ) {
116
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
64 echo $trValue["page"].",";
92
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
65 } else {
116
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
66 echo ",";
92
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
67 }
116
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
68
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
69 foreach ( $outputTableArray[0][0] as $index => $value ) {
92
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
70 if ( $index == "time" ) {
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
71 if ( isset( $trValue[0][$index] ) ) {
116
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
72 echo $trValue[0][$index].",";
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
73 echo $trValue[0][$index].",";
92
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
74 } else {
116
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
75 echo ",";
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
76 echo ",";
92
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
77 }
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
78 } else {
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
79 if ( isset( $trValue[0][$index] ) ) {
116
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
80 echo $trValue[0][$index].",";
92
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
81 } else {
116
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
82 echo ",";
92
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
83 }
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
84 }
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
85 }
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
86 if ( isset( $trValue["other"] ) ) {
116
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
87 echo $trValue["other"].",";
92
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
88 } else {
116
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
89 echo ",";
92
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
90 }
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
91 if ( isset( $trValue["full"] ) ) {
116
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
92 echo $trValue["full"].",";
92
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
93 } else {
116
0ef426b5a1b9 replace delimit character from "tab" to "comma"
Calvin Yeh <cyeh@mpiwg-berlin.mpg.de>
parents: 94
diff changeset
94 echo ",";
92
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
95 }
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
96 echo "\n";
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
97 }
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
98
f5b0cd4f25b2 new: explore table for using on LGMap
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff changeset
99 ?>