Browse Source

Minor - fixes from ofaj_dev

Julio 6 years ago
parent
commit
6d912ac390

+ 2 - 3
main/inc/lib/api.lib.php

@@ -1906,7 +1906,7 @@ function api_get_anonymous_id()
     $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
     $tableU = Database::get_main_table(TABLE_MAIN_USER);
     $ip = Database::escape_string(api_get_real_ip());
-    $max = api_get_configuration_value('max_anonymous_users');
+    $max = (int) api_get_configuration_value('max_anonymous_users');
     if ($max >= 2) {
         $sql = "SELECT * FROM $table as TEL 
                 JOIN $tableU as U
@@ -1919,7 +1919,7 @@ function api_get_anonymous_id()
         if (empty(Database::num_rows($result))) {
             $login = uniqid('anon_');
             $anonList = UserManager::get_user_list(['status' => ANONYMOUS], ['registration_date ASC']);
-            if (count($anonList) == $max) {
+            if (count($anonList) >= $max) {
                 foreach ($anonList as $userToDelete) {
                     UserManager::delete_user($userToDelete['user_id']);
                     break;
@@ -3327,7 +3327,6 @@ function api_is_allowed_to_edit(
     $check_student_view = true
 ) {
     $allowSessionAdminEdit = api_get_configuration_value('session_admins_edit_courses_content') === true;
-
     // Admins can edit anything.
     if (api_is_platform_admin($allowSessionAdminEdit)) {
         //The student preview was on

+ 14 - 14
main/inc/lib/extra_field.lib.php

@@ -1379,13 +1379,13 @@ class ExtraField extends Model
                                             continue;
                                         }
                                         $tagsSelect->addOption(
-                                        $tag['tag'],
+                                            $tag['tag'],
                                             $tag['tag'],
                                             [
                                                 'selected' => 'selected',
                                                 'class' => 'selected',
                                             ]
-                                    );
+                                        );
                                         $selectedOptions[] = $tag['tag'];
                                     }
                                 }
@@ -1411,9 +1411,9 @@ class ExtraField extends Model
                                         continue;
                                     }
                                     $tagsSelect->addOption(
-                                    $tag->getTag(),
-                                    $tag->getTag()
-                                );
+                                        $tag->getTag(),
+                                        $tag->getTag()
+                                    );
                                     $selectedOptions[] = $tag->getTag();
                                 }
 
@@ -1433,7 +1433,7 @@ class ExtraField extends Model
                                     $fieldTags = $em->getRepository('ChamiloCoreBundle:ExtraFieldRelTag')
                                         ->findBy(
                                             [
-                                        'fieldId' => $field_id,
+                                                'fieldId' => $field_id,
                                             ]
                                         );
                                     $tagsAdded = [];
@@ -1451,10 +1451,10 @@ class ExtraField extends Model
                                         }
 
                                         $tagsSelect->addOption(
-                                        $tag->getTag(),
-                                        $tag->getTag(),
-                                        []
-                                    );
+                                            $tag->getTag(),
+                                            $tag->getTag(),
+                                            []
+                                        );
 
                                         $tagsAdded[] = $tagText;
                                     }
@@ -1463,10 +1463,10 @@ class ExtraField extends Model
                             }
 
                             $form->setDefaults(
-                            [
-                                'extra_'.$field_details['variable'] => $selectedOptions,
-                            ]
-                        );
+                                [
+                                    'extra_'.$field_details['variable'] => $selectedOptions,
+                                ]
+                            );
 
                             if ($useTagAsSelect == false) {
                                 $jquery_ready_content .= "

+ 3 - 1
main/inc/lib/groupmanager.lib.php

@@ -1,6 +1,8 @@
 <?php
 /* For licensing terms, see /license.txt */
 
+use Chamilo\CourseBundle\Entity\CGroupRelUser;
+
 /**
  * This library contains some functions for group-management.
  *
@@ -1345,7 +1347,7 @@ class GroupManager
             ->getResult();
 
         $users = [];
-
+        /** @var CGroupRelUser $subscription */
         foreach ($subscriptions as $subscription) {
             $users[] = api_get_user_info($subscription['id']);
         }

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

@@ -7730,7 +7730,7 @@ SQL;
             case 1:
                 return get_lang('ReadOnly');
             case 2:
-               return get_lang('Visible');
+                return get_lang('Visible');
             case 3:
                 return api_ucfirst(get_lang('Invisible'));
         }