Merge branch '1.10.x' of ssh://github.com/chamilo/chamilo-lms into 1.10.x

1.10.x
Julio Montoya 11 years ago
commit 9d48a6bd1f
  1. 12
      main/inc/lib/pdf.lib.php
  2. 22
      main/inc/lib/sessionmanager.lib.php
  3. 8
      main/install/install.lib.php
  4. 2
      main/install/migrate-db-1.9.0-1.10.0-pre.sql
  5. 7
      main/upload/courses/index.html
  6. 7
      main/upload/sessions/index.html
  7. 91
      main/webservices/registration.soap.php
  8. 30
      plugin/advanced_subscription/ajax/advanced_subscription.ajax.php
  9. 5
      plugin/advanced_subscription/config.php
  10. 92
      plugin/advanced_subscription/lang/english.php
  11. 2
      plugin/advanced_subscription/lang/spanish.php
  12. 186
      plugin/advanced_subscription/src/AdvancedSubscriptionPlugin.php
  13. 4
      plugin/advanced_subscription/src/HookAdvancedSubscription.php
  14. 25
      plugin/advanced_subscription/src/render_mail.php
  15. 78
      plugin/advanced_subscription/src/terms_and_conditions.php
  16. 47
      plugin/advanced_subscription/test/terms_to_pdf.php
  17. 40
      plugin/advanced_subscription/test/ws_session_user.php
  18. 19
      plugin/advanced_subscription/views/css/style.css
  19. 49
      plugin/advanced_subscription/views/terms_and_conditions.tpl
  20. 23
      plugin/advanced_subscription/views/terms_and_conditions_to_pdf.tpl

