|
@@ -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.
|
|
|
*/
|