comparison models/extractapp.php @ 73:2daef8e36214 extractapp

minor modification
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Wed, 08 Apr 2015 16:17:50 +0200
parents 26d8c4c43d86
children 60b5a94163c3
comparison
equal deleted inserted replaced
72:6974309983d1 73:2daef8e36214
82 // get from URL with file_id 82 // get from URL with file_id
83 // $lg_text_url = $this->get_text_from_sectionId_url.$section_id; 83 // $lg_text_url = $this->get_text_from_sectionId_url.$section_id;
84 $lg_text_url = $this->get_text_from_sectionId_url.$this->section_id; 84 $lg_text_url = $this->get_text_from_sectionId_url.$this->section_id;
85 $lg_text = file_get_contents($lg_text_url); 85 $lg_text = file_get_contents($lg_text_url);
86 86
87
88 87
89 $stringInput = $lg_text; 88 $stringInput = $lg_text;
90 $stringInput = preg_replace("/<(.*?)>/u", "○", $stringInput); 89 $stringInput = preg_replace("/<(.*?)>/u", "○", $stringInput);
91 $stringInput = preg_replace("/ /u", "○", $stringInput); 90 $stringInput = preg_replace("/ /u", "○", $stringInput);
92 $stringInput = preg_replace("/\n/u", "<br>", $stringInput); 91 $stringInput = preg_replace("/\n/u", "<br>", $stringInput);
93 $stringInput = preg_replace("/【(.*?)】/u", "【<a href=\"review_index_xml_images.php?books_id=".$bookId."&pages=\\1&entry=0\" target=\"_bookImg\">\\1</a>】", $stringInput); 92 $stringInput = preg_replace("/【(.*?)】/u", "【<a href=\"review_index_xml_images.php?books_id=".$this->book_id."&pages=\\1&entry=0\" target=\"_bookImg\">\\1</a>】", $stringInput);
94 $lg_text = $stringInput; 93 $lg_text = $stringInput;
95 94
96 $this->lg_text = $lg_text; 95 $this->lg_text = $lg_text;
97 } 96 }
98 97
122 $this->user_id = $_postdata['userId']; 121 $this->user_id = $_postdata['userId'];
123 } 122 }
124 if (isset($_postdata['topic_id'])) { 123 if (isset($_postdata['topic_id'])) {
125 $this->topic = $_postdata['topic_id']; 124 $this->topic = $_postdata['topic_id'];
126 } 125 }
127
128 if (isset($_postdata['sectionName'])) { 126 if (isset($_postdata['sectionName'])) {
129 $this->section_name = $_postdata['sectionName']; 127 $this->section_name = $_postdata['sectionName'];
130 } 128 }
131 if (isset($_postdata['bookName'])) { 129 if (isset($_postdata['bookName'])) {
132 $this->book_name = $_postdata['bookName']; 130 $this->book_name = $_postdata['bookName'];
142 } 140 }
143 if (isset($_postdata['book_meta'])) { 141 if (isset($_postdata['book_meta'])) {
144 $this->book_meta = json_decode($_postdata['book_meta']); 142 $this->book_meta = json_decode($_postdata['book_meta']);
145 } 143 }
146 144
147 145 }
148 }
149
150 146
151 147
152 private function TaglistSubsetIn($list1, $list2) { // $l1 is a subset of $l2 or not 148 private function TaglistSubsetIn($list1, $list2) { // $l1 is a subset of $l2 or not
153 // l1 and l2: array( $row['id'], $row['name'], $row['tag'], $row['color'] ) 149 // l1 and l2: array( $row['id'], $row['name'], $row['tag'], $row['color'] )
154 $cnt_list1 = count($list1); 150 $cnt_list1 = count($list1);
272 268
273 } 269 }
274 270
275 public function UpdateInfoByResponseFromLGService($response) { 271 public function UpdateInfoByResponseFromLGService($response) {
276 272
277 $response_file = $response["file"]; 273 if (isset($response["file"])) {
278 $response_branch = $response["branch"]; 274 $response_file = $response["file"];
275 }
276 if (isset($response["branch"])) {
277 $response_branch = $response["branch"];
278 }
279 279
280 $status = (string)$response["status"]; 280 $status = (string)$response["status"];
281 if ($status == "ok") { 281 if ($status == "ok") {
282 $this->messages['info'] .= "[Info] Saving success. <br>"; 282 $this->messages['info'] .= "[Info] Saving success. <br>";
283 $this->file_id = (string)$response_file["id"]; 283 $this->file_id = (string)$response_file["id"];