-
Notifications
You must be signed in to change notification settings - Fork 0
/
datamodel.php
executable file
·101 lines (80 loc) · 1.96 KB
/
datamodel.php
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
<?php
class LoginService {
public static function login($userid, $pw) {
// TODO: implement
return false;
}
}
/*
** User
*/
class User {
var $userID; // nick and login
var $password;
var $email;
var $myEvents = array(); // events that this user has created
var $myQuestions = array(); // questions this user has asked
function __construct() {
}
public static function load($userID) {
// TODO: implement
//
$user = User::createExampleUser();
return $user;
}
public static function createExampleUser() {
$user = new User();
$user->userID = 'BruceWayne';
$user->email = 'foo.bar@gmail.com';
array_push($user->myEvents, Event::createExampleEvent($user) );
return $user;
}
}
/*
** Event that users can follow up
*/
class Event {
var $eventID; // uid to identify and share the event (needed fo the barcode)
var $owner; // owner of the event
var $title;
var $description;
var $questions = array(); // questions posted to this event
public function load($eventID) {
// TODO: implement
}
public function save() {
// TODO: implement
// return $uid;
}
public static function createExampleEvent($user) {
$retval = new Event();
$retval->title = 'Example Event';
$retval->description = 'Example description';
$retval->owner = $user;
}
}
/*
** Question posted to the event
*/
class Question {
var $questionID;
var $ownerUser; // user who posted the question
var $question; // question
var $answer; // answer posted by the creator of the event
var $parentEvent; // event that this question belongs to
public function load($questionID) {
// TODO: implement
}
public function save() {
// TODO: implement
// return $uid;
}
}
/*
class Example {
function hello() {
echo 'Hello world';
}
}
*/
?>