comparison develop/models/extractapp.php @ 26:579f03f8bee5

merge table books_info into table books (execute Home/Test)
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 03 Mar 2015 10:33:42 +0100
parents 4b6d2d7e706e
children 4a29bccb6c59
comparison
equal deleted inserted replaced
25:4b6d2d7e706e 26:579f03f8bee5
190 $data['topiclistArray'] = $topiclistArray; 190 $data['topiclistArray'] = $topiclistArray;
191 $data['default_topic_id'] = $this->GetTopic(); 191 $data['default_topic_id'] = $this->GetTopic();
192 $data['topic_tag'] = $this->GetTopicTag($this->GetTopic()); 192 $data['topic_tag'] = $this->GetTopicTag($this->GetTopic());
193 $data['topic_name'] = $this->GetTopicName($this->GetTopic()); 193 $data['topic_name'] = $this->GetTopicName($this->GetTopic());
194 194
195 $data['info'] = array('file_id'=>$this->file_id, 'user_id'=>$this->user_id, 'branch_id'=>$this->branch_id, 'section_id'=>$this->section_id, 'book_id'=>$this->book_id, 'book_name'=>$this->book_name, 'section_name'=>$this->section_name); 195 $data['info'] = array('file_id'=>$this->file_id, 'user_id'=>$this->user_id,
196 'branch_id'=>$this->branch_id, 'section_id'=>$this->section_id, 'book_id'=>$this->book_id,
197 'book_name'=>$this->book_name, 'section_name'=>$this->section_name,
198 'current_fileId'=>$this->current_fileId);
199
196 $data['messages'] = $this->messages; 200 $data['messages'] = $this->messages;
197 201
198 return $data; 202 return $data;
199 203
200 } 204 }
238 $this->messages .= "saving success."; 242 $this->messages .= "saving success.";
239 243
240 } else if ($status == "error") { 244 } else if ($status == "error") {
241 // saving not success 245 // saving not success
242 $this->messages .= "saving does not success! ".(string)$response["message"]; 246 $this->messages .= "saving does not success! ".(string)$response["message"];
243 247 $this->current_fileId = (string)$response['currentFileId'];
248 // ask to "force save" or "reload"
244 249
245 } 250 }
246 251
247 252
248 } 253 }
277 282
278 283
279 if ($_postdata['branchId'] != 0) { 284 if ($_postdata['branchId'] != 0) {
280 // exiting branch case 285 // exiting branch case
281 $postfields = array( 286 $postfields = array(
282 //"text" => $_postdata['text'],
283 "text" => $require, 287 "text" => $require,
284 "branchId" => $_postdata['branchId'], 288 "branchId" => $_postdata['branchId'],
285 "userId" => $_postdata['userId'], 289 "userId" => $_postdata['userId'],
286 "userPreviousFileId" => $_postdata['fileId'], 290 "userPreviousFileId" => $_postdata['fileId'],
287 ); 291 );
294 $user_id = $_postdata['userId']; 298 $user_id = $_postdata['userId'];
295 } else { 299 } else {
296 $user_id = "12"; 300 $user_id = "12";
297 } 301 }
298 $postfields = array( 302 $postfields = array(
299 //"text" => $_postdata['text'],
300 "text" => $require, 303 "text" => $require,
301 "sectionId" => $_postdata['sectionId'], 304 "sectionId" => $_postdata['sectionId'],
302 //"userId" => $_postdata['userId'],
303 // TODO: change userId when we can query by sectionId from LGService using search
304 "userId" => $user_id, 305 "userId" => $user_id,
305 "label" => $_postdata['label'], 306 "label" => $_postdata['label'],
306 // TODO: ask user for lable
307 //"label" => "label for section ".$_postdata['sectionId'],
308 ); 307 );
309 $save_url = $this->save_new_to_LGService_url; 308 $save_url = $this->save_new_to_LGService_url;
310 } 309 }
311
312
313 310
314 311
315 // set up the curl resource 312 // set up the curl resource
316 $ch = curl_init(); 313 $ch = curl_init();
317 curl_setopt($ch, CURLOPT_URL, $save_url); 314 curl_setopt($ch, CURLOPT_URL, $save_url);