Yannick Warnier 10 年之前
父節點
當前提交
c4a1d37423
共有 64 個文件被更改,包括 2007 次插入1627 次删除
  1. 11 9
      main/inc/lib/sessionmanager.lib.php
  2. 1 1
      main/inc/lib/usermanager.lib.php
  3. 2 2
      main/webservices/registration.soap.php
  4. 53 0
      plugin/advanced_subscription/README.md
  5. 95 62
      plugin/advanced_subscription/ajax/advanced_subscription.ajax.php
  6. 26 0
      plugin/advanced_subscription/config.php
  7. 0 0
      plugin/advanced_subscription/index.html
  8. 1 1
      plugin/advanced_subscription/install.php
  9. 134 0
      plugin/advanced_subscription/lang/english.php
  10. 134 0
      plugin/advanced_subscription/lang/spanish.php
  11. 0 0
      plugin/advanced_subscription/license.txt
  12. 1 1
      plugin/advanced_subscription/plugin.php
  13. 99 0
      plugin/advanced_subscription/readme.txt
  14. 239 188
      plugin/advanced_subscription/src/AdvancedSubscriptionPlugin.php
  15. 56 47
      plugin/advanced_subscription/src/HookAdvancedSubscription.php
  16. 88 0
      plugin/advanced_subscription/src/admin_view.php
  17. 123 0
      plugin/advanced_subscription/test/mails.php
  18. 1 1
      plugin/advanced_subscription/uninstall.php
  19. 10 21
      plugin/advanced_subscription/views/admin_accepted_notice_admin.tpl
  20. 10 21
      plugin/advanced_subscription/views/admin_accepted_notice_student.tpl
  21. 10 21
      plugin/advanced_subscription/views/admin_accepted_notice_superior.tpl
  22. 10 21
      plugin/advanced_subscription/views/admin_rejected_notice_admin.tpl
  23. 10 21
      plugin/advanced_subscription/views/admin_rejected_notice_student.tpl
  24. 10 21
      plugin/advanced_subscription/views/admin_rejected_notice_superior.tpl
  25. 13 78
      plugin/advanced_subscription/views/admin_view.tpl
  26. 63 0
      plugin/advanced_subscription/views/css/style.css
  27. 0 0
      plugin/advanced_subscription/views/img/aprobar.png
  28. 0 0
      plugin/advanced_subscription/views/img/avatar.png
  29. 0 0
      plugin/advanced_subscription/views/img/desaprobar.png
  30. 0 0
      plugin/advanced_subscription/views/img/footer.png
  31. 0 0
      plugin/advanced_subscription/views/img/header.png
  32. 0 0
      plugin/advanced_subscription/views/img/icon-avatar.png
  33. 0 0
      plugin/advanced_subscription/views/img/line.png
  34. 10 21
      plugin/advanced_subscription/views/reminder_notice_admin.tpl
  35. 76 0
      plugin/advanced_subscription/views/reminder_notice_student.tpl
  36. 14 25
      plugin/advanced_subscription/views/reminder_notice_superior.tpl
  37. 87 0
      plugin/advanced_subscription/views/reminder_notice_superior_max.tpl
  38. 75 0
      plugin/advanced_subscription/views/student_no_superior_notice_admin.tpl
  39. 76 0
      plugin/advanced_subscription/views/student_no_superior_notice_student.tpl
  40. 75 0
      plugin/advanced_subscription/views/student_notice_student.tpl
  41. 14 25
      plugin/advanced_subscription/views/student_notice_superior.tpl
  42. 75 0
      plugin/advanced_subscription/views/superior_accepted_notice_admin.tpl
  43. 76 0
      plugin/advanced_subscription/views/superior_accepted_notice_student.tpl
  44. 76 0
      plugin/advanced_subscription/views/superior_accepted_notice_superior.tpl
  45. 75 0
      plugin/advanced_subscription/views/superior_rejected_notice_student.tpl
  46. 75 0
      plugin/advanced_subscription/views/superior_rejected_notice_superior.tpl
  47. 0 4
      plugin/advancedsubscription/README.md
  48. 0 29
      plugin/advancedsubscription/config.php
  49. 0 62
      plugin/advancedsubscription/lang/english.php
  50. 0 67
      plugin/advancedsubscription/lang/spanish.php
  51. 0 3
      plugin/advancedsubscription/readme.txt
  52. 0 74
      plugin/advancedsubscription/src/admin_view.php
  53. 0 86
      plugin/advancedsubscription/views/advsub_approval_admin_accepted_notice_student.tpl
  54. 0 86
      plugin/advancedsubscription/views/advsub_approval_admin_accepted_notice_superior.tpl
  55. 0 87
      plugin/advancedsubscription/views/advsub_request_approve_confirmed.tpl
  56. 0 95
      plugin/advancedsubscription/views/advsub_request_approved_info_admin.tpl
  57. 0 87
      plugin/advancedsubscription/views/advsub_request_received.tpl
  58. 0 87
      plugin/advancedsubscription/views/advsub_request_received_no_boss.tpl
  59. 0 87
      plugin/advancedsubscription/views/advsub_request_received_reminder.tpl
  60. 0 86
      plugin/advancedsubscription/views/advsub_request_superior_approved.tpl
  61. 0 97
      plugin/advancedsubscription/views/advsub_request_superior_reminder_max.tpl
  62. 二進制
      plugin/advancedsubscription/views/img/avatar.png
  63. 二進制
      plugin/advancedsubscription/views/img/logo-minedu.png
  64. 3 3
      tests/scripts/insert_session_fields.php

+ 11 - 9
main/inc/lib/sessionmanager.lib.php

@@ -5436,13 +5436,15 @@ class SessionManager
     }
 
     /**
-     * Returns the list of session (name, short description, start date, end date) from category.
-     * The short description is an extra field value
+     * Returns list of a few data from session (name, short description, start date, end date)
+     * And the next extra fields
+     * short_description, mode, human_text_duration, vacancies, brochure, target, schedule
+     * from Session category Id.
      * @param int $categoryId
      * @param string $target
      * @return mixed
      */
-    public static function getSessionBriefListByCategory($categoryId, $target) {
+    public static function getBriefSessionListAndExtraByCategory($categoryId, $target) {
         // Init variables
         $categoryId = (int) $categoryId;
         $sessionList = array();
@@ -5455,7 +5457,7 @@ class SessionManager
             // Join session field and session field values tables
             $joinTable = $sfTable . ' sf INNER JOIN ' . $sfvTable . ' sfv ON sf.id = sfv.field_id';
             $fieldsArray = array(
-                'short_description', 'mode', 'duration', 'vacancies', 'brochure', 'target', 'schedule'
+                'short_description', 'mode', 'human_text_duration', 'vacancies', 'brochure', 'target', 'schedule'
             );
             // Get the session list from session category and target
             $sessionList = Database::select(
@@ -5660,13 +5662,13 @@ class SessionManager
                 // Not found result, update error message
                 $errorResult['errorMessage'] = 'Not found any session for session category id ' . $sessionCategoryId;
             }
-
-            return $errorResult;
         }
+
+        return $errorResult;
     }
 
     /**
-     * Return session description from
+     * Return session description from session id
      * @param int $sessionId
      * @return string
      */
@@ -5676,7 +5678,7 @@ class SessionManager
         $sessionId = intval($sessionId);
         $description = '';
         // Check if session id is valid
