Minor - format code, remove commented code

pull/3213/head
Julio Montoya 6 years ago
parent e04c898e85
commit 3f20a852b1
  1. 6
      main/auth/profile.php
  2. 106
      main/inc/lib/social.lib.php
  3. 4
      main/inc/lib/usermanager.lib.php
  4. 61
      main/social/profile.php
  5. 2
      plugin/bbb/start.php
  6. 3
      src/Chamilo/UserBundle/Entity/Manager/UserManager.php

@ -321,11 +321,7 @@ if (is_platform_authentication() &&
}
$extraField = new ExtraField('user');
$return = $extraField->addElements(
$form,
api_get_user_id()
);
$return = $extraField->addElements($form, api_get_user_id());
$jquery_ready_content = $return['jquery_ready_content'];
// the $jquery_ready_content variable collects all functions that

@ -38,7 +38,7 @@ class SocialManager extends UserManager
{
$table = Database::get_main_table(TABLE_MAIN_USER_FRIEND_RELATION_TYPE);
$sql = 'SELECT id, title FROM '.$table.'
WHERE id<>6
WHERE id<>6
ORDER BY id ASC';
$result = Database::query($sql);
$friend_relation_list = [];
@ -68,10 +68,10 @@ class SocialManager extends UserManager
{
$table = Database::get_main_table(TABLE_MAIN_USER_FRIEND_RELATION_TYPE);
$userRelUserTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
$sql = 'SELECT rt.id as id
$sql = 'SELECT rt.id as id
FROM '.$table.' rt
WHERE rt.id = (
SELECT uf.relation_type
SELECT uf.relation_type
FROM '.$userRelUserTable.' uf
WHERE
user_id='.((int) $user_id).' AND
@ -274,18 +274,18 @@ class SocialManager extends UserManager
} else {
// invitation already exist
$sql = 'SELECT COUNT(*) AS count, id FROM '.$tbl_message.'
WHERE
user_sender_id='.$user_id.' AND
user_receiver_id='.$friend_id.' AND
WHERE
user_sender_id='.$user_id.' AND
user_receiver_id='.$friend_id.' AND
msg_status = 7';
$res_if_exist = Database::query($sql);
$row_if_exist = Database::fetch_array($res_if_exist, 'ASSOC');
if ($row_if_exist['count'] == 1) {
$sql = 'UPDATE '.$tbl_message.' SET
msg_status = 5, content = "'.$clean_message_content.'"
WHERE
user_sender_id='.$user_id.' AND
user_receiver_id='.$friend_id.' AND
WHERE
user_sender_id='.$user_id.' AND
user_receiver_id='.$friend_id.' AND
msg_status = 7 ';
Database::query($sql);
@ -379,12 +379,12 @@ class SocialManager extends UserManager
}
$table = Database::get_main_table(TABLE_MESSAGE);
$sql = 'SELECT COUNT(*)
$sql = 'SELECT COUNT(*)
FROM '.$table.'
WHERE
user_sender_id='.$userId.' AND
(msg_status = '.MESSAGE_STATUS_WALL.' OR
msg_status = '.MESSAGE_STATUS_WALL_POST.') AND
(msg_status = '.MESSAGE_STATUS_WALL.' OR
msg_status = '.MESSAGE_STATUS_WALL_POST.') AND
parent_id = 0';
$res = Database::query($sql);
$row = Database::fetch_row($res);
@ -851,9 +851,7 @@ class SocialManager extends UserManager
);
}
$skillBlock = $template->get_template('social/avatar_block.tpl');
return $template->fetch($skillBlock);
return $template->fetch($template->get_template('social/avatar_block.tpl'));
}
/**
@ -1630,7 +1628,7 @@ class SocialManager extends UserManager
// Get my own posts
$userReceiverCondition = ' (
user_receiver_id = '.$userId.' AND
user_receiver_id = '.$userId.' AND
msg_status IN ('.MESSAGE_STATUS_WALL_POST.', '.MESSAGE_STATUS_WALL.') AND
parent_id = '.$parentId.'
)';
@ -1677,7 +1675,7 @@ class SocialManager extends UserManager
if ($getCount) {
$select = ' SELECT count(iid) count_items ';
} else {
$select = " SELECT
$select = " SELECT
iid as id,
poster_id as user_sender_id,
'' as user_receiver_id,
@ -1688,7 +1686,7 @@ class SocialManager extends UserManager
'' as group_id,
forum_id,
thread_id,
c_id
c_id
";
}
@ -1696,8 +1694,8 @@ class SocialManager extends UserManager
$threadList = implode("','", $threadList);
$condition = " thread_id IN ('$threadList') ";
$sql[5] = "$select
FROM c_forum_post
WHERE $condition
FROM c_forum_post
WHERE $condition
";
}
@ -1861,8 +1859,8 @@ class SocialManager extends UserManager
$comment .= '<div class="col-md-2 col-xs-2 social-post-answers">';
$comment .= '<div class="user-image pull-right">';
$comment .= '<a href="'.$url.'">
<img src="'.$users[$userIdLoop]['avatar'].'"
alt="'.$users[$userIdLoop]['complete_name'].'"
<img src="'.$users[$userIdLoop]['avatar'].'"
alt="'.$users[$userIdLoop]['complete_name'].'"
class="avatar-thumb">
</a>';
$comment .= '</div>';
@ -1870,7 +1868,7 @@ class SocialManager extends UserManager
$comment .= '<div class="col-md-7 col-xs-7 social-post-answers">';
$comment .= '<div class="user-data">';
$comment .= $iconStatus;
$comment .= '<div class="username"><a href="'.$url.'">'.$nameComplete.'</a>
$comment .= '<div class="username"><a href="'.$url.'">'.$nameComplete.'</a>
<span>'.Security::remove_XSS($message['content']).'</span>
</div>';
$comment .= '<div>'.$date.'</div>';
@ -2098,7 +2096,7 @@ class SocialManager extends UserManager
$groupId = 0,
$show_full_profile = true
) {
if (api_get_setting('allow_social_tool') != 'true') {
if (api_get_setting('allow_social_tool') !== 'true') {
return '';
}
@ -2656,8 +2654,8 @@ class SocialManager extends UserManager
$value_options = [];
// get option display text from user_field_options table
foreach ($id_options as $id_option) {
$sql = "SELECT display_text
FROM $t_ufo
$sql = "SELECT display_text
FROM $t_ufo
WHERE id = '$id_option'";
$res_options = Database::query($sql);
$row_options = Database::fetch_row($res_options);
@ -2863,15 +2861,15 @@ class SocialManager extends UserManager
loadingHtml: "<div class=\"well_border\">'.get_lang('Loading').' </div>",
nextSelector: "a.nextPage:last",
contentSelector: "",
callback: timeAgo
callback: timeAgo
});
});
</script>';
}
$htmlHeadXtra[] = '<script>
function deleteMessage(id)
{
function deleteMessage(id)
{
$.ajax({
url: "'.$socialAjaxUrl.'?a=delete_message" + "&id=" + id,
success: function (result) {
@ -2879,11 +2877,11 @@ class SocialManager extends UserManager
$("#message_" + id).parent().parent().parent().parent().html(result);
}
}
});
});
}
function deleteComment(id)
{
function deleteComment(id)
{
$.ajax({
url: "'.$socialAjaxUrl.'?a=delete_message" + "&id=" + id,
success: function (result) {
@ -2891,40 +2889,40 @@ class SocialManager extends UserManager
$("#message_" + id).parent().parent().parent().html(result);
}
}
});
}
function submitComment(messageId)
});
}
function submitComment(messageId)
{
var data = $("#form_comment_"+messageId).serializeArray();
var data = $("#form_comment_"+messageId).serializeArray();
$.ajax({
type : "POST",
url: "'.$socialAjaxUrl.'?a=send_comment" + "&id=" + messageId,
data: data,
success: function (result) {
success: function (result) {
if (result) {
$("#post_" + messageId + " textarea").val("");
$("#post_" + messageId + " .sub-mediapost").prepend(result);
$("#post_" + messageId + " .sub-mediapost").append(
$(\'<div id=result_\' + messageId +\'>'.addslashes(get_lang('Saved')).'</div>\')
);
);
$("#result_" + messageId + "").fadeIn("fast", function() {
$("#result_" + messageId + "").delay(1000).fadeOut("fast", function() {
$(this).remove();
});
});
});
}
}
});
}
});
}
$(function() {
timeAgo();
/*$(".delete_message").on("click", function() {
var id = $(this).attr("id");
id = id.split("_")[1];
id = id.split("_")[1];
$.ajax({
url: "'.$socialAjaxUrl.'?a=delete_message" + "&id=" + id,
success: function (result) {
@ -2932,13 +2930,13 @@ class SocialManager extends UserManager
$("#message_" + id).parent().parent().parent().parent().html(result);
}
}
});
});
});
});
$(".delete_comment").on("click", function() {
var id = $(this).attr("id");
id = id.split("_")[1];
id = id.split("_")[1];
$.ajax({
url: "'.$socialAjaxUrl.'?a=delete_message" + "&id=" + id,
success: function (result) {
@ -2947,10 +2945,10 @@ class SocialManager extends UserManager
}
}
});
});
});
*/
});
function timeAgo() {
$(".timeago").timeago();
}

