Rename blog methods to camelCase

pull/2487/head
Yannick Warnier 9 years ago
parent 5608fdd25c
commit 4aa97efd7e
  1. 100
      main/blog/blog.php
  2. 14
      main/blog/blog_admin.php
  3. 4
      main/inc/ajax/social.ajax.php
  4. 148
      main/inc/lib/blog.lib.php
  5. 2
      main/permissions/blog_permissions.inc.php
  6. 2
      main/permissions/user_permissions.inc.php

@ -41,7 +41,7 @@ $safe_task_name = isset($_POST['task_name']) ? Security::remove_XSS($_POST['task
$safe_task_description = isset($_POST['task_description']) ? Security::remove_XSS($_POST['task_description']) : null; $safe_task_description = isset($_POST['task_description']) ? Security::remove_XSS($_POST['task_description']) : null;
if (!empty($_POST['new_post_submit'])) { if (!empty($_POST['new_post_submit'])) {
Blog:: create_post( Blog::createPost(
$_POST['title'], $_POST['title'],
$_POST['full_text'], $_POST['full_text'],
$_POST['post_file_comment'], $_POST['post_file_comment'],
@ -52,7 +52,7 @@ if (!empty($_POST['new_post_submit'])) {
); );
} }
if (!empty($_POST['edit_post_submit'])) { if (!empty($_POST['edit_post_submit'])) {
Blog:: edit_post( Blog::editPost(
$_POST['post_id'], $_POST['post_id'],
$_POST['title'], $_POST['title'],
$_POST['full_text'], $_POST['full_text'],
@ -64,7 +64,7 @@ if (!empty($_POST['edit_post_submit'])) {
} }
if (!empty($_POST['new_task_submit'])) { if (!empty($_POST['new_task_submit'])) {
Blog:: create_task( Blog::addTask(
$blog_id, $blog_id,
$safe_task_name, $safe_task_name,
$safe_task_description, $safe_task_description,
@ -80,7 +80,7 @@ if (!empty($_POST['new_task_submit'])) {
} }
if (isset($_POST['edit_task_submit'])) { if (isset($_POST['edit_task_submit'])) {
Blog:: edit_task( Blog::editTask(
$_POST['blog_id'], $_POST['blog_id'],
$_POST['task_id'], $_POST['task_id'],
$safe_task_name, $safe_task_name,
@ -96,7 +96,7 @@ if (isset($_POST['edit_task_submit'])) {
} }
if (!empty($_POST['assign_task_submit'])) { if (!empty($_POST['assign_task_submit'])) {
Blog:: assign_task( Blog::assignTask(
$blog_id, $blog_id,
$_POST['task_user_id'], $_POST['task_user_id'],
$_POST['task_task_id'], $_POST['task_task_id'],
@ -108,7 +108,7 @@ if (!empty($_POST['assign_task_submit'])) {
} }
if (isset($_POST['assign_task_edit_submit'])) { if (isset($_POST['assign_task_edit_submit'])) {
Blog:: edit_assigned_task( Blog::updateAssignedTask(
$blog_id, $blog_id,
$_POST['task_user_id'], $_POST['task_user_id'],
$_POST['task_task_id'], $_POST['task_task_id'],
@ -124,38 +124,38 @@ if (isset($_POST['assign_task_edit_submit'])) {
if (!empty($_POST['register'])) { if (!empty($_POST['register'])) {
if (is_array($_POST['user'])) { if (is_array($_POST['user'])) {
foreach ($_POST['user'] as $index => $user_id) { foreach ($_POST['user'] as $index => $user_id) {
Blog:: set_user_subscribed((int) $_GET['blog_id'], $user_id); Blog::subscribeUser((int) $_GET['blog_id'], $user_id);
} }
} }
} }
if (!empty($_POST['unregister'])) { if (!empty($_POST['unregister'])) {
if (is_array($_POST['user'])) { if (is_array($_POST['user'])) {
foreach ($_POST['user'] as $index => $user_id) { foreach ($_POST['user'] as $index => $user_id) {
Blog:: set_user_unsubscribed((int) $_GET['blog_id'], $user_id); Blog::unsubscribeUser($_GET['blog_id'], $user_id);
} }
} }
} }
if (!empty($_GET['register'])) { if (!empty($_GET['register'])) {
Blog:: set_user_subscribed((int) $_GET['blog_id'], (int) $_GET['user_id']); Blog::subscribeUser((int) $_GET['blog_id'], (int) $_GET['user_id']);
Display::addFlash( Display::addFlash(
Display::return_message(get_lang('UserRegistered'), 'success') Display::return_message(get_lang('UserRegistered'), 'success')
); );
$flag = 1; $flag = 1;
} }
if (!empty($_GET['unregister'])) { if (!empty($_GET['unregister'])) {
Blog:: set_user_unsubscribed((int) $_GET['blog_id'], (int) $_GET['user_id']); Blog::unsubscribeUser($_GET['blog_id'], $_GET['user_id']);
} }
if (isset($_GET['action']) && $_GET['action'] == 'manage_tasks') { if (isset($_GET['action']) && $_GET['action'] == 'manage_tasks') {
if (isset($_GET['do']) && $_GET['do'] == 'delete') { if (isset($_GET['do']) && $_GET['do'] == 'delete') {
Blog:: delete_task($blog_id, (int) $_GET['task_id']); Blog::deleteTask($blog_id, (int) $_GET['task_id']);
Display::addFlash( Display::addFlash(
Display::return_message(get_lang('TaskDeleted'), 'success') Display::return_message(get_lang('TaskDeleted'), 'success')
); );
} }
if (isset($_GET['do']) && $_GET['do'] == 'delete_assignment') { if (isset($_GET['do']) && $_GET['do'] == 'delete_assignment') {
Blog:: delete_assigned_task($blog_id, intval($_GET['task_id']), intval($_GET['user_id'])); Blog::deleteAssignedTask($blog_id, intval($_GET['task_id']), intval($_GET['user_id']));
Display::addFlash( Display::addFlash(
Display::return_message(get_lang('TaskAssignmentDeleted'), 'success') Display::return_message(get_lang('TaskAssignmentDeleted'), 'success')
); );
@ -167,7 +167,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'view_post') {
if (isset($_GET['do']) && $_GET['do'] == 'delete_comment') { if (isset($_GET['do']) && $_GET['do'] == 'delete_comment') {
if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id)) { if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id)) {
Blog:: delete_comment($blog_id, (int) $_GET['post_id'], (int) $_GET['comment_id']); Blog::deleteComment($blog_id, (int) $_GET['post_id'], (int) $_GET['comment_id']);
Display::addFlash( Display::addFlash(
Display::return_message(get_lang('CommentDeleted'), 'success') Display::return_message(get_lang('CommentDeleted'), 'success')
); );
@ -180,7 +180,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'view_post') {
if (isset($_GET['do']) && $_GET['do'] == 'delete_article') { if (isset($_GET['do']) && $_GET['do'] == 'delete_article') {
if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id)) { if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id)) {
Blog:: delete_post($blog_id, (int) $_GET['article_id']); Blog::deletePost($blog_id, (int) $_GET['article_id']);
$action = ''; // Article is gone, go to blog home $action = ''; // Article is gone, go to blog home
Display::addFlash( Display::addFlash(
Display::return_message(get_lang('BlogDeleted'), 'success') Display::return_message(get_lang('BlogDeleted'), 'success')
@ -194,7 +194,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'view_post') {
if (isset($_GET['do']) && $_GET['do'] == 'rate') { if (isset($_GET['do']) && $_GET['do'] == 'rate') {
if (isset($_GET['type']) && $_GET['type'] == 'post') { if (isset($_GET['type']) && $_GET['type'] == 'post') {
if (api_is_allowed('BLOG_'.$blog_id, 'article_rate')) { if (api_is_allowed('BLOG_'.$blog_id, 'article_rate')) {
Blog:: add_rating('post', $blog_id, (int) $_GET['post_id'], (int) $_GET['rating']); Blog::addRating('post', $blog_id, (int) $_GET['post_id'], (int) $_GET['rating']);
Display::addFlash( Display::addFlash(
Display::return_message(get_lang('RatingAdded'), 'success') Display::return_message(get_lang('RatingAdded'), 'success')
); );
@ -202,7 +202,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'view_post') {
} }
if (isset($_GET['type']) && $_GET['type'] == 'comment') { if (isset($_GET['type']) && $_GET['type'] == 'comment') {
if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) { if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) {
Blog:: add_rating('comment', $blog_id, (int) $_GET['comment_id'], (int) $_GET['rating']); Blog::addRating('comment', $blog_id, (int) $_GET['comment_id'], (int) $_GET['rating']);
Display::addFlash( Display::addFlash(
Display::return_message(get_lang('RatingAdded'), 'success') Display::return_message(get_lang('RatingAdded'), 'success')
); );
@ -220,53 +220,53 @@ switch ($action) {
$nameTools = get_lang('NewPost'); $nameTools = get_lang('NewPost');
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(),
"name" => Blog:: get_blog_title($blog_id), "name" => Blog::getBlogTitle($blog_id),
); );
break; break;
case 'view_post' : case 'view_post' :
$nameTools = ''; $nameTools = '';
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(),
"name" => Blog:: get_blog_title($blog_id), "name" => Blog::getBlogTitle($blog_id),
); );
break; break;
case 'manage_tasks' : case 'manage_tasks' :
$nameTools = get_lang('TaskManager'); $nameTools = get_lang('TaskManager');
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(),
"name" => Blog:: get_blog_title($blog_id), "name" => Blog::getBlogTitle($blog_id),
); );
break; break;
case 'manage_members' : case 'manage_members' :
$nameTools = get_lang('MemberManager'); $nameTools = get_lang('MemberManager');
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(),
"name" => Blog:: get_blog_title($blog_id), "name" => Blog::getBlogTitle($blog_id),
); );
break; break;
case 'manage_rights' : case 'manage_rights' :
$nameTools = get_lang('RightsManager'); $nameTools = get_lang('RightsManager');
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(),
'name' => Blog:: get_blog_title($blog_id), 'name' => Blog::getBlogTitle($blog_id),
); );
break; break;
case 'view_search_result' : case 'view_search_result' :
$nameTools = get_lang('SearchResults'); $nameTools = get_lang('SearchResults');
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(),
'name' => Blog:: get_blog_title($blog_id), 'name' => Blog::getBlogTitle($blog_id),
); );
break; break;
case 'execute_task' : case 'execute_task' :
$nameTools = get_lang('ExecuteThisTask'); $nameTools = get_lang('ExecuteThisTask');
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(),
'name' => Blog:: get_blog_title($blog_id), 'name' => Blog::getBlogTitle($blog_id),
); );
break; break;
default : default :
$nameTools = Blog:: get_blog_title($blog_id); $nameTools = Blog::getBlogTitle($blog_id);
} }
$actionsLeft = []; $actionsLeft = [];
@ -293,21 +293,21 @@ if (api_is_allowed('BLOG_'.$blog_id, 'member_management')) {
); );
} }
$titleBlog = Blog::get_blog_title($blog_id); $titleBlog = Blog::getBlogTitle($blog_id);
$descriptionBlog = Blog::get_blog_subtitle($blog_id); $descriptionBlog = Blog::getBlogSubtitle($blog_id);
$idBlog = $blog_id; $idBlog = $blog_id;
$searchBlog = isset($_GET['q']) ? Security::remove_XSS($_GET['q']) : ''; $searchBlog = isset($_GET['q']) ? Security::remove_XSS($_GET['q']) : '';
//calendar blog //calendar blog
$month = isset($_GET['month']) ? (int) $_GET['month'] : (int) date('m'); $month = isset($_GET['month']) ? (int) $_GET['month'] : (int) date('m');
$year = isset($_GET['year']) ? (int) $_GET['year'] : date('Y'); $year = isset($_GET['year']) ? (int) $_GET['year'] : date('Y');
$calendarBlog = Blog::display_minimonthcalendar($month, $year, $blog_id); $calendarBlog = Blog::displayMiniMonthCalendar($month, $year, $blog_id);
//task blogs //task blogs
$taskBlog = Blog::get_personal_task_list(); $taskBlog = Blog::getPersonalTasksList();
if (isset($flag) && $flag == '1') { if (isset($flag) && $flag == '1') {
$action = "manage_tasks"; $action = "manage_tasks";
Blog::display_assign_task_form($blog_id); Blog::displayTaskAssignmentForm($blog_id);
} }
$user_task = false; $user_task = false;
@ -318,7 +318,7 @@ if (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) {
$task_id = (int) $_GET['task_id']; $task_id = (int) $_GET['task_id'];
} else { } else {
$task_id = 0; $task_id = 0;
$tbl_blogs_tasks_rel_user = Database:: get_course_table(TABLE_BLOGS_TASKS_REL_USER); $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER);
$sql = "SELECT COUNT(*) as number $sql = "SELECT COUNT(*) as number
FROM ".$tbl_blogs_tasks_rel_user." FROM ".$tbl_blogs_tasks_rel_user."
@ -357,12 +357,12 @@ switch ($action) {
if ($_POST) { if ($_POST) {
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete')); Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));
} }
$formAdd = Blog::display_form_new_post($blog_id); $formAdd = Blog::displayPostCreateForm($blog_id);
} else { } else {
if (isset($_GET['filter']) && !empty($_GET['filter'])) { if (isset($_GET['filter']) && !empty($_GET['filter'])) {
Blog::display_day_results($blog_id, Database::escape_string($_GET['filter'])); Blog::getDailyResults($blog_id, Database::escape_string($_GET['filter']));
} else { } else {
Blog::display_blog_posts($blog_id); Blog::getPosts($blog_id);
} }
} }
} else { } else {
@ -372,7 +372,7 @@ switch ($action) {
$blogLayout = $tpl->get_template('blog/layout.tpl'); $blogLayout = $tpl->get_template('blog/layout.tpl');
break; break;
case 'view_post' : case 'view_post' :
$postArticle = Blog::display_post($blog_id, intval($_GET['post_id'])); $postArticle = Blog::getSinglePost($blog_id, intval($_GET['post_id']));
$tpl->assign('post', $postArticle); $tpl->assign('post', $postArticle);
$blogLayout = $tpl->get_template('blog/post.tpl'); $blogLayout = $tpl->get_template('blog/post.tpl');
break; break;
@ -384,12 +384,12 @@ switch ($action) {
// 2. there is post data and the required field is empty // 2. there is post data and the required field is empty
if (!$_POST OR (!empty($_POST) AND empty($_POST['post_title']))) { if (!$_POST OR (!empty($_POST) AND empty($_POST['post_title']))) {
// if there is post data there is certainly an error in the form // if there is post data there is certainly an error in the form
$formEdit = Blog::display_form_edit_post($blog_id, intval($_GET['post_id'])); $formEdit = Blog::displayPostEditForm($blog_id, intval($_GET['post_id']));
$tpl->assign('content', $formEdit); $tpl->assign('content', $formEdit);
$blogLayout = $tpl->get_template('blog/layout.tpl'); $blogLayout = $tpl->get_template('blog/layout.tpl');
if ($_POST) { if ($_POST) {
$post = Blog::display_post($blog_id, intval($_GET['post_id'])); $post = Blog::getSinglePost($blog_id, intval($_GET['post_id']));
$tpl->assign('post', $post); $tpl->assign('post', $post);
$blogLayout = $tpl->get_template('blog/post.tpl'); $blogLayout = $tpl->get_template('blog/post.tpl');
} }
@ -402,8 +402,8 @@ switch ($action) {
case 'manage_members' : case 'manage_members' :
$manage = null; $manage = null;
if (api_is_allowed('BLOG_'.$blog_id, 'member_management')) { if (api_is_allowed('BLOG_'.$blog_id, 'member_management')) {
$manage .= Blog::display_form_user_subscribe($blog_id); $manage .= Blog::displayUserSubscriptionForm($blog_id);
$manage .= Blog::display_form_user_unsubscribe($blog_id); $manage .= Blog::displayUserUnsubscriptionForm($blog_id);
} else { } else {
api_not_allowed(); api_not_allowed();
} }
@ -411,7 +411,7 @@ switch ($action) {
$blogLayout = $tpl->get_template('blog/layout.tpl'); $blogLayout = $tpl->get_template('blog/layout.tpl');
break; break;
case 'manage_rights' : case 'manage_rights' :
$manage = Blog::display_form_user_rights($blog_id); $manage = Blog::displayUserRightsForm($blog_id);
$tpl->assign('content', $manage); $tpl->assign('content', $manage);
$blogLayout = $tpl->get_template('blog/layout.tpl'); $blogLayout = $tpl->get_template('blog/layout.tpl');
break; break;
@ -419,27 +419,27 @@ switch ($action) {
if (api_is_allowed('BLOG_'.$blog_id, 'task_management')) { if (api_is_allowed('BLOG_'.$blog_id, 'task_management')) {
$task = null; $task = null;
if (isset($_GET['do']) && $_GET['do'] == 'add') { if (isset($_GET['do']) && $_GET['do'] == 'add') {
$task .= Blog::display_new_task_form($blog_id); $task .= Blog::displayTaskCreateForm($blog_id);
} }
if (isset($_GET['do']) && $_GET['do'] == 'assign') { if (isset($_GET['do']) && $_GET['do'] == 'assign') {
$task .= Blog::display_assign_task_form($blog_id); $task .= Blog::displayTaskAssignmentForm($blog_id);
} }
if (isset($_GET['do']) && $_GET['do'] == 'edit') { if (isset($_GET['do']) && $_GET['do'] == 'edit') {
$task .= Blog::display_edit_task_form( $task .= Blog::displayTaskEditForm(
$blog_id, $blog_id,
intval($_GET['task_id']) intval($_GET['task_id'])
); );
} }
if (isset($_GET['do']) && $_GET['do'] == 'edit_assignment') { if (isset($_GET['do']) && $_GET['do'] == 'edit_assignment') {
$taks .= Blog:: display_edit_assigned_task_form( $taks .= Blog::displayAssignedTaskEditForm(
$blog_id, $blog_id,
intval($_GET['task_id']), intval($_GET['task_id']),
intval($_GET['user_id']) intval($_GET['user_id'])
); );
} }
$task .= Blog::display_task_list($blog_id); $task .= Blog::displayTasksList($blog_id);
$task .= Blog::display_assigned_task_list($blog_id); $task .= Blog::displayAssignedTasksList($blog_id);
$tpl->assign('content', $task); $tpl->assign('content', $task);
@ -451,11 +451,11 @@ switch ($action) {
break; break;
case 'execute_task' : case 'execute_task' :
if (isset ($_GET['post_id'])) { if (isset ($_GET['post_id'])) {
$post = Blog::display_post($blog_id, intval($_GET['post_id'])); $post = Blog::getSinglePost($blog_id, intval($_GET['post_id']));
$tpl->assign('post', $post); $tpl->assign('post', $post);
$blogLayout = $tpl->get_template('blog/post.tpl'); $blogLayout = $tpl->get_template('blog/post.tpl');
} else { } else {
$taskPost = Blog::display_select_task_post($blog_id, intval($_GET['task_id'])); $taskPost = Blog::displayPostSelectionForTask($blog_id, intval($_GET['task_id']));
$tpl->assign('content', $taskPost); $tpl->assign('content', $taskPost);
@ -463,7 +463,7 @@ switch ($action) {
} }
break; break;
case 'view_search_result' : case 'view_search_result' :
$listArticles = Blog:: display_search_results($blog_id, Database::escape_string($_GET['q'])); $listArticles = Blog::getSearchResults($blog_id, Database::escape_string($_GET['q']));
$titleSearch = get_lang('SearchResults'); $titleSearch = get_lang('SearchResults');
$tpl->assign('search', $titleSearch); $tpl->assign('search', $titleSearch);
$tpl->assign('articles', $listArticles); $tpl->assign('articles', $listArticles);
@ -472,14 +472,14 @@ switch ($action) {
case '': case '':
default: default:
if (isset ($_GET['filter']) && !empty ($_GET['filter'])) { if (isset ($_GET['filter']) && !empty ($_GET['filter'])) {
$listArticles = Blog::display_day_results($blog_id, Database::escape_string($_GET['filter'])); $listArticles = Blog::getDailyResults($blog_id, Database::escape_string($_GET['filter']));
$dateSearch = api_format_date($_GET['filter'], DATE_FORMAT_LONG); $dateSearch = api_format_date($_GET['filter'], DATE_FORMAT_LONG);
$titleSearch = get_lang('PostsOf').' '.$dateSearch; $titleSearch = get_lang('PostsOf').' '.$dateSearch;
$tpl->assign('search', $titleSearch); $tpl->assign('search', $titleSearch);
$tpl->assign('articles', $listArticles); $tpl->assign('articles', $listArticles);
$blogLayout = $tpl->get_template('blog/blog.tpl'); $blogLayout = $tpl->get_template('blog/blog.tpl');
} else { } else {
$listArticles = Blog::display_blog_posts($blog_id); $listArticles = Blog::getPosts($blog_id);
$tpl->assign('articles', $listArticles); $tpl->assign('articles', $listArticles);
$blogLayout = $tpl->get_template('blog/blog.tpl'); $blogLayout = $tpl->get_template('blog/blog.tpl');
} }

@ -51,22 +51,22 @@ if (api_is_allowed_to_edit()) {
if (!empty($_POST['new_blog_submit']) && !empty($_POST['blog_name'])) { if (!empty($_POST['new_blog_submit']) && !empty($_POST['blog_name'])) {
if (isset($_POST['blog_name'])) { if (isset($_POST['blog_name'])) {
Blog::create_blog($_POST['blog_name'], $_POST['blog_subtitle']); Blog::addBlog($_POST['blog_name'], $_POST['blog_subtitle']);
Display::display_confirmation_message(get_lang('BlogStored')); Display::display_confirmation_message(get_lang('BlogStored'));
} }
} }
if (!empty($_POST['edit_blog_submit']) && !empty($_POST['blog_name'])) { if (!empty($_POST['edit_blog_submit']) && !empty($_POST['blog_name'])) {
if (strlen(trim($_POST['blog_name']))>0) { if (strlen(trim($_POST['blog_name']))>0) {
Blog::edit_blog($_POST['blog_id'], $_POST['blog_name'], $_POST['blog_subtitle']); Blog::editBlog($_POST['blog_id'], $_POST['blog_name'], $_POST['blog_subtitle']);
Display::display_confirmation_message(get_lang('BlogEdited')); Display::display_confirmation_message(get_lang('BlogEdited'));
} }
} }
if (isset($_GET['action']) && $_GET['action'] == 'visibility') { if (isset($_GET['action']) && $_GET['action'] == 'visibility') {
Blog::change_blog_visibility(intval($_GET['blog_id'])); Blog::changeBlogVisibility(intval($_GET['blog_id']));
Display::display_confirmation_message(get_lang('VisibilityChanged')); Display::display_confirmation_message(get_lang('VisibilityChanged'));
} }
if (isset($_GET['action']) && $_GET['action'] == 'delete') { if (isset($_GET['action']) && $_GET['action'] == 'delete') {
Blog::delete_blog(intval($_GET['blog_id'])); Blog::deleteBlog(intval($_GET['blog_id']));
Display::display_confirmation_message(get_lang('BlogDeleted')); Display::display_confirmation_message(get_lang('BlogDeleted'));
} }
@ -75,7 +75,7 @@ if (api_is_allowed_to_edit()) {
// 1. no post data // 1. no post data
// 2. there is post data and one of the required form elements is empty // 2. there is post data and one of the required form elements is empty
if (!$_POST || (!empty($_POST) && (empty($_POST['new_blog_submit']) || empty($_POST['blog_name'])))) { if (!$_POST || (!empty($_POST) && (empty($_POST['new_blog_submit']) || empty($_POST['blog_name'])))) {
Blog::display_new_blog_form(); Blog::displayBlogCreateForm();
} }
} }
@ -88,10 +88,10 @@ if (api_is_allowed_to_edit()) {
if ($_POST) { if ($_POST) {
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete')); Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));
} }
Blog::display_edit_blog_form(intval($_GET['blog_id'])); Blog::displayBlogEditForm(intval($_GET['blog_id']));
} }
} }
Blog::display_blog_list(); Blog::displayBlogsList();
} else { } else {
api_not_allowed(true); api_not_allowed(true);
} }

@ -154,7 +154,7 @@ switch ($action) {
} }
//------Blog posts //------Blog posts
$result = Blog::get_blog_post_from_user($course_id, $user_id, $course_code ); $result = Blog::getBlogPostFromUser($course_id, $user_id, $course_code );
if (!empty($result)) { if (!empty($result)) {
api_display_tool_title(api_xml_http_response_encode(get_lang('Blog'))); api_display_tool_title(api_xml_http_response_encode(get_lang('Blog')));
@ -166,7 +166,7 @@ switch ($action) {
} }
//------Blog comments //------Blog comments
$result = Blog::get_blog_comment_from_user($course_id, $user_id, $course_code); $result = Blog::getBlogCommentsFromUser($course_id, $user_id, $course_code);
if (!empty($result)) { if (!empty($result)) {
echo '<div style="background:#FAF9F6; padding-left:10px;">'; echo '<div style="background:#FAF9F6; padding-left:10px;">';
api_display_tool_title(api_xml_http_response_encode(get_lang('BlogComments'))); api_display_tool_title(api_xml_http_response_encode(get_lang('BlogComments')));

@ -21,7 +21,7 @@ class Blog
* @param int $blog_id The internal ID of the blog * @param int $blog_id The internal ID of the blog
* @return string Blog Title * @return string Blog Title
*/ */
public static function get_blog_title($blog_id) public static function getBlogTitle($blog_id)
{ {
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -45,7 +45,7 @@ class Blog
* @param int $blog_id The internal ID of the blog * @param int $blog_id The internal ID of the blog
* @return string Blog description * @return string Blog description
*/ */
public static function get_blog_subtitle($blog_id) public static function getBlogSubtitle($blog_id)
{ {
$tbl_blogs = Database::get_course_table(TABLE_BLOGS); $tbl_blogs = Database::get_course_table(TABLE_BLOGS);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -63,7 +63,7 @@ class Blog
* @param int $blog_id The ID of the blog * @param int $blog_id The ID of the blog
* @return array Returns an array with [userid]=>[username] * @return array Returns an array with [userid]=>[username]
*/ */
public static function get_blog_users($blog_id) public static function getBlogUsers($blog_id)
{ {
// Database table definitions // Database table definitions
$tbl_users = Database::get_main_table(TABLE_MAIN_USER); $tbl_users = Database::get_main_table(TABLE_MAIN_USER);
@ -98,7 +98,7 @@ class Blog
* @param string $subtitle The description (or subtitle) of the new blog * @param string $subtitle The description (or subtitle) of the new blog
* @return void * @return void
*/ */
public static function create_blog($title, $subtitle) public static function addBlog($title, $subtitle)
{ {
$_user = api_get_user_info(); $_user = api_get_user_info();
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -175,7 +175,7 @@ class Blog
} }
// Subscribe the teacher to this blog // Subscribe the teacher to this blog
Blog::set_user_subscribed($this_blog_id, $_user['user_id']); Blog::subscribeUser($this_blog_id, $_user['user_id']);
} }
} }
@ -186,7 +186,7 @@ class Blog
* @param int $user_id The internal user ID (of the user to be subscribed) * @param int $user_id The internal user ID (of the user to be subscribed)
* @return void * @return void
*/ */
public static function set_user_subscribed($blog_id, $user_id) public static function subscribeUser($blog_id, $user_id)
{ {
// Init // Init
$tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER); $tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER);
@ -232,7 +232,7 @@ class Blog
* @param string $subtitle The subtitle (or description) to be set * @param string $subtitle The subtitle (or description) to be set
* @return void * @return void
*/ */
public static function edit_blog($blog_id, $title, $subtitle = '') public static function editBlog($blog_id, $title, $subtitle = '')
{ {
// Table definitions // Table definitions
$tbl_blogs = Database::get_course_table(TABLE_BLOGS); $tbl_blogs = Database::get_course_table(TABLE_BLOGS);
@ -276,7 +276,7 @@ class Blog
* @param Integer $blog_id The internal blog ID * @param Integer $blog_id The internal blog ID
* @return void * @return void
*/ */
public static function delete_blog($blog_id) public static function deleteBlog($blog_id)
{ {
// Init // Init
$tbl_blogs = Database::get_course_table(TABLE_BLOGS); $tbl_blogs = Database::get_course_table(TABLE_BLOGS);
@ -290,7 +290,7 @@ class Blog
$blog_id = intval($blog_id); $blog_id = intval($blog_id);
// Delete posts from DB and the attachments // Delete posts from DB and the attachments
self::delete_all_blog_attachment($blog_id); self::deleteAllBlogAttachments($blog_id);
//Delete comments //Delete comments
$sql = "DELETE FROM $tbl_blogs_comment WHERE c_id = $course_id AND blog_id = $blog_id"; $sql = "DELETE FROM $tbl_blogs_comment WHERE c_id = $course_id AND blog_id = $blog_id";
@ -335,7 +335,7 @@ class Blog
* @param int $blog_id The internal blog ID * @param int $blog_id The internal blog ID
* @return void * @return void
*/ */
public static function create_post($title, $full_text, $file_comment, $blog_id) public static function createPost($title, $full_text, $file_comment, $blog_id)
{ {
$_user = api_get_user_info(); $_user = api_get_user_info();
$_course = api_get_course_info(); $_course = api_get_course_info();
@ -420,7 +420,7 @@ class Blog
* @param string $full_text The full post text * @param string $full_text The full post text
* @param int $blog_id The internal ID of the blog in which the post is located * @param int $blog_id The internal ID of the blog in which the post is located
*/ */
public static function edit_post($post_id, $title, $full_text, $blog_id) public static function editPost($post_id, $title, $full_text, $blog_id)
{ {
$tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -444,7 +444,7 @@ class Blog
* @param int $blog_id The internal blog ID * @param int $blog_id The internal blog ID
* @param int $post_id The internal post ID * @param int $post_id The internal post ID
*/ */
public static function delete_post($blog_id, $post_id) public static function deletePost($blog_id, $post_id)
{ {
$tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS);
$tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS); $tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS);
@ -470,7 +470,7 @@ class Blog
Database::query($sql); Database::query($sql);
// Delete posts and attachments // Delete posts and attachments
self::delete_all_blog_attachment($blog_id, $post_id); self::deleteAllBlogAttachments($blog_id, $post_id);
} }
/** /**
@ -484,7 +484,7 @@ class Blog
* @param int $parent_id The internal parent post ID * @param int $parent_id The internal parent post ID
* @param int $task_id The internal task ID (if any) * @param int $task_id The internal task ID (if any)
*/ */
public static function create_comment( public static function createComment(
$title, $title,
$full_text, $full_text,
$file_comment, $file_comment,
@ -578,7 +578,7 @@ class Blog
* @param int $post_id The internal post ID * @param int $post_id The internal post ID
* @param int $comment_id The internal comment ID * @param int $comment_id The internal comment ID
*/ */
public static function delete_comment($blog_id, $post_id, $comment_id) public static function deleteComment($blog_id, $post_id, $comment_id)
{ {
$tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS); $tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS);
$tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING); $tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING);
@ -587,7 +587,7 @@ class Blog
$comment_id = intval($comment_id); $comment_id = intval($comment_id);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
self::delete_all_blog_attachment($blog_id, $post_id, $comment_id); self::deleteAllBlogAttachments($blog_id, $post_id, $comment_id);
// Delete ratings on this comment // Delete ratings on this comment
$sql = "DELETE FROM $tbl_blogs_rating $sql = "DELETE FROM $tbl_blogs_rating
@ -605,7 +605,7 @@ class Blog
// Delete them recursively // Delete them recursively
while ($comment = Database::fetch_array($result)) { while ($comment = Database::fetch_array($result)) {
Blog::delete_comment($blog_id, $post_id, $comment['comment_id']); Blog::deleteComment($blog_id, $post_id, $comment['comment_id']);
} }
// Finally, delete the selected comment to // Finally, delete the selected comment to
@ -625,7 +625,7 @@ class Blog
* @param string $commentsDelete Set to 'on' to register as 'article_comments_delete' in tasks permissions * @param string $commentsDelete Set to 'on' to register as 'article_comments_delete' in tasks permissions
* @param string $color * @param string $color
*/ */
public static function create_task( public static function addTask(
$blog_id, $blog_id,
$title, $title,
$description, $description,
@ -709,7 +709,7 @@ class Blog
* @param string $commentsDelete Set to 'on' to register as 'article_comments_delete' in tasks permissions * @param string $commentsDelete Set to 'on' to register as 'article_comments_delete' in tasks permissions
* @param string $color The color code * @param string $color The color code
*/ */
public static function edit_task( public static function editTask(
$blog_id, $blog_id,
$task_id, $task_id,
$title, $title,
@ -786,7 +786,7 @@ class Blog
* @param int $task_id * @param int $task_id
* @return void * @return void
*/ */
public static function delete_task($blog_id, $task_id) public static function deleteTask($blog_id, $task_id)
{ {
$tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -806,7 +806,7 @@ class Blog
* @param int $user_id * @param int $user_id
* @return void * @return void
*/ */
public static function delete_assigned_task($blog_id, $task_id, $user_id) public static function deleteAssignedTask($blog_id, $task_id, $user_id)
{ {
$tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -829,7 +829,7 @@ class Blog
* @author Toon Keppens * @author Toon Keppens
* @return string Returns an unsorted list (<ul></ul>) with the users' tasks * @return string Returns an unsorted list (<ul></ul>) with the users' tasks
*/ */
public static function get_personal_task_list() public static function getPersonalTasksList()
{ {
$_user = api_get_user_info(); $_user = api_get_user_info();
$html = null; $html = null;
@ -883,7 +883,7 @@ class Blog
* @param Integer $blog_id * @param Integer $blog_id
* @return void * @return void
*/ */
public static function change_blog_visibility($blog_id) public static function changeBlogVisibility($blog_id)
{ {
$tbl_blogs = Database::get_course_table(TABLE_BLOGS); $tbl_blogs = Database::get_course_table(TABLE_BLOGS);
$tbl_tool = Database::get_course_table(TABLE_TOOL_LIST); $tbl_tool = Database::get_course_table(TABLE_TOOL_LIST);
@ -932,7 +932,7 @@ class Blog
* @param string $query_string * @param string $query_string
* @return string|array * @return string|array
*/ */
public static function display_search_results($blog_id, $query_string) public static function getSearchResults($blog_id, $query_string)
{ {
// Init // Init
$query_string = Database::escape_string($query_string); $query_string = Database::escape_string($query_string);
@ -945,7 +945,7 @@ class Blog
// Display the posts // Display the posts
//echo '<span class="blogpost_title">' . get_lang('SearchResults') . '</span>'; //echo '<span class="blogpost_title">' . get_lang('SearchResults') . '</span>';
return Blog::display_blog_posts($blog_id, $query_string); return Blog::getPosts($blog_id, $query_string);
} }
/** /**
@ -956,7 +956,7 @@ class Blog
* @param int $max_number_of_posts * @param int $max_number_of_posts
* @return string|array * @return string|array
*/ */
public static function display_blog_posts($blog_id, $filter = '1=1', $max_number_of_posts = 20) public static function getPosts($blog_id, $filter = '1=1', $max_number_of_posts = 20)
{ {
// Init // Init
$tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS);
@ -994,8 +994,8 @@ class Blog
$tmp = Database::query($sql); $tmp = Database::query($sql);
$blog_post_comments = Database::fetch_array($tmp); $blog_post_comments = Database::fetch_array($tmp);
$fileArray = self::get_blog_attachment($blog_id, $blog_post['post_id'], 0); $fileArray = self::getBlogAttachments($blog_id, $blog_post['post_id'], 0);
$scoreRanking = Blog::display_rating('post',$blog_id,$blog_post['post_id']); $scoreRanking = Blog::displayRating('post',$blog_id,$blog_post['post_id']);
// Prepare data // Prepare data
$article = [ $article = [
'id_blog' => $blog_post['blog_id'], 'id_blog' => $blog_post['blog_id'],
@ -1039,7 +1039,7 @@ class Blog
* @param String $query_string * @param String $query_string
* @return string|array * @return string|array
*/ */
public static function display_day_results($blog_id, $query_string) public static function getDailyResults($blog_id, $query_string)
{ {
//$date_output = $query_string; //$date_output = $query_string;
$date = explode('-', $query_string); $date = explode('-', $query_string);
@ -1050,7 +1050,7 @@ class Blog
//$date_output = api_format_date($date_output, DATE_FORMAT_LONG); //$date_output = api_format_date($date_output, DATE_FORMAT_LONG);
// Display the posts // Display the posts
//echo '<span class="blogpost_title">' . get_lang('PostsOf') . ': ' . $date_output . '</span>'; //echo '<span class="blogpost_title">' . get_lang('PostsOf') . ': ' . $date_output . '</span>';
$list = Blog::display_blog_posts($blog_id, $query_string); $list = Blog::getPosts($blog_id, $query_string);
return $list; return $list;
} }
@ -1061,7 +1061,7 @@ class Blog
* @param int $post_id * @param int $post_id
* @return array * @return array
*/ */
public static function display_post($blog_id, $post_id) public static function getSinglePost($blog_id, $post_id)
{ {
$tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS);
$tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS); $tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS);
@ -1099,20 +1099,20 @@ class Blog
// Display comments if there are any // Display comments if there are any
if ($blog_post_comments['number_of_comments'] > 0) { if ($blog_post_comments['number_of_comments'] > 0) {
$listComments = Blog::get_threaded_comments(0, 0, $blog_id, $post_id, $task_id); $listComments = Blog::getThreadedComments(0, 0, $blog_id, $post_id, $task_id);
} }
// Display comment form // Display comment form
if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) { if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) {
$formComments = Blog::display_new_comment_form($blog_id, $post_id, $blog_post['title'], false); $formComments = Blog::displayCommentCreateForm($blog_id, $post_id, $blog_post['title'], false);
} }
// Prepare data // Prepare data
$fileArray = self::get_blog_attachment($blog_id, $post_id); $fileArray = self::getBlogAttachments($blog_id, $post_id);
$post_text = make_clickable(stripslashes($blog_post['full_text'])); $post_text = make_clickable(stripslashes($blog_post['full_text']));
$post_text = stripslashes($post_text); $post_text = stripslashes($post_text);
if (api_is_allowed('BLOG_'.$blog_id, 'article_edit', $task_id)) { if (api_is_allowed('BLOG_'.$blog_id, 'article_edit', $task_id)) {
$blogActions .= '<a class="btn btn-default" href="blog.php?action=edit_post&blog_id='.$blog_id.'&post_id='.$post_id.'&article_id='.$blog_post['post_id'].'&task_id='.$task_id.'" title="'.get_lang( $blogActions .= '<a class="btn btn-default" href="blog.php?action=editPost&blog_id='.$blog_id.'&post_id='.$post_id.'&article_id='.$blog_post['post_id'].'&task_id='.$task_id.'" title="'.get_lang(
'EditThisPost' 'EditThisPost'
).'">'; ).'">';
$blogActions .= Display::return_icon('edit.png', get_lang('Edit'), null, ICON_SIZE_TINY); $blogActions .= Display::return_icon('edit.png', get_lang('Edit'), null, ICON_SIZE_TINY);
@ -1128,7 +1128,7 @@ class Blog
$blogActions .= Display::return_icon('delete.png', get_lang('Delete'), null, ICON_SIZE_TINY); $blogActions .= Display::return_icon('delete.png', get_lang('Delete'), null, ICON_SIZE_TINY);
$blogActions .= '</a>'; $blogActions .= '</a>';
} }
$scoreRanking = Blog::display_rating('post',$blog_id,$post_id); $scoreRanking = Blog::displayRating('post',$blog_id,$post_id);
$article = [ $article = [
'id_blog' => $blog_post['blog_id'], 'id_blog' => $blog_post['blog_id'],
'c_id' => $blog_post['c_id'], 'c_id' => $blog_post['c_id'],
@ -1148,7 +1148,7 @@ class Blog
'actions' => $blogActions, 'actions' => $blogActions,
'score_ranking' => (int)$scoreRanking, 'score_ranking' => (int)$scoreRanking,
'frm_rating' => api_is_allowed('BLOG_'.$blog_id, 'article_rate') 'frm_rating' => api_is_allowed('BLOG_'.$blog_id, 'article_rate')
? Blog::display_rating_form('post', $blog_id, $post_id) ? Blog::displayRatingCreateForm('post', $blog_id, $post_id)
: null : null
]; ];
@ -1166,7 +1166,7 @@ class Blog
* @param int $task_id * @param int $task_id
* @return array * @return array
*/ */
public static function get_threaded_comments($current = 0, $current_level = 0, $blog_id, $post_id, $task_id = 0) public static function getThreadedComments($current = 0, $current_level = 0, $blog_id, $post_id, $task_id = 0)
{ {
$tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS); $tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS);
$tbl_users = Database::get_main_table(TABLE_MAIN_USER); $tbl_users = Database::get_main_table(TABLE_MAIN_USER);
@ -1226,7 +1226,7 @@ class Blog
); );
if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id)) { if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id)) {
$commentActions .= ' <a class="btn btn-default" href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$post_id.'&do=delete_comment&comment_id='.$comment['comment_id'].'&task_id='.$task_id.'" title="'.get_lang( $commentActions .= ' <a class="btn btn-default" href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$post_id.'&do=deleteComment&comment_id='.$comment['comment_id'].'&task_id='.$task_id.'" title="'.get_lang(
'DeleteThisComment' 'DeleteThisComment'
).'" onclick="javascript:if(!confirm(\''.addslashes( ).'" onclick="javascript:if(!confirm(\''.addslashes(
api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset) api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)
@ -1235,13 +1235,13 @@ class Blog
$commentActions .= '</a>'; $commentActions .= '</a>';
} }
if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_rate')) { if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_rate')) {
$ratingSelect = Blog::display_rating_form('comment', $blog_id, $post_id, $comment['comment_id']); $ratingSelect = Blog::displayRatingCreateForm('comment', $blog_id, $post_id, $comment['comment_id']);
} }
$scoreRanking = self::display_rating('comment', $blog_id, $comment['comment_id']); $scoreRanking = self::displayRating('comment', $blog_id, $comment['comment_id']);
//Files //Files
$fileArray = self::get_blog_attachment($blog_id, $post_id, $comment['comment_id']); $fileArray = self::getBlogAttachments($blog_id, $post_id, $comment['comment_id']);
$comments = [ $comments = [
'iid' => $comment['iid'], 'iid' => $comment['iid'],
@ -1267,7 +1267,7 @@ class Blog
'actions' => $commentActions, 'actions' => $commentActions,
'form_ranking' => $ratingSelect, 'form_ranking' => $ratingSelect,
'score_ranking' => $scoreRanking, 'score_ranking' => $scoreRanking,
'comments' => self::get_threaded_comments($comment['iid'], $next_level, $blog_id, $post_id) 'comments' => self::getThreadedComments($comment['iid'], $next_level, $blog_id, $post_id)
]; ];
$listComments[] = $comments; $listComments[] = $comments;
@ -1285,7 +1285,7 @@ class Blog
* @param int $comment_id * @param int $comment_id
* @return void * @return void
*/ */
public static function display_rating_form($type, $blog_id, $post_id, $comment_id = null) public static function displayRatingCreateForm($type, $blog_id, $post_id, $comment_id = null)
{ {
$_user = api_get_user_info(); $_user = api_get_user_info();
$tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING); $tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING);
@ -1354,7 +1354,7 @@ class Blog
* @param integer $item_id * @param integer $item_id
* @return array * @return array
*/ */
public static function display_rating($type, $blog_id, $item_id) public static function displayRating($type, $blog_id, $item_id)
{ {
$tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING); $tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -1383,7 +1383,7 @@ class Blog
* @param int $post_id * @param int $post_id
* @return string HTML form * @return string HTML form
*/ */
public static function display_new_comment_form($blog_id, $post_id) public static function displayCommentCreateForm($blog_id, $post_id)
{ {
$taskId = !empty($_GET['task_id']) ? intval($_GET['task_id']) : 0; $taskId = !empty($_GET['task_id']) ? intval($_GET['task_id']) : 0;
$blog_id = intval($blog_id); $blog_id = intval($blog_id);
@ -1423,7 +1423,7 @@ class Blog
if ($form->validate()) { if ($form->validate()) {
$values = $form->exportValues(); $values = $form->exportValues();
Blog::create_comment( Blog::createComment(
$values['title'], $values['title'],
$values['comment'], $values['comment'],
$values['post_file_comment'], $values['post_file_comment'],
@ -1467,7 +1467,7 @@ class Blog
* *
* @return Boolean success * @return Boolean success
*/ */
public static function add_rating($type, $blog_id, $item_id, $rating) public static function addRating($type, $blog_id, $item_id, $rating)
{ {
$_user = api_get_user_info(); $_user = api_get_user_info();
@ -1514,7 +1514,7 @@ class Blog
* @param Integer $blog_id * @param Integer $blog_id
* @return string * @return string
*/ */
public static function display_form_new_post($blog_id) public static function displayPostCreateForm($blog_id)
{ {
$blog_id = intval($blog_id); $blog_id = intval($blog_id);
if (api_is_allowed('BLOG_'.$blog_id, 'article_add')) { if (api_is_allowed('BLOG_'.$blog_id, 'article_add')) {
@ -1554,7 +1554,7 @@ class Blog
* @param int $post_id * @param int $post_id
* @return string * @return string
*/ */
public static function display_form_edit_post($blog_id, $post_id) public static function displayPostEditForm($blog_id, $post_id)
{ {
$tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS);
$tbl_users = Database::get_main_table(TABLE_MAIN_USER); $tbl_users = Database::get_main_table(TABLE_MAIN_USER);
@ -1612,7 +1612,7 @@ class Blog
* @param int $blog_id * @param int $blog_id
* @return string * @return string
*/ */
public static function display_task_list($blog_id) public static function displayTasksList($blog_id)
{ {
global $charset; global $charset;
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -1704,7 +1704,7 @@ class Blog
* @param int $blog_id * @param int $blog_id
* @return string * @return string
*/ */
public static function display_assigned_task_list($blog_id) public static function displayAssignedTasksList($blog_id)
{ {
// Init // Init
$tbl_users = Database::get_main_table(TABLE_MAIN_USER); $tbl_users = Database::get_main_table(TABLE_MAIN_USER);
@ -1785,7 +1785,7 @@ class Blog
* @param int $blog_id * @param int $blog_id
* @return string HTML form * @return string HTML form
*/ */
public static function display_new_task_form($blog_id) public static function displayTaskCreateForm($blog_id)
{ {
$blog_id = intval($blog_id); $blog_id = intval($blog_id);
// Init // Init
@ -1896,7 +1896,7 @@ class Blog
* @param int $task_id * @param int $task_id
* @return string * @return string
*/ */
public static function display_edit_task_form($blog_id, $task_id) public static function displayTaskEditForm($blog_id, $task_id)
{ {
$tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -2015,9 +2015,9 @@ class Blog
* @author Toon Keppens * @author Toon Keppens
* *
*/ */
public static function display_assign_task_form($blog_id) public static function displayTaskAssignmentForm($blog_id)
{ {
$form = self::getTaskForm($blog_id); $form = self::getTaskAssignmentForm($blog_id);
$form->addHidden('assign_task_submit', 'true'); $form->addHidden('assign_task_submit', 'true');
return $form->returnForm() return $form->returnForm()
@ -2030,7 +2030,7 @@ class Blog
* @param $blog_id * @param $blog_id
* @return string FormValidator * @return string FormValidator
*/ */
public static function getTaskForm($blog_id) public static function getTaskAssignmentForm($blog_id)
{ {
$tbl_users = Database::get_main_table(TABLE_MAIN_USER); $tbl_users = Database::get_main_table(TABLE_MAIN_USER);
$tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER); $tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER);
@ -2098,7 +2098,7 @@ class Blog
* @param int $user_id * @param int $user_id
* @return string HTML form * @return string HTML form
*/ */
public static function display_edit_assigned_task_form($blog_id, $task_id, $user_id) public static function displayAssignedTaskEditForm($blog_id, $task_id, $user_id)
{ {
$tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER);
@ -2125,7 +2125,7 @@ class Blog
'task_task_id' => $task_id, 'task_task_id' => $task_id,
'task_day' => $date, 'task_day' => $date,
]; ];
$form = self::getTaskForm($blog_id); $form = self::getTaskAssignmentForm($blog_id);
$form->addHidden('old_task_id', $task_id); $form->addHidden('old_task_id', $task_id);
$form->addHidden('old_user_id', $user_id); $form->addHidden('old_user_id', $user_id);
$form->addHidden('old_target_date', $date); $form->addHidden('old_target_date', $date);
@ -2143,7 +2143,7 @@ class Blog
* @param string $target_date date * @param string $target_date date
* @return void * @return void
*/ */
public static function assign_task($blog_id, $user_id, $task_id, $target_date) public static function assignTask($blog_id, $user_id, $task_id, $target_date)
{ {
$tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -2194,7 +2194,7 @@ class Blog
* @param $old_target_date * @param $old_target_date
* @return void * @return void
*/ */
public static function edit_assigned_task( public static function updateAssignedTask(
$blog_id, $blog_id,
$user_id, $user_id,
$task_id, $task_id,
@ -2250,7 +2250,7 @@ class Blog
* @param int $task_id * @param int $task_id
* @return string * @return string
*/ */
public static function display_select_task_post($blog_id, $task_id) public static function displayPostSelectionForTask($blog_id, $task_id)
{ {
$tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS);
$tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS);
@ -2307,7 +2307,7 @@ class Blog
* @param int $user_id * @param int $user_id
* @return void * @return void
*/ */
public static function set_user_unsubscribed($blog_id, $user_id) public static function unsubscribeUser($blog_id, $user_id)
{ {
// Init // Init
$tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER); $tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER);
@ -2335,7 +2335,7 @@ class Blog
* *
* @return string Html Form with sortable table with users to subcribe in a blog, in a course. * @return string Html Form with sortable table with users to subcribe in a blog, in a course.
*/ */
public static function display_form_user_subscribe($blog_id) public static function displayUserSubscriptionForm($blog_id)
{ {
$_course = api_get_course_info(); $_course = api_get_course_info();
$is_western_name_order = api_is_western_name_order(); $is_western_name_order = api_is_western_name_order();
@ -2447,7 +2447,7 @@ class Blog
* @param int $blog_id * @param int $blog_id
* @return false|null Form with sortable table with users to unsubcribe from a blog. * @return false|null Form with sortable table with users to unsubcribe from a blog.
*/ */
public static function display_form_user_unsubscribe($blog_id) public static function displayUserUnsubscriptionForm($blog_id)
{ {
$_user = api_get_user_info(); $_user = api_get_user_info();
$is_western_name_order = api_is_western_name_order(); $is_western_name_order = api_is_western_name_order();
@ -2563,7 +2563,7 @@ class Blog
* *
* @param Integer $blog_id * @param Integer $blog_id
*/ */
public static function display_form_user_rights($blog_id) public static function displayUserRightsForm($blog_id)
{ {
echo '<legend>'.get_lang('RightsManager').'</legend>'; echo '<legend>'.get_lang('RightsManager').'</legend>';
echo '<br />'; echo '<br />';
@ -2582,7 +2582,7 @@ class Blog
* @param int $blog_id * @param int $blog_id
* @return string html code * @return string html code
*/ */
public static function display_minimonthcalendar($month, $year, $blog_id) public static function displayMiniMonthCalendar($month, $year, $blog_id)
{ {
// Init // Init
$_user = api_get_user_info(); $_user = api_get_user_info();
@ -2750,7 +2750,7 @@ class Blog
* Blog admin | Display the form to add a new blog. * Blog admin | Display the form to add a new blog.
* @return void (direct output) * @return void (direct output)
*/ */
public static function display_new_blog_form() public static function displayBlogCreateForm()
{ {
$form = new FormValidator('add_blog', 'post', 'blog_admin.php?action=add'); $form = new FormValidator('add_blog', 'post', 'blog_admin.php?action=add');
$form->addElement('header', get_lang('AddBlog')); $form->addElement('header', get_lang('AddBlog'));
@ -2773,7 +2773,7 @@ class Blog
* @param int $blog_id * @param int $blog_id
* @return void Direct output * @return void Direct output
*/ */
public static function display_edit_blog_form($blog_id) public static function displayBlogEditForm($blog_id)
{ {
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$blog_id = intval($blog_id); $blog_id = intval($blog_id);
@ -2811,7 +2811,7 @@ class Blog
* Blog admin | Returns table with blogs in this course * Blog admin | Returns table with blogs in this course
* @return void Direct output * @return void Direct output
*/ */
public static function display_blog_list() public static function displayBlogsList()
{ {
global $charset; global $charset;
$_user = api_get_user_info(); $_user = api_get_user_info();
@ -2888,7 +2888,7 @@ class Blog
* @author Julio Montoya * @author Julio Montoya
* @version avril 2008, dokeos 1.8.5 * @version avril 2008, dokeos 1.8.5
*/ */
function get_blog_attachment($blog_id, $post_id = null, $comment_id = null) function getBlogAttachments($blog_id, $post_id = null, $comment_id = null)
{ {
$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
@ -2930,7 +2930,7 @@ class Blog
* @author Julio Montoya * @author Julio Montoya
* @version avril 2008, dokeos 1.8.5 * @version avril 2008, dokeos 1.8.5
*/ */
function delete_all_blog_attachment( function deleteAllBlogAttachments(
$blog_id, $blog_id,
$post_id = null, $post_id = null,
$comment_id = null $comment_id = null
@ -2983,7 +2983,7 @@ class Blog
* @param string $courseCode * @param string $courseCode
* @return string * @return string
*/ */
function get_blog_post_from_user($courseId, $userId, $courseCode) function getBlogPostFromUser($courseId, $userId, $courseCode)
{ {
$tbl_blogs = Database::get_course_table(TABLE_BLOGS); $tbl_blogs = Database::get_course_table(TABLE_BLOGS);
$tbl_blog_post = Database::get_course_table(TABLE_BLOGS_POSTS); $tbl_blog_post = Database::get_course_table(TABLE_BLOGS_POSTS);
@ -3027,7 +3027,7 @@ class Blog
* @param string $courseCode * @param string $courseCode
* @return string * @return string
*/ */
function get_blog_comment_from_user($courseId, $userId, $courseCode) function getBlogCommentsFromUser($courseId, $userId, $courseCode)
{ {
$tbl_blogs = Database::get_course_table(TABLE_BLOGS); $tbl_blogs = Database::get_course_table(TABLE_BLOGS);
$tbl_blog_comment = Database::get_course_table(TABLE_BLOGS_COMMENTS); $tbl_blog_comment = Database::get_course_table(TABLE_BLOGS_COMMENTS);

@ -37,7 +37,7 @@ $rights_blog = array(
$course_tool_table = Database::get_course_table(TABLE_TOOL_LIST); $course_tool_table = Database::get_course_table(TABLE_TOOL_LIST);
// Get all user // Get all user
$blog_users = Blog::get_blog_users($_GET['blog_id']); $blog_users = Blog::getBlogUsers($_GET['blog_id']);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();

@ -151,7 +151,7 @@ foreach ($tool_rights as $tool=>$rights) // $tool_rights contains all the possib
$tmp = strpos($tool,'_')+1; $tmp = strpos($tool,'_')+1;
$blog_id = substr($tool,$tmp,strlen($tool)); $blog_id = substr($tool,$tmp,strlen($tool));
// Get title // Get title
echo get_lang('Blog').": ".Blog::get_blog_title($blog_id); echo get_lang('Blog').": ".Blog::getBlogTitle($blog_id);
} }
else else
{ {

Loading…
Cancel
Save