comparison develop/classes/basemodel.php @ 10:54a235d43694

add topic choosing in the TaggingText page
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 10 Feb 2015 16:20:29 +0100
parents 63e08b98032f
children 3d6fba07bfbd
comparison
equal deleted inserted replaced
9:584b1623e9ef 10:54a235d43694
1 <?php 1 <?php
2 2
3 abstract class BaseModel { 3 abstract class BaseModel {
4 // protected $database; 4 // protected $database;
5 protected $systemNAME; 5 protected $systemNAME, $topic;
6 6
7 public function __construct() { 7 public function __construct() {
8 global $mysql_database, $mysql_server, $mysql_user, $mysql_password, $systemNAME; 8 global $mysql_database, $mysql_server, $mysql_user, $mysql_password, $systemNAME;
9 $this->systemNAME = $systemNAME; 9 $this->systemNAME = $systemNAME;
10 10
21 $db_selected = mysql_select_db($mysql_database, $link_mysql); 21 $db_selected = mysql_select_db($mysql_database, $link_mysql);
22 if (!$db_selected) { 22 if (!$db_selected) {
23 23
24 die ('Can\'t use foo : ' . mysql_error()); 24 die ('Can\'t use foo : ' . mysql_error());
25 } 25 }
26 $this->topic = 1; // set the default topic to person (人物)
26 } 27 }
27 28
28 protected function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { 29 protected function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") {
29 $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; 30 $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
30 31
86 return json_encode("Failed during selecting books table."); 87 return json_encode("Failed during selecting books table.");
87 } 88 }
88 return $result; 89 return $result;
89 } 90 }
90 91
92 protected function GetTopiclist() {
93 $query = sprintf("SELECT * FROM `topics`");
94 $result = mysql_query($query);
95 if (!$result) {
96 return json_encode("Failed during selecting topics table.");
97 }
98 return $result;
99 }
100
91 101
92 102
93 } 103 }
94 104
95 ?> 105 ?>