summaryrefslogtreecommitdiff
path: root/demos/blog/sitemap.txt
blob: 8326855bee47ff53e20e266f06abb7e1d806c23e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
Be careful about username case sensitivity!!

Home : list of blogs filtered by a category or time range, with paging

ViewBlog : read a single blog with all comments and a comment input form
NewBlog : create a new blog, with file attachment form and THtmlArea
EditBlog : edit an existing blog

LoginUser : login page
NewUser : create a new user
EditUser : edit the current user

Admin : whether allow multiple users, whether HTML is allowed (first user is always the admin)

URL design:

index.php?page=ListBlog&timespan=123,456&limit=123,456 : list of latest blogs, equivalent to:
index.php?page=NewBlog
index.php?page=EditBlog&id=123
index.php?page=ViewBlog&id=123
index.php?page=NewUser
index.php?page=EditUser
index.php?page=ViewUser
index.php?page=Admin


Use Case 1: Add a post
1. Authorization check
2. display UI for adding post
3. input validation
4. add post to DB
5. display UI for post list


DB Logic needed:

class Post extends DataObject
{
	public $xxx;
}

class Comment extends DataObject
{
}

class UserProfile extends DataObject
{

}

class DataObject extends TComponent
{
	protected static $mapping=array();

	public function __construct($db)
	{
	}

	protected static function generateModifier($filter,$orderBy,$limit)
	{
		$modifier='';
		if($filter!=='')
			$modifier=' WHERE '.$filter;
		if($orderBy!=='')
			$modifier.=' ORDER BY '.$orderBy;
		if($limit!=='')
			$modifier.=' LIMIT '.$limit;
		return $modifier;
	}

	public static function queryRow($filter='')
	{
		$modifier=self::generateModifier($filter,'','');
	}

	public static function query($filter='',$orderBy='',$limit='')
	{
		$modifier=self::generateModifier($filter,$orderBy,$limit);
	}

	public function save()
	{
	}

	public function delete()
	{
	}
}

public function queryUsers($filter='',$sortBy='',$limit='')
public function queryUser($id)
public function insertUser($user)
public function updateUser($user)
public function deleteUser($id)

public function queryPosts($filter='',$sortBy='',$limit='')
public function queryPost($id)
public function insertPost($post)
public function updatePost($post)
public function deletePost($id)

public function queryComments($filter='',$sortBy='',$limit='')
public function queryComment($id)
public function insertComment($comment)
public function updateComment($comment)
public function deleteComment($id)