Example #1
0
 /**
  * Subscribe users to a group
  * @param int     $usergroup_id usergroup id
  * @param array   $list list of user ids     *
  * @param bool $delete_users_not_present_in_list
  * @param array $relationType
  */
 public function subscribe_users_to_usergroup($usergroup_id, $list, $delete_users_not_present_in_list = true, $relationType = '')
 {
     $current_list = self::get_users_by_usergroup($usergroup_id);
     $course_list = self::get_courses_by_usergroup($usergroup_id);
     $session_list = self::get_sessions_by_usergroup($usergroup_id);
     $delete_items = array();
     $new_items = array();
     if (!empty($list)) {
         foreach ($list as $user_id) {
             if (!in_array($user_id, $current_list)) {
                 $new_items[] = $user_id;
             }
         }
     }
     if (!empty($current_list)) {
         foreach ($current_list as $user_id) {
             if (!in_array($user_id, $list)) {
                 $delete_items[] = $user_id;
             }
         }
     }
     // Deleting items
     if (!empty($delete_items) && $delete_users_not_present_in_list) {
         foreach ($delete_items as $user_id) {
             // Removing courses
             if (!empty($course_list)) {
                 foreach ($course_list as $course_id) {
                     $course_info = api_get_course_info_by_id($course_id);
                     CourseManager::unsubscribe_user($user_id, $course_info['code']);
                 }
             }
             // Removing sessions
             if (!empty($session_list)) {
                 foreach ($session_list as $session_id) {
                     SessionManager::unsubscribe_user_from_session($session_id, $user_id);
                 }
             }
             Database::delete($this->usergroup_rel_user_table, array('usergroup_id = ? AND user_id = ? AND relation_type = ?' => array($usergroup_id, $user_id, $relationType)));
         }
     }
     // Adding new relationships
     if (!empty($new_items)) {
         // Adding sessions
         if (!empty($session_list)) {
             foreach ($session_list as $session_id) {
                 SessionManager::suscribe_users_to_session($session_id, $new_items, null, false);
             }
         }
         foreach ($new_items as $user_id) {
             // Adding courses
             if (!empty($course_list)) {
                 foreach ($course_list as $course_id) {
                     $course_info = api_get_course_info_by_id($course_id);
                     CourseManager::subscribe_user($user_id, $course_info['code']);
                 }
             }
             $params = array('user_id' => $user_id, 'usergroup_id' => $usergroup_id, 'relation_type' => $relationType);
             Database::insert($this->usergroup_rel_user_table, $params);
         }
     }
 }
function WSSubscribeUserToSessionSimple($params)
{
    global $debug;
    if ($debug) {
        error_log('WSSubscribeUserToSessionSimple with params=[' . serialize($params) . ']');
    }
    // Check security key
    if (!WSHelperVerifyKey($params)) {
        return return_error(WS_ERROR_SECRET_KEY);
    }
    // Get input parameters
    $session_id = intval($params['session']);
    // Session ID
    $user_id = intval($params['user_id']);
    // Chamilo user id
    // Get user id
    $user_data = api_get_user_info($user_id);
    // Prepare answer
    $result = 0;
    if (empty($user_data)) {
        $result = "User {$user_id} does not exist";
        if ($debug) {
            error_log($result);
        }
        return $result;
    }
    if (!empty($session_id) && is_numeric($session_id)) {
        $session_data = api_get_session_info($session_id);
        if (empty($session_data)) {
            $result = "Session {$session_id} does not exist.";
            if ($debug) {
                error_log($result);
            }
        } else {
            SessionManager::suscribe_users_to_session($session_id, array($user_id), SESSION_VISIBLE_READ_ONLY, false);
            if ($debug) {
                error_log('User registered to the course: ' . $session_id);
            }
            $result = 1;
        }
    }
    return $result;
}
Example #3
0
 $result_message = array();
 $result_message_compare = array();
 $update_database = true;
 if (isset($_REQUEST['view_stat']) && $_REQUEST['view_stat'] == 1) {
     $update_database = false;
 }
 //Check if the same course exist in the session destination
 if ($course_founded) {
     //Check if the user is registered in the session otherwise we will add it
     $result = SessionManager::get_users_by_session($new_session_id);
     if (empty($result) || !in_array($user_id, array_keys($result))) {
         if ($debug) {
             echo 'User added to the session';
         }
         //Registering user to the new session
         SessionManager::suscribe_users_to_session($new_session_id, array($user_id), false);
     }
     //Begin with the import process
     $course_info = api_get_course_info($origin_course_code);
     $course_id = $course_info['real_id'];
     $TABLETRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
     $TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
     $TBL_TRACK_E_COURSE_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
     $TBL_TRACK_E_LAST_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
     $TBL_LP_VIEW = Database::get_course_table(TABLE_LP_VIEW);
     $TBL_NOTEBOOK = Database::get_course_table(TABLE_NOTEBOOK);
     $TBL_STUDENT_PUBLICATION = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
     $TBL_STUDENT_PUBLICATION_ASSIGNMENT = Database::get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT);
     $TBL_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
     $TBL_DROPBOX_FILE = Database::get_course_table(TABLE_DROPBOX_FILE);
     $TBL_DROPBOX_POST = Database::get_course_table(TABLE_DROPBOX_POST);
