Merge branch 'danbarretodev-advsub' into 1.10.x

1.10.x
Yannick Warnier 10 years ago
commit b71dde78de
  1. 2
      main/inc/lib/auth.lib.php
  2. 9
      main/inc/lib/extra_field.lib.php
  3. 2
      main/inc/lib/hook/HookWSRegistration.php
  4. 6
      main/inc/lib/internationalization.lib.php
  5. 277
      main/inc/lib/sessionmanager.lib.php
  6. 30
      main/inc/lib/usermanager.lib.php
  7. 17
      main/webservices/registration.soap.php
  8. 59
      plugin/advanced_subscription/README.md
  9. 281
      plugin/advanced_subscription/ajax/advanced_subscription.ajax.php
  10. 26
      plugin/advanced_subscription/config.php
  11. 1
      plugin/advanced_subscription/index.html
  12. 17
      plugin/advanced_subscription/install.php
  13. 134
      plugin/advanced_subscription/lang/english.php
  14. 134
      plugin/advanced_subscription/lang/spanish.php
  15. 1
      plugin/advanced_subscription/license.txt
  16. 12
      plugin/advanced_subscription/plugin.php
  17. 99
      plugin/advanced_subscription/readme.txt
  18. 940
      plugin/advanced_subscription/src/AdvancedSubscriptionPlugin.php
  19. 673
      plugin/advanced_subscription/src/HookAdvancedSubscription.php
  20. 88
      plugin/advanced_subscription/src/admin_view.php
  21. 123
      plugin/advanced_subscription/test/mails.php
  22. 17
      plugin/advanced_subscription/uninstall.php
  23. 75
      plugin/advanced_subscription/views/admin_accepted_notice_admin.tpl
  24. 75
      plugin/advanced_subscription/views/admin_accepted_notice_student.tpl
  25. 75
      plugin/advanced_subscription/views/admin_accepted_notice_superior.tpl
  26. 75
      plugin/advanced_subscription/views/admin_rejected_notice_admin.tpl
  27. 75
      plugin/advanced_subscription/views/admin_rejected_notice_student.tpl
  28. 75
      plugin/advanced_subscription/views/admin_rejected_notice_superior.tpl
  29. 139
      plugin/advanced_subscription/views/admin_view.tpl
  30. 63
      plugin/advanced_subscription/views/css/style.css
  31. BIN
      plugin/advanced_subscription/views/img/aprobar.png
  32. BIN
      plugin/advanced_subscription/views/img/avatar.png
  33. BIN
      plugin/advanced_subscription/views/img/desaprobar.png
  34. BIN
      plugin/advanced_subscription/views/img/footer.png
  35. BIN
      plugin/advanced_subscription/views/img/header.png
  36. BIN
      plugin/advanced_subscription/views/img/icon-avatar.png
  37. BIN
      plugin/advanced_subscription/views/img/line.png
  38. 75
      plugin/advanced_subscription/views/reminder_notice_admin.tpl
  39. 76
      plugin/advanced_subscription/views/reminder_notice_student.tpl
  40. 86
      plugin/advanced_subscription/views/reminder_notice_superior.tpl
  41. 87
      plugin/advanced_subscription/views/reminder_notice_superior_max.tpl
  42. 75
      plugin/advanced_subscription/views/student_no_superior_notice_admin.tpl
  43. 76
      plugin/advanced_subscription/views/student_no_superior_notice_student.tpl
  44. 75
      plugin/advanced_subscription/views/student_notice_student.tpl
  45. 84
      plugin/advanced_subscription/views/student_notice_superior.tpl
  46. 75
      plugin/advanced_subscription/views/superior_accepted_notice_admin.tpl
  47. 76
      plugin/advanced_subscription/views/superior_accepted_notice_student.tpl
  48. 76
      plugin/advanced_subscription/views/superior_accepted_notice_superior.tpl
  49. 75
      plugin/advanced_subscription/views/superior_rejected_notice_student.tpl
  50. 75
      plugin/advanced_subscription/views/superior_rejected_notice_superior.tpl
  51. 6
      tests/scripts/insert_session_fields.php

@ -630,7 +630,7 @@ class Auth
if ($session['nbr_courses'] > 0) {
$session['coach_name'] = api_get_person_name($session['firstname'], $session['lastname']);
$session['coach_name'] .= " ({$session['username']})";
$session['is_subscribed'] = SessionManager::isUserSusbcribedAsStudent($session['id'], $userId);
$session['is_subscribed'] = SessionManager::isUserSubscribedAsStudent($session['id'], $userId);
$sessionsToBrowse[] = $session;
}

