|
|
|
@ -19,6 +19,81 @@ $this_section = SECTION_COURSES; |
|
|
|
|
|
|
|
|
|
$htmlHeadXtra[] = api_get_asset('qtip2/jquery.qtip.min.js'); |
|
|
|
|
$htmlHeadXtra[] = api_get_css_asset('qtip2/jquery.qtip.min.css'); |
|
|
|
|
$htmlHeadXtra[] = " |
|
|
|
|
<div class=\"modal fade\" id=\"NotificarUsuarios\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\"> |
|
|
|
|
<div class=\"modal-dialog\" role=\"document\"> |
|
|
|
|
<div class=\"modal-content\"> |
|
|
|
|
<div class=\"modal-header\"> |
|
|
|
|
<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"> |
|
|
|
|
<span aria-hidden=\"true\">×</span></button> |
|
|
|
|
<h4 class=\"modal-title\" id=\"myModalLabel\"> |
|
|
|
|
|
|
|
|
|
</h4> |
|
|
|
|
</div> |
|
|
|
|
<div class=\"modal-body\"> |
|
|
|
|
<form action=\"#\" class=\"form-horizontal\"> |
|
|
|
|
<div class='col-md-6'> |
|
|
|
|
".get_lang('EmailNotifySubscription')." |
|
|
|
|
</div> |
|
|
|
|
<div class='col-md-6'> |
|
|
|
|
<select |
|
|
|
|
class=\"selectpicker form-control\" |
|
|
|
|
multiple=\"multiple\" |
|
|
|
|
id=\"toUsers\" |
|
|
|
|
name=\"toUsers\" |
|
|
|
|
> |
|
|
|
|
<option value=\"\">-</option> |
|
|
|
|
</select> |
|
|
|
|
</div> |
|
|
|
|
<input class='hidden' id='urlTo' type='hidden'> |
|
|
|
|
</form> |
|
|
|
|
<div class='clearfix clear-fix'></div> |
|
|
|
|
</div> |
|
|
|
|
<div class=\"modal-footer\"> |
|
|
|
|
<button type=\"button\" class=\"btn btn-default\" onclick='sendNotificationToUsers()' data-dismiss=\"modal\">".get_lang('SendMailToUsers')." |
|
|
|
|
</button> |
|
|
|
|
<button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">".get_lang('Close')." |
|
|
|
|
</button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div>"; |
|
|
|
|
$htmlHeadXtra[] = '<script> |
|
|
|
|
function sendNotificationToUsers(){ |
|
|
|
|
var sendTo = $("#toUsers").val().join(","); |
|
|
|
|
var url = $("#urlTo").val() + sendTo; |
|
|
|
|
$("#toUsers").find("option").remove().end().selectpicker("refresh"); |
|
|
|
|
$.ajax({ |
|
|
|
|
url: url, |
|
|
|
|
dataType: "json" |
|
|
|
|
}).done(function(response) { |
|
|
|
|
$("#cm-tools").html(response.message); |
|
|
|
|
}).always(function() { |
|
|
|
|
$("#toUsers").find("option").remove().end().selectpicker("refresh"); |
|
|
|
|
$("#urlTo").val(""); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
function showUserToSendNotificacion(element){ |
|
|
|
|
var url = $(element).data("link"); |
|
|
|
|
$("#toUsers").find("option").remove().end().selectpicker("refresh"); |
|
|
|
|
$("#urlTo").val(""); |
|
|
|
|
$.ajax({ |
|
|
|
|
url: url, |
|
|
|
|
dataType: "json", |
|
|
|
|
}).done(function(response) { |
|
|
|
|
$("#toUsers").find("option").remove().end().selectpicker("refresh"); |
|
|
|
|
$.each(response,function(a,b){ |
|
|
|
|
$("#toUsers").append($("<option>", { |
|
|
|
|
value: b.user_id, |
|
|
|
|
text: b.user_name |
|
|
|
|
})); |
|
|
|
|
}); |
|
|
|
|
$("#urlTo").val($(element).data("link").replace("send_reminder","send_reminder_to") + "&users=") |
|
|
|
|
$("#toUsers").selectpicker("refresh"); |
|
|
|
|
$("#NotificarUsuarios").modal() |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
</script>'; |
|
|
|
|
|
|
|
|
|
api_protect_course_script(true); |
|
|
|
|
|
|
|
|
@ -411,18 +486,39 @@ if ($is_allowedToEdit) { |
|
|
|
|
'confirmation' |
|
|
|
|
)); |
|
|
|
|
break; |
|
|
|
|
case 'send_reminder_to': |
|
|
|
|
$toUsers = isset($_GET['users'])?$_GET['users']:null; |
|
|
|
|
if( |
|
|
|
|
!empty($toUsers) && |
|
|
|
|
!empty($exerciseId) |
|
|
|
|
) { |
|
|
|
|
$toUsers = explode(',',$toUsers); |
|
|
|
|
api_set_more_memory_and_time_limits(); |
|
|
|
|
Exercise::notifyUsersOfTheExercise( |
|
|
|
|
$exerciseId, |
|
|
|
|
$courseId, |
|
|
|
|
$sessionId, |
|
|
|
|
$toUsers |
|
|
|
|
); |
|
|
|
|
echo json_encode([ |
|
|
|
|
'message'=>Display::return_message( |
|
|
|
|
get_lang('AnnounceSentByEmail'), |
|
|
|
|
'confirmation' |
|
|
|
|
), |
|
|
|
|
]); |
|
|
|
|
} |
|
|
|
|
exit(); |
|
|
|
|
break; |
|
|
|
|
case 'send_reminder': |
|
|
|
|
api_set_more_memory_and_time_limits(); |
|
|
|
|
$objExerciseTmp->notifyUsersOfTheExercise( |
|
|
|
|
$exerciseId, |
|
|
|
|
|
|
|
|
|
$users = Exercise::getUsersInExercise( |
|
|
|
|
$objExerciseTmp->id, |
|
|
|
|
$courseId, |
|
|
|
|
$sessionId |
|
|
|
|
); |
|
|
|
|
echo json_encode($users); |
|
|
|
|
exit(); |
|
|
|
|
|
|
|
|
|
Display::addFlash(Display::return_message( |
|
|
|
|
get_lang('AnnounceSentByEmail'), |
|
|
|
|
'confirmation' |
|
|
|
|
)); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
header('Location: '.$currentUrl); |
|
|
|
|