Browse Source

Minor - Flint fixes

Angel Fernando Quiroz Campos 6 years ago
parent
commit
4d3ced3292

+ 2 - 2
main/exercise/overview.php

@@ -251,7 +251,7 @@ if (!empty($attempts)) {
                 RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT,
                 RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK,
                 RESULT_DISABLE_RANKING,
-                RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER
+                RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER,
             ]
         )) {
             $row['result'] = $score;
@@ -265,7 +265,7 @@ if (!empty($attempts)) {
                 RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT,
                 RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK,
                 RESULT_DISABLE_RANKING,
-                RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER
+                RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER,
             ]
         ) || (
             $objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_ONLY &&

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

@@ -294,7 +294,7 @@ class ExerciseShowFunctions
      * Display the answers to a multiple choice question.
      *
      * @param Exercise $exercise
-     * @param int      $feedbackType                Feedback type
+     * @param int      $feedbackType                 Feedback type
      * @param int      $answerType                   Answer type
      * @param int      $studentChoice                Student choice
      * @param string   $answer                       Textual answer

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

@@ -594,8 +594,8 @@ class SessionManager
     /**
      * Gets the admin session list callback of the session/session_list.php page.
      *
-     * @param array $options  order and limit keys
-     * @param bool  $getCount Whether to get all the results or only the count
+     * @param array $options           order and limit keys
+     * @param bool  $getCount          Whether to get all the results or only the count
      * @param array $columns
      * @param array $extraFieldsToLoad
      *

+ 98 - 98
main/inc/lib/usermanager.lib.php

@@ -6473,104 +6473,6 @@ SQL;
         return (int) $row['count'];
     }
 
-    /**
-     * @return EncoderFactory
-     */
-    private static function getEncoderFactory()
-    {
-        $encryption = self::getPasswordEncryption();
-        $encoders = [
-            'Chamilo\\UserBundle\\Entity\\User' => new \Chamilo\UserBundle\Security\Encoder($encryption),
-        ];
-
-        $encoderFactory = new EncoderFactory($encoders);
-
-        return $encoderFactory;
-    }
-
-    /**
-     * @param User $user
-     *
-     * @return \Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface
-     */
-    private static function getEncoder(User $user)
-    {
-        $encoderFactory = self::getEncoderFactory();
-
-        return $encoderFactory->getEncoder($user);
-    }
-
-    /**
-     * Disables or enables a user.
-     *
-     * @param int $user_id
-     * @param int $active  Enable or disable
-     *
-     * @return bool True on success, false on failure
-     * @assert (-1,0) === false
-     * @assert (1,1) === true
-     */
-    private static function change_active_state($user_id, $active)
-    {
-        if (strval(intval($user_id)) != $user_id) {
-            return false;
-        }
-        if ($user_id < 1) {
-            return false;
-        }
-        $user_id = intval($user_id);
-        $table_user = Database::get_main_table(TABLE_MAIN_USER);
-        $sql = "UPDATE $table_user SET active = '$active' WHERE id = $user_id";
-        $r = Database::query($sql);
-        $ev = LOG_USER_DISABLE;
-        if ($active == 1) {
-            $ev = LOG_USER_ENABLE;
-        }
-        if ($r !== false) {
-            Event::addEvent($ev, LOG_USER_ID, $user_id);
-        }
-
-        return $r;
-    }
-
-    /**
-     * Get either a Gravatar URL or complete image tag for a specified email address.
-     *
-     * @param string $email The email address
-     * @param int    $s     Size in pixels, defaults to 80px [ 1 - 2048 ]
-     * @param string $d     Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ]
-     * @param string $r     Maximum rating (inclusive) [ g | pg | r | x ]
-     * @param bool   $img   True to return a complete IMG tag False for just the URL
-     * @param array  $atts  Optional, additional key/value attributes to include in the IMG tag
-     *
-     * @return string containing either just a URL or a complete image tag
-     * @source http://gravatar.com/site/implement/images/php/
-     */
-    private static function getGravatar(
-        $email,
-        $s = 80,
-        $d = 'mm',
-        $r = 'g',
-        $img = false,
-        $atts = []
-    ) {
-        $url = 'http://www.gravatar.com/avatar/';
-        if (!empty($_SERVER['HTTPS'])) {
-            $url = 'https://secure.gravatar.com/avatar/';
-        }
-        $url .= md5(strtolower(trim($email)));
-        $url .= "?s=$s&d=$d&r=$r";
-        if ($img) {
-            $url = '<img src="'.$url.'"';
-            foreach ($atts as $key => $val) {
-                $url .= ' '.$key.'="'.$val.'"';
-            }
-            $url .= ' />';
-        }
-
-        return $url;
-    }
-
     /**
      * @param array $userInfo
      * @param int   $searchYear
@@ -6747,4 +6649,102 @@ SQL;
 
         return $calendar;
     }
+
+    /**
+     * @return EncoderFactory
+     */
+    private static function getEncoderFactory()
+    {
+        $encryption = self::getPasswordEncryption();
+        $encoders = [
+            'Chamilo\\UserBundle\\Entity\\User' => new \Chamilo\UserBundle\Security\Encoder($encryption),
+        ];
+
+        $encoderFactory = new EncoderFactory($encoders);
+
+        return $encoderFactory;
+    }
+
+    /**
+     * @param User $user
+     *
+     * @return \Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface
+     */
+    private static function getEncoder(User $user)
+    {
+        $encoderFactory = self::getEncoderFactory();
+
+        return $encoderFactory->getEncoder($user);
+    }
+
+    /**
+     * Disables or enables a user.
+     *
+     * @param int $user_id
+     * @param int $active  Enable or disable
+     *
+     * @return bool True on success, false on failure
+     * @assert (-1,0) === false
+     * @assert (1,1) === true
+     */
+    private static function change_active_state($user_id, $active)
+    {
+        if (strval(intval($user_id)) != $user_id) {
+            return false;
+        }
+        if ($user_id < 1) {
+            return false;
+        }
+        $user_id = intval($user_id);
+        $table_user = Database::get_main_table(TABLE_MAIN_USER);
+        $sql = "UPDATE $table_user SET active = '$active' WHERE id = $user_id";
+        $r = Database::query($sql);
+        $ev = LOG_USER_DISABLE;
+        if ($active == 1) {
+            $ev = LOG_USER_ENABLE;
+        }
+        if ($r !== false) {
+            Event::addEvent($ev, LOG_USER_ID, $user_id);
+        }
+
+        return $r;
+    }
+
+    /**
+     * Get either a Gravatar URL or complete image tag for a specified email address.
+     *
+     * @param string $email The email address
+     * @param int    $s     Size in pixels, defaults to 80px [ 1 - 2048 ]
+     * @param string $d     Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ]
+     * @param string $r     Maximum rating (inclusive) [ g | pg | r | x ]
+     * @param bool   $img   True to return a complete IMG tag False for just the URL
+     * @param array  $atts  Optional, additional key/value attributes to include in the IMG tag
+     *
+     * @return string containing either just a URL or a complete image tag
+     * @source http://gravatar.com/site/implement/images/php/
+     */
+    private static function getGravatar(
+        $email,
+        $s = 80,
+        $d = 'mm',
+        $r = 'g',
+        $img = false,
+        $atts = []
+    ) {
+        $url = 'http://www.gravatar.com/avatar/';
+        if (!empty($_SERVER['HTTPS'])) {
+            $url = 'https://secure.gravatar.com/avatar/';
+        }
+        $url .= md5(strtolower(trim($email)));
+        $url .= "?s=$s&d=$d&r=$r";
+        if ($img) {
+            $url = '<img src="'.$url.'"';
+            foreach ($atts as $key => $val) {
+                $url .= ' '.$key.'="'.$val.'"';
+            }
+            $url .= ' />';
+        }
+
+        return $url;
+    }
 }