@ -735,9 +735,14 @@ class ExtraField extends Model
$addOptions = array();
$optionsExists = false;
global $app;
$optionsExists = $app['orm.em']->getRepository('ChamiloLMS\Entity\ExtraFieldOptionRelFieldOption')->
findOneBy(array('fieldId' => $field_details['id']));
// Check if exist $app['orm.em'] object
if (isset($app['orm.em']) && is_object($app['orm.em'])) {
$optionsExists = $app['orm.em']
->getRepository('ChamiloLMS\Entity\ExtraFieldOptionRelFieldOption')
->findOneBy(array('fieldId' => $field_details['id']));
}
if ($optionsExists) {
if (isset($userInfo['status']) && !empty($userInfo['status'])) {

@ -34,7 +34,7 @@ class HookWSRegistration extends HookEvent implements HookWSRegistrationEventInt
{
/** @var \HookWSRegistrationObserverInterface $observer */
// check if already have server data
if (!isset($this->eventData['server'])) {
if (isset($this->eventData['server'])) {
// Save Hook event type data
$this->eventData['type'] = $type;
foreach ($this->observers as $observer) {

@ -3347,12 +3347,12 @@ function get_datepicker_langage_code() {
/**
* Returns the variable translated
* @param $variable the string to translate
* @param $pluginName the Plugin name
* @param string $variable the string to translate
* @param string $pluginName the Plugin name
* @return string the variable translated
*/
function get_plugin_lang($variable, $pluginName) {
eval("\$plugin = {$pluginName}::create();");
$plugin = $pluginName::create();
return $plugin->get_lang($variable);
}
/**

@ -5224,15 +5224,17 @@ class SessionManager
* @param int $userId The user id
* @return boolean Whether is subscribed
*/
public static function isUserSusbcribedAsStudent($sessionId, $userId)
public static function isUserSubscribedAsStudent($sessionId, $userId)
{
$sessionRelUserTable = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$sessionId = intval($sessionId);
$userId = intval($userId);
$sql = "SELECT COUNT(1) AS qty FROM $sessionRelUserTable
WHERE id_session = $sessionId AND id_user = $userId AND relation_type = 0";
// COUNT(1) actually returns the number of rows from the table (as if
// counting the results from the first column)
$sql = "SELECT COUNT(1) AS qty FROM $sessionRelUserTable "
. "WHERE id_session = $sessionId AND id_user = $userId AND relation_type = 0";
$result = Database::fetch_assoc(Database::query($sql));
@ -5312,7 +5314,6 @@ class SessionManager
* Check if the course belongs to the session
* @param int $sessionId The session id
* @param string $courseCode The course code
*
* @return bool
*/
public static function sessionHasCourse($sessionId, $courseCode)
@ -5436,6 +5437,273 @@ class SessionManager
));
}
/**
* Returns list of a few data from session (name, short description, start
* date, end date) and the given extra fields if defined based on a
* session category Id.
* @param int $categoryId The internal ID of the session category
* @param string $target Value to search for in the session field values
* @param array $extraFields A list of fields to be scanned and returned
* @return mixed
*/
public static function getShortSessionListAndExtraByCategory($categoryId, $target, $extraFields = null) {
// Init variables
$categoryId = (int) $categoryId;
$sessionList = array();
// Check if categoryId is valid
if ($categoryId > 0) {
$target = Database::escape_string($target);
$sTable = Database::get_main_table(TABLE_MAIN_SESSION);
$sfTable = Database::get_main_table(TABLE_MAIN_SESSION_FIELD);
$sfvTable = Database::get_main_table(TABLE_MAIN_SESSION_FIELD_VALUES);
// Join session field and session field values tables
$joinTable = $sfTable . ' sf INNER JOIN ' . $sfvTable . ' sfv ON sf.id = sfv.field_id';
$fieldsArray = array();
foreach ($extraFields as $field) {
$fieldsArray[] = Database::escape_string($field);
}
// Get the session list from session category and target
$sessionList = Database::select(
'id, name, date_start, date_end',
$sTable,
array(
'where' => array(
"session_category_id = ? AND id IN (
SELECT sfv.session_id FROM $joinTable WHERE
sfv.session_id = session.id
AND sf.field_variable = 'target'
AND sfv.field_value = ?
)" => array($categoryId, $target)
)
)
);
// Get session fields
$extraField = new ExtraField('session');
$questionMarks = substr(str_repeat('?, ', count($fieldsArray)), 0, -2);
$fieldsList = $extraField->get_all(array(
'field_variable IN ( ' . $questionMarks . ' )' => $fieldsArray
));
// Index session fields
foreach ($fieldsList as $field) {
$fields[$field['id']] = $field['field_variable'];
}
// Get session field values
$extra = new ExtraFieldValue('session');
$sessionFieldValueList = $extra->get_all(array('field_id IN ( ' . $questionMarks . ' )' => array_keys($fields)));
// Add session fields values to session list
foreach ($sessionList as $id => &$session) {
foreach ($sessionFieldValueList as $sessionFieldValue) {
// Match session field values to session
if ($sessionFieldValue['session_id'] == $id) {
// Check if session field value is set in session field list
if (isset($fields[$sessionFieldValue['field_id']])) {
$var = $fields[$sessionFieldValue['field_id']];
$val = $sessionFieldValue['field_value'];
// Assign session field value to session
$session[$var] = $val;
}
}
}
}
}
return $sessionList;
}
/**
* Return the Session Category id searched by name
* @param string $categoryName Name attribute of session category used for search query
* @param bool $force boolean used to get even if something is wrong (e.g not unique name)
* @return int|array If success, return category id (int), else it will return an array
* with the next structure:
* array('error' => true, 'errorMessage' => ERROR_MESSAGE)
*/
public static function getSessionCategoryIdByName($categoryName, $force = false)
{
// Start error result
$errorResult = array('error' => true, 'errorMessage' => get_lang('ThereWasAnError'));
$categoryName = Database::escape_string($categoryName);
// Check if is not empty category name
if (!empty($categoryName)) {
$sessionCategoryTable = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
// Get all session category with same name
$result = Database::select(
'id',
$sessionCategoryTable,
array(
'where' => array(
'name = ?' => $categoryName,
)
)
);
// Check the result
if ($result < 1) {
// If not found any result, update error message
$errorResult['errorMessage'] = 'Not found any session category name ' . $categoryName;
} elseif (count($result) > 1 && !$force) {
// If found more than one result and force is disabled, update error message
$errorResult['errorMessage'] = 'Found many session categories';
} elseif (count($result) == 1 || $force) {
// If found just one session category or force option is enabled
return key($result);
}
} else {
// category name is empty, update error message
$errorResult['errorMessage'] = 'Not valid category name';
}
return $errorResult;
}
/**
* Return all data from sessions (plus extra field, course and coach data) by category id
* @param int $sessionCategoryId session category id used to search sessions
* @return array If success, return session list and more session related data, else it will return an array
* with the next structure:
* array('error' => true, 'errorMessage' => ERROR_MESSAGE)
*/
public static function getSessionListAndExtraByCategoryId($sessionCategoryId)
{
// Start error result
$errorResult = array('error' => true, 'errorMessage' => get_lang('ThereWasAnError'));
$sessionCategoryId = intval($sessionCategoryId);
// Check if sesssion category id is valid
if ($sessionCategoryId > 0) {
// Get table names
$sessionTable = Database::get_main_table(TABLE_MAIN_SESSION);
$sessionFieldTable = Database::get_main_table(TABLE_MAIN_SESSION_FIELD);
$sessionFieldValueTable = Database::get_main_table(TABLE_MAIN_SESSION_FIELD_VALUES);
$sessionCourseUserTable = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$userTable = Database::get_main_table(TABLE_MAIN_USER);
$courseTable = Database::get_main_table(TABLE_MAIN_COURSE);
// Get all data from all sessions whit the session category specified
$sessionList = Database::select(
'*',
$sessionTable,
array(
'where' => array(
'session_category_id = ?' => $sessionCategoryId
)
)
);
// Check if session list query had result
if (!empty($sessionList)) {
// implode all session id
$sessionIdsString = '(' . implode(', ', array_keys($sessionList)) . ')';
// Get all field variables
$sessionFieldList = Database::select('id, field_variable', $sessionFieldTable);
// Get all field values
$sessionFieldValueList = Database::select(
'session_id, field_id, field_value',
$sessionFieldValueTable,
array('where' => array('session_id IN ?' => $sessionIdsString))
);
// Check if session field values had result
if (!empty($sessionFieldValueList)) {
$sessionFieldValueListBySession = array();
foreach ($sessionFieldValueList as $key => $sessionFieldValue) {
// Create an array to index ids to session id
$sessionFieldValueListBySession[$sessionFieldValue['session_id']][] = $key;
}
}
// Query used to find course-coaches from sessions
$sql = "SELECT scu.id_session AS session_id, c.id AS course_id, c.code AS course_code," .
" c.title AS course_title, u.username AS coach_username, u.firstname AS coach_firstname, " .
" u.lastname AS coach_lastname " .
"FROM $courseTable c " .
"INNER JOIN $sessionCourseUserTable scu ON c.code = scu.course_code " .
"INNER JOIN $userTable u ON scu.id_user = u.user_id " .
"WHERE scu.status = 2 AND scu.id_session IN $sessionIdsString " .
"ORDER BY scu.id_session ASC ";
$res = Database::query($sql);
$sessionCourseList = Database::store_result($res, 'ASSOC');
// Check if course list had result
if (!empty($sessionCourseList)) {
foreach ($sessionCourseList as $key => $sessionCourse) {
// Create an array to index ids to session_id
$sessionCourseListBySession[$sessionCourse['session_id']][] = $key;
}
}
// Join lists
if (is_array($sessionList)) {
foreach ($sessionList as $id => &$row) {
if (
!empty($sessionFieldValueListBySession) &&
is_array($sessionFieldValueListBySession[$id])
) {
// If have an index array for session extra fields, use it to join arrays
foreach ($sessionFieldValueListBySession[$id] as $key) {
$row['extra'][$key] = array(
'field_name' => $sessionFieldList[$sessionFieldValueList[$key]['field_id']]['field_variable'],
'field_value' => $sessionFieldValueList[$key]['field_value'],
);
}
}
if (
!empty($sessionCourseListBySession) &&
is_array($sessionCourseListBySession[$id])
) {
// If have an index array for session course coach, use it to join arrays
foreach ($sessionCourseListBySession[$id] as $key) {
$row['course'][$key] = array(
'course_id' => $sessionCourseList[$key]['course_id'],
'course_code' => $sessionCourseList[$key]['course_code'],
'course_title' => $sessionCourseList[$key]['course_title'],
'coach_username' => $sessionCourseList[$key]['coach_username'],
'coach_firstname' => $sessionCourseList[$key]['coach_firstname'],
'coach_lastname' => $sessionCourseList[$key]['coach_lastname'],
);
}
}
}
}
return $sessionList;
} else {
// Not found result, update error message
$errorResult['errorMessage'] = 'Not found any session for session category id ' . $sessionCategoryId;
}
}
return $errorResult;
}
/**
* Return session description from session id
* @param int $sessionId
* @return string
*/
public static function getDescriptionFromSessionId($sessionId)
{
// Init variables
$sessionId = intval($sessionId);
$description = '';
// Check if session id is valid
if ($sessionId > 0) {
// Select query from session id
$rows = Database::select(
'description',
Database::get_main_table(TABLE_MAIN_SESSION),
array(
'where' => array(
'id = ?' => $sessionId
)
)
);
// Check if select query result is not empty
if (!empty($rows)) {
// Get session description
$description = $rows[0]['description'];
}
}
return $description;
}
/**
* Get a session list filtered by name, description or any of the given extra fields
* @param string $term The term to search
@ -5518,5 +5786,4 @@ class SessionManager
return $resultData;
}
}

@ -5112,4 +5112,34 @@ EOF;
return 0;
}
/**
* Get the boss user ID from a followed user id
* @param $userId
* @return bool
*/
public static function getStudentBoss($userId)
{
$userId = intval($userId);
if ($userId > 0) {
$userRelTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
$row = Database::select(
'DISTINCT friend_user_id AS boss_id',
$userRelTable,
array(
'where' => array(
'user_id = ? AND relation_type = ? LIMIT 1' => array(
$userId,
USER_RELATION_TYPE_BOSS,
)
)
)
);
if (!empty($row)) {
return $row[0]['boss_id'];
}
}
return false;
}
}

@ -9,13 +9,26 @@ $libpath = api_get_path(LIBRARY_PATH);
$debug = false;
define('WS_ERROR_SECRET_KEY', 1);
define('WS_ERROR_NOT_FOUND_RESULT', 2);
define('WS_ERROR_INVALID_INPUT', 3);
define('WS_ERROR_SETTING', 4);
function return_error($code) {
$fault = null;
switch ($code) {
case WS_ERROR_SECRET_KEY:
$fault = new soap_fault('Server', '', 'Secret key is not correct or params are not correctly set');
break;
break;
case WS_ERROR_NOT_FOUND_RESULT:
$fault = new soap_fault('Server', '', 'No result was found for this query');
break;
case WS_ERROR_INVALID_INPUT:
$fault = new soap_fault('Server', '', 'The input variables are invalid o are not correctly set');
break;
case WS_ERROR_SETTING:
$fault = new soap_fault('Server', '', 'Please check the configuration for this webservice');
break;
}
return $fault;
}
@ -5428,7 +5441,7 @@ $server->wsdl->addComplexType(
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP:ENC:arrayType',
array('ref'=>'SOAP-ENC:arrayType',
'wsdl:arrayType'=>'tns:session[]')
),
'tns:session'

@ -0,0 +1,59 @@
Advanced subscription plugin for Chamilo LMS
=======================================
Plugin to manage the registration queue and communication to sessions
from an external website creating a queue to control session subscription
and sending emails to approve student subscription requests
# Requirements
Chamilo LMS 1.10.0 or greater
# Settings
These settings have to be configured in the Configuration screen for the plugin
Parameters | Description
------------- |-------------
Webservice url | Url to external website to get user profile (SOAP)
Induction requirement | Checkbox to enable induction as requirement
Courses count limit | Number of times a student is allowed at most to course by year
Yearly hours limit | Teaching hours a student is allowed at most to course by year
Yearly cost unit converter | The cost of a taxation unit value (TUV)
Yearly cost limit | Number of TUV student courses is allowed at most to cost by year
Year start date | Date (dd/mm) when the year limit is renewed
Minimum percentage profile | Minimum percentage required from external website profile
# Hooks
This plugin uses the following hooks (defined since Chamilo LMS 1.10.0):
* HookAdminBlock
* HookWSRegistration
* HookNotificationContent
* HookNotificationTitle
# Web services
This plugin also enables new webservices that can be used from registration.soap.php
* HookAdvancedSubscription..WSSessionListInCategory
* HookAdvancedSubscription..WSSessionGetDetailsByUser
* HookAdvancedSubscription..WSListSessionsDetailsByCategory
See `/plugin/advanced_subscription/src/HookAdvancedSubscription.php` to check Web services inputs and outputs
# How does this plugin works?
After install, fill the required parameters (described above)
Use web services to communicate course session inscription from external website
This allows students to search course sessions and subscribe if they match
the requirements.
The normal process is:
* Student searches course session
* Student reads session info depending student data
* Student requests to be subscribed
* A confirmation email is sent to student
* An authorization email is sent to student's superior (STUDENT BOSS role) or admins (when there is no superior) who will accept or reject the student request
* When the superior accepts or rejects, an email will be sent to the student and superior (or admin), respectively
* To complete the subscription, the request must be validated and accepted by an admin

@ -0,0 +1,281 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script to receipt request to subscribe and confirmation action to queue
* @author Daniel Alejandro Barreto Alva <daniel.barreto@beeznest.com>
* @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['action'] = Security::remove_XSS($_REQUEST['a']);
$data['sessionId'] = intval($_REQUEST['s']);
$data['currentUserId'] = intval($_REQUEST['current_user_id']);
$data['studentUserId'] = intval($_REQUEST['u']);
$data['queueId'] = intval($_REQUEST['q']);
$data['newStatus'] = intval($_REQUEST['e']);
$data['is_connected'] = isset($_REQUEST['is_connected']) ? boolval($_REQUEST['is_connected']) : false;
$data['profile_completed'] = isset($_REQUEST['profile_completed']) ? floatval($_REQUEST['profile_completed']) : 0;
// Init result array
$result = array('error' => true, 'errorMessage' => get_lang('ThereWasAnError'));
// Check if data is valid or is for start subscription
$verified = $plugin->checkHash($data, $hash) || $data['action'] == 'subscribe';
if ($verified) {
switch($data['action']) {
case 'check': // Check minimum requirements
try {
$res = AdvancedSubscriptionPlugin::create()->isAllowedToDoRequest($data['studentUserId'], $data);
if ($res) {
$result['error'] = false;
$result['errorMessage'] = 'No error';
$result['pass'] = true;
} else {
$result['errorMessage'] = 'User can not be subscribed';
$result['pass'] = false;
}
} catch (\Exception $e) {
$result['errorMessage'] = $e->getMessage();
}
break;
case 'subscribe': // Subscription
// Start subscription to queue
$res = AdvancedSubscriptionPlugin::create()->startSubscription($data['studentUserId'], $data['sessionId'], $data);
// Check if queue subscription was successful
if ($res === true) {
// Prepare data
// Get session data
// Assign variables
$fieldsArray = array('description', 'target', 'mode', 'publication_end_date', 'recommended_number_of_participants');
$sessionArray = api_get_session_info($data['sessionId']);
$extraSession = new ExtraFieldValue('session');
$extraField = new ExtraField('session');
// Get session fields
$fieldList = $extraField->get_all(array(
'field_variable IN ( ?, ?, ?, ?, ?)' => $fieldsArray
));
// Index session fields
foreach ($fieldList as $field) {
$fields[$field['id']] = $field['field_variable'];
}
$mergedArray = array_merge(array($data['sessionId']), array_keys($fields));
$sessionFieldValueList = $extraSession->get_all(array('session_id = ? field_id IN ( ?, ?, ?, ?, ?, ?, ? )' => $mergedArray));
foreach ($sessionFieldValueList as $sessionFieldValue) {
// Check if session field value is set in session field list
if (isset($fields[$sessionFieldValue['field_id']])) {
$var = $fields[$sessionFieldValue['field_id']];
$val = $sessionFieldValue['field_value'];
// Assign session field value to session
$sessionArray[$var] = $val;
}
}
// Get student data
$studentArray = api_get_user_info($data['studentUserId']);
$studentArray['picture'] = UserManager::get_user_picture_path_by_id($studentArray['user_id'], 'web', false, true);
$studentArray['picture'] = UserManager::get_picture_user($studentArray['user_id'], $studentArray['picture']['file'], 22, USER_IMAGE_SIZE_MEDIUM);
// Get superior data if exist
$superiorId = UserManager::getStudentBoss($data['studentUserId']);
if (!empty($superiorId)) {
$superiorArray = api_get_user_info($superiorId);
} else {
$superiorArray = null;
}
// Get admin data
$adminsArray = UserManager::get_all_administrators();
$isWesternNameOrder = api_is_western_name_order();
foreach ($adminsArray as &$admin) {
$admin['complete_name'] = $isWesternNameOrder ?
$admin['firstname'] . ', ' . $admin['lastname'] :
$admin['lastname'] . ', ' . $admin['firstname']
;
}
unset($admin);
// Set data
$data['action'] = 'confirm';
$data['student'] = $studentArray;
$data['superior'] = $superiorArray;
$data['admins'] = $adminsArray;
$data['session'] = $sessionArray;
$data['signature'] = api_get_setting('Institution');
// Check if student boss exists
if (empty($superiorId)) {
// Student boss does not exist
// Update status to accepted by boss
$res = $plugin->updateQueueStatus($data, ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_APPROVED);
if (!empty($res)) {
// Prepare admin url
$data['admin_view_url'] = api_get_path(WEB_PLUGIN_PATH) .
'advanced_subscription/src/admin_view.php?s=' . $data['sessionId'];
// Send mails
$result['mailIds'] = $plugin->sendMail($data, ADVANCED_SUBSCRIPTION_ACTION_STUDENT_REQUEST_NO_BOSS);
// Check if mails were sent
if (!empty($result['mailIds'])) {
$result['error'] = false;
$result['errorMessage'] = 'No error';
$result['pass'] = true;
// 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;
exit;
}
}
}
} else {
// Student boss does exist
// Get url to be accepted by boss
$data['newStatus'] = ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_APPROVED;
$data['student']['acceptUrl'] = $plugin->getQueueUrl($data);
// Get url to be rejected by boss
$data['newStatus'] = ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_DISAPPROVED;
$data['student']['rejectUrl'] = $plugin->getQueueUrl($data);
// Send mails
$result['mailIds'] = $plugin->sendMail($data, ADVANCED_SUBSCRIPTION_ACTION_STUDENT_REQUEST);
// Check if mails were sent
if (!empty($result['mailIds'])) {
$result['error'] = false;
$result['errorMessage'] = 'No error';
$result['pass'] = true;
// 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;
exit;
}
}
}
} else {
if (is_string($res)) {
$result['errorMessage'] = $res;
} else {
$result['errorMessage'] = 'User can not be subscribed';
}
$result['pass'] = false;
}
break;
case 'confirm':
// Check if new status is set
if (isset($data['newStatus'])) {
// Update queue status
$res = $plugin->updateQueueStatus($data, $data['newStatus']);
if ($res === true) {
// Prepare data
// Prepare session data
$fieldsArray = array('description', 'target', 'mode', 'publication_end_date', 'recommended_number_of_participants');
$sessionArray = api_get_session_info($data['sessionId']);
$extraSession = new ExtraFieldValue('session');
$extraField = new ExtraField('session');
// Get session fields
$fieldList = $extraField->get_all(array(
'field_variable IN ( ?, ?, ?, ?, ?)' => $fieldsArray
));
// Index session fields
foreach ($fieldList as $field) {
$fields[$field['id']] = $field['field_variable'];
}
$mergedArray = array_merge(array($data['sessionId']), array_keys($fields));
$sessionFieldValueList = $extraSession->get_all(array('session_id = ? field_id IN ( ?, ?, ?, ?, ?, ?, ? )' => $mergedArray));
foreach ($sessionFieldValueList as $sessionFieldValue) {
// Check if session field value is set in session field list
if (isset($fields[$sessionFieldValue['field_id']])) {
$var = $fields[$sessionFieldValue['field_id']];
$val = $sessionFieldValue['field_value'];
// Assign session field value to session
$sessionArray[$var] = $val;
}
}
// Prepare student data
$studentArray = api_get_user_info($data['studentUserId']);
$studentArray['picture'] = UserManager::get_user_picture_path_by_id($studentArray['user_id'], 'web', false, true);
$studentArray['picture'] = UserManager::get_picture_user($studentArray['user_id'], $studentArray['picture']['file'], 22, USER_IMAGE_SIZE_MEDIUM);
// Prepare superior data
$superiorId = UserManager::getStudentBoss($data['studentUserId']);
if (!empty($superiorId)) {
$superiorArray = api_get_user_info($superiorId);
} else {
$superiorArray = null;
}
// Prepare admin data
$adminsArray = UserManager::get_all_administrators();
$isWesternNameOrder = api_is_western_name_order();
foreach ($adminsArray as &$admin) {
$admin['complete_name'] = $isWesternNameOrder ?
$admin['firstname'] . ', ' . $admin['lastname'] :
$admin['lastname'] . ', ' . $admin['firstname']
;
}
unset($admin);
// Set data
$data['student'] = $studentArray;
$data['superior'] = $superiorArray;
$data['admins'] = $adminsArray;
$data['session'] = $sessionArray;
$data['signature'] = api_get_setting('Institution');
$data['admin_view_url'] = api_get_path(WEB_PLUGIN_PATH) . 'advanced_subscription/src/admin_view.php?s=' . $data['sessionId'];
// Check if exist and action in data
if (empty($data['action'])) {
// set action in data by new status
switch ($data['newStatus']) {
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_APPROVED:
$data['action'] = ADVANCED_SUBSCRIPTION_ACTION_SUPERIOR_APPROVE;
break;
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_DISAPPROVED:
$data['action'] = ADVANCED_SUBSCRIPTION_ACTION_SUPERIOR_DISAPPROVE;
break;
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED:
$data['action'] = ADVANCED_SUBSCRIPTION_ACTION_ADMIN_APPROVE;
break;
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_DISAPPROVED:
$data['action'] = ADVANCED_SUBSCRIPTION_ACTION_ADMIN_DISAPPROVE;
break;
default:
break;
}
}
// Student Session inscription
if ($data['newStatus'] == ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED) {
SessionManager::suscribe_users_to_session($data['sessionId'], array($data['studentUserId']), null, false);
}
// Send mails
$result['mailIds'] = $plugin->sendMail($data, $data['action']);
// Check if mails were sent
if (!empty($result['mailIds'])) {
$result['error'] = false;
$result['errorMessage'] = 'User has been processed';
// 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;
exit;
}
}
} else {
$result['errorMessage'] = 'User queue can not be updated';
}
}
break;
default:
$result['errorMessage'] = 'This action does not exist!';
}
}
// Echo result as json
echo json_encode($result);

@ -0,0 +1,26 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Config the plugin
* @author Daniel Alejandro Barreto Alva <daniel.barreto@beeznest.com>
* @package chamilo.plugin.advanced_subscription
*/
define('TABLE_ADVANCED_SUBSCRIPTION_QUEUE', 'plugin_advanced_subscription_queue');
define('ADVANCED_SUBSCRIPTION_ACTION_STUDENT_REQUEST', 0);
define('ADVANCED_SUBSCRIPTION_ACTION_SUPERIOR_APPROVE', 1);
define('ADVANCED_SUBSCRIPTION_ACTION_SUPERIOR_DISAPPROVE', 2);
define('ADVANCED_SUBSCRIPTION_ACTION_SUPERIOR_SELECT', 3);
define('ADVANCED_SUBSCRIPTION_ACTION_ADMIN_APPROVE', 4);
define('ADVANCED_SUBSCRIPTION_ACTION_ADMIN_DISAPPROVE', 5);
define('ADVANCED_SUBSCRIPTION_ACTION_STUDENT_REQUEST_NO_BOSS', 6);
define('ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE', -1);
define('ADVANCED_SUBSCRIPTION_QUEUE_STATUS_START', 0);
define('ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_DISAPPROVED', 1);
define('ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_APPROVED', 2);
define('ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_DISAPPROVED', 3);
define('ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED', 10);
require_once __DIR__ . '/../../main/inc/global.inc.php';

@ -0,0 +1,17 @@
<?php
/* For license terms, see /license.txt */
/**
* This script is included by main/admin/settings.lib.php and generally
* includes things to execute in the main database (settings_current table)
* @package chamilo.plugin.advanced_subscription
*/
/**
* Initialization
*/
require_once dirname(__FILE__) . '/config.php';
if (!api_is_platform_admin()) {
die ('You must have admin permissions to install plugins');
}
AdvancedSubscriptionPlugin::create()->install();