@ -7012,9 +7012,7 @@ SQL;
'Chamilo\\UserBundle\\Entity\\User' => new \Chamilo\UserBundle\Security\Encoder($encryption),
];
$encoderFactory = new EncoderFactory($encoders);
return $encoderFactory;
return new EncoderFactory($encoders);
}
/**

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
@ -10,13 +11,11 @@ use ChamiloSession as Session;
* @author Isaac Flores Paz <florespaz_isaac@hotmail.com>
*
* @todo use Display::panel()
*
* @package chamilo.social
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
if (api_get_setting('allow_social_tool') != 'true') {
if (api_get_setting('allow_social_tool') !== 'true') {
$url = api_get_path(WEB_PATH).'whoisonline.php?id='.intval($_GET['u']);
header('Location: '.$url);
exit;
@ -105,25 +104,6 @@ if (isset($_GET['u']) && is_numeric($_GET['u']) && $_GET['u'] != api_get_user_id
Session::write('social_user_id', (int) $user_id);
// Setting some course info
/*$course_list_code = [];
$personal_course_list = UserManager::get_personal_session_course_list($friendId, 50);
$i = 1;
$list = [];
if (is_array($personal_course_list)) {
foreach ($personal_course_list as $my_course) {
if ($i <= 10) {
$list[] = SocialManager::get_logged_user_course_html($my_course, $i);
$course_list_code[] = ['code' => $my_course['code']];
} else {
break;
}
$i++;
}
//to avoid repeted courses
$course_list_code = array_unique_dimensional($course_list_code);
}*/
// Social Block Menu
$menu = SocialManager::show_social_menu(
'shared_profile',
@ -134,7 +114,6 @@ $menu = SocialManager::show_social_menu(
//Setting some session info
$user_info = api_get_user_info($friendId);
//$sessionList = SessionManager::getSessionsFollowedByUser($friendId, $user_info['status']);
$sessionList = [];
// My friends
@ -152,20 +131,6 @@ $listInvitations = '';
if ($show_full_profile) {
$social_group_info_block = SocialManager::getGroupBlock($friendId);
/*
$my_courses = null;
// COURSES LIST
if (is_array($list)) {
$i = 1;
foreach ($list as $key => $value) {
if (empty($value[2])) { //if out of any session
$my_courses .= $value[1];
$i++;
}
}
$social_course_block .= $my_courses;
}*/
// Block Social Sessions
if (count($sessionList) > 0) {
$social_session_block = $sessionList;
@ -183,17 +148,6 @@ if ($show_full_profile) {
// Images uploaded by course
$file_list = '';
/*
if (is_array($course_list_code) && count($course_list_code) > 0) {
foreach ($course_list_code as $course) {
$file_list .= UserManager::get_user_upload_files_by_course(
$user_id,
$course['code'],
'images'
);
}
}*/
$count_pending_invitations = 0;
if (!isset($_GET['u']) ||
(isset($_GET['u']) && $_GET['u'] == api_get_user_id())
@ -257,14 +211,6 @@ if ($show_full_profile) {
}
$images_uploaded = null;
// Images uploaded by course
/*if (!empty($file_list)) {
$images_uploaded .= '<div><h3>'.get_lang('ImagesUploaded').'</h3></div>';
$images_uploaded .= '<div class="social-content-information">';
$images_uploaded .= $file_list;
$images_uploaded .= '</div>';
$socialRightInformation .= SocialManager::social_wrapper_div($images_uploaded, 4);
}*/
}
if (!empty($user_info['competences']) || !empty($user_info['diplomas'])
@ -324,5 +270,4 @@ $template = $formModalTpl->get_template('social/form_modals.tpl');
$formModals = $formModalTpl->fetch($template);
$tpl->assign('form_modals', $formModals);
$social_layout = $tpl->get_template('social/profile.tpl');
$tpl->display($social_layout);
$tpl->display($tpl->get_template('social/profile.tpl'));

@ -3,8 +3,6 @@
/**
* This script initiates a video conference session, calling the BigBlueButton API.
*
* @package chamilo.plugin.bigbluebutton
*/
require_once __DIR__.'/../../vendor/autoload.php';

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\UserBundle\Entity\Manager;
@ -8,8 +9,6 @@ use Sonata\UserBundle\Entity\UserManager as BaseUserManager;
/**
* Class UserManager.
*
* @package Chamilo\UserBundle\Entity\Manager
*/
class UserManager extends BaseUserManager
{

Loading…
Cancel
Save