@ -351,7 +351,8 @@ class PDF
$document_html,
$css = '',
$pdf_name = '',
$course_code = null
$course_code = null,
$outputMode = 'D'
) {
global $_configuration;
@ -433,11 +434,16 @@ class PDF
$output_file = 'pdf_'.date('Y-m-d-his').'.pdf';
} else {
$pdf_name = replace_dangerous_char($pdf_name);
$output_file = $pdf_name.'.pdf';
// Save temporally into Archive folder
$output_file = api_get_path(SYS_ARCHIVE_PATH) . $pdf_name.'.pdf';
}
$this->pdf->Output($output_file, 'D'); // F to save the pdf in a file
$this->pdf->Output($output_file, $outputMode); // F to save the pdf in a file
if ($outputMode == 'F') {
// Do NOT exit when export to file
} else {
exit;
}
}
/**
* Gets the watermark from the platform or a course

@ -5737,7 +5737,7 @@ class SessionManager
$term = Database::escape_string($term);
$resultData = Database::select('id, name, date_start, date_end, duration, description', $sTable, array(
$resultData = Database::select('*', $sTable, array(
'where' => array(
"name LIKE %?% " => $term,
"OR description LIKE %?% " => $term,
@ -5753,6 +5753,17 @@ class SessionManager
return $resultData;
}
foreach ($resultData as $id => &$session) {
$session['extra'] = self::getFilteredExtraFields($id, $extraFieldsToInclude);
}
return $resultData;
}
public static function getFilteredExtraFields($sessionId, $extraFieldsToInclude = array())
{
$extraData = array();
$variables = array();
$variablePlaceHolders = array();
@ -5781,11 +5792,9 @@ class SessionManager
)
);
// Add session fields values to session list
foreach ($resultData as $id => &$session) {
foreach ($sessionFieldValueList as $sessionFieldValue) {
// Match session field values to session
if ($sessionFieldValue['session_id'] != $id) {
if ($sessionFieldValue['session_id'] != $sessionId) {
continue;
}
@ -5797,14 +5806,13 @@ class SessionManager
$extrafieldVariable = $fields[$sessionFieldValue['field_id']];
$extrafieldValue = $sessionFieldValue['field_value'];
$session['extra'][] = array(
$extraData[] = array(
'variable' => $extrafieldVariable,
'value' => $extrafieldValue
);
}
}
return $resultData;
return $extraData;
}
public static function isValidId($sessionId)

@ -1315,6 +1315,14 @@ function display_requirements($installType, $badUpdatePath, $updatePath = '', $u
<td class="requirements-item">'.api_get_path(SYS_CODE_PATH).'upload/users/</td>
<td class="requirements-value">'.check_writable(api_get_path(SYS_CODE_PATH).'upload/users/').'</td>
</tr>
<tr>
<td class="requirements-item">'.api_get_path(SYS_CODE_PATH).'upload/sessions/</td>
<td class="requirements-value">'.check_writable(api_get_path(SYS_CODE_PATH).'upload/sessions/').'</td>
</tr>
<tr>
<td class="requirements-item">'.api_get_path(SYS_CODE_PATH).'upload/courses/</td>
<td class="requirements-value">'.check_writable(api_get_path(SYS_CODE_PATH).'upload/courses/').'</td>
</tr>
<tr>
<td class="requirements-item">'.api_get_path(SYS_CODE_PATH).'default_course_document/images/</td>
<td class="requirements-value">'.check_writable(api_get_path(SYS_CODE_PATH).'default_course_document/images/').'</td>

@ -38,8 +38,6 @@ ALTER TABLE gradebook_category ADD COLUMN generate_certificates TINYINT NOT NULL
RENAME TABLE track_e_exercices TO track_e_exercises;
ALTER TABLE session_rel_user ADD COLUMN duration int;
ALTER TABLE track_e_access ADD COLUMN c_id int NOT NULL;
ALTER TABLE track_e_default ADD COLUMN c_id int NOT NULL;
ALTER TABLE track_e_lastaccess ADD COLUMN c_id int NOT NULL;

@ -0,0 +1,7 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
</body>
</html>

@ -0,0 +1,7 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
</body>
</html>

@ -5557,7 +5557,8 @@ $server->wsdl->addComplexType(
'',
array(
'term' => array('name' => 'term', 'type' => 'xsd:string'),
'extrafields' => array('name' => 'extrafields', 'type' => 'xsd:string')
'extrafields' => array('name' => 'extrafields', 'type' => 'xsd:string'),
'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string')
)
);
@ -5595,11 +5596,22 @@ $server->wsdl->addComplexType(
'',
array(
'id' => array('name' => 'id', 'type' => 'xsd:int'),
'id_coach' => array('name' => 'id_coach', 'type' => 'xsd:int'),
'name' => array('name' => 'name', 'type' => 'xsd:string'),
'nbr_courses' => array('name' => 'nbr_courses', 'type' => 'xsd:int'),
'nbr_users' => array('name' => 'nbr_users', 'type' => 'xsd:int'),
'nbr_classes' => array('name' => 'nbr_classes', 'type' => 'xsd:int'),
'date_start' => array('name' => 'date_start', 'type' => 'xsd:string'),
'date_end' => array('name' => 'date_end', 'type' => 'xsd:string'),
'duration' => array('name' => 'duration', 'type' => 'xsd:string'),
'nb_days_access_before_beginning' => array('name' => 'nb_days_access_before_beginning', 'type' => 'xsd:int'),
'nb_days_access_after_end' => array('nb_days_access_after_end' => 'duration', 'type' => 'xsd:int'),
'session_admin_id' => array('session_admin_id' => 'duration', 'type' => 'xsd:int'),
'visibility' => array('visibility' => 'duration', 'type' => 'xsd:int'),
'session_category_id' => array('session_category_id' => 'duration', 'type' => 'xsd:int'),
'promotion_id' => array('promotion_id' => 'duration', 'type' => 'xsd:int'),
'description' => array('name' => 'description', 'type' => 'xsd:string'),
'show_description' => array('name' => 'description', 'type' => 'xsd:int'),
'duration' => array('name' => 'duration', 'type' => 'xsd:string'),
'extra' => array('name' => 'extra', 'type' => 'tns:searchedSessionExtras'),
)
);
@ -5632,12 +5644,17 @@ $server->register(
/**
* Web service to get a session list filtered by name, description or short description extra field
* @param string Secret key
* @param string $term Search term
* @param string $extraFields Extrafields to include in request result
* @param string $secretKey Secret key to check
* @return array The list
*/
function WSSearchSession($term, $extraFields)
function WSSearchSession($term, $extraFields, $secretKey)
{
if (!WSHelperVerifyKey($secretKey)) {
return return_error(WS_ERROR_SECRET_KEY);
}
$fieldsToInclude = explode(',', $extraFields);
foreach ($fieldsToInclude as &$field) {
@ -5653,6 +5670,72 @@ function WSSearchSession($term, $extraFields)
/* Search session Web Service end */
/* Fetch session Web Service start */
// Input params for WSSearchSession
$server->wsdl->addComplexType(
'FetchSession',
'complexType',
'struct',
'all',
'',
array(
'id' => array('name' => 'term', 'type' => 'xsd:int'),
'extrafields' => array('name' => 'extrafields', 'type' => 'xsd:string'),
'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string')
)
);
//Reister WSFetchSession
$server->register(
'WSFetchSession',
array('SearchSession' => 'tns:FetchSession'), // input parameters
array('return' => 'tns:searchedSessionList'), // output parameters
'urn:WSRegistration', // namespace
'urn:WSRegistration#WSFetchSession', // soapaction
'rpc', // style
'encoded', // use
'This service get a session by its id. Optionally can get its extra fields values' // documentation
);
/**
* Web service to get a session by its id. Optionally can get its extra fields values
* @param int $id The session id
* @param string $extraFields Extrafields to include in request result
* @param string $secretKey Secret key to check
* @return array The session data
*/
function WSFetchSession($id, $extraFields, $secretKey)
{
if (!WSHelperVerifyKey($secretKey)) {
return return_error(WS_ERROR_SECRET_KEY);
}
$fieldsToInclude = explode(',', $extraFields);
foreach ($fieldsToInclude as &$field) {
if (empty($field)) {
continue;
}
$field = trim($field);
}
$sessionData = SessionManager::fetch($id);
if ($sessionData === false) {
return return_error(WS_ERROR_INVALID_INPUT);
}
if (!empty($extraFields)) {
$sessionData['extra'] = SessionManager::getFilteredExtraFields($id, $fieldsToInclude);
}
return array($sessionData);
}
/* Fetch session Web Service end */
// Add more webservices by Hooks
if (!empty($hook)) {
$hook->setEventData(array('server' => $server));

@ -25,6 +25,8 @@ $data['newStatus'] = intval($_REQUEST['e']);
// $data['is_connected'] = isset($_REQUEST['is_connected']) ? boolval($_REQUEST['is_connected']) : false;
$data['is_connected'] = true;
$data['profile_completed'] = isset($_REQUEST['profile_completed']) ? floatval($_REQUEST['profile_completed']) : 0;
$data['accept_terms'] = isset($_REQUEST['accept_terms']) ? intval($_REQUEST['accept_terms']) : 0;
$data['courseId'] = isset($_REQUEST['c']) ? intval($_REQUEST['c']) : 0;
// Init result array
$result = array('error' => true, 'errorMessage' => get_lang('ThereWasAnError'));
// Check if data is valid or is for start subscription
@ -51,6 +53,11 @@ if ($verified) {
$res = AdvancedSubscriptionPlugin::create()->startSubscription($data['studentUserId'], $data['sessionId'], $data);
// Check if queue subscription was successful
if ($res === true) {
$legalEnabled = api_get_plugin_setting('courselegal', 'tool_enable');
if ($legalEnabled) {
// Save terms confirmation
CourseLegalPlugin::create()->saveUserLegal($data['studentUserId'], $data['courseId'], $data['sessionId']);
}
// Prepare data
// Get session data
// Assign variables
@ -126,9 +133,8 @@ if ($verified) {
// Check if exist an email to render
if (isset($result['mailIds']['render'])) {
// Render mail
$message = MessageManager::get_message_by_id($result['mailIds']['render']);
$message = str_replace(array('<br /><hr>', '<br />', '<br/>'), '', $message['content']);
echo $message;
$url = $plugin->getRenderMailUrl(array('queueId' => $result['mailIds']['render']));
Header::location($url);
exit;
}
}
@ -151,13 +157,19 @@ if ($verified) {
// Check if exist an email to render
if (isset($result['mailIds']['render'])) {
// Render mail
$message = MessageManager::get_message_by_id($result['mailIds']['render']);
$message = str_replace(array('<br /><hr>', '<br />', '<br/>'), '', $message['content']);
echo $message;
$url = $plugin->getRenderMailUrl(array('queueId' => $result['mailIds']['render']));
Header::location($url);
exit;
}
}
}
} else {
$lastMessageId = $plugin->getLastMessageId($data['studentUserId'], $data['sessionId']);
if ($lastMessageId !== false) {
// Render mail
$url = $plugin->getRenderMailUrl(array('queueId' => $lastMessageId));
Header::location($url);
exit;
} else {
if (is_string($res)) {
$result['errorMessage'] = $res;
@ -166,6 +178,7 @@ if ($verified) {
}
$result['pass'] = false;
}
}
break;
case 'confirm':
@ -263,9 +276,8 @@ if ($verified) {
// Check if exist mail to render
if (isset($result['mailIds']['render'])) {
// Render mail
$message = MessageManager::get_message_by_id($result['mailIds']['render']);
$message = str_replace(array('<br /><hr>', '<br />', '<br/>'), '', $message['content']);
echo $message;
$url = $plugin->getRenderMailUrl(array('queueId' => $result['mailIds']['render']));
Header::location($url);
exit;
}
}

@ -27,4 +27,9 @@ define('ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_APPROVED', 2);
define('ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_DISAPPROVED', 3);
define('ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED', 10);
define('ADVANCED_SUBSCRIPTION_TERMS_MODE_POPUP', 0);
define('ADVANCED_SUBSCRIPTION_TERMS_MODE_REJECT', 1);
require_once __DIR__ . '/../../main/inc/global.inc.php';

@ -78,60 +78,62 @@ $strings['MailThankYou'] = 'Thank you.';
$strings['MailThankYouCollaboration'] = 'Thank you for your help.';
// Admin Accept
$strings['MailTitleAdminAcceptToAdmin'] = 'Information: Has been received inscription validation';
$strings['MailContentAdminAcceptToAdmin'] = 'We have received and registered your inscription validation for student <strong>%s</strong> to course <strong>%s</strong>';
$strings['MailTitleAdminAcceptToStudent'] = 'Accepted: Your inscription to course %s was confirmed!';
$strings['MailContentAdminAcceptToStudent'] = 'We are pleased to inform your course registration <strong>%s</strong> starting at <strong>%s</strong> was validated by administrators. We hope to keep all your encouragement and participate in another course or, on another occasion, this same course.';
$strings['MailTitleAdminAcceptToSuperior'] = 'Information: Inscription validation for %s to course %s';
$strings['MailContentAdminAcceptToSuperior'] = 'Inscription for student <strong>%s</strong> to course <strong>%s</strong> starting at <strong>%s</strong>, was pending status, has been validated a few minutes ago. We hope you help us to assure full availability for your collaborator during the course period.';
$strings['MailTitleAdminAcceptToAdmin'] = 'Notification: subscription validation received';
$strings['MailContentAdminAcceptToAdmin'] = 'We have received and registered your subscription validation for student <strong>%s</strong> to course <strong>%s</strong>';
$strings['MailTitleAdminAcceptToStudent'] = 'Accepted: Your subscription to course %s has been accepted!';
$strings['MailContentAdminAcceptToStudent'] = 'We are pleased to inform you that your registration to course <strong>%s</strong> starting on <strong>%s</strong> was validated by an administrator. We wish you good luck and hope you will consider participating to another course soon.';
$strings['MailTitleAdminAcceptToSuperior'] = 'Notification: Subscription validation of %s to course %s';
$strings['MailContentAdminAcceptToSuperior'] = 'Subscription of student <strong>%s</strong> to course <strong>%s</strong> starting on <strong>%s</strong> was pending but has been validated a few minutes ago. We kindly hope we can count on you to ensure the necessary availability of your collaborator during the course period.';
// Admin Reject
$strings['MailTitleAdminRejectToAdmin'] = 'Information: Has been received inscription refusal';
$strings['MailContentAdminRejectToAdmin'] = 'We have received and registered your inscription refusal for student <strong>%s</strong> to course <strong>%s</strong>';
$strings['MailTitleAdminRejectToStudent'] = 'Your inscription to course %s was refused';
$strings['MailContentAdminRejectToStudent'] = 'We regret that your inscription to course <strong>%s</strong> starting at <strong>%s</strong> was rejected because of lack of vacancies. We hope to keep all your encouragement and participate in another course or, on another occasion, this same course.';
$strings['MailTitleAdminRejectToSuperior'] = 'Information: Inscription refusal for student %s to course %s';
$strings['MailContentAdminRejectToSuperior'] = 'The inscription for <strong>%s</strong> to course <strong>%s</strong>, it was accepted earlier, was rejected because of lack of vacancies. Our sincere apologies.';
$strings['MailTitleAdminRejectToAdmin'] = 'Notification: Rejection received';
$strings['MailContentAdminRejectToAdmin'] = 'We have received and registered your rejection for the subscription of student <strong>%s</strong> to course <strong>%s</strong>';
$strings['MailTitleAdminRejectToStudent'] = 'Your subscription to course %s was rejected';
$strings['MailContentAdminRejectToStudent'] = 'We regret to inform you that your subscription to course <strong>%s</strong> starting on <strong>%s</strong> was rejected because of a lack of vacancies. We hope you will consider participating to another course soon.';
$strings['MailTitleAdminRejectToSuperior'] = 'Notification: Subscription refusal for student %s to course %s';
$strings['MailContentAdminRejectToSuperior'] = 'The subscription of <strong>%s</strong> to course <strong>%s</strong> that you previously validated was rejected because of a lack of vacancies. Our sincere apologies.';
// Superior Accept
$strings['MailTitleSuperiorAcceptToAdmin'] = 'Approval for %s to course %s ';
$strings['MailContentSuperiorAcceptToAdmin'] = 'The inscription for student <strong>%s</strong> to course <strong>%s</strong> has been accepted by superior. You can manage inscriptions <a href="%s"><strong>HERE</strong></a>';
$strings['MailTitleSuperiorAcceptToSuperior'] = 'Confirmation: Has been received approval for %s';
$strings['MailContentSuperiorAcceptToSuperior'] = 'We have received and registered your choice to accept inscription to course <strong>%s</strong> for your collaborator <strong>%s</strong>';
$strings['MailContentSuperiorAcceptToSuperiorSecond'] = 'Now, the inscription is pending for availability of vacancies. We will keep you informed about status for this step';
$strings['MailTitleSuperiorAcceptToStudent'] = 'Accepted: Your inscription to course %s has been approved by your superior';
$strings['MailContentSuperiorAcceptToStudent'] = 'We are pleased to inform your inscription to course <strong>%s</strong> has been accepted by your superior. Now, your inscription is pending to availability of vacancies. We will notify you as soon as it is validated.';
$strings['MailTitleSuperiorAcceptToAdmin'] = 'Approval for subscription of %s to course %s ';
$strings['MailContentSuperiorAcceptToAdmin'] = 'The subscription of student <strong>%s</strong> to course <strong>%s</strong> has been accepted by his superior. You can <a href="%s">manage subscriptions here</a>';
$strings['MailTitleSuperiorAcceptToSuperior'] = 'Confirmation: Approval received for %s';
$strings['MailContentSuperiorAcceptToSuperior'] = 'We have received and registered you validation of subscription to course <strong>%s</strong> of your collaborator <strong>%s</strong>';
$strings['MailContentSuperiorAcceptToSuperiorSecond'] = 'The subscription is now pending for a vacancies confirmation. We will keep you informed about changes of status for this subscription';
$strings['MailTitleSuperiorAcceptToStudent'] = 'Accepted: Your subscription to course %s has been approved by your superior';
$strings['MailContentSuperiorAcceptToStudent'] = 'We are pleased to inform you that your subscription to course <strong>%s</strong> has been accepted by your superior. Your inscription is now pending for a vacancies confirmation. We will notify you as soon as it is confirmed.';
// Superior Reject
$strings['MailTitleSuperiorRejectToStudent'] = 'Information: Your inscription to course %s has been refused';
$strings['MailContentSuperiorRejectToStudent'] = 'We regret to inform your inscription to course <strong>%s</strong> was NOT accepted. We hope to keep all your encouragement and participate in another course or, on another occasion, this same course.';
$strings['MailTitleSuperiorRejectToSuperior'] = 'Confirmation: Has been received inscription refusal for %s';
$strings['MailContentSuperiorRejectToSuperior'] = 'We have received and registered your choice to reject inscription to course <strong>%s</strong> for your collaborator <strong>%s</strong>';
$strings['MailTitleSuperiorRejectToStudent'] = 'Notification: Your subscription to course %s has been refused';
$strings['MailContentSuperiorRejectToStudent'] = 'We regret to inform your subscription to course <strong>%s</strong> was NOT accepted. We hope this will not reduce your motivation and encourage you to register to another course or, on another occasion, this same course soon.';
$strings['MailTitleSuperiorRejectToSuperior'] = 'Confirmation: Rejection of subscription received for %s';
$strings['MailContentSuperiorRejectToSuperior'] = 'We have received and registered your rejection of subscription to course <strong>%s</strong> for your collaborator <strong>%s</strong>';
// Student Request
$strings['MailTitleStudentRequestToStudent'] = 'Information: Has been received inscription validation';
$strings['MailContentStudentRequestToStudent'] = 'We have received and registered your inscripción request to course <strong>%s</strong> starting at <strong>%s</strong>';
$strings['MailContentStudentRequestToStudentSecond'] = 'Your inscription is pending approval, first from your superior, then the availability of vacancies. An email has been sent to your superior for review and approval of your request.';
$strings['MailTitleStudentRequestToSuperior'] = 'Course inscription request from your collaborator';
$strings['MailContentStudentRequestToSuperior'] = 'We have received an inscription request for <strong>%s</strong> to course <strong>%s</strong>, starting at <strong>%s</strong>. Course details: <strong>%s</strong>.';
$strings['MailContentStudentRequestToSuperiorSecond'] = 'Your are welcome to accept or reject this inscription, clicking the corresponding button.';
$strings['MailTitleStudentRequestToStudent'] = 'Notification: Subscription approval received';
$strings['MailContentStudentRequestToStudent'] = 'We have received and registered your subscription request to course <strong>%s</strong> starting on <strong>%s</strong>';
$strings['MailContentStudentRequestToStudentSecond'] = 'Your subscription is pending approval, first from your superior, then for the availability of vacancies. An email has been sent to your superior for review and approval. We will inform you when this situation changes.';
$strings['MailTitleStudentRequestToSuperior'] = 'Course subscription request from your collaborator';
$strings['MailContentStudentRequestToSuperior'] = 'We have received an subscription request of <strong>%s</strong> to course <strong>%s</strong>, starting on <strong>%s</strong>. Course details: <strong>%s</strong>.';
$strings['MailContentStudentRequestToSuperiorSecond'] = 'Your are welcome to accept or reject this subscription, clicking the corresponding button.';
// Student Request No Boss
$strings['MailTitleStudentRequestNoSuperiorToStudent'] = 'Has been received your inscription request for %s';
$strings['MailContentStudentRequestNoSuperiorToStudent'] = 'We have received and registered your inscription to course <strong>%s</strong> starting at <strong>%s</strong>.';
$strings['MailContentStudentRequestNoSuperiorToStudentSecond'] = 'Your inscription is pending availability of vacancies. Soon you will get the result of your request approval.';
$strings['MailTitleStudentRequestNoSuperiorToAdmin'] = 'Inscription request for %s to course %s';
$strings['MailContentStudentRequestNoSuperiorToAdmin'] = 'The inscription for <strong>%s</strong> to course <strong>%s</strong> has been approved by default, missing superior. You can manage inscriptions <a href="%s"><strong>HERE</strong></a>';
$strings['MailTitleStudentRequestNoSuperiorToStudent'] = 'Your subscription request for %s has been received';
$strings['MailContentStudentRequestNoSuperiorToStudent'] = 'We have received and registered your subscription to course <strong>%s</strong> starting on <strong>%s</strong>.';
$strings['MailContentStudentRequestNoSuperiorToStudentSecond'] = 'Your subscription is pending availability of vacancies. You will get the results of your request approval (or rejection) soon.';
$strings['MailTitleStudentRequestNoSuperiorToAdmin'] = 'Subscription request of %s to course %s';
$strings['MailContentStudentRequestNoSuperiorToAdmin'] = 'The subscription of <strong>%s</strong> to course <strong>%s</strong> has been approved by default (no direct superior defined). You can <a href="%s">manage subscriptions here</strong></a>';
// Reminders
$strings['MailTitleReminderAdmin'] = 'Inscription to %s are pending confirmation';
$strings['MailContentReminderAdmin'] = 'The inscription below to course <strong>%s</strong> are pending validation to be accepted. Please, go to <a href="%s">Administration page</a> to validate them.';
$strings['MailTitleReminderStudent'] = 'Information: Your request is pending approval to course %s';
$strings['MailContentReminderStudent'] = 'This email is to confirm we have received and registered your inscription request to course <strong>%s</strong>, starting at <strong>%s</strong>.';
$strings['MailContentReminderStudentSecond'] = 'Your inscription has not yet been approved by your superior, so we send him an reminder email.';
$strings['MailTitleReminderSuperior'] = 'Course inscription request for your collaborators';
$strings['MailContentReminderSuperior'] = 'We remind you, we have received inscription requests below to course <strong>%s</strong> for your collaborators. This course is starting at <strong>%s</strong>. Course details: <strong>%s</strong>.';
$strings['MailContentReminderSuperiorSecond'] = 'We invite you to accept or reject inscription request, clicking corresponding button for each collaborator.';
$strings['MailTitleReminderMaxSuperior'] = 'Reminder: Course inscription request for your collaborators';
$strings['MailContentReminderMaxSuperior'] = 'We remind you, we have received inscription requests below to course <strong>%s</strong> for your collaborators. This course is starting at <strong>%s</strong>. Course details: <strong>%s</strong>.';
$strings['MailContentReminderMaxSuperiorSecond'] = 'This course have limited vacancies and has received a high inscription request rate, So we recommend all areas to accept at most <strong>%s</strong> candidates. We invite you to accept or reject inscription request, clicking corresponding button for each collaborator.';
$strings['MailTitleReminderAdmin'] = 'Subscriptions to %s are pending confirmation';
$strings['MailContentReminderAdmin'] = 'The subscription requests for course <strong>%s</strong> are pending validation to be accepted. Please, go to <a href="%s">Administration page</a> to validate them.';
$strings['MailTitleReminderStudent'] = 'Information: Your subscription request is pending approval for course %s';
$strings['MailContentReminderStudent'] = 'This email is just to confirm we have received and registered your subscription request to course <strong>%s</strong>, starting on <strong>%s</strong>.';
$strings['MailContentReminderStudentSecond'] = 'Your subscription has not been approved by your superior yet, so we sent him a e-mail reminder.';
$strings['MailTitleReminderSuperior'] = 'Course subscription request for your collaborators';
$strings['MailContentReminderSuperior'] = 'We kindly remind you that we have received the subscription requests below to course <strong>%s</strong> from your collaborators. This course is starting on <strong>%s</strong>. Course details: <strong>%s</strong>.';
$strings['MailContentReminderSuperiorSecond'] = 'We invite you to accept or reject this subscription request by clicking the corresponding button for each collaborator.';
$strings['MailTitleReminderMaxSuperior'] = 'Reminder: Course subscription request for your collaborators';
$strings['MailContentReminderMaxSuperior'] = 'We kindly remind you that we have received the subscription requests below to course <strong>%s</strong> from your collaborators. This course is starting on <strong>%s</strong>. Course details: <strong>%s</strong>.';
$strings['MailContentReminderMaxSuperiorSecond'] = 'This course have limited vacancies and has received a high subscription request rate, So we recommend all areas to accept at most <strong>%s</strong> candidates. We invite you to accept or reject the inscription request by clicking the corresponding button for each collaborator.';
$strings['YouMustAcceptTermsAndConditions'] = 'To subscribe to course <strong>%s</strong>, you must accept these terms and conditions.';

@ -135,3 +135,5 @@ $strings['MailContentReminderSuperiorSecond'] = 'Le invitamos a aprobar o desapr
$strings['MailTitleReminderMaxSuperior'] = 'Recordatorio: Solicitud de consideración de curso para colaborador(es)';
$strings['MailContentReminderMaxSuperior'] = 'Le recordamos que hemos recibido las siguientes solicitudes de suscripción al curso <strong>%s</strong> de parte de sus colaboradores. El curso se iniciará el <strong>%s</strong>. Detalles del curso: <strong>%s</strong>.';
$strings['MailContentReminderMaxSuperiorSecond'] = 'Este curso tiene una cantidad de cupos limitados y ha recibido una alta tasa de solicitudes de inscripción, por lo que recomendamos que cada área apruebe un máximo de <strong>%s</strong> candidatos. Le invitamos a aprobar o desaprobar las suscripciones, dando clic en el botón correspondiente a continuación para cada colaborador.';
$strings['YouMustAcceptTermsAndConditions'] = 'Para inscribirse al curso <strong>%s</strong>, debe aceptar estos términos y condiciones.';

@ -25,6 +25,7 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
'min_profile_percentage' => 'text',
'check_induction' => 'boolean',
'secret_key' => 'text',
'terms_and_conditions' => 'wysiwyg'
);
parent::__construct('1.0', 'Imanol Losada, Daniel Barreto', $parameters);
@ -301,15 +302,31 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
* @param string $content
* @param int $sessionId
* @param bool $save
* @param array $fileAttachments
* @return bool|int
*/
public function sendMailMessage($studentId, $receiverId, $subject, $content, $sessionId, $save = false)
public function sendMailMessage($studentId, $receiverId, $subject, $content, $sessionId, $save = false, $fileAttachments = array())
{
if (
!empty($fileAttachments) &&
is_array($fileAttachments) &&
isset($fileAttachments['files']) &&
isset($fileAttachments['comments'])
) {
$mailId = MessageManager::send_message(
$receiverId,
$subject,
$content,
$fileAttachments['files'],
$fileAttachments['comments']
);
} else {
$mailId = MessageManager::send_message(
$receiverId,
$subject,
$content
);
}
if ($save && !empty($mailId)) {
// Save as sent message
@ -321,6 +338,17 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
$studentId = intval($studentId);
$this->saveLastMessage($mailId, $studentId, $sessionId);
}
} elseif (!empty($mailId)) {
// Update queue row, updated_at
Database::update(
Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE),
array(
'updated_at' => api_get_utc_datetime(),
),
array(
'user_id = ? AND session_id = ?' => array($studentId, $sessionId)
)
);
}
return $mailId;
}
@ -430,7 +458,8 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
$data['student']['user_id'],
$this->get_lang('MailStudentRequest'),
$template->fetch('/advanced_subscription/views/student_notice_student.tpl'),
$data['sessionId']
$data['sessionId'],
true
);
// Mail to superior
$mailIds[] = $this->sendMailMessage(
@ -438,8 +467,7 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
$data['superior']['user_id'],
$this->get_lang('MailStudentRequest'),
$template->fetch('/advanced_subscription/views/student_notice_superior.tpl'),
$data['sessionId'],
true
$data['sessionId']
);
break;
case ADVANCED_SUBSCRIPTION_ACTION_SUPERIOR_APPROVE:
@ -449,7 +477,8 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
$data['student']['user_id'],
$this->get_lang('MailBossAccept'),
$template->fetch('/advanced_subscription/views/superior_accepted_notice_student.tpl'),
$data['sessionId']
$data['sessionId'],
true
);
// Mail to superior
$mailIds['render'] = $this->sendMailMessage(
@ -467,8 +496,7 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
$adminId,
$this->get_lang('MailBossAccept'),
$template->fetch('/advanced_subscription/views/superior_accepted_notice_admin.tpl'),
$data['sessionId'],
true
$data['sessionId']
);
}
break;
@ -498,7 +526,8 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
$data['student']['user_id'],
$this->get_lang('MailStudentRequestSelect'),
$template->fetch('/advanced_subscription/views/student_notice_student.tpl'),
$data['sessionId']
$data['sessionId'],
true
);
// Mail to superior
$mailIds['render'] = $this->sendMailMessage(
@ -506,18 +535,47 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
$data['superior']['user_id'],
$this->get_lang('MailStudentRequestSelect'),
$template->fetch('/advanced_subscription/views/student_notice_superior.tpl'),
$data['sessionId'],
true
$data['sessionId']
);
break;
case ADVANCED_SUBSCRIPTION_ACTION_ADMIN_APPROVE:
$fileAttachments = array();
if (api_get_plugin_setting('courselegal', 'tool_enable')) {
$courseLegal = CourseLegalPlugin::create();
$courses = SessionManager::get_course_list_by_session_id($data['sessionId']);
$course = current($courses);
$data['courseId'] = $course['id'];
$data['course'] = api_get_course_info_by_id($data['courseId']);
$termsAndConditions = $courseLegal->getData($data['courseId'], $data['sessionId']);
$termsAndConditions = $termsAndConditions['content'];
$termsAndConditions = $this->renderTemplateString($termsAndConditions, $data);
$tpl = new Template(get_lang('TermsAndConditions'));
$tpl->assign('session', $data['session']);
$tpl->assign('student', $data['student']);
$tpl->assign('sessionId', $data['sessionId']);
$tpl->assign('termsContent', $termsAndConditions);
$termsAndConditions = $tpl->fetch('/advanced_subscription/views/terms_and_conditions_to_pdf.tpl');
$pdf = new PDF();
$filename = 'terms' . sha1(rand(0,99999));
$pdf->content_to_pdf($termsAndConditions, null, $filename, null, 'F');
$fileAttachments['file'][] = array(
'name' => $filename . '.pdf',
'application/pdf' => $filename . '.pdf',
'tmp_name' => api_get_path(SYS_ARCHIVE_PATH) . $filename . '.pdf',
'error' => UPLOAD_ERR_OK,
'size' => filesize(api_get_path(SYS_ARCHIVE_PATH) . $filename . '.pdf'),
);
$fileAttachments['comments'][] = get_lang('TermsAndConditions');
}
// Mail to student
$mailIds[] = $this->sendMailMessage(
$data['studentUserId'],
$data['student']['user_id'],
$this->get_lang('MailAdminAccept'),
$template->fetch('/advanced_subscription/views/admin_accepted_notice_student.tpl'),
$data['sessionId']
$data['sessionId'],
true,
$fileAttachments
);
// Mail to superior
$mailIds[] = $this->sendMailMessage(
@ -535,8 +593,7 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
$adminId,
$this->get_lang('MailAdminAccept'),
$template->fetch('/advanced_subscription/views/admin_accepted_notice_admin.tpl'),
$data['sessionId'],
true
$data['sessionId']
);
break;
case ADVANCED_SUBSCRIPTION_ACTION_ADMIN_DISAPPROVE:
@ -575,7 +632,8 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
$data['student']['user_id'],
$this->get_lang('MailStudentRequestNoBoss'),
$template->fetch('/advanced_subscription/views/student_no_superior_notice_student.tpl'),
$data['sessionId']
$data['sessionId'],
true
);
// Mail to admin
foreach ($data['admins'] as $adminId => $admin) {
@ -585,8 +643,7 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
$adminId,
$this->get_lang('MailStudentRequestNoBoss'),
$template->fetch('/advanced_subscription/views/student_no_superior_notice_admin.tpl'),
$data['sessionId'],
true
$data['sessionId']
);
}
break;
@ -606,8 +663,7 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
$data['superior']['user_id'],
$this->get_lang('MailRemindSuperior'),
$template->fetch('/advanced_subscription/views/reminder_notice_superior.tpl'),
$data['sessionId'],
true
$data['sessionId']
);
break;
case ADVANCED_SUBSCRIPTION_ACTION_REMINDER_SUPERIOR_MAX:
@ -616,8 +672,7 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
$data['superior']['user_id'],
$this->get_lang('MailRemindSuperior'),
$template->fetch('/advanced_subscription/views/reminder_notice_superior_max.tpl'),
$data['sessionId'],
true
$data['sessionId']
);
break;
case ADVANCED_SUBSCRIPTION_ACTION_REMINDER_ADMIN:
@ -629,8 +684,7 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
$adminId,
$this->get_lang('MailRemindAdmin'),
$template->fetch('/advanced_subscription/views/reminder_notice_admin.tpl'),
$data['sessionId'],
true
$data['sessionId']
);
}
break;
@ -883,7 +937,7 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
'e=' . intval($params['newStatus']) . '&' .
'u=' . intval($params['studentUserId']) . '&' .
'q=' . intval($params['queueId']) . '&' .
'is_connected=' . true . '&' .
'is_connected=' . 1 . '&' .
'profile_completed=' . intval($params['profile_completed']) . '&' .
'v=' . $this->generateHash($params);
return $url;
@ -1037,4 +1091,90 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
{
return 'advanced_subscription';
}
/**
* Return the url to show subscription terms
* @param array $params
* @param int $mode
* @return string
*/
public function getTermsUrl($params, $mode = ADVANCED_SUBSCRIPTION_TERMS_MODE_POPUP)
{
$url = api_get_path(WEB_PLUGIN_PATH) . 'advanced_subscription/src/terms_and_conditions.php?' .
'a=' . Security::remove_XSS($params['action']) . '&' .
's=' . intval($params['sessionId']) . '&' .
'current_user_id=' . intval($params['currentUserId']) . '&' .
'e=' . intval($params['newStatus']) . '&' .
'u=' . intval($params['studentUserId']) . '&' .
'q=' . intval($params['queueId']) . '&' .
'is_connected=' . 1 . '&' .
'profile_completed=' . intval($params['profile_completed']) . '&' .
'r=' . intval($mode) . '&' .
'v=' . $this->generateHash($params);
// Launch popup
if ($mode == ADVANCED_SUBSCRIPTION_TERMS_MODE_POPUP) {
$url = 'javascript:void(window.open(\'' . $url .'\',\'AdvancedSubscriptionTerms\', \'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700px,height=600px\', \'100\' ))';
}
return $url;
}
/**
* Return the url to get mail rendered
* @param array $params
* @return string
*/
public function getRenderMailUrl($params)
{
$url = api_get_path(WEB_PLUGIN_PATH) . 'advanced_subscription/src/render_mail.php?' .
'q=' . $params['queueId'] . '&' .
'v=' . $this->generateHash($params);
return $url;
}
/**
* Return the last message id from queue row
* @param int $studentUserId
* @param int $sessionId
* @return int|bool
*/
public function getLastMessageId($studentUserId, $sessionId)
{
$studentUserId = intval($studentUserId);
$sessionId = intval($sessionId);
if (!empty($sessionId) && !empty($studentUserId)) {
$row = Database::select(
'last_message_id',
Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE),
array(
'where' => array(
'user_id = ? AND session_id = ?' => array($studentUserId, $sessionId),
)
)
);
if (count($row) > 0) {
return $row[0]['last_message_id'];
}
}
return false;
}
/**
* Return string replacing tags "{{}}"with variables assigned in $data
* @param string $templateContent
* @param array $data
* @return string
*/
public function renderTemplateString($templateContent, $data = array())
{
$twigString = new \Twig_Environment(new \Twig_Loader_String());
$templateContent = $twigString->render(
$templateContent,
$data
);
return $templateContent;
}
}