@ -0,0 +1,134 @@
<?php
/* Strings for settings */
$strings['plugin_title'] = 'Advanced Subscription';
$strings['plugin_comment'] = 'Plugin for managing the registration queue and communication to sessions from an external website';
$strings['ws_url'] = 'Webservice url';
$strings['ws_url_help'] = 'La URL de la cual se solicitará información para el proceso de la inscripción avanzada';
$strings['check_induction'] = 'Activate induction course requirement';
$strings['check_induction_help'] = 'Check to require induction course';
$strings['yearly_cost_limit'] = 'Yearly limit TUV for courses (measured in Taxation units)';
$strings['yearly_cost_limit_help'] = "How much TUV the student courses should cost at most.";
$strings['yearly_hours_limit'] = 'Yearly limit teaching hours for courses';
$strings['yearly_hours_limit_help'] = "How many teching hours the student may learn by year.";
$strings['yearly_cost_unit_converter'] = 'Taxation unit value (TUV)';
$strings['yearly_cost_unit_converter_help'] = "The taxation unit value for current year in local currency";
$strings['courses_count_limit'] = 'Yearly limit times for courses';
$strings['courses_count_limit_help'] = "How many times a student can course, this does <strong>not</strong> include induction courses";
$strings['course_session_credit_year_start_date'] = 'Year start date';
$strings['course_session_credit_year_start_date_help'] = "a date (dd/mm)";
$strings['min_profile_percentage'] = "Minimum required of completed percentage profile";
$strings['min_profile_percentage_help'] = "Percentage number( > 0.00 y < 100.00)";
/* String for error message about requirements */
$strings['AdvancedSubscriptionNotConnected'] = "You are not connected to platform. Please login first";
$strings['AdvancedSubscriptionProfileIncomplete'] = "Your percentage completed profile require to exceed minimum percentage. Please complete percentage";
$strings['AdvancedSubscriptionIncompleteInduction'] = "You have not yet completed induction course. Please complete it first";
$strings['AdvancedSubscriptionCostXLimitReached'] = "We are sorry, you have already reached yearly limit %s TUV cost for courses ";
$strings['AdvancedSubscriptionTimeXLimitReached'] = "We are sorry, you have already reached yearly limit %s hours for courses";
$strings['AdvancedSubscriptionCourseXLimitReached'] = "We are sorry, you have already reached yearly limit %s times for courses";
$strings['AdvancedSubscriptionNotMoreAble'] = "We are sorry, you no longer fulfills the initial conditions to subscribe this course";
$strings['AdvancedSubscriptionIncompleteParams'] = "The parameters are wrong or incomplete.";
$strings['AdvancedSubscriptionIsNotEnabled'] = "Advanced subscription is not enabled";
$strings['AdvancedSubscriptionNoQueue'] = "You are not subscribed for this course.";
$strings['AdvancedSubscriptionNoQueueIsAble'] = "You are not subscribed, but you are qualified for this course.";
$strings['AdvancedSubscriptionQueueStart'] = "Your subscription request is pending for approval by your boss, please wait attentive.";
$strings['AdvancedSubscriptionQueueBossDisapproved'] = "We are sorry, your subscription was rejected by your boss.";
$strings['AdvancedSubscriptionQueueBossApproved'] = "Your subscription request has been accepted by your boss, now is pending for vacancies.";
$strings['AdvancedSubscriptionQueueAdminDisapproved'] = "We are sorry, your subscription was rejected by the administrator.";
$strings['AdvancedSubscriptionQueueAdminApproved'] = "Congratulation, your subscription request has been accepted by administrator";
$strings['AdvancedSubscriptionQueueDefaultX'] = "There was an error, queue status %d is not defined by system.";
// Mail translations
$strings['MailStudentRequest'] = 'Student registration request';
$strings['MailBossAccept'] = 'Registration request accepted by boss';
$strings['MailBossReject'] = 'Registration request rejected by boss';
$strings['MailStudentRequestSelect'] = 'Student registration requests selection';
$strings['MailAdminAccept'] = 'Registration request accepted by administrator';
$strings['MailAdminReject'] = 'Registration request rejected by administrator';
$strings['MailStudentRequestNoBoss'] = 'Student registration request without boss';
// TPL langs
// Admin view
$strings['SelectASession'] = 'Select a training session';
$strings['SessionName'] = 'Session name';
$strings['Target'] = 'Target audience';
$strings['Vacancies'] = 'Vacancies';
$strings['RecommendedNumberOfParticipants'] = 'Recommended number of participants';
$strings['PublicationEndDate'] = 'Publication end date';
$strings['Mode'] = 'Mode';
$strings['Postulant'] = 'Postulant';
$strings['InscriptionDate'] = 'Inscription date';
$strings['BossValidation'] = 'Boss validation';
$strings['Decision'] = 'Decision';
$strings['AdvancedSubscriptionAdminViewTitle'] = 'Subscription request confirmation result';
$strings['AcceptInfinitive'] = 'Accept';
$strings['RejectInfinitive'] = 'Reject';
$strings['AreYouSureYouWantToAcceptSubscriptionOfX'] = 'Are you sure you want to accept the subscription of %s?';
$strings['AreYouSureYouWantToRejectSubscriptionOfX'] = 'Are you sure you want to reject the subscription of %s?';
$strings['MailTitle'] = 'Received request for course %s';
$strings['MailDear'] = 'Dear:';
$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.';
// 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.';
// 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.';
// 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>';
// 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.';
// 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>';
// 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.';

@ -0,0 +1,134 @@
<?php
/* Strings for settings */
$strings['plugin_title'] = 'Inscripción Avanzada';
$strings['plugin_comment'] = 'Plugin que permite gestionar la inscripción en cola a sesiones con comunicación a a un portal externo';
$strings['ws_url'] = 'URL del Webservice';
$strings['ws_url_help'] = 'La URL de la cual se solicitará información para el proceso de la inscripción avanzada';
$strings['check_induction'] = 'Activar requerimiento de curso inducción';
$strings['check_induction_help'] = 'Escoja si se requiere que se complete los cursos de inducción';
$strings['yearly_cost_limit'] = 'Límite de UITs';
$strings['yearly_cost_limit_help'] = "El límite de UITs de cursos que se pueden llevar en un año calendario del año actual.";
$strings['yearly_hours_limit'] = 'Límite de horas lectivas';
$strings['yearly_hours_limit_help'] = "El límite de horas lectivas de cursos que se pueden llevar en un año calendario del año actual.";
$strings['yearly_cost_unit_converter'] = 'Valor de un UIT';
$strings['yearly_cost_unit_converter_help'] = "El valor en Soles de un UIT del año actual.";
$strings['courses_count_limit'] = 'Límite de sesiones';
$strings['courses_count_limit_help'] = "El límite de cantidad de cursos (sesiones) que se pueden llevar en un año calendario del año actual y que <strong>no</strong> sean el curso de inducción";
$strings['course_session_credit_year_start_date'] = 'Fecha de inicio';
$strings['course_session_credit_year_start_date_help'] = "Fecha de inicio del año (día/mes)";
$strings['min_profile_percentage'] = 'Porcentage de perfil completado mínimo requerido';
$strings['min_profile_percentage_help'] = 'Número porcentage ( > 0.00 y < 100.00)';
/* String for error message about requirements */
$strings['AdvancedSubscriptionNotConnected'] = "Usted no está conectado en la plataforma. Por favor ingrese su usuario / constraseña para poder inscribirse";
$strings['AdvancedSubscriptionProfileIncomplete'] = "Su perfil no es lo suficientemente completo para poder inscribirse al curso. Por favor complete su perfil";
$strings['AdvancedSubscriptionIncompleteInduction'] = "Usted aún no ha completado el curso de inducción. Por favor complete el curso inducción";
$strings['AdvancedSubscriptionCostXLimitReached'] = "Lo sentimos, usted ya ha alcanzado el límite anual de %s UIT para los cursos que ha seguido este año";
$strings['AdvancedSubscriptionTimeXLimitReached'] = "Lo sentimos, usted ya ha alcanzado el límite anual de %s horas para los cursos que ha seguido este año";
$strings['AdvancedSubscriptionCourseXLimitReached'] = "Lo sentimos, usted ya ha alcanzado el límite anual de %s cursos que ha seguido este año";
$strings['AdvancedSubscriptionNotMoreAble'] = "Lo sentimos, usted ya no cumple con las condiciones iniciales para poder inscribirse al curso";
$strings['AdvancedSubscriptionIncompleteParams'] = "Los parámetros enviados no están completos o no son los correctos.";
$strings['AdvancedSubscriptionIsNotEnabled'] = "La inscripción avanzada no está activada";
$strings['AdvancedSubscriptionNoQueue'] = "You are not subscribed for this course.";
$strings['AdvancedSubscriptionNoQueueIsAble'] = "You are not subscribed, but you are qualified for this course.";
$strings['AdvancedSubscriptionQueueStart'] = "Your subscription request is pending for approval by your boss, please wait attentive.";
$strings['AdvancedSubscriptionQueueBossDisapproved'] = "We are sorry, your subscription was rejected by your boss.";
$strings['AdvancedSubscriptionQueueBossApproved'] = "Your subscription request has been accepted by your boss, now is pending for vacancies.";
$strings['AdvancedSubscriptionQueueAdminDisapproved'] = "We are sorry, your subscription was rejected by the administrator.";
$strings['AdvancedSubscriptionQueueAdminApproved'] = "Congratulation, your subscription request has been accepted by administrator";
$strings['AdvancedSubscriptionQueueDefaultX'] = "There was an error, queue status %d is not defined by system.";
// Mail translations
$strings['MailStudentRequest'] = 'Solicitud de registro de estudiante';
$strings['MailBossAccept'] = 'Solicitud de registro aceptada por superior';
$strings['MailBossReject'] = 'Solicitud de registro rechazada por superior';
$strings['MailStudentRequestSelect'] = 'Selección de solicitudes de registro de estudiante';
$strings['MailAdminAccept'] = 'Solicitud de registro aceptada por administrador';
$strings['MailAdminReject'] = 'Solicitud de registro rechazada por administrador';
$strings['MailStudentRequestNoBoss'] = 'Solicitud de registro de estudiante sin superior';
// TPL translations
// Admin view
$strings['SelectASession'] = 'Elija una sesión de formación';
$strings['SessionName'] = 'Nombre de la sesión';
$strings['Target'] = 'Publico objetivo';
$strings['Vacancies'] = 'Vacantes';
$strings['RecommendedNumberOfParticipants'] = 'Número recomendado de participantes';
$strings['PublicationEndDate'] = 'Fecha fin de publicación';
$strings['Mode'] = 'Modalidad';
$strings['Postulant'] = 'Postulante';
$strings['InscriptionDate'] = 'Fecha de inscripción';
$strings['BossValidation'] = 'Validación del superior';
$strings['Decision'] = 'Decisión';
$strings['AdvancedSubscriptionAdminViewTitle'] = 'Resultado de confirmación de solicitud de inscripción';
$strings['AcceptInfinitive'] = 'Aceptar';
$strings['RejectInfinitive'] = 'Rechazar';
$strings['AreYouSureYouWantToAcceptSubscriptionOfX'] = '¿Está seguro que quiere aceptar la inscripción de %s?';
$strings['AreYouSureYouWantToRejectSubscriptionOfX'] = '¿Está seguro que quiere rechazar la inscripción de %s?';
$strings['MailTitle'] = 'Solicitud recibida para el curso %s';
$strings['MailDear'] = 'Estimado(a):';
$strings['MailThankYou'] = 'Gracias.';
$strings['MailThankYouCollaboration'] = 'Gracias por su colaboración.';
// Admin Accept
$strings['MailTitleAdminAcceptToAdmin'] = 'Información: Validación de inscripción recibida';
$strings['MailContentAdminAcceptToAdmin'] = 'Hemos recibido y registrado su validación de la inscripción de <strong>%s</strong> al curso <strong>%s</strong>';
$strings['MailTitleAdminAcceptToStudent'] = 'Aprobada: ¡Su inscripción al curso %s fue confirmada!';
$strings['MailContentAdminAcceptToStudent'] = 'Nos complace informarle que su inscripción al curso <strong>%s</strong> iniciando el <strong>%s</strong> fue validada por los administradores. Esperamos mantenga todo su ánimo y participe en otro curso o, en otra oportunidad, a este mismo curso.';
$strings['MailTitleAdminAcceptToSuperior'] = 'Información: Validación de inscripción de %s al curso %s';
$strings['MailContentAdminAcceptToSuperior'] = 'La inscripción de <strong>%s</strong> al curso <strong>%s</strong> iniciando el <strong>%s</strong>, que estaba pendiente de validación por los organizadores del curso, fue validada hacen unos minutos. Esperamos nos ayude en asegurar la completa disponibilidad de su colaborador(a) para la duración completa del curso.';
// Admin Reject
$strings['MailTitleAdminRejectToAdmin'] = 'Información: rechazo de inscripción recibido';
$strings['MailContentAdminRejectToAdmin'] = 'Hemos recibido y registrado su rechazo de la inscripción de <strong>%s</strong> al curso <strong>%s</strong>';
$strings['MailTitleAdminRejectToStudent'] = 'Rechazamos su inscripción al curso %s';
$strings['MailContentAdminRejectToStudent'] = 'Lamentamos informarle que su inscripción al curso <strong>%s</strong> iniciando el <strong>%s</strong> fue rechazada por falta de cupos. Esperamos mantenga todo su ánimo y participe en otro curso o, en otra oportunidad, a este mismo curso.';
$strings['MailTitleAdminRejectToSuperior'] = 'Información: Rechazo de inscripción de %s al curso %s';
$strings['MailContentAdminRejectToSuperior'] = 'La inscripción de <strong>%s</strong> al curso <strong>%s</strong>, que había aprobado anteriormente, fue rechazada por falta de cupos. Les presentamos nuestras disculpas sinceras.';
// Superior Accept
$strings['MailTitleSuperiorAcceptToAdmin'] = 'Aprobación de %s al curso %s ';
$strings['MailContentSuperiorAcceptToAdmin'] = 'La inscripción del alumno <strong>%s</strong> al curso <strong>%s</strong> ha sido aprobada por su superior. Puede gestionar las inscripciones al curso <a href="%s"><strong>aquí</strong></a>';
$strings['MailTitleSuperiorAcceptToSuperior'] = 'Confirmación: Aprobación recibida para %s';
$strings['MailContentSuperiorAcceptToSuperior'] = 'Hemos recibido y registrado su decisión de aprobar el curso <strong>%s</strong> para su colaborador <strong>%s</strong>';
$strings['MailContentSuperiorAcceptToSuperiorSecond'] = 'Ahora la inscripción al curso está pendiente de la disponibilidad de cupos. Le mantendremos informado sobre el resultado de esta etapa';
$strings['MailTitleSuperiorAcceptToStudent'] = 'Aprobado: Su inscripción al curso %s ha sido aprobada por su superior ';
$strings['MailContentSuperiorAcceptToStudent'] = 'Nos complace informarle que su inscripción al curso <strong>%s</strong> ha sido aprobada por su superior. Su inscripción ahora solo se encuentra pendiente de disponibilidad de cupos. Le avisaremos tan pronto como se confirme este último paso.';
// Superior Reject
$strings['MailTitleSuperiorRejectToStudent'] = 'Información: Su inscripción al curso %s ha sido rechazada ';
$strings['MailContentSuperiorRejectToStudent'] = 'Lamentamos informarle que, en esta oportunidad, su inscripción al curso <strong>%s</strong> NO ha sido aprobada. Esperamos mantenga todo su ánimo y participe en otro curso o, en otra oportunidad, a este mismo curso.';
$strings['MailTitleSuperiorRejectToSuperior'] = 'Confirmación: Desaprobación recibida para %s';
$strings['MailContentSuperiorRejectToSuperior'] = 'Hemos recibido y registrado su decisión de desaprobar el curso <strong>%s</strong> para su colaborador <strong>%s</strong>';
// Student Request
$strings['MailTitleStudentRequestToStudent'] = 'Información: Validación de inscripción recibida';
$strings['MailContentStudentRequestToStudent'] = 'Hemos recibido y registrado su solicitud de inscripción al curso <strong>%s</strong> para iniciarse el <strong>%s</strong>.';
$strings['MailContentStudentRequestToStudentSecond'] = 'Su inscripción es pendiente primero de la aprobación de su superior, y luego de la disponibilidad de cupos. Un correo ha sido enviado a su superior para revisión y aprobación de su solicitud.';
$strings['MailTitleStudentRequestToSuperior'] = 'Solicitud de consideración de curso para un colaborador';
$strings['MailContentStudentRequestToSuperior'] = 'Hemos recibido una solicitud de inscripción de <strong>%s</strong> al curso <strong>%s</strong>, por iniciarse el <strong>%s</strong>. Detalles del curso: <strong>%s</strong>.';
$strings['MailContentStudentRequestToSuperiorSecond'] = 'Le invitamos a aprobar o desaprobar esta inscripción, dando clic en el botón correspondiente a continuación.';
// Student Request No Boss
$strings['MailTitleStudentRequestNoSuperiorToStudent'] = 'Solicitud recibida para el curso %s';
$strings['MailContentStudentRequestNoSuperiorToStudent'] = 'Hemos recibido y registrado su solicitud de inscripción al curso <strong>%s</strong> para iniciarse el <strong>%s</strong>.';
$strings['MailContentStudentRequestNoSuperiorToStudentSecond'] = 'Su inscripción es pendiente de la disponibilidad de cupos. Pronto recibirá los resultados de su aprobación de su solicitud.';
$strings['MailTitleStudentRequestNoSuperiorToAdmin'] = 'Solicitud de inscripción de %s para el curso %s';
$strings['MailContentStudentRequestNoSuperiorToAdmin'] = 'La inscripción del alumno <strong>%s</strong> al curso <strong>%s</strong> ha sido aprobada por defecto, a falta de superior. Puede gestionar las inscripciones al curso <a href="%s"><strong>aquí</strong></a>';
// Reminders
$strings['MailTitleReminderAdmin'] = 'Inscripciones a %s pendiente de confirmación';
$strings['MailContentReminderAdmin'] = 'Las inscripciones siguientes al curso <strong>%s</strong> están pendientes de validación para ser efectivas. Por favor, dirigese a la <a href="%s">página de administración</a> para validarlos.';
$strings['MailTitleReminderStudent'] = 'Información: Solicitud pendiente de aprobación para el curso %s';
$strings['MailContentReminderStudent'] = 'Este correo es para confirmar que hemos recibido y registrado su solicitud de inscripción al curso <strong>%s</strong>, por iniciarse el <strong>%s</strong>.';
$strings['MailContentReminderStudentSecond'] = 'Su inscripción todavía no ha sido aprobada por su superior, por lo que hemos vuelto a enviarle un correo electrónico de recordatorio.';
$strings['MailTitleReminderSuperior'] = 'Solicitud de consideración de curso para un colaborador';
$strings['MailContentReminderSuperior'] = 'Le recordamos que hemos recibido las siguientes solicitudes de suscripción para el curso <strong>%s</strong> de parte de sus colaboradores. El curso se iniciará el <strong>%s</strong>. Detalles del curso: <strong>%s</strong>.';
$strings['MailContentReminderSuperiorSecond'] = 'Le invitamos a aprobar o desaprobar las suscripciones, dando clic en el botón correspondiente a continuación para cada colaborador.';
$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.';