-        if ($sessionId !== 0) {
+        if ($sessionId > 0) {
             // Select query from session id
             $rows = Database::select(
                 'description',
@@ -5698,7 +5700,7 @@ class SessionManager
         return $description;
     }
 
-    /*
+    /**
      * Get a session list filtered by name, description or any of the given extra fields
      * @param string $term The term to search
      * @param array $extraFieldsToInclude Extra fields to include in the session data

+ 1 - 1
main/inc/lib/usermanager.lib.php

@@ -5120,7 +5120,7 @@ EOF;
     public static function getStudentBoss($userId)
     {
         $userId = intval($userId);
-        if ($userId !== 0) {
+        if ($userId > 0) {
             $userRelTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
             $row = Database::select(
                 'DISTINCT friend_user_id AS boss_id',

+ 2 - 2
main/webservices/registration.soap.php

@@ -21,13 +21,13 @@ function return_error($code) {
             $fault = new soap_fault('Server', '', 'Secret key is not correct or params are not correctly set');
             break;
         case WS_ERROR_NOT_FOUND_RESULT:
-            $fault = new soap_fault('Server', '', 'Not found any result from the query');
+            $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 and installation for this webservice');
+            $fault = new soap_fault('Server', '', 'Please check the configuration for this webservice');
             break;
     }
     return $fault;

+ 53 - 0
plugin/advanced_subscription/README.md

@@ -0,0 +1,53 @@
+Advanced subscription plugin for Chamilo LMS
+=======================================
+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
+# Requirements
+Chamilo LMS 1.10 or greater
+
+# Settings
+
+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 use the next hooks:
+
+* HookAdminBlock
+* HookWSRegistration
+* HookNotificationContent
+* HookNotificationTitle
+
+
+# Web services
+
+* HookAdvancedSubscription..WSSessionListInCategory
+* HookAdvancedSubscription..WSSessionGetDetailsByUser
+* HookAdvancedSubscription..WSListSessionsDetailsByCategory
+
+See `/plugin/advanced_subscription/src/HookAdvancedSubscription.php` to check Web services inputs and outputs
+
+# How plugin works?
+
+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:
+* Student search course session
+* Student read session info depending student data
+* Student request a subscription
+* A confirmation email is send to student
+* An email is send to users (superior or admins) who will accept or reject student request
+* When the user aceept o reject, an email will be send to student, superior or admins respectively
+* To complete the subscription, the request must be validated and accepted by an admin

+ 95 - 62
plugin/advancedsubscription/ajax/advsub.ajax.php → plugin/advanced_subscription/ajax/advanced_subscription.ajax.php

@@ -3,7 +3,7 @@
 /**
  * Script to receipt request to subscribe and confirmation action to queue
  * @author Daniel Alejandro Barreto Alva <daniel.barreto@beeznest.com>
- * @package chamilo.plugin.advancedsubscription
+ * @package chamilo.plugin.advanced_subscription
  */
 
 /**
@@ -15,23 +15,23 @@ $plugin = AdvancedSubscriptionPlugin::create();
 // Get validation hash
 $hash = Security::remove_XSS($_REQUEST['v']);
 // Get data from request (GET or POST)
-$data['a'] = Security::remove_XSS($_REQUEST['a']);
-$data['s'] = intval($_REQUEST['s']);
-$data['current_user_id'] = intval($_REQUEST['current_user_id']);
-$data['u'] = intval($_REQUEST['u']);
-$data['q'] = intval($_REQUEST['q']);
-$data['e'] = intval($_REQUEST['e']);
+$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['a'] == 'subscribe';
+$verified = $plugin->checkHash($data, $hash) || $data['action'] == 'subscribe';
 if ($verified) {
-    switch($data['a']) {
+    switch($data['action']) {
         case 'check': // Check minimum requirements
             try {
-                $res = AdvancedSubscriptionPlugin::create()->isAbleToRequest($data['u'], $data);
+                $res = AdvancedSubscriptionPlugin::create()->isAllowedToDoRequest($data['studentUserId'], $data);
                 if ($res) {
                     $result['error'] = false;
                     $result['errorMessage'] = 'No error';
@@ -46,29 +46,42 @@ if ($verified) {
             break;
         case 'subscribe': // Subscription
             // Start subscription to queue
-            $res = AdvancedSubscriptionPlugin::create()->startSubscription($data['u'], $data['s'], $data);
+            $res = AdvancedSubscriptionPlugin::create()->startSubscription($data['studentUserId'], $data['sessionId'], $data);
             // Check if queue subscription was successful
             if ($res === true) {
                 // Prepare data
                 // Get session data
-                $sessionArray = api_get_session_info($data['s']);
+                // 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');
-                $var = $extraSession->get_values_by_handler_and_field_variable($data['s'], 'description');
-                $sessionArray['description'] = $var['field_valiue'];
-                $var = $extraSession->get_values_by_handler_and_field_variable($data['s'], 'target');
-                $sessionArray['target'] = $var['field_valiue'];
-                $var = $extraSession->get_values_by_handler_and_field_variable($data['s'], 'mode');
-                $sessionArray['mode'] = $var['field_valiue'];
-                $var = $extraSession->get_values_by_handler_and_field_variable($data['s'], 'publication_end_date');
-                $sessionArray['publication_end_date'] = $var['field_value'];
-                $var = $extraSession->get_values_by_handler_and_field_variable($data['s'], 'recommended_number_of_participants');
-                $sessionArray['recommended_number_of_participants'] = $var['field_valiue'];
+                $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['u']);
+                $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['u']);
+                $superiorId = UserManager::getStudentBoss($data['studentUserId']);
                 if (!empty($superiorId)) {
                     $superiorArray = api_get_user_info($superiorId);
                 } else {
@@ -76,12 +89,16 @@ if ($verified) {
                 }
                 // Get admin data
                 $adminsArray = UserManager::get_all_administrators();
+                $isWesternNameOrder = api_is_western_name_order();
                 foreach ($adminsArray as &$admin) {
-                    $admin['complete_name'] = $admin['lastname'] . ', ' . $admin['firstname'];
+                    $admin['complete_name'] = $isWesternNameOrder ?
+                        $admin['firstname'] . ', ' . $admin['lastname'] :
+                        $admin['lastname'] . ', ' . $admin['firstname']
+                    ;
                 }
                 unset($admin);
                 // Set data
-                $data['a'] = 'confirm';
+                $data['action'] = 'confirm';
                 $data['student'] = $studentArray;
                 $data['superior'] = $superiorArray;
                 $data['admins'] = $adminsArray;
@@ -92,13 +109,13 @@ if ($verified) {
                 if (empty($superiorId)) {
                     // Student boss does not exist
                     // Update status to accepted by boss
-                    $res = $plugin->updateQueueStatus($data, ADV_SUB_QUEUE_STATUS_BOSS_APPROVED);
+                    $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) .
-                            'advancedsubscription/src/admin_view.php?s=' . $data['s'];
+                            'advanced_subscription/src/admin_view.php?s=' . $data['sessionId'];
                         // Send mails
-                        $result['mailIds'] = $plugin->sendMail($data, ADV_SUB_ACTION_STUDENT_REQUEST_NO_BOSS);
+                        $result['mailIds'] = $plugin->sendMail($data, ADVANCED_SUBSCRIPTION_ACTION_STUDENT_REQUEST_NO_BOSS);
                         // Check if mails were sent
                         if (!empty($result['mailIds'])) {
                             $result['error'] = false;
@@ -117,13 +134,13 @@ if ($verified) {
                 } else {
                     // Student boss does exist
                     // Get url to be accepted by boss
-                    $data['e'] = ADV_SUB_QUEUE_STATUS_BOSS_APPROVED;
+                    $data['newStatus'] = ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_APPROVED;
                     $data['student']['acceptUrl'] = $plugin->getQueueUrl($data);
                     // Get url to be rejected by boss
-                    $data['e'] = ADV_SUB_QUEUE_STATUS_BOSS_DISAPPROVED;
+                    $data['newStatus'] = ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_DISAPPROVED;
                     $data['student']['rejectUrl'] = $plugin->getQueueUrl($data);
                     // Send mails
-                    $result['mailIds'] = $plugin->sendMail($data, ADV_SUB_ACTION_STUDENT_REQUEST);
+                    $result['mailIds'] = $plugin->sendMail($data, ADVANCED_SUBSCRIPTION_ACTION_STUDENT_REQUEST);
                     // Check if mails were sent
                     if (!empty($result['mailIds'])) {
                         $result['error'] = false;
@@ -150,31 +167,43 @@ if ($verified) {
 
             break;
         case 'confirm':
-            // Check if is set new status
-            if (isset($data['e'])) {
+            // Check if new status is set
+            if (isset($data['newStatus'])) {
                 // Update queue status
-                $res = $plugin->updateQueueStatus($data, $data['e']);
+                $res = $plugin->updateQueueStatus($data, $data['newStatus']);
                 if ($res === true) {
                     // Prepare data
                     // Prepare session data
-                    $sessionArray = api_get_session_info($data['s']);
+                    $fieldsArray = array('description', 'target', 'mode', 'publication_end_date', 'recommended_number_of_participants');
+                    $sessionArray = api_get_session_info($data['sessionId']);
                     $extraSession = new ExtraFieldValue('session');
-                    $var = $extraSession->get_values_by_handler_and_field_variable($data['s'], 'description');
-                    $sessionArray['description'] = $var['field_valiue'];
-                    $var = $extraSession->get_values_by_handler_and_field_variable($data['s'], 'target');
-                    $sessionArray['target'] = $var['field_valiue'];
-                    $var = $extraSession->get_values_by_handler_and_field_variable($data['s'], 'mode');
-                    $sessionArray['mode'] = $var['field_valiue'];
-                    $var = $extraSession->get_values_by_handler_and_field_variable($data['s'], 'publication_end_date');
-                    $sessionArray['publication_end_date'] = $var['field_value'];
-                    $var = $extraSession->get_values_by_handler_and_field_variable($data['s'], 'recommended_number_of_participants');
-                    $sessionArray['recommended_number_of_participants'] = $var['field_valiue'];
+                    $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['u']);
+                    $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['u']);
+                    $superiorId = UserManager::getStudentBoss($data['studentUserId']);
                     if (!empty($superiorId)) {
                         $superiorArray = api_get_user_info($superiorId);
                     } else {
@@ -182,8 +211,12 @@ if ($verified) {
                     }
                     // Prepare admin data
                     $adminsArray = UserManager::get_all_administrators();
+                    $isWesternNameOrder = api_is_western_name_order();
                     foreach ($adminsArray as &$admin) {
-                        $admin['complete_name'] = $admin['lastname'] . ', ' . $admin['firstname'];
+                        $admin['complete_name'] = $isWesternNameOrder ?
+                            $admin['firstname'] . ', ' . $admin['lastname'] :
+                            $admin['lastname'] . ', ' . $admin['firstname']
+                        ;
                     }
                     unset($admin);
                     // Set data
@@ -192,22 +225,22 @@ if ($verified) {
                     $data['admins'] = $adminsArray;
                     $data['session'] = $sessionArray;
                     $data['signature'] = api_get_setting('Institution');
-                    $data['admin_view_url'] = api_get_path(WEB_PLUGIN_PATH) . 'advancedsubscription/src/admin_view.php?s=' . $data['s'];
+                    $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['e']) {
-                            case ADV_SUB_QUEUE_STATUS_BOSS_APPROVED:
-                                $data['action'] = ADV_SUB_ACTION_SUPERIOR_APPROVE;
+                        switch ($data['newStatus']) {
+                            case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_APPROVED:
+                                $data['action'] = ADVANCED_SUBSCRIPTION_ACTION_SUPERIOR_APPROVE;
                                 break;
-                            case ADV_SUB_QUEUE_STATUS_BOSS_DISAPPROVED:
-                                $data['action'] = ADV_SUB_ACTION_SUPERIOR_DISAPPROVE;
+                            case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_DISAPPROVED:
+                                $data['action'] = ADVANCED_SUBSCRIPTION_ACTION_SUPERIOR_DISAPPROVE;
                                 break;
-                            case ADV_SUB_QUEUE_STATUS_ADMIN_APPROVED:
-                                $data['action'] = ADV_SUB_ACTION_ADMIN_APPROVE;
+                            case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED:
+                                $data['action'] = ADVANCED_SUBSCRIPTION_ACTION_ADMIN_APPROVE;
                                 break;
-                            case ADV_SUB_QUEUE_STATUS_ADMIN_DISAPPROVED:
-                                $data['action'] = ADV_SUB_ACTION_ADMIN_DISAPPROVE;
+                            case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_DISAPPROVED:
+                                $data['action'] = ADVANCED_SUBSCRIPTION_ACTION_ADMIN_DISAPPROVE;
                                 break;
                             default:
                                 break;
@@ -215,8 +248,8 @@ if ($verified) {
                     }
 
                     // Student Session inscription
-                    if ($data['e'] == ADV_SUB_QUEUE_STATUS_ADMIN_APPROVED) {
-                        SessionManager::suscribe_users_to_session($data['s'], array($data['u']), null, false);
+                    if ($data['newStatus'] == ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED) {
+                        SessionManager::suscribe_users_to_session($data['sessionId'], array($data['studentUserId']), null, false);
                     }
 
                     // Send mails
@@ -240,7 +273,7 @@ if ($verified) {
             }
             break;
         default:
-            $result['errorMessage'] = 'Action do not exist!';
+            $result['errorMessage'] = 'This action does not exist!';
     }
 }
 

+ 26 - 0
plugin/advanced_subscription/config.php

@@ -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
plugin/advancedsubscription/index.html → plugin/advanced_subscription/index.html


+ 1 - 1
plugin/advancedsubscription/install.php → plugin/advanced_subscription/install.php

@@ -3,7 +3,7 @@
 /**
  * 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.advancedsubscription
+ * @package chamilo.plugin.advanced_subscription
  */
 
 /**

+ 134 - 0
plugin/advanced_subscription/lang/english.php

@@ -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.';

+ 134 - 0
plugin/advanced_subscription/lang/spanish.php

@@ -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
plugin/advancedsubscription/license.txt → plugin/advanced_subscription/license.txt


+ 1 - 1
plugin/advancedsubscription/plugin.php → plugin/advanced_subscription/plugin.php

@@ -3,7 +3,7 @@
 /**
  * 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.advancedsubscription
+ * @package chamilo.plugin.advanced_subscription
  */
 /**
  * Plugin details (must be present)

+ 99 - 0
plugin/advanced_subscription/readme.txt

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

+ 239 - 188
plugin/advancedsubscription/src/AdvancedSubscriptionPlugin.php → plugin/advanced_subscription/src/AdvancedSubscriptionPlugin.php

@@ -1,22 +1,21 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
- * @TODO: Improve description
  * 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.advancedsubscription
+ * @package chamilo.plugin.advanced_subscription
  */
 
 
 class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
 {
+    protected $strings;
     /**
      * Constructor
      */
     function __construct()
     {
         $parameters = array(
-            'tool_enable' => 'boolean',
             'yearly_cost_limit' => 'text',
             'yearly_hours_limit' => 'text',
             'yearly_cost_unit_converter' => 'text',
@@ -25,7 +24,6 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
             'ws_url' => 'text',
             'min_profile_percentage' => 'text',
             'check_induction' => 'boolean',
-            'confirmation_message' => 'wysiwyg',
             'secret_key' => 'text',
         );
 
@@ -70,9 +68,9 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
      */
     private function installDatabase()
     {
-        $pAdvSubQueueTable = Database::get_main_table(TABLE_ADV_SUB_QUEUE);
+        $advancedSubscriptionQueueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE);
 
-        $sql = "CREATE TABLE IF NOT EXISTS $pAdvSubQueueTable (" .
+        $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, " .
@@ -80,8 +78,8 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
             "last_message_id int UNSIGNED NOT NULL, " .
             "created_at datetime NOT NULL, " .
             "updated_at datetime NULL, " .
-            "PRIMARY KEY PK_advsub_queue (id), " .
-            "UNIQUE KEY UK_advsub_queue (user_id, session_id)); ";
+            "PRIMARY KEY PK_advanced_subscription_queue (id), " .
+            "UNIQUE KEY UK_advanced_subscription_queue (user_id, session_id)); ";
         Database::query($sql);
     }
 
@@ -92,18 +90,18 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
     private function uninstallDatabase()
     {
         /* Drop plugin tables */
-        $pAdvSubQueueTable = Database::get_main_table(TABLE_ADV_SUB_QUEUE);
+        $advancedSubscriptionQueueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE);
 
-        $sql = "DROP TABLE IF EXISTS $pAdvSubQueueTable; ";
+        $sql = "DROP TABLE IF EXISTS $advancedSubscriptionQueueTable; ";
         Database::query($sql);
 
         /* Delete settings */
-        $tSettings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
-        Database::query("DELETE FROM $tSettings WHERE subkey = 'advancedsubscription'");
+        $settingsTable = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
+        Database::query("DELETE FROM $settingsTable WHERE subkey = 'advanced_subscription'");
     }
 
     /**
-     * Return true if user is able to be added to queue for session 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
@@ -111,42 +109,42 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
      * @throws Exception
      * @return bool
      */
-    public function isAbleToRequest($userId, $params = array())
+    public function isAllowedToDoRequest($userId, $params = array())
     {
         if (isset($params['is_connected']) && isset($params['profile_completed'])) {
-            $isAble = false;
-            $advSubPlugin = self::create();
-            $wsUrl = $advSubPlugin->get('ws_url');
+            $isAllowed = false;
+            $plugin = self::create();
+            $wsUrl = $plugin->get('ws_url');
             // @TODO: Get connection status from user by WS
             $isConnected = $params['is_connected'];
             if ($isConnected) {
-                $profileCompletedMin = (float) $advSubPlugin->get('min_profile_percentage');
+                $profileCompletedMin = (float) $plugin->get('min_profile_percentage');
                 // @TODO: Get completed profile percentage by WS
                 $profileCompleted = (float) $params['profile_completed'];
                 if ($profileCompleted > $profileCompletedMin) {
-                    $checkInduction = $advSubPlugin->get('check_induction');
+                    $checkInduction = $plugin->get('check_induction');
                     // @TODO: check if user have completed at least one induction session
                     $completedInduction = true;
                     if (!$checkInduction || $completedInduction) {
-                        $uitMax = $advSubPlugin->get('yearly_cost_unit_converter');
-                        $uitMax *= $advSubPlugin->get('yearly_cost_limit');
+                        $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 = $advSubPlugin->get('yearly_hours_limit');
+                            $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 = $advSubPlugin->get('courses_count_limit');
+                                $expendedNumMax = $plugin->get('courses_count_limit');
                                 // @TODO: Get Expended num from user
                                 $expendedNum = 0;
                                 if ($expendedNumMax >= $expendedNum) {
-                                    $isAble = true;
+                                    $isAllowed = true;
                                 } else {
                                     throw new \Exception($this->get_lang('AdvancedSubscriptionCourseXLimitReached'));
                                 }
@@ -166,7 +164,7 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
                 throw new \Exception($this->get_lang('AdvancedSubscriptionNotConnected'));
             }
 
-            return $isAble;
+            return $isAllowed;
         } else {
             throw new \Exception($this->get_lang('AdvancedSubscriptionIncompleteParams'));
         }
@@ -181,8 +179,11 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
      */
     public function addToQueue($userId, $sessionId)
     {
+        // Filter input variables
+        $userId = intval($userId);
+        $sessionId = intval($sessionId);
         $now = api_get_utc_datetime();
-        $pAdvSubQueueTable = Database::get_main_table(TABLE_ADV_SUB_QUEUE);
+        $advancedSubscriptionQueueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE);
         $attributes = array(
             'session_id' => $sessionId,
             'user_id' => $userId,
@@ -191,7 +192,7 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
             'updated_at' => null,
         );
 
-        $id = Database::insert($pAdvSubQueueTable, $attributes);
+        $id = Database::insert($advancedSubscriptionQueueTable, $attributes);
 
         return $id;
     }
@@ -205,7 +206,11 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
      */
     public function saveLastMessage($mailId, $userId, $sessionId)
     {
-        $queueTable = Database::get_main_table(TABLE_ADV_SUB_QUEUE);
+        // 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,
         );
@@ -230,10 +235,10 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
     {
         $result = false;
         if (!empty($sessionId) && !empty($userId)) {
-            $advSub = self::create();
+            $plugin = self::create();
             try {
-                if ($advSub->isAbleToRequest($userId, $params)) {
-                    $result = (bool) $advSub->addToQueue($userId, $sessionId);
+                if ($plugin->isAllowedToDoRequest($userId, $params)) {
+                    $result = (bool) $plugin->addToQueue($userId, $sessionId);
                 } else {
                     throw new \Exception($this->get_lang('AdvancedSubscriptionNotMoreAble'));
                 }
@@ -259,19 +264,10 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
      */
     public function sendMailMessage($studentId, $receiverId, $subject, $content, $sessionId, $save = false)
     {
-        global $_configuration; // @TODO: Add $_configuration['no_reply_user_id'] to configuration file
-
         $mailId = MessageManager::send_message(
             $receiverId,
             $subject,
-            $content,
-            null,
-            null,
-            null,
-            null,
-            null,
-            null,
-            $_configuration['no_reply_user_id']
+            $content
         );
 
         if ($save && !empty($mailId)) {
@@ -287,7 +283,7 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
      * @param string $fieldVariable
      * @return bool
      */
-    public function isSessionOpen($sessionId, $fieldVariable = 'es_abierta')
+    public function isSessionOpen($sessionId, $fieldVariable = 'is_open_session')
     {
         $sessionId = (int) $sessionId;
         $fieldVariable = Database::escape_string($fieldVariable);
@@ -321,23 +317,24 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
      */
     public function updateQueueStatus($params, $newStatus)
     {
+        $newStatus = intval($newStatus);
         if (isset($params['queue']['id'])) {
             $where = array(
-                'id = ?' => $params['queue']['id'],
+                'id = ?' => intval($params['queue']['id']),
             );
-        } elseif(isset($params['u']) && isset($params['s'])) {
+        } elseif(isset($params['studentUserId']) && isset($params['sessionId'])) {
             $where = array(
                 'user_id = ? AND session_id = ? AND status <> ? AND status <> ?' => array(
-                    $params['u'],
-                    $params['s'],
+                    intval($params['studentUserId']),
+                    intval($params['sessionId']),
                     $newStatus,
-                    ADV_SUB_QUEUE_STATUS_ADMIN_APPROVED,
+                    ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED,
                 ),
             );
         }
         if (isset($where)) {
             $res = (bool) Database::update(
-                Database::get_main_table(TABLE_ADV_SUB_QUEUE),
+                Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE),
                 array(
                     'status' => $newStatus,
                     'updated_at' => api_get_utc_datetime(),
@@ -359,9 +356,9 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
      */
     public function sendMail($data, $actionType)
     {
-        $tpl = new Template($this->get_lang('plugin_title'));
-        $tpl->assign('data', $data);
-        $tplParams = array(
+        $template = new Template($this->get_lang('plugin_title'));
+        $template->assign('data', $data);
+        $templateParams = array(
             'user',
             'student',
             'students',
@@ -373,174 +370,174 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
             'acceptUrl',
             'rejectUrl'
         );
-        foreach ($tplParams as $tplParam) {
-            $tpl->assign($tplParam, $data[$tplParam]);
+        foreach ($templateParams as $templateParam) {
+            $template->assign($templateParam, $data[$templateParam]);
         }
         $mailIds = array();
         switch ($actionType) {
-            case ADV_SUB_ACTION_STUDENT_REQUEST:
+            case ADVANCED_SUBSCRIPTION_ACTION_STUDENT_REQUEST:
                 // Mail to student
                 $mailIds['render'] = $this->sendMailMessage(
-                    $data['u'],
+                    $data['studentUserId'],
                     $data['student']['user_id'],
                     $this->get_lang('MailStudentRequest'),
-                    $tpl->fetch('/advancedsubscription/views/advsub_request_received.tpl'),
-                    $data['s']
+                    $template->fetch('/advanced_subscription/views/student_notice_student.tpl'),
+                    $data['sessionId']
                 );
                 // Mail to superior
                 $mailIds[] = $this->sendMailMessage(
-                    $data['u'],
+                    $data['studentUserId'],
                     $data['superior']['user_id'],
                     $this->get_lang('MailStudentRequest'),
-                    $tpl->fetch('/advancedsubscription/views/advsub_request_superior.tpl'),
-                    $data['s'],
+                    $template->fetch('/advanced_subscription/views/student_notice_superior.tpl'),
+                    $data['sessionId'],
                     true
                 );
                 break;
-            case ADV_SUB_ACTION_SUPERIOR_APPROVE:
+            case ADVANCED_SUBSCRIPTION_ACTION_SUPERIOR_APPROVE:
                 // Mail to student
                 $mailIds[] = $this->sendMailMessage(
-                    $data['u'],
+                    $data['studentUserId'],
                     $data['student']['user_id'],
                     $this->get_lang('MailBossAccept'),
-                    $tpl->fetch('/advancedsubscription/views/advsub_request_superior_approved.tpl'),
-                    $data['s']
+                    $template->fetch('/advanced_subscription/views/superior_accepted_notice_student.tpl'),
+                    $data['sessionId']
                 );
                 // Mail to superior
                 $mailIds['render'] = $this->sendMailMessage(
-                    $data['u'],
+                    $data['studentUserId'],
                     $data['superior']['user_id'],
                     $this->get_lang('MailBossAccept'),
-                    $tpl->fetch('/advancedsubscription/views/advsub_request_approve_confirmed.tpl'),
-                    $data['s']
+                    $template->fetch('/advanced_subscription/views/superior_accepted_notice_superior.tpl'),
+                    $data['sessionId']
                 );
                 // Mail to admin
                 foreach ($data['admins'] as $adminId => $admin) {
-                    $tpl->assign('admin', $admin);
+                    $template->assign('admin', $admin);
                     $mailIds[] = $this->sendMailMessage(
-                        $data['u'],
+                        $data['studentUserId'],
                         $adminId,
                         $this->get_lang('MailBossAccept'),
-                        $tpl->fetch('/advancedsubscription/views/advsub_request_approved_info_admin.tpl'),
-                        $data['s'],
+                        $template->fetch('/advanced_subscription/views/superior_accepted_notice_admin.tpl'),
+                        $data['sessionId'],
                         true
                     );
                 }
                 break;
-            case ADV_SUB_ACTION_SUPERIOR_DISAPPROVE:
+            case ADVANCED_SUBSCRIPTION_ACTION_SUPERIOR_DISAPPROVE:
                 // Mail to student
                 $mailIds[] = $this->sendMailMessage(
-                    $data['u'],
+                    $data['studentUserId'],
                     $data['student']['user_id'],
                     $this->get_lang('MailBossReject'),
-                    $tpl->fetch('/advancedsubscription/views/advsub_request_superior_disapproved.tpl'),
-                    $data['s'],
+                    $template->fetch('/advanced_subscription/views/superior_rejected_notice_student.tpl'),
+                    $data['sessionId'],
                     true
                 );
                 // Mail to superior
                 $mailIds['render'] = $this->sendMailMessage(
-                    $data['u'],
+                    $data['studentUserId'],
                     $data['superior']['user_id'],
                     $this->get_lang('MailBossReject'),
-                    $tpl->fetch('/advancedsubscription/views/advsub_request_disapprove_confirmed.tpl'),
-                    $data['s']
+                    $template->fetch('/advanced_subscription/views/superior_rejected_notice_superior.tpl'),
+                    $data['sessionId']
                 );
                 break;
-            case ADV_SUB_ACTION_SUPERIOR_SELECT:
+            case ADVANCED_SUBSCRIPTION_ACTION_SUPERIOR_SELECT:
                 // Mail to student
                 $mailIds[] = $this->sendMailMessage(
-                    $data['u'],
+                    $data['studentUserId'],
                     $data['student']['user_id'],
                     $this->get_lang('MailStudentRequestSelect'),
-                    $tpl->fetch('/advancedsubscription/views/advsub_request_received.tpl'),
-                    $data['s']
+                    $template->fetch('/advanced_subscription/views/student_notice_student.tpl'),
+                    $data['sessionId']
                 );
                 // Mail to superior
                 $mailIds['render'] = $this->sendMailMessage(
-                    $data['u'],
+                    $data['studentUserId'],
                     $data['superior']['user_id'],
                     $this->get_lang('MailStudentRequestSelect'),
-                    $tpl->fetch('/advancedsubscription/views/advsub_request_superior.tpl'),
-                    $data['s'],
+                    $template->fetch('/advanced_subscription/views/student_notice_superior.tpl'),
+                    $data['sessionId'],
                     true
                 );
                 break;
-            case ADV_SUB_ACTION_ADMIN_APPROVE:
+            case ADVANCED_SUBSCRIPTION_ACTION_ADMIN_APPROVE:
                 // Mail to student
                 $mailIds[] = $this->sendMailMessage(
-                    $data['u'],
+                    $data['studentUserId'],
                     $data['student']['user_id'],
                     $this->get_lang('MailAdminAccept'),
-                    $tpl->fetch('/advancedsubscription/views/advsub_approval_admin_accepted_notice_student.tpl'),
-                    $data['s']
+                    $template->fetch('/advanced_subscription/views/admin_accepted_notice_student.tpl'),
+                    $data['sessionId']
                 );
                 // Mail to superior
                 $mailIds[] = $this->sendMailMessage(
-                    $data['u'],
+                    $data['studentUserId'],
                     $data['superior']['user_id'],
                     $this->get_lang('MailAdminAccept'),
-                    $tpl->fetch('/advancedsubscription/views/advsub_approval_admin_accepted_notice_superior.tpl'),
-                    $data['s']
+                    $template->fetch('/advanced_subscription/views/admin_accepted_notice_superior.tpl'),
+                    $data['sessionId']
                 );
                 // Mail to admin
-                $adminId = $data['current_user_id'];
-                $tpl->assign('admin', $data['admins'][$adminId]);
+                $adminId = $data['currentUserId'];
+                $template->assign('admin', $data['admins'][$adminId]);
                 $mailIds['render'] = $this->sendMailMessage(
-                    $data['u'],
+                    $data['studentUserId'],
                     $adminId,
                     $this->get_lang('MailAdminAccept'),
-                    $tpl->fetch('/advancedsubscription/views/advsub_approval_admin_accepted_notice_admin.tpl'),
-                    $data['s'],
+                    $template->fetch('/advanced_subscription/views/admin_accepted_notice_admin.tpl'),
+                    $data['sessionId'],
                     true
                 );
                 break;
-            case ADV_SUB_ACTION_ADMIN_DISAPPROVE:
+            case ADVANCED_SUBSCRIPTION_ACTION_ADMIN_DISAPPROVE:
                 // Mail to student
                 $mailIds[] = $this->sendMailMessage(
-                    $data['u'],
+                    $data['studentUserId'],
                     $data['student']['user_id'],
                     $this->get_lang('MailAdminReject'),
-                    $tpl->fetch('/advancedsubscription/views/advsub_approval_admin_rejected_notice_student.tpl'),
-                    $data['s'],
+                    $template->fetch('/advanced_subscription/views/admin_rejected_notice_student.tpl'),
+                    $data['sessionId'],
                     true
                 );
                 // Mail to superior
                 $mailIds[] = $this->sendMailMessage(
-                    $data['u'],
+                    $data['studentUserId'],
                     $data['superior']['user_id'],
                     $this->get_lang('MailAdminReject'),
-                    $tpl->fetch('/advancedsubscription/views/advsub_approval_admin_rejected_notice_superior.tpl'),
-                    $data['s']
+                    $template->fetch('/advanced_subscription/views/admin_rejected_notice_superior.tpl'),
+                    $data['sessionId']
                 );
                 // Mail to admin
-                $adminId = $data['current_user_id'];
-                $tpl->assign('admin', $data['admins'][$adminId]);
+                $adminId = $data['currentUserId'];
+                $template->assign('admin', $data['admins'][$adminId]);
                 $mailIds['render'] = $this->sendMailMessage(
-                    $data['u'],
+                    $data['studentUserId'],
                     $adminId,
                     $this->get_lang('MailAdminReject'),
-                    $tpl->fetch('/advancedsubscription/views/advsub_approval_admin_rejected_notice_admin.tpl'),
-                    $data['s']
+                    $template->fetch('/advanced_subscription/views/admin_rejected_notice_admin.tpl'),
+                    $data['sessionId']
                 );
                 break;
-            case ADV_SUB_ACTION_STUDENT_REQUEST_NO_BOSS:
+            case ADVANCED_SUBSCRIPTION_ACTION_STUDENT_REQUEST_NO_BOSS:
                 // Mail to student
                 $mailIds['render'] = $this->sendMailMessage(
-                    $data['u'],
+                    $data['studentUserId'],
                     $data['student']['user_id'],
                     $this->get_lang('MailStudentRequestNoBoss'),
-                    $tpl->fetch('/advancedsubscription/views/advsub_request_received_no_boss.tpl'),
-                    $data['s']
+                    $template->fetch('/advanced_subscription/views/student_no_superior_notice_student.tpl'),
+                    $data['sessionId']
                 );
                 // Mail to admin
                 foreach ($data['admins'] as $adminId => $admin) {
-                    $tpl->assign('admin', $admin);
+                    $template->assign('admin', $admin);
                     $mailIds[] = $this->sendMailMessage(
-                        $data['u'],
+                        $data['studentUserId'],
                         $adminId,
                         $this->get_lang('MailStudentRequestNoBoss'),
-                        $tpl->fetch('/advancedsubscription/views/advsub_request_approved_info_admin.tpl'),
-                        $data['s'],
+                        $template->fetch('/advanced_subscription/views/student_no_superior_notice_admin.tpl'),
+                        $data['sessionId'],
                         true
                     );
                 }
@@ -565,16 +562,22 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
     {
         $count = 0;
         if (!empty($params) && is_array($params)) {
-            $advsubQueueTable = Database::get_main_table(TABLE_ADV_SUB_QUEUE);
+            $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(*)', $advsubQueueTable, $where);
+            $count = Database::select('COUNT(*)', $advancedSubscriptionQueueTable, $where);
             $count = $count[0]['COUNT(*)'];
         }
         return $count;
@@ -614,8 +617,10 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
      */
     public function getQueueStatus($userId, $sessionId)
     {
+        $userId = intval($userId);
+        $sessionId = intval($sessionId);
         if (!empty($userId) && !empty($sessionId)) {
-            $queueTable = Database::get_main_table(TABLE_ADV_SUB_QUEUE);
+            $queueTable = Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE);
             $row = Database::select(
                 'status',
                 $queueTable,
@@ -631,7 +636,7 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
                 return $row[0]['status'];
             } else {
 
-                return ADV_SUB_QUEUE_STATUS_NO_QUEUE;
+                return ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE;
             }
         }
 
@@ -650,8 +655,12 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
             $var = $extra->get_values_by_handler_and_field_variable($sessionId, 'vacancies');
             $vacancy = intval($var['field_value']);
             if (!empty($vacancy)) {
-                $vacancy -= $this->countQueueByParams(array('sessions' => $sessionId, 'status' => ADV_SUB_QUEUE_STATUS_ADMIN_APPROVED));
-
+                $vacancy -= $this->countQueueByParams(
+                    array(
+                        'sessions' => array($sessionId),
+                        'status' => array(ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED),
+                    )
+                );
                 if ($vacancy >= 0) {
 
                     return $vacancy;
@@ -670,26 +679,33 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
     public function getSessionDetails($sessionId)
     {
         if (!empty($sessionId)) {
-            $extra = new ExtraFieldValue('session');
-            $var = $extra->get_values_by_handler_and_field_variable($sessionId, 'id');
-            $data['id'] = $var['field_value'];
-            $var = $extra->get_values_by_handler_and_field_variable($sessionId, 'cost');
-            $data['cost'] = $var['field_value'];
-            $var = $extra->get_values_by_handler_and_field_variable($sessionId, 'place');
-            $data['place'] = $var['field_value'];
-            $var = $extra->get_values_by_handler_and_field_variable($sessionId, 'allow_visitors');
-            $data['allow_visitors'] = $var['field_value'];
-            $var = $extra->get_values_by_handler_and_field_variable($sessionId, 'horas_lectivas');
-            $data['duration'] = $var['field_value'];
-            // Get brochure URL
-            $var = $extra->get_values_by_handler_and_field_variable($sessionId, 'brochure');
-            $data['brochure'] = api_get_path(WEB_CODE_PATH) . $var['field_value'];
-            // Get banner URL
-            $var = $extra->get_values_by_handler_and_field_variable($sessionId, 'banner');
-            $data['banner'] = api_get_path(WEB_CODE_PATH) . $var['field_value'];
-            $data['description'] = SessionManager::getDescriptionFromSessionId($sessionId);
-
-            return $data;
+            // 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
+            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;
@@ -706,26 +722,26 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
         $message = '';
         switch ($status)
         {
-            case ADV_SUB_QUEUE_STATUS_NO_QUEUE:
+            case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE:
                 if ($isAble) {
                     $message = $this->get_lang('AdvancedSubscriptionNoQueueIsAble');
                 } else {
                     $message = $this->get_lang('AdvancedSubscriptionNoQueue');
                 }
                 break;
-            case ADV_SUB_QUEUE_STATUS_START:
+            case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_START:
                 $message = $this->get_lang('AdvancedSubscriptionQueueStart');
                 break;
-            case ADV_SUB_QUEUE_STATUS_BOSS_DISAPPROVED:
+            case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_DISAPPROVED:
                 $message = $this->get_lang('AdvancedSubscriptionQueueBossDisapproved');
                 break;
-            case ADV_SUB_QUEUE_STATUS_BOSS_APPROVED:
+            case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_APPROVED:
                 $message = $this->get_lang('AdvancedSubscriptionQueueBossApproved');
                 break;
-            case ADV_SUB_QUEUE_STATUS_ADMIN_DISAPPROVED:
+            case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_DISAPPROVED:
                 $message = $this->get_lang('AdvancedSubscriptionQueueAdminDisapproved');
                 break;
-            case ADV_SUB_QUEUE_STATUS_ADMIN_APPROVED:
+            case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED:
                 $message = $this->get_lang('AdvancedSubscriptionQueueAdminApproved');
                 break;
             default:
@@ -743,7 +759,7 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
      */
     public function getSessionUrl($sessionId)
     {
-        $url = api_get_path(WEB_CODE_PATH) . 'session/?session_id=' . $sessionId;
+        $url = api_get_path(WEB_CODE_PATH) . 'session/?session_id=' . intval($sessionId);
         return $url;
     }
 
@@ -754,15 +770,15 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
      */
     public function getQueueUrl($params)
     {
-        $url = api_get_path(WEB_PLUGIN_PATH) . 'advancedsubscription/ajax/advsub.ajax.php?' .
-            'a=' . $params['a'] . '&' .
-            's=' . $params['s'] . '&' .
-            'current_user_id=' . $params['current_user_id'] . '&' .
-            'e=' . $params['e'] . '&' .
-            'u=' . $params['u'] . '&' .
-            'q=' . $params['q'] . '&' .
-            'is_connected=' . $params['is_connected'] . '&' .
-            'profile_completed=' . $params['profile_completed'] . '&' .
+        $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;
     }
@@ -774,19 +790,34 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
      */
     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');
-        $session = api_get_session_info($sessionId);
-        $var = $extraSession->get_values_by_handler_and_field_variable($sessionId, 'target');
-        $session['target'] = $var['field_value'];
-        $var = $extraSession->get_values_by_handler_and_field_variable($sessionId, 'publication_end_date');
-        $session['publication_end_date'] = $var['field_value'];
-        $var = $extraSession->get_values_by_handler_and_field_variable($sessionId, 'mode');
-        $session['mode'] = $var['field_value'];
-        $var = $extraSession->get_values_by_handler_and_field_variable($sessionId, 'recommended_number_of_participants');
-        $session['recommended_number_of_participants'] = $var['field_value'];
-        $var = $extraSession->get_values_by_handler_and_field_variable($sessionId, 'vacancies');
-        $session['vacancies'] = $var['field_value'];
-        $queueTable = Database::get_main_table(TABLE_ADV_SUB_QUEUE);
+        $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;
+            }
+        }
+        $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(
@@ -794,8 +825,8 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
             array(
                 'q.session_id = ? AND q.status <> ? AND q.status <> ?' => array(
                     $sessionId,
-                    ADV_SUB_QUEUE_STATUS_ADMIN_APPROVED,
-                    ADV_SUB_QUEUE_STATUS_ADMIN_DISAPPROVED,
+                    ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED,
+                    ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_DISAPPROVED,
                 )
             )
         );
@@ -804,16 +835,16 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
         foreach ($students as &$student) {
             $status = intval($student['status']);
             switch($status) {
-                case ADV_SUB_QUEUE_STATUS_NO_QUEUE:
-                case ADV_SUB_QUEUE_STATUS_START:
+                case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE:
+                case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_START:
                     $student['validation'] = '';
                     break;
-                case ADV_SUB_QUEUE_STATUS_BOSS_DISAPPROVED:
-                case ADV_SUB_QUEUE_STATUS_ADMIN_DISAPPROVED:
+                case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_DISAPPROVED:
+                case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_DISAPPROVED:
                     $student['validation'] = get_lang('No');
                     break;
-                case ADV_SUB_QUEUE_STATUS_BOSS_APPROVED:
-                case ADV_SUB_QUEUE_STATUS_ADMIN_APPROVED:
+                case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_APPROVED:
+                case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED:
                     $student['validation'] = get_lang('Yes');
                     break;
                 default:
@@ -821,7 +852,7 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
             }
         }
         $return = array(
-            'session' => $session,
+            'session' => $sessionArray,
             'students' => $students,
         );
 
@@ -831,13 +862,23 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
 
     /**
      * List all session (id, name) for select input
+     * @param int $limit
      * @return array
      */
-    public function listAllSessions()
+    public function listAllSessions($limit = 100)
     {
+        $limit = intval($limit);
         $sessionTable = Database::get_main_table(TABLE_MAIN_SESSION);
         $columns = 'id, name';
-        return Database::select($columns, $sessionTable);
+        $conditions = array();
+        if ($limit > 0) {
+            $conditions = array(
+                'order' => 'name',
+                'limit' => $limit,
+            );
+        }
+
+        return Database::select($columns, $sessionTable, $conditions);
     }
 
     /**
@@ -849,12 +890,12 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
     {
         $key = sha1($this->get('secret_key'));
         // Prepare array to have specific type variables
-        $dataPrepared['a'] = strval($data['a']);
-        $dataPrepared['s'] = intval($data['s']);
-        $dataPrepared['current_user_id'] = intval($data['current_user_id']);
-        $dataPrepared['u'] = intval($data['u']);
-        $dataPrepared['q'] = intval($data['q']);
-        $dataPrepared['e'] = intval($data['e']);
+        $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);
     }
@@ -869,4 +910,14 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
     {
         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';
+    }
 }

+ 56 - 47
plugin/advancedsubscription/src/HookAdvancedSubscription.php → plugin/advanced_subscription/src/HookAdvancedSubscription.php

@@ -3,7 +3,7 @@
 /**
  * Hook Observer for Advanced subscription plugin
  * @author Daniel Alejandro Barreto Alva <daniel.barreto@beeznest.com>
- * @package chamilo.plugin.advancedsubscription
+ * @package chamilo.plugin.advanced_subscription
  */
 
 require_once __DIR__ . '/../config.php';
@@ -13,12 +13,14 @@ class HookAdvancedSubscription extends HookObserver implements
     HookWSRegistrationObserverInterface,
     HookNotificationContentObserverInterface
 {
+    public $plugin;
 
     protected function __construct()
     {
+        $this->plugin = AdvancedSubscriptionPlugin::create();
         parent::__construct(
-            'plugin/advancedsubscription/src/HookAdvancedSubscription.class.php',
-            'advancedsubscription'
+            'plugin/advanced_subscription/src/HookAdvancedSubscription.class.php',
+            'advanced_subscription'
         );
     }
 
@@ -35,7 +37,7 @@ class HookAdvancedSubscription extends HookObserver implements
 
             if (isset($data['blocks'])) {
                 $data['blocks']['sessions']['items'][] = array(
-                    'url' => '../../plugin/advancedsubscription/src/admin_view.php',
+                    'url' => '../../plugin/advanced_subscription/src/admin_view.php',
                     'label' => get_plugin_lang('plugin_title', 'AdvancedSubscriptionPlugin'),
                 );
             }
@@ -77,7 +79,7 @@ class HookAdvancedSubscription extends HookObserver implements
                     'mode' => array('name' => 'mode', 'type' => 'xsd:string'), // session.mode
                     'date_start' => array('name' => 'date_start', 'type' => 'xsd:string'), // session.date_start
                     'date_end' => array('name' => 'date_end', 'type' => 'xsd:string'), // session.date_end
-                    'duration' => array('name' => 'duration', 'type' => 'xsd:string'), // session.duration
+                    'duration' => array('name' => 'duration', 'type' => 'xsd:string'), // session.human_text_duration
                     'vacancies' => array('name' => 'vacancies', 'type' => 'xsd:string'), // session.vacancies
                     'schedule' => array('name' => 'schedule', 'type' => 'xsd:string'), // session.schedule
                 )
@@ -397,7 +399,7 @@ class HookAdvancedSubscription extends HookObserver implements
         }
 
         // Get the session brief List by category
-        $sessionList = SessionManager::getSessionBriefListByCategory($sessionCategoryId, $params['target']);
+        $sessionList = SessionManager::getBriefSessionListAndExtraByCategory($sessionCategoryId, $params['target']);
 
         return $sessionList;
     }
@@ -423,47 +425,46 @@ class HookAdvancedSubscription extends HookObserver implements
             $sessionId = (int) $params['session_id'];
             // Check if student is already subscribed
 
-            $advsubPlugin = AdvancedSubscriptionPlugin::create();
-            $isOpen = $advsubPlugin->isSessionOpen($sessionId);
-            $status = $advsubPlugin->getQueueStatus($userId, $sessionId);
-            $vacancy = $advsubPlugin->getVacancy($sessionId);
-            $data = $advsubPlugin->getSessionDetails($sessionId);
+            $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'] = $advsubPlugin->getSessionUrl($sessionId);
+                    $data['action_url'] = $this->plugin->getSessionUrl($sessionId);
                 } else {
                     try {
-                        $isAble = $advsubPlugin->isAbleToRequest($userId, $params);
-                        $data['message'] = $advsubPlugin->getStatusMessage($status, $isAble);
+                        $isAble = $this->plugin->isAllowedToDoRequest($userId, $params);
+                        $data['message'] = $this->plugin->getStatusMessage($status, $isAble);
                     } catch (\Exception $e) {
                         $data['message'] = $e->getMessage();
                     }
-                    $params['a'] = 'subscribe';
-                    $params['s'] = intval($sessionId);
-                    $params['current_user_id'] = 0; // No needed
-                    $params['u'] = intval($userId);
-                    $params['q'] = 0; // No needed
-                    $params['e'] = ADV_SUB_QUEUE_STATUS_START;
+                    $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 === ADV_SUB_QUEUE_STATUS_NO_QUEUE) {
+                        if ($status === ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE) {
                             // No in Queue, require queue subscription url action
-                            $data['action_url'] = $advsubPlugin->getQueueUrl($params);
-                        } elseif ($status === ADV_SUB_QUEUE_STATUS_ADMIN_APPROVED) {
+                            $data['action_url'] = $this->plugin->getQueueUrl($params);
+                        } elseif ($status === ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED) {
                             // send url action
-                            $data['action_url'] = $advsubPlugin->getSessionUrl($sessionId);
+                            $data['action_url'] = $this->plugin->getSessionUrl($sessionId);
                         } else {
                             // In queue, output status message, no more info.
                         }
                     } else {
-                        if ($status === ADV_SUB_QUEUE_STATUS_ADMIN_APPROVED) {
-                            $data['action_url'] = $advsubPlugin->getSessionUrl($sessionId);
+                        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'] = $advsubPlugin->getQueueUrl($params);
+                            $data['action_url'] = $this->plugin->getQueueUrl($params);
                         }
                     }
                 }
@@ -527,18 +528,26 @@ class HookAdvancedSubscription extends HookObserver implements
 
             return return_error(WS_ERROR_NOT_FOUND_RESULT);
         }
-        //@TODO: Not implemented yet, see BT#9092
-        // Check if advanced inscription plugin is enabled
-        $isAdvancedInscriptionEnabled = false;
-        if ($isAdvancedInscriptionEnabled) {
-            // Get validated and waiting queue users count for each session
-            foreach ($sessionList as &$session) {
-                // Add validated and queue users count
-                $session['validated_user_num'] = 0;
-                $session['waiting_user_num'] = 0;
-            }
-        } else {
-            // Set -1 to validated and waiting queue users count
+
+        // 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;
@@ -552,15 +561,15 @@ class HookAdvancedSubscription extends HookObserver implements
     {
         $data = $hook->getEventData();
         if ($data['type'] === HOOK_EVENT_TYPE_PRE) {
-            $data['advsub_pre_content'] = $data['content'];
+            $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['advsub_pre_content']) &&
-                !empty($data['advsub_pre_content'])
+                isset($data['advanced_subscription_pre_content']) &&
+                !empty($data['advanced_subscription_pre_content'])
             ) {
                 $data['content'] = str_replace(
                     array(
@@ -569,7 +578,7 @@ class HookAdvancedSubscription extends HookObserver implements
                         '<br/>',
                     ),
                     '',
-                    $data['advsub_pre_content']
+                    $data['advanced_subscription_pre_content']
                 );
             }
 
@@ -588,15 +597,15 @@ class HookAdvancedSubscription extends HookObserver implements
     {
         $data = $hook->getEventData();
         if ($data['type'] === HOOK_EVENT_TYPE_PRE) {
-            $data['advsub_pre_title'] = $data['title'];
+            $data['advanced_subscription_pre_title'] = $data['title'];
 
             return $data;
         } elseif ($data['type'] === HOOK_EVENT_TYPE_POST) {
             if (
-                isset($data['advsub_pre_title']) &&
-                !empty($data['advsub_pre_title'])
+                isset($data['advanced_subscription_pre_title']) &&
+                !empty($data['advanced_subscription_pre_title'])
             ) {
-                $data['title'] = $data['advsub_pre_title'];
+                $data['title'] = $data['advanced_subscription_pre_title'];
             }
 
             return $data;

+ 88 - 0
plugin/advanced_subscription/src/admin_view.php

@@ -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();

+ 123 - 0
plugin/advanced_subscription/test/mails.php

@@ -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>';

+ 1 - 1
plugin/advancedsubscription/uninstall.php → plugin/advanced_subscription/uninstall.php

@@ -4,7 +4,7 @@
  * 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.advancedsubscription
+ * @package chamilo.plugin.advanced_subscription
 */
 
 /**

+ 10 - 21
plugin/advancedsubscription/views/advsub_approval_admin_rejected_notice_admin.tpl → plugin/advanced_subscription/views/admin_accepted_notice_admin.tpl

@@ -2,33 +2,22 @@
 <html>
 <head>
     <meta charset="utf-8">
-    <title>Solicitud recibida para el curso {{ session.name }}</title>
-    <style type="text/css">
-        .titulo {
-            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;
-        }
-    </style>
+    <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 }}advancedsubscription/views/img/header.png" width="700" height="20" alt=""></td>
+        <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 }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
+        <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_plugin }}advancedsubscription/views/img/logo-minedu.png" width="230" height="60" alt="Ministerio de Educación"></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>
@@ -43,7 +32,7 @@
                 </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;">Información: rechazo de inscripción recibido </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>
@@ -58,10 +47,10 @@
                 </tr>
                 <tr>
                     <td height="356">&nbsp;</td>
-                    <td valign="top"><p>Estimado:</p>
+                    <td valign="top"><p>{{ "MailDear" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</p>
                         <h2>{{ admin.complete_name }}</h2>
-                        <p>Hemos recibido y registrado su rechazo de la inscripción de <strong>{{ student.complete_name_with_username }}</strong> al curso <strong>{{ session.name }}</strong></p>
-                        <p>Gracias.</p>
+                        <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>
@@ -73,10 +62,10 @@
             </table></td>
     </tr>
     <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
+        <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 }}advancedsubscription/views/img/footer.png" width="700" height="20" alt=""></td>
+        <td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
     </tr>
     <tr>
         <td>&nbsp;</td>

+ 10 - 21
plugin/advancedsubscription/views/advsub_request_superior_disapproved.tpl → plugin/advanced_subscription/views/admin_accepted_notice_student.tpl

@@ -2,33 +2,22 @@
 <html>
 <head>
     <meta charset="utf-8">
-    <title>Solicitud recibida para el curso {{ session.name }}</title>
-    <style type="text/css">
-        .titulo {
-            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;
-         }
-    </style>
+    <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 }}advancedsubscription/views/img/header.png" width="700" height="20" alt=""></td>
+        <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 }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
+        <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_plugin }}advancedsubscription/views/img/logo-minedu.png" width="230" height="60" alt="Ministerio de Educación"></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>
@@ -43,7 +32,7 @@
                 </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;">Información: Su inscripción al curso {{ session.name }} ha sido rechazada </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>
@@ -58,10 +47,10 @@
                 </tr>
                 <tr>
                     <td height="356">&nbsp;</td>
-                    <td valign="top"><p>Estimado:</p>
+                    <td valign="top"><p> {{ "MailDear" | get_plugin_lang('AdvancedSubscriptionPlugin') }} </p>
                         <h2>{{ student.complete_name }}</h2>
-                        <p>Lamentamos informarle que, en esta oportunidad, su inscripción al curso <strong>{{ session.name }}</strong> NO ha sido aprobada. Esperamos mantenga todo su ánimo y participe en otro curso o, en otra oportunidad, a este mismo curso.</p>
-                        <p>Gracias.</p>
+                        <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>
@@ -73,10 +62,10 @@
             </table></td>
     </tr>
     <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
+        <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 }}advancedsubscription/views/img/footer.png" width="700" height="20" alt=""></td>
+        <td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
     </tr>
     <tr>
         <td>&nbsp;</td>

+ 10 - 21
plugin/advancedsubscription/views/advsub_request_disapprove_confirmed.tpl → plugin/advanced_subscription/views/admin_accepted_notice_superior.tpl

@@ -2,33 +2,22 @@
 <html>
 <head>
     <meta charset="utf-8">
-    <title>Solicitud recibida para el curso {{ session.name }}</title>
-    <style type="text/css">
-        .titulo {
-            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;
-         }
-    </style>
+    <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 }}advancedsubscription/views/img/header.png" width="700" height="20" alt=""></td>
+        <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 }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
+        <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_plugin }}advancedsubscription/views/img/logo-minedu.png" width="230" height="60" alt="Ministerio de Educación"></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>
@@ -43,7 +32,7 @@
                 </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;">Confirmación: Desaprobación recibida para {{ student.complete_name }} </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>
@@ -58,10 +47,10 @@
                 </tr>
                 <tr>
                     <td height="356">&nbsp;</td>
-                    <td valign="top"><p>Estimado:</p>
+                    <td valign="top"><p>{{ "MailDear"| get_plugin_lang('AdvancedSubscriptionPlugin') }}</p>
                         <h2>{{ superior.complete_name }}</h2>
-                        <p>Hemos recibido y registrado su decisión de desaprobar el curso <strong>{{ session.name }}</strong> para su colaborador <strong>{{ student.complete_name }}</strong></p>
-                        <p>Gracias por su colaboración</p>
+                        <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>
@@ -73,10 +62,10 @@
             </table></td>
     </tr>
     <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
+        <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 }}advancedsubscription/views/img/footer.png" width="700" height="20" alt=""></td>
+        <td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
     </tr>
     <tr>
         <td>&nbsp;</td>

+ 10 - 21
plugin/advancedsubscription/views/advsub_approval_admin_accepted_notice_admin.tpl → plugin/advanced_subscription/views/admin_rejected_notice_admin.tpl

@@ -2,33 +2,22 @@
 <html>
 <head>
     <meta charset="utf-8">
-    <title>Solicitud recibida para el curso {{ session.name }}</title>
-    <style type="text/css">
-        .titulo {
-            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;
-        }
-    </style>
+    <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 }}advancedsubscription/views/img/header.png" width="700" height="20" alt=""></td>
+        <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 }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
+        <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_plugin }}advancedsubscription/views/img/logo-minedu.png" width="230" height="60" alt="Ministerio de Educación"></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>
@@ -43,7 +32,7 @@
                 </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;">Información: Validación de inscripción recibida </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>
@@ -58,10 +47,10 @@
                 </tr>
                 <tr>
                     <td height="356">&nbsp;</td>
-                    <td valign="top"><p>Estimado:</p>
+                    <td valign="top"><p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
                         <h2>{{ admin.complete_name }}</h2>
-                        <p>Hemos recibido y registrado su validación de la inscripción de <strong>{{ student.complete_name_with_username }}</strong> al curso <strong>{{ session.name }}</strong></p>
-                        <p>Gracias.</p>
+                        <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>
@@ -73,10 +62,10 @@
             </table></td>
     </tr>
     <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
+        <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 }}advancedsubscription/views/img/footer.png" width="700" height="20" alt=""></td>
+        <td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
     </tr>
     <tr>
         <td>&nbsp;</td>

+ 10 - 21
plugin/advancedsubscription/views/advsub_approval_admin_rejected_notice_student.tpl → plugin/advanced_subscription/views/admin_rejected_notice_student.tpl

@@ -2,33 +2,22 @@
 <html>
 <head>
     <meta charset="utf-8">
-    <title>Solicitud recibida para el curso {{ session.name }}</title>
-    <style type="text/css">
-        .titulo {
-            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;
-         }
-    </style>
+    <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 }}advancedsubscription/views/img/header.png" width="700" height="20" alt=""></td>
+        <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 }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
+        <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_plugin }}advancedsubscription/views/img/logo-minedu.png" width="230" height="60" alt="Ministerio de Educación"></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>
@@ -43,7 +32,7 @@
                 </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;">Rechazamos su inscripción al curso {{ session.name }} </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>
@@ -58,10 +47,10 @@
                 </tr>
                 <tr>
                     <td height="356">&nbsp;</td>
-                    <td valign="top"><p>Estimado:</p>
+                    <td valign="top"><p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
                         <h2>{{ student.complete_name }}</h2>
-                        <p>Lamentamos informarle que su inscripción al curso <strong>{{ session.name }}</strong> iniciando el <strong>{{ session.name }}</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.</p>
-                        <p>Gracias.</p>
+                        <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>
@@ -73,10 +62,10 @@
             </table></td>
     </tr>
     <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
+        <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 }}advancedsubscription/views/img/footer.png" width="700" height="20" alt=""></td>
+        <td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
     </tr>
     <tr>
         <td>&nbsp;</td>

+ 10 - 21
plugin/advancedsubscription/views/advsub_approval_admin_rejected_notice_superior.tpl → plugin/advanced_subscription/views/admin_rejected_notice_superior.tpl

@@ -2,33 +2,22 @@
 <html>
 <head>
     <meta charset="utf-8">
-    <title>Solicitud recibida para el curso {{ session.name }}</title>
-    <style type="text/css">
-        .titulo {
-            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;
-         }
-    </style>
+    <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 }}advancedsubscription/views/img/header.png" width="700" height="20" alt=""></td>
+        <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 }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
+        <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_plugin }}advancedsubscription/views/img/logo-minedu.png" width="230" height="60" alt="Ministerio de Educación"></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>
@@ -43,7 +32,7 @@
                 </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;">Información: Rechazo de inscripción de {{ student.complete_name }} al curso {{ session.name }} </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>
@@ -58,10 +47,10 @@
                 </tr>
                 <tr>
                     <td height="356">&nbsp;</td>
-                    <td valign="top"><p>Estimado:</p>
+                    <td valign="top"><p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
                         <h2>{{ superior.complete_name }}</h2>
-                        <p>La inscripción de <strong>{{ student.complete_name }}</strong> al curso <strong>{{ session.name }}</strong>, que había aprobado anteriormente, fue rechazada por falta de cupos. Les presentamos nuestras disculpas sinceras.</p>
-                        <p>Gracias.</p>
+                        <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>
@@ -73,10 +62,10 @@
             </table></td>
     </tr>
     <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
+        <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 }}advancedsubscription/views/img/footer.png" width="700" height="20" alt=""></td>
+        <td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
     </tr>
     <tr>
         <td>&nbsp;</td>

+ 13 - 78
plugin/advancedsubscription/views/admin_view.tpl → plugin/advanced_subscription/views/admin_view.tpl

@@ -1,69 +1,4 @@
-<style type="text/css">
-    .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 {
-
-    }
-</style>
-
-<form id="form_advsub_admin" class="form-search" method="post" action="/plugin/advancedsubscription/src/admin_view.php" name="form_advsub_admin">
+<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>
@@ -101,7 +36,7 @@
                 <table id="student_table" class="table table-striped">
                     <tbody>
                     <tr>
-                        <th style="width: 118px;"><img src="img/icon-avatar.png"/> </th>
+                        <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>
@@ -116,13 +51,13 @@
                         <td>{{ student.validation }}</td>
                         <td>
                             <a
-                                class="btn btn-success btn-advsub btn-accept"
+                                class="btn btn-success btn-advanced-subscription btn-accept"
                                 href="{{ student.acceptUrl }}"
                             >
                                 {{ 'Accept' | get_plugin_lang('AdvancedSubscriptionPlugin') }}
                             </a>
                             <a
-                                class="btn btn-danger btn-advsub btn-reject"
+                                class="btn btn-danger btn-advanced-subscription btn-reject"
                                 href="{{ student.rejectUrl }}"
                             >
                                 {{ 'Reject' | get_plugin_lang('AdvancedSubscriptionPlugin') }}
@@ -143,15 +78,15 @@
 
 <input name="f" value="social" type="hidden">
 </form>
-<div class="modal fade" id="modalMail" tabindex="-1" role="dialog" aria-labelledby="privacidadLabel" aria-hidden="true">
+<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="privacidadLabel">{{ "AdvancedSubscriptionAdminViewTitle" | get_plugin_lang('AdvancedSubscriptionPlugin')}}</h4>
+                <h4 class="modal-title" id="modalMailLabel">{{ "AdvancedSubscriptionAdminViewTitle" | get_plugin_lang('AdvancedSubscriptionPlugin')}}</h4>
             </div>
             <div class="modal-body">
-                <iframe id="iframeAdvsub" style="width: 100%; height: 100%;" frameBorder="0">
+                <iframe id="iframeAdvsub" frameBorder="0">
                 </iframe>
             </div>
             <div class="modal-footer">
@@ -160,12 +95,13 @@
         </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_advsub_admin").submit();
+            $("#form_advanced_subscription_admin").submit();
         });
-        $("a.btn-advsub").click(function(event){
+        $("a.btn-advanced-subscription").click(function(event){
             event.preventDefault();
             var confirmed = false;
             var studentName = $(this).closest("tr").find(".name").html();
@@ -181,16 +117,15 @@
             } else {
                 var msg = "{{ 'AreYouSureYouWantToRejectSubscriptionOfX' | get_plugin_lang('AdvancedSubscriptionPlugin') }}";
                 var confirmed = confirm(msg.replace(msgRe, studentName));
-                );
             }
             if (confirmed) {
                 var thisBlock = $(this).closest("tr");
-                var advsubUrl = $(this).attr("href")
-                $("#iframeAdvsub").attr("src", advsubUrl)
+                var advancedSubscriptionUrl = $(this).attr("href")
+                $("#iframeAdvsub").attr("src", advancedSubscriptionUrl)
                 $("#modalMail").modal("show");
                 $.ajax({
                     dataType: "json",
-                    url: advsubUrl
+                    url: advancedSubscriptionUrl
                 }).done(function(result){
                     if (result.error == true) {
                         thisBlock.slideUp();

+ 63 - 0
plugin/advanced_subscription/views/css/style.css

@@ -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%;
+}

+ 0 - 0
plugin/advancedsubscription/views/img/aprobar.png → plugin/advanced_subscription/views/img/aprobar.png


+ 0 - 0
plugin/advancedsubscription/src/img/avatar.png → plugin/advanced_subscription/views/img/avatar.png


+ 0 - 0
plugin/advancedsubscription/views/img/desaprobar.png → plugin/advanced_subscription/views/img/desaprobar.png


+ 0 - 0
plugin/advancedsubscription/views/img/footer.png → plugin/advanced_subscription/views/img/footer.png


+ 0 - 0
plugin/advancedsubscription/views/img/header.png → plugin/advanced_subscription/views/img/header.png


+ 0 - 0
plugin/advancedsubscription/src/img/icon-avatar.png → plugin/advanced_subscription/views/img/icon-avatar.png


+ 0 - 0
plugin/advancedsubscription/views/img/line.png → plugin/advanced_subscription/views/img/line.png


+ 10 - 21
plugin/advancedsubscription/views/advsub_request_approved_reminder.tpl → plugin/advanced_subscription/views/reminder_notice_admin.tpl

@@ -2,33 +2,22 @@
 <html>
 <head>
     <meta charset="utf-8">
-    <title>Solicitud recibida para el curso {{ session.name }}</title>
-    <style type="text/css">
-        .titulo {
-            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;
-         }
-    </style>
+    <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 }}advancedsubscription/views/img/header.png" width="700" height="20" alt=""></td>
+        <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 }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
+        <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_plugin }}advancedsubscription/views/img/logo-minedu.png" width="230" height="60" alt="Ministerio de Educación"></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>
@@ -43,7 +32,7 @@
                 </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;">Inscripciones a {{ session.name }} pendiente de confirmación</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>
@@ -58,10 +47,10 @@
                 </tr>
                 <tr>
                     <td height="356">&nbsp;</td>
-                    <td valign="top"><p>Estimado:</p>
+                    <td valign="top"><p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
                         <h2>{{ admin.complete_name }}</h2>
-                        <p>Las inscripciones siguientes al curso {{ session.name }} están pendientes de validación para ser efectivas. Por favor, dirigese al la <a href="{{ admin_view_url }}">página de administración</a> para validarlos.</p>
-                        <p>Gracias.</p>
+                        <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>
@@ -73,10 +62,10 @@
             </table></td>
     </tr>
     <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
+        <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 }}advancedsubscription/views/img/footer.png" width="700" height="20" alt=""></td>
+        <td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
     </tr>
     <tr>
         <td>&nbsp;</td>

+ 76 - 0
plugin/advanced_subscription/views/reminder_notice_student.tpl

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

+ 14 - 25
plugin/advancedsubscription/views/advsub_request_superior_reminder.tpl → plugin/advanced_subscription/views/reminder_notice_superior.tpl

@@ -2,33 +2,22 @@
 <html>
 <head>
     <meta charset="utf-8">
-    <title>Solicitud recibida para el curso {{ session.name }}</title>
-    <style type="text/css">
-        .titulo {
-            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;
-         }
-    </style>
+    <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 }}advancedsubscription/views/img/header.png" width="700" height="20" alt=""></td>
+        <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 }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
+        <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_plugin }}advancedsubscription/views/img/logo-minedu.png" width="230" height="60" alt="Ministerio de Educación"></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>
@@ -43,7 +32,7 @@
                 </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;">Solicitud de consideración de curso para un colaborador</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>
@@ -58,22 +47,22 @@
                 </tr>
                 <tr>
                     <td height="356">&nbsp;</td>
-                    <td valign="top"><p>Estimado:</p>
+                    <td valign="top"><p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
                         <h2>{{ superior.complete_name }}</h2>
-                        <p>Le recordamos que hemos recibido las siguientes solicitudes de suscripción<strong> </strong>al curso <strong>{{ session.name }}</strong> de parte de sus colaboradores. El curso se iniciará el <strong>{{ session.date_start }}</strong>. Detalles del curso: <strong>{{ session.description }}</strong>. </p>
-                        <p>Le invitamos a aprobar o desarprobar las suscripciones, dando clic en el botón correspondiente a continuación para cada colaborador.</p>
+                        <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 }}advancedsubscription/views/img/aprobar.png" width="90" height="25" alt=""></a></td>
-                                <td valign="middle"><a href="{{ student.rejectUrl }}"><img src="{{ _p.web_plugin }}advancedsubscription/views/img/desaprobar.png" width="90" height="25" alt=""></a></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>Gracias.</p>
-                        <p><strong>Equipo Forge</strong></p></td>
+                        <p>{{ "MailThankYou" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
+                        <p>{{ signature }}</p></td>
                     <td>&nbsp;</td>
                 </tr>
                 <tr>
@@ -84,10 +73,10 @@
             </table></td>
     </tr>
     <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
+        <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 }}advancedsubscription/views/img/footer.png" width="700" height="20" alt=""></td>
+        <td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
     </tr>
     <tr>
         <td>&nbsp;</td>

+ 87 - 0
plugin/advanced_subscription/views/reminder_notice_superior_max.tpl

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

+ 75 - 0
plugin/advanced_subscription/views/student_no_superior_notice_admin.tpl

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

+ 76 - 0
plugin/advanced_subscription/views/student_no_superior_notice_student.tpl

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

+ 75 - 0
plugin/advanced_subscription/views/student_notice_student.tpl

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

+ 14 - 25
plugin/advancedsubscription/views/advsub_request_superior.tpl → plugin/advanced_subscription/views/student_notice_superior.tpl

@@ -2,33 +2,22 @@
 <html>
 <head>
     <meta charset="utf-8">
-    <title>Solicitud recibida para el curso {{ session.name }}</title>
-    <style type="text/css">
-        .titulo {
-            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;
-         }
-    </style>
+    <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 }}advancedsubscription/views/img/header.png" width="700" height="20" alt=""></td>
+        <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 }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
+        <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_plugin }}advancedsubscription/views/img/logo-minedu.png" width="230" height="60" alt="Ministerio de Educación"></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>
@@ -43,7 +32,7 @@
                 </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;">Solicitud de consideración de curso para un colaborador</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>
@@ -58,20 +47,20 @@
                 </tr>
                 <tr>
                     <td height="356">&nbsp;</td>
-                    <td valign="top"><p>Estimado:</p>
+                    <td valign="top"><p>{{ "MailDear" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
                         <h2>{{ superior.complete_name }}</h2>
-                        <p>Hemos recibido una solicitud de inscripción de <strong>{{ student.complete_name }}</strong> al curso <strong>{{ session.name }}</strong>, por iniciarse el <strong>{{ session.date_start }}</strong>. Detalles del curso: <strong>{{ session.description }}</strong>. </p>
-                        <p>Le invitamos a aprobar o desarprobar esta inscripción, dando clic en el botón correspondiente a continuación.</p>
+                        <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 }}advancedsubscription/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 }}advancedsubscription/views/img/desaprobar.png" width="90" height="25" alt=""></a></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>Gracias.</p>
-                        <p><strong>Equipo Forge</strong></p></td>
+                        <p>{{ "MailThankYou" | get_plugin_lang("AdvancedSubscriptionPlugin") }}</p>
+                        <p>{{ signature }}</p></td>
                     <td>&nbsp;</td>
                 </tr>
                 <tr>
@@ -82,10 +71,10 @@
             </table></td>
     </tr>
     <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
+        <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 }}advancedsubscription/views/img/footer.png" width="700" height="20" alt=""></td>
+        <td><img src="{{ _p.web_plugin }}advanced_subscription/views/img/footer.png" width="700" height="20" alt=""></td>
     </tr>
     <tr>
         <td>&nbsp;</td>

+ 75 - 0
plugin/advanced_subscription/views/superior_accepted_notice_admin.tpl

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

+ 76 - 0
plugin/advanced_subscription/views/superior_accepted_notice_student.tpl

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

+ 76 - 0
plugin/advanced_subscription/views/superior_accepted_notice_superior.tpl

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

+ 75 - 0
plugin/advanced_subscription/views/superior_rejected_notice_student.tpl

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

+ 75 - 0
plugin/advanced_subscription/views/superior_rejected_notice_superior.tpl

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

+ 0 - 4
plugin/advancedsubscription/README.md

@@ -1,4 +0,0 @@
-Advanced subscription plugin for Chamilo LMS
-=======================================
-@TODO:Edit README.md
-

+ 0 - 29
plugin/advancedsubscription/config.php

@@ -1,29 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-/**
- * Config the plugin
- * @author Daniel Alejandro Barreto Alva <daniel.barreto@beeznest.com>
- * @package chamilo.plugin.advancedsubscription
- */
-
-define('TABLE_ADV_SUB_QUEUE', 'plugin_advsub_queue');
-
-define('ADV_SUB_ACTION_STUDENT_REQUEST', 0);
-define('ADV_SUB_ACTION_SUPERIOR_APPROVE', 1);
-define('ADV_SUB_ACTION_SUPERIOR_DISAPPROVE', 2);
-define('ADV_SUB_ACTION_SUPERIOR_SELECT', 3);
-define('ADV_SUB_ACTION_ADMIN_APPROVE', 4);
-define('ADV_SUB_ACTION_ADMIN_DISAPPROVE', 5);
-define('ADV_SUB_ACTION_STUDENT_REQUEST_NO_BOSS', 6);
-
-define('ADV_SUB_QUEUE_STATUS_NO_QUEUE', -1);
-define('ADV_SUB_QUEUE_STATUS_START', 0);
-define('ADV_SUB_QUEUE_STATUS_BOSS_DISAPPROVED', 1);
-define('ADV_SUB_QUEUE_STATUS_BOSS_APPROVED', 2);
-define('ADV_SUB_QUEUE_STATUS_ADMIN_DISAPPROVED', 3);
-define('ADV_SUB_QUEUE_STATUS_ADMIN_APPROVED', 10);
-
-require_once __DIR__ . '/../../main/inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH) . 'plugin.class.php';
-require_once api_get_path(PLUGIN_PATH) . 'advancedsubscription/src/AdvancedSubscriptionPlugin.php';
-require_once api_get_path(PLUGIN_PATH) . 'advancedsubscription/src/HookAdvancedSubscription.php';

+ 0 - 62
plugin/advancedsubscription/lang/english.php

@@ -1,62 +0,0 @@
-<?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'] = 'Webservice url';
-$strings['yearly_cost_unit_converter'] = 'Taxation unit (TU)';
-$strings['min_profile_percentage'] = 'Minimum required of completed percentage profile';
-$strings['yearly_cost_limit'] = 'Yearly limit TU for courses (measured in Taxation units)';
-$strings['yearly_hours_limit'] = 'Yearly limit hours for courses';
-$strings['courses_count_limit'] = 'Yearly limit times for courses';
-$strings['check_induction'] = 'Activate induction course requirement';
-$strings['course_session_credit_year_start_date'] = 'Year start date';
-
-/* 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 mount for courses";
-$strings['AdvancedSubscriptionTimeXLimitReached'] = "We are sorry, you have already reached yearly limit hours for courses";
-$strings['AdvancedSubscriptionCourseXLimitReached'] = "We are sorry, you have already reached yearly limit times for courses";
-$strings['AdvancedSubscriptionNotMoreAble'] = "We are sorry, you no longer fulfills the initial conditions to subscribe this course";
-
-$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 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?';
-

+ 0 - 67
plugin/advancedsubscription/lang/spanish.php

@@ -1,67 +0,0 @@
-<?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['tool_enable'] = 'Inscripción avanzada activada';
-$strings['tool_enable_help'] = "Escoja si desea activar la inscripción avanzada.";
-$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 <b>no</b> 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";
-
-//Needed in order to show the plugin title
-
-// 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';
-$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'] = 'Are you sure you want to reject the subscripti %s?';

+ 0 - 3
plugin/advancedsubscription/readme.txt

@@ -1,3 +0,0 @@
-Advanced subscription plugin<br/><br/>
-@TODO: Complete readme.txt
-This plugin enables Chamilo to extend its subscribe parameters.

+ 0 - 74
plugin/advancedsubscription/src/admin_view.php

@@ -1,74 +0,0 @@
-<?php
-/* For license terms, see /license.txt */
-/**
- * Index of the Advanced subscription plugin courses list
- * @package chamilo.plugin.advancedsubscription
- */
-/**
- * Init
- */
-require_once __DIR__ . '/../config.php';
-// protect
-api_protect_admin_script();
-// start plugin
-$plugin = AdvancedSubscriptionPlugin::create();
-// Session ID
-$s = isset($_REQUEST['s']) ? intval($_REQUEST['s']) : null;
-
-// Init template
-$tpl = new Template('TESTING');
-// Get all sessions
-$sessionList = $plugin->listAllSessions();
-
-if (!empty($s)) {
-    // Get student list in queue
-    $studentList = $plugin->listAllStudentsInQueueBySession($s);
-    // Set selected to current session
-    $sessionList[$s]['selected'] = 'selected="selected"';
-    $studentList['session']['id'] = $s;
-    // Assign variables
-
-    // send mail to superior
-    $sessionArray = api_get_session_info($s);
-    $extraSession = new ExtraFieldValue('session');
-    $var = $extraSession->get_values_by_handler_and_field_variable($s, 'description');
-    $sessionArray['description'] = $var['field_valiue'];
-    $var = $extraSession->get_values_by_handler_and_field_variable($s, 'target');
-    $sessionArray['target'] = $var['field_valiue'];
-    $var = $extraSession->get_values_by_handler_and_field_variable($s, 'mode');
-    $sessionArray['mode'] = $var['field_valiue'];
-    $var = $extraSession->get_values_by_handler_and_field_variable($s, 'publication_end_date');
-    $sessionArray['publication_end_date'] = $var['field_value'];
-    $var = $extraSession->get_values_by_handler_and_field_variable($s, 'recommended_number_of_participants');
-    $sessionArray['recommended_number_of_participants'] = $var['field_valiue'];
-    $adminsArray = UserManager::get_all_administrators();
-
-    $data['a'] = 'confirm';
-    $data['s'] = $s;
-    $data['current_user_id'] = api_get_user_id();
-
-    foreach ($studentList['students'] as &$student) {
-        $data['u'] = intval($student['user_id']);
-        $data['q'] = intval($student['queue_id']);
-        $data['e'] = ADV_SUB_QUEUE_STATUS_ADMIN_APPROVED;
-        $student['acceptUrl'] = $plugin->getQueueUrl($data);
-        $data['e'] = ADV_SUB_QUEUE_STATUS_ADMIN_DISAPPROVED;
-        $student['rejectUrl'] = $plugin->getQueueUrl($data);
-        $student['complete_name'] = $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', ADV_SUB_QUEUE_STATUS_ADMIN_APPROVED);
-$tpl->assign('disapproveAdmin', ADV_SUB_QUEUE_STATUS_ADMIN_DISAPPROVED);
-// Get rendered template
-$content = $tpl->fetch('/advancedsubscription/views/admin_view.tpl');
-// Assign into content
-$tpl->assign('content', $content);
-// Display
-$tpl->display_one_col_template();

+ 0 - 86
plugin/advancedsubscription/views/advsub_approval_admin_accepted_notice_student.tpl

@@ -1,86 +0,0 @@
-<!doctype html>
-<html>
-<head>
-    <meta charset="utf-8">
-    <title>Solicitud recibida para el curso {{ session.name }}</title>
-    <style type="text/css">
-        .titulo {
-            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;
-        }
-    </style>
-</head>
-
-<body>
-<table width="700" border="0" cellspacing="0" cellpadding="0">
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/header.png" width="700" height="20" alt=""></td>
-    </tr>
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/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_plugin }}advancedsubscription/views/img/logo-minedu.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;">Aprobada: su inscripción al curso {{ session.name }} fue confirmada! </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>Estimado:</p>
-                        <h2>{{ student.complete_name }}</h2>
-                        <p>Nos complace informarle que su inscripción al curso <strong>{{ session.name }}</strong> iniciando el <strong>{{ session.date_start }}</strong> fue validada por los administradores. Esperamos mantenga todo su ánimo y participe en otro curso o, en otra oportunidad, a este mismo curso.</p>
-                        <p>Gracias.</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 }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
-    </tr>
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/footer.png" width="700" height="20" alt=""></td>
-    </tr>
-    <tr>
-        <td>&nbsp;</td>
-    </tr>
-</table>
-</body>
-</html>

+ 0 - 86
plugin/advancedsubscription/views/advsub_approval_admin_accepted_notice_superior.tpl

@@ -1,86 +0,0 @@
-<!doctype html>
-<html>
-<head>
-    <meta charset="utf-8">
-    <title>Solicitud recibida para el curso {{ session.name }}</title>
-    <style type="text/css">
-        .titulo {
-            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;
-        }
-    </style>
-</head>
-
-<body>
-<table width="700" border="0" cellspacing="0" cellpadding="0">
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/header.png" width="700" height="20" alt=""></td>
-    </tr>
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/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_plugin }}advancedsubscription/views/img/logo-minedu.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;">Información: Validación de inscripción de {{ student.complete_name }} al curso {{ 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>Estimado:</p>
-                        <h2>{{ superior.complete_name }}</h2>
-                        <p>La inscripción de <strong>{{ student.complete_name }}</strong> al curso <strong>{{ session.name }}</strong> iniciando el <strong>{{ session.date_start }}</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.</p>
-                        <p>Gracias.</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 }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
-    </tr>
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/footer.png" width="700" height="20" alt=""></td>
-    </tr>
-    <tr>
-        <td>&nbsp;</td>
-    </tr>
-</table>
-</body>
-</html>

+ 0 - 87
plugin/advancedsubscription/views/advsub_request_approve_confirmed.tpl

@@ -1,87 +0,0 @@
-<!doctype html>
-<html>
-<head>
-    <meta charset="utf-8">
-    <title>Solicitud recibida para el curso {{ session.name }}</title>
-    <style type="text/css">
-        .titulo {
-            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;
-         }
-    </style>
-</head>
-
-<body>
-<table width="700" border="0" cellspacing="0" cellpadding="0">
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/header.png" width="700" height="20" alt=""></td>
-    </tr>
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/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_plugin }}advancedsubscription/views/img/logo-minedu.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;">Confirmación: Aprobación recibida para {{ 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>Estimado:</p>
-                        <h2>{{ superior.complete_name }}</h2>
-                        <p>Hemos recibido y registrado su decisión de aprobar el curso <strong>{{ session.name }}</strong> para su colaborador <strong>{{ student.complete_name }}</strong></p>
-                        <p>Ahora la inscripción al curso está pendiente de la disponibilidad de cupos. Le mantendremos informado sobre el resultado de esta etapa</p>
-                        <p>Gracias por su colaboración.</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 }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
-    </tr>
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/footer.png" width="700" height="20" alt=""></td>
-    </tr>
-    <tr>
-        <td>&nbsp;</td>
-    </tr>
-</table>
-</body>
-</html>

+ 0 - 95
plugin/advancedsubscription/views/advsub_request_approved_info_admin.tpl

@@ -1,95 +0,0 @@
-<!doctype html>
-<html>
-<head>
-    <meta charset="utf-8">
-    <title>Solicitud recibida para el curso {{ session.name }}</title>
-    <style type="text/css">
-        .titulo {
-            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;
-         }
-    </style>
-</head>
-
-<body>
-<table width="700" border="0" cellspacing="0" cellpadding="0">
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/header.png" width="700" height="20" alt=""></td>
-    </tr>
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/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_plugin }}advancedsubscription/views/img/logo-minedu.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;">Aprobación de {{ student.complete_name }} al curso {{ 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>Estimado:</p>
-                        <h2>{{ admin.complete_name }}</h2>
-                        <p>La inscripción del alumno
-                            <strong>{{ student.complete_name_with_username }}</strong>
-                            al curso <strong>{{ session.name }}</strong>
-                            ha sido aprobada por su superior.
-                            Puede gestionar las inscripciones al curso
-                            <a href="{{ admin_view_url }}">
-                                <strong>aquí</strong>
-                            </a>
-                            <strong></strong>
-                        </p>
-                        <p>Gracias.</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 }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
-    </tr>
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/footer.png" width="700" height="20" alt=""></td>
-    </tr>
-    <tr>
-        <td>&nbsp;</td>
-    </tr>
-</table>
-</body>
-</html>

+ 0 - 87
plugin/advancedsubscription/views/advsub_request_received.tpl

@@ -1,87 +0,0 @@
-<!doctype html>
-<html>
-<head>
-    <meta charset="utf-8">
-    <title>Solicitud recibida para el curso {{ session.name }}</title>
-    <style type="text/css">
-        .titulo {
-            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;
-         }
-    </style>
-</head>
-
-<body>
-<table width="700" border="0" cellspacing="0" cellpadding="0">
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/header.png" width="700" height="20" alt=""></td>
-    </tr>
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/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_plugin }}advancedsubscription/views/img/logo-minedu.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;">Solicitud recibida para el curso {{ 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>Estimado:</p>
-                        <h2>{{ student.complete_name }}</h2>
-                        <p>Hemos recibido y registrado su solicitud de inscripción al curso <strong>{{ session.name }}</strong> para iniciarse el <strong>{{ session.date_start }}</strong>.</p>
-                        <p>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.</p>
-                        <p>Gracias.</p>
-                        <p><strong>Equipo Forge</strong></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 }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
-    </tr>
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/footer.png" width="700" height="20" alt=""></td>
-    </tr>
-    <tr>
-        <td>&nbsp;</td>
-    </tr>
-</table>
-</body>
-</html>

+ 0 - 87
plugin/advancedsubscription/views/advsub_request_received_no_boss.tpl

@@ -1,87 +0,0 @@
-<!doctype html>
-<html>
-<head>
-    <meta charset="utf-8">
-    <title>Solicitud recibida para el curso {{ session.name }}</title>
-    <style type="text/css">
-        .titulo {
-            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;
-         }
-    </style>
-</head>
-
-<body>
-<table width="700" border="0" cellspacing="0" cellpadding="0">
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/header.png" width="700" height="20" alt=""></td>
-    </tr>
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/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_plugin }}advancedsubscription/views/img/logo-minedu.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;">Solicitud recibida para el curso {{ 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>Estimado:</p>
-                        <h2>{{ student.complete_name }}</h2>
-                        <p>Hemos recibido y registrado su solicitud de inscripción al curso <strong>{{ session.name }}</strong> para iniciarse el <strong>{{ session.date_start }}</strong>.</p>
-                        <p>Su inscripción es pendiente de la disponibilidad de cupos. Pronto recibirá los resultados de su aprobación de su solicitud.</p>
-                        <p>Gracias.</p>
-                        <p><strong>Equipo Forge</strong></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 }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
-    </tr>
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/footer.png" width="700" height="20" alt=""></td>
-    </tr>
-    <tr>
-        <td>&nbsp;</td>
-    </tr>
-</table>
-</body>
-</html>

+ 0 - 87
plugin/advancedsubscription/views/advsub_request_received_reminder.tpl

@@ -1,87 +0,0 @@
-<!doctype html>
-<html>
-<head>
-    <meta charset="utf-8">
-    <title>Solicitud recibida para el curso {{ session.name }}</title>
-    <style type="text/css">
-        .titulo {
-            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;
-         }
-    </style>
-</head>
-
-<body>
-<table width="700" border="0" cellspacing="0" cellpadding="0">
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/header.png" width="700" height="20" alt=""></td>
-    </tr>
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/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_plugin }}advancedsubscription/views/img/logo-minedu.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;">Información: Solicitud pendiente de aprobación para el curso {{ 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>Estimado:</p>
-                        <h2>{{ student.complete_name }}</h2>
-                        <p>Este correo es para confirmar que hemos recibido y registrado su solicitud de inscripción al  curso <strong>{{ session.name }}</strong>, por iniciarse el <strong>{{ session.date_start }}</strong>. </p>
-                        <p>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.</p>
-                        <p>Gracias por su paciencia.</p>
-                        <p><strong>Equipo Forge</strong></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 }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
-    </tr>
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/footer.png" width="700" height="20" alt=""></td>
-    </tr>
-    <tr>
-        <td>&nbsp;</td>
-    </tr>
-</table>
-</body>
-</html>

+ 0 - 86
plugin/advancedsubscription/views/advsub_request_superior_approved.tpl

@@ -1,86 +0,0 @@
-<!doctype html>
-<html>
-<head>
-    <meta charset="utf-8">
-    <title>Solicitud recibida para el curso {{ session.name }}</title>
-    <style type="text/css">
-        .titulo {
-            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;
-         }
-    </style>
-</head>
-
-<body>
-<table width="700" border="0" cellspacing="0" cellpadding="0">
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/header.png" width="700" height="20" alt=""></td>
-    </tr>
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/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_plugin }}advancedsubscription/views/img/logo-minedu.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;">Aprobado: Su inscripción al curso {{ session.name }} ha sido aprobada por su superior </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>Estimado:</p>
-                        <h2>{{ student.complete_name }}</h2>
-                        <p>Nos complace informarle que su inscripción al curso <strong>{{ session.name }}</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.</p>
-                        <p>Gracias.</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 }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
-    </tr>
-    <tr>
-        <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/footer.png" width="700" height="20" alt=""></td>
-    </tr>
-    <tr>
-        <td>&nbsp;</td>
-    </tr>
-</table>
-</body>
-</html>

