|
|
|
@ -13,19 +13,16 @@ |
|
|
|
|
*/ |
|
|
|
|
/* INIT SECTION */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$TABLETRACK_LOGIN = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
|
|
|
$TABLETRACK_OPEN = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_OPEN); |
|
|
|
|
$TABLETRACK_ACCESS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
|
|
|
$course_tracking_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
|
|
|
$TABLETRACK_DOWNLOADS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
|
|
|
$TABLETRACK_UPLOADS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_UPLOADS); |
|
|
|
|
$TABLETRACK_UPLOADS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_UPLOADS); |
|
|
|
|
$TABLETRACK_LINKS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LINKS); |
|
|
|
|
$TABLETRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); |
|
|
|
|
//$TABLETRACK_SUBSCRIPTIONS = $_configuration['statistics_database'].".track_e_subscriptions"; // this table is never use |
|
|
|
|
$TABLETRACK_LASTACCESS = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS); //for "what's new" notification |
|
|
|
|
$TABLETRACK_DEFAULT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_DEFAULT); |
|
|
|
|
$TABLETRACK_DEFAULT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_DEFAULT); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* FUNCTIONS */ |
|
|
|
@ -563,7 +560,6 @@ function exercise_attempt_hotspot($exe_id, $question_id, $answer_id, $correct, $ |
|
|
|
|
* @param string Course code (defaults to null) |
|
|
|
|
*/ |
|
|
|
|
function event_system($event_type, $event_value_type, $event_value, $datetime = null, $user_id = null, $course_code = null) { |
|
|
|
|
global $_user; |
|
|
|
|
global $TABLETRACK_DEFAULT; |
|
|
|
|
|
|
|
|
|
$event_type = Database::escape_string($event_type); |
|
|
|
@ -586,25 +582,27 @@ function event_system($event_type, $event_value_type, $event_value, $datetime = |
|
|
|
|
|
|
|
|
|
$event_value = Database::escape_string($event_value); |
|
|
|
|
$user_id = Database::escape_string($user_id); |
|
|
|
|
$course_code = Database::escape_string($course_code); |
|
|
|
|
|
|
|
|
|
$course_info = api_get_course_info($course_code); |
|
|
|
|
|
|
|
|
|
$course_id = null; |
|
|
|
|
$course_code = null; |
|
|
|
|
|
|
|
|
|
if (!empty($course_info)) { |
|
|
|
|
$course_id = $course_info['real_id']; |
|
|
|
|
$course_code = $course_info['code']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$course_code = Database::escape_string($course_code); |
|
|
|
|
|
|
|
|
|
if (!isset($datetime)) { |
|
|
|
|
$datetime = api_get_utc_datetime(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$datetime = Database::escape_string($datetime); |
|
|
|
|
|
|
|
|
|
if(!isset($user_id)) { |
|
|
|
|
$user_id = 0; |
|
|
|
|
} |
|
|
|
|
if(!isset($course_code)) { |
|
|
|
|
$course_code = ''; |
|
|
|
|
if (!isset($user_id)) { |
|
|
|
|
$user_id = api_get_user_id(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$sql = "INSERT INTO $TABLETRACK_DEFAULT |
|
|
|
@ -625,7 +623,7 @@ function event_system($event_type, $event_value_type, $event_value, $datetime = |
|
|
|
|
'$event_value')"; |
|
|
|
|
$res = Database::query($sql); |
|
|
|
|
|
|
|
|
|
//Sending notifications to users |
|
|
|
|
//Sending notifications to users @todo check this |
|
|
|
|
$send_event_setting = api_get_setting('activate_send_event_by_mail'); |
|
|
|
|
if (!empty($send_event_setting) && $send_event_setting == 'true') { |
|
|
|
|
global $language_file; |
|
|
|
@ -635,13 +633,13 @@ function event_system($event_type, $event_value_type, $event_value, $datetime = |
|
|
|
|
$mail_body=$message; |
|
|
|
|
if (is_array($notification_infos)) { |
|
|
|
|
foreach ($notification_infos as $variable => $value) { |
|
|
|
|
$mail_body = str_replace('%'.$variable.'%',$value,$mail_body); |
|
|
|
|
$mail_body = str_replace('%'.$variable.'%',$value,$mail_body); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//prepare mail common variables |
|
|
|
|
if(empty($subject)) { |
|
|
|
|
$subject = $event_type; |
|
|
|
|
if (empty($subject)) { |
|
|
|
|
$subject = $event_type; |
|
|
|
|
} |
|
|
|
|
$mail_subject = '['.api_get_setting('siteName').'] '.$subject; |
|
|
|
|
$sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); |
|
|
|
|