$form_sent = 0;
$errorMsg = $firstLetterUser = $firstLetterSession = '';
$UserList = $SessionList = array();
$sessions = array();
$noPHP_SELF = true;
if (isset($_POST['form_sent']) && $_POST['form_sent']) {
    $form_sent = $_POST['form_sent'];
    $firstLetterUser = $_POST['firstLetterUser'];
    $firstLetterSession = $_POST['firstLetterSession'];
    $UserList = $_POST['sessionUsersList'];
    if (!is_array($UserList)) {
        $UserList = array();
    }
    if ($form_sent == 1) {
        // Added a parameter to send emails when registering a user
        SessionManager::suscribe_users_to_session($id_session, $UserList, null, true);
        header('Location: resume_session.php?id_session=' . $id_session);
        exit;
    }
}
$session_info = SessionManager::fetch($id_session);
Display::display_header($tool_name);
$nosessionUsersList = $sessionUsersList = array();
$ajax_search = $add_type == 'unique' ? true : false;
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
if ($ajax_search) {
    $sql = "SELECT user_id, lastname, firstname, username, id_session, official_code\n            FROM {$tbl_user} u\n            INNER JOIN {$tbl_session_rel_user}\n                ON {$tbl_session_rel_user}.id_user = u.user_id AND {$tbl_session_rel_user}.relation_type<>" . SESSION_RELATION_TYPE_RRHH . "\n                AND {$tbl_session_rel_user}.id_session = " . intval($id_session) . "\n            WHERE u.status<>" . DRH . " AND u.status<>6 {$order_clause}";
    if (api_is_multiple_url_enabled()) {
        $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
        $access_url_id = api_get_current_access_url_id();
        if ($access_url_id != -1) {
if ($_POST['formSent']) {
    if (isset($_FILES['import_file']['tmp_name']) && !empty($_FILES['import_file']['tmp_name'])) {
        $form_sent = $_POST['formSent'];
        $send_mail = $_POST['sendMail'] ? 1 : 0;
        // CSV
        $users = Import::csv_to_array($_FILES['import_file']['tmp_name']);
        $user_list = array();
        foreach ($users as $user_data) {
            $username = $user_data['username'];
            $user_id = UserManager::get_user_id_from_username($username);
            if ($user_id) {
                $user_list[] = $user_id;
            }
        }
        if (!empty($user_list)) {
            SessionManager::suscribe_users_to_session($session_id, $user_list, null, false, $send_mail);
            foreach ($user_list as &$user_id) {
                $user_info = api_get_user_info($user_id);
                $user_id = $user_info['complete_name'];
            }
            $error_message = get_lang('UsersAdded') . ' : ' . implode(', ', $user_list);
        }
    } else {
        $error_message = get_lang('NoInputFile');
    }
}
// Display the header.
Display::display_header($tool_name);
if (count($inserted_in_course) > 1) {
    $msg = get_lang('SeveralCoursesSubscribedToSessionBecauseOfSameVisualCode') . ': ';
    foreach ($inserted_in_course as $code => $title) {
Example #6
0
/**
 *	Specific to PARIS 5
 *	Subscibes the user to the session. To do that it check the ldap field 
 *	against the correspondance table 
 *	Params string the login of the user
 **/
function ldap_subscribe_user_to_session($login, $info)
{
    global $ldap_session_field;
    $cursus = $info['courses'];
    $id_session = get_session_by_ldap_cursus($cursus);
    $temp = UserManager::get_user_info($login);
    $uid = $temp['user_id'];
    for ($i = 0; $i < count($id_session); $i++) {
        SessionManager::suscribe_users_to_session($id_session[$i], array($uid), false);
    }
}
Example #7
0
     exit;
 }
 $registrationAllowed = api_get_setting('session.catalog_allow_session_auto_subscription');
 if ($registrationAllowed === 'true') {
     $entityManager = Database::getManager();
     $repository = $entityManager->getRepository('ChamiloCoreBundle:SequenceResource');
     $sequences = $repository->getRequirements($sessionId, SequenceResource::SESSION_TYPE);
     if (count($sequences) > 0) {
         $requirementsData = SequenceResourceManager::checkRequirementsForUser($sequences, SequenceResource::SESSION_TYPE, $userId);
         $continueWithSubscription = SequenceResourceManager::checkSequenceAreCompleted($requirementsData);
         if (!$continueWithSubscription) {
             header('Location: ' . api_get_path(WEB_CODE_PATH) . 'auth/courses.php');
             exit;
         }
     }
     SessionManager::suscribe_users_to_session($_GET['session_id'], array($userId), SESSION_VISIBLE_READ_ONLY, false);
     $coursesList = SessionManager::get_course_list_by_session_id($_GET['session_id']);
     $count = count($coursesList);
     $url = '';
     if ($count <= 0) {
         // no course in session -> return to catalog
         $url = api_get_path(WEB_CODE_PATH) . 'auth/courses.php';
     } elseif ($count == 1) {
         // only one course, so redirect directly to this course
         foreach ($coursesList as $course) {
             $url = api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/index.php?id_session=' . intval($_GET['session_id']);
         }
     } else {
         $url = api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . intval($_GET['session_id']);
     }
     header('Location: ' . $url);
 /**
  * @param array $sessions
  * @param array $sessionsDestination
  * @return string
  */
 public static function copyStudentsFromSession($sessions, $sessionsDestination)
 {
     $messages = array();
     if (!empty($sessions)) {
         foreach ($sessions as $sessionId) {
             $sessionInfo = self::fetch($sessionId);
             $userList = self::get_users_by_session($sessionId, 0);
             if (!empty($userList)) {
                 $newUserList = array();
                 $userToString = null;
                 foreach ($userList as $userInfo) {
                     $newUserList[] = $userInfo['user_id'];
                     $userToString .= $userInfo['firstname'] . ' ' . $userInfo['lastname'] . '<br />';
                 }
                 if (!empty($sessionsDestination)) {
                     foreach ($sessionsDestination as $sessionDestinationId) {
                         $sessionDestinationInfo = self::fetch($sessionDestinationId);
                         $messages[] = Display::return_message(sprintf(get_lang('AddingStudentsFromSessionXToSessionY'), $sessionInfo['name'], $sessionDestinationInfo['name']), 'info', false);
                         if ($sessionId == $sessionDestinationId) {
                             $messages[] = Display::return_message(sprintf(get_lang('SessionXSkipped'), $sessionDestinationId), 'warning', false);
                             continue;
                         }
                         $messages[] = Display::return_message(get_lang('StudentList') . '<br />' . $userToString, 'info', false);
                         SessionManager::suscribe_users_to_session($sessionDestinationId, $newUserList, SESSION_VISIBLE_READ_ONLY, false);
                     }
                 } else {
                     $messages[] = Display::return_message(get_lang('NoDestinationSessionProvided'), 'warning');
                 }
             } else {
                 $messages[] = Display::return_message(get_lang('NoStudentsFoundForSession') . ' #' . $sessionInfo['name'], 'warning');
             }
         }
     } else {
         $messages[] = Display::return_message(get_lang('NoData'), 'warning');
     }
     return $messages;
 }
 static function transaction_4($data)
 {
     $uidIdPersona = $data['item_id'];
     $uidIdPrograma = $data['orig_id'];
     $uidIdProgramaDestination = $data['dest_id'];
     $status = !empty($data['info']) ? $data['info'] : null;
     global $data_list;
     $user_id = self::get_user_id_by_persona_id($uidIdPersona, $data_list);
     if (empty($user_id)) {
         return array('message' => "User does not exists in DB: {$uidIdPersona}", 'status_id' => self::TRANSACTION_STATUS_FAILED);
     }
     //Move A to B
     if (!empty($uidIdPrograma) && !empty($uidIdProgramaDestination)) {
         $session_id = self::get_session_id_by_programa_id($uidIdPrograma, $data_list);
         $destination_session_id = self::get_session_id_by_programa_id($uidIdProgramaDestination, $data_list);
         if (!empty($session_id) && !empty($destination_session_id)) {
             $before1 = SessionManager::get_user_status_in_session($session_id, $user_id);
             $before2 = SessionManager::get_user_status_in_session($destination_session_id, $user_id);
             /*
               These constants are defined in sessionmanager but are not
               usable directly from here
               SESSION_CHANGE_USER_REASON_SCHEDULE = 1;
               SESSION_CHANGE_USER_REASON_CLASSROOM = 2;
               SESSION_CHANGE_USER_REASON_LOCATION = 3;
               SESSION_CHANGE_USER_REASON_ENROLLMENT_ANNULATION = 4;
             */
             $reason_id = 1;
             SessionManager::change_user_session($user_id, $session_id, $destination_session_id, $reason_id);
             $befores = array($before1, $before2);
             $message = "Move Session A to Session B";
             return self::check_if_user_is_subscribe_to_session($user_id, $destination_session_id, $message, $befores);
         } else {
             return array('message' => "Session ids were not correctly setup session_id 1: {$session_id} Session id 2 {$uidIdProgramaDestination} - Move Session A to Session B", 'status_id' => self::TRANSACTION_STATUS_FAILED);
         }
     }
     //Move A to empty
     if (!empty($uidIdPrograma) && empty($uidIdProgramaDestination)) {
         $session_id = self::get_session_id_by_programa_id($uidIdPrograma, $data_list);
         if (!empty($session_id)) {
             $before = SessionManager::get_user_status_in_session($session_id, $user_id);
             //SessionManager::suscribe_users_to_session($session_id, array($user_id), SESSION_VISIBLE_READ_ONLY, false, false);
             SessionManager::unsubscribe_user_from_session($session_id, $user_id);
             $message = "Move Session to empty";
             return self::check_if_user_is_subscribe_to_session($user_id, $session_id, $message, $before);
         } else {
             return array('message' => "Session does not exists in DB {$uidIdPrograma}  - Move Session to empty", 'status_id' => self::TRANSACTION_STATUS_FAILED);
         }
     }
     //Move empty to A
     if (empty($uidIdPrograma) && !empty($uidIdProgramaDestination)) {
         $session_id = self::get_session_id_by_programa_id($uidIdProgramaDestination, $data_list);
         if (!empty($session_id)) {
             $before = SessionManager::get_user_status_in_session($session_id, $user_id);
             if (isset($status) && $status == 1) {
                 $course_list = SessionManager::get_course_list_by_session_id($session_id);
                 if (!empty($course_list)) {
                     $course_data = current($course_list);
                     SessionManager::set_coach_to_course_session($user_id, $session_id, $course_data['code']);
                 } else {
                     return array('message' => 'Could not subscribe to course: no course in session ' . $uidIdProgramaDestination, 'status_id' => self::TRANSACTION_STATUS_FAILED);
                 }
             } else {
                 SessionManager::suscribe_users_to_session($session_id, array($user_id), SESSION_VISIBLE_READ_ONLY, false, false);
             }
             $message = 'Move empty to Session';
             return self::check_if_user_is_subscribe_to_session($user_id, $session_id, $message, $before);
         } else {
             return array('message' => "Session does not exists in DB {$uidIdProgramaDestination} - Move empty to Session", 'status_id' => self::TRANSACTION_STATUS_FAILED);
         }
     }
 }
 /**
  * Change user subscription (helper method)
  *
  * @param string User id field name
  * @param string User id value
  * @param string Session id field name
  * @param string Session id value
  * @param int State (1 to subscribe, 0 to unsubscribe)
  * @return mixed True on success, WSError otherwise
  */
 protected function changeUserSubscription($user_id_field_name, $user_id_value, $session_id_field_name, $session_id_value, $state)
 {
     $session_id = $this->getSessionId($session_id_field_name, $session_id_value);
     if ($session_id instanceof WSError) {
         return $session_id;
     } else {
         $user_id = $this->getUserId($user_id_field_name, $user_id_value);
         if ($user_id instanceof WSError) {
             return $user_id;
         } else {
             if ($state == 1) {
                 SessionManager::suscribe_users_to_session($session_id, array($user_id));
             } else {
                 $result = SessionManager::unsubscribe_user_from_session($session_id, $user_id);
                 if (!$result) {
                     return new WSError(303, 'There was an error unsubscribing this user from the session');
                 }
             }
             return true;
         }
     }
 }
         case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_BOSS_DISAPPROVED:
             $data['mailAction'] = ADVANCED_SUBSCRIPTION_ACTION_SUPERIOR_DISAPPROVE;
             break;
         case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED:
             $data['mailAction'] = ADVANCED_SUBSCRIPTION_ACTION_ADMIN_APPROVE;
             break;
         case ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_DISAPPROVED:
             $data['mailAction'] = ADVANCED_SUBSCRIPTION_ACTION_ADMIN_DISAPPROVE;
             break;
         default:
             break;
     }
 }
 // Student Session inscription
 if ($data['newStatus'] == ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED) {
     SessionManager::suscribe_users_to_session($data['sessionId'], array($data['studentUserId']), null, false);
 }
 // Send mails
 $result['mailIds'] = $plugin->sendMail($data, $data['mailAction']);
 // Check if mails were sent
 if (!empty($result['mailIds'])) {
     $result['error'] = false;
     $result['errorMessage'] = 'User has been processed';
     // Check if exist mail to render
     if (isset($result['mailIds']['render'])) {
         // Render mail
         $url = $plugin->getRenderMailUrl(array('queueId' => $result['mailIds']['render']));
         header('Location: ' . $url);
         exit;
     }
 }
 /**
  * Complete sale process. Update sale status to completed
  * @param int $saleId The sale ID
  * @return boolean
  */
 public function completeSale($saleId)
 {
     $sale = $this->getSale($saleId);
     if ($sale['status'] == self::SALE_STATUS_COMPLETED) {
         return true;
     }
     $saleIsCompleted = false;
     switch ($sale['product_type']) {
         case self::PRODUCT_TYPE_COURSE:
             $course = api_get_course_info_by_id($sale['product_id']);
             $saleIsCompleted = CourseManager::subscribe_user($sale['user_id'], $course['code']);
             break;
         case self::PRODUCT_TYPE_SESSION:
             SessionManager::suscribe_users_to_session($sale['product_id'], [$sale['user_id']], api_get_session_visibility($sale['product_id']), false);
             $saleIsCompleted = true;
             break;
     }
     if ($saleIsCompleted) {
         $this->updateSaleStatus($sale['id'], self::SALE_STATUS_COMPLETED);
     }
     return $saleIsCompleted;
 }
Example #13
0
     exit;
 }
 $registrationAllowed = api_get_setting('session.catalog_allow_session_auto_subscription');
 if ($registrationAllowed === 'true') {
     $entityManager = Database::getManager();
     $repository = $entityManager->getRepository('ChamiloCoreBundle:SequenceResource');
     $sequences = $repository->getRequirements($sessionId, SequenceResource::SESSION_TYPE);
     if (count($sequences) > 0) {
         $requirementsData = SequenceResourceManager::checkRequirementsForUser($sequences, SequenceResource::SESSION_TYPE, $userId);
         $continueWithSubscription = SequenceResourceManager::checkSequenceAreCompleted($requirementsData);
         if (!$continueWithSubscription) {
             header('Location: ' . api_get_path(WEB_CODE_PATH) . 'auth/courses.php');
             exit;
         }
     }
     SessionManager::suscribe_users_to_session($_GET['session_id'], array($userId));
     $coursesList = SessionManager::get_course_list_by_session_id($_GET['session_id']);
     $count = count($coursesList);
     $url = '';
     if ($count <= 0) {
         // no course in session -> return to catalog
         $url = api_get_path(WEB_CODE_PATH) . 'auth/courses.php';
     } elseif ($count == 1) {
         // only one course, so redirect directly to this course
         foreach ($coursesList as $course) {
             $url = api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/index.php?id_session=' . intval($_GET['session_id']);
         }
     } else {
         $url = api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . intval($_GET['session_id']);
     }
     header('Location: ' . $url);
Example #14
0
             *  buyer-complaint: A reversal has occurred on this transaction due to a complaint about the transaction from your customer.
             *  refund: A reversal has occurred on this transaction because you have given the customer a refund.
             *  other: A reversal has occurred on this transaction due to a reason not listed above.
             */

            $reasonCode = $resArray["PAYMENTINFO_0_REASONCODE"];

            // Insert the user information to activate the user
            if ($paymentStatus == "Completed") {
                $userId = $_SESSION['bc_user_id'];
                if ($_SESSION['bc_codetext'] === 'THIS_IS_A_SESSION') {
                    $sessionId = $_SESSION['bc_code'];
                    $all_session_information = SessionManager::fetch($sessionId);
                    SessionManager::suscribe_users_to_session(
                        $sessionId,
                        array($userId),
                        api_get_session_visibility($sessionId),
                        false
                    );
                    $url = Display::url(
                        $all_session_information['name'],
                        api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$sessionId
                    );
                    $_SESSION['bc_message'] = 'EnrollToSessionXSuccessful';
                    $_SESSION['bc_url'] = $url;
                    $_SESSION['bc_success'] = true;
                } else {
                    $course_code = $_SESSION['bc_codetext'];
                    $all_course_information = CourseManager::get_course_information($course_code);
                    if (CourseManager::subscribe_user($user_id, $course_code)) {
                        $send = api_get_course_setting('email_alert_to_teacher_on_new_user_in_course', $course_code);
                        if ($send == 1) {
Example #15
0
<?php

/* For licensing terms, see /license.txt */
/**
 * Validate requirements for a open session
 * @author Angel Fernando Quiroz Campos <*****@*****.**>
 * @package chamilo.plugin.advanced_subscription
 */
require_once __DIR__ . '/../config.php';
$plugin = AdvancedSubscriptionPlugin::create();
if (!isset($_GET['session_id'], $_GET['user_id'], $_GET['profile_completed'])) {
    die;
}
$sessionInfo = api_get_session_info($_GET['session_id']);
$tpl = new Template($plugin->get_lang('plugin_title'), false, false, false, false, false);
$tpl->assign('session', $sessionInfo);
if (SessionManager::isUserSubscribedAsStudent($_GET['session_id'], $_GET['user_id'])) {
    $tpl->assign('is_subscribed', false);
    $tpl->assign('errorMessages', [sprintf($plugin->get_lang('YouAreAlreadySubscribedToSessionX'), $sessionInfo['name'])]);
} else {
    if (!$plugin->isAllowedSubscribeToOpenSession($_GET)) {
        $tpl->assign('is_subscribed', false);
        $tpl->assign('errorMessages', $plugin->getErrorMessages());
    } else {
        SessionManager::suscribe_users_to_session($_GET['session_id'], [$_GET['user_id']], SESSION_VISIBLE_READ_ONLY, false);
        $tpl->assign('is_subscribed', true);
    }
}
$content = $tpl->fetch('/advanced_subscription/views/open_session.tpl');
$tpl->assign('content', $content);
$tpl->display_one_col_template();