@ -509,7 +509,7 @@ class HookAdvancedSubscription extends HookObserver implements
// Check conditions
if ($status == ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE) {
// No in Queue, require queue subscription url action
$data['action_url'] = self::$plugin->getQueueUrl($params);
$data['action_url'] = self::$plugin->getTermsUrl($params);
} elseif ($status == ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED) {
// send url action
$data['action_url'] = self::$plugin->getSessionUrl($sessionId);
@ -521,7 +521,7 @@ class HookAdvancedSubscription extends HookObserver implements
$data['action_url'] = self::$plugin->getSessionUrl($sessionId);
} elseif ($status == ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE) {
// in Queue or not, cannot be subscribed to session
$data['action_url'] = self::$plugin->getQueueUrl($params);
$data['action_url'] = self::$plugin->getTermsUrl($params);
} else {
// In queue, output status message, no more info.
}

@ -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,78 @@
<?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['course'] = api_get_course_info_by_id($data['courseId']);
$data['acceptTermsUrl'] = $plugin->getQueueUrl($data);
$data['rejectTermsUrl'] = $plugin->getTermsUrl($data, ADVANCED_SUBSCRIPTION_TERMS_MODE_REJECT);
// Use Twig with String loader
$termsContent = $plugin->renderTemplateString($termsAndConditions, $data);
} 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,47 @@
<?php
/* For license terms, see /license.txt */
/**
* A script to render all mails templates
* @package chamilo.plugin.advanced_subscription
*/
require_once __DIR__ . '/../config.php';
// Protect test
api_protect_admin_script();
$data['action'] = 'confirm';
$data['currentUserId'] = 1;
$data['queueId'] = 0;
$data['is_connected'] = true;
$data['profile_completed'] = 90.0;
$data['sessionId'] = intval($_REQUEST['s']);
$data['studentUserId'] = intval($_REQUEST['u']);
$data['student'] = UserManager::get_user_info_by_id($data['studentUserId']);
$data['session'] = api_get_session_info($data['sessionId']);
if (!empty($data['sessionId']) && !empty($data['studentUserId'])) {
$plugin = AdvancedSubscriptionPlugin::create();
if (api_get_plugin_setting('courselegal', 'tool_enable')) {
$courseLegal = CourseLegalPlugin::create();
$courses = SessionManager::get_course_list_by_session_id($data['sessionId']);
$course = current($courses);
$data['courseId'] = $course['id'];
$data['course'] = api_get_course_info_by_id($data['courseId']);
$termsAndConditions = $courseLegal->getData($data['courseId'], $data['sessionId']);
$termsAndConditions = $termsAndConditions['content'];
$termsAndConditions = $plugin->renderTemplateString($termsAndConditions, $data);
$tpl = new Template($plugin->get_lang('Terms'));
$tpl->assign('session', $data['session']);
$tpl->assign('student', $data['student']);
$tpl->assign('sessionId', $data['sessionId']);
$tpl->assign('termsContent', $termsAndConditions);
$termsAndConditions = $tpl->fetch('/advanced_subscription/views/terms_and_conditions_to_pdf.tpl');
$pdf = new PDF();
$filename = 'terms' . sha1(rand(0,99999));
$pdf->content_to_pdf($termsAndConditions, null, $filename, null, 'F');
$fileDir = api_get_path(WEB_ARCHIVE_PATH) . $filename . '.pdf';
echo '<pre>', print_r($fileDir, 1), '</pre>';
}
}

