1 | <?php |
||
14 | class SWLEdit { |
||
15 | |||
16 | /** |
||
17 | * The ID of the page the edit was made to. |
||
18 | * |
||
19 | * @var integer |
||
20 | */ |
||
21 | private $pageId; |
||
22 | |||
23 | /** |
||
24 | * The name of the user that made the edit. |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | private $userName; |
||
29 | |||
30 | /** |
||
31 | * The user that made the changes. |
||
32 | * |
||
33 | * @var User or false |
||
34 | */ |
||
35 | private $user = false; |
||
36 | |||
37 | /** |
||
38 | * The time on which the edit was made. |
||
39 | * |
||
40 | * @var integer |
||
41 | */ |
||
42 | private $time; |
||
43 | |||
44 | /** |
||
45 | * DB ID of the edit (swl_edits.edit_id). |
||
46 | * |
||
47 | * @var integer |
||
48 | */ |
||
49 | private $id; |
||
50 | |||
51 | /** |
||
52 | * Creates and returns a new instance of SWLEdit by getting it's info from the database. |
||
53 | * |
||
54 | * @since 0.1 |
||
55 | * |
||
56 | * @param integer $id |
||
57 | * |
||
58 | * @return SWLEdit |
||
59 | */ |
||
60 | public static function newFromId( $id ) { |
||
74 | |||
75 | /** |
||
76 | * Creates and returns a new instance of SWLEdit from a database result. |
||
77 | * |
||
78 | * @since 0.1 |
||
79 | * |
||
80 | * @param ResultWrapper $edit |
||
81 | * |
||
82 | * @return SWLEdit |
||
83 | */ |
||
84 | public static function newFromDBResult( $edit ) { |
||
92 | |||
93 | /** |
||
94 | * Constructor. |
||
95 | * |
||
96 | * @since 0.1 |
||
97 | */ |
||
98 | public function __construct( $pageId, $userName, $time, $id = null ) { |
||
104 | |||
105 | /** |
||
106 | * Writes the edit to the database, either updating it |
||
107 | * when it already exists, or inserting it when it doesn't. |
||
108 | * |
||
109 | * @since 0.1 |
||
110 | * |
||
111 | * @return boolean Success indicator |
||
112 | */ |
||
113 | public function writeToDB() { |
||
121 | |||
122 | /** |
||
123 | * Updates the group in the database. |
||
124 | * |
||
125 | * @since 0.1 |
||
126 | * |
||
127 | * @return boolean Success indicator |
||
128 | */ |
||
129 | private function updateInDB() { |
||
142 | |||
143 | /** |
||
144 | * Inserts the group into the database. |
||
145 | * |
||
146 | * @since 0.1 |
||
147 | * |
||
148 | * @return boolean Success indicator |
||
149 | */ |
||
150 | private function insertIntoDB() { |
||
170 | |||
171 | /** |
||
172 | * Returns the edit database id (swl_edits.edit_id). |
||
173 | * |
||
174 | * @since 0.1 |
||
175 | * |
||
176 | * @return integer |
||
177 | */ |
||
178 | public function getId() { |
||
181 | |||
182 | /** |
||
183 | * Returns the ID of the page the edit was made to. |
||
184 | * |
||
185 | * @since 0.1 |
||
186 | * |
||
187 | * @return integer |
||
188 | */ |
||
189 | public function getPageId() { |
||
192 | |||
193 | /** |
||
194 | * Gets the title of the page these changes belong to. |
||
195 | * |
||
196 | * @since 0.1 |
||
197 | * |
||
198 | * @return Title |
||
199 | */ |
||
200 | public function getTitle() { |
||
203 | |||
204 | /** |
||
205 | * Gets the name of the user that made the changes. |
||
206 | * |
||
207 | * @since 0.1 |
||
208 | * |
||
209 | * @return string |
||
210 | */ |
||
211 | public function getUserName() { |
||
214 | |||
215 | /** |
||
216 | * Gets the user that made the changes. |
||
217 | * |
||
218 | * @since 0.1 |
||
219 | * |
||
220 | * @return User |
||
221 | */ |
||
222 | public function getUser() { |
||
229 | |||
230 | /** |
||
231 | * Gets the time on which the changes where made. |
||
232 | * |
||
233 | * @since 0.1 |
||
234 | * |
||
235 | * @return integer |
||
236 | */ |
||
237 | public function getTime() { |
||
240 | |||
241 | } |