@ -0,0 +1 @@
This plugin, as the rest of Chamilo, is released under the GNU/GPLv3 license.

@ -0,0 +1,12 @@
<?php
/* For license terms, see /license.txt */
/**
* This script is a configuration file for the date plugin. You can use it as a master for other platform plugins (course plugins are slightly different).
* These settings will be used in the administration interface for plugins (Chamilo configuration settings->Plugins)
* @package chamilo.plugin.advanced_subscription
*/
/**
* Plugin details (must be present)
*/
require_once __DIR__ . '/config.php';
$plugin_info = AdvancedSubscriptionPlugin::create()->get_info();

@ -0,0 +1,99 @@
<h1>
<a id="user-content-advanced-subscription-plugin-for-chamilo-lms" class="anchor" href="#advanced-subscription-plugin-for-chamilo-lms" aria-hidden="true"><span class="octicon octicon-link"></span></a>Advanced subscription plugin for Chamilo LMS</h1>
<p>Plugin for managing the registration queue and communication to sessions
from an external website creating a queue to control session subscription
and sending emails to approve student subscription request</p>
<h1>
<a id="user-content-requirements" class="anchor" href="#requirements" aria-hidden="true"><span class="octicon octicon-link"></span></a>Requirements</h1>
<p>Chamilo LMS 1.10 or greater</p>
<h1>
<a id="user-content-settings" class="anchor" href="#settings" aria-hidden="true"><span class="octicon octicon-link"></span></a>Settings</h1>
<table>
<thead>
<tr>
<th>Parameters</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Webservice url</td>
<td>Url to external website to get user profile (SOAP)</td>
</tr>
<tr>
<td>Induction requirement</td>
<td>Checkbox to enable induction as requirement</td>
</tr>
<tr>
<td>Courses count limit</td>
<td>Number of times a student is allowed at most to course by year</td>
</tr>
<tr>
<td>Yearly hours limit</td>
<td>Teaching hours a student is allowed at most to course by year</td>
</tr>
<tr>
<td>Yearly cost unit converter</td>
<td>The cost of a taxation unit value (TUV)</td>
</tr>
<tr>
<td>Yearly cost limit</td>
<td>Number of TUV student courses is allowed at most to cost by year</td>
</tr>
<tr>
<td>Year start date</td>
<td>Date (dd/mm) when the year limit is renewed</td>
</tr>
<tr>
<td>Minimum percentage profile</td>
<td>Minimum percentage required from external website profile</td>
</tr>
</tbody>
</table>
<h1>
<a id="user-content-hooks" class="anchor" href="#hooks" aria-hidden="true"><span class="octicon octicon-link"></span></a>Hooks</h1>
<p>This plugin use the next hooks:</p>
<ul class="task-list">
<li>HookAdminBlock</li>
<li>HookWSRegistration</li>
<li>HookNotificationContent</li>
<li>HookNotificationTitle</li>
</ul>
<h1>
<a id="user-content-web-services" class="anchor" href="#web-services" aria-hidden="true"><span class="octicon octicon-link"></span></a>Web services</h1>
<ul class="task-list">
<li>HookAdvancedSubscription..WSSessionListInCategory</li>
<li>HookAdvancedSubscription..WSSessionGetDetailsByUser</li>
<li>HookAdvancedSubscription..WSListSessionsDetailsByCategory</li>
</ul>
<p>See <code>/plugin/advanced_subscription/src/HookAdvancedSubscription.php</code> to check Web services inputs and outputs</p>
<h1>
<a id="user-content-how-plugin-works" class="anchor" href="#how-plugin-works" aria-hidden="true"><span class="octicon octicon-link"></span></a>How plugin works?</h1>
<p>After install plugin, fill the parameters needed (described above)
Use Web services to communicate course session inscription from external website
This allow to student to search course session and subscribe if is qualified
and allowed to subscribe.
The normal process is:</p>
<ul class="task-list">
<li>Student search course session</li>
<li>Student read session info depending student data</li>
<li>Student request a subscription</li>
<li>A confirmation email is send to student</li>
<li>An email is send to users (superior or admins) who will accept or reject student request</li>
<li>When the user aceept o reject, an email will be send to student, superior or admins respectively</li>
<li>To complete the subscription, the request must be validated and accepted by an admin</li>
</ul>

