Bladeren bron

Minor - format code, remove unused code

Julio Montoya 5 jaren geleden
bovenliggende
commit
4dcea2493f
3 gewijzigde bestanden met toevoegingen van 8 en 83 verwijderingen
  1. 4 73
      main/inc/lib/events.lib.php
  2. 3 0
      main/mySpace/access_details.php
  3. 1 10
      plugin/bbb/lib/bbb.lib.php

+ 4 - 73
main/inc/lib/events.lib.php

@@ -1651,7 +1651,7 @@ class Event
             $userId = (int) $userId;
             $sql .= " AND exe_user_id = $userId ";
         }
-        $sql .= " ORDER BY exe_id";
+        $sql .= ' ORDER BY exe_id';
 
         $res = Database::query($sql);
         $list = [];
@@ -1775,42 +1775,6 @@ class Event
         return $row['count'];
     }
 
-    /**
-     * Gets all exercise BEST results attempts (NO Exercises in LPs)
-     * from a given exercise id, course, session per user.
-     *
-     * @param   int     exercise id
-     * @param   int   course id
-     * @param   int     session id
-     *
-     * @return array with the results
-     */
-    public static function get_count_exercises_attempted_by_course(
-        $courseId,
-        $session_id = 0
-    ) {
-        $table_track_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
-        $courseId = (int) $courseId;
-        $session_id = (int) $session_id;
-
-        $sql = "SELECT DISTINCT exe_exo_id, exe_user_id
-                FROM $table_track_exercises
-                WHERE
-                    status = '' AND
-                    c_id = $courseId AND
-                    session_id = $session_id AND
-                    orig_lp_id = 0 AND
-                    orig_lp_item_id = 0
-                ORDER BY exe_id";
-        $res = Database::query($sql);
-        $count = 0;
-        if (Database::num_rows($res) > 0) {
-            $count = Database::num_rows($res);
-        }
-
-        return $count;
-    }
-
     /**
      * Gets all exercise events from a Learning Path within a Course    nd Session.
      *
@@ -1877,12 +1841,12 @@ class Event
                 ORDER BY parent_item_id, display_order";
         $res = Database::query($sql);
 
-        $my_exercise_list = [];
+        $list = [];
         while ($row = Database::fetch_array($res, 'ASSOC')) {
-            $my_exercise_list[] = $row;
+            $list[] = $row;
         }
 
-        return $my_exercise_list;
+        return $list;
     }
 
     /**
@@ -2340,39 +2304,6 @@ class Event
         EventsMail::send_mail($event_name, $params);
     }
 
-    /**
-     * Internal function checking if the mail was already sent from that user to that user.
-     *
-     * @param string $event_name
-     * @param int    $user_from
-     * @param int    $user_to
-     *
-     * @return bool
-     */
-    public static function check_if_mail_already_sent(
-        $event_name,
-        $user_from,
-        $user_to = null
-    ) {
-        if ($user_to == null) {
-            $sql = 'SELECT COUNT(*) as total 
-                    FROM '.Database::get_main_table(TABLE_EVENT_SENT).'
-                    WHERE 
-                        user_from = '.$user_from.' AND 
-                        event_type_name = "'.$event_name.'"';
-        } else {
-            $sql = 'SELECT COUNT(*) as total 
-                    FROM '.Database::get_main_table(TABLE_EVENT_SENT).'
-                    WHERE 
-                        user_from = '.$user_from.' AND 
-                        user_to = '.$user_to.' AND 
-                        event_type_name = "'.$event_name.'"';
-        }
-        $result = Database::store_result(Database::query($sql), 'ASSOC');
-
-        return $result[0]["total"];
-    }
-
     /**
      * Filter EventEmailTemplate Filters see the main/inc/conf/events.conf.dist.php.
      */

+ 3 - 0
main/mySpace/access_details.php

@@ -35,6 +35,9 @@ $session_id = (int) $_GET['id_session'];
 $type = isset($_REQUEST['type']) ? Security::remove_XSS($_REQUEST['type']) : '';
 $course_code = isset($_REQUEST['course']) ? Security::remove_XSS($_REQUEST['course']) : '';
 $courseInfo = api_get_course_info($course_code);
+if (empty($courseInfo)) {
+    api_not_allowed(true);
+}
 $courseId = (!empty($courseInfo['real_id']) ? $courseInfo['real_id'] : null);
 $quote_simple = "'";
 

+ 1 - 10
plugin/bbb/lib/bbb.lib.php

@@ -331,11 +331,6 @@ class bbb
         // Each simultaneous conference room needs to have a different
         // voice_bridge composed of a 5 digits number, so generating a random one
         $params['voice_bridge'] = rand(10000, 99999);
-
-        if ($this->debug) {
-            error_log("enter create_meeting ".print_r($params, 1));
-        }
-
         $params['created_at'] = api_get_utc_datetime();
         $params['access_url'] = $this->accessUrl;
 
@@ -350,10 +345,6 @@ class bbb
         $id = Database::insert($this->table, $params);
 
         if ($id) {
-            if ($this->debug) {
-                error_log("create_meeting: $id ");
-            }
-
             $meetingName = isset($params['meeting_name']) ? $params['meeting_name'] : $this->getCurrentVideoConferenceName();
             $welcomeMessage = isset($params['welcome_msg']) ? $params['welcome_msg'] : null;
             $record = isset($params['record']) && $params['record'] ? 'true' : 'false';
@@ -374,7 +365,7 @@ class bbb
                 'maxParticipants' => $max, // Optional. -1 = unlimitted. Not supported in BBB. [number]
                 'record' => $record, // New. 'true' will tell BBB to record the meeting.
                 'duration' => $duration, // Default = 0 which means no set duration in minutes. [number]
-                //'meta_category' => '', 				// Use to pass additional info to BBB server. See API docs.
+                //'meta_category' => '',  // Use to pass additional info to BBB server. See API docs.
             );
 
             $status = false;