@ -22,10 +22,46 @@ $params = array();
$params['user_id'] = intval($_REQUEST['u']);
$params['session_id'] = intval($_REQUEST['s']);
$params['profile_completed'] = 100;
$params['secret_key'] = 'ed639d402804ffa347b489be3e42f28058e402bf';
/**
* Copied code from WSHelperVerifyKey function
*/
/**
* Start WSHelperVerifyKey
*/
//error_log(print_r($params,1));
$check_ip = false;
$ip = trim($_SERVER['REMOTE_ADDR']);
// if we are behind a reverse proxy, assume it will send the
// HTTP_X_FORWARDED_FOR header and use this IP instead
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
list($ip1, $ip2) = split(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
$ip = trim($ip1);
}
// Check if a file that limits access from webservices exists and contains
// the restraining check
if (is_file(api_get_path(WEB_CODE_PATH) .'webservices/webservice-auth-ip.conf.php')) {
include api_get_path(WEB_CODE_PATH).'webservices/webservice-auth-ip.conf.php';
if (!empty($ws_auth_ip)) {
$check_ip = true;
}
}
global $_configuration;
if ($check_ip) {
$security_key = $_configuration['security_key'];
} else {
$security_key = $ip.$_configuration['security_key'];
//error_log($secret_key.'-'.$security_key);
}
/**
* End WSHelperVerifyKey
*/
$params['secret_key'] = sha1($security_key);
// Registration soap wsdl
$wsUrl = 'http://chamilo19.net/main/webservices/registration.soap.php?wsdl';
$wsUrl = api_get_path(WEB_CODE_PATH) . 'webservices/registration.soap.php?wsdl';
$options = array(
'location' => $wsUrl,
'uri' => $wsUrl,

@ -61,3 +61,22 @@
width: 100%;
height: 100%;
}
.legal-terms-popup{
margin-top: 5%;
margin-left: 5%;
margin-right: 5%;
}
.legal-terms{
width: 90%;
height: 50%;
}
.legal-terms-buttons {
text-align: right;
}
.legal-terms-title {
text-align: center;
}

@ -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">

@ -0,0 +1,23 @@
{# 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" />
<link href="{{ _p.web_plugin }}advanced_subscription/views/css/style.css" rel="stylesheet" type="text/css">
<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 #}
<div class="legal-terms-popup">
{{ termsContent }}
</div>
Loading…
Cancel
Save