@ -0,0 +1,940 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This class is used to add an advanced subscription allowing the admin to
* create user queues requesting a subscribe to a session
* @package chamilo.plugin.advanced_subscription
*/
class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
{
protected $strings;
/**
* Constructor
*/
public function __construct()
{
$parameters = array(
'yearly_cost_limit' => 'text',
'yearly_hours_limit' => 'text',
'yearly_cost_unit_converter' => 'text',
'courses_count_limit' => 'text',
'course_session_credit_year_start_date' => 'text',
'ws_url' => 'text',
'min_profile_percentage' => 'text',
'check_induction' => 'boolean',
'secret_key' => 'text',
);
parent::__construct('1.0', 'Imanol Losada, Daniel Barreto', $parameters);
}
/**
* Instance the plugin
* @staticvar null $result
* @return AdvancedSubscriptionPlugin
*/
public static function create()
{
static $result = null;
return $result ? $result : $result = new self();
}
/**
* Install the plugin
* @return void
*/
public function install()
{
$this->installDatabase();
$this->installHook();
}
/**
* Uninstall the plugin
* @return void
*/
public function uninstall()
{
$this->uninstallHook();
$this->uninstallDatabase();
}
/**
* Create the database tables for the plugin
* @return void
*/
private function installDatabase()
{
$advancedSubscriptionQueueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE);
$sql = "CREATE TABLE IF NOT EXISTS $advancedSubscriptionQueueTable (" .
"id int UNSIGNED NOT NULL AUTO_INCREMENT, " .
"session_id int UNSIGNED NOT NULL, " .
"user_id int UNSIGNED NOT NULL, " .
"status int UNSIGNED NOT NULL, " .
"last_message_id int UNSIGNED NOT NULL, " .
"created_at datetime NOT NULL, " .
"updated_at datetime NULL, " .
"PRIMARY KEY PK_advanced_subscription_queue (id), " .
"UNIQUE KEY UK_advanced_subscription_queue (user_id, session_id)); ";
Database::query($sql);
}
/**
* Drop the database tables for the plugin
* @return void
*/
private function uninstallDatabase()
{
/* Drop plugin tables */
$advancedSubscriptionQueueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE);
$sql = "DROP TABLE IF EXISTS $advancedSubscriptionQueueTable; ";
Database::query($sql);
/* Delete settings */
$settingsTable = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
Database::query("DELETE FROM $settingsTable WHERE subkey = 'advanced_subscription'");
}
/**
* Return true if user is allowed to be added to queue for session subscription
* @param int $userId
* @param array $params MUST have keys:
* "is_connected" Indicate if the user is online on external web
* "profile_completed" Percentage of completed profile, given by WS
* @throws Exception
* @return bool
*/
public function isAllowedToDoRequest($userId, $params = array())
{
if (isset($params['is_connected']) && isset($params['profile_completed'])) {
$isAllowed = null;
$plugin = self::create();
$wsUrl = $plugin->get('ws_url');
// @TODO: Get connection status from user by WS
$isConnected = $params['is_connected'];
if ($isConnected) {
$profileCompletedMin = (float) $plugin->get('min_profile_percentage');
// @TODO: Get completed profile percentage by WS
$profileCompleted = (float) $params['profile_completed'];
if ($profileCompleted > $profileCompletedMin) {
$checkInduction = $plugin->get('check_induction');
// @TODO: check if user have completed at least one induction session
$completedInduction = true;
if (!$checkInduction || $completedInduction) {
$uitMax = $plugin->get('yearly_cost_unit_converter');
$uitMax *= $plugin->get('yearly_cost_limit');
// @TODO: Get UIT completed by user this year by WS
$uitUser = 0;
$extra = new ExtraFieldValue('session');
$var = $extra->get_values_by_handler_and_field_variable($params['session_id'], 'cost');
$uitUser += $var['field_value'];
if ($uitMax >= $uitUser) {
$expendedTimeMax = $plugin->get('yearly_hours_limit');
// @TODO: Get Expended time from user data
$expendedTime = 0;
$var = $extra->get_values_by_handler_and_field_variable($params['session_id'], 'duration');
$expendedTime += $var['field_value'];
if ($expendedTimeMax >= $expendedTime) {
$expendedNumMax = $plugin->get('courses_count_limit');
// @TODO: Get Expended num from user
$expendedNum = 0;
if ($expendedNumMax >= $expendedNum) {
$isAllowed = true;
} else {
throw new \Exception($this->get_lang('AdvancedSubscriptionCourseXLimitReached'));
}
} else {
throw new \Exception($this->get_lang('AdvancedSubscriptionTimeXLimitReached'));
}
} else {
throw new \Exception($this->get_lang('AdvancedSubscriptionCostXLimitReached'));
}
} else {
throw new \Exception($this->get_lang('AdvancedSubscriptionIncompleteInduction'));
}
} else {
throw new \Exception($this->get_lang('AdvancedSubscriptionProfileIncomplete'));
}
} else {
throw new \Exception($this->get_lang('AdvancedSubscriptionNotConnected'));
}
return $isAllowed;
} else {
throw new \Exception($this->get_lang('AdvancedSubscriptionIncompleteParams'));
}
}
/**
* Register a user into a queue for a session
* @param $userId
* @param $sessionId
* @return bool|int
*/
public function addToQueue($userId, $sessionId)
{
// Filter input variables
$userId = intval($userId);
$sessionId = intval($sessionId);
$now = api_get_utc_datetime();
$advancedSubscriptionQueueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE);
$attributes = array(
'session_id' => $sessionId,
'user_id' => $userId,
'status' => 0,
'created_at' => $now,
'updated_at' => null,
);
$id = Database::insert($advancedSubscriptionQueueTable, $attributes);
return $id;
}
/**
* Register message with type and status
* @param $mailId
* @param $userId
* @param $sessionId
* @return bool|int
*/
public function saveLastMessage($mailId, $userId, $sessionId)
{
// Filter variables
$mailId = intval($mailId);
$userId = intval($userId);
$sessionId = intval($sessionId);
$queueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE);
$attributes = array(
'last_message_id' => $mailId,
);
$num = Database::update(
$queueTable,
$attributes,
array('user_id = ? AND session_id = ?' => array($userId, $sessionId))
);
return $num;
}
/**
* Check for requirements and register user into queue
* @param $userId
* @param $sessionId
* @param $params
* @return bool|string
*/
public function startSubscription($userId, $sessionId, $params)
{
$result = null;
if (!empty($sessionId) && !empty($userId)) {
$plugin = self::create();
try {
if ($plugin->isAllowedToDoRequest($userId, $params)) {
$result = (bool) $plugin->addToQueue($userId, $sessionId);
} else {
throw new \Exception($this->get_lang('AdvancedSubscriptionNotMoreAble'));
}
} catch (Exception $e) {
$result = $e->getMessage();
}
} else {
$result = 'Params not found';
}
return $result;
}
/**
* Send message for the student subscription approval to a specific session
* @param int $studentId
* @param int $receiverId
* @param string $subject
* @param string $content
* @param int $sessionId
* @param bool $save
* @return bool|int
*/
public function sendMailMessage($studentId, $receiverId, $subject, $content, $sessionId, $save = false)
{
$mailId = MessageManager::send_message(
$receiverId,
$subject,
$content
);
if ($save && !empty($mailId)) {
// Save as sent message
$this->saveLastMessage($mailId, $studentId, $sessionId);
}
return $mailId;
}
/**
* Check if session is open for subscription
* @param $sessionId
* @param string $fieldVariable
* @return bool
*/
public function isSessionOpen($sessionId, $fieldVariable = 'is_open_session')
{
$sessionId = (int) $sessionId;
$fieldVariable = Database::escape_string($fieldVariable);
$isOpen = false;
if ($sessionId > 0 && !empty($fieldVariable)) {
$sfTable = Database::get_main_table(TABLE_MAIN_SESSION_FIELD);
$sfvTable = Database::get_main_table(TABLE_MAIN_SESSION_FIELD_VALUES);
$joinTable = $sfvTable . ' sfv INNER JOIN ' . $sfTable . ' sf ON sfv.field_id = sf.id ';
$row = Database::select(
'sfv.field_value as field_value',
$joinTable,
array(
'where' => array(
'sfv.session_id = ? AND sf.field_variable = ?' => array($sessionId, $fieldVariable),
)
)
);
if (isset($row[0]) && is_array($row[0])) {
$isOpen = (bool) $row[0]['field_value'];
}
}
return $isOpen;
}
/**
* Update the queue status for subscription approval rejected or accepted
* @param $params
* @param $newStatus
* @return bool
*/
public function updateQueueStatus($params, $newStatus)
{
$newStatus = intval($newStatus);
if (isset($params['queue']['id'])) {
$where = array(
'id = ?' => intval($params['queue']['id']),
);
} elseif (isset($params['studentUserId']) && isset($params['sessionId'])) {
$where = array(
'user_id = ? AND session_id = ? AND status <> ? AND status <> ?' => array(
intval($params['studentUserId']),
intval($params['sessionId']),
$newStatus,
ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED,
),
);
}
if (isset($where)) {
$res = (bool) Database::update(
Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE),
array(
'status' => $newStatus,
'updated_at' => api_get_utc_datetime(),
),
$where
);
} else {
$res = false;
}
return $res;
}
/**
* Render and send mail by defined advanced subscription action
* @param $data
* @param $actionType
* @return array
*/
public function sendMail($data, $actionType)
{
$template = new Template($this->get_lang('plugin_title'));
$template->assign('data', $data);
$templateParams = array(
'user',
'student',
'students',
'superior',
'admins',
'session',
'signature',
'admin_view_url',
'acceptUrl',
'rejectUrl'
);
foreach ($templateParams as $templateParam) {
$template->assign($templateParam, $data[$templateParam]);
}
$mailIds = array();
switch ($actionType) {
case ADVANCED_SUBSCRIPTION_ACTION_STUDENT_REQUEST:
// Mail to student
$mailIds['render'] = $this->sendMailMessage(
$data['studentUserId'],
$data['student']['user_id'],
$this->get_lang('MailStudentRequest'),
$template->fetch('/advanced_subscription/views/student_notice_student.tpl'),
$data['sessionId']
);
// Mail to superior
$mailIds[] = $this->sendMailMessage(
$data['studentUserId'],
$data['superior']['user_id'],
$this->get_lang('MailStudentRequest'),
$template->fetch('/advanced_subscription/views/student_notice_superior.tpl'),
$data['sessionId'],
true
);
break;
case ADVANCED_SUBSCRIPTION_ACTION_SUPERIOR_APPROVE:
// Mail to student
$mailIds[] = $this->sendMailMessage(
$data['studentUserId'],
$data['student']['user_id'],
$this->get_lang('MailBossAccept'),
$template->fetch('/advanced_subscription/views/superior_accepted_notice_student.tpl'),
$data['sessionId']
);
// Mail to superior
$mailIds['render'] = $this->sendMailMessage(
$data['studentUserId'],
$data['superior']['user_id'],
$this->get_lang('MailBossAccept'),
$template->fetch('/advanced_subscription/views/superior_accepted_notice_superior.tpl'),
$data['sessionId']
);
// Mail to admin
foreach ($data['admins'] as $adminId => $admin) {
$template->assign('admin', $admin);
$mailIds[] = $this->sendMailMessage(
$data['studentUserId'],
$adminId,
$this->get_lang('MailBossAccept'),
$template->fetch('/advanced_subscription/views/superior_accepted_notice_admin.tpl'),
$data['sessionId'],
true
);
}
break;
case ADVANCED_SUBSCRIPTION_ACTION_SUPERIOR_DISAPPROVE:
// Mail to student
$mailIds[] = $this->sendMailMessage(
$data['studentUserId'],
$data['student']['user_id'],
$this->get_lang('MailBossReject'),
$template->fetch('/advanced_subscription/views/superior_rejected_notice_student.tpl'),
$data['sessionId'],
true
);
// Mail to superior
$mailIds['render'] = $this->sendMailMessage(
$data['studentUserId'],
$data['superior']['user_id'],
$this->get_lang('MailBossReject'),
$template->fetch('/advanced_subscription/views/superior_rejected_notice_superior.tpl'),
$data['sessionId']
);
break;
case ADVANCED_SUBSCRIPTION_ACTION_SUPERIOR_SELECT:
// Mail to student
$mailIds[] = $this->sendMailMessage(
$data['studentUserId'],
$data['student']['user_id'],
$this->get_lang('MailStudentRequestSelect'),
$template->fetch('/advanced_subscription/views/student_notice_student.tpl'),
$data['sessionId']
);
// Mail to superior
$mailIds['render'] = $this->sendMailMessage(
$data['studentUserId'],
$data['superior']['user_id'],
$this->get_lang('MailStudentRequestSelect'),
$template->fetch('/advanced_subscription/views/student_notice_superior.tpl'),
$data['sessionId'],
true
);
break;
case ADVANCED_SUBSCRIPTION_ACTION_ADMIN_APPROVE:
// 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']
);
// Mail to superior
$mailIds[] = $this->sendMailMessage(
$data['studentUserId'],
$data['superior']['user_id'],
$this->get_lang('MailAdminAccept'),
$template->fetch('/advanced_subscription/views/admin_accepted_notice_superior.tpl'),
$data['sessionId']
);
// Mail to admin
$adminId = $data['currentUserId'];
$template->assign('admin', $data['admins'][$adminId]);
$mailIds['render'] = $this->sendMailMessage(
$data['studentUserId'],
$adminId,
$this->get_lang('MailAdminAccept'),
$template->fetch('/advanced_subscription/views/admin_accepted_notice_admin.tpl'),
$data['sessionId'],
true
);
break;
case ADVANCED_SUBSCRIPTION_ACTION_ADMIN_DISAPPROVE:
// Mail to student
$mailIds[] = $this->sendMailMessage(
$data['studentUserId'],
$data['student']['user_id'],
$this->get_lang('MailAdminReject'),
$template->fetch('/advanced_subscription/views/admin_rejected_notice_student.tpl'),
$data['sessionId'],
true
);
// Mail to superior
$mailIds[] = $this->sendMailMessage(
$data['studentUserId'],
$data['superior']['user_id'],
$this->get_lang('MailAdminReject'),
$template->fetch('/advanced_subscription/views/admin_rejected_notice_superior.tpl'),
$data['sessionId']
);
// Mail to admin
$adminId = $data['currentUserId'];
$template->assign('admin', $data['admins'][$adminId]);
$mailIds['render'] = $this->sendMailMessage(
$data['studentUserId'],
$adminId,
$this->get_lang('MailAdminReject'),
$template->fetch('/advanced_subscription/views/admin_rejected_notice_admin.tpl'),
$data['sessionId']
);
break;
case ADVANCED_SUBSCRIPTION_ACTION_STUDENT_REQUEST_NO_BOSS:
// Mail to student
$mailIds['render'] = $this->sendMailMessage(
$data['studentUserId'],
$data['student']['user_id'],
$this->get_lang('MailStudentRequestNoBoss'),
$template->fetch('/advanced_subscription/views/student_no_superior_notice_student.tpl'),
$data['sessionId']
);
// Mail to admin
foreach ($data['admins'] as $adminId => $admin) {
$template->assign('admin', $admin);
$mailIds[] = $this->sendMailMessage(
$data['studentUserId'],
$adminId,
$this->get_lang('MailStudentRequestNoBoss'),
$template->fetch('/advanced_subscription/views/student_no_superior_notice_admin.tpl'),
$data['sessionId'],
true
);
}
break;
default:
break;
}
return $mailIds;
}
/**
* Count the users in queue filtered by params (sessions, status)
* @param array $params Input array containing the set of
* session and status to count from queue
* e.g:
* array('sessions' => array(215, 218, 345, 502),
* 'status' => array(0, 1, 2))
* @return int
*/
public function countQueueByParams($params)
{
$count = 0;
if (!empty($params) && is_array($params)) {
$advancedSubscriptionQueueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE);
$where['1 = ? '] = 1;
if (isset($params['sessions']) && is_array($params['sessions'])) {
foreach ($params['sessions'] as &$sessionId) {
$sessionId = intval($sessionId);
}
$where['AND session_id IN ( ? ) '] = implode($params['sessions']);
}
if (isset($params['status']) && is_array($params['status'])) {
foreach ($params['status'] as &$status) {
$status = intval($status);
}
$where['AND status IN ( ? ) '] = implode($params['status']);
}
$where['where'] = $where;
$count = Database::select('COUNT(*)', $advancedSubscriptionQueueTable, $where);
$count = $count[0]['COUNT(*)'];
}
return $count;
}
/**
* This method will call the Hook management insertHook to add Hook observer from this plugin
* @return int
*/
public function installHook()
{
$hookObserver = HookAdvancedSubscription::create();
HookAdminBlock::create()->attach($hookObserver);
HookWSRegistration::create()->attach($hookObserver);
HookNotificationContent::create()->attach($hookObserver);
HookNotificationTitle::create()->attach($hookObserver);
}
/**
* This method will call the Hook management deleteHook to disable Hook observer from this plugin
* @return int
*/
public function uninstallHook()
{
$hookObserver = HookAdvancedSubscription::create();
HookAdminBlock::create()->detach($hookObserver);
HookWSRegistration::create()->detach($hookObserver);
HookNotificationContent::create()->detach($hookObserver);
HookNotificationTitle::create()->detach($hookObserver);
}
/**
* Return the status from user in queue to session subscription
* @param int $userId
* @param int $sessionId
* @return bool|int
*/
public function getQueueStatus($userId, $sessionId)
{
$userId = intval($userId);
$sessionId = intval($sessionId);
if (!empty($userId) && !empty($sessionId)) {
$queueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE);
$row = Database::select(
'status',
$queueTable,
array(
'where' => array(
'user_id = ? AND session_id = ?' => array($userId, $sessionId),
)
)
);
if (count($row) == 1) {
return $row[0]['status'];
} else {
return ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE;
}
}
return false;
}
/**
* Return the remaining vacancy
* @param $sessionId
* @return bool|int
*/
public function getVacancy($sessionId)
{
if (!empty($sessionId)) {
$extra = new ExtraFieldValue('session');
$var = $extra->get_values_by_handler_and_field_variable($sessionId, 'vacancies');
$vacancy = intval($var['field_value']);
if (!empty($vacancy)) {
$vacancy -= $this->countQueueByParams(
array(
'sessions' => array($sessionId),
'status' => array(ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED),
)
);
if ($vacancy >= 0) {
return $vacancy;
}
}
}
return false;
}
/**
* Return the session details data from a session ID (including the extra
* fields used for the advanced subscription mechanism)
* @param $sessionId
* @return bool|mixed
*/
public function getSessionDetails($sessionId)
{
if (!empty($sessionId)) {
// Assign variables
$fieldsArray = array('id', 'cost', 'place', 'allow_visitors', 'teaching_hours', 'brochure', 'banner');
$extraSession = new ExtraFieldValue('session');
$extraField = new ExtraField('session');
// Get session fields
$fieldList = $extraField->get_all(array(
'field_variable IN ( ?, ?, ?, ?, ?)' => $fieldsArray
));
// Index session fields
$fields = array();
foreach ($fieldList as $field) {
$fields[$field['id']] = $field['field_variable'];
}
$mergedArray = array_merge(array($sessionId), array_keys($fields));
$sessionFieldValueList = $extraSession->get_all(
array(
'session_id = ? field_id IN ( ?, ?, ?, ?, ?, ?, ? )' => $mergedArray
)
);
foreach ($sessionFieldValueList as $sessionFieldValue) {
// Check if session field value is set in session field list
if (isset($fields[$sessionFieldValue['field_id']])) {
$var = $fields[$sessionFieldValue['field_id']];
$val = $sessionFieldValue['field_value'];
// Assign session field value to session
$sessionArray[$var] = $val;
}
}
$sessionArray['description'] = SessionManager::getDescriptionFromSessionId($sessionId);
return $sessionArray;
}
return false;
}
/**
* Get status message
* @param int $status
* @param bool $isAble
* @return string
*/
public function getStatusMessage($status, $isAble = true)
{
$message = '';
switch ($status)
{
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE:
if ($isAble) {
$message = $this->get_lang('AdvancedSubscriptionNoQueueIsAble');
} else {
$message = $this->get_lang('AdvancedSubscriptionNoQueue');
}
break;
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_START:
$message = $this->get_lang('AdvancedSubscriptionQueueStart');
break;
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_DISAPPROVED:
$message = $this->get_lang('AdvancedSubscriptionQueueBossDisapproved');
break;
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_APPROVED:
$message = $this->get_lang('AdvancedSubscriptionQueueBossApproved');
break;
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_DISAPPROVED:
$message = $this->get_lang('AdvancedSubscriptionQueueAdminDisapproved');
break;
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED:
$message = $this->get_lang('AdvancedSubscriptionQueueAdminApproved');
break;
default:
$message = sprintf($this->get_lang('AdvancedSubscriptionQueueDefault'), $status);
}
return $message;
}
/**
* Return the url to go to session
* @param $sessionId
* @return string
*/
public function getSessionUrl($sessionId)
{
$url = api_get_path(WEB_CODE_PATH) . 'session/?session_id=' . intval($sessionId);
return $url;
}
/**
* Return the url to enter to subscription queue to session
* @param $params
* @return string
*/
public function getQueueUrl($params)
{
$url = api_get_path(WEB_PLUGIN_PATH) . 'advanced_subscription/ajax/advanced_subscription.ajax.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=' . intval($params['is_connected']) . '&' .
'profile_completed=' . intval($params['profile_completed']) . '&' .
'v=' . $this->generateHash($params);
return $url;
}
/**
* Return the list of student, in queue used by admin view
* @param int $sessionId
* @return array
*/
public function listAllStudentsInQueueBySession($sessionId)
{
// Filter input variable
$sessionId = intval($sessionId);
// Assign variables
$fieldsArray = array(
'target',
'publication_end_date',
'mode',
'recommended_number_of_participants',
'vacancies'
);
$sessionArray = api_get_session_info($sessionId);
$extraSession = new ExtraFieldValue('session');
$extraField = new ExtraField('session');
// Get session fields
$fieldList = $extraField->get_all(array(
'field_variable IN ( ?, ?, ?, ?, ?)' => $fieldsArray
));
// Index session fields
$fields = array();
foreach ($fieldList as $field) {
$fields[$field['id']] = $field['field_variable'];
}
$mergedArray = array_merge(array($sessionId), array_keys($fields));
$sessionFieldValueList = $extraSession->get_all(
array(
'session_id = ? field_id IN ( ?, ?, ?, ?, ?, ?, ? )' => $mergedArray
)
);
foreach ($sessionFieldValueList as $sessionFieldValue) {
// Check if session field value is set in session field list
if (isset($fields[$sessionFieldValue['field_id']])) {
$var = $fields[$sessionFieldValue['field_id']];
$val = $sessionFieldValue['field_value'];
// Assign session field value to session
$sessionArray[$var] = $val;
}
}
$queueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE);
$userTable = Database::get_main_table(TABLE_MAIN_USER);
$userJoinTable = $queueTable . ' q INNER JOIN ' . $userTable . ' u ON q.user_id = u.user_id';
$where = array(
'where' =>
array(
'q.session_id = ? AND q.status <> ? AND q.status <> ?' => array(
$sessionId,
ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED,
ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_DISAPPROVED,
)
)
);
$select = 'u.user_id, u.firstname, u.lastname, q.created_at, q.updated_at, q.status, q.id as queue_id';
$students = Database::select($select, $userJoinTable, $where);
foreach ($students as &$student) {
$status = intval($student['status']);
switch($status) {
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE:
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_START:
$student['validation'] = '';
break;
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_DISAPPROVED:
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_DISAPPROVED:
$student['validation'] = get_lang('No');
break;
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_APPROVED:
case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED:
$student['validation'] = get_lang('Yes');
break;
default:
error_log(__FILE__ . ' ' . __FUNCTION__ . ' Student status no detected');
}
}
$return = array(
'session' => $sessionArray,
'students' => $students,
);
return $return;
}
/**
* List all session (id, name) for select input
* @param int $limit
* @return array
*/
public function listAllSessions($limit = 100)
{
$limit = intval($limit);
$sessionTable = Database::get_main_table(TABLE_MAIN_SESSION);
$columns = 'id, name';
$conditions = array();
if ($limit > 0) {
$conditions = array(
'order' => 'name',
'limit' => $limit,
);
}
return Database::select($columns, $sessionTable, $conditions);
}
/**
* Generate security hash to check data send by url params
* @param string $data
* @return string
*/
public function generateHash($data)
{
$key = sha1($this->get('secret_key'));
// Prepare array to have specific type variables
$dataPrepared['action'] = strval($data['action']);
$dataPrepared['sessionId'] = intval($data['sessionId']);
$dataPrepared['currentUserId'] = intval($data['currentUserId']);
$dataPrepared['studentUserId'] = intval($data['studentUserId']);
$dataPrepared['queueId'] = intval($data['queueId']);
$dataPrepared['newStatus'] = intval($data['newStatus']);
$dataPrepared = serialize($dataPrepared);
return sha1($dataPrepared . $key);
}
/**
* Verify hash from data
* @param string $data
* @param string $hash
* @return bool
*/
public function checkHash($data, $hash)
{
return $this->generateHash($data) == $hash;
}
/**
* Copied and fixed from plugin.class.php
* Returns the "system" name of the plugin in lowercase letters
* @return string
*/
public function get_name()
{
return 'advanced_subscription';
}
}

