@@ 126-137 (lines=12) @@ | ||
123 | * |
|
124 | * @return void |
|
125 | */ |
|
126 | public function updateComment($id, $comment) |
|
127 | { |
|
128 | // Connect to db |
|
129 | $com = new Comments(); |
|
130 | $com->setDb($this->di->get("db")); |
|
131 | // Get comment |
|
132 | $com->find("id", $id); |
|
133 | // Update comment |
|
134 | $com->comment = $comment["comment"]; |
|
135 | // Save |
|
136 | $com->save(); |
|
137 | } |
|
138 | ||
139 | ||
140 | /** |
|
@@ 147-160 (lines=14) @@ | ||
144 | * |
|
145 | * @return void |
|
146 | */ |
|
147 | public function deleteComment($id) |
|
148 | { |
|
149 | // Set default timezone |
|
150 | date_default_timezone_set('Europe/Stockholm'); |
|
151 | // Connect to db |
|
152 | $com = new Comments(); |
|
153 | $com->setDb($this->di->get("db")); |
|
154 | // Get comment |
|
155 | $com->find("id", $id); |
|
156 | // Delete (Update) comment |
|
157 | $com->deleted = date("Y-m-d H:i:s"); |
|
158 | // Save |
|
159 | $com->save(); |
|
160 | } |
|
161 | } |
|
162 |
@@ 183-193 (lines=11) @@ | ||
180 | * |
|
181 | * @return object $user the deleted useer |
|
182 | */ |
|
183 | public function deleteUser($id) |
|
184 | { |
|
185 | // Get user from db |
|
186 | $user = new User(); |
|
187 | $user->setDb($this->di->get("db")); |
|
188 | $user->find("id", $id); |
|
189 | // Delete user (Set Deleted to timestamp) |
|
190 | $user->deleted = date("Y-m-d H:i:s"); |
|
191 | $user->save(); |
|
192 | return $user; |
|
193 | } |
|
194 | } |
|
195 |