|
@@ 418-430 (lines=13) @@
|
| 415 |
|
* @param string $full_text The full post text |
| 416 |
|
* @param int $blog_id The internal ID of the blog in which the post is located |
| 417 |
|
*/ |
| 418 |
|
public static function editPost($post_id, $title, $full_text, $blog_id) |
| 419 |
|
{ |
| 420 |
|
$tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); |
| 421 |
|
$course_id = api_get_course_int_id(); |
| 422 |
|
|
| 423 |
|
// Create the post |
| 424 |
|
$sql = "UPDATE $tbl_blogs_posts SET |
| 425 |
|
title = '".Database::escape_string($title)."', |
| 426 |
|
full_text = '".Database::escape_string($full_text)."' |
| 427 |
|
WHERE c_id = $course_id AND post_id ='".(int) $post_id."' AND blog_id ='".(int) $blog_id."' |
| 428 |
|
LIMIT 1 "; |
| 429 |
|
Database::query($sql); |
| 430 |
|
} |
| 431 |
|
|
| 432 |
|
/** |
| 433 |
|
* Deletes an article and its comments |
|
@@ 2244-2259 (lines=16) @@
|
| 2241 |
|
* @param Integer $blog_id |
| 2242 |
|
* @param Integer $user_id |
| 2243 |
|
*/ |
| 2244 |
|
public static function unsubscribeUser($blog_id, $user_id) |
| 2245 |
|
{ |
| 2246 |
|
// Init |
| 2247 |
|
$tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER); |
| 2248 |
|
$tbl_user_permissions = Database::get_course_table(TABLE_PERMISSION_USER); |
| 2249 |
|
|
| 2250 |
|
// Unsubscribe the user |
| 2251 |
|
$sql = "DELETE FROM $tbl_blogs_rel_user |
| 2252 |
|
WHERE blog_id = '".(int) $blog_id."' AND user_id = '".(int) $user_id."'"; |
| 2253 |
|
Database::query($sql); |
| 2254 |
|
|
| 2255 |
|
// Remove this user's permissions. |
| 2256 |
|
$sql = "DELETE FROM $tbl_user_permissions |
| 2257 |
|
WHERE user_id = '".(int) $user_id."'"; |
| 2258 |
|
Database::query($sql); |
| 2259 |
|
} |
| 2260 |
|
|
| 2261 |
|
/** |
| 2262 |
|
* Displays the form to register users in a blog (in a course) |