@ -0,0 +1,673 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Hook Observer for Advanced subscription plugin
* @author Daniel Alejandro Barreto Alva <daniel.barreto@beeznest.com>
* @package chamilo.plugin.advanced_subscription
*/
require_once __DIR__ . '/../config.php';
/**
* Class HookAdvancedSubscription extends the HookObserver to implements
* specific behaviour when the AdvancedSubscription plugin is enabled
*/
class HookAdvancedSubscription extends HookObserver implements
HookAdminBlockObserverInterface,
HookWSRegistrationObserverInterface,
HookNotificationContentObserverInterface
{
public $plugin;
/**
* Constructor. Calls parent, mainly.
*/
protected function __construct()
{
$this->plugin = AdvancedSubscriptionPlugin::create();
parent::__construct(
'plugin/advanced_subscription/src/HookAdvancedSubscription.class.php',
'advanced_subscription'
);
}
/**
* @param HookAdminBlockEventInterface $hook
* @return int
*/
public function hookAdminBlock(HookAdminBlockEventInterface $hook)
{
$data = $hook->getEventData();
if ($data['type'] === HOOK_EVENT_TYPE_PRE) {
// Nothing to do
} elseif ($data['type'] === HOOK_EVENT_TYPE_POST) {
if (isset($data['blocks'])) {
$data['blocks']['sessions']['items'][] = array(
'url' => '../../plugin/advanced_subscription/src/admin_view.php',
'label' => get_plugin_lang('plugin_title', 'AdvancedSubscriptionPlugin'),
);
}
} else {
// Hook type is not valid
// Nothing to do
}
return $data;
}
/**
* Add Webservices to registration.soap.php
* @param HookWSRegistrationEventInterface $hook
* @return mixed (int or false)
*/
public function hookWSRegistration(HookWSRegistrationEventInterface $hook)
{
$data = $hook->getEventData();
if ($data['type'] === HOOK_EVENT_TYPE_PRE) {
} elseif ($data['type'] === HOOK_EVENT_TYPE_POST) {
/** @var \nusoap_server $server */
$server = &$data['server'];
/** WSSessionListInCategory */
// Output params for sessionBriefList WSSessionListInCategory
$server->wsdl->addComplexType(
'sessionBrief',
'complexType',
'struct',
'all',
'',
array(
// session.id
'id' => array('name' => 'id', 'type' => 'xsd:int'),
// session.name
'name' => array('name' => 'name', 'type' => 'xsd:string'),
// session.short_description
'short_description' => array('name' => 'short_description', 'type' => 'xsd:string'),
// session.mode
'mode' => array('name' => 'mode', 'type' => 'xsd:string'),
// session.date_start
'date_start' => array('name' => 'date_start', 'type' => 'xsd:string'),
// session.date_end
'date_end' => array('name' => 'date_end', 'type' => 'xsd:string'),
// session.human_text_duration
'duration' => array('name' => 'duration', 'type' => 'xsd:string'),
// session.vacancies
'vacancies' => array('name' => 'vacancies', 'type' => 'xsd:string'),
// session.schedule
'schedule' => array('name' => 'schedule', 'type' => 'xsd:string'),
)
);
//Output params for WSSessionListInCategory
$server->wsdl->addComplexType(
'sessionBriefList',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType',
'wsdl:arrayType'=>'tns:sessionBrief[]')
),
'tns:sessionBrief'
);
// Input params for WSSessionListInCategory
$server->wsdl->addComplexType(
'sessionCategoryInput',
'complexType',
'struct',
'all',
'',
array(
'id' => array('name' => 'id', 'type' => 'xsd:string'), // session_category.id
'name' => array('name' => 'name', 'type' => 'xsd:string'), // session_category.name
'target' => array('name' => 'target', 'type' => 'xsd:string'), // session.target
'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string')
)
);
// Input params for WSSessionGetDetailsByUser
$server->wsdl->addComplexType(
'advsubSessionDetailInput',
'complexType',
'struct',
'all',
'',
array(
// user.user_id
'user_id' => array('name' => 'user_id', 'type' => 'xsd:int'),
// session.id
'session_id' => array('name' => 'session_id', 'type' => 'xsd:int'),
// user.profile_completes
'profile_completed' => array('name' => 'profile_completed', 'type' => 'xsd:float'),
// user.is_connected
'is_connected' => array('name' => 'is_connected', 'type' => 'xsd:boolean'),
'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string'),
)
);
// Output params for WSSessionGetDetailsByUser
$server->wsdl->addComplexType(
'advsubSessionDetail',
'complexType',
'struct',
'all',
'',
array(
// session.id
'id' => array('name' => 'id', 'type' => 'xsd:string'),
// session.cost
'cost' => array('name' => 'cost', 'type' => 'xsd:float'),
// session.place
'place' => array('name' => 'place', 'type' => 'xsd:string'),
// session.allow_visitors
'allow_visitors' => array('name' => 'allow_visitors', 'type' => 'xsd:string'),
// session.duration
'duration' => array('name' => 'duration', 'type' => 'xsd:int'),
// session.brochure
'brochure' => array('name' => 'brochure', 'type' => 'xsd:string'),
// session.banner
'banner' => array('name' => 'banner', 'type' => 'xsd:string'),
// session.description
'description' => array('name' => 'description', 'type' => 'xsd:string'),
// status
'status' => array('name' => 'status', 'type' => 'xsd:string'),
// action_url
'action_url' => array('name' => 'action_url', 'type' => 'xsd:string'),
// message
'message' => array('name' => 'error_message', 'type' => 'xsd:string'),
)
);
/** WSListSessionsDetailsByCategory **/
// Input params for WSListSessionsDetailsByCategory
$server->wsdl->addComplexType(
'listSessionsDetailsByCategory',
'complexType',
'struct',
'all',
'',
array(
// session_category.id
'id' => array('name' => 'id', 'type' => 'xsd:string'),
// session_category.access_url_id
'access_url_id' => array('name' => 'access_url_id', 'type' => 'xsd:int'),
// session_category.name
'category_name' => array('name' => 'category_name', 'type' => 'xsd:string'),
// secret key
'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string'),
),
array(),
'tns:listSessionsDetailsByCategory'
);
// Output params for sessionDetailsCourseList WSListSessionsDetailsByCategory
$server->wsdl->addComplexType(
'sessionDetailsCourse',
'complexType',
'struct',
'all',
'',
array(
'course_id' => array('name' => 'course_id', 'type' => 'xsd:int'), // course.id
'course_code' => array('name' => 'course_code', 'type' => 'xsd:string'), // course.code
'course_title' => array('name' => 'course_title', 'type' => 'xsd:string'), // course.title
'coach_username' => array('name' => 'coach_username', 'type' => 'xsd:string'), // user.username
'coach_firstname' => array('name' => 'coach_firstname', 'type' => 'xsd:string'), // user.firstname
'coach_lastname' => array('name' => 'coach_lastname', 'type' => 'xsd:string'), // user.lastname
)
);
// Output array for sessionDetails WSListSessionsDetailsByCategory
$server->wsdl->addComplexType(
'sessionDetailsCourseList',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array(
'ref' => 'SOAP-ENC:arrayType',
'wsdl:arrayType' => 'tns:sessionDetailsCourse[]',
)
),
'tns:sessionDetailsCourse'
);
// Output params for sessionDetailsList WSListSessionsDetailsByCategory
$server->wsdl->addComplexType(
'sessionDetails',
'complexType',
'struct',
'all',
'',
array(
// session.id
'id' => array(
'name' => 'id',
'type' => 'xsd:int'
),
// session.id_coach
'coach_id' => array(
'name' => 'coach_id',
'type' => 'xsd:int'
),
// session.name
'name' => array(
'name' => 'name',
'type' => 'xsd:string'
),
// session.nbr_courses
'courses_num' => array(
'name' => 'courses_num',
'type' => 'xsd:int'
),
// session.nbr_users
'users_num' => array(
'name' => 'users_num',
'type' => 'xsd:int'
),
// session.nbr_classes
'classes_num' => array(
'name' => 'classes_num',
'type' => 'xsd:int'
),
// session.date_start
'date_start' => array(
'name' => 'date_start',
'type' => 'xsd:string'
),
// session.date_end
'date_end' => array(
'name' => 'date_end',
'type' => 'xsd:string'
),
// session.nb_days_access_before_beginning
'access_days_before_num' => array(
'name' => 'access_days_before_num',
'type' => 'xsd:int'
),
// session.nb_days_access_after_end
'access_days_after_num' => array(
'name' => 'access_days_after_num',
'type' => 'xsd:int'
),
// session.session_admin_id
'session_admin_id' => array(
'name' => 'session_admin_id',
'type' => 'xsd:int'
),
// session.visibility
'visibility' => array(
'name' => 'visibility',
'type' => 'xsd:int'
),
// session.session_category_id
'session_category_id' => array(
'name' => 'session_category_id',
'type' => 'xsd:int'
),
// session.promotion_id
'promotion_id' => array(
'name' => 'promotion_id',
'type' => 'xsd:int'
),
// session.number of registered users validated
'validated_user_num' => array(
'name' => 'validated_user_num',
'type' => 'xsd:int'
),
// session.number of registered users from waiting queue
'waiting_user_num' => array(
'name' => 'waiting_user_num',
'type' => 'xsd:int'
),
// extra fields
// Array(field_name, field_value)
'extra' => array(
'name' => 'extra',
'type' => 'tns:extrasList'
),
// course and coaches data
// Array(course_id, course_code, course_title, coach_username, coach_firstname, coach_lastname)
'course' => array(
'name' => 'courses',
'type' => 'tns:sessionDetailsCourseList'
),
)
);
// Output params for WSListSessionsDetailsByCategory
$server->wsdl->addComplexType(
'sessionDetailsList',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array(
'ref' => 'SOAP-ENC:arrayType',
'wsdl:arrayType' => 'tns:sessionDetails[]',
)
),
'tns:sessionDetails'
);
// Register the method for WSSessionListInCategory
$server->register(
'HookAdvancedSubscription..WSSessionListInCategory', // method name
array('sessionCategoryInput' => 'tns:sessionCategoryInput'), // input parameters
array('return' => 'tns:sessionBriefList'), // output parameters
'urn:WSRegistration', // namespace
'urn:WSRegistration#WSSessionListInCategory', // soapaction
'rpc', // style
'encoded', // use
'This service checks if user assigned to course' // documentation
);
// Register the method for WSSessionGetDetailsByUser
$server->register(
'HookAdvancedSubscription..WSSessionGetDetailsByUser', // method name
array('advsubSessionDetailInput' => 'tns:advsubSessionDetailInput'), // input parameters
array('return' => 'tns:advsubSessionDetail'), // output parameters
'urn:WSRegistration', // namespace
'urn:WSRegistration#WSSessionGetDetailsByUser', // soapaction
'rpc', // style
'encoded', // use
'This service return session details to specific user' // documentation
);
// Register the method for WSListSessionsDetailsByCategory
$server->register(
'HookAdvancedSubscription..WSListSessionsDetailsByCategory', // method name
array('name' => 'tns:listSessionsDetailsByCategory'), // input parameters
array('return' => 'tns:sessionDetailsList'), // output parameters
'urn:WSRegistration', // namespace
'urn:WSRegistration#WSListSessionsDetailsByCategory', // soapaction
'rpc', // style
'encoded', // use
'This service returns a list of detailed sessions by a category' // documentation
);
return $data;
} else {
// Nothing to do
}
return false;
}
/**
* @param $params
* @return null|soap_fault
*/
public static function WSSessionListInCategory($params)
{
global $debug;
if ($debug) {
error_log('WSUserSubscribedInCourse');
error_log('Params ' . print_r($params, 1));
}
if (!WSHelperVerifyKey($params)) {
//return return_error(WS_ERROR_SECRET_KEY);
}
// Check if category ID is set
if (!empty($params['id']) && empty($params['name'])) {
$sessionCategoryId = $params['id'];
} elseif (!empty($params['name'])) {
// Check if category name is set
$sessionCategoryId = SessionManager::getSessionCategoryIdByName($params['name']);
if (is_array($sessionCategoryId)) {
$sessionCategoryId = current($sessionCategoryId);
}
} else {
// Return soap fault Not valid input params
return return_error(WS_ERROR_INVALID_INPUT);
}
// Get the session brief List by category
$fields = array(
'short_description',
'mode',
'human_text_duration',
'vacancies',
'brochure',
'target',
'schedule'
);
$sessionList = SessionManager::getShortSessionListAndExtraByCategory(
$sessionCategoryId,
$params['target'],
$fields
);
return $sessionList;
}
/**
* @param $params
* @return null|soap_fault
*/
public function WSSessionGetDetailsByUser($params)
{
global $debug;
if ($debug) {
error_log('WSUserSubscribedInCourse');
error_log('Params ' . print_r($params, 1));
}
if (!WSHelperVerifyKey($params)) {
return return_error(WS_ERROR_SECRET_KEY);
}
$result = return_error(WS_ERROR_NOT_FOUND_RESULT);
// Check params
if (is_array($params) && !empty($params['session_id']) && !empty($params['user_id'])) {
$userId = (int) $params['user_id'];
$sessionId = (int) $params['session_id'];
// Check if student is already subscribed
$isOpen = $this->plugin->isSessionOpen($sessionId);
$status = $this->plugin->getQueueStatus($userId, $sessionId);
$vacancy = $this->plugin->getVacancy($sessionId);
$data = $this->plugin->getSessionDetails($sessionId);
if (!empty($data) && is_array($data)) {
$data['status'] = $status;
// 5 Cases:
if ($isOpen) {
// Go to Course session
$data['action_url'] = $this->plugin->getSessionUrl($sessionId);
} else {
try {
$isAble = $this->plugin->isAllowedToDoRequest($userId, $params);
$data['message'] = $this->plugin->getStatusMessage($status, $isAble);
} catch (\Exception $e) {
$data['message'] = $e->getMessage();
}
$params['action'] = 'subscribe';
$params['sessionId'] = intval($sessionId);
$params['currentUserId'] = 0; // No needed
$params['studentUserId'] = intval($userId);
$params['queueId'] = 0; // No needed
$params['newStatus'] = ADVANCED_SUBSCRIPTION_QUEUE_STATUS_START;
if ($vacancy > 0) {
// Check conditions
if ($status === ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE) {
// No in Queue, require queue subscription url action
$data['action_url'] = $this->plugin->getQueueUrl($params);
} elseif ($status === ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED) {
// send url action
$data['action_url'] = $this->plugin->getSessionUrl($sessionId);
} else {
// In queue, output status message, no more info.
}
} else {
if ($status === ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED) {
$data['action_url'] = $this->plugin->getSessionUrl($sessionId);
} else {
// in Queue or not, cannot be subscribed to session
$data['action_url'] = $this->plugin->getQueueUrl($params);
}
}
}
$result = $data;
}
} else {
// Return soap fault Not valid input params
$result = return_error(WS_ERROR_INVALID_INPUT);
}
return $result;
}
/**
* Get a list of sessions (id, coach_id, name, courses_num, users_num, classes_num,
* date_start, date_end, access_days_before_num, session_admin_id, visibility,
* session_category_id, promotion_id,
* validated_user_num, waiting_user_num,
* extra, course) the validated_usernum and waiting_user_num are
* used when have the plugin for advance incsription enables.
* The extra data (field_name, field_value)
* The course data (course_id, course_code, course_title,
* coach_username, coach_firstname, coach_lastname)
* @param array $params List of parameters (id, category_name, access_url_id, secret_key)
* @return array|soap_fault Sessions list (id=>[title=>'title',url='http://...',date_start=>'...',date_end=>''])
*/
public function WSListSessionsDetailsByCategory($params)
{
global $debug;
if ($debug) {
error_log('WSListSessionsDetailsByCategory');
error_log('Params ' . print_r($params, 1));
}
$secretKey = $params['secret_key'];
// Check if secret key is valid
if (!WSHelperVerifyKey($secretKey)) {
return return_error(WS_ERROR_SECRET_KEY);
}
// Check if category ID is set
if (!empty($params['id']) && empty($params['category_name'])) {
$sessionCategoryId = $params['id'];
} elseif (!empty($params['category_name'])) {
// Check if category name is set
$sessionCategoryId = SessionManager::getSessionCategoryIdByName($params['category_name']);
if (is_array($sessionCategoryId)) {
$sessionCategoryId = current($sessionCategoryId);
}
} else {
// Return soap fault Not valid input params
return return_error(WS_ERROR_INVALID_INPUT);
}
// Get the session List by category
$sessionList = SessionManager::getSessionListAndExtraByCategoryId($sessionCategoryId);
if (empty($sessionList)) {
// If not found any session, return error
return return_error(WS_ERROR_NOT_FOUND_RESULT);
}
// Get validated and waiting queue users count for each session
foreach ($sessionList as &$session) {
// Add validated and queue users count
$session['validated_user_num'] = $this->plugin->countQueueByParams(
array(
'sessions' => array($session['id']),
'status' => array(ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED)
)
);
$session['waiting_user_num'] = $this->plugin->countQueueByParams(
array(
'sessions' => array($session['id']),
'status' => array(
ADVANCED_SUBSCRIPTION_QUEUE_STATUS_START,
ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_APPROVED,
),
)
);
}
return $sessionList;
}
/**
* Return notification content when the hook has been triggered
* @param HookNotificationContentEventInterface $hook
* @return mixed (int or false)
*/
public function hookNotificationContent(HookNotificationContentEventInterface $hook)
{
$data = $hook->getEventData();
if ($data['type'] === HOOK_EVENT_TYPE_PRE) {
$data['advanced_subscription_pre_content'] = $data['content'];
return $data;
} elseif ($data['type'] === HOOK_EVENT_TYPE_POST) {
if (isset($data['content']) &&
!empty($data['content']) &&
isset($data['advanced_subscription_pre_content']) &&
!empty($data['advanced_subscription_pre_content'])
) {
$data['content'] = str_replace(
array(
'<br /><hr>',
'<br />',
'<br/>',
),
'',
$data['advanced_subscription_pre_content']
);
}
return $data;
} else {
// Hook type is not valid
// Nothing to do
}
return false;
}
/**
* Return the notification data title if the hook was triggered
* @param HookNotificationTitleEventInterface $hook
* @return int
*/
public function hookNotificationTitle(HookNotificationTitleEventInterface $hook)
{
$data = $hook->getEventData();
if ($data['type'] === HOOK_EVENT_TYPE_PRE) {
$data['advanced_subscription_pre_title'] = $data['title'];
return $data;
} elseif ($data['type'] === HOOK_EVENT_TYPE_POST) {
if (isset($data['advanced_subscription_pre_title']) &&
!empty($data['advanced_subscription_pre_title'])
) {
$data['title'] = $data['advanced_subscription_pre_title'];
}
return $data;
} else {
// Hook type is not valid
// Nothing to do
}
return false;
}
}

