@ -31,8 +31,10 @@ switch ($action) {
echo json_encode($result);
echo json_encode($result);
break;
break;
case 'get_user_popup':
case 'get_user_popup':
$courseId = isset($_REQUEST['course_id']) ? (int) $_REQUEST['course_id'] : 0;
$sessionId = isset($_REQUEST['session_id']) ? (int) $_REQUEST['session_id'] : 0;
$user_info = api_get_user_info($_REQUEST['user_id']);
$user_info = api_get_user_info($_REQUEST['user_id']);
$ajax_url = api_get_path(WEB_AJAX_PATH).'message.ajax.php';
$isAnonymous = api_is_anonymous();
$isAnonymous = api_is_anonymous();
echo '< div class = "row" > ';
echo '< div class = "row" > ';
@ -66,13 +68,15 @@ switch ($action) {
echo '< / div > ';
echo '< / div > ';
echo '< / div > ';
echo '< / div > ';
$url = api_get_path(WEB_AJAX_PATH).'message.ajax.php?a=send_message&user_id='.$user_info['user_id'].'&course_id='.$courseId.'&session_id='.$sessionId;
if ($isAnonymous === false & &
if ($isAnonymous === false & &
api_get_setting('allow_message_tool') == 'true'
api_get_setting('allow_message_tool') == 'true'
) {
) {
echo '< script > ' ;
echo '< script > ' ;
echo '
echo '
$("#send_message_link").on("click", function() {
$("#send_message_link").on("click", function() {
var url = "'.$ajax_ url.'?a=send_message&user_id='.$user_info['user_id'].' ";
var url = "'.$url.'";
var params = $("#send_message").serialize();
var params = $("#send_message").serialize();
$.ajax({
$.ajax({
url: url+"& "+params,
url: url+"& "+params,
@ -156,45 +160,45 @@ switch ($action) {
)
)
) {
) {
$user_id = intval($_GET['user_id']);
$user_id = intval($_GET['user_id']);
$status = intval($_GET['status']);
$status = intval($_GET['status']);
if (!empty($user_id)) {
if (!empty($user_id)) {
$user_table = Database::get_main_table(TABLE_MAIN_USER);
$user_table = Database::get_main_table(TABLE_MAIN_USER);
$sql = "UPDATE $user_table
$sql = "UPDATE $user_table
SET active='".$status."'
SET active = '".$status."'
WHERE user_id='".$user_id."'";
WHERE user_id = '".$user_id."'";
$result = Database::query($sql);
$result = Database::query($sql);
//Send and email if account is active
// Send and email if account is active
if ($status == 1) {
if ($status == 1) {
$user_info = api_get_user_info($user_id);
$user_info = api_get_user_info($user_id);
$recipient_n ame = api_get_person_name(
$recipientN ame = api_get_person_name(
$user_info['firstname'],
$user_info['firstname'],
$user_info['lastname'],
$user_info['lastname'],
null,
null,
PERSON_NAME_EMAIL_ADDRESS
PERSON_NAME_EMAIL_ADDRESS
);
);
$emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
$email_admin = api_get_setting('emailAdministrator');
$subject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
$emailAdmin = api_get_setting('emailAdministrator');
$sender_name = api_get_person_name(
$sender_name = api_get_person_name(
api_get_setting('administratorName'),
api_get_setting('administratorName'),
api_get_setting('administratorSurname'),
api_get_setting('administratorSurname'),
null,
null,
PERSON_NAME_EMAIL_ADDRESS
PERSON_NAME_EMAIL_ADDRESS
);
);
$emailbody = get_lang('Dear')." ".stripslashes($recipient_name).",\n\n";
$body = get_lang('Dear')." ".stripslashes($recipientName).",\n\n";
$body .= sprintf(
$emailbody .= sprintf(
get_lang('YourAccountOnXHasJustBeenApprovedByOneOfOurAdministrators'),
get_lang('YourAccountOnXHasJustBeenApprovedByOneOfOurAdministrators'),
api_get_setting('siteName')
api_get_setting('siteName')
)."\n";
)."\n";
$email body .= sprintf(
$body .= sprintf(
get_lang('YouCanNowLoginAtXUsingTheLoginAndThePasswordYouHaveProvided'),
get_lang('YouCanNowLoginAtXUsingTheLoginAndThePasswordYouHaveProvided'),
api_get_path(WEB_PATH)
api_get_path(WEB_PATH)
).",\n\n";
).",\n\n";
$email body .= get_lang('HaveFun')."\n\n";
$body .= get_lang('HaveFun')."\n\n";
//$email body.=get_lang('Problem'). "\n\n". get_lang('SignatureFormula');
//$body.=get_lang('Problem'). "\n\n". get_lang('SignatureFormula');
$email body .= api_get_person_name(
$body .= api_get_person_name(
api_get_setting('administratorName'),
api_get_setting('administratorName'),
api_get_setting('administratorSurname')
api_get_setting('administratorSurname')
)."\n".
)."\n".
@ -207,17 +211,27 @@ switch ($action) {
'userId' => $user_id
'userId' => $user_id
);
);
$result = api_mail_html(
MessageManager::send_message_simple(
$recipient_name,
$user_id,
$subject,
$body,
null,
false,
false,
$additionalParameters
);
/*$result = api_mail_html(
$recipientName,
$user_info['mail'],
$user_info['mail'],
$emailsubject,
$subject,
$emailbody,
$body,
$sender_name,
$sender_name,
$email_admin,
$emailA dmin,
null,
null,
null,
null,
$additionalParameters
$additionalParameters
);
);*/
Event::addEvent(LOG_USER_ENABLE, LOG_USER_ID, $user_id);
Event::addEvent(LOG_USER_ENABLE, LOG_USER_ID, $user_id);
} else {
} else {
Event::addEvent(LOG_USER_DISABLE, LOG_USER_ID, $user_id);
Event::addEvent(LOG_USER_DISABLE, LOG_USER_ID, $user_id);