|
@@ 365-377 (lines=13) @@
|
| 362 |
|
* @param String $full_text |
| 363 |
|
* @param Integer $blog_id |
| 364 |
|
*/ |
| 365 |
|
public static function edit_post($post_id, $title, $full_text, $blog_id) |
| 366 |
|
{ |
| 367 |
|
$tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); |
| 368 |
|
$course_id = api_get_course_int_id(); |
| 369 |
|
|
| 370 |
|
// Create the post |
| 371 |
|
$sql = "UPDATE $tbl_blogs_posts SET |
| 372 |
|
title = '" . Database::escape_string($title)."', |
| 373 |
|
full_text = '" . Database::escape_string($full_text)."' |
| 374 |
|
WHERE c_id = $course_id AND post_id ='".(int)$post_id."' AND blog_id ='".(int)$blog_id."' |
| 375 |
|
LIMIT 1 "; |
| 376 |
|
Database::query($sql); |
| 377 |
|
} |
| 378 |
|
|
| 379 |
|
/** |
| 380 |
|
* Deletes an article and it's comments |
|
@@ 2011-2026 (lines=16) @@
|
| 2008 |
|
* @param Integer $blog_id |
| 2009 |
|
* @param Integer $user_id |
| 2010 |
|
*/ |
| 2011 |
|
public static function set_user_unsubscribed($blog_id, $user_id) |
| 2012 |
|
{ |
| 2013 |
|
// Init |
| 2014 |
|
$tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER); |
| 2015 |
|
$tbl_user_permissions = Database::get_course_table(TABLE_PERMISSION_USER); |
| 2016 |
|
|
| 2017 |
|
// Unsubscribe the user |
| 2018 |
|
$sql = "DELETE FROM $tbl_blogs_rel_user |
| 2019 |
|
WHERE blog_id = '".(int)$blog_id."' AND user_id = '".(int)$user_id."'"; |
| 2020 |
|
Database::query($sql); |
| 2021 |
|
|
| 2022 |
|
// Remove this user's permissions. |
| 2023 |
|
$sql = "DELETE FROM $tbl_user_permissions |
| 2024 |
|
WHERE user_id = '".(int)$user_id."'"; |
| 2025 |
|
Database::query($sql); |
| 2026 |
|
} |
| 2027 |
|
|
| 2028 |
|
/** |
| 2029 |
|
* Displays the form to register users in a blog (in a course) |