Browse Source

Minor - format code.

jmontoyaa 7 years ago
parent
commit
d155b854f4

+ 0 - 2
main/inc/ajax/chat.ajax.php

@@ -16,7 +16,6 @@ if (api_get_setting('allow_global_chat') == 'false') {
 if (api_is_anonymous()) {
     exit;
 }
-
 $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
 
 // Course Chat
@@ -45,7 +44,6 @@ if ($chat->isChatBlockedByExercises()) {
     $chat->setUserStatus(0);
     exit;
 }
-
 switch ($action) {
     case 'chatheartbeat':
         $chat->heartbeat();

+ 1 - 3
main/inc/ajax/message.ajax.php

@@ -24,7 +24,7 @@ switch ($action) {
         $count_unread_message = 0;
         if (api_get_setting('allow_message_tool') == 'true') {
             // get count unread message and total invitations
-            $count_unread_message = MessageManager::get_number_of_messages(true);
+            $count_unread_message = MessageManager::getNumberOfMessages(true);
         }
 
         if (api_get_setting('allow_social_tool') == 'true') {
@@ -44,8 +44,6 @@ switch ($action) {
             }
             $total_invitations = intval($number_of_new_messages_of_friend) + $group_pending_invitations + intval($count_unread_message);
         }
-        //$total_invitations = !empty($total_invitations) ? Display::badge($total_invitations) : '';
-
         echo $total_invitations;
         break;
     case 'send_message':

+ 1 - 1
main/inc/lib/TicketManager.php

@@ -1387,7 +1387,7 @@ class TicketManager
     /**
      * @return mixed
      */
-    public static function get_number_of_messages()
+    public static function getNumberOfMessages()
     {
         $table_support_tickets = Database::get_main_table(TABLE_TICKET_TICKET);
         $table_support_messages = Database::get_main_table(

+ 2 - 2
main/inc/lib/chat.lib.php

@@ -106,7 +106,7 @@ class Chat extends Model
 
     /**
      * Starts a chat session and returns JSON array of status and chat history
-     * @return void (prints output in JSON format)
+     * @return bool (prints output in JSON format)
      */
     public function startSession()
     {
@@ -119,7 +119,7 @@ class Chat extends Model
             'items' => $chats
         );
         echo json_encode($return);
-        exit;
+        return true;
     }
 
     /**

+ 4 - 4
main/inc/lib/message.lib.php

@@ -70,7 +70,7 @@ class MessageManager
      * @param bool $unread
      * @return int
      */
-    public static function get_number_of_messages($unread = false)
+    public static function getNumberOfMessages($unread = false)
     {
         $table = Database::get_main_table(TABLE_MESSAGE);
         if ($unread) {
@@ -1055,7 +1055,7 @@ class MessageManager
      * @param void
      * @return integer
      */
-    public static function get_number_of_messages_sent()
+    public static function getNumberOfMessagesSent()
     {
         $table = Database::get_main_table(TABLE_MESSAGE);
         $keyword = Session::read('message_sent_search_keyword');
@@ -1829,7 +1829,7 @@ class MessageManager
         // display sortable table with messages of the current user
         $table = new SortableTable(
             'message_inbox',
-            array('MessageManager', 'get_number_of_messages'),
+            array('MessageManager', 'getNumberOfMessages'),
             array('MessageManager', 'get_message_data'),
             3,
             20,
@@ -1894,7 +1894,7 @@ class MessageManager
         // display sortable table with messages of the current user
         $table = new SortableTable(
             'message_outbox',
-            array('MessageManager', 'get_number_of_messages_sent'),
+            array('MessageManager', 'getNumberOfMessagesSent'),
             array('MessageManager', 'get_message_data_sent'),
             3,
             20,

+ 17 - 19
main/inc/lib/social.lib.php

@@ -290,8 +290,8 @@ class SocialManager extends UserManager
      */
     public static function get_message_number_invitation_by_user_id($user_receiver_id)
     {
-        $tbl_message = Database::get_main_table(TABLE_MESSAGE);
-        $sql = 'SELECT COUNT(*) as count_message_in_box FROM '.$tbl_message.'
+        $table = Database::get_main_table(TABLE_MESSAGE);
+        $sql = 'SELECT COUNT(*) as count_message_in_box FROM '.$table.'
                 WHERE
                     user_receiver_id='.intval($user_receiver_id).' AND
                     msg_status='.MESSAGE_STATUS_INVITATION_PENDING;
@@ -308,8 +308,8 @@ class SocialManager extends UserManager
      */
     public static function getCountMessagesSent($sender_id)
     {
-        $tbl_message = Database::get_main_table(TABLE_MESSAGE);
-        $sql = 'SELECT COUNT(*) FROM '.$tbl_message.'
+        $table = Database::get_main_table(TABLE_MESSAGE);
+        $sql = 'SELECT COUNT(*) FROM '.$table.'
                 WHERE
                     user_sender_id='.intval($sender_id).' AND
                     msg_status < 5';
@@ -326,8 +326,8 @@ class SocialManager extends UserManager
      */
     public static function getCountMessagesReceived($receiver_id)
     {
-        $tbl_message = Database::get_main_table(TABLE_MESSAGE);
-        $sql = 'SELECT COUNT(*) FROM '.$tbl_message.'
+        $table = Database::get_main_table(TABLE_MESSAGE);
+        $sql = 'SELECT COUNT(*) FROM '.$table.'
                 WHERE
                     user_receiver_id='.intval($receiver_id).' AND
                     msg_status < 4';
@@ -348,9 +348,9 @@ class SocialManager extends UserManager
             return 0;
         }
 
-        $tbl_message = Database::get_main_table(TABLE_MESSAGE);
+        $table = Database::get_main_table(TABLE_MESSAGE);
         $sql = 'SELECT COUNT(*) 
-                FROM '.$tbl_message.'
+                FROM '.$table.'
                 WHERE
                     user_sender_id='.intval($userId).' AND
                     (msg_status = '.MESSAGE_STATUS_WALL.' OR 
@@ -375,9 +375,9 @@ class SocialManager extends UserManager
             return [];
         }
 
-        $tbl_message = Database::get_main_table(TABLE_MESSAGE);
+        $table = Database::get_main_table(TABLE_MESSAGE);
         $sql = 'SELECT user_sender_id, send_date, title, content
-                FROM '.$tbl_message.'
+                FROM '.$table.'
                 WHERE
                     user_receiver_id = '.intval($userId).' AND
                     msg_status = '.MESSAGE_STATUS_INVITATION_PENDING;
@@ -460,8 +460,8 @@ class SocialManager extends UserManager
             return false;
         }
 
-        $tbl_message = Database::get_main_table(TABLE_MESSAGE);
-        $sql = "UPDATE $tbl_message
+        $table = Database::get_main_table(TABLE_MESSAGE);
+        $sql = "UPDATE $table
                 SET msg_status = ".MESSAGE_STATUS_INVITATION_ACCEPTED."
                 WHERE
                     user_sender_id = ".((int) $user_send_id)." AND
@@ -486,8 +486,8 @@ class SocialManager extends UserManager
         if (empty($user_send_id) || empty($user_receiver_id)) {
             return false;
         }
-        $tbl_message = Database::get_main_table(TABLE_MESSAGE);
-        $sql = 'DELETE FROM '.$tbl_message.'
+        $table = Database::get_main_table(TABLE_MESSAGE);
+        $sql = 'DELETE FROM '.$table.'
                 WHERE
                     user_sender_id =  '.((int) $user_send_id).' AND
                     user_receiver_id='.((int) $user_receiver_id).' AND
@@ -507,9 +507,9 @@ class SocialManager extends UserManager
      */
     public static function qualify_friend($id_friend_qualify, $type_qualify)
     {
-        $tbl_user_friend = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
+        $table = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
         $user_id = api_get_user_id();
-        $sql = 'UPDATE '.$tbl_user_friend.' SET relation_type='.((int) $type_qualify).'
+        $sql = 'UPDATE '.$table.' SET relation_type='.((int) $type_qualify).'
                 WHERE user_id = '.((int) $user_id).' AND friend_user_id='.(int) $id_friend_qualify;
         Database::query($sql);
     }
@@ -684,8 +684,6 @@ class SocialManager extends UserManager
         }
 
         $result .= '</li>';
-
-
         $session = '';
         if (!empty($my_course['session_name']) && !empty($my_course['id_session'])) {
             // Request for the name of the general coach
@@ -857,7 +855,7 @@ class SocialManager extends UserManager
         );
 
         // get count unread message and total invitations
-        $count_unread_message = MessageManager::get_number_of_messages(true);
+        $count_unread_message = MessageManager::getNumberOfMessages(true);
         $count_unread_message = !empty($count_unread_message) ? Display::badge($count_unread_message) : null;
 
         $number_of_new_messages_of_friend = self::get_message_number_invitation_by_user_id(api_get_user_id());

+ 1 - 1
main/install/configuration.dist.php

@@ -713,5 +713,5 @@ $_configuration['gradebook_badge_sidebar'] = [
 // Add user activation by confirmation email
 // This option prevents the new user to login in the platform if your account is not confirmed via email
 // You need add a new option called "confirmation" to the registration settings
-//INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_registration', 'confirmation', 'MailConfirmation')
+//INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_registration', 'confirmation', 'MailConfirmation');
 // ------ (End) Custom DB changes