Confirm session subscription - refs BT#9889 #TMI

1.10.x
Angel Fernando Quiroz Campos 9 years ago
parent 064b96d574
commit 141be5d9d1
  1. 16
      main/auth/courses.php
  2. 27
      main/auth/courses_controller.php
  3. 9
      main/template/default/auth/confirm_session_subscription.tpl
  4. 2
      main/template/default/layout/head.tpl

@ -211,9 +211,21 @@ switch ($action) {
break;
case 'subscribe_to_session':
$userId = api_get_user_id();
$confirmed = isset($_GET['confirm']);
$sessionId = intval($_GET['session_id']);
if (empty($userId)) {
header('Location: ' . api_get_path(WEB_PATH));
api_not_allowed();
exit;
}
if (!$confirmed) {
$template = new Template(null, false, false, false, false, false);
$template->assign('session_id', $sessionId);
$layout = $template->get_template('auth/confirm_session_subscription.tpl');
echo $template->fetch($layout);
exit;
}
@ -223,7 +235,7 @@ switch ($action) {
$repository = $entityManager->getRepository('ChamiloCoreBundle:SequenceResource');
$sequences = $repository->getRequirements(
$_GET['session_id'],
$sessionId,
SequenceResource::SESSION_TYPE
);

@ -534,23 +534,32 @@ class CoursesController
$url .= 'auth/courses.php?';
$url .= http_build_query([
'action' => 'subscribe_to_session',
'session_id' => intval($sessionId)
'session_id' => intval($sessionId),
'modal_size' => 'md'
]);
$result = Display::toolbarButton(
get_lang('Subscribe'),
$url,
'check-circle',
'primary',
['class' => 'btn-lg btn-block ajax']
);
} else {
$url .= 'inc/email_editor.php?';
$url .= http_build_query([
'action' => 'subscribe_me_to_session',
'session' => Security::remove_XSS($sessionName)
]);
}
$result = Display::toolbarButton(
get_lang('Subscribe'),
$url,
'check-circle',
'primary',
['class' => 'btn-lg btn-block']
);
$result = Display::toolbarButton(
get_lang('Subscribe'),
$url,
'check-circle',
'primary',
['class' => 'btn-lg btn-block']
);
}
$hook = HookResubscribe::create();
if (!empty($hook)) {

@ -0,0 +1,9 @@
<p class="text-center lead">{{ 'AreYouSureToSubscribe'|get_lang }}</p>
<div class="row">
<div class="col-sm-3 col-sm-offset-3">
<a href="{{ _p.web_main }}auth/courses.php?{{ {'action':'subscribe_to_session', 'session_id':session_id, 'confirm':'1'}|url_encode() }}" class="btn btn-success btn-block">{{ 'Yes'|get_lang }}</a>
</div>
<div class="col-sm-3">
<button type="button" class="btn btn-danger btn-block" data-dismiss="modal">{{ 'No'|get_lang }}</button>
</div>
</div>

@ -349,7 +349,7 @@ $(function() {
});
// Global popup
$('a.ajax').on('click', function(e) {
$('body').on('click', 'a.ajax', function(e) {
e.preventDefault();
var contentUrl = this.href,

Loading…
Cancel
Save