Jelajahi Sumber

Minor - Code style - Use "self" instead of classname within the class and remove spaces around :: operator

Yannick Warnier 8 tahun lalu
induk
melakukan
192c073954

+ 5 - 5
main/gradebook/lib/be/abstractlink.class.php

@@ -238,7 +238,7 @@ abstract class AbstractLink implements GradebookItem
         $category_id = null,
         $visible = null
     ) {
-        $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
+        $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
         $sql = 'SELECT * FROM '.$tbl_grade_links;
         $paramcount = 0;
         if (isset($id)) {
@@ -294,7 +294,7 @@ abstract class AbstractLink implements GradebookItem
         }
 
         $result = Database::query($sql);
-        $links = AbstractLink::create_objects_from_sql_result($result);
+        $links = self::create_objects_from_sql_result($result);
 
         return $links;
     }
@@ -388,7 +388,7 @@ abstract class AbstractLink implements GradebookItem
             return;
         }
 
-        AbstractLink::add_link_log($this->id);
+        self::add_link_log($this->id);
 
         $this->save_linked_data();
 
@@ -411,7 +411,7 @@ abstract class AbstractLink implements GradebookItem
     public static function add_link_log($idevaluation, $nameLog = null)
     {
         $table = Database:: get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);
-        $dateobject = AbstractLink::load($idevaluation, null, null, null, null);
+        $dateobject = self::load($idevaluation, null, null, null, null);
         $current_date_server = api_get_utc_datetime();
         $arreval = get_object_vars($dateobject[0]);
         $description_log = isset($arreval['description']) ? $arreval['description']:'';
@@ -446,7 +446,7 @@ abstract class AbstractLink implements GradebookItem
     public function delete()
     {
         $this->delete_linked_data();
-        $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
+        $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
         $sql = 'DELETE FROM '.$tbl_grade_links.'
                 WHERE id = '.intval($this->id);
         Database::query($sql);

+ 6 - 6
main/gradebook/lib/be/forumthreadlink.class.php

@@ -48,7 +48,7 @@ class ForumThreadLink extends AbstractLink
             return [];
         }
 
-        $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
+        $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
         $sql = 'SELECT thread_id,thread_title,thread_title_qualify 
                 FROM '.$this->get_forum_thread_table().'
 			    forum_thread WHERE thread_id NOT IN
@@ -86,8 +86,8 @@ class ForumThreadLink extends AbstractLink
 			return [];
 		}
 
-		$tbl_grade_links 	= Database :: get_course_table(TABLE_FORUM_THREAD);
-		$tbl_item_property	= Database :: get_course_table(TABLE_ITEM_PROPERTY);
+		$tbl_grade_links 	= Database::get_course_table(TABLE_FORUM_THREAD);
+		$tbl_item_property	= Database::get_course_table(TABLE_ITEM_PROPERTY);
 		$session_id = api_get_session_id();
 
 		if ($session_id) {
@@ -126,7 +126,7 @@ class ForumThreadLink extends AbstractLink
     */
     public function has_results()
     {
-        $table = Database :: get_course_table(TABLE_FORUM_POST);
+        $table = Database::get_course_table(TABLE_FORUM_POST);
 
         $sql = "SELECT count(*) AS number FROM $table
                 WHERE
@@ -161,7 +161,7 @@ class ForumThreadLink extends AbstractLink
         );
 
         $sql = 'SELECT thread_qualify_max
-                FROM '.Database :: get_course_table(TABLE_FORUM_THREAD)."
+                FROM '.Database::get_course_table(TABLE_FORUM_THREAD)."
                 WHERE 
                     c_id = ".$this->course_id." AND 
                     thread_id = '".$this->get_ref_id()."'
@@ -264,7 +264,7 @@ class ForumThreadLink extends AbstractLink
      */
     private function get_forum_thread_table()
     {
-        return $this->forum_thread_table = Database :: get_course_table(TABLE_FORUM_THREAD);
+        return $this->forum_thread_table = Database::get_course_table(TABLE_FORUM_THREAD);
     }
 
     public function needs_name_and_description()

+ 6 - 6
main/gradebook/lib/scoredisplay.class.php

@@ -41,7 +41,7 @@ class ScoreDisplay
         } elseif (!isset($score2)) {
             return -1;
         } else {
-            $scoredisplay = ScoreDisplay :: instance();
+            $scoredisplay = ScoreDisplay::instance();
             $custom1 = $scoredisplay->display_custom($score1);
             $custom2 = $scoredisplay->display_custom($score2);
             if ($custom1 == $custom2) {
@@ -169,7 +169,7 @@ class ScoreDisplay
      */
     private function get_current_gradebook_category_id()
     {
-        $tbl_gradebook_category = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
+        $tbl_gradebook_category = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
         $curr_course_code = api_get_course_id();
         $curr_session_id = api_get_session_id();
 
@@ -209,7 +209,7 @@ class ScoreDisplay
         }
 
         // remove previous settings
-        $table = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY);
+        $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY);
         $sql = 'DELETE FROM '.$table.' WHERE category_id = '.$category_id;
         Database::query($sql);
 