+ 0 - 97
plugin/advancedsubscription/views/advsub_request_superior_reminder_max.tpl

@@ -1,97 +0,0 @@
-<!doctype html>
-<html>
-<head>
-<meta charset="utf-8">
-<title>Solicitud recibida para el curso {{ session.name }}</title>
-<style type="text/css">
-.titulo {
-	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;
- }
-</style>
-</head>
-
-<body>
-<table width="700" border="0" cellspacing="0" cellpadding="0">
-  <tr>
-    <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/header.png" width="700" height="20" alt=""></td>
-  </tr>
-  <tr>
-    <td><img src="{{ _p.web_plugin }}advancedsubscription/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_plugin }}advancedsubscription/views/img/logo-minedu.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;">Recordatorio: Solicitud de consideración de curso para colaborador(es)</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>Estimado:</p>
-          <h2>{{ superior.complete_name }}</h2>
-          <p>Le recordamos que hemos recibido las siguientes solicitudes de suscripción<strong> </strong>al curso <strong>{{ session.name }}</strong> de parte de sus colaboradores. El curso se iniciará el <strong>{{ session.date_start }}</strong>. Detalles del curso: <strong>{{ session.description }}</strong>. </p>
-          <p>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>{{ session.recommended_number_of_participants }}</strong> candidatos. Le invitamos a aprobar o desaprobar las suscripciones, dando clic en el botón correspondiente a continuación para cada colaborador.</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 }}advancedsubscription/views/img/aprobar.png" width="90" height="25" alt=""></a></td>
-              <td valign="middle"><a href="{{ student.rejectUrl }}"><img src="{{ _p.web_plugin }}advancedsubscription/views/img/desaprobar.png" width="90" height="25" alt=""></a></td>
-            </tr>
-            {% endfor %}
-            </table>
-          <p>Gracias.</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 }}advancedsubscription/views/img/line.png" width="700" height="25" alt=""></td>
-  </tr>
-  <tr>
-    <td><img src="{{ _p.web_plugin }}advancedsubscription/views/img/footer.png" width="700" height="20" alt=""></td>
-  </tr>
-  <tr>
-    <td>&nbsp;</td>
-  </tr>
-</table>
-</body>
-</html>

二進制
plugin/advancedsubscription/views/img/avatar.png


二進制
plugin/advancedsubscription/views/img/logo-minedu.png


+ 3 - 3
tests/scripts/insert_session_fields.php

@@ -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
 ));