Browse Source

Minor - format code

jmontoyaa 9 years ago
parent
commit
5cb9d44f4f

+ 0 - 1
main/inc/lib/events_dispatcher.class.php

@@ -1,5 +1,4 @@
 <?php
-include_once api_get_path(CONFIGURATION_PATH).'events.conf.php';
 
 /**
  *  Class EventsDispatcher

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

@@ -5,7 +5,7 @@
  * @package chamilo.include.geometry
  */
 
-DEFINE('DEBUG', false);
+define('DEBUG', false);
 /**
  * poly_init -    build the array which will store the image of the polygone
  * @param max[x]    X resolution

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

@@ -12,7 +12,7 @@ class GlossaryManager
     /**
      * Get all glossary terms
      * @author Isaac Flores <isaac.flores@dokeos.com>
-     * @return Array Contain glossary terms
+     * @return array Contain glossary terms
      */
     public static function get_glossary_terms()
     {
@@ -37,7 +37,7 @@ class GlossaryManager
      * Get glossary term by glossary id
      * @author Isaac Flores <florespaz@bidsoftperu.com>
      * @param int $glossary_id
-     * @return String The glossary description
+     * @return string The glossary description
      */
     public static function get_glossary_term_by_glossary_id ($glossary_id)
     {
@@ -58,8 +58,8 @@ class GlossaryManager
     /**
      * Get glossary term by glossary id
      * @author Isaac Flores <florespaz_isaac@hotmail.com>
-     * @param String The glossary term name
-     * @return String The glossary description
+     * @param string The glossary term name
+     * @return string The glossary description
      */
     public static function get_glossary_term_by_glossary_name ($glossary_name)
     {

+ 22 - 22
main/inc/lib/lp_item.lib.php

@@ -11,28 +11,28 @@
  */
 class LpItem
 {
-    public $c_id=0;
-    public $id=0;
-    public $lp_id=0;
-    public $item_type="";
-    public $ref="";
-    public $title="";
-    public $description="";
-    public $path="";
-    public $min_score=0;
-    public $max_score=0;
-    public $mastery_score=0;
-    public $parent_item_id=0;
-    public $previous_item_id=0;
-    public $next_item_id=0;
-    public $display_order=0;
-    public $prerequisite="";
-    public $parameters="";
-    public $launch_data="";
-    public $max_time_allowed="";
-    public $terms="";
-    public $search_did=0;
-    public $audio="";
+    public $c_id = 0;
+    public $id = 0;
+    public $lp_id = 0;
+    public $item_type = "";
+    public $ref = "";
+    public $title = "";
+    public $description = "";
+    public $path = "";
+    public $min_score = 0;
+    public $max_score = 0;
+    public $mastery_score = 0;
+    public $parent_item_id = 0;
+    public $previous_item_id = 0;
+    public $next_item_id = 0;
+    public $display_order = 0;
+    public $prerequisite = "";
+    public $parameters = "";
+    public $launch_data = "";
+    public $max_time_allowed = "";
+    public $terms = "";
+    public $search_did = 0;
+    public $audio = "";
 
     public function __construct($in_c_id=0, $in_id=0)
     {

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

@@ -69,7 +69,9 @@ class MessageManager
             return false;
         }
         $sql = "SELECT * FROM $table
-                WHERE user_receiver_id=".api_get_user_id()." AND msg_status=".MESSAGE_STATUS_UNREAD;
+                WHERE
+                    user_receiver_id=".api_get_user_id()." AND
+                    msg_status=".MESSAGE_STATUS_UNREAD;
         $result = Database::query($sql);
         $i = Database::num_rows($result);
 
@@ -108,6 +110,7 @@ class MessageManager
                 WHERE $condition_msg_status AND user_receiver_id=".api_get_user_id();
         $sql_result = Database::query($sql);
         $result = Database::fetch_array($sql_result);
+
         return $result['number_messages'];
     }
 
@@ -645,8 +648,9 @@ class MessageManager
             $path_message_attach = $path_user_info['dir'].'message_attachments/';
             if (is_file($path_message_attach.$path)) {
                 if (rename($path_message_attach.$path, $path_message_attach.$new_path)) {
-                    $sql_upd = "UPDATE $table_message_attach set path='$new_path' WHERE id ='$attach_id'";
-                    Database::query($sql_upd);
+                    $sql = "UPDATE $table_message_attach set path='$new_path'
+                            WHERE id ='$attach_id'";
+                    Database::query($sql);
                 }
             }
         }
@@ -799,7 +803,10 @@ class MessageManager
         }
 
         $sql = "SELECT * FROM $table_message
-                WHERE parent_id='$parent_id' AND msg_status <> ".MESSAGE_STATUS_OUTBOX." $condition_group_id
+                WHERE
+                    parent_id='$parent_id' AND
+                    msg_status <> ".MESSAGE_STATUS_OUTBOX."
+                    $condition_group_id
                 ORDER BY send_date DESC $condition_limit ";
         $rs = Database::query($sql);
         $data = array();

+ 34 - 21
main/inc/lib/social.lib.php

@@ -291,7 +291,9 @@ class SocialManager extends UserManager
         $tbl_message = Database::get_main_table(TABLE_MESSAGE);
         $sql = 'SELECT user_receiver_id, send_date,title,content
                 FROM '.$tbl_message.'
-                WHERE user_sender_id = '.intval($user_id).' AND msg_status = '.MESSAGE_STATUS_INVITATION_PENDING;
+                WHERE
+                    user_sender_id = '.intval($user_id).' AND
+                    msg_status = '.MESSAGE_STATUS_INVITATION_PENDING;
         $res = Database::query($sql);
         while ($row = Database::fetch_array($res, 'ASSOC')) {
             $list_friend_invitation[$row['user_receiver_id']] = $row;
@@ -724,10 +726,7 @@ class SocialManager extends UserManager
             $show,
             array('shared_profile', 'groups', 'group_edit', 'member_list', 'waiting_list', 'invite_friends')
         )) {
-
-            
             $links = '<ul class="nav nav-pills nav-stacked">';
-            
             $active = $show == 'home' ? 'active' : null;
             $links .= '
                 <li class="home-icon ' . $active . '">
@@ -813,9 +812,7 @@ class SocialManager extends UserManager
         }
 
         if ($show == 'shared_profile') {
-            
             $links =  '<ul class="nav nav-pills nav-stacked">';
-
             // My own profile
             if ($show_full_profile && $user_id == intval(api_get_user_id())) {
                 $links .= '
@@ -897,7 +894,9 @@ class SocialManager extends UserManager
             }
 
             // Check if I already sent an invitation message
-            $invitation_sent_list = SocialManager::get_list_invitation_sent_by_user_id(api_get_user_id());
+            $invitation_sent_list = SocialManager::get_list_invitation_sent_by_user_id(
+                api_get_user_id()
+            );
 
             if (isset($invitation_sent_list[$user_id]) && is_array($invitation_sent_list[$user_id]) && count($invitation_sent_list[$user_id]) > 0) {
                 $links .= '<li><a href="'.api_get_path(WEB_CODE_PATH).'social/invitations.php">'.Display::return_icon('invitation.png', get_lang('YouAlreadySentAnInvitation')).'&nbsp;&nbsp;'.get_lang('YouAlreadySentAnInvitation').'</a></li>';
@@ -909,13 +908,13 @@ class SocialManager extends UserManager
 
             $links .= '</ul>';
             $html .= Display::panelCollapse(
-                    get_lang('SocialNetwork'),
-                    $links,
-                    'social-network-menu',
-                    null,
-                    'sn-sidebar',
-                    'sn-sidebar-collapse'
-                    );
+                get_lang('SocialNetwork'),
+                $links,
+                'social-network-menu',
+                null,
+                'sn-sidebar',
+                'sn-sidebar-collapse'
+            );
 
             if ($show_full_profile && $user_id == intval(api_get_user_id())) {
                 $personal_course_list = UserManager::get_personal_session_course_list($user_id);
@@ -1207,6 +1206,7 @@ class SocialManager extends UserManager
             case SOCIAL_RIGHT_PLUGIN:
                 break;
         }
+
         return $content;
     }
     /**
@@ -1325,12 +1325,24 @@ class SocialManager extends UserManager
         $start = Database::escape_string($start);
         $limit = intval($limit);
 
-        $sql = "SELECT id, user_sender_id,user_receiver_id, send_date, content, parent_id,
-          (SELECT ma.path FROM $tblMessageAttachment ma WHERE  ma.message_id = tm.id ) as path,
-          (SELECT ma.filename FROM $tblMessageAttachment ma WHERE  ma.message_id = tm.id ) as filename
-            FROM $tblMessage tm
-            WHERE user_receiver_id = $userId
-                AND send_date > '$start' ";
+        $sql = "
+        SELECT
+          id,
+          user_sender_id,
+          user_receiver_id,
+          send_date,
+          content,
+          parent_id,
+          (SELECT ma.path FROM $tblMessageAttachment ma
+           WHERE  ma.message_id = tm.id ) as path,
+          (SELECT ma.filename FROM $tblMessageAttachment ma
+          WHERE  ma.message_id = tm.id ) as filename
+        FROM $tblMessage tm
+        WHERE
+            user_receiver_id = $userId AND
+            send_date > '$start'
+        ";
+
         $sql .= (empty($messageStatus) || is_null($messageStatus)) ? '' : " AND msg_status = '$messageStatus' ";
         $sql .= (empty($parentId) || is_null($parentId)) ? '' : " AND parent_id = '$parentId' ";
         $sql .= " ORDER BY send_date DESC LIMIT $offset, $limit ";
@@ -1563,6 +1575,7 @@ class SocialManager extends UserManager
         $html .= empty($graph->description) ? '' : '<p class="description">'.$graph->description.'</p>';
         $html .= '<a href="'.$link.'">'.$link.'</a>';
         $html .= '</div>';
+
         return $html;
     }
 
@@ -1746,7 +1759,7 @@ class SocialManager extends UserManager
                         $statusIcon = Display::span('', array('class' => 'offline_user_in_text'));
                     }
 
-                    $friendHtml.= '<li class="">';
+                    $friendHtml.= '<li>';
                     $friendHtml.= '<div>';
 
                     // the height = 92 must be the same in the image_friend_network span style in default.css

+ 4 - 1
main/inc/lib/statistics.lib.php

@@ -86,6 +86,7 @@ class Statistics
         }
         $res = Database::query($sql);
         $obj = Database::fetch_object($res);
+
         return $obj->number;
     }
 
@@ -238,7 +239,9 @@ class Statistics
                     user.username         as col5,
                     user.user_id         as col6,
                     default_date         as col7
-                    FROM $track_e_default as track_default, $table_user as user, $access_url_rel_user_table as url
+                    FROM $track_e_default as track_default,
+                    $table_user as user,
+                    $access_url_rel_user_table as url
                     WHERE
                         track_default.default_user_id = user.user_id AND
                         url.user_id = user.user_id AND

+ 1 - 0
main/inc/lib/system_announcements.lib.php

@@ -197,6 +197,7 @@ class SystemAnnouncementManager
 			$content .= '</table>';
 			$content .= '</div>';
 		}
+
 		return $content;
 	}
 

+ 9 - 11
main/inc/lib/urlmanager.lib.php

@@ -49,13 +49,12 @@ class UrlManager
     {
         $url_id = intval($url_id);
         $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
-        $tms = time();
         $sql = "UPDATE $table
                 SET url 	= '".Database::escape_string($url)."',
                 description = '".Database::escape_string($description)."',
                 active 		= '".intval($active)."',
                 created_by 	= '".api_get_user_id()."',
-                tms 		= FROM_UNIXTIME(".$tms.")
+                tms 		= '".api_get_utc_datetime()."'
                 WHERE id = '$url_id'";
 
         $result = Database::query($sql);
@@ -164,6 +163,7 @@ class UrlManager
                 WHERE id = ".intval($url_id);
         $res = Database::query($sql);
         $row = Database::fetch_array($res);
+
         return $row;
     }
 
@@ -178,7 +178,7 @@ class UrlManager
     {
         $where = '';
         $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
-        $tbl_user           = Database :: get_main_table(TABLE_MAIN_USER);
+        $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
         if (!empty($access_url_id)) {
             $where = "WHERE $table_url_rel_user.access_url_id = ".intval($access_url_id);
         }
@@ -335,6 +335,7 @@ class UrlManager
 
         $result = Database::query($sql);
         $courses = Database::store_result($result, 'ASSOC');
+
         return $courses;
     }
 
@@ -584,6 +585,7 @@ class UrlManager
                      course_category_id = ".intval($categoryCourseId);
         $result = Database::query($sql);
         $num = Database::num_rows($result);
+
         return $num;
     }
 
@@ -643,10 +645,10 @@ class UrlManager
                     $count = UrlManager::relation_url_session_exist($session_id, $url_id);
 
                     if ($count == 0) {
-                        $sql    = "INSERT INTO $table_url_rel_session
-		               			SET session_id = ".intval(
-                                $session_id
-                            ).", access_url_id = ".intval($url_id);
+                        $sql = "INSERT INTO $table_url_rel_session
+		               			SET
+		               			session_id = ".intval($session_id).",
+		               			access_url_id = ".intval($url_id);
                         $result = Database::query($sql);
                         if ($result) {
                             $result_array[$url_id][$session_id] = 1;
@@ -1045,8 +1047,6 @@ class UrlManager
         return $url_list;
     }
 
-
-
     /**
      * @param int $courseId
      * @return array
@@ -1064,7 +1064,6 @@ class UrlManager
         return $url_list;
     }
 
-
     /**
      * @param $session_id
      * @return array
@@ -1131,5 +1130,4 @@ class UrlManager
         $response->addAssign('ajax_list_courses', 'innerHTML', api_utf8_encode($return));
         return $response;
     }
-
 }

+ 0 - 1
main/inc/lib/user_api_key_manager.class.php

@@ -8,7 +8,6 @@
  */
 class UserApiKeyManager
 {
-
     /**
      * The name of the default service.
      *