Merge branch 'BT9461' of https://github.com/danbarretodev/chamilo-lms into danbarretodev-BT9461
commit
2df08d064e
@ -0,0 +1,25 @@ |
|||||||
|
<?php |
||||||
|
/* For license terms, see /license.txt */ |
||||||
|
/** |
||||||
|
* Render an email from data |
||||||
|
* @package chamilo.plugin.advanced_subscription |
||||||
|
*/ |
||||||
|
|
||||||
|
/** |
||||||
|
* Init |
||||||
|
*/ |
||||||
|
require_once __DIR__ . '/../config.php'; |
||||||
|
|
||||||
|
$plugin = AdvancedSubscriptionPlugin::create(); |
||||||
|
// Get validation hash |
||||||
|
$hash = Security::remove_XSS($_REQUEST['v']); |
||||||
|
// Get data from request (GET or POST) |
||||||
|
$data['queueId'] = intval($_REQUEST['q']); |
||||||
|
// Check if data is valid or is for start subscription |
||||||
|
$verified = $plugin->checkHash($data, $hash); |
||||||
|
if ($verified) { |
||||||
|
// Render mail |
||||||
|
$message = MessageManager::get_message_by_id($data['queueId']); |
||||||
|
$message = str_replace(array('<br /><hr>', '<br />', '<br/>'), '', $message['content']); |
||||||
|
echo $message; |
||||||
|
} |
||||||
@ -0,0 +1,84 @@ |
|||||||
|
<?php |
||||||
|
/* For license terms, see /license.txt */ |
||||||
|
/** |
||||||
|
* Script to show sessions terms and conditions |
||||||
|
* @package chamilo.plugin.advanced_subscription |
||||||
|
*/ |
||||||
|
/** |
||||||
|
* Init |
||||||
|
*/ |
||||||
|
require_once __DIR__ . '/../config.php'; |
||||||
|
// start plugin |
||||||
|
$plugin = AdvancedSubscriptionPlugin::create(); |
||||||
|
// Session ID |
||||||
|
$data['action'] = Security::remove_XSS($_REQUEST['a']); |
||||||
|
$data['sessionId'] = isset($_REQUEST['s']) ? intval($_REQUEST['s']) : 0; |
||||||
|
$data['currentUserId'] = isset($_REQUEST['current_user_id']) ? intval($_REQUEST['current_user_id']) : 0; |
||||||
|
$data['studentUserId'] = isset($_REQUEST['u']) ? intval($_REQUEST['u']) : 0; |
||||||
|
$data['queueId'] = isset($_REQUEST['q']) ? intval($_REQUEST['q']) : 0; |
||||||
|
$data['newStatus'] = isset($_REQUEST['e']) ? intval($_REQUEST['e']) : 0; |
||||||
|
$data['is_connected'] = true; |
||||||
|
$data['profile_completed'] = isset($_REQUEST['profile_completed']) ? floatval($_REQUEST['profile_completed']) : 0; |
||||||
|
$data['termsRejected'] = isset($_REQUEST['r']) ? intval($_REQUEST['r']) : 0; |
||||||
|
|
||||||
|
// Init template |
||||||
|
$tpl = new Template($plugin->get_lang('plugin_title')); |
||||||
|
|
||||||
|
if ( |
||||||
|
!empty($data['sessionId']) && |
||||||
|
!empty($data['studentUserId']) && |
||||||
|
api_get_plugin_setting('courselegal', 'tool_enable') |
||||||
|
) { |
||||||
|
$lastMessageId = $plugin->getLastMessageId($data['studentUserId'], $data['sessionId']); |
||||||
|
if ($lastMessageId !== false) { |
||||||
|
// Render mail |
||||||
|
$url = $plugin->getRenderMailUrl(array('queueId' => $lastMessageId)); |
||||||
|
Header::location($url); |
||||||
|
exit; |
||||||
|
} |
||||||
|
$courses = SessionManager::get_course_list_by_session_id($data['sessionId']); |
||||||
|
$course = current($courses); |
||||||
|
$data['courseId'] = $course['id']; |
||||||
|
$legalEnabled = api_get_plugin_setting('courselegal', 'tool_enable'); |
||||||
|
if ($legalEnabled) { |
||||||
|
$courseLegal = CourseLegalPlugin::create(); |
||||||
|
$termsAndConditions = $courseLegal->getData($data['courseId'], $data['sessionId']); |
||||||
|
$termsAndConditions = $termsAndConditions['content']; |
||||||
|
$termFiles = $courseLegal->getCurrentFile($data['courseId'], $data['sessionId']); |
||||||
|
} else { |
||||||
|
$termsAndConditions = $plugin->get('terms_and_conditions'); |
||||||
|
$termFiles = ''; |
||||||
|
} |
||||||
|
|
||||||
|
$data['session'] = api_get_session_info($data['sessionId']); |
||||||
|
$data['student'] = Usermanager::get_user_info_by_id($data['studentUserId']); |
||||||
|
$data['acceptTermsUrl'] = $plugin->getQueueUrl($data); |
||||||
|
$data['rejectTermsUrl'] = $plugin->getTermsUrl($data, ADVANCED_SUBSCRIPTION_TERMS_MODE_REJECT); |
||||||
|
// Use Twig with String loader |
||||||
|
$twigString = new \Twig_Environment(new \Twig_Loader_String()); |
||||||
|
$termsContent = $twigString->render( |
||||||
|
$termsAndConditions, |
||||||
|
array( |
||||||
|
'session' => $data['session'], |
||||||
|
'student' => $data['student'], |
||||||
|
) |
||||||
|
); |
||||||
|
|
||||||
|
} else { |
||||||
|
$termsContent = ''; |
||||||
|
$termFiles = ''; |
||||||
|
$data['acceptTermsUrl'] = '#'; |
||||||
|
$data['rejectTermsUrl'] = '#'; |
||||||
|
} |
||||||
|
|
||||||
|
// Assign into content |
||||||
|
$tpl->assign('termsRejected', $data['termsRejected']); |
||||||
|
$tpl->assign('acceptTermsUrl', $data['acceptTermsUrl']); |
||||||
|
$tpl->assign('rejectTermsUrl', $data['rejectTermsUrl']); |
||||||
|
$tpl->assign('session', $data['session']); |
||||||
|
$tpl->assign('student', $data['student']); |
||||||
|
$tpl->assign('sessionId', $data['sessionId']); |
||||||
|
$tpl->assign('termsContent', $termsContent); |
||||||
|
$tpl->assign('termsFiles', $termFiles); |
||||||
|
$content = $tpl->fetch('/advanced_subscription/views/terms_and_conditions.tpl'); |
||||||
|
echo $content; |
||||||
@ -0,0 +1,49 @@ |
|||||||
|
{# start copy from head.tpl #} |
||||||
|
<meta charset="{{ system_charset }}" /> |
||||||
|
<link href="http://www.chamilo.org/documentation.php" rel="help" /> |
||||||
|
<link href="http://www.chamilo.org/team.php" rel="author" /> |
||||||
|
<link href="http://www.chamilo.org" rel="copyright" /> |
||||||
|
{{ prefetch }} |
||||||
|
{{ favico }} |
||||||
|
{{ browser_specific_head }} |
||||||
|
<link rel="apple-touch-icon" href="{{ _p.web }}apple-touch-icon.png" /> |
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes" /> |
||||||
|
<meta name="Generator" content="{{ _s.software_name }} {{ _s.system_version|slice(0,1) }}" /> |
||||||
|
{# Use the latest engine in ie8/ie9 or use google chrome engine if available #} |
||||||
|
{# Improve usability in portal devices #} |
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||||
|
<title>{{ title_string }}</title> |
||||||
|
{{ css_file_to_string }} |
||||||
|
{{ css_style_print }} |
||||||
|
{{ js_file_to_string }} |
||||||
|
{# end copy from head.tpl #} |
||||||
|
<h2 class="legal-terms-title legal-terms-popup"> |
||||||
|
{{ "TermsAndConditions" | get_lang }} |
||||||
|
</h2> |
||||||
|
{% if termsRejected == 1 %} |
||||||
|
<div class="error-message legal-terms-popup"> |
||||||
|
{{ "YouMustAcceptTermsAndConditions" | get_plugin_lang("AdvancedSubscriptionPlugin") | format(session.name) }} |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
<div class="legal-terms legal-terms-popup"> |
||||||
|
{{ termsContent }} |
||||||
|
</div> |
||||||
|
<div class="legal-terms-files legal-terms-popup"> |
||||||
|
{{ termsFiles }} |
||||||
|
</div> |
||||||
|
<div class="legal-terms-buttons legal-terms-popup"> |
||||||
|
<a |
||||||
|
class="btn btn-success btn-advanced-subscription btn-accept" |
||||||
|
href="{{ acceptTermsUrl }}" |
||||||
|
> |
||||||
|
{{ "AcceptInfinitive" | get_plugin_lang("AdvancedSubscriptionPlugin") }} |
||||||
|
</a> |
||||||
|
<a |
||||||
|
class="btn btn-danger btn-advanced-subscription btn-reject" |
||||||
|
href="{{ rejectTermsUrl }}" |
||||||
|
> |
||||||
|
{{ "RejectInfinitive" | get_plugin_lang("AdvancedSubscriptionPlugin") }} |
||||||
|
</a> |
||||||
|
</div> |
||||||
|
|
||||||
|
<link href="{{ _p.web_plugin }}advanced_subscription/views/css/style.css" rel="stylesheet" type="text/css"> |
||||||
Loading…
Reference in new issue