Mercurial > hg > extraction-interface
annotate develop/models/extractapp.php @ 27:4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 03 Mar 2015 11:47:41 +0100 |
parents | 579f03f8bee5 |
children | e6e9bdc4f256 |
rev | line source |
---|---|
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
2 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
3 <?php |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
4 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
5 class ExtractappModel extends BaseModel{ |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
6 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
7 public function Index() { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
8 return array("Index Value 1", "Value 2", "Value 3"); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
9 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
10 |
21
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
11 protected $section_id = 0, $data_path, $file_id = 0, $branch_id = 0, $user_id = 0, $lg_text = "", $topic = 0; |
14
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
12 public $messages = ""; |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
13 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
14 private function Initialize($_urlvalues) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
15 $this->SetSectionId($_urlvalues); |
11
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
16 |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
17 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
18 |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
19 public function GetTextFromFileId($_postdata) { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
20 $file_id = $_postdata['fileId']; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
21 $branch_id = $_postdata['branchId']; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
22 $section_id = $_postdata['sectionId']; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
23 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
24 $this->branch_id = $branch_id; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
25 $this->file_id = $file_id; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
26 $this->user_id = $_postdata['userId']; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
27 $this->section_id = $section_id; |
25
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
28 |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
29 |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
30 // TODO: get info from LGService |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
31 $this->section_name = $_postdata['sectionName']; |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
32 $this->book_id = $_postdata['bookId']; |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
33 $this->book_name = $_postdata['bookName']; |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
34 |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
35 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
36 // get from URL with file_id |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
37 $lg_text_url = $this->get_text_from_fileId_url.$file_id; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
38 $lg_text = file_get_contents($lg_text_url); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
39 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
40 $stringInput = $lg_text; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
41 $stringInput = preg_replace("/ /u", "○", $stringInput); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
42 $stringInput = preg_replace("/\n/u", "<br>", $stringInput); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
43 $stringInput = preg_replace("/【(.*?)】/u", "【<a href=\"review_index_xml_images.php?books_id=".$bookId."&pages=\\1&entry=0\" target=\"_bookImg\">\\1</a>】", $stringInput); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
44 $lg_text = $stringInput; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
45 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
46 $this->lg_text = $lg_text; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
47 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
48 } |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
49 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
50 public function GetTextFromSectionId($_postdata) { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
51 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
52 $section_id = $_postdata['sectionId']; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
53 $this->section_id = $section_id; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
54 $this->user_id = $_postdata['userId']; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
55 |
25
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
56 // TODO: get info from LGService |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
57 $this->section_name = $_postdata['sectionName']; |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
58 $this->book_id = $_postdata['bookId']; |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
59 $this->book_name = $_postdata['bookName']; |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
60 |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
61 |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
62 |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
63 // get from URL with file_id |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
64 $lg_text_url = $this->get_text_from_sectionId_url.$section_id; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
65 $lg_text = file_get_contents($lg_text_url); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
66 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
67 $stringInput = $lg_text; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
68 $stringInput = preg_replace("/<(.*?)>/u", "○", $stringInput); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
69 $stringInput = preg_replace("/ /u", "○", $stringInput); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
70 $stringInput = preg_replace("/\n/u", "<br>", $stringInput); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
71 $stringInput = preg_replace("/【(.*?)】/u", "【<a href=\"review_index_xml_images.php?books_id=".$bookId."&pages=\\1&entry=0\" target=\"_bookImg\">\\1</a>】", $stringInput); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
72 $lg_text = $stringInput; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
73 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
74 $this->lg_text = $lg_text; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
75 } |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
76 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
77 public function GetTextFromLocal($_id){ |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
78 $this->section_id = $_id; |
14
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
79 $this->messages .= "DEBUG: from my local"."<br>"; |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
80 $this->lg_text = $this->GetSectionContent(); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
81 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
82 } |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
83 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
84 public function GetInfoFromPreviousPage($_postdata) { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
85 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
86 if ($_postdata['fileId']) { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
87 $this->file_id = $_postdata['fileId']; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
88 } |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
89 if ($_postdata['sectionId']) { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
90 $this->section_id = $_postdata['sectionId']; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
91 } |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
92 if ($_postdata['text']) { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
93 $this->lg_text = $_postdata['text']; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
94 } |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
95 if ($_postdata['branchId']) { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
96 $this->branch_id = $_postdata['branchId']; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
97 } |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
98 if ($_postdata['userId']) { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
99 $this->user_id = $_postdata['userId']; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
100 } |
21
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
101 if ($_postdata['topic_id']) { |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
102 $this->topic = $_postdata['topic_id']; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
103 } |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
104 |
25
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
105 // TODO: LGService |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
106 if ($_postdata['sectionName']) { |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
107 $this->section_name = $_postdata['sectionName']; |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
108 } |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
109 if ($_postdata['bookName']) { |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
110 $this->book_name = $_postdata['bookName']; |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
111 } |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
112 if ($_postdata['bookId']) { |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
113 $this->book_id = $_postdata['bookId']; |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
114 } |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
115 |
21
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
116 $this->messages .= "Info: "; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
117 $this->messages .= "file_id=".$this->file_id.", section_id=".$this->section_id; |
25
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
118 $this->messages .= ", user_id=".$this->user_id.", branch_id=".$this->branch_id.", topic_id=".$this->topic; |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
119 $this->messages .= ", book_id=".$this->book_id.", book_name=".$this->book_name.", section_name=".$this->section_name."<br>"; |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
120 |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
121 |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
122 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
123 } |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
124 public function InitData($_postdata) { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
125 $file_id = $_postdata['fileId']; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
126 $branch_id = $_postdata['branchId']; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
127 $section_id = $_postdata['sectionId']; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
128 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
129 $this->branch_id = $branch_id; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
130 $this->file_id = $file_id; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
131 $this->user_id = $_postdata['userId']; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
132 $this->section_id = $section_id; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
133 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
134 if ($file_id != 0 && $branch_id != 0) { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
135 // get from URL with file_id |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
136 $lg_text_url = $this->get_text_from_fileId_url.$file_id; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
137 } else if ($section_id != 0) { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
138 // get from URL with section_id |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
139 $lg_text_url = $this->get_text_from_sectionId_url.$section_id; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
140 } else { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
141 echo "wrong url!!"; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
142 return; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
143 } |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
144 |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
145 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
146 $lg_text = file_get_contents($lg_text_url); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
147 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
148 /* |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
149 $stringInput = preg_replace("/ /u", "○", $stringInput); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
150 $stringInput = preg_replace("/\n/u", "<br>", $stringInput); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
151 $stringInput = preg_replace("/【(.*?)】/u", "【<a href=\"review_index_xml_images.php?books_id=".$bookId."&pages=\\1&entry=0\" target=\"_bookImg\">\\1</a>】", $stringInput); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
152 */ |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
153 |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
154 // the text is from database |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
155 $stringInput = $lg_text; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
156 $stringInput = preg_replace("/<(.*?)>/u", "○", $stringInput); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
157 $stringInput = preg_replace("/ /u", "○", $stringInput); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
158 $stringInput = preg_replace("/\n/u", "<br>", $stringInput); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
159 $stringInput = preg_replace("/【(.*?)】/u", "【<a href=\"review_index_xml_images.php?books_id=".$bookId."&pages=\\1&entry=0\" target=\"_bookImg\">\\1</a>】", $stringInput); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
160 $lg_text = $stringInput; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
161 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
162 $this->lg_text = $lg_text; |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
163 |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
164 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
165 } |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
166 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
167 // === for tagging === |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
168 public function StartTagging() { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
169 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
170 // $this->Initialize($urlvalues); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
171 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
172 $section_id = $this->section_id; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
173 $stringInput = $this->lg_text; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
174 |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
175 |
10
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
176 //$taglistArray = $this->GetTaglistArray(); |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
177 //for GetTaglistByTopicID: |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
178 $taglistArray = $this->GetTaglistByTopicID($this->GetTopic()); |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
179 // topic list |
10
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
180 $topiclistArray = $this->GetTopiclistArray(); |
9
584b1623e9ef
TOC correction list page updated
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
6
diff
changeset
|
181 |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
182 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
183 $wordlistArray = $this->GetWordlistArray(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
184 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
185 $data = array(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
186 $data['stringInput'] = $stringInput; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
187 $data['taglistArray'] = $taglistArray; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
188 $data['wordlistArray'] = $wordlistArray; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
189 $data['section_id'] = $section_id; |
10
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
190 $data['topiclistArray'] = $topiclistArray; |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
191 $data['default_topic_id'] = $this->GetTopic(); |
11
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
192 $data['topic_tag'] = $this->GetTopicTag($this->GetTopic()); |
15
1f98c92ebbfb
first version of UI layout. Very roughly, but works in the fixed sidebar, head line, popups and so on.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
14
diff
changeset
|
193 $data['topic_name'] = $this->GetTopicName($this->GetTopic()); |
1f98c92ebbfb
first version of UI layout. Very roughly, but works in the fixed sidebar, head line, popups and so on.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
14
diff
changeset
|
194 |
26
579f03f8bee5
merge table books_info into table books (execute Home/Test)
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
25
diff
changeset
|
195 $data['info'] = array('file_id'=>$this->file_id, 'user_id'=>$this->user_id, |
579f03f8bee5
merge table books_info into table books (execute Home/Test)
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
25
diff
changeset
|
196 'branch_id'=>$this->branch_id, 'section_id'=>$this->section_id, 'book_id'=>$this->book_id, |
579f03f8bee5
merge table books_info into table books (execute Home/Test)
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
25
diff
changeset
|
197 'book_name'=>$this->book_name, 'section_name'=>$this->section_name, |
579f03f8bee5
merge table books_info into table books (execute Home/Test)
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
25
diff
changeset
|
198 'current_fileId'=>$this->current_fileId); |
27
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
199 |
14
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
200 $data['messages'] = $this->messages; |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
201 |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
202 return $data; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
203 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
204 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
205 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
206 public function SaveFullText($postdata) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
207 if ($postdata['text']){ |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
208 $date = date('Y_m_d_H_i_s', time()); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
209 if ( file_exists("data/parsing_files/".$postdata['filename'].".txt") ) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
210 $oldFile = file_get_contents("data/parsing_files/".$postdata['filename'].".txt"); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
211 file_put_contents("data/parsing_files/".$postdata['filename']."_".$date.".txt", $oldFile); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
212 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
213 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
214 if (get_magic_quotes_gpc()) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
215 $require = stripslashes($postdata['text']); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
216 } else { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
217 $require = $postdata['text']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
218 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
219 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
220 $require = preg_replace("/【<a(.*?)>(.*?)<\/a>】/u", "【\\2】", $require); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
221 $require = preg_replace('/&/u', "&", $require); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
222 $require = preg_replace("/○/u", " ", $require); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
223 $require = preg_replace("/<br>/u", "\n", $require); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
224 $require = preg_replace("/<br>/u", "\n", $require); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
225 file_put_contents("data/parsing_files/".$postdata['filename'].".txt", $require); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
226 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
227 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
228 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
229 |
13
cc36a20a68ab
automatically decide which rows (what data) should be shown in the exporting table based on the topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
12
diff
changeset
|
230 public function UpdateInfoByResponseFromLGService($response) { |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
231 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
232 $response_file = $response["file"]; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
233 $response_branch = $response["branch"]; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
234 |
14
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
235 $this->file_id = (string)$response_file["id"]; |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
236 $this->branch_id = (string)$response_branch["id"]; |
25
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
237 |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
238 |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
239 |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
240 $status = (string)$response["status"]; |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
241 if ($status == "ok") { |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
242 $this->messages .= "saving success."; |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
243 |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
244 } else if ($status == "error") { |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
245 // saving not success |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
246 $this->messages .= "saving does not success! ".(string)$response["message"]; |
26
579f03f8bee5
merge table books_info into table books (execute Home/Test)
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
25
diff
changeset
|
247 $this->current_fileId = (string)$response['currentFileId']; |
579f03f8bee5
merge table books_info into table books (execute Home/Test)
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
25
diff
changeset
|
248 // ask to "force save" or "reload" |
25
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
249 |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
250 } |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
251 |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
252 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
253 } |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
254 public function SaveFullTextToLGService($_postdata) { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
255 // save tagged text (full text) by Jorge's API to lg service |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
256 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
257 // -------- |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
258 if ($_postdata['text']){ |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
259 $date = date('Y_m_d_H_i_s', time()); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
260 if ( file_exists("data/parsing_files/".$_postdata['sectionId'].".txt") ) { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
261 $oldFile = file_get_contents("data/parsing_files/".$_postdata['sectionId'].".txt"); |
25
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
262 //saving in my local machine in developing phrase |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
263 file_put_contents("data/parsing_files/".$_postdata['sectionId']."_".$date.".txt", $oldFile); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
264 } |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
265 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
266 if (get_magic_quotes_gpc()) { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
267 $require = stripslashes($_postdata['text']); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
268 } else { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
269 $require = $_postdata['text']; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
270 } |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
271 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
272 $require = preg_replace("/【<a(.*?)>(.*?)<\/a>】/u", "【\\2】", $require); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
273 $require = preg_replace('/&/u', "&", $require); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
274 $require = preg_replace("/○/u", " ", $require); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
275 $require = preg_replace("/<br>/u", "\n", $require); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
276 $require = preg_replace("/<br>/u", "\n", $require); |
25
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
277 //saving in my local machine in developing phrase |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
278 file_put_contents("data/parsing_files/".$_postdata['sectionId'].".txt", $require); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
279 } |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
280 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
281 // ------ |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
282 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
283 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
284 if ($_postdata['branchId'] != 0) { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
285 // exiting branch case |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
286 $postfields = array( |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
287 "text" => $require, |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
288 "branchId" => $_postdata['branchId'], |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
289 "userId" => $_postdata['userId'], |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
290 "userPreviousFileId" => $_postdata['fileId'], |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
291 ); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
292 $save_url = $this->save_to_LGService_url; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
293 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
294 } else { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
295 // new branch case |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
296 echo "saveNew!"; |
25
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
297 if ($_postdata['userId']) { |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
298 $user_id = $_postdata['userId']; |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
299 } else { |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
300 $user_id = "12"; |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
301 } |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
302 $postfields = array( |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
303 "text" => $require, |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
304 "sectionId" => $_postdata['sectionId'], |
25
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
305 "userId" => $user_id, |
14
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
306 "label" => $_postdata['label'], |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
307 ); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
308 $save_url = $this->save_new_to_LGService_url; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
309 } |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
310 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
311 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
312 // set up the curl resource |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
313 $ch = curl_init(); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
314 curl_setopt($ch, CURLOPT_URL, $save_url); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
315 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
316 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
317 curl_setopt($ch, CURLOPT_POST, true); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
318 curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
319 //curl_setopt($ch, CURLOPT_HEADER, true); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
320 curl_setopt($ch, CURLOPT_HTTPHEADER, array( |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
321 'Content-type: multipart/form-data;charset=utf-8' |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
322 )); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
323 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
324 // execute the request |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
325 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
326 $output = curl_exec($ch); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
327 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
328 // output the profile information - includes the header |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
329 //echo($output) . PHP_EOL; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
330 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
331 // close curl resource to free up system resources |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
332 curl_close($ch); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
333 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
334 $response = json_decode($output, true); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
335 return $response; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
336 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
337 } |
14
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
338 |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
339 // --- for regex ---- |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
340 public function GetRegexFilenameById($topic_id) { |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
341 $query = sprintf("SELECT regex_filename FROM `topic_regex_relation` WHERE topic_id=\"%s\"", $topic_id); |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
342 $result = mysql_query($query); |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
343 if (!$result) { |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
344 return json_encode("Failed during selecting topic_regex_relation table."); |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
345 } |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
346 |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
347 $filenames = array(); |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
348 while ($row = mysql_fetch_assoc($result)) { |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
349 array_push($filenames, $row['regex_filename']); |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
350 } |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
351 |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
352 return $filenames; |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
353 } |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
354 public function SmartRegexLoad($topic_id) { |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
355 |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
356 // Load regex file based on current topic. Only shows the regex in this topic -- |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
357 $filenames = $this->GetRegexFilenameById($topic_id); |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
358 |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
359 // Get regex file from filesystem ---- |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
360 $data_path = "./data/"; // get the current file path, which is getcwd(), and concatenate with "/data/" |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
361 $returnArray = array(); |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
362 $files1 = scandir($data_path."regex_files"); |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
363 foreach ( $files1 as $file ) { |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
364 if ( $file != "." && $file != ".." && $file != ".DS_Store") { |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
365 foreach ($filenames as $filename) { |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
366 if ($file == $filename) { |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
367 $returnArray[preg_replace("/\.txt/", "", $file)] = file_get_contents( $data_path."regex_files/".$file ); |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
368 break; |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
369 } |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
370 } |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
371 } |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
372 } |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
373 echo json_encode($returnArray); |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
374 return; |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
375 } |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
376 |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
377 |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
378 public function SmartRegexSave($_postdata) { |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
379 if ($_postdata['text']){ |
27
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
380 |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
381 // --- update topic_regex_relation table --- |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
382 $topic_id = $_postdata['topic_id']; |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
383 $filename = $_postdata['filename'].'.txt'; |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
384 |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
385 // check if already existing a record for this regex file |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
386 $query = "SELECT * FROM topic_regex_relation WHERE topic_id=".$topic_id." AND regex_filename='".$filename."'"; |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
387 $result = mysql_query($query); |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
388 if (!$result) { |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
389 echo json_encode("ErrorDB"); |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
390 } |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
391 while ($row = mysql_fetch_assoc($result)) { |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
392 if ($row && !$_postdata['forcesave']) { |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
393 // promt user a comfirm to force saving or not |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
394 echo json_encode("ForceSave"); |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
395 return; |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
396 } |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
397 } |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
398 |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
399 |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
400 if (!$_postdata['forcesave']) { |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
401 $query = "INSERT INTO topic_regex_relation (topic_id, regex_filename) VALUES (".$topic_id.",'".$filename."')"; |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
402 $result = mysql_query($query); |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
403 if (!$result) { |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
404 echo json_encode("ErrorDB"); |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
405 } |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
406 } |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
407 // --- write to filesystem --- |
4a29bccb6c59
modify the SmartRegexSave method to prevent duplicated records in topic_regex_relation table and provide better promting to user to force saving regex file or not
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
26
diff
changeset
|
408 |
14
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
409 /* |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
410 $date = date('Y_m_d_H_i_s', time()); |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
411 if ( file_exists("regex_files/".$_POST['filename'].".txt") ) { |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
412 $oldFile = file_get_contents("regex_files/".$_POST['filename'].".txt"); |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
413 file_put_contents("regex_files/".$_POST['filename']."_".$date.".txt", $oldFile); |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
414 } |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
415 */ |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
416 $data_path = "./data/"; // get the current file path, which is getcwd(), and concatenate with "/data/" |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
417 |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
418 if (get_magic_quotes_gpc()) { |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
419 $require = stripslashes($_postdata['text']); |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
420 } else { |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
421 $require = $_postdata['text']; |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
422 } |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
423 |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
424 file_put_contents( $data_path."regex_files/".$_postdata['filename'].".txt", $require); |
20
04db1dd9d10d
update topic_regex_relation table when saving (new) regex file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
19
diff
changeset
|
425 |
04db1dd9d10d
update topic_regex_relation table when saving (new) regex file
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
19
diff
changeset
|
426 |
14
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
427 } |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
428 } |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
429 |
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
430 |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
431 // === for export table === |
13
cc36a20a68ab
automatically decide which rows (what data) should be shown in the exporting table based on the topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
12
diff
changeset
|
432 public function ExportTable($postdata) { |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
433 // $this->Initialize($urlvalues); |
13
cc36a20a68ab
automatically decide which rows (what data) should be shown in the exporting table based on the topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
12
diff
changeset
|
434 |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
435 $content = $postdata['content']; |
11
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
436 $topic = $postdata['topic']; |
21
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
437 $section_id = $postdata['sectionId']; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
438 |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
439 //$section_id = $this->section_id; |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
440 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
441 |
25
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
442 // TODO: this should be get from LGService: sectionName, bookId, bookName |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
443 $sectionName = $postdata['sectionName']; |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
444 $bookId = $postdata['bookId']; |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
445 $bookName = $postdata['bookName']; |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
446 |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
447 |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
448 // --- replace if get info from LGService |
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
449 /* |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
450 $section_info = $this->GetSectionInfo(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
451 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
452 $sectionName = $section_info['sectionName']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
453 $bookId = $section_info['bookId']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
454 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
455 $books_info = $this->GetBooksInfo($bookId); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
456 $bookName = $books_info['bookName']; |
25
4b6d2d7e706e
update for the integration
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
24
diff
changeset
|
457 */ |
13
cc36a20a68ab
automatically decide which rows (what data) should be shown in the exporting table based on the topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
12
diff
changeset
|
458 // ===== |
cc36a20a68ab
automatically decide which rows (what data) should be shown in the exporting table based on the topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
12
diff
changeset
|
459 |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
460 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
461 $outputTableArray = array(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
462 |
11
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
463 //$taglistArray = $this->GetTaglistArray(); |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
464 $taglistArray = $this->GetTaglistByTopicID($topic); |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
465 |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
466 $outputTableArray[0]=array(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
467 $outputTableArray[0][0]=array(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
468 $outputTableArray[0][1]=array(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
469 foreach ( $taglistArray as $value ) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
470 $outputTableArray[0][0][$value[2]] = $value[1]; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
471 $outputTableArray[0][1][$value[2]] = $value[1]."(Title)"; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
472 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
473 $outputTableArray[0]["other"] = "其他"; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
474 $outputTableArray[0]["page"] = "頁數"; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
475 $outputTableArray[0]["full"] = "全文"; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
476 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
477 foreach ( $taglistArray as $tagValue ) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
478 $content = preg_replace("/<\/".$tagValue[2].">○*<".$tagValue[2].">/u", "", $content); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
479 $content = preg_replace("/<".$tagValue[2].">[ ]*<\/".$tagValue[2].">/u", "", $content); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
480 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
481 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
482 $contentLineArray = explode( "<br>", $content ); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
483 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
484 $count=0; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
485 $pageNow=NULL; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
486 foreach ( $contentLineArray as $value ) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
487 $count++; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
488 $recordString = $value; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
489 $otherString = $recordString; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
490 //echo $recordString."<br>\n"; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
491 if ( preg_match("/【<a(.*?)>(.*?)<\/a>】/u", $recordString, $matches) ) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
492 $pageNow = $matches[2]; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
493 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
494 foreach ( $taglistArray as $tagValue ) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
495 if ( preg_match_all("/<".$tagValue[2].">(.*?)<\/".$tagValue[2].">/u", $recordString, $matches, PREG_SET_ORDER) ) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
496 foreach ( $matches as $matchesValue ) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
497 $matchesValue[1] = preg_replace("/○/u", "", $matchesValue[1]); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
498 if ( preg_match_all("/〈(.*?)〉/u", $matchesValue[1], $matches2, PREG_SET_ORDER) ) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
499 foreach ( $matches2 as $matches2Value ) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
500 if ( isset($outputTableArray[$count][0][$tagValue[2]]) ) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
501 $outputTableArray[$count][0][$tagValue[2]] .= ";".$matches2Value[1]; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
502 } else { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
503 $outputTableArray[$count][0][$tagValue[2]] = $matches2Value[1]; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
504 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
505 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
506 } else { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
507 if ( isset($outputTableArray[$count][0][$tagValue[2]]) ) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
508 $outputTableArray[$count][0][$tagValue[2]] .= ";".$matchesValue[1]; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
509 } else { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
510 $outputTableArray[$count][0][$tagValue[2]] = $matchesValue[1]; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
511 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
512 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
513 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
514 $otherString = preg_replace("/<".$tagValue[2].">(.*?)<\/".$tagValue[2].">/u", " ", $otherString); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
515 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
516 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
517 $otherString = preg_replace("/○/u", "", $otherString); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
518 $outputTableArray[$count]["other"] = $otherString; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
519 $outputTableArray[$count]["page"] = $pageNow; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
520 $value = preg_replace("/>/u", ">", $value); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
521 $value = preg_replace("/</u", "<", $value); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
522 $outputTableArray[$count]["full"] = $value; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
523 } |
11
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
524 /* |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
525 echo "<br>"."DEBUG: outputTableArray:"."<br>"; |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
526 var_dump($outputTableArray); |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
527 */ |
13
cc36a20a68ab
automatically decide which rows (what data) should be shown in the exporting table based on the topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
12
diff
changeset
|
528 |
cc36a20a68ab
automatically decide which rows (what data) should be shown in the exporting table based on the topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
12
diff
changeset
|
529 $topic_tag = $this->GetTopicTag($topic); |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
530 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
531 foreach ( $outputTableArray as $arrayIndex => $arrayValue ) { |
11
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
532 // output each row which the topic tag |
13
cc36a20a68ab
automatically decide which rows (what data) should be shown in the exporting table based on the topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
12
diff
changeset
|
533 // e.g. the original version is for 'person' |
cc36a20a68ab
automatically decide which rows (what data) should be shown in the exporting table based on the topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
12
diff
changeset
|
534 if ( !isset($arrayValue[0][$topic_tag]) ) { |
cc36a20a68ab
automatically decide which rows (what data) should be shown in the exporting table based on the topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
12
diff
changeset
|
535 unset($outputTableArray[$arrayIndex]); |
cc36a20a68ab
automatically decide which rows (what data) should be shown in the exporting table based on the topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
12
diff
changeset
|
536 } |
cc36a20a68ab
automatically decide which rows (what data) should be shown in the exporting table based on the topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
12
diff
changeset
|
537 |
cc36a20a68ab
automatically decide which rows (what data) should be shown in the exporting table based on the topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
12
diff
changeset
|
538 /* |
11
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
539 if ($topic == 1) { |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
540 if ( !isset($arrayValue[0]["person"]) ) { |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
541 unset($outputTableArray[$arrayIndex]); |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
542 } |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
543 } else if ($topic == 2) { |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
544 |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
545 // for object topic |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
546 if ( !isset($arrayValue[0]["object"]) ) { // only the record with the tag of 'object' will become a row |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
547 unset($outputTableArray[$arrayIndex]); |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
548 } |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
549 } |
13
cc36a20a68ab
automatically decide which rows (what data) should be shown in the exporting table based on the topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
12
diff
changeset
|
550 */ |
11
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
551 |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
552 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
553 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
554 $data = array(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
555 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
556 $data['outputTableArray'] = $outputTableArray; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
557 $data['bookId'] = $bookId; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
558 $data['section_id'] = $section_id; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
559 $data['bookName'] = $bookName; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
560 $data['sectionName'] = $sectionName; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
561 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
562 return $data; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
563 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
564 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
565 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
566 // === for manage tag list === |
17
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
567 public function EditTaglist($_postdata) { |
22
a8ae5cbc3364
update topic_tag_relation table when adding new tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
21
diff
changeset
|
568 $query = "SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='taglist'"; |
a8ae5cbc3364
update topic_tag_relation table when adding new tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
21
diff
changeset
|
569 $result = mysql_query($query); |
a8ae5cbc3364
update topic_tag_relation table when adding new tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
21
diff
changeset
|
570 if (!$result) { |
a8ae5cbc3364
update topic_tag_relation table when adding new tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
21
diff
changeset
|
571 echo json_encode(mysql_error()); |
a8ae5cbc3364
update topic_tag_relation table when adding new tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
21
diff
changeset
|
572 } |
a8ae5cbc3364
update topic_tag_relation table when adding new tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
21
diff
changeset
|
573 $row = mysql_fetch_assoc($result); |
a8ae5cbc3364
update topic_tag_relation table when adding new tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
21
diff
changeset
|
574 $largest_id = $row['AUTO_INCREMENT']; |
a8ae5cbc3364
update topic_tag_relation table when adding new tag
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
21
diff
changeset
|
575 |
21
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
576 |
17
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
577 $topic_id = $_postdata['topic_id']; |
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
578 $result = $this->GetTaglistByTopicID($topic_id); |
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
579 |
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
580 $taglistArray = array(); |
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
581 foreach ($result as $row) { |
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
582 $taglistArray[$row[0]] = array($row[1], $row[2], $row[3]); |
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
583 //$taglistArray[$row['id']] = array($row['name'], $row['tag'], $row['color']); |
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
584 // TODO: the format is not good, so I use $row[0], $row[1],... This could be changed some time. |
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
585 } |
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
586 |
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
587 /* |
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
588 //$result = $this->GetTaglist(); |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
589 $taglistArray = array(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
590 while ($row = mysql_fetch_assoc($result)) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
591 $taglistArray[$row['id']] = array($row['name'], $row['tag'], $row['color']); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
592 } |
17
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
593 */ |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
594 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
595 $data = array(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
596 $data['taglistArray'] = $taglistArray; |
17
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
597 $data['topic_id'] = $topic_id; |
21
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
598 $data['largest_id'] = $largest_id; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
599 |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
600 |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
601 return $data; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
602 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
603 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
604 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
605 private function _GetTag($_postdata) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
606 if (get_magic_quotes_gpc()) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
607 $id = stripslashes($_postdata['id']); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
608 $name = stripslashes($_postdata['name']); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
609 $tag = stripslashes($_postdata['tag']); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
610 $color = stripslashes($_postdata['color']); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
611 } else { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
612 $id = $_postdata['id']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
613 $name = $_postdata['name']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
614 $tag = $_postdata['tag']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
615 $color = $_postdata['color']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
616 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
617 return array($id, $name, $tag, $color); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
618 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
619 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
620 public function NewTagElement($postdata) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
621 if ($postdata['id']){ |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
622 list($id, $name, $tag, $color) = $this->_GetTag($postdata); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
623 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
624 $query1 = sprintf("INSERT INTO `taglist` (`id`, `name`, `tag`, `color`, `systemName`) VALUES (%s, %s, %s, %s, %s)", |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
625 $this->GetSQLValueString($id, "int"), |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
626 $this->GetSQLValueString($name, "text"), |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
627 $this->GetSQLValueString($tag, "text"), |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
628 $this->GetSQLValueString($color, "text"), |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
629 $this->GetSQLValueString($this->systemNAME, "text")); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
630 $result1 = mysql_query($query1); |
17
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
631 |
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
632 |
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
633 // add it to topic_tag_relation table |
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
634 $topic_id = $postdata['topic_id']; |
19
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
635 |
17
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
636 // tag_id is $id; |
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
637 $query = sprintf("INSERT INTO `topic_tag_relation` (`topic_id`,`tag_id`) VALUES (%s,%s)", $topic_id, $id); |
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
638 $result = mysql_query($query); |
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
639 if (!$result) { |
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
640 echo json_encode("error when insert into topic_tag_relation table"); |
82f8c6bd2b69
add new tag will based on the current topic_id, insert new element into (1)taglist table and (2)topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
15
diff
changeset
|
641 } |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
642 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
643 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
644 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
645 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
646 public function SaveTagElement($postdata) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
647 if ($postdata['id']){ |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
648 list($id, $name, $tag, $color) = $this->_GetTag($postdata); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
649 |
19
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
650 $query = sprintf("UPDATE taglist SET `name`=%s, `tag`=%s, `color`=%s WHERE `id`=%s", |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
651 $this->GetSQLValueString($name, "text"), |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
652 $this->GetSQLValueString($tag, "text"), |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
653 $this->GetSQLValueString($color, "text"), |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
654 $this->GetSQLValueString($id, "int")); |
19
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
655 $result = mysql_query($query); |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
656 |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
657 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
658 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
659 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
660 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
661 public function DeleteTag($postdata) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
662 if ($postdata['id']) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
663 $queryInsert = sprintf("DELETE FROM `taglist` WHERE `id` = %s", stripslashes($postdata['id'])); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
664 $resultInsert = mysql_query($queryInsert); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
665 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
666 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
667 } |
9
584b1623e9ef
TOC correction list page updated
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
6
diff
changeset
|
668 |
10
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
669 // === for config topic === |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
670 public function ConfigTagsInTopic($postdata) { |
24
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
671 $topic = $postdata['topic']; |
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
672 $result = $this->GetTopicByID($topic); |
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
673 $row = mysql_fetch_assoc($result); |
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
674 $topic_name = $row['name']; |
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
675 |
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
676 /* |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
677 $query = "SELECT taglist.*, topic_tag_relation.topic_id FROM taglist LEFT JOIN topic_tag_relation ON taglist.id = topic_tag_relation.tag_id ORDER BY `topic_id`"; |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
678 $result = mysql_query($query); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
679 if (!$result) { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
680 return json_encode("Failed during selecting/joining taglist and topic_tag_relation table."); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
681 } |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
682 $taglistArray = array(); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
683 while ($row = mysql_fetch_assoc($result)) { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
684 array_push($taglistArray, array('id'=>$row['id'],'name'=>$row['name'], 'tag'=>$row['tag'], 'color'=>$row['color'], 'topic_id'=>$row['topic_id']) ); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
685 } |
24
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
686 */ |
21
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
687 |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
688 // ------ |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
689 $query = "SELECT taglist.*, topic_tag_relation.topic_id FROM taglist LEFT JOIN topic_tag_relation ON taglist.id = topic_tag_relation.tag_id ORDER BY `topic_id`"; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
690 $result = mysql_query($query); |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
691 if (!$result) { |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
692 return json_encode("Failed during selecting/joining taglist and topic_tag_relation table."); |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
693 } |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
694 |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
695 $tag_intopic = array(); |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
696 $tag_others = array(); |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
697 $tag_tmp_others = array(); |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
698 while ($row = mysql_fetch_assoc($result)) { |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
699 if ($row['topic_id'] == $topic) { |
23
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
700 array_push($tag_intopic, array('id'=>$row['id'],'name'=>$row['name'], 'tag'=>$row['tag'], 'color'=>$row['color'], 'topic_id'=>$row['topic_id'])); |
21
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
701 } else { |
23
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
702 array_push($tag_tmp_others, array('id'=>$row['id'],'name'=>$row['name'], 'tag'=>$row['tag'], 'color'=>$row['color'], 'topic_id'=>$row['topic_id'])); |
21
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
703 } |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
704 } |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
705 |
24
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
706 // --- check if there's any duplicated tags in tag_tmp_others. remove the duplicated tags |
23
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
707 $num_others = count($tag_tmp_others); |
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
708 for ($i=0; $i < $num_others; $i++) { |
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
709 $cnt = 0; |
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
710 for ($j=$i+1; $j < $num_others; $j++) { |
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
711 if ($tag_tmp_others[$i]['tag'] == $tag_tmp_others[$j]['tag']) { |
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
712 break; |
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
713 } else { |
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
714 $cnt++; |
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
715 } |
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
716 } |
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
717 if ($cnt == ($num_others-$i-1) ) { |
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
718 $row = $tag_tmp_others[$i]; |
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
719 array_push($tag_others, array('id'=>$row['id'],'name'=>$row['name'], 'tag'=>$row['tag'], 'color'=>$row['color'], 'topic_id'=>$row['topic_id']) ); |
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
720 } |
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
721 } |
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
722 |
24
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
723 // --- remove duplicated tags in tag_others that is duplicated with tags in tag_intopic |
23
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
724 $tag_tmp_others = $tag_others; |
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
725 $tag_others = array(); |
21
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
726 |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
727 foreach ($tag_tmp_others as $tmp) { |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
728 $cnt = 0; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
729 foreach ($tag_intopic as $intopic) { |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
730 if ($tmp['tag'] == $intopic['tag']) { |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
731 break; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
732 } else { |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
733 $cnt ++; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
734 } |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
735 } |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
736 if ($cnt == count($tag_intopic)) { |
23
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
737 // not appear in $tag_intopic |
21
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
738 array_push($tag_others, $tmp); |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
739 } |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
740 } |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
741 |
24
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
742 // ----- |
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
743 |
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
744 |
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
745 $data = array(); |
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
746 //$data['taglistArray'] = $taglistArray; |
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
747 $data['topic'] = $topic; |
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
748 $data['topic_name'] = $topic_name; |
21
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
749 |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
750 $data['tag_intopic'] = $tag_intopic; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
751 $data['tag_others'] = $tag_others; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
752 |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
753 return $data; |
11
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
754 } |
21
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
755 |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
756 |
19
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
757 public function UpdateTagsInTopic($_postdata) { |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
758 $topic_id = $_postdata['topic_id']; |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
759 $tag_ids = json_decode(str_replace('\\', '', $_postdata['ids'])); |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
760 |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
761 // update topic_tag_relation by tags_ids array as `tag_id` and topic_id as `topic_id` |
21
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
762 // --- add new topic_tag_relation --- |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
763 foreach ($tag_ids as $tag_id) { |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
764 $query = "SELECT * FROM topic_tag_relation WHERE tag_id=".$tag_id; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
765 $result = mysql_query($query); |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
766 if (!$result) { |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
767 echo json_encode("error when select from topic_tag_relation"); |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
768 } |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
769 $topic_tag = array(); |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
770 $flag = false; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
771 while ($row = mysql_fetch_assoc($result)) { |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
772 if ($row['topic_id'] == $topic_id) { |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
773 $flag = true; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
774 break; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
775 } |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
776 } |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
777 if (!$flag) { |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
778 // insert a row into topic_tag_relation table |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
779 $queryUpdate = "INSERT INTO topic_tag_relation (topic_id, tag_id) VALUES (".$topic_id.",".$tag_id.")"; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
780 $resultUpdate = mysql_query($queryUpdate); |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
781 if (!$resultUpdate) { |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
782 return json_encode("error when insert topic_tag_relation table"); |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
783 } |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
784 } |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
785 |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
786 } |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
787 |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
788 // --- remove tags from this topic --- |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
789 $query = "SELECT * FROM topic_tag_relation WHERE topic_id=".$topic_id; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
790 $result = mysql_query($query); |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
791 if (!$result) { |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
792 echo json_encode("error when select from topic_tag_relation"); |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
793 } |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
794 |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
795 while ($row = mysql_fetch_assoc($result)) { |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
796 $cnt = 0; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
797 foreach ($tag_ids as $tag_id) { |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
798 if ($row['tag_id'] == $tag_id) { |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
799 break; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
800 } else { |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
801 $cnt ++; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
802 } |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
803 } |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
804 $_id = $row['id']; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
805 if ($cnt == count($tag_ids)) { |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
806 // delete row with (topic_id, tag_ids) |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
807 $queryDelete = "DELETE FROM topic_tag_relation WHERE id=".$_id; |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
808 $resultDelete = mysql_query($queryDelete); |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
809 if (!$resultDelete) { |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
810 echo json_encode("error when delete from topic_tag_relation"); |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
811 } |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
812 } |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
813 } |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
814 |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
815 |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
816 |
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
817 /* |
23
a879f6b9d166
modification for select-move-taglist: tags don't appear to be duplicated in other topics.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
22
diff
changeset
|
818 $query = "SELECT * FROM topic_tag_relation"; |
19
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
819 $result = mysql_query($query); |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
820 if (!$result) { |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
821 echo json_encode("error when select from topic_tag_relation"); |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
822 } |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
823 $topic_tag = array(); |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
824 while ($row = mysql_fetch_assoc($result)) { |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
825 array_push($topic_tag, array('tag_id'=>$row['tag_id'], 'topic_id'=>$row['topic_id'])); |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
826 } |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
827 |
21
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
828 |
19
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
829 foreach ($topic_tag as $value) { |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
830 $flag = false; |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
831 foreach ($tag_ids as $tag_id) { |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
832 if ($value['tag_id'] == $tag_id) { |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
833 //update its topic_id to $topic_id |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
834 $queryUpdate = "UPDATE topic_tag_relation SET topic_id=".$topic_id." WHERE tag_id=".$tag_id; |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
835 $resultUpdate = mysql_query($queryUpdate); |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
836 if (!$resultUpdate) { |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
837 return json_encode("error when update topic_tag_relation table"); |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
838 } |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
839 $flag = true; |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
840 break; |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
841 } |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
842 } |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
843 if (!$flag && $value['topic_id'] == $topic_id) { |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
844 // set its topic_id to 0, indicating unsigned |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
845 $queryUpdate = "UPDATE topic_tag_relation SET topic_id=0 WHERE tag_id=".$value['tag_id']; |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
846 $resultUpdate = mysql_query($queryUpdate); |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
847 if (!$resultUpdate) { |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
848 return json_encode("error when update topic_tag_relation table"); |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
849 } |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
850 } |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
851 } |
21
c805470cefee
Remove bootstrap.TaggingText UI layout modification
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
20
diff
changeset
|
852 */ |
19
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
853 |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
854 } |
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
855 |
9
584b1623e9ef
TOC correction list page updated
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
6
diff
changeset
|
856 |
584b1623e9ef
TOC correction list page updated
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
6
diff
changeset
|
857 private function GetTaglistByTopicID($topic_id) { |
10
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
858 $taglistArray = array(); |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
859 // select taglist ids from topic_tag_relation table |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
860 $query = sprintf("SELECT * FROM `topic_tag_relation` WHERE `topic_id`='%s'", $topic_id); |
9
584b1623e9ef
TOC correction list page updated
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
6
diff
changeset
|
861 $result = mysql_query($query); |
584b1623e9ef
TOC correction list page updated
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
6
diff
changeset
|
862 if (!$result) { |
10
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
863 return json_encode("Failed during selecting topic_tag_relation table."); |
9
584b1623e9ef
TOC correction list page updated
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
6
diff
changeset
|
864 } |
10
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
865 $taglist_ids = array(); |
9
584b1623e9ef
TOC correction list page updated
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
6
diff
changeset
|
866 |
584b1623e9ef
TOC correction list page updated
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
6
diff
changeset
|
867 while ($row = mysql_fetch_assoc($result)) { |
10
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
868 array_push($taglist_ids, $row['tag_id']); |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
869 } |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
870 |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
871 // select taglist by tag ids |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
872 foreach ($taglist_ids as $tag_id) { |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
873 $query = sprintf("SELECT * FROM `taglist` WHERE `id`='%s'", $tag_id); |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
874 $result = mysql_query($query); |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
875 if (!$result) { |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
876 echo mysql_error(); |
9
584b1623e9ef
TOC correction list page updated
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
6
diff
changeset
|
877 return json_encode("Failed during selecting taglist table."); |
584b1623e9ef
TOC correction list page updated
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
6
diff
changeset
|
878 } |
10
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
879 |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
880 $row = mysql_fetch_assoc($result); |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
881 array_push($taglistArray, array( $row['id'], $row['name'], $row['tag'], $row['color'] )); |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
882 |
9
584b1623e9ef
TOC correction list page updated
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
6
diff
changeset
|
883 } |
584b1623e9ef
TOC correction list page updated
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
6
diff
changeset
|
884 return $taglistArray; |
10
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
885 } |
9
584b1623e9ef
TOC correction list page updated
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
6
diff
changeset
|
886 |
10
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
887 public function SetTopic($topic) { |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
888 $this->topic = $topic; |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
889 } |
9
584b1623e9ef
TOC correction list page updated
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
6
diff
changeset
|
890 |
10
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
891 public function GetTopic() { |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
892 return $this->topic; |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
893 } |
9
584b1623e9ef
TOC correction list page updated
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
6
diff
changeset
|
894 |
10
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
895 private function GetTopiclistArray() { |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
896 $topiclistArray = array(); |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
897 $result = $this->GetTopiclist(); |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
898 while ($row = mysql_fetch_assoc($result)) { |
11
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
899 array_push($topiclistArray, array('id'=>$row['id'],'name'=>$row['name'],'tag'=>$row['tag'])); |
10
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
900 } |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
901 return $topiclistArray; |
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
902 } |
9
584b1623e9ef
TOC correction list page updated
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
6
diff
changeset
|
903 |
11
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
904 |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
905 private function GetTopicTag($topic_id) { |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
906 $result = $this->GetTopicByID($topic_id); |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
907 $row = mysql_fetch_assoc($result); |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
908 $tag = $row['tag']; |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
909 return $tag; |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
910 |
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
911 } |
15
1f98c92ebbfb
first version of UI layout. Very roughly, but works in the fixed sidebar, head line, popups and so on.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
14
diff
changeset
|
912 private function GetTopicName($topic_id) { |
1f98c92ebbfb
first version of UI layout. Very roughly, but works in the fixed sidebar, head line, popups and so on.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
14
diff
changeset
|
913 $result = $this->GetTopicByID($topic_id); |
1f98c92ebbfb
first version of UI layout. Very roughly, but works in the fixed sidebar, head line, popups and so on.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
14
diff
changeset
|
914 $row = mysql_fetch_assoc($result); |
1f98c92ebbfb
first version of UI layout. Very roughly, but works in the fixed sidebar, head line, popups and so on.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
14
diff
changeset
|
915 $name = $row['name']; |
1f98c92ebbfb
first version of UI layout. Very roughly, but works in the fixed sidebar, head line, popups and so on.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
14
diff
changeset
|
916 return $name; |
1f98c92ebbfb
first version of UI layout. Very roughly, but works in the fixed sidebar, head line, popups and so on.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
14
diff
changeset
|
917 |
1f98c92ebbfb
first version of UI layout. Very roughly, but works in the fixed sidebar, head line, popups and so on.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
14
diff
changeset
|
918 } |
11
3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
10
diff
changeset
|
919 |
19
f60969462226
save tag modification of topic configration into topic_tag_relation table
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
17
diff
changeset
|
920 |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
921 // =========================== |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
922 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
923 // === for manage wordlist === |
14
ac77748bb813
- Load regex files based on current topic. Only show the regex in this topic.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
13
diff
changeset
|
924 public function EditWordlist() { |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
925 $result = $this->GetWordlist(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
926 $wordlistArray = array(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
927 while ($row = mysql_fetch_assoc($result)) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
928 $wordlistArray[$row['id']] = $row['name']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
929 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
930 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
931 $data = array(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
932 $data['wordlistArray'] = $wordlistArray; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
933 return $data; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
934 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
935 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
936 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
937 public function AddNewList($postdata) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
938 if ($postdata['text']){ |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
939 if (get_magic_quotes_gpc()) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
940 $name = stripslashes($postdata['text']); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
941 } else { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
942 $name = $postdata['text']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
943 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
944 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
945 $query1 = sprintf("INSERT INTO `wordlist` (`name`, `systemName`) VALUES (%s, %s)", |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
946 $this->GetSQLValueString($name, "text"), |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
947 $this->GetSQLValueString($this->systemNAME, "text")); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
948 $result1 = mysql_query($query1); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
949 file_put_contents( "data/wordlist/".mysql_insert_id().".txt", "(empty now)"); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
950 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
951 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
952 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
953 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
954 public function SaveWordlist($postdata) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
955 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
956 if ($postdata['text']){ |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
957 $date = date('Y_m_d_H_i_s', time()); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
958 if ( file_exists("data/wordlist/".$postdata['filename'].".txt") ) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
959 $filename = "data/wordlist/".$postdata['filename']."_".$date.".txt"; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
960 $oldFile = file_get_contents("data/wordlist/".$postdata['filename'].".txt"); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
961 file_put_contents($filename, $oldFile); |
24
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
962 } |
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
963 /*else { |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
964 $filename = "data/wordlist/".$postdata['filename'].".txt"; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
965 } |
24
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
966 */ |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
967 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
968 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
969 if (get_magic_quotes_gpc()) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
970 $require = stripslashes($postdata['text']); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
971 } else { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
972 $require = $postdata['text']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
973 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
974 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
975 $require = preg_replace("/<br>/u", "<br>", $require); |
24
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
976 file_put_contents("data/wordlist/".$postdata['filename'].".txt", $require); |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
977 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
978 /* |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
979 if ($postdata['text']){ |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
980 $date = date('Y_m_d_H_i_s', time()); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
981 if ( file_exists("data/wordlist/".$postdata['filename'].".txt") ) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
982 $oldFile = file_get_contents("data/wordlist/".$postdata['filename'].".txt"); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
983 file_put_contents("data/wordlist/".$postdata['filename']."_".$date.".txt", $oldFile); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
984 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
985 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
986 if (get_magic_quotes_gpc()) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
987 $require = stripslashes($postdata['text']); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
988 } else { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
989 $require = $postdata['text']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
990 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
991 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
992 // $require = preg_replace("/<br>/u", "", $require); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
993 file_put_contents("data/wordlist/".$postdata['filename'].".txt", $require); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
994 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
995 */ |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
996 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
997 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
998 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
999 // ======================================= |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1000 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1001 public function sortFunction($a,$b) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1002 return strlen($b)-strlen($a); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1003 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1004 |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
1005 // TODO: delete this |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1006 private function SetSectionId($_urlvalues) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1007 // TODO: maybe get user info also |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1008 // get book id from url |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1009 if ($_urlvalues['id'] != "") { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1010 $section_id = $_urlvalues['id']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1011 } else { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1012 return json_encode("Error: No section id"); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1013 /* ???? */ |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1014 /* |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1015 $get_book_id = $urlvalues['book']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1016 $get_start = $urlvalues['start']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1017 $get_end = $urlvalues['end']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1018 */ |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1019 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1020 $this->section_id = $section_id; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1021 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1022 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1023 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1024 private function GetSectionId() { |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
1025 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
1026 if (is_numeric($this->section_id)) { |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1027 return $this->section_id; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1028 } else { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1029 return json_encode("Error: No section id"); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1030 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1031 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1032 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1033 private function GetSectionInfo() { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1034 $section_id = $this->GetSectionId(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1035 if (!is_numeric($section_id)){ |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1036 return $section_id; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1037 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1038 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1039 $result = $this->GetSectionsByID($section_id); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1040 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1041 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1042 while ($row = mysql_fetch_assoc($result)) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1043 $bookId=$row['books_id']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1044 $startPage=$row['start_page']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1045 $endPage=$row['end_page']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1046 $sectionName = $row['name']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1047 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1048 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1049 $data = array(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1050 $data['bookId'] = $bookId; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1051 $data['startPage'] = $startPage; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1052 $data['endPage'] = $endPage; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1053 $data['sectionName'] = $sectionName; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1054 |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
1055 |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1056 return $data; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1057 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1058 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1059 private function GetSectionContent() { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1060 $section_id = $this->GetSectionId(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1061 $section_info = $this->GetSectionInfo(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1062 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1063 $bookId = $section_info['bookId']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1064 $startPage = $section_info['startPage']; |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
1065 $endPage = $section_info['endPage']; |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1066 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1067 $contentString=""; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1068 $data_path = $this->GetDataPath(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1069 if ( file_exists($data_path."parsing_files/".$section_id.".txt") ) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1070 $contentString=file_get_contents($data_path."parsing_files/".$section_id.".txt"); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1071 $stringInput = $contentString; |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
1072 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
1073 // if the text is from file system |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1074 $stringInput = preg_replace("/ /u", "○", $stringInput); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1075 $stringInput = preg_replace("/\n/u", "<br>", $stringInput); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1076 $stringInput = preg_replace("/【(.*?)】/u", "【<a href=\"review_index_xml_images.php?books_id=".$bookId."&pages=\\1&entry=0\" target=\"_bookImg\">\\1</a>】", $stringInput); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1077 } else { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1078 $query = sprintf("SELECT `content`, `line`, `books_id` FROM `contents` WHERE `books_id`=\"%s\" AND `line`>=%d AND `line`<=%d", $bookId, $startPage, $endPage); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1079 $result = mysql_query($query); |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
1080 if (!$result) { |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
1081 return json_encode("Failed during selecting content table."); |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
1082 } |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1083 while ($row = mysql_fetch_assoc($result)) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1084 $contentString.="【".$row['line']."】".$row['content']."\n"; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1085 } |
12
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
1086 |
e82ca7375e93
Integration with LocalGazetteerService (LGService), getting text from LGService and saving text to LGService. Adjust the control flow (controller).
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
11
diff
changeset
|
1087 // the text is from database |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1088 $stringInput = $contentString; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1089 $stringInput = preg_replace("/<(.*?)>/u", "○", $stringInput); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1090 $stringInput = preg_replace("/ /u", "○", $stringInput); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1091 $stringInput = preg_replace("/\n/u", "<br>", $stringInput); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1092 $stringInput = preg_replace("/【(.*?)】/u", "【<a href=\"review_index_xml_images.php?books_id=".$bookId."&pages=\\1&entry=0\" target=\"_bookImg\">\\1</a>】", $stringInput); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1093 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1094 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1095 return $stringInput; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1096 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1097 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1098 private function GetDataPath() { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1099 return getcwd()."/data/"; // get the current file path, which is getcwd(), and concatenate with "/data/" |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1100 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1101 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1102 private function GetTaglistArray() { |
10
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
1103 $taglistArray = array(); |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1104 $result = $this->GetTaglist(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1105 while ($row = mysql_fetch_assoc($result)) { |
10
54a235d43694
add topic choosing in the TaggingText page
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
9
diff
changeset
|
1106 array_push($taglistArray, array( $row['id'], $row['name'], $row['tag'], $row['color'] )); |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1107 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1108 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1109 return $taglistArray; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1110 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1111 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1112 private function GetWordlistArray() { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1113 $wordlistArray=""; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1114 $result = $this->GetWordlist(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1115 while ($row = mysql_fetch_assoc($result)) { |
24
b55f5d3564c4
add some regular expressions and wordlist for topic ??
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
23
diff
changeset
|
1116 $listString = file_get_contents("data/wordlist/".$row['id'].".txt"); |
6
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1117 $listString = preg_replace("/<div>/u", "\n", $listString); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1118 $listString = preg_replace("/<\/div>/u", "", $listString); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1119 $listString = preg_replace("/<span(.*?)>/u", "", $listString); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1120 $listString = preg_replace("/<\/span>/u", "", $listString); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1121 //$listString = preg_replace("/\n/u", "|", $listString); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1122 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1123 $wordlistArray2 = explode( "\n", $listString ); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1124 usort($wordlistArray2,'sortFunction'); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1125 foreach ( $wordlistArray2 as $index=>$value ) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1126 $wordlistArray2[$index] = implode("○?", preg_split("/(?<!^)(?!$)/u", $value)); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1127 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1128 foreach ( $wordlistArray2 as $index=>$value ) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1129 if ($value=="") unset($wordlistArray2[$index]); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1130 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1131 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1132 $listString = implode("|", $wordlistArray2); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1133 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1134 if ( $listString[0]=="|" ) $listString = substr($listString, 1); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1135 $wordlistArray[] = array( $row['id'], $row['name'], $listString ); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1136 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1137 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1138 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1139 return $wordlistArray; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1140 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1141 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1142 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1143 protected function GetBooksInfo($bookId) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1144 $result = $this->GetSectionsByID($bookId); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1145 while ($row = mysql_fetch_assoc($result)) { |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1146 $bookName = $row['name']; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1147 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1148 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1149 $data = array(); |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1150 $data['bookName'] = $bookName; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1151 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1152 return $data; |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1153 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1154 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1155 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1156 } |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1157 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1158 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1159 |
63e08b98032f
rewrite extraction interface into PHP MVC architecture.
Zoe Hong <zhong@mpiwg-berlin.mpg.de>
parents:
diff
changeset
|
1160 ?> |