@ -0,0 +1,88 @@
<?php
/* For license terms, see /license.txt */
/**
* Index of the Advanced subscription plugin courses list
* @package chamilo.plugin.advanced_subscription
*/
/**
* Init
*/
require_once __DIR__ . '/../config.php';
// protect
api_protect_admin_script();
// start plugin
$plugin = AdvancedSubscriptionPlugin::create();
// Session ID
$sessionId = isset($_REQUEST['s']) ? intval($_REQUEST['s']) : null;
// Init template
$tpl = new Template($plugin->get_lang('plugin_title'));
// Get all sessions
$sessionList = $plugin->listAllSessions();
if (!empty($sessionId)) {
// Get student list in queue
$studentList = $plugin->listAllStudentsInQueueBySession($sessionId);
// Set selected to current session
$sessionList[$sessionId]['selected'] = 'selected="selected"';
$studentList['session']['id'] = $sessionId;
// Assign variables
$fieldsArray = array('description', 'target', 'mode', 'publication_end_date', 'recommended_number_of_participants');
$sessionArray = api_get_session_info($sessionId);
$extraSession = new ExtraFieldValue('session');
$extraField = new ExtraField('session');
// Get session fields
$fieldList = $extraField->get_all(array(
'field_variable IN ( ?, ?, ?, ?, ?)' => $fieldsArray
));
// Index session fields
foreach ($fieldList as $field) {
$fields[$field['id']] = $field['field_variable'];
}
$mergedArray = array_merge(array($sessionId), array_keys($fields));
$sessionFieldValueList = $extraSession->get_all(array('session_id = ? field_id IN ( ?, ?, ?, ?, ?, ?, ? )' => $mergedArray));
foreach ($sessionFieldValueList as $sessionFieldValue) {
// Check if session field value is set in session field list
if (isset($fields[$sessionFieldValue['field_id']])) {
$var = $fields[$sessionFieldValue['field_id']];
$val = $sessionFieldValue['field_value'];
// Assign session field value to session
$sessionArray[$var] = $val;
}
}
$adminsArray = UserManager::get_all_administrators();
$data['action'] = 'confirm';
$data['sessionId'] = $sessionId;
$data['currentUserId'] = api_get_user_id();
$isWesternNameOrder = api_is_western_name_order();
foreach ($studentList['students'] as &$student) {
$data['studentUserId'] = intval($student['user_id']);
$data['queueId'] = intval($student['queue_id']);
$data['newStatus'] = ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED;
$student['acceptUrl'] = $plugin->getQueueUrl($data);
$data['newStatus'] = ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_DISAPPROVED;
$student['rejectUrl'] = $plugin->getQueueUrl($data);
$student['complete_name'] = $isWesternNameOrder ?
$student['firstname'] . ', ' . $student['lastname'] :
$student['lastname'] . ', ' . $student['firstname']
;
$student['picture'] = UserManager::get_user_picture_path_by_id($student['user_id'], 'web', false, true);
$student['picture'] = UserManager::get_picture_user($student['user_id'], $student['picture']['file'], 22, USER_IMAGE_SIZE_MEDIUM);
}
$tpl->assign('session', $studentList['session']);
$tpl->assign('students', $studentList['students']);
}
// Assign variables
$tpl->assign('sessionItems', $sessionList);
$tpl->assign('approveAdmin', ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED);
$tpl->assign('disapproveAdmin', ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_DISAPPROVED);
// Get rendered template
$content = $tpl->fetch('/advanced_subscription/views/admin_view.tpl');
// Assign into content
$tpl->assign('content', $content);
// Display
$tpl->display_one_col_template();

@ -0,0 +1,123 @@
<?php
require_once __DIR__ . '/../config.php';
// Protect test
api_protect_admin_script();
// exit;
$plugin = AdvancedSubscriptionPlugin::create();
// Get validation hash
$hash = Security::remove_XSS($_REQUEST['v']);
// Get data from request (GET or POST)
$data['action'] = 'confirm';
$data['currentUserId'] = 1;
$data['queueId'] = 0;
$data['is_connected'] = true;
$data['profile_completed'] = 90.0;
// Init result array
$data['sessionId'] = 1;
$data['studentUserId'] = 4;
// Prepare data
// Get session data
// Assign variables
$fieldsArray = array('description', 'target', 'mode', 'publication_end_date', 'recommended_number_of_participants');
$sessionArray = api_get_session_info($data['sessionId']);
$extraSession = new ExtraFieldValue('session');
$extraField = new ExtraField('session');
// Get session fields
$fieldList = $extraField->get_all(array(
'field_variable IN ( ?, ?, ?, ?, ?)' => $fieldsArray
));
$fields = array();
// Index session fields
foreach ($fieldList as $field) {
$fields[$field['id']] = $field['field_variable'];
}
$mergedArray = array_merge(array($data['sessionId']), array_keys($fields));
$sessionFieldValueList = $extraSession->get_all(array('session_id = ? field_id IN ( ?, ?, ?, ?, ?, ?, ? )' => $mergedArray));
foreach ($sessionFieldValueList as $sessionFieldValue) {
// Check if session field value is set in session field list
if (isset($fields[$sessionFieldValue['field_id']])) {
$var = $fields[$sessionFieldValue['field_id']];
$val = $sessionFieldValue['field_value'];
// Assign session field value to session
$sessionArray[$var] = $val;
}
}
// Get student data
$studentArray = api_get_user_info($data['studentUserId']);
$studentArray['picture'] = UserManager::get_user_picture_path_by_id($studentArray['user_id'], 'web', false, true);
$studentArray['picture'] = UserManager::get_picture_user($studentArray['user_id'], $studentArray['picture']['file'], 22, USER_IMAGE_SIZE_MEDIUM);
// Get superior data if exist
$superiorId = UserManager::getStudentBoss($data['studentUserId']);
if (!empty($superiorId)) {
$superiorArray = api_get_user_info($superiorId);
} else {
$superiorArray = api_get_user_info(3);
}
// Get admin data
$adminsArray = UserManager::get_all_administrators();
$isWesternNameOrder = api_is_western_name_order();
foreach ($adminsArray as &$admin) {
$admin['complete_name'] = $isWesternNameOrder ?
$admin['firstname'] . ', ' . $admin['lastname'] :
$admin['lastname'] . ', ' . $admin['firstname']
;
}
unset($admin);
// Set data
$data['action'] = 'confirm';
$data['student'] = $studentArray;
$data['superior'] = $superiorArray;
$data['admins'] = $adminsArray;
$data['admin'] = current($adminsArray);
$data['session'] = $sessionArray;
$data['signature'] = api_get_setting('Institution');
$data['admin_view_url'] = api_get_path(WEB_PLUGIN_PATH) .
'advanced_subscription/src/admin_view.php?s=' . $data['sessionId'];
$data['newStatus'] = ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_APPROVED;
$data['student']['acceptUrl'] = $plugin->getQueueUrl($data);
$data['newStatus'] = ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_DISAPPROVED;
$data['student']['rejectUrl'] = $plugin->getQueueUrl($data);
$tpl = new Template($plugin->get_lang('plugin_title'));
$tpl->assign('data', $data);
$tplParams = array(
'user',
'student',
'students',
'superior',
'admins',
'admin',
'session',
'signature',
'admin_view_url',
'acceptUrl',
'rejectUrl'
);
foreach ($tplParams as $tplParam) {
$tpl->assign($tplParam, $data[$tplParam]);
}
$dir = __DIR__ . '/../views/';
$files = scandir($dir);
echo '<br>', '<pre>' , print_r($files, 1) , '</pre>';
foreach ($files as $k =>&$file) {
if (
is_file($dir . $file) &&
strpos($file, '.tpl') &&
$file != 'admin_view.tpl'
) {
echo '<pre>', $file, '</pre>';
echo $tpl->fetch('/advanced_subscription/views/' . $file);
} else {
unset($files[$k]);
}
}
echo '<br>', '<pre>' , print_r($files, 1) , '</pre>';

@ -0,0 +1,17 @@
<?php
/* For license terms, see /license.txt */
/**
* This script is included by main/admin/settings.lib.php when unselecting a plugin
* and is meant to remove things installed by the install.php script in both
* the global database and the courses tables
* @package chamilo.plugin.advanced_subscription
*/
/**
* Queries
*/
require_once dirname(__FILE__) . '/config.php';
if (!api_is_platform_admin()) {
die ('You must have admin permissions to uninstall plugins');
}
AdvancedSubscriptionPlugin::create()->uninstall();

