Exemple #1
0
 public function deleteUserSubscription($params)
 {
     require_once _lms_ . '/lib/lib.subscribe.php';
     require_once _lms_ . '/lib/lib.course.php';
     $output = array();
     $output['success'] = true;
     if (empty($params['idst']) || (int) $params['idst'] <= 0) {
         return false;
         // return array('success'=>true, 'debug'=>print_r($params, true));
     } else {
         $user_id = $params['idst'];
     }
     $course_id = isset($params['course_id']) ? (int) $params['course_id'] : false;
     $course_code = isset($params['course_code']) ? $params['course_code'] : false;
     $edition_id = isset($params['edition_id']) ? (int) $params['edition_id'] : false;
     $edition_code = isset($params['edition_code']) ? $params['edition_code'] : false;
     $classroom_id = isset($params['classroom_id']) ? (int) $params['classroom_id'] : false;
     $classroom_code = isset($params['classroom_code']) ? $params['classroom_code'] : false;
     $user_level = $this->getUserLevelId(isset($params['user_level']) ? $params['user_level'] : false);
     $user_status = $this->getUserStatusId(isset($params['user_status']) ? $params['user_status'] : false);
     $acl_man = Docebo::user()->getAclManager();
     $course_man = new Man_Course();
     $db = DbConn::getInstance();
     $course_info = false;
     $edition_info = false;
     $classroom_info = false;
     $this->fillCourseDataFromParams($params, $db, $course_id, $edition_id, $classroom_id, $course_code, $edition_code, $classroom_code, $course_info, $edition_info, $classroom_info, $output);
     // --------------- delete user subscription: ------------------------
     $model = new SubscriptionAlms($course_id, $edition_id, $classroom_id);
     $docebo_course = new DoceboCourse($course_id);
     $level_idst = $docebo_course->getCourseLevel($course_id);
     $old_level = $model->getUserLevel($user_id);
     $delete_ok = $model->delUser($user_id);
     if ($delete_ok) {
         if (empty($edition_id) && empty($classroom_id)) {
             $acl_man->removeFromGroup($level_idst[$old_level], $user_id);
         }
     }
     if (!$delete_ok) {
         $output['success'] = false;
     } else {
         $output['message'] = 'User has been removed from the course';
     }
     return $output;
 }
 public function show()
 {
     if (isset($_GET['res']) && $_GET['res'] !== '') {
         UIFeedback::info(Lang::t('_OPERATION_SUCCESSFUL', 'standard'));
     }
     if (isset($_GET['err']) && $_GET['err'] !== '') {
         UIFeedback::error(Lang::t('_OPERATION_FAILURE', 'standard'));
     }
     $params = array();
     if (!isset($_SESSION['course_filter'])) {
         $_SESSION['course_filter']['text'] = '';
         $_SESSION['course_filter']['classroom'] = false;
         $_SESSION['course_filter']['descendants'] = false;
         $_SESSION['course_filter']['waiting'] = false;
     }
     if (isset($_POST['c_filter_set'])) {
         $classroom = (bool) Get::req('classroom', DOTY_INT, false);
         $descendants = (bool) Get::req('descendants', DOTY_INT, false);
         $waiting = (bool) Get::req('waiting', DOTY_INT, false);
         $filter_text = Get::req('text', DOTY_STRING, '');
     } else {
         $classroom = $_SESSION['course_filter']['classroom'];
         $descendants = $_SESSION['course_filter']['descendants'];
         $waiting = $_SESSION['course_filter']['waiting'];
         $filter_text = $_SESSION['course_filter']['text'];
     }
     $filter_open = false;
     if ($descendants || $waiting) {
         $filter_open = true;
     }
     $filter = array('classroom' => $classroom, 'descendants' => $descendants, 'waiting' => $waiting, 'text' => $filter_text, 'open' => $filter_open, 'id_category' => $this->_getSessionTreeData('id_category', 0));
     $_SESSION['course_filter']['text'] = $filter_text;
     $_SESSION['course_filter']['classroom'] = $classroom;
     $_SESSION['course_filter']['descendants'] = $descendants;
     $_SESSION['course_filter']['waiting'] = $waiting;
     $params['initial_selected_node'] = $this->_getSessionTreeData('id_category', 0);
     $params['filter'] = $filter;
     $params['root_name'] = Lang::t('_CATEGORY', 'admin_course_managment');
     $params['permissions'] = $this->permissions;
     $params['base_link_course'] = $this->base_link_course;
     $params['base_link_classroom'] = $this->base_link_classroom;
     $params['base_link_edition'] = $this->base_link_edition;
     $params['base_link_subscription'] = $this->base_link_subscription;
     $smodel = new SubscriptionAlms();
     $params['unsubscribe_requests'] = $smodel->countPendingUnsubscribeRequests();
     $this->render('show', $params);
 }
 public function getPassedData($idScorm)
 {
     $output = false;
     $items = $this->getItems($idScorm, false);
     $query = "SELECT idscorm_item, lesson_status, COUNT(*) as num_count " . " FROM %lms_scorm_tracking WHERE idscorm_item IN (" . implode(",", $items) . ") " . " GROUP BY idscorm_item, lesson_status" . " ORDER BY idscorm_item ";
     $res = $this->db->query($query);
     if ($res) {
         $data = array();
         while ($row = $this->db->fetch_obj($res)) {
             if (!isset($data[$row->idscorm_item])) {
                 $data[$row->idscorm_item] = array('passed' => 0, 'not_passed' => 0);
             }
             if ($row->lesson_status == 'passed' || $row->lesson_status == 'completed') {
                 $data[$row->idscorm_item]['passed'] += $row->num_count;
             } else {
                 $data[$row->idscorm_item]['not_passed'] += $row->num_count;
             }
         }
         //get number of users subscribed to the course
         $subs_man = new SubscriptionAlms($_SESSION['idCourse']);
         $tot = $subs_man->totalUser("", 3);
         //all subscribed students
         $output = array();
         foreach ($items as $idItem) {
             $p1 = isset($data[$idItem]['passed']) ? $data[$idItem]['passed'] : 0;
             $p2 = isset($data[$idItem]['not_passed']) ? $data[$idItem]['not_passed'] : 0;
             //$tot = $p1 + $p2;
             if ($tot <= 0) {
                 $result = 0;
             } else {
                 $result = 100 * $p1 / $tot;
             }
             $output[$idItem] = $result;
         }
     }
     return $output;
 }
 public function deny_unsubscribe_request_multiTask()
 {
     $_requests = Get::req('requests', DOTY_MIXED, FALSE);
     if (!$_requests) {
         //...
     }
     $res = TRUE;
     $smodel = new SubscriptionAlms();
     $list = explode(",", $_requests);
     foreach ($list as $request) {
         list($user_id, $idCourse, $res_id, $r_type) = explode("_", $request);
         switch ($r_type) {
             case "course":
                 $res = $smodel->unsetUnsubscribeRequest($user_id, $idCourse);
                 break;
             case "edition":
                 $res = $smodel->unsetUnsubscribeRequest($user_id, $idCourse, $res_id);
                 break;
             case "classroom":
                 $res = $smodel->unsetUnsubscribeRequest($user_id, $idCourse, false, $res_id);
                 break;
         }
     }
     $output = array('success' => $res ? TRUE : FALSE);
     echo $this->json->encode($output);
 }
 /**
  * assign a group of user to a preassessment, you can specify if the users are administrator or not
  * @param int 	$id_assessment 	the id of the assessment
  * @param int 	$user_type 		is the identifier of the type of the user, use the constant USER_ASSES_TYPE_ADMIN, USER_ASSES_TYPE_USER
  * @param array $user_list 		the list of user that must be assigned to the assesment.If a user is not in this list, but is actually
  * 								assigned to the ass. the function will remove the user
  */
 function updateAssessmentUser($id_assessment, $user_type, $user_list)
 {
     require_once _lms_ . '/lib/lib.course.php';
     require_once _lms_ . '/admin/models/SubscriptionAlms.php';
     $docebo_course = new DoceboCourse($id_assessment);
     $acl_man = Docebo::user()->getAclManager();
     $subsciption_model = new SubscriptionAlms($id_assessment, 0, 0);
     $level_idst = $docebo_course->getCourseLevel($id_assessment);
     if (count($level_idst) == 0 || $level_idst[1] == '') {
         $level_idst = $docebo_course->createCourseLevel($id_assessment);
     }
     $level = 3;
     if ($user_type !== 'user') {
         $level = 6;
     }
     $op_result = true;
     $query = "\r\n\t\tSELECT " . implode($this->user_field, ',') . "\r\n\t\tFROM " . $this->tableUserAssessment() . "\r\n\t\tWHERE " . $this->user_field[USER_ASSES_ID] . " = '" . $id_assessment . "'\r\n\t\t\tAND " . $this->user_field[USER_ASSES_TYPE] . " = '" . $user_type . "'";
     $re_query = $this->_query($query);
     while ($row = $this->fetch_row($re_query)) {
         if (isset($user_list[$row[USER_ASSES_ID_USER]])) {
             unset($user_list[$row[USER_ASSES_ID_USER]]);
         } else {
             $del_query = "\r\n\t\t\t\tDELETE FROM " . $this->tableUserAssessment() . "\r\n\t\t\t\tWHERE " . $this->user_field[USER_ASSES_ID] . " = '{$id_assessment}'\r\n\t\t\t\t\t AND " . $this->user_field[USER_ASSES_ID_USER] . " = '" . $row[USER_ASSES_ID_USER] . "'";
             $op_result &= $this->_query($del_query);
             $acl_man->removeFromGroup($level_idst[$level], $row[USER_ASSES_ID_USER]);
             $subsciption_model->delUser($row[USER_ASSES_ID_USER]);
         }
     }
     // end while
     reset($user_list);
     while (list(, $id_user) = each($user_list)) {
         $upd_query = "\r\n\t\t\tINSERT INTO " . $this->tableUserAssessment() . "\r\n\t\t\t( \t" . $this->user_field[USER_ASSES_ID] . ",\r\n\t\t\t\t" . $this->user_field[USER_ASSES_ID_USER] . ",\r\n\t\t\t\t" . $this->user_field[USER_ASSES_TYPE] . " ) VALUES\r\n\t\t\t( \t'" . $id_assessment . "',\r\n\t\t\t\t'" . $id_user . "',\r\n\t\t\t\t'" . $user_type . "' )";
         $op_result &= $this->_query($upd_query);
         $acl_man->addToGroup($level_idst[$level], $id_user);
         $subsciption_model->subscribeUser($id_user, $level, false);
     }
     return $op_result;
 }
