Minor - flint fixes + replace jquery ready syntax

pull/2858/head
Julio Montoya 7 years ago
parent 84f4d38ee9
commit 80e36943cc
  1. 6
      main/document/edit_odf.php
  2. 1
      main/inc/ajax/social.ajax.php
  3. 55
      main/inc/lib/message.lib.php
  4. 1
      main/inc/lib/social.lib.php

@ -76,11 +76,11 @@ $htmlHeadXtra[] = api_get_js('wodotexteditor/wodotexteditor.js');
$htmlHeadXtra[] = api_get_js('wodotexteditor/localfileeditor.js'); $htmlHeadXtra[] = api_get_js('wodotexteditor/localfileeditor.js');
$htmlHeadXtra[] = api_get_js('wodotexteditor/FileSaver.js'); $htmlHeadXtra[] = api_get_js('wodotexteditor/FileSaver.js');
$htmlHeadXtra[] = ' $htmlHeadXtra[] = '
<script type="text/javascript" charset="utf-8"> <script>
$(document).on(\'ready\', function() { $(function() {
createEditor(\''.$fileUrl.'\'); createEditor(\''.$fileUrl.'\');
}); });
</script> </script>
'; ';
$htmlHeadXtra[] = ' $htmlHeadXtra[] = '
<style> <style>

@ -1,7 +1,6 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Component\Utils\ChamiloApi;
use Chamilo\CoreBundle\Entity\Message; use Chamilo\CoreBundle\Entity\Message;
use Chamilo\CoreBundle\Entity\MessageLikes; use Chamilo\CoreBundle\Entity\MessageLikes;
use ChamiloSession as Session; use ChamiloSession as Session;

@ -2736,36 +2736,12 @@ class MessageManager
} }
} }
/**
* Execute the SQL necessary to know the number of messages in the database.
*
* @param int $userId The user for which we need the unread messages count
*
* @return int The number of unread messages in the database for the given user
*/
private static function getCountNewMessagesFromDB($userId)
{
if (empty($userId)) {
return 0;
}
$table = Database::get_main_table(TABLE_MESSAGE);
$sql = "SELECT COUNT(id) as count
FROM $table
WHERE
user_receiver_id=".api_get_user_id()." AND
msg_status = ".MESSAGE_STATUS_UNREAD;
$result = Database::query($sql);
$row = Database::fetch_assoc($result);
return $row['count'];
}
/** /**
* @param int $messageId * @param int $messageId
* *
* @return array
*
* @throws \Doctrine\ORM\Query\QueryException * @throws \Doctrine\ORM\Query\QueryException
*
* @return array
*/ */
public static function countLikesAndDislikes($messageId, $userId) public static function countLikesAndDislikes($messageId, $userId)
{ {
@ -2800,8 +2776,9 @@ class MessageManager
* @param int $userId * @param int $userId
* @param int $groupId Optional. * @param int $groupId Optional.
* *
* @return string
* @throws \Doctrine\ORM\Query\QueryException * @throws \Doctrine\ORM\Query\QueryException
*
* @return string
*/ */
public static function getLikesButton($messageId, $userId, $groupId = 0) public static function getLikesButton($messageId, $userId, $groupId = 0)
{ {
@ -2834,4 +2811,28 @@ class MessageManager
return $btnLike.PHP_EOL.$btnDislike; return $btnLike.PHP_EOL.$btnDislike;
} }
/**
* Execute the SQL necessary to know the number of messages in the database.
*
* @param int $userId The user for which we need the unread messages count
*
* @return int The number of unread messages in the database for the given user
*/
private static function getCountNewMessagesFromDB($userId)
{
if (empty($userId)) {
return 0;
}
$table = Database::get_main_table(TABLE_MESSAGE);
$sql = "SELECT COUNT(id) as count
FROM $table
WHERE
user_receiver_id=".api_get_user_id()." AND
msg_status = ".MESSAGE_STATUS_UNREAD;
$result = Database::query($sql);
$row = Database::fetch_assoc($result);
return $row['count'];
}
} }

@ -1905,7 +1905,6 @@ class SocialManager extends UserManager
$isOwnWall = $currentUserId == $userIdLoop || $currentUserId == $receiverId; $isOwnWall = $currentUserId == $userIdLoop || $currentUserId == $receiverId;
if ($isOwnWall) { if ($isOwnWall) {
$comment .= Display::url( $comment .= Display::url(
Display::returnFontAwesomeIcon('trash', '', true), Display::returnFontAwesomeIcon('trash', '', true),
'javascript:void(0)', 'javascript:void(0)',

Loading…
Cancel
Save