@ -0,0 +1,75 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ "MailTitle"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</title>
</head>
<body>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/header.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td valign="top"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50">&nbsp;</td>
<td width="394"><img src="{{ _p.web_css }}{{ "stylesheets" | get_setting }}/images/header-logo.png" width="230" height="60" alt="Ministerio de Educación"></td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="color: #93c5cd; font-family: Times New Roman, Times, serif; font-size: 24px; font-weight: bold; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #93c5cd;">{{ "MailTitleAdminAcceptToAdmin"| get_plugin_lang('AdvancedSubscriptionPlugin') }}</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="356">&nbsp;</td>
<td valign="top"><p>{{ "MailDear" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</p>
<h2>{{ admin.complete_name }}</h2>
<p>{{ "MailContentAdminAcceptToAdmin" | get_plugin_lang('AdvancedSubscriptionPlugin') | format(student.complete_name_with_username, session.name) }}</p>
<p>{{ "MailThankYou" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</p>
<h3>{{ signature }}</h3></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="50">&nbsp;</td>
<td>&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,75 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ "MailTitle" | get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</title>
</head>
<body>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/header.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td valign="top"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50">&nbsp;</td>
<td width="394"><img src="{{ _p.web_css }}{{ "stylesheets" | get_setting }}/images/header-logo.png" width="230" height="60" alt="Ministerio de Educación"></td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="color: #93c5cd; font-family: Times New Roman, Times, serif; font-size: 24px; font-weight: bold; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #93c5cd;">{{ "MailTitleAdminAcceptToStudent" | get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="356">&nbsp;</td>
<td valign="top"><p> {{ "MailDear" | get_plugin_lang('AdvancedSubscriptionPlugin') }} </p>
<h2>{{ student.complete_name }}</h2>
<p>{{ "MailContentAdminAcceptToStudent" | get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name, session.date_start) }}</p>
<p>{{ "MailThankYou" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</p>
<h3>{{ signature }}</h3></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="50">&nbsp;</td>
<td>&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,75 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ "MailTitle"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</title>
</head>
<body>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/header.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td valign="top"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50">&nbsp;</td>
<td width="394"><img src="{{ _p.web_css }}{{ "stylesheets" | get_setting }}/images/header-logo.png" width="230" height="60" alt="Ministerio de Educación"></td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="color: #93c5cd; font-family: Times New Roman, Times, serif; font-size: 24px; font-weight: bold; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #93c5cd;">{{ "MailTitleAdminAcceptToSuperior"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(student.complete_name, session.name) }}</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="356">&nbsp;</td>
<td valign="top"><p>{{ "MailDear"| get_plugin_lang('AdvancedSubscriptionPlugin') }}</p>
<h2>{{ superior.complete_name }}</h2>
<p>{{ "MailContentAdminAcceptToSuperior"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(student.complete_name, session.name, session.date_start) }}</p>
<p>{{ "MailThankYou"| get_plugin_lang('AdvancedSubscriptionPlugin') }}</p>
<h3>{{ signature }}</h3></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="50">&nbsp;</td>
<td>&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,75 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ "MailTitle"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</title>
</head>
<body>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/header.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td valign="top"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50">&nbsp;</td>
<td width="394"><img src="{{ _p.web_css }}{{ "stylesheets" | get_setting }}/images/header-logo.png" width="230" height="60" alt="Ministerio de Educación"></td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="color: #93c5cd; font-family: Times New Roman, Times, serif; font-size: 24px; font-weight: bold; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #93c5cd;">{{ "MailTitleAdminRejectToAdmin" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="356">&nbsp;</td>
<td valign="top"><p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h2>{{ admin.complete_name }}</h2>
<p>{{ "MailContentAdminRejectToAdmin"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(student.complete_name_with_username, session.name) }}</strong></p>
<p>{{ "MailThankYou" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h3>{{ signature }}</h3></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="50">&nbsp;</td>
<td>&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,75 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ "MailTitle"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</title>
</head>
<body>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/header.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td valign="top"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50">&nbsp;</td>
<td width="394"><img src="{{ _p.web_css }}{{ "stylesheets" | get_setting }}/images/header-logo.png" width="230" height="60" alt="Ministerio de Educación"></td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="color: #93c5cd; font-family: Times New Roman, Times, serif; font-size: 24px; font-weight: bold; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #93c5cd;">{{ "MailTitleAdminRejectToStudent"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="356">&nbsp;</td>
<td valign="top"><p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h2>{{ student.complete_name }}</h2>
<p>{{ "MailContentAdminRejectToStudent"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name, session.date_start) }}</p>
<p>{{ "MailThankYou" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h3>{{ signature }}</h3></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="50">&nbsp;</td>
<td>&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,75 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ "MailTitle"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</title>
</head>
<body>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/header.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td valign="top"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50">&nbsp;</td>
<td width="394"><img src="{{ _p.web_css }}{{ "stylesheets" | get_setting }}/images/header-logo.png" width="230" height="60" alt="Ministerio de Educación"></td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="color: #93c5cd; font-family: Times New Roman, Times, serif; font-size: 24px; font-weight: bold; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #93c5cd;">{{ "MailTitleAdminRejectToSuperior"| get_plugin_lang("AdvancedSubscriptionPlugin") | format(student.complete_name, session.name) }}</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="356">&nbsp;</td>
<td valign="top"><p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h2>{{ superior.complete_name }}</h2>
<p>{{ "MailContentAdminRejectToSuperior"| get_plugin_lang("AdvancedSubscriptionPlugin") | format(student.complete_name, session.name) }}</p>
<p>{{ "MailThankYou" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h3>{{ signature }}</h3></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="50">&nbsp;</td>
<td>&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,139 @@
<form id="form_advanced_subscription_admin" class="form-search" method="post" action="/plugin/advanced_subscription/src/admin_view.php" name="form_advanced_subscription_admin">
<div class="row">
<div class="span6">
<p class="text-title-select">{{ 'SelectASession' | get_plugin_lang('AdvancedSubscriptionPlugin') }}</p>
<select id="session-select" name="s">
<option value="0">
{{ "SelectASession" | get_plugin_lang('AdvancedSubscriptionPlugin') }}
</option>
{% for sessionItem in sessionItems %}
<option value="{{ sessionItem.id }}" {{ sessionItem.selected }}>
{{ sessionItem.name }}
</option>
{% endfor %}
</select>
<h4>{{ "SessionName" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</h4>
<h3 class="title-name-session">{{ session.name }}</h3>
<h4>{{ "Target" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</h4>
<p>{{ session.target }}</p>
</div>
<div class="span6">
<p class="separate-badge">
<span class="badge badge-dis">{{ session.vacancies }}</span>
{{ "Vacancies" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</p>
<p class="separate-badge">
<span class="badge badge-recom">{{ session.recommended_number_of_participants }}</span>
{{ "RecommendedNumberOfParticipants" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</p>
<h4>{{ "PublicationEndDate" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</h4> <p>{{ session.publication_end_date }}</p>
<h4>{{ "Mode" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</h4> <p>{{ session.mode }}</p>
</div>
</div>
<div class="row">
<div class="span12">
<div class="student-list-table">
<table id="student_table" class="table table-striped">
<tbody>
<tr>
<th style="width: 118px;"><img src="{{ _p.web_plugin }}advanced_subscription/views/img/icon-avatar.png"/> </th>
<th>{{ "Postulant" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</th>
<th>{{ "InscriptionDate" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</th>
<th>{{ "BossValidation" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</th>
<th>{{ "Decision" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</th>
</tr>
{% set row_class = "row_odd" %}
{% for student in students %}
<tr class="{{ row_class }}">
<td style="width: 118px;"><img src="{{ student.picture.file }}" class="img-circle"> </td>
<td class="name">{{ student.complete_name }}</td>
<td>{{ student.created_at }}</td>
<td>{{ student.validation }}</td>
<td>
<a
class="btn btn-success btn-advanced-subscription btn-accept"
href="{{ student.acceptUrl }}"
>
{{ 'Accept' | get_plugin_lang('AdvancedSubscriptionPlugin') }}
</a>
<a
class="btn btn-danger btn-advanced-subscription btn-reject"
href="{{ student.rejectUrl }}"
>
{{ 'Reject' | get_plugin_lang('AdvancedSubscriptionPlugin') }}
</a>
</td>
</tr>
{% if row_class == "row_even" %}
{% set row_class = "row_odd" %}
{% else %}
{% set row_class = "row_even" %}
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<input name="f" value="social" type="hidden">
</form>
<div class="modal fade" id="modalMail" tabindex="-1" role="dialog" aria-labelledby="modalMailLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="modalMailLabel">{{ "AdvancedSubscriptionAdminViewTitle" | get_plugin_lang('AdvancedSubscriptionPlugin')}}</h4>
</div>
<div class="modal-body">
<iframe id="iframeAdvsub" frameBorder="0">
</iframe>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Cerrar</button>
</div>
</div>
</div>
</div>
<link href="{{ _p.web_plugin }}advanced_subscription/views/css/style.css" rel="stylesheet" type="text/css">
<script>
$(document).ready(function(){
$("#session-select").change(function () {
$("#form_advanced_subscription_admin").submit();
});
$("a.btn-advanced-subscription").click(function(event){
event.preventDefault();
var confirmed = false;
var studentName = $(this).closest("tr").find(".name").html();
if (studentName) {
;
} else {
studentName = "";
}
var msgRe = /%s/;
if ($(this).hasClass('btn-accept')) {
var msg = "{{ 'AreYouSureYouWantToAcceptSubscriptionOfX' | get_plugin_lang('AdvancedSubscriptionPlugin') }}";
var confirmed = confirm(msg.replace(msgRe, studentName));
} else {
var msg = "{{ 'AreYouSureYouWantToRejectSubscriptionOfX' | get_plugin_lang('AdvancedSubscriptionPlugin') }}";
var confirmed = confirm(msg.replace(msgRe, studentName));
}
if (confirmed) {
var thisBlock = $(this).closest("tr");
var advancedSubscriptionUrl = $(this).attr("href")
$("#iframeAdvsub").attr("src", advancedSubscriptionUrl)
$("#modalMail").modal("show");
$.ajax({
dataType: "json",
url: advancedSubscriptionUrl
}).done(function(result){
if (result.error == true) {
thisBlock.slideUp();
} else {
console.log(result);
}
});
}
});
});
</script>

@ -0,0 +1,63 @@
.text-title-select{
display: inline-block;
}
#session-select{
display: inline-block;
}
.title-name-session{
display: block;
padding-top: 10px;
padding-bottom: 10px;
font-weight: normal;
margin-top: 5px;
margin-bottom: 5px;
}
.badge-dis{
background-color: #008080;
font-size: 20px;
}
.badge-recom{
background-color:#88aa00 ;
font-size: 20px;
}
.separate-badge{
margin-bottom: 20px;
margin-top: 20px;
}
.date, .mode{
display: inline-block;
}
.img-circle{
border-radius: 500px;
-moz-border-radius: 500px;
-webkit-border-radius: 500px;
}
#student_table.table td{
vertical-align: middle;
text-align: center;
}
#student_table.table td.name{
color: #084B8A;
text-align: left;
}
#student_table.table th{
font-size: 14px;
vertical-align: middle;
text-align: center;
}
#modalMail{
width: 770px;
margin-top: -180px !important;
margin-left: -385px !important;
}
#modalMail .modal-body {
height: 360px;
overflow: visible;
}
#iframeAdvsub {
width: 100%;
height: 100%;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

@ -0,0 +1,75 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ "MailTitle"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</title>
</head>
<body>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/header.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td valign="top"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50">&nbsp;</td>
<td width="394"><img src="{{ _p.web_css }}{{ "stylesheets" | get_setting }}/images/header-logo.png" width="230" height="60" alt="Ministerio de Educación"></td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="color: #93c5cd; font-family: Times New Roman, Times, serif; font-size: 24px; font-weight: bold; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #93c5cd;">{{ "MailTitleReminderAdmin" | get_plugin_lang("AdvancedSubscriptionPlugin") | format(session.name)}}</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="356">&nbsp;</td>
<td valign="top"><p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h2>{{ admin.complete_name }}</h2>
<p>{{ "MailContentReminderAdmin" | get_plugin_lang("AdvancedSubscriptionPlugin") | format(session.name, admin_view_url)}}</p>
<p>{{ "MailThankYou" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h3>{{ signature }}</h3></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="50">&nbsp;</td>
<td>&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,76 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ "MailTitle"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</title>
</head>
<body>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/header.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td valign="top"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50">&nbsp;</td>
<td width="394"><img src="{{ _p.web_css }}{{ "stylesheets" | get_setting }}/images/header-logo.png" width="230" height="60" alt="Ministerio de Educación"></td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="color: #93c5cd; font-family: Times New Roman, Times, serif; font-size: 24px; font-weight: bold; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #93c5cd;">{{ "MailTitleReminderStudent"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="356">&nbsp;</td>
<td valign="top"><p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h2>{{ student.complete_name }}</h2>
<p>{{ "MailContentReminderStudent"| get_plugin_lang("AdvancedSubscriptionPlugin") | format(session.name, session.date_start) }}</p>
<p>{{ "MailContentReminderStudentSecond"| get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<p>{{ "MailThankYouCollaboration"| get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<p>{{ signature }}</p></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="50">&nbsp;</td>
<td>&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,86 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ "MailTitle"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</title>
</head>
<body>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/header.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td valign="top"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50">&nbsp;</td>
<td width="394"><img src="{{ _p.web_css }}{{ "stylesheets" | get_setting }}/images/header-logo.png" width="230" height="60" alt="Ministerio de Educación"></td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="color: #93c5cd; font-family: Times New Roman, Times, serif; font-size: 24px; font-weight: bold; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #93c5cd;">{{ "MailTitleReminderSuperior" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="356">&nbsp;</td>
<td valign="top"><p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h2>{{ superior.complete_name }}</h2>
<p>{{ "MailContentReminderSuperior" | get_plugin_lang("AdvancedSubscriptionPlugin") | format(session.name, session.date_start, session.description) }}</p>
<p>{{ "MailContentReminderSuperiorSecond" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<table width="100%" border="0" cellspacing="3" cellpadding="4" style="background:#EDE9EA">
{% for student in students %}
<tr>
<td valign="middle"><img src="{{ student.picture.file }}" width="50" height="50" alt=""></td>
<td valign="middle"><h4>{{ student.complete_name }}</h4></td>
<td valign="middle"><a href="{{ student.acceptUrl }}"><img src="{{ _p.web_plugin }}advanced_subscription/views/img/aprobar.png" width="90" height="25" alt=""></a></td>
<td valign="middle"><a href="{{ student.rejectUrl }}"><img src="{{ _p.web_plugin }}advanced_subscription/views/img/desaprobar.png" width="90" height="25" alt=""></a></td>
</tr>
{% endfor %}
</table>
<p>{{ "MailThankYou" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<p>{{ signature }}</p></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="50">&nbsp;</td>
<td>&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,87 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ "MailTitle"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</title>
</head>
<body>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/header.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td valign="top"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50">&nbsp;</td>
<td width="394"><img src="{{ _p.web_css }}{{ "stylesheets" | get_setting }}/images/header-logo.png" width="230" height="60" alt="Ministerio de Educación"></td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="color: #93c5cd; font-family: Times New Roman, Times, serif; font-size: 24px; font-weight: bold; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #93c5cd;">{{ "MailTitleReminderMaxSuperior" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="356">&nbsp;</td>
<td valign="top">
<p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h2>{{ superior.complete_name }}</h2>
<p>{{ "MailContentReminderMaxSuperior" | get_plugin_lang("AdvancedSubscriptionPlugin") | format(session.name, session.date_start, session.description) }}</p>
<p>{{ "MailContentReminderMaxSuperiorSecond" | get_plugin_lang("AdvancedSubscriptionPlugin") | format(session.recommended_number_of_participants) }}</p>
<table width="100%" border="0" cellspacing="3" cellpadding="4" style="background:#EDE9EA">
{% for student in students %}
<tr>
<td valign="middle"><img src="{{ student.picture.file }}" width="50" height="50" alt=""></td>
<td valign="middle"><h4>{{ student.complete_name }}</h4></td>
<td valign="middle"><a href="{{ student.approveUrl }}"><img src="{{ _p.web_plugin }}advanced_subscription/views/img/aprobar.png" width="90" height="25" alt=""></a></td>
<td valign="middle"><a href="{{ student.rejectUrl }}"><img src="{{ _p.web_plugin }}advanced_subscription/views/img/desaprobar.png" width="90" height="25" alt=""></a></td>
</tr>
{% endfor %}
</table>
<p>{{ "MailThankYou" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h3>{{ signature }}</h3></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="50">&nbsp;</td>
<td>&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,75 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ "MailTitle"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</title>
</head>
<body>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/header.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td valign="top"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50">&nbsp;</td>
<td width="394"><img src="{{ _p.web_css }}{{ "stylesheets" | get_setting }}/images/header-logo.png" width="230" height="60" alt="Ministerio de Educación"></td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="color: #93c5cd; font-family: Times New Roman, Times, serif; font-size: 24px; font-weight: bold; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #93c5cd;">{{ "MailTitleStudentRequestNoSuperiorToAdmin"| get_plugin_lang("AdvancedSubscriptionPlugin") | format(student.complete_name, session.name) }}</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="356">&nbsp;</td>
<td valign="top"><p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h2>{{ admin.complete_name }}</h2>
<p>{{ "MailContentStudentRequestNoSuperiorToAdmin"| get_plugin_lang("AdvancedSubscriptionPlugin") | format(complete_name_with_username, session.name, admin_view_url) }}</p>
<p>{{ "MailThankYou" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h3>{{ signature }}</h3></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="50">&nbsp;</td>
<td>&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,76 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ "MailTitle"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</title>
</head>
<body>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/header.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td valign="top"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50">&nbsp;</td>
<td width="394"><img src="{{ _p.web_css }}{{ "stylesheets" | get_setting }}/images/header-logo.png" width="230" height="60" alt="Ministerio de Educación"></td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="color: #93c5cd; font-family: Times New Roman, Times, serif; font-size: 24px; font-weight: bold; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #93c5cd;">{{ "MailTitleStudentRequestNoSuperiorToStudent"| get_plugin_lang("AdvancedSubscriptionPlugin") | format(session.name) }}</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="356">&nbsp;</td>
<td valign="top"><p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h2>{{ student.complete_name }}</h2>
<p>{{ "MailContentStudentRequestNoSuperiorToStudent"| get_plugin_lang("AdvancedSubscriptionPlugin") | format(session.name, session.date_start) }}</p>
<p>{{ "MailContentStudentRequestNoSuperiorToStudentSecond"| get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<p>{{ "MailThankYou" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<p>{{ signature }}</p></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="50">&nbsp;</td>
<td>&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,75 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ "MailTitle"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</title>
</head>
<body>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/header.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td valign="top"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50">&nbsp;</td>
<td width="394"><img src="{{ _p.web_css }}{{ "stylesheets" | get_setting }}/images/header-logo.png" width="230" height="60" alt="Ministerio de Educación"></td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="color: #93c5cd; font-family: Times New Roman, Times, serif; font-size: 24px; font-weight: bold; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #93c5cd;">{{ "MailTitleStudentRequestToStudent"| get_plugin_lang("AdvancedSubscriptionPlugin") | format(session.name) }}</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="356">&nbsp;</td>
<td valign="top"><p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h2>{{ student.complete_name }}</h2>
<p>{{ "MailContentStudentRequestToStudent"| get_plugin_lang("AdvancedSubscriptionPlugin") | format(session.name, session.date_start) }}</p>
<p>{{ "MailContentStudentRequestToStudentSecond" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<p>{{ signature }}</p></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="50">&nbsp;</td>
<td>&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,84 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ "MailTitle"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</title>
</head>
<body>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/header.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td valign="top"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50">&nbsp;</td>
<td width="394"><img src="{{ _p.web_css }}{{ "stylesheets" | get_setting }}/images/header-logo.png" width="230" height="60" alt="Ministerio de Educación"></td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="color: #93c5cd; font-family: Times New Roman, Times, serif; font-size: 24px; font-weight: bold; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #93c5cd;">{{ "MailTitleStudentRequestToSuperior" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="356">&nbsp;</td>
<td valign="top"><p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h2>{{ superior.complete_name }}</h2>
<p>{{ "MailContentStudentRequestToSuperior" | get_plugin_lang("AdvancedSubscriptionPlugin") | format(student.complete_name, session.name, session.date_start, session.description) }}</p>
<p>{{ "MailContentStudentRequestToSuperiorSecond" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<table width="100%" border="0" cellspacing="3" cellpadding="4" style="background:#EDE9EA">
<tr>
<td width="58" valign="middle"><img src="{{ student.picture.file }}" width="50" height="50" alt=""></td>
<td width="211" valign="middle"><h4>{{ student.complete_name }}</h4></td>
<td width="90" valign="middle"><a href="{{ student.acceptUrl }}"><img src="{{ _p.web_plugin }}advanced_subscription/views/img/aprobar.png" width="90" height="25" alt=""></a></td>
<td width="243" valign="middle"><a href="{{ student.rejectUrl }}"><img src="{{ _p.web_plugin }}advanced_subscription/views/img/desaprobar.png" width="90" height="25" alt=""></a></td>
</tr>
</table>
<p>{{ "MailThankYou" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<p>{{ signature }}</p></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="50">&nbsp;</td>
<td>&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,75 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ "MailTitle"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</title>
</head>
<body>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/header.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td valign="top"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50">&nbsp;</td>
<td width="394"><img src="{{ _p.web_css }}{{ "stylesheets" | get_setting }}/images/header-logo.png" width="230" height="60" alt="Ministerio de Educación"></td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="color: #93c5cd; font-family: Times New Roman, Times, serif; font-size: 24px; font-weight: bold; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #93c5cd;">{{ "MailTitleSuperiorAcceptToAdmin"| get_plugin_lang("AdvancedSubscriptionPlugin") | format(student.complete_name, session.name) }}</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="356">&nbsp;</td>
<td valign="top"><p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h2>{{ admin.complete_name }}</h2>
<p>{{ "MailContentSuperiorAcceptToAdmin"| get_plugin_lang("AdvancedSubscriptionPlugin") | format(student.complete_name_with_username, session.name, admin_view_url) }}</p>
<p>{{ "MailThankYou" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h3>{{ signature }}</h3></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="50">&nbsp;</td>
<td>&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,76 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ "MailTitle"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</title>
</head>
<body>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/header.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td valign="top"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50">&nbsp;</td>
<td width="394"><img src="{{ _p.web_css }}{{ "stylesheets" | get_setting }}/images/header-logo.png" width="230" height="60" alt="Ministerio de Educación"></td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="color: #93c5cd; font-family: Times New Roman, Times, serif; font-size: 24px; font-weight: bold; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #93c5cd;">{{ "MailTitleSuperiorAcceptToStudent" | get_plugin_lang("AdvancedSubscriptionPlugin") | format(session.name) }}</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="356">&nbsp;</td>
<td valign="top">
<p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h2>{{ student.complete_name }}</h2>
<p>{{ "MailContentSuperiorAcceptToStudent" | get_plugin_lang("AdvancedSubscriptionPlugin") | format(session.name ) }}</p>
<p>{{ "MailThankYou" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h3>{{ signature }}</h3></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="50">&nbsp;</td>
<td>&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,76 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ "MailTitle"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</title>
</head>
<body>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/header.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td valign="top"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50">&nbsp;</td>
<td width="394"><img src="{{ _p.web_css }}{{ "stylesheets" | get_setting }}/images/header-logo.png" width="230" height="60" alt="Ministerio de Educación"></td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="color: #93c5cd; font-family: Times New Roman, Times, serif; font-size: 24px; font-weight: bold; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #93c5cd;">{{ "MailTitleSuperiorAcceptToSuperior"| get_plugin_lang("AdvancedSubscriptionPlugin") | format(student.complete_name) }}</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="356">&nbsp;</td>
<td valign="top"><p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h2>{{ superior.complete_name }}</h2>
<p>{{ "MailContentSuperiorAcceptToSuperior"| get_plugin_lang("AdvancedSubscriptionPlugin") | format(session.name, student.complete_name) }}</p>
<p>{{ "MailContentSuperiorAcceptToSuperiorSecond"| get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<p>{{ "MailThankYouCollaboration" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h3>{{ signature }}</h3></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="50">&nbsp;</td>
<td>&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,75 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ "MailTitle"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</title>
</head>
<body>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/header.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td valign="top"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50">&nbsp;</td>
<td width="394"><img src="{{ _p.web_css }}{{ "stylesheets" | get_setting }}/images/header-logo.png" width="230" height="60" alt="Ministerio de Educación"></td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="color: #93c5cd; font-family: Times New Roman, Times, serif; font-size: 24px; font-weight: bold; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #93c5cd;">{{ "MailTitleSuperiorRejectToStudent" | get_plugin_lang("AdvancedSubscriptionPlugin") | format(session.name) }}</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="356">&nbsp;</td>
<td valign="top"><p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h2>{{ student.complete_name }}</h2>
<p>{{ "MailContentSuperiorRejectToStudent" | get_plugin_lang("AdvancedSubscriptionPlugin") | format(session.name) }}</p>
<p>{{ "MailThankYou" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h3>{{ signature }}</h3></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="50">&nbsp;</td>
<td>&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,75 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ "MailTitle"| get_plugin_lang('AdvancedSubscriptionPlugin') | format(session.name) }}</title>
</head>
<body>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/header.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td valign="top"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50">&nbsp;</td>
<td width="394"><img src="{{ _p.web_css }}{{ "stylesheets" | get_setting }}/images/header-logo.png" width="230" height="60" alt="Ministerio de Educación"></td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td style="color: #93c5cd; font-family: Times New Roman, Times, serif; font-size: 24px; font-weight: bold; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #93c5cd;">{{ "MailTitleSuperiorRejectToSuperior"| get_plugin_lang("AdvancedSubscriptionPlugin") | format(student.complete_name) }}</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="356">&nbsp;</td>
<td valign="top"><p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h2>{{ superior.complete_name }}</h2>
<p>{{ "MailContentSuperiorRejectToSuperior"| get_plugin_lang("AdvancedSubscriptionPlugin") | format(session.name, student.complete_name) }}</p>
<p>{{ "MailThankYouCollaboration" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
<h3>{{ signature }}</h3></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="50">&nbsp;</td>
<td>&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/line.png" width="700" height="25" alt=""></td>
</tr>
<tr>
<td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -108,9 +108,9 @@ $isOpenSession->save(array(
$duration = new ExtraField('session');
$duration->save(array(
'field_type' => ExtraField::FIELD_TYPE_INTEGER,
'field_variable' => 'duration',
'field_display_text' => get_lang('Duration'),
'field_type' => ExtraField::FIELD_TYPE_TEXT,
'field_variable' => 'human_text_duration',
'field_display_text' => get_lang('DurationInWords'),
'field_visible' => 1,
'field_changeable' => 1
));

Loading…
Cancel
Save