Exemple #6
0
    }
    ?>
    				
		<p class="course_support_info">
			<?php 
    if ($course['code']) {
        ?>
<i style="font-size:.88em">[<?php 
        echo $keyword != "" ? Layout::highlight($course['code'], $keyword) : $course['code'];
        ?>
]</i><?php 
    }
    ?>
		</p>
		<?php 
    $smodel = new SubscriptionAlms();
    if ($smodel->isUserWaitingForSelfUnsubscribe(Docebo::user()->idst, $course['idCourse'])) {
        echo '<p style="padding:.4em">' . Lang::t('_UNSUBSCRIBE_REQUEST_WAITING_FOR_MODERATION', 'course') . '</p>';
    } else {
        //auto unsubscribe management: create a link for the user in the course block
        $_can_unsubscribe = $course['auto_unsubscribe'] == 1 || $course['auto_unsubscribe'] == 2;
        $_date_limit = $course['unsubscribe_date_limit'] != "" && $course['unsubscribe_date_limit'] != "0000-00-00 00:00:00" ? $course['unsubscribe_date_limit'] : FALSE;
        if ($_can_unsubscribe) {
            ?>
		<p class="course_support_info">
			<?php 
            if ($_date_limit !== FALSE && $_date_limit < date("Y-m-d H:i:s")) {
                echo '';
            } else {
                ?>
			<a href="index.php?r=elearning/self_unsubscribe&amp;id_course=<?php 
 public function inline_editorTask()
 {
     if (!$this->permissions['mod']) {
         $output = array('success' => false, 'message' => $this->_getErrorMessage('no permission'));
         echo $this->json->encode($output);
         return;
     }
     $id_course = isset($_SESSION['idCourse']) && $_SESSION['idCourse'] > 0 ? $_SESSION['idCourse'] : false;
     if ((int) $id_course <= 0) {
         $output = array('success' => false, 'message' => $this->_getErrorMessage('invalid course'));
         echo $this->json->encode($output);
         return;
     }
     $id_user = Get::req('id_user', DOTY_INT, -1);
     if ($id_user <= 0) {
         $output = array('success' => false, 'message' => $this->_getErrorMessage('invalid user'));
         echo $this->json->encode($output);
         return;
     }
     $old_value = Get::req('old_value', DOTY_MIXED, false);
     $new_value = Get::req('new_value', DOTY_MIXED, false);
     if ($old_value === false || $new_value === false) {
         $output = array('success' => false, 'message' => $this->_getErrorMessage("invalid data"));
         echo $this->json->encode($output);
         return;
     }
     $output = array();
     $col = Get::req('col', DOTY_STRING, "");
     switch ($col) {
         case "status":
             $smodel = new SubscriptionAlms($id_course);
             $slist = $smodel->getUserStatusList();
             $res = $smodel->updateUserStatus($id_user, $new_value);
             $output['success'] = $res ? true : false;
             $output['new_value'] = isset($slist[$new_value]) ? $slist[$new_value] : "";
             break;
         default:
             $output['success'] = false;
             $output['message'] = $this->_getErrorMessage("invalid column");
     }
     echo $this->json->encode($output);
 }
 /**
  * The action of self-unsubscription from a course (if enabled for the course),
  * available in the course box of the courses list
  */
 public function self_unsubscribe()
 {
     $id_user = Docebo::user()->idst;
     //Get::req('id_user', DOTY_INT, Docebo::user()->idst);
     $id_course = Get::req('id_course', DOTY_INT, 0);
     $id_edition = Get::req('id_edition', DOTY_INT, 0);
     $id_date = Get::req('id_date', DOTY_INT, 0);
     $cmodel = new CourseAlms();
     $cinfo = $cmodel->getCourseModDetails($id_course);
     //index.php?r=elearning/show
     $back = Get::req('back', DOTY_STRING, "");
     if ($back != "") {
         $parts = explode('/', $back);
         $length = count($parts);
         if ($length > 0) {
             $parts[$length - 1] = 'show';
             $back = implode('/', $parts);
         }
     }
     $jump_url = 'index.php?r=' . ($back ? $back : 'lms/elearning/show');
     if ($cinfo['auto_unsubscribe'] == 0) {
         //no self unsubscribe possible for this course
         Util::jump_to($jump_url . '&res=err_unsub');
     }
     $date_ok = TRUE;
     if ($cinfo['unsubscribe_date_limit'] != "" && $cinfo['unsubscribe_date_limit'] != "0000-00-00 00:00:00") {
         if ($cinfo['unsubscribe_date_limit'] < date("Y-m-d H:i:s")) {
             //self unsubscribing is no more allowed, go back to courselist page
             Util::jump_to($jump_url . '&res=err_unsub');
         }
     }
     $smodel = new SubscriptionAlms();
     $param = '';
     if ($cinfo['auto_unsubscribe'] == 1) {
         //moderated self unsubscribe
         $res = $smodel->setUnsubscribeRequest($id_user, $id_course, $id_edition, $id_date);
         $param .= $res ? '&res=ok_unsub' : '&res=err_unsub';
     }
     if ($cinfo['auto_unsubscribe'] == 2) {
         //directly unsubscribe user
         $res = $smodel->unsubscribeUser($id_user, $id_course, $id_edition, $id_date);
         $param .= $res ? '&res=ok_unsub' : '&res=err_unsub';
     }
     Util::jump_to($jump_url);
 }
 public function subscribeToCourse()
 {
     $id_course = Get::req('id_course', DOTY_INT, 0);
     $id_date = Get::req('id_date', DOTY_INT, 0);
     $id_edition = Get::req('id_edition', DOTY_INT, 0);
     $id_user = Docebo::user()->getIdSt();
     $docebo_course = new DoceboCourse($id_course);
     require_once _lms_ . '/admin/models/SubscriptionAlms.php';
     $model = new SubscriptionAlms($id_course, $id_edition, $id_date);
     $course_info = $model->getCourseInfoForSubscription();
     $userinfo = $this->acl_man->getUser($id_user);
     $level_idst =& $docebo_course->getCourseLevel($id_course);
     if (count($level_idst) == 0 || $level_idst[1] == '') {
         $level_idst =& $docebo_course->createCourseLevel($id_course);
     }
     $waiting = 0;
     if ($course_info['subscribe_method'] != 2) {
         $waiting = 1;
     }
     $userlevel_subscrip = $this->get_userlevel_subscription($id_user);
     //UG
     //UG		$this->acl_man->addToGroup($level_idst[3], $id_user);
     $this->acl_man->addToGroup($level_idst[$userlevel_subscrip], $id_user);
     //UG
     //UG		if($model->subscribeUser($id_user, 3, $waiting))
     if ($model->subscribeUser($id_user, $userlevel_subscrip, $waiting)) {
         $res['success'] = true;
         $res['new_status_code'] = '';
         if ($id_edition != 0 || $id_date != 0) {
             $must_change_status = $this->model->controlSubscriptionRemaining($id_course);
             $res['new_status'] = '';
             if (!$must_change_status) {
                 $res['new_status'] = '<p class="cannot_subscribe">' . Lang::t('_NO_EDITIONS', 'catalogue') . '</p>';
             }
         } else {
             if ($waiting == 1) {
                 $res['new_status'] = '<p class="cannot_subscribe">' . Lang::t('_WAITING', 'catalogue') . '</p>';
                 $res['new_status_code'] = 'waiting';
             } else {
                 $res['new_status'] = '<p class="subscribed">' . Lang::t('_USER_STATUS_ENTER', 'catalogue') . '</p>';
                 $res['new_status_code'] = 'subscribed';
             }
         }
         $array_subst = array('[url]' => Get::sett('url'), '[course]' => $course_info['name'], '[firstname]' => $userinfo[ACL_INFO_FIRSTNAME], '[lastname]' => $userinfo[ACL_INFO_LASTNAME]);
         // message to user that is waiting
         require_once _base_ . '/lib/lib.eventmanager.php';
         $msg_composer = new EventMessageComposer('subscribe', 'lms');
         $msg_composer->setSubjectLangText('email', '_NEW_USER_SUBS_WAITING_SUBJECT', false);
         $msg_composer->setBodyLangText('email', '_NEW_USER_SUBS_WAITING_TEXT', $array_subst);
         $msg_composer->setSubjectLangText('sms', '_NEW_USER_SUBS_WAITING_SUBJECT_SMS', false);
         $msg_composer->setBodyLangText('sms', '_NEW_USER_SUBS_WAITING_TEXT_SMS', $array_subst);
         $acl =& Docebo::user()->getAcl();
         $acl_man =& $this->acl_man;
         $recipients = array();
         $idst_group_god_admin = $acl->getGroupST(ADMIN_GROUP_GODADMIN);
         $recipients = $acl_man->getGroupMembers($idst_group_god_admin);
         $idst_group_admin = $acl->getGroupST(ADMIN_GROUP_ADMIN);
         $idst_admin = $acl_man->getGroupMembers($idst_group_admin);
         require_once _adm_ . '/lib/lib.adminmanager.php';
         foreach ($idst_admin as $id_user) {
             $adminManager = new AdminManager();
             $acl_manager =& $acl_man;
             $idst_associated = $adminManager->getAdminTree($id_user);
             $array_user =& $acl_manager->getAllUsersFromIdst($idst_associated);
             $array_user = array_unique($array_user);
             $array_user[] = $array_user[0];
             unset($array_user[0]);
             $control_user = array_search(getLogUserId(), $array_user);
             $query = "SELECT COUNT(*)" . " FROM " . Get::cfg('prefix_fw') . "_admin_course" . " WHERE idst_user = '******'" . " AND type_of_entry = 'course'" . " AND id_entry = '" . $id_course . "'";
             list($control_course) = mysql_fetch_row(mysql_query($query));
             /*if($control)
             		$recipients[] = $id_user;*/
             $query = "SELECT COUNT(*)" . " FROM " . Get::cfg('prefix_fw') . "_admin_course" . " WHERE idst_user = '******'" . " AND type_of_entry = 'coursepath'" . " AND id_entry IN" . " (" . " SELECT id_path" . " FROM " . Get::cfg('prefix_lms') . "_coursepath_courses" . " WHERE id_item = '" . $id_course . "'" . " )";
             list($control_coursepath) = mysql_fetch_row(mysql_query($query));
             /*if($control)
             		$recipients[] = $id_user;*/
             $query = "SELECT COUNT(*)" . " FROM " . Get::cfg('prefix_fw') . "_admin_course" . " WHERE idst_user = '******'" . " AND type_of_entry = 'catalogue'" . " AND id_entry IN" . " (" . " SELECT idCatalogue" . " FROM " . Get::cfg('prefix_lms') . "_catalogue_entry" . " WHERE idEntry = '" . $id_course . "'" . " )";
             list($control_catalogue) = mysql_fetch_row(mysql_query($query));
             if ($control_user && ($control_course || $control_coursepath || $control_catalogue)) {
                 $recipients[] = $id_user;
             }
         }
         $recipients = array_unique($recipients);
         createNewAlert('UserCourseInsertModerate', 'subscribe', 'insert', '1', 'User subscribed with moderation', $recipients, $msg_composer);
         $res['message'] = UIFeedback::info(Lang::t('_SUBSCRIPTION_CORRECT', 'catalogue'), true);
     } else {
         $this->acl_man->removeFromGroup($level_idst[3], $id_user);
         $res['success'] = false;
         $res['message'] = UIFeedback::error(Lang::t('_SUBSCRIPTION_ERROR', 'catalogue'), true);
     }
     echo $this->json->encode($res);
 }
 public function makeOrder()
 {
     $wire = Get::req('wire', DOTY_INT, 0);
     $cart = $_SESSION['lms_cart'];
     require_once _lms_ . '/lib/lib.cart.php';
     if (Learning_Cart::cartItemCount() > 0) {
         $id_trans = $this->model->createTransaction();
     } else {
         $id_trans = false;
     }
     if ($id_trans === false) {
         $result = array('success' => false, 'message' => UIFeedback::error(Lang::t('_ERROR_CREATE_TRANS', 'catalogue'), true));
     } else {
         $course_info = $this->model->getCartList(true);
         $total_price = 0;
         foreach ($cart as $id_course => $extra) {
             $docebo_course = new DoceboCourse($id_course);
             require_once _lms_ . '/admin/models/SubscriptionAlms.php';
             $level_idst =& $docebo_course->getCourseLevel($id_course);
             if (count($level_idst) == 0 || $level_idst[1] == '') {
                 $level_idst =& $docebo_course->createCourseLevel($id_course);
             }
             $waiting = 1;
             $this->acl_man->addToGroup($level_idst[3], Docebo::user()->getIdSt());
             if (isset($extra['classroom'])) {
                 foreach ($extra['classroom'] as $id_date) {
                     $model = new SubscriptionAlms($id_course, 0, $id_date);
                     if (!$model->subscribeUser(Docebo::user()->getIdSt(), 3, $waiting)) {
                         $this->acl_man->removeFromGroup($level_idst[3], Docebo::user()->getIdSt());
                     } elseif ($this->model->addTransactionCourse($id_trans, $id_course, $id_date, 0, $course_info[$id_course . '_' . $id_date . '_0'])) {
                         unset($_SESSION['lms_cart'][$id_course]['classroom'][$id_date]);
                         $query = "UPDATE %lms_courseuser" . " SET status = '-2'" . " WHERE idUser = "******" AND idCourse = " . $id_course;
                         sql_query($query);
                         $total_price += $course_info[$id_course . '_' . $id_date . '_0']['price'];
                     }
                 }
             } elseif (isset($extra['edition'])) {
                 foreach ($extra['edition'] as $id_edition) {
                     $model = new SubscriptionAlms($id_course, $id_edition, 0);
                     if (!$model->subscribeUser(Docebo::user()->getIdSt(), 3, $waiting)) {
                         $this->acl_man->removeFromGroup($level_idst[3], Docebo::user()->getIdSt());
                     } elseif ($this->model->addTransactionCourse($id_trans, $id_course, 0, $id_edition, $course_info[$id_course . '_0_' . $id_edition])) {
                         unset($_SESSION['lms_cart'][$id_course]['edition'][$id_edition]);
                         $query = "UPDATE %lms_courseuser" . " SET status = '-2'" . " WHERE idUser = "******" AND idCourse = " . $id_course;
                         sql_query($query);
                         $total_price += $course_info[$id_course . '_0_' . $id_edition]['price'];
                     }
                 }
             } else {
                 $model = new SubscriptionAlms($id_course, 0, 0);
                 if (!$model->subscribeUser(Docebo::user()->getIdSt(), 3, $waiting)) {
                     $this->acl_man->removeFromGroup($level_idst[3], Docebo::user()->getIdSt());
                 } elseif ($this->model->addTransactionCourse($id_trans, $id_course, 0, 0, $course_info[$id_course . '_0_0'])) {
                     unset($_SESSION['lms_cart'][$id_course]);
                     $query = "UPDATE %lms_courseuser" . " SET status = '-2'" . " WHERE idUser = "******" AND idCourse = " . $id_course;
                     sql_query($query);
                     $total_price += $course_info[$id_course . '_0_0']['price'];
                 }
             }
         }
         require_once _lms_ . '/lib/lib.cart.php';
         if (Learning_Cart::cartItemCount() == 0) {
             $_SESSION['lms_cart'] = array();
         }
         $_SESSION['cart_transaction'] = $id_trans;
         $result = array('success' => true, 'message' => UIFeedback::info(Lang::t('_TRANS_CREATED', 'catalogue'), true), 'id_transaction' => $id_trans, 'total_price' => $total_price, 'link' => Get::sett('url') . _folder_lms_ . '/index.php?r=cart/show&id_transaction=' . $id_trans . '&cart=' . $_SESSION['cart_id']);
     }
     if ($wire) {
         if ($result['success']) {
             Util::jump_to('index.php?r=cart/wireInfo&id_transaction=' . $id_trans);
         }
         Util::jump_to('index.php?r=cart/show&error=1');
     } else {
         echo $this->json->encode($result);
     }
 }