@@ -248,7 +248,7 @@ class ScoreDisplay
             100 => get_lang('GradebookExcellent')
         );
 
-        $tbl_display = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY);
+        $tbl_display = Database::get_main_table(TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY);
         foreach($display as $value => $text) {
             $params = array(
                 'score' => $value,
@@ -472,7 +472,7 @@ class ScoreDisplay
      */
     private function get_score_color_percent($category_id = null)
     {
-        $tbl_display = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY);
+        $tbl_display = Database::get_main_table(TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY);
         if (isset($category_id)) {
             $category_id = intval($category_id);
         } else {
@@ -499,7 +499,7 @@ class ScoreDisplay
      */
     private function get_custom_displays($category_id = null)
     {
-        $tbl_display = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY);
+        $tbl_display = Database::get_main_table(TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY);
         if (isset($category_id)) {
             $category_id = intval($category_id);
         } else {

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

@@ -1554,6 +1554,7 @@ class Skill extends Model
 
                     return true;
                 }
+                break;
             case DRH:
                 return UserManager::is_user_followed_by_drh($toUser->getId(), $fromUser->getId());
         }

+ 6 - 6
main/inc/lib/table_sort.class.php

@@ -39,11 +39,11 @@ class TableSort
         }
 
         if ($type == SORT_REGULAR) {
-            if (TableSort::is_image_column($data, $column)) {
+            if (self::is_image_column($data, $column)) {
                 $type = SORT_IMAGE;
-            } elseif (TableSort::is_date_column($data, $column)) {
+            } elseif (self::is_date_column($data, $column)) {
                 $type = SORT_DATE;
-            } elseif (TableSort::is_numeric_column($data, $column)) {
+            } elseif (self::is_numeric_column($data, $column)) {
                 $type = SORT_NUMERIC;
             } else {
                 $type = SORT_STRING;
@@ -114,11 +114,11 @@ class TableSort
         }
 
         if ($type == SORT_REGULAR) {
-            if (TableSort::is_image_column($data, $column)) {
+            if (self::is_image_column($data, $column)) {
                 $type = SORT_IMAGE;
-            } elseif (TableSort::is_date_column($data, $column)) {
+            } elseif (self::is_date_column($data, $column)) {
                 $type = SORT_DATE;
-            } elseif (TableSort::is_numeric_column($data, $column)) {
+            } elseif (self::is_numeric_column($data, $column)) {
                 $type = SORT_NUMERIC;
             } else {
                 $type = SORT_STRING;

+ 6 - 6
main/inc/lib/thematic.lib.php

@@ -40,7 +40,7 @@ class Thematic
      */
     public function get_number_of_thematics()
     {
-        $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC);
+        $tbl_thematic = Database::get_course_table(TABLE_THEMATIC);
         $condition_session = '';
         if (!api_get_session_id()) {
             $condition_session = api_get_session_condition(0);
@@ -65,7 +65,7 @@ class Thematic
      */
     public function get_thematic_data($from, $number_of_items, $column, $direction)
     {
-        $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC);
+        $tbl_thematic = Database::get_course_table(TABLE_THEMATIC);
         $condition_session = '';
         if (!api_get_session_id()) {
             $condition_session = api_get_session_condition(0);
@@ -157,7 +157,7 @@ class Thematic
     public function get_max_thematic_item($use_session = true)
     {
         // Database table definition
-        $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC);
+        $tbl_thematic = Database::get_course_table(TABLE_THEMATIC);
         $session_id   = api_get_session_id();
         if ($use_session) {
             $condition_session = api_get_session_condition($session_id);
@@ -183,7 +183,7 @@ class Thematic
     public function move_thematic($direction, $thematic_id)
     {
         // Database table definition
-        $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC);
+        $tbl_thematic = Database::get_course_table(TABLE_THEMATIC);
 
         // sort direction
         if ($direction == 'up') {
@@ -469,7 +469,7 @@ class Thematic
     public static function get_number_of_thematic_advances()
     {
         global $thematic_id;
-        $tbl_thematic_advance = Database :: get_course_table(TABLE_THEMATIC_ADVANCE);
+        $tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
         $course_id = api_get_course_int_id();
 
         $sql = "SELECT COUNT(id) AS total_number_of_items 
@@ -493,7 +493,7 @@ class Thematic
     public static function get_thematic_advance_data($from, $number_of_items, $column, $direction)
     {
         global $thematic_id;
-        $tbl_thematic_advance = Database :: get_course_table(TABLE_THEMATIC_ADVANCE);
+        $tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
         $column = intval($column);
         $from   = intval($from);
         $number_of_items = intval($number_of_items);

+ 18 - 12
main/lp/openoffice_document.class.php

@@ -132,14 +132,17 @@ abstract class OpenofficeDocument extends learnpath
 
             if ($return != 0) { // If the java application returns an error code.
                 switch ($return) {
-                    // Can't connect to openoffice.
-                    case 1: $this->error = get_lang('CannotConnectToOpenOffice');
+                    case 1:
+                        // Can't connect to openoffice.
+                        $this->error = get_lang('CannotConnectToOpenOffice');
                         break;
-                    // Conversion failed in openoffice.
-                    case 2: $this->error = get_lang('OogieConversionFailed');
+                    case 2:
+                        // Conversion failed in openoffice.
+                        $this->error = get_lang('OogieConversionFailed');
                         break;
-                    // Conversion can't be launch because command failed.
-                    case 255: $this->error = get_lang('OogieUnknownError');
+                    case 255:
+                        // Conversion can't be launch because command failed.
+                        $this->error = get_lang('OogieUnknownError');
                         break;
                 }
                 DocumentManager::delete_document($_course, $this->created_dir, $this->base_work_dir);
@@ -311,14 +314,17 @@ abstract class OpenofficeDocument extends learnpath
 
             if ($return != 0) { // If the java application returns an error code.
                 switch ($return) {
-                    // Can't connect to openoffice.
-                    case 1: $this->error = get_lang('CannotConnectToOpenOffice');
+                    case 1:
+                        // Can't connect to openoffice.
+                        $this->error = get_lang('CannotConnectToOpenOffice');
                         break;
-                    // Conversion failed in openoffice.
-                    case 2: $this->error = get_lang('OogieConversionFailed');
+                    case 2:
+                        // Conversion failed in openoffice.
+                        $this->error = get_lang('OogieConversionFailed');
                         break;
-                    // Conversion can't be launch because command failed.
-                    case 255: $this->error = get_lang('OogieUnknownError');
+                    case 255:
+                        // Conversion can't be launch because command failed.
+                        $this->error = get_lang('OogieUnknownError');
                         break;
                 }
                 DocumentManager::delete_document($_course, $this->created_dir, $this->base_work_dir);

+ 7 - 7
main/wiki/wiki.inc.php

@@ -1736,7 +1736,7 @@ class Wiki
         $session_id=api_get_session_id();
         $course_id = api_get_course_int_id();
 
-        $group_properties  = GroupManager :: get_group_properties($groupId);
+        $group_properties  = GroupManager::get_group_properties($groupId);
         $group_name = $group_properties['name'];
         $allow_send_mail = false; //define the variable to below
         $email_assignment = null;
@@ -1972,7 +1972,7 @@ class Wiki
 
         if (0 != $groupId) {
             $groupPart = '_group' . $groupId; // and add groupId to put the same document title in different groups
-            $group_properties  = GroupManager :: get_group_properties($groupId);
+            $group_properties  = GroupManager::get_group_properties($groupId);
             $groupPath = $group_properties['directory'];
         } else {
             $groupPart = '';
@@ -2119,8 +2119,8 @@ class Wiki
             }
         } else {
             //extract group members
-            $subscribed_users = GroupManager :: get_subscribed_users($groupInfo['iid']);
-            $subscribed_tutors = GroupManager :: get_subscribed_tutors($groupInfo['iid']);
+            $subscribed_users = GroupManager::get_subscribed_users($groupInfo['iid']);
+            $subscribed_tutors = GroupManager::get_subscribed_tutors($groupInfo['iid']);
             $a_users_to_add_with_duplicates = array_merge($subscribed_users, $subscribed_tutors);
 
             //remove duplicates
@@ -3540,7 +3540,7 @@ class Wiki
                 }//end discuss lock
 
                 echo '<hr noshade size="1">';
-                $user_table = Database :: get_main_table(TABLE_MAIN_USER);
+                $user_table = Database::get_main_table(TABLE_MAIN_USER);
 
                 $sql = "SELECT *
                         FROM $tbl_wiki_discuss reviews, $user_table user
@@ -4248,7 +4248,7 @@ class Wiki
                 //Only teacher, platform admin and group members can edit a wiki group
                 if (api_is_allowed_to_edit(false,true) ||
                     api_is_platform_admin() ||
-                    GroupManager :: is_user_in_group($userId, $groupInfo['iid']) ||
+                    GroupManager::is_user_in_group($userId, $groupInfo['iid']) ||
                     api_is_allowed_in_course()
                 ) {
                     $PassEdit = true;
@@ -4880,7 +4880,7 @@ class Wiki
                 //Only teacher, platform admin and group members can edit a wiki group
                 if (api_is_allowed_to_edit(false,true) ||
                     api_is_platform_admin() ||
-                    GroupManager :: is_user_in_group($userId, $groupInfo['iid'])
+                    GroupManager::is_user_in_group($userId, $groupInfo['iid'])
                 ) {
                     $PassEdit = true;
                 } else {