Ejemplo n.º 1
0
 function getCatalogueCourse($id_cat, $for_admin = false)
 {
     require_once _lms_ . '/lib/lib.coursepath.php';
     $path_man = new CoursePath_Manager();
     $query = "SELECT idEntry, type_of_entry" . " FROM %lms_catalogue_entry" . " WHERE idCatalogue = '" . $id_cat . "'";
     $result = sql_query($query);
     $res = array();
     while (list($id_entry, $type) = sql_fetch_row($result)) {
         if ($type == 'course') {
             $res[$id_entry] = $id_entry;
         } elseif ($for_admin) {
             $coursepath_course =& $path_man->getAllCourses(array($id_entry));
             foreach ($coursepath_course as $id_course) {
                 $res[$id_course] = $id_course;
             }
         }
     }
     return $res;
 }
Ejemplo n.º 2
0
 public function __construct()
 {
     $this->db = DbConn::getInstance();
     $this->users_filter = false;
     $this->courses_filter = false;
     $this->user_level = Docebo::user()->getUserLevelId();
     if ($this->user_level != ADMIN_GROUP_GODADMIN) {
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $this->users_filter = $adminManager->getAdminUsers(Docebo::user()->getIdST());
         $all_courses = false;
         $array_courses = array();
         $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST());
         foreach ($admin_courses['course'] as $key => $id_course) {
             if ($key > 0) {
                 $array_courses[$key] = $id_course;
             }
         }
         if (isset($admin_courses['course'][0])) {
             $all_courses = true;
         } elseif (isset($admin_courses['course'][-1])) {
             require_once _lms_ . '/lib/lib.catalogue.php';
             $cat_man = new Catalogue_Manager();
             $user_catalogue = $cat_man->getUserAllCatalogueId(Docebo::user()->getIdSt());
             if (count($user_catalogue) > 0) {
                 $courses = array();
                 foreach ($user_catalogue as $id_cat) {
                     $catalogue_course =& $cat_man->getCatalogueCourse($id_cat, true);
                     if (empty($courses)) {
                         $courses = $catalogue_course;
                     } else {
                         $courses = array_merge($courses, $catalogue_course);
                     }
                 }
                 foreach ($courses as $id_course) {
                     if ($id_course != 0) {
                         $array_courses[$id_course] = $id_course;
                     }
                 }
             } elseif (Get::sett('on_catalogue_empty', 'off') == 'on') {
                 $all_courses = true;
             }
         } else {
             if (!empty($admin_courses['coursepath'])) {
                 require_once _lms_ . '/lib/lib.coursepath.php';
                 $path_man = new CoursePath_Manager();
                 $coursepath_course =& $path_man->getAllCourses($admin_courses['coursepath']);
                 $array_courses = array_merge($array_courses, $coursepath_course);
             }
             if (!empty($admin_courses['catalogue'])) {
                 require_once _lms_ . '/lib/lib.catalogue.php';
                 $cat_man = new Catalogue_Manager();
                 foreach ($admin_courses['catalogue'] as $id_cat) {
                     $catalogue_course =& $cat_man->getCatalogueCourse($id_cat, true);
                     $array_courses = array_merge($array_courses, $catalogue_course);
                 }
             }
         }
         if (!$all_courses) {
             $this->courses_filter = array_values($array_courses);
         }
         //if "$all_courses" is true, than leave "$this->courses_filter" as false
     }
 }
Ejemplo n.º 3
0
 function entrylist()
 {
     checkPerm('view');
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
     $lang =& DoceboLanguage::createInstance('catalogue', 'lms');
     $out =& $GLOBALS['page'];
     $id_cat = Get::req('id', DOTY_INT, 0);
     $cat_name = getCatalogueName($id_cat);
     $mod_perm = checkPerm('mod', true);
     $title_area = array('index.php?modname=catalogue&op=catlist' => $lang->def('_CATALOGUE'), $cat_name);
     $tb_entry = new Table();
     $query_entry = "\r\n\tSELECT idEntry, type_of_entry\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_catalogue_entry\r\n\tWHERE idCatalogue = '" . $id_cat . "'";
     $re_entry = sql_query($query_entry);
     $courses = array();
     $coursepath = array();
     while (list($id, $t_o_entry) = sql_fetch_row($re_entry)) {
         if ($t_o_entry == 'course') {
             $courses[$id] = $id;
         } else {
             $coursepath[$id] = $id;
         }
     }
     $coursepath_man = new CoursePath_Manager();
     $coursespath_name =& $coursepath_man->getNames($coursepath);
     $course_name =& getCoursesInfo($courses);
     $cont_h = array($lang->def('_CODE'), $lang->def('_NAME'), $lang->def('_TYPE'));
     $type_h = array('', '', '');
     if ($mod_perm) {
         $type_h[] = 'image';
         $cont_h[] = '<img src="' . getPathImage('fw') . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />';
     }
     $tb_entry->setColsStyle($type_h);
     $tb_entry->addHead($cont_h);
     $all_courses = true;
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         $all_courses = false;
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST());
         if (isset($admin_courses['course'][0])) {
             $all_courses = true;
         } elseif (isset($admin_courses['course'][-1])) {
             require_once _lms_ . '/lib/lib.catalogue.php';
             $cat_man = new Catalogue_Manager();
             $user_catalogue = $cat_man->getUserAllCatalogueId(Docebo::user()->getIdSt());
             if (count($user_catalogue) > 0) {
                 $courses = array(0);
                 foreach ($user_catalogue as $id_cat) {
                     $catalogue_course =& $cat_man->getCatalogueCourse($id_cat, true);
                     $courses = array_merge($courses, $catalogue_course);
                 }
                 foreach ($courses as $id_course) {
                     if ($id_course != 0) {
                         $admin_courses['course'][$id_course] = $id_course;
                     }
                 }
             } elseif (Get::sett('on_catalogue_empty', 'off') == 'on') {
                 $all_courses = true;
             }
         } else {
             $array_courses = array();
             $array_courses = array_merge($array_courses, $admin_courses['course']);
             if (!empty($admin_courses['coursepath'])) {
                 require_once _lms_ . '/lib/lib.coursepath.php';
                 $path_man = new Catalogue_Manager();
                 $coursepath_course =& $path_man->getAllCourses($admin_courses['coursepath']);
                 $array_courses = array_merge($array_courses, $coursepath_course);
             }
             if (!empty($admin_courses['catalogue'])) {
                 require_once _lms_ . '/lib/lib.catalogue.php';
                 $cat_man = new Catalogue_Manager();
                 foreach ($admin_courses['catalogue'] as $id_cat) {
                     $catalogue_course =& $cat_man->getCatalogueCourse($id_cat, true);
                     $array_courses = array_merge($array_courses, $catalogue_course);
                 }
             }
             $admin_courses['course'] = array_merge($admin_courses['course'], $array_courses);
         }
     }
     if (is_array($course_name)) {
         foreach ($course_name as $course) {
             $cont = array($course['code'], $course['name'], $lang->def('_COURSE'));
             if ($mod_perm) {
                 if (isset($admin_courses['course'][$course['id']]) || $all_courses) {
                     $cont[] = '<a href="index.php?modname=catalogue&amp;op=delentry&amp;id_cat=' . $id_cat . '&amp;type=course&amp;id_entry=' . $course['id'] . '" ' . 'title="' . $lang->def('_REMOVE_ENTRY') . ' : ' . strip_tags($course['name']) . '">' . '<img src="' . getPathImage('fw') . 'standard/delete.png" ' . 'alt="' . $lang->def('_DEL') . ' : ' . strip_tags($course['name']) . '" /></a>';
                 } else {
                     $cont[] = '';
                 }
             }
             $tb_entry->addBody($cont);
         }
     }
     if (is_array($coursespath_name)) {
         while (list($id, $coursepath) = each($coursespath_name)) {
             $cont = array($coursepath, $lang->def('_COURSEPATH'));
             // #bugfix 1141
             $tmp_code = $coursepath_man->getCoursepathInfo($id);
             $path_code = $tmp_code['path_code'];
             array_unshift($cont, $path_code);
             // end bugfix
             if ($mod_perm) {
                 if (isset($admin_courses['coursepath'][$id]) || $all_courses) {
                     $cont[] = '<a href="index.php?modname=catalogue&amp;op=delentry&amp;id_cat=' . $id_cat . '&amp;type=coursepath&amp;id_entry=' . $id . '" ' . 'title="' . $lang->def('_REMOVE_ENTRY') . ' : ' . strip_tags($coursepath) . '">' . '<img src="' . getPathImage('fw') . 'standard/delete.png" ' . 'alt="' . $lang->def('_DEL') . ' : ' . strip_tags($coursepath) . '" /></a>';
                 } else {
                     $cont[] = '';
                 }
             }
             $tb_entry->addBody($cont);
         }
     }
     $select_entry = array('course' => $lang->def('_COURSE'), 'coursepath' => $lang->def('_COURSEPATH'));
     if ($mod_perm) {
         $tb_entry->addActionAdd('<a href="index.php?modname=catalogue&amp;op=import&amp;id_cat=' . $id_cat . '&amp;load=1" class="ico-wt-sprite subs_import" ' . ' title="' . Lang::t('_IMPORT', 'catalogue') . '"><span>' . Lang::t('_IMPORT', 'catalogue') . '</span></a>');
     }
     switch (Get::req('result', DOTY_ALPHANUM, '')) {
         case "ok":
             UIFeedback::info(Lang::t('_OPERATION_SUCCESSFUL', 'standard'));
             break;
         case "err":
             UIFeedback::error(Lang::t('_OPERATION_ERROR', 'standard'));
             break;
     }
     $out->add(getTitleArea($title_area, 'catalogue') . '<div class="std_block">' . getBackUi('index.php?modname=catalogue&amp;op=catlist', $lang->def('_BACK')) . $tb_entry->getTable() . getBackUi('index.php?modname=catalogue&amp;op=catlist', $lang->def('_BACK')) . '</div>', 'content');
     if ($mod_perm) {
         require_once _base_ . '/lib/lib.dialog.php';
         setupHrefDialogBox('a[href*=delentry]');
     }
 }
Ejemplo n.º 4
0
 function &getUserAllCourses($id_user)
 {
     require_once $GLOBALS['where_lms'] . '/lib/lib.catalogue.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php';
     $courses = $this->getUserCourses($id_user);
     $coursepath = $this->getUserPathCourses($id_user);
     $catalogues = $this->getUserCatalogues($id_user);
     $man_cataloge = new AdminCatalogue();
     $course_from_catalogue = $man_cataloge->getAllCourses($catalogues);
     $coursepath_from_catalogue = $man_cataloge->getAllCoursePaths($catalogues);
     $coursepath = array_merge($coursepath, $coursepath_from_catalogue);
     $man_coursepath = new CoursePath_Manager();
     $course_from_coursepath = $man_coursepath->getAllCourses($coursepath);
     $courses = array_merge($courses, $course_from_catalogue, $course_from_coursepath);
     return $courses;
 }
Ejemplo n.º 5
0
function userCourseList(&$url, $use_tab = true, $page_add = true)
{
    YuiLib::load(array('animation' => 'animation-min.js', 'dragdrop' => 'dragdrop-min.js', 'button' => 'button-min.js', 'container' => 'container-min.js', 'my_window' => 'windows.js'), array('container/assets/skins/sam' => 'container.css', 'button/assets/skins/sam' => 'button.css'));
    if ($page_add) {
        addJs($GLOBALS['where_lms_relative'] . '/modules/coursecatalogue/', 'ajax.coursecatalogue.js');
    }
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.user_profile.php';
    require_once _base_ . '/lib/lib.navbar.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.preassessment.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.catalogue.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.coursereport.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php';
    require_once $GLOBALS["where_framework"] . "/lib/lib.ajax_comment.php";
    require_once $GLOBALS['where_lms'] . '/lib/lib.classroom.php';
    // pre-loading coursepath ------------------------------------------------------------------
    $path_man = new CoursePath_Manager();
    // search for the coursepath ----------------------------------------------------------
    $user_coursepath = $path_man->getUserSubscriptionsInfo(getLogUserId(), true);
    $coursepath = $path_man->getCoursepathAllInfo(array_keys($user_coursepath));
    if (!empty($coursepath)) {
        // find structures of the course path ---------------------------------------------
        $path_courses = $path_man->getPathStructure(array_keys($coursepath));
        $cp_info = $path_man->getAllCoursesInfo($path_courses['all_paths']);
        /*echo "<pre>\n\n";
        		print_r($cp_info);
        		echo "\n\n</pre>";*/
    }
    // ------------------------------------------------------------------------
    $course_stats = array('total' => 0, 'u_can_enter' => 0, 'with_status' => array(CST_AVAILABLE => 0, CST_EFFECTIVE => 0, CST_CONCLUDED => 0, CST_CANCELLED => 0), 'with_ustatus' => array(_CUS_SUBSCRIBED => 0, _CUS_BEGIN => 0, _CUS_END => 0, _CUS_SUSPEND => 0), 'with_wstatus' => array(_CUS_RESERVED => 0, _CUS_WAITING_LIST => 0), 'with_ulevel' => array(), 'expiring' => 0, 'cert_relesable' => 0);
    // ------------------------------------------------------------------------
    $filter = importVar('filter', false, 'total');
    if ($filter == 'level') {
        $filter_level = importVar('filter_on', true, 0);
    }
    $current_tab = importVar('current_tab', false, 'lo_plan');
    if ($use_tab && $page_add) {
        addCss('style_tab');
        $lo_plan = importVar('lo_plan', false, 0);
        $lo_history = importVar('lo_history', false, 0);
        if ($lo_plan != 0) {
            $current_tab = 'lo_plan';
        }
        if ($lo_history != 0) {
            $current_tab = 'lo_history';
        }
    }
    if ($use_tab && $page_add) {
        addCss('style_tab');
        $lo_plan = importVar('lo_plan', false, 0);
        $lo_history = importVar('lo_history', false, 0);
        if ($lo_plan != 0) {
            $current_tab = 'lo_plan';
        }
        if ($lo_history != 0) {
            $current_tab = 'lo_history';
        }
    }
    require_once $GLOBALS['where_lms'] . '/lib/lib.certificate.php';
    $cert = new Certificate();
    $released = $cert->certificateReleased(getLogUserId());
    $available_cert = $cert->certificateForCourses(false, false);
    // cahce classroom -----------------------------------------------------------------
    $classroom_man = new ClassroomManager();
    $classrooms = $classroom_man->getClassroomNameList();
    $lang =& DoceboLanguage::createInstance('catalogue');
    $lang_c =& DoceboLanguage::createInstance('course');
    $man_course = new Man_Course();
    $subcourse_list = sql_query("" . " SELECT u.idCourse, u.edition_id, level, u.date_inscr, u.date_first_access, " . "\t\tu.date_complete, u.status AS user_status, u.waiting, u.edition_id " . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser AS u" . " WHERE idUser = '******'");
    $subscription = array();
    while ($cinfo = mysql_fetch_assoc($subcourse_list)) {
        $subscription['course'][$cinfo['idCourse']] = $cinfo;
        if ($cinfo['edition_id'] != 0) {
            $subscription['edition'][$cinfo['idCourse']][$cinfo['edition_id']] = $cinfo;
        }
    }
    // searching courses ---------------------------------------------------------------
    $select_course = "" . " SELECT c.idCourse, c.course_type, c.idCategory, c.code, c.name, c.description, c.lang_code, c.difficult, " . "\tc.subscribe_method, c.date_begin, c.date_end, c.max_num_subscribe, " . "\tc.selling, c.prize, c.create_date, c.status AS course_status, c.course_edition, " . "\tc.classrooms, c.img_othermaterial, c.course_demo, c.course_vote, " . "\tc.can_subscribe, c.sub_start_date, c.sub_end_date, c.valid_time, c.userStatusOp, c.show_result, u.status AS user_status, u.level " . ", c.use_logo_in_courselist, c.img_course, c.direct_play ";
    $from_course = " FROM " . $GLOBALS['prefix_lms'] . "_course AS c " . "\t JOIN " . $GLOBALS['prefix_lms'] . "_courseuser AS u ";
    $where_course = " c.idCourse = u.idCourse " . " AND u.idUser = '******' " . " AND ( c.status <> '" . CST_PREPARATION . "' OR u.level > 3 )" . " AND c.course_type <> 'assessment' ";
    $selected_year = 0;
    $selected_search = '';
    if (isset($_POST['apply_filter'])) {
        if ($_POST['year']) {
            $where_course .= " AND c.create_date BETWEEN '" . $_POST['year'] . "-01-01 00:00:00' AND '" . $_POST['year'] . "-12-31 23:59:59'";
            $selected_year = $_POST['year'];
        }
        if ($_POST['search'] !== '') {
            $where_course .= " AND c.name LIKE '%" . $_POST['search'] . "%'";
            $selected_search = $_POST['search'];
        }
    }
    $group_by_course = " GROUP BY c.idCourse ";
    $order_course = " ORDER BY ";
    $tablist = Get::sett('tablist_mycourses', '');
    if ($tablist != '') {
        $arr_order_course = explode(',', $tablist);
        $arr_temp = array();
        foreach ($arr_order_course as $key => $value) {
            switch ($value) {
                case 'status':
                    $arr_temp[] = ' u.status ';
                    break;
                case 'code':
                    $arr_temp[] = ' c.code ';
                    break;
                case 'name':
                    $arr_temp[] = ' c.name ';
                    break;
            }
        }
        $order_course = $order_course . implode(', ', $arr_temp);
    }
    if ($order_course == " ORDER BY ") {
        //default without parameter
        $order_course .= " u.status, c.name ";
    }
    // apply search filter --------------------------------------------------------------
    $all_lang = Docebo::langManager()->getAllLangCode();
    $re_course = sql_query($select_course . $from_course . " WHERE " . $where_course . $group_by_course . $order_course);
    // retrive editions ----------------------------------------------------------------
    $select_edition = " SELECT e.* ";
    $from_edition = " FROM " . $GLOBALS["prefix_lms"] . "_course_editions AS e " . " JOIN " . $GLOBALS["prefix_lms"] . "_courseuser AS u ";
    $where_edition = " WHERE e.status <> '" . CST_PREPARATION . "' AND e.id_edition = u.edition_id ";
    $re_edition = sql_query($select_edition . $from_edition . $where_edition);
    // --------------------------------------------------------------------------------
    $editions = array();
    if ($re_edition) {
        while ($edition_elem = mysql_fetch_assoc($re_edition)) {
            $edition_elem['classrooms'] = isset($classrooms[$edition_elem['classrooms']]) ? $classrooms[$edition_elem['classrooms']] : '';
            $editions[$edition_elem["id_course"]][$edition_elem["id_course"]] = $edition_elem;
        }
    }
    $man_courseuser = new Man_CourseUser();
    $ax_comm = new AjaxComment('course', 'lms');
    $comment_count = $ax_comm->getResourceCommentCount();
    $user_score = $man_courseuser->getUserCourseScored(getLogUserId());
    // -----------------------------------------------------------------------------
    $needed_info_for = array();
    if (!empty($subscription['course'])) {
        $id_course_list = array_keys($subscription['course']);
        // find last access to the courses ---------------------------------------------------------------------
        require_once $GLOBALS['where_lms'] . '/lib/lib.track_user.php';
        $last_access_courses = TrackUser::getLastAccessToCourse(getLogUserId());
        // retrive unreaded advice -----------------------------------------------------------------------------
        require_once $GLOBALS['where_lms'] . '/lib/lib.advice.php';
        $advices = Man_Advice::getCountUnreaded(getLogUserId(), $id_course_list, $last_access_courses);
        // retrive unreaded forum messages ---------------------------------------------------------------------
        require_once $GLOBALS['where_lms'] . '/lib/lib.forum.php';
        $forums = Man_Forum::getCountUnreaded(getLogUserId(), $id_course_list, $last_access_courses);
        // retrive new lesson ----------------------------------------------------------------------------------
        require_once $GLOBALS['where_lms'] . '/lib/lib.orgchart.php';
        $org_chart = OrganizationManagement::getCountUnreaded(getLogUserId(), $id_course_list, $last_access_courses);
        if (!empty($path_courses['all_items'])) {
            $needed_info_for = array_diff($path_courses['all_items'], $id_course_list);
        }
        $first_is_scorm = OrganizationManagement::objectFilter($id_course_list, 'scormorg');
        $enroll_list = sql_query("" . " SELECT u.idCourse, u.edition_id, COUNT(*) as number " . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser AS u" . " WHERE u.idCourse IN (" . implode($id_course_list, ',') . ") " . " AND u.level = '3'" . " AND u.status IN ('" . _CUS_CONFIRMED . "', '" . _CUS_SUBSCRIBED . "', '" . _CUS_BEGIN . "', '" . _CUS_END . "', '" . _CUS_SUSPEND . "', '" . _CUS_WAITING_LIST . "')" . " AND u.absent = '0'" . " GROUP BY u.idCourse, u.edition_id ");
        $enrolled = array();
        while ($cinfo = mysql_fetch_assoc($enroll_list)) {
            $enrolled[$cinfo['idCourse']][$cinfo['edition_id']] = $cinfo['number'];
        }
    }
    // search pre-assessment -----------------------------------------------------------
    $select_assess = "" . " SELECT c.idCourse, c.course_type, c.idCategory, c.code, c.name, c.description, c.lang_code, c.difficult, " . "\tc.subscribe_method, c.date_begin, c.date_end, c.max_num_subscribe, " . "\tc.selling, c.prize, c.create_date, c.status AS course_status, c.course_edition, " . "\tc.classrooms, c.img_othermaterial, c.course_demo, c.course_vote, " . "\tc.can_subscribe, c.sub_start_date, c.sub_end_date, c.valid_time, c.userStatusOp, " . "\tu.level, u.date_inscr, u.date_first_access, u.date_complete, u.status AS user_status, u.waiting, c.advance, u.waiting ";
    $from_assess = " FROM " . $GLOBALS['prefix_lms'] . "_course AS c " . "\t JOIN " . $GLOBALS['prefix_lms'] . "_courseuser AS u ";
    $where_assess = " c.idCourse = u.idCourse " . " AND u.idUser = '******' " . " AND c.course_type = 'assessment' " . " AND  ( c.status <> '" . CST_PREPARATION . "' OR u.level > 3 ) " . ($filter == 'level' ? " AND level = '" . $filter_level . "'" : "");
    //." AND ( u.status <> '"._CUS_END."' OR u.level > 3 ) ";
    $preass_list = sql_query($select_assess . $from_assess . " WHERE " . $where_assess . " ORDER BY c.name ");
    // pre assessment list ---------------------------------------------------------------------------------------
    $i = 0;
    if (mysql_num_rows($preass_list) && $current_tab == 'lo_plan') {
        if ($page_add) {
            $GLOBALS['page']->add('<div id="mycourse_asses">' . '<h1>' . $lang_c->def('_ASSESSMENT_LIST') . '</h1>', 'content');
        }
        while ($cinfo = mysql_fetch_assoc($preass_list)) {
            $cinfo['user_score'] = isset($user_score[$cinfo['idCourse']]) ? $user_score[$cinfo['idCourse']] : NULL;
            if (isset($comment_count[$cinfo['idCourse']])) {
                $cinfo['comment_count'] = $comment_count[$cinfo['idCourse']];
            }
            if ($page_add) {
                $GLOBALS['page']->add(dashmyassess($url, $lang_c, $cinfo, $i++), 'content');
            }
        }
        if ($page_add) {
            $GLOBALS['page']->add('</div>', 'content');
        }
    }
    // page intest ------------------------------------------------------------
    require_once $GLOBALS['where_lms'] . '/lib/lib.levels.php';
    $lvl = CourseLevel::getLevels();
    $title = $lang->def('_COURSE_LIST');
    switch ($filter) {
        case "access":
            $title = $lang->def('_COURSE_YOU_CAN_ACCESS');
            break;
        case "expiring":
            $title = $lang->def('_COURSE_EXPIRING');
            break;
        case "subscribed":
            $title = $lang->def('_COURSE_SUBSCRIBED');
            break;
        case "begin":
            $title = $lang->def('_COURSE_BEGIN');
            break;
        case "end":
            $title = $lang->def('_COURSE_END');
            break;
        case "level":
            $title = str_replace('[level]', $lvl[$_GET['filter_on']], $lang->def('_COURSE_AS'));
            break;
    }
    if ($page_add) {
        $GLOBALS['page']->add('<div id="mycourse_list">' . '<h1>' . $title . '</h1>', 'content');
    }
    $i = 0;
    $direct_play = false;
    while ($cinfo = mysql_fetch_assoc($re_course)) {
        $access = Man_Course::canEnterCourse($cinfo);
        if ($cinfo['direct_play'] == 1) {
            $direct_play = true;
        }
        $course_stats['total']++;
        if ($cinfo['user_status'] == _CUS_RESERVED || $cinfo['user_status'] == _CUS_WAITING_LIST) {
            $course_stats['with_wstatus'][$cinfo['user_status']]++;
        } elseif ($access['can']) {
            $course_stats['u_can_enter']++;
        }
        if (isset($course_stats['with_ustatus'][$cinfo['user_status']])) {
            $course_stats['with_ustatus'][$cinfo['user_status']]++;
        } else {
            $course_stats['with_ustatus'][$cinfo['user_status']] = 1;
        }
        if (!isset($course_stats['with_ulevel'][$cinfo['level']])) {
            $course_stats['with_ulevel'][$cinfo['level']] = 1;
        } else {
            $course_stats['with_ulevel'][$cinfo['level']]++;
        }
        if (isset($available_cert[$cinfo['idCourse']])) {
            while (list($id_cert, $certificate) = each($available_cert[$cinfo['idCourse']])) {
                if (!isset($released[$id_cert]) && $cert->canRelease($certificate[CERT_AV_STATUS], $cinfo['user_status'])) {
                    $course_stats['cert_relesable']++;
                }
            }
        }
    }
    if (mysql_num_rows($re_course)) {
        mysql_data_seek($re_course, 0);
    }
    while ($cinfo = mysql_fetch_assoc($re_course)) {
        $cinfo['edition_list'] = isset($editions[$cinfo['idCourse']]) ? $editions[$cinfo['idCourse']] : array();
        $cinfo['user_score'] = isset($user_score[$cinfo['idCourse']]) ? $user_score[$cinfo['idCourse']] : NULL;
        $cinfo['enrolled'] = isset($enrolled[$cinfo['idCourse']]) ? $enrolled[$cinfo['idCourse']] : false;
        if (isset($comment_count[$cinfo['idCourse']])) {
            $cinfo['comment_count'] = $comment_count[$cinfo['idCourse']];
        }
        $cinfo['classrooms'] = isset($classrooms[$cinfo['classrooms']]) ? $classrooms[$cinfo['classrooms']] : '';
        // advertising --------------------------------------------------------------------------------------------
        $cinfo['to_read']['advice'] = isset($advices[$cinfo['idCourse']]) ? $advices[$cinfo['idCourse']] : 0;
        $cinfo['to_read']['forum'] = isset($forums[$cinfo['idCourse']]) ? $forums[$cinfo['idCourse']] : 0;
        $cinfo['to_read']['lobj'] = isset($org_chart[$cinfo['idCourse']]) ? $org_chart[$cinfo['idCourse']] : 0;
        // 10 days in the future
        $range = time() + 10 * 24 * 60 * 60;
        $expiring = false;
        if ($cinfo['date_end'] != '0000-00-00') {
            $time_end = fromDatetimeToTimestamp($cinfo['date_end']);
            if ($range > $time_end) {
                $expiring = true;
                $course_stats['expiring']++;
            }
        }
        if ($cinfo['valid_time'] != '0' && $cinfo['valid_time'] != '' && $cinfo['date_first_access'] != '') {
            $time_first_access = fromDatetimeToTimestamp($cinfo['date_first_access']);
            if ($range > $time_first_access + $cinfo['valid_time'] * 24 * 3600) {
                $expiring = true;
                $course_stats['expiring']++;
            }
        }
        if (isset($first_is_scorm[$cinfo['idCourse']])) {
            $cinfo['first_is_scorm'] = $first_is_scorm[$cinfo['idCourse']];
        } else {
            $cinfo['first_is_scorm'] = false;
        }
        $access = Man_Course::canEnterCourse($cinfo);
        // --------------------------------------------------------------------
        if (!isset($path_courses['all_items'][$cinfo['idCourse']])) {
            // the course is not related with a coursepath, so i can print it --------------
            if ($filter == 'level') {
                if ($subscription['course'][$cinfo['idCourse']]['level'] == $filter_level) {
                    $dash = dashmycourse($url, $lang_c, $subscription, $cinfo, $i++);
                } else {
                    $dash = '';
                }
            } else {
                $dash = dashmycourse($url, $lang_c, $subscription, $cinfo, $i++);
            }
            if ($use_tab == true) {
                if ($course_stats['with_ustatus'][_CUS_END] == $course_stats['total']) {
                    $current_tab = 'lo_history';
                }
                if ($current_tab == 'lo_history') {
                    if ($cinfo['user_status'] == _CUS_END && $page_add) {
                        $GLOBALS['page']->add($dash, 'content');
                    }
                } else {
                    if (($cinfo['user_status'] != _CUS_END || $cinfo['level'] >= 4) && $page_add) {
                        $GLOBALS['page']->add($dash, 'content');
                    }
                }
            } else {
                switch ($filter) {
                    case "access":
                        if ($access['can'] && $page_add) {
                            $GLOBALS['page']->add($dash, 'content');
                        }
                        break;
                    case "expiring":
                        if ($expiring && $page_add) {
                            $GLOBALS['page']->add($dash, 'content');
                        }
                        break;
                    case "subscribed":
                        if ($cinfo['user_status'] == _CUS_SUBSCRIBED && $page_add) {
                            $GLOBALS['page']->add($dash, 'content');
                        }
                        break;
                    case "begin":
                        if ($cinfo['user_status'] == _CUS_BEGIN && $page_add) {
                            $GLOBALS['page']->add($dash, 'content');
                        }
                        break;
                    case "end":
                        if ($cinfo['user_status'] == _CUS_END && $page_add) {
                            $GLOBALS['page']->add($dash, 'content');
                        }
                        break;
                    case "level":
                        if ($_GET['filter_on'] == $cinfo['level'] && $page_add) {
                            $GLOBALS['page']->add($dash, 'content');
                        }
                        break;
                    default:
                        if ($page_add) {
                            $GLOBALS['page']->add($dash, 'content');
                        }
                }
            }
        } else {
            // the course is related with a coursepath, so i must wait to print it ----------
            //$cinfo['prerequisites'] = $path_courses['all_items'][$cinfo['idCourse']]; // <- useless?
            //$courses =array($cinfo['idCourse']=>$cinfo);
            $prere = $cp_info[$cinfo['idCourse']]["prerequisites"];
            if ($path_man->checkPrerequisites($prere, $subscription)) {
                $cinfo['prerequisites_satisfied'] = true;
            } else {
                $cinfo['prerequisites_satisfied'] = false;
            }
            if ($filter == 'level') {
                if ($subscription['course'][$cinfo['idCourse']]['level'] == $filter_level) {
                    $course_cache[$cinfo['idCourse']] = dashmycourse($url, $lang_c, $subscription, $cinfo, 1, true, 4);
                } else {
                    $course_cache[$cinfo['idCourse']] = '';
                }
            } else {
                $course_cache[$cinfo['idCourse']] = dashmycourse($url, $lang_c, $subscription, $cinfo, 1, true, 4);
            }
        }
        // end else-if -------------------------------------------------------
    }
    //  end while ------------------------------------------------------------
    if ($direct_play && $page_add) {
        $GLOBALS['page']->add('' . '	<link href="' . getPathTemplate() . '/style/shadowbox.css" rel="stylesheet" type="text/css" />' . '<script type="text/javascript" src="' . $GLOBALS['where_framework_relative'] . '/addons/shadowbox/shadowbox-yui.js"></script>' . "\n" . '<script type="text/javascript" src="' . $GLOBALS['where_framework_relative'] . '/addons/shadowbox/shadowbox.js"></script>' . "\n", 'page_head');
        $GLOBALS['page']->add('<script type="text/javascript">
	
		YAHOO.util.Event.onDOMReady(function() {
			var options = { listenOverlay:false, overlayOpacity:"0.8", 
				loadingImage:"' . getPathImage('lms') . 'standard/loading.gif", overlayBgImage:"' . getPathImage('lms') . 'standard/overlay-85.png", 
				text: {close: "' . Lang::t('_CLOSE') . '", cancel: "' . Lang::t('_UNDO') . '", loading:"' . Lang::t('_LOADING') . '" },
				onOpen: function (gallery) { window.onbeforeunload = function() { return "' . Lang::t('_CONFIRM_EXIT', 'organization', 'lms') . '"; } }
		    }; 
			Shadowbox.init(options); 
			Shadowbox.close = function() { 
				window.frames[\'shadowbox_content\'].uiPlayer.closePlayer(true, window);
			}
		});
		</script>');
    }
    if ($course_stats['total'] == 0 && $page_add) {
        $GLOBALS['page']->add('' . '<b>' . $lang->def('_NO_COURSE') . '</b> ' . '<br />', 'content');
    }
    if ($page_add) {
        $GLOBALS['page']->add('</div>', 'content');
    }
    // Coursepath --------------------------------------------------------------
    if (!empty($coursepath)) {
        // find structures of the course path ----------------------------------
        $path_slot = $path_man->getPathSlot(array_keys($coursepath));
        // coursepath list -----------------------------------------------------
        if ($page_add) {
            $GLOBALS['page']->add('<div id="mycoursepath_list">' . '<h1>' . $lang->def('_COURSEPATH_LIST') . '</h1>', 'content');
        }
        $i = 0;
        // find course basilar information -------------------------------------
        if (!empty($needed_info_for)) {
            $course_info = $man_course->getAllCourses(false, false, $needed_info_for);
        } else {
            $course_info = array();
        }
        while (list($id_path, $path) = each($coursepath)) {
            $html = '<div class="coursepath_container coursepath_container_simple">';
            $html .= '<h2>' . ($path[COURSEPATH_CODE] != '' ? '[' . $path[COURSEPATH_CODE] . '] ' : '') . $path[COURSEPATH_NAME] . '</h2>';
            if (!isset($path_courses[$id_path]) || empty($path_courses[$id_path])) {
                $html .= $lang->def('_NO_COURSE_ASSIGNED_TO_COURSEPATH') . '<br />';
            } else {
                // display the slots
                foreach ($path_slot[$id_path] as $id_slot => $slot_info) {
                    if ($id_slot == 0) {
                        $html .= '<h3>' . $lang->def('_MANDATORY') . '</h3>';
                        if (!empty($path_courses[$id_path][$id_slot])) {
                            $html .= '<ul class="coursepath_mainslot">';
                        }
                    } else {
                        if ($slot_info['min_selection'] > 0 && $slot_info['max_selection'] > 0) {
                            $title = str_replace(array('[min_selection]', '[max_selection]'), array($slot_info['min_selection'], $slot_info['max_selection']), $lang->def('_COURSE_PATH_SLOT_MIN_MAX'));
                        } elseif ($slot_info['max_selection'] > 0) {
                            $title = str_replace('[max_selection]', $slot_info['max_selection'], $lang->def('_COURSE_PATH_SLOT_MAX'));
                        } else {
                            $title = $lang->def('_COURSE_PATH_SLOT');
                        }
                        $html .= '<h3>' . $title . '</h3>';
                        if (!empty($path_courses[$id_path][$id_slot])) {
                            $html .= '<ul class="coursepath_otherslot">';
                        }
                    }
                    while (list($id) = each($path_courses[$id_path][$id_slot])) {
                        if (isset($course_cache[$id])) {
                            $html .= '<li>' . $course_cache[$id] . '</li>';
                        } else {
                            $html .= '<li>' . dashAcourse($id, 4) . '</li>';
                        }
                    }
                    if (!empty($path_courses[$id_path][$id_slot])) {
                        $html .= '</ul>';
                    }
                }
            }
            $html .= '</div>';
            if ($page_add) {
                $GLOBALS['page']->add($html, 'content');
            }
        }
        if ($page_add) {
            $GLOBALS['page']->add('</div>', 'content');
        }
    }
    if ($course_stats['cert_relesable'] < 0) {
        $course_stats['cert_relesable'] = 0;
    }
    return $course_stats;
}
Ejemplo n.º 6
0
 function loadCourseSelector($noprint = false, $with_assesment = false)
 {
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('course', 'lms');
     $output = '';
     $output .= $this->treeview->load();
     // Filter
     $this->filter['course_flat'] = isset($_POST['c_flatview']);
     //$this->filter['course_code'] = ( isset($_POST['c_filter_code']) ? $_POST['c_filter_code'] : '' );
     $this->filter['course_name'] = isset($_POST['c_filter_name']) ? $_POST['c_filter_name'] : '';
     if ($this->show_filter === true) {
         $output .= '<div class="quick_search_form">' . '<div class="common_options">' . Form::getInputCheckbox('c_flatview', 'c_flatview', '1', Get::req('c_flatview', DOTY_INT, '0') == '1' ? true : false, ' onclick="submit();" ') . ' <label class="label_normal" for="c_flatview">' . Lang::t('_DIRECTORY_FILTER_FLATMODE', 'admin_directory') . '</label>' . '&nbsp;&nbsp;&nbsp;&nbsp;' . '</div>' . '<div>' . Form::getInputTextfield("search_t", "c_filter_name", "c_filter_name", Get::req('c_filter_name', DOTY_ALPHANUM, ''), '', 255, '') . Form::getButton("c_filter_set", "c_filter_set", Lang::t('_SEARCH', 'standard'), "search_b") . '</div>' . '</div>';
     }
     // End Filter
     $tb = new Table(Get::sett('visu_course'), $lang->def('_COURSE_LIST'), $lang->def('_COURSE_LIST_SUMMARY'));
     $tb->initNavBar('ini', 'button');
     $ini = $tb->getSelectedElement();
     $category_selected = $this->treeview->getSelectedFolderId();
     if ($this->filter['course_flat']) {
         $id_categories = $this->treeDB->getDescendantsId($this->treeDB->getFolderById($category_selected));
         $id_categories[] = $category_selected;
     }
     $select = "\r\n\t\tSELECT c.idCourse, c.code, c.name, c.description, c.status, c.difficult,\r\n\t\t\tc.subscribe_method, c.permCloseLo, c.show_rules, c.max_num_subscribe ";
     $query_course = "\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_course AS c\r\n\t\tWHERE " . ($with_assesment ? '1' : "c.course_type <> 'assessment'") . " AND c.idCategory IN ( " . (!$this->filter['course_flat'] ? $category_selected : implode(",", $id_categories)) . " )";
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         $all_courses = false;
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST());
         $all_courses = false;
         if (isset($admin_courses['course'][0])) {
             $all_courses = true;
         } elseif (isset($admin_courses['course'][-1])) {
             require_once _lms_ . '/lib/lib.catalogue.php';
             $cat_man = new Catalogue_Manager();
             $user_catalogue = $cat_man->getUserAllCatalogueId(Docebo::user()->getIdSt());
             if (count($user_catalogue) > 0) {
                 $courses = array(0);
                 foreach ($user_catalogue as $id_cat) {
                     $catalogue_course =& $cat_man->getCatalogueCourse($id_cat, true);
                     $courses = array_merge($courses, $catalogue_course);
                 }
                 foreach ($courses as $id_course) {
                     if ($id_course != 0) {
                         $admin_courses['course'][$id_course] = $id_course;
                     }
                 }
             } elseif (Get::sett('on_catalogue_empty', 'off') == 'on') {
                 $all_courses = true;
             }
         } else {
             $array_courses = array();
             $array_courses = array_merge($array_courses, $admin_courses['course']);
             if (!empty($admin_courses['coursepath'])) {
                 require_once _lms_ . '/lib/lib.coursepath.php';
                 $path_man = new CoursePath_Manager();
                 $coursepath_course =& $path_man->getAllCourses($admin_courses['coursepath']);
                 $array_courses = array_merge($array_courses, $coursepath_course);
             }
             if (!empty($admin_courses['catalogue'])) {
                 require_once _lms_ . '/lib/lib.catalogue.php';
                 $cat_man = new Catalogue_Manager();
                 foreach ($admin_courses['catalogue'] as $id_cat) {
                     $catalogue_course =& $cat_man->getCatalogueCourse($id_cat, true);
                     $array_courses = array_merge($array_courses, $catalogue_course);
                 }
             }
             $admin_courses['course'] = array_merge($admin_courses['course'], $array_courses);
         }
         if (!$all_courses) {
             if (empty($admin_courses['course'])) {
                 $query_course .= " AND 0 ";
             } else {
                 $query_course .= " AND c.idCourse IN (" . implode(',', $admin_courses['course']) . ") ";
             }
         }
     }
     /*
     		if($this->filter['course_code'] != '') {
     			$query_course .= " AND c.code LIKE '%".$this->filter['course_code']."%'";
     		}*/
     if ($this->filter['course_name'] != '') {
         $query_course .= " AND ( c.code LIKE '%" . $this->filter['course_name'] . "%' OR c.name LIKE '%" . $this->filter['course_name'] . "%' ) ";
     }
     list($tot_course) = sql_fetch_row(sql_query("SELECT COUNT(*) " . $query_course));
     $query_course .= " ORDER BY c.name\r\n\t\t\t\t\t\t\tLIMIT " . $ini . "," . (int) Get::sett('visuItem', 25);
     $re_course = sql_query($select . $query_course);
     $type_h = array('image', '', '', '');
     $cont_h = array('<span class="access-only">' . $lang->def('_COURSE_SELECTION') . '</span>', $lang->def('_CODE'), $lang->def('_COURSE_NAME'), $lang->def('_STATUS'));
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     $status_array = array(CST_PREPARATION => Lang::t('_CST_PREPARATION', 'course'), CST_AVAILABLE => Lang::t('_CST_AVAILABLE', 'course'), CST_EFFECTIVE => Lang::t('_CST_CONFIRMED', 'course'), CST_CONCLUDED => Lang::t('_CST_CONCLUDED', 'course'), CST_CANCELLED => Lang::t('_CST_CANCELLED', 'course'));
     while (list($id_course, $code, $name, $desc, $status, $difficult, $auto_sub, $end_mode, $show_rules, $max_user_sub) = sql_fetch_row($re_course)) {
         $tb_content = array(Form::getInputCheckbox('new_course_selected_' . $id_course, 'new_course_selected[' . $id_course . ']', $id_course, isset($this->current_selection[$id_course]), ''), '<label for="new_course_selected_' . $id_course . '">' . $code . '</label>', '<label for="new_course_selected_' . $id_course . '">' . $name . '</label>');
         $tb_content[] = $status_array[$status];
         $tb->addBody($tb_content);
         if (isset($this->current_selection[$id_course])) {
             unset($this->current_selection[$id_course]);
         }
     }
     $output .= $tb->getTable() . $tb->getNavBar($ini, $tot_course) . $this->stateSelection();
     //, 'content');
     if ($noprint) {
         return $output;
     } else {
         cout($output);
     }
 }
Ejemplo n.º 7
0
 public function saveTrackStatusChange($idUser, $idCourse, $status)
 {
     require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
     list($prev_status) = sql_fetch_row(sql_query("\r\n\t\tSELECT status\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_courseuser\r\n\t\tWHERE idUser = '******' AND idCourse = '" . (int) $idCourse . "'"));
     $extra = '';
     if ($prev_status != $status) {
         switch ($status) {
             case _CUS_SUBSCRIBED:
                 //approved subscriptin for example
                 $extra = ", date_inscr = NOW()";
                 break;
             case _CUS_BEGIN:
                 //first access
                 UpdatesLms::resetCache();
                 $extra = ", date_first_access = NOW()";
                 break;
             case _CUS_END:
                 //end course
                 $extra = ", date_complete = NOW()";
                 break;
         }
     }
     if (!sql_query("\r\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_courseuser\r\n\t\tSET status = '" . (int) $status . "' " . $extra . "\r\n\t\tWHERE idUser = '******' AND idCourse = '" . (int) $idCourse . "'")) {
         return false;
     }
     $re = sql_query("\r\n\t\tSELECT when_do\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_statuschangelog\r\n\t\tWHERE status_user = '******' AND\r\n\t\t\tidUser = '******' AND\r\n\t\t\tidCourse = '" . (int) $idCourse . "'");
     if (sql_num_rows($re)) {
         sql_query("\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_statuschangelog\r\n\t\t\tSET when_do = NOW()\r\n\t\t\tWHERE status_user = '******' AND\r\n\t\t\t\tidUser = '******' AND\r\n\t\t\t\tidCourse = '" . (int) $idCourse . "'");
     } else {
         sql_query("\r\n\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_statuschangelog\r\n\t\t\tSET status_user = '******',\r\n\t\t\t\tidUser = '******',\r\n\t\t\t\tidCourse = '" . (int) $idCourse . "',\r\n\t\t\t\twhen_do = NOW()");
     }
     if ($prev_status != $status && $status == _CUS_END) {
         // send alert
         if (!sql_num_rows($re)) {
             /*
             				//add course's competences scores to user
             				require_once($GLOBALS['where_lms'].'/lib/lib.competences.php');
             				$competences_man = new Competences_Manager();
             				$competences_man->AssignCourseCompetencesToUser($idCourse, $idUser);
             */
         }
         require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
         require_once _base_ . '/lib/lib.eventmanager.php';
         $teachers = Man_Course::getIdUserOfLevel($idCourse, '6');
         $cd = new DoceboCourse($idCourse);
         $acl_man =& Docebo::user()->getAclManager();
         $array_subst = array('[user]' => $acl_man->getUserName($idUser), '[course]' => $cd->getValue('name'));
         $msg_composer = new EventMessageComposer();
         $msg_composer->setSubjectLangText('email', '_USER_END_COURSE_SBJ', false);
         $msg_composer->setBodyLangText('email', '_USER_END_COURSE_TEXT', $array_subst);
         $msg_composer->setBodyLangText('sms', '_USER_END_COURSE_TEXT_SMS', $array_subst);
         // send message to the user subscribed
         createNewAlert('UserCourseEnded', 'status', 'modify', '1', 'User end course', $teachers, $msg_composer);
         //add course's competences scores to user
         /*
         require_once($GLOBALS['where_lms'].'/lib/lib.competences.php');
         $competences_man = new Competences_Manager();
         $competences_man->AssignCourseCompetencesToUser($idCourse, $idUser);
         */
         //increment coursecompleted if this course is in a coursepath
         require_once _lms_ . '/lib/lib.coursepath.php';
         $cpmodel = new CoursePath_Manager();
         $cpmodel->assignComplete($idCourse, $idUser);
     }
     return true;
 }
Ejemplo n.º 8
0
 public function resetCoursepathValidityDates($id_path, $id_user)
 {
     if ($id_path <= 0 || $id_user <= 0) {
         return false;
     }
     require_once _lms_ . '/lib/lib.coursepath.php';
     $cman = new CoursePath_Manager();
     $courses = $cman->getAllCourses(array($id_path));
     if (empty($courses)) {
         return true;
     }
     $query = "UPDATE %lms_courseuser SET date_begin_validity = NULL, date_expire_validity = NULL " . " WHERE idCourse IN (" . implode(",", $courses) . ") AND idUser="******"";
     $res = sql_query($query);
     return $res ? true : false;
 }
Ejemplo n.º 9
0
 public function delCourse($id_course)
 {
     if ((int) $id_course <= 0) {
         return false;
     }
     require_once _lms_ . '/lib/lib.course.php';
     require_once _base_ . '/lib/lib.upload.php';
     $course_man = new Man_Course();
     //remove course subscribed------------------------------------------
     $levels =& $course_man->getCourseIdstGroupLevel($id_course);
     foreach ($levels as $lv => $idst) {
         Docebo::aclm()->deleteGroup($idst);
     }
     $alluser = getIDGroupAlluser($id_course);
     Docebo::aclm()->deleteGroup($alluser);
     $course_man->removeCourseRole($id_course);
     $course_man->removeCourseMenu($id_course);
     $query = "DELETE FROM %lms_courseuser WHERE idCourse = '" . (int) $id_course . "'";
     $qres = sql_query($query);
     if (!$qres) {
         return false;
     }
     //--- remove course data ---------------------------------------------------
     $query_course = "SELECT imgSponsor, img_course, img_material, img_othermaterial, course_demo, course_type, has_editions\n\t\t\tFROM %lms_course\n\t\t\tWHERE idCourse = '" . (int) $id_course . "'";
     $qres = sql_query($query_course);
     list($file_sponsor, $file_logo, $file_material, $file_othermaterial, $file_demo, $course_type, $course_edition) = sql_fetch_row($qres);
     require_once _base_ . '/lib/lib.upload.php';
     $path = '/appLms/' . Get::sett('pathcourse');
     if (substr($path, -1) != '/' && substr($path, -1) != '\\') {
         $path .= '/';
     }
     sl_open_fileoperations();
     if ($file_sponsor != '') {
         sl_unlink($path . $file_sponsor);
     }
     if ($file_logo != '') {
         sl_unlink($path . $file_logo);
     }
     if ($file_material != '') {
         sl_unlink($path . $file_material);
     }
     if ($file_othermaterial != '') {
         sl_unlink($path . $file_othermaterial);
     }
     if ($file_demo != '') {
         sl_unlink($path . $file_demo);
     }
     sl_close_fileoperations();
     //if the scs exist delete course rooms
     if ($GLOBALS['where_scs'] !== false) {
         require_once _scs_ . '/lib/lib.room.php';
         $re = deleteRoom(false, 'course', $id_course);
     }
     //--- delete classroom or editions -----------------------------------------
     if ($course_type == 'classroom') {
         require_once _lms_ . '/admin/model/ClassroomAlms.php';
         $classroom_model = new ClassroomAlms($id_course);
         $classroom = $classroom_model->classroom_man->getDateIdForCourse($id_course);
         foreach ($classroom as $id_date) {
             if (!$classroom_model->classroom_man->delDate($id_date)) {
                 return false;
             }
         }
     } elseif ($course_edition == 1) {
         require_once _lms_ . '/admin/model/EditionAlms.php';
         $edition_model = new EditionAlms($id_course);
         $editions = $edition_model->classroom_man->getEditionIdFromCourse($id_course);
         foreach ($editions as $id_edition) {
             if (!$edition_model->edition_man->delEdition($id_edition)) {
                 return false;
             }
         }
     }
     //--- end classrooms or editions -------------------------------------------
     //--- clear LOs ------------------------------------------------------------
     require_once _lms_ . '/lib/lib.module.php';
     require_once _lms_ . '/lib/lib.param.php';
     require_once _lms_ . '/class.module/track.object.php';
     $arr_lo_param = array();
     $arr_lo_track = array();
     $arr_org_access = array();
     $query = "SELECT * FROM %lms_organization WHERE idCourse = " . (int) $id_course;
     $ores = sql_query($query);
     while ($obj = sql_fetch_object($ores)) {
         $deleted = true;
         if ($obj->idResource != 0 && $obj->objectType != "") {
             $lo = createLO($obj->objectType);
             $deleted = $lo->del($obj->idResource);
             //delete learning object
         }
         if ($deleted) {
             $arr_lo_track[] = $obj->idOrg;
             $arr_org_access[] = $obj->idOrg;
             //collect org access ids
             $arr_lo_param[] = $obj->idParam;
             //collect idParams ids
         }
     }
     //delete all organizations references for the course
     $query = "DELETE FROM %lms_organization WHERE idCourse = " . (int) $id_course;
     $res = sql_query($query);
     //delete LOs trackings
     if (!empty($arr_lo_track)) {
         $track_object = new Track_Object(false, 'course_lo');
         $track_object->delIdTrackFromCommon($arr_lo_track);
     }
     //delete org accesses
     if (!empty($arr_org_access)) {
         $query = "DELETE FROM %lms_organization_access\n\t\t\t\tWHERE idOrgAccess IN (" . implode(",", $arr_org_access) . ")";
         $res = sql_query($query);
     }
     //delete lo params
     if (!empty($arr_lo_param)) {
         $query = "DELETE FROM %lms_lo_param\n\t\t\t\tWHERE idParam IN (" . implode(",", $arr_lo_param) . ")";
     }
     //--- end LOs --------------------------------------------------------------
     //--- clear coursepath references ------------------------------------------
     require_once _lms_ . '/lib/lib.coursepath.php';
     $cman = new CoursePath_Manager();
     $cman->deleteCourseFromCoursePaths($id_course);
     //--- end coursepath references --------------------------------------------
     //--- clear certificates assignments ---------------------------------------
     require_once _lms_ . '/lib/lib.certificate.php';
     $cman = new Certificate();
     $cman->deleteCourseCertificateAssignments($id_course);
     //--- end certificates assignments -----------------------------------------
     //--- clear labels ---------------------------------------------------------
     $lmodel = new LabelAlms();
     $lmodel->clearCourseLabel($id_course);
     //--- end labels -----------------------------------------------------------
     //--- clear advices --------------------------------------------------------
     require_once _lms_ . '/lib/lib.advice.php';
     $aman = new Man_Advice();
     $aman->deleteAllCourseAdvices($id_course);
     //--- end advices ----------------------------------------------------------
     //--- clear coursereports --------------------------------------------------
     require_once _lms_ . '/lib/lib.coursereport.php';
     $cman = new CourseReportManager();
     $cman->deleteAllReports($id_course);
     //--- end coursereports ----------------------------------------------------
     //--- clear competences ----------------------------------------------------
     $cmodel = new CompetencesAdm();
     $cmodel->deleteAllCourseCompetences($id_course);
     //--- end competences ------------------------------------------------------
     //--- finally delete course from courses table -----------------------------
     if (!sql_query("DELETE FROM %lms_course WHERE idCourse = '" . $id_course . "'")) {
         return false;
     }
     return true;
 }
Ejemplo n.º 10
0
function modrule(&$url)
{
    checkPerm('mod');
    YuiLib::load(array('animation' => 'animation-min.js', 'dragdrop' => 'dragdrop-min.js', 'button' => 'button-min.js', 'container' => 'container-min.js', 'my_window' => 'windows.js'), array('container/assets/skins/sam' => 'container.css', 'button/assets/skins/sam' => 'button.css'));
    addJs($GLOBALS['where_lms_relative'] . '/admin/modules/preassessment/', 'ajax.preassessment.js');
    $id_assessment = importVar('id_assess', true, 0);
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    $course_man = new Man_Course();
    require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php';
    $coursepath_man = new CoursePath_Manager();
    require_once $GLOBALS['where_lms'] . '/lib/lib.preassessment.php';
    $assess_man = new AssessmentList();
    $rule_man = new AssessmentRule();
    $lang =& DoceboLanguage::createInstance('preassessment');
    // recover assessment
    $assessment = $assess_man->getAssessment($id_assessment);
    $rule_list = $rule_man->getAllRule($id_assessment);
    // recover new type one
    require_once _base_ . '/lib/lib.table.php';
    $tb = new Table(0, $lang->def('_CAPTION_PREASSESSMENT_RULE'), $lang->def('_SUMMARY_PREASSESSMENT_RULE'));
    // table header --------------------------------------------------------------------------------------------
    $cont_h = array($lang->def('_RULE_TEXT'), $lang->def('_RULE_ACTION'), '<img src="' . getPathImage('lms') . 'standard/modelem.png" alt="' . $lang->def('_ALT_ADD_EFFECT') . '" />', '<img src="' . getPathImage('lms') . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage('lms') . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />');
    $type_h = array('nowrap', '', 'image', 'image', 'image');
    $usedef = 1;
    $tb->addHead($cont_h, $type_h);
    while ($rule = $rule_man->fetch_row($rule_list)) {
        $id = $rule[RULE_ID];
        if ($rule[RULE_TYPE] == RULE_DEFAULT) {
            $usedef = 0;
        }
        $rule_name = $rule_man->resolveRuleTypePhrase($lang, $rule);
        $cont = array($rule_name);
        $effect = '';
        $effects = $rule_man->parseEffects($rule[RULE_EFFECT]);
        if (count($effects['course']) > 0) {
            $effect .= $lang->def('_COURSES') . ': ' . $course_man->listCourseName($effects['course']);
        }
        if (count($effects['coursepath']) > 0) {
            if (count($effects['course']) > 0) {
                $effect .= '<br/>';
            }
            $path_list =& $coursepath_man->getNames($effects['coursepath']);
            $effect .= $lang->def('_COURSEPATH') . ': ' . implode(', ', $path_list);
        }
        if (count($effects['course']) == 0 && count($effects['coursepath']) == 0) {
            $effect = $lang->def('_DO_NOTHING');
        }
        $cont[] = $effect;
        $cont[] = '<a href="' . $url->getUrl('op=assignrule&id_rule=' . $id . '&load=1') . '" title=""' . $lang->def('_ADD_EFFECT') . '">' . '<img src="' . getPathImage('lms') . 'standard/modelem.png" alt="' . $lang->def('_ALT_ADD_EFFECT') . '" />' . '</a>';
        $cont[] = '<a href="' . $url->getUrl('op=modrulet&id_rule=' . $id) . '" title="' . $lang->def('_MOD_TITLE') . '"' . '" onclick="mod_rule_mask(\'' . $id_assessment . '\', \'' . $id . '\'); return false;"' . '>' . '<img src="' . getPathImage('lms') . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />' . '</a>';
        $cont[] = '<a href="' . $url->getUrl('op=delrule&id_rule=' . $id) . '" title="' . $lang->def('_DEL') . ': ' . $rule_name . '"' . '	onclick="del_assessment_rule(\'' . $id . '\', \'' . strip_tags($rule_name) . '\'); return false;"' . '>' . '<img src="' . getPathImage('lms') . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />' . '</a>';
        $tb->addBody($cont);
    }
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=delrule]');
    $tb->addActionAdd('<a class="new_element_link" ' . ' 	onclick="add_rule_mask(\'' . $id_assessment . '\', \'' . $usedef . '\'); return false;"' . ' id="add_rule" ' . 'href="#" ' . '>' . $lang->def('_ADD_RULE') . '</a>');
    $GLOBALS['page']->add('<script type="text/javascript">' . 'YAHOO.util.Event.onDOMReady( function(e) {' . ' setup_assessment(); ' . ' YAHOO.util.Event.addListener("add_rule", "click", function(e) { add_rule_mask(\'' . $id_assessment . '\', \'' . $usedef . '\'); });' . '});' . '</script>', 'page_head');
    $GLOBALS['page']->add(getTitleArea(array($url->getUrl() => $lang->def('_ASSESSMENT'), $lang->def('_RULES') . ': ' . $assessment['name']), 'preassessment') . '<div class="std_block">' . getInfoUi($lang->def('_RULE_OVERLAPPED')), 'content');
    if (isset($_GET['result'])) {
        $GLOBALS['page']->add(guiResultStatus($lang, $_GET['result']), 'content');
    }
    $GLOBALS['page']->add($tb->getTable(), 'content');
    $GLOBALS['page']->add(getBackUi($url->getUrl(), $lang->def('_BACK')) . '</div>', 'content');
}
 public function choose_editions_coursepath_action()
 {
     if (isset($_POST['undo'])) {
         Util::jump_to('index.php?r=' . $this->link . '/show_coursepath&id_path=' . (int) $_POST['id_path']);
     }
     $courses = explode(',', Get::req('courses_list', DOTY_MIXED, ''));
     $_to_add = explode(',', Get::req('users_to_add', DOTY_MIXED, ''));
     $_to_del = explode(',', Get::req('users_to_del', DOTY_MIXED, ''));
     $id_path = Get::req('id_path', DOTY_INT, 0);
     $classrooms = Get::req('classrooms', DOTY_MIXED, array());
     $editions = Get::req('editions', DOTY_MIXED, array());
     require_once _lms_ . '/lib/lib.coursepath.php';
     require_once _lms_ . '/lib/lib.course.php';
     $path_man = new CoursePath_Manager();
     foreach ($courses as $id_course) {
         $res = true;
         $docebo_course = new DoceboCourse($id_course);
         $level_idst =& $docebo_course->getCourseLevel($id_course);
         if (count($level_idst) == 0 || $level_idst[1] == '') {
             $level_idst =& $docebo_course->createCourseLevel($id_course);
         }
         foreach ($_to_add as $id_user) {
             $level = 3;
             //student
             $waiting = false;
             //$this->acl_man->addToGroup($level_idst[$level], $id_user);
             $this->_addToCourseGroup($level_idst[$level], $id_user);
             $this->model->id_course = $id_course;
             if (isset($classrooms[$id_course])) {
                 $this->model->id_date = $classrooms[$id_course];
             }
             if (isset($editions[$id_course])) {
                 $this->model->id_edition = $editions[$id_course];
             }
             if (!$this->model->subscribeUser($id_user, $level, $waiting)) {
                 $res = false;
             }
         }
     }
     if ($res) {
         $res = $path_man->subscribeUserToCoursePath($id_path, $_to_add);
     }
     Util::jump_to('index.php?r=' . $this->link . '/show_coursepath&id_path=' . (int) $_POST['id_path'] . '&res=' . $res);
 }
Ejemplo n.º 12
0
 function delslot()
 {
     checkPerm('mod');
     require_once _base_ . '/lib/lib.form.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php';
     $out =& $GLOBALS['page'];
     $lang =& DoceboLanguage::createInstance('coursepath', 'lms');
     $id_slot = importVar('id_slot');
     $id_path = importVar('id_path');
     $cpath_man = new CoursePath_Manager();
     $path = $cpath_man->getCoursepathInfo($id_path);
     if (isset($_POST['confirm'])) {
         if ($id_slot != false) {
             $re = $cpath_man->deleteSlot($id_slot, $id_path);
         }
         Util::jump_to('index.php?modname=coursepath&amp;op=pathelem&amp;id_path=' . $id_path);
     }
     $slot = $cpath_man->getSlotInfo($id_slot);
     $title_area = array('index.php?modname=coursepath&amp;op=pathlist' => $lang->def('_COURSEPATH'));
     $title_area['index.php?modname=coursepath&amp;op=pathelem&amp;id_path=' . $id_path] = $path['path_name'];
     $title_area[] = $lang->def('_DEL_SLOT');
     $GLOBALS['page']->add(getTitleArea($title_area, 'coursepath') . '<div class="std_block">' . Form::openForm('deletepath', 'index.php?modname=coursepath&amp;op=delslot') . Form::getHidden('id_path', 'id_path', $id_path) . Form::getHidden('id_slot', 'id_slot', $id_slot) . getDeleteUi($lang->def('_AREE_YOU_SURE_TO_DELETE_SLOT'), '<span class="text_bold">' . $lang->def('_MIN_SELECTION') . ' : </span>' . $slot['min_selection'] . '<br />' . '<span class="text_bold">' . $lang->def('_MAX_SELECTION') . ' : </span>' . $slot['max_selection'], false, 'confirm', 'undo') . Form::closeForm() . '</div>', 'content');
 }
Ejemplo n.º 13
0
function displayCoursePathList(&$url, $selected_tab)
{
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.user_profile.php';
    require_once _base_ . '/lib/lib.navbar.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.preassessment.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.catalogue.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.preassessment.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.coursereport.php';
    $lang =& DoceboLanguage::createInstance('catalogue');
    $lang_c =& DoceboLanguage::createInstance('course');
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0);
    $nav_bar->setLink($url->getUrl());
    $ini = $nav_bar->getSelectedElement();
    $course_man = new Man_Course();
    $path_man = new CoursePath_Manager();
    $cat_man = new Catalogue_Manager();
    $man_courseuser = new Man_CourseUser();
    $profile = new UserProfile(getLogUserId());
    $profile->init('profile', 'framework', '', 'ap');
    $profile->addStyleSheet('lms');
    $catalogues =& $cat_man->getUserAllCatalogueId(getLogUserId());
    if (!empty($catalogues)) {
        // at least one catalogue is assigned to this user
        $cat_path =& $cat_man->getAllCoursepathOfUser(getLogUserId());
        if (!empty($cat_path)) {
            $path_man->filterInPath($cat_path);
        }
    } elseif (Get::sett('on_catalogue_empty') == 'off') {
        $path_man->filterInPath(array(0));
    }
    if (!Docebo::user()->isAnonymous()) {
        if (!isset($_SESSION['cp_assessment_effect'])) {
            $pa_man = new AssessmentList();
            $arr_assessment = $pa_man->getUserAssessmentSubsription(Docebo::user()->getArrSt());
            $report = new CourseReportManager();
            $user_result = $report->getAllUserFinalScore(getLogUserId(), $arr_assessment['course_list']);
            $rule_man = new AssessmentRule();
            $ass_elem = $rule_man->getCompleteEffectListForAssessmentWithUserResult($arr_assessment['course_list'], $user_result);
            $_SESSION['cp_assessment_effect'] = urlencode(serialize($ass_elem));
        } else {
            $ass_elem = unserialize(urldecode($_SESSION['cp_assessment_effect']));
        }
        if (!empty($ass_elem['parsed']['coursepath'])) {
            $path_man->filterOrInPath($ass_elem['parsed']['coursepath']);
        }
    }
    // retrive all the classroorm
    // search for the coursepath ------------------------------------------------------
    $coursepath = $path_man->getCoursepathList($ini, Get::sett('visuItem'));
    if (empty($coursepath)) {
        // no path found for the criteria ---------------------------------------------
        $GLOBALS['page']->add('<p class="no_course_found">' . $lang->def('_NO_COURSE_FOUND') . '</p></div>', 'content');
        return;
    }
    // find structures of the course path ---------------------------------------------
    $courses = $path_man->getPathStructure(array_keys($coursepath));
    $path_slot = $path_man->getPathSlot(array_keys($coursepath));
    // fin user subscription needed ---------------------------------------------------
    $user_paths =& $path_man->getUserSubscriptionsInfo(getLogUserId(), false);
    $usercourses =& $man_courseuser->getUserSubscriptionsInfo(getLogUserId(), false);
    // find course basilar information ------------------------------------------------
    $course_info = $course_man->getAllCourses(false, false, $courses['all_items'], true);
    $GLOBALS['page']->add($nav_bar->getNavBar($ini), 'content');
    while (list($id_path, $path) = each($coursepath)) {
        $html = '<div class="coursepath_container">';
        $in_h = ' <span class="coursepath_subscribe">';
        $can_subs = true;
        if (isset($ass_elem['parsed']['coursepath'])) {
            if (isset($ass_elem['not_done']['coursepath']) && in_array($id_path, $ass_elem['not_done']['coursepath'])) {
                // the assosiacted preassessment is not done
                $in_h .= '';
                //$lang->def('_MUST_DO_PREASSESSMENT');
                $can_subs = false;
            } elseif (isset($ass_elem['to_apply']['coursepath']) && in_array($id_path, $ass_elem['to_apply']['coursepath'])) {
                // the assosiacted preassessment suggest this coursepath
                $in_h .= $lang->def('_PREASSESSMENT_SUGGESTION');
            }
        } else {
            switch ($path[COURSEPATH_METHOD]) {
                case METHOD_WAIT:
                    $in_h .= $lang->def('_METHOD_WAIT');
                    break;
                case METHOD_AUTO:
                    $in_h .= $lang->def('_METHOD_AUTO');
                    break;
                case METHOD_MANUAL:
                default:
                    $in_h .= $lang->def('_METHOD_MANUAL');
                    $can_subs = false;
                    break;
            }
        }
        $in_h .= '</span>';
        $in_h .= ' <span class="coursepath_status">';
        if (isset($usercourses[$id_path])) {
            // user is alredy subscribed to this coursepath
            if ($usercourses[$id_path]['waiting']) {
                $in_h .= $lang->def('_COURSEPATH_WAITING');
            } else {
                $in_h .= $lang->def('_USER_STATUS_SUBS');
            }
        }
        $in_h .= '</span>';
        // -------------------------------------------------------------
        $html .= '<div class="coursepath_info_container">';
        $html .= '<h2 class="pathtitle">' . $in_h . ($path[COURSEPATH_CODE] != '' ? '[' . $path[COURSEPATH_CODE] . '] ' : '') . $path[COURSEPATH_NAME] . '</h2>' . '<p class="course_support_info">' . str_replace('[enrolled]', $path[CP_ENROLLED], $lang->def('_COURSEPATH_INTRO')) . '</p>';
        if (!isset($courses[$id_path]) || empty($courses[$id_path])) {
            $html .= $lang->def('_NO_COURSE_ASSIGNED_TO_COURSEPATH') . '<br />';
        } else {
            // display the slots
            foreach ($path_slot[$id_path] as $id_slot => $slot_info) {
                if ($id_slot == 0) {
                    $html .= '<h4>' . $lang->def('_MANDATORY') . '</h4>';
                    if (!empty($courses[$id_path][$id_slot])) {
                        $html .= '<ul class="coursepath_mainslot">';
                    }
                } else {
                    if ($slot_info['min_selection'] > 0 && $slot_info['max_selection'] > 0) {
                        $title = str_replace(array('[min_selection]', '[max_selection]'), array($slot_info['min_selection'], $slot_info['max_selection']), $lang->def('_COURSE_PATH_SLOT_MIN_MAX'));
                    } elseif ($slot_info['max_selection'] > 0) {
                        $title = str_replace('[max_selection]', $slot_info['max_selection'], $lang->def('_COURSE_PATH_SLOT_MAX'));
                    } else {
                        $title = $lang->def('_COURSE_PATH_SLOT');
                    }
                    $html .= '<h4>' . $title . '</h4>';
                    if (!empty($courses[$id_path][$id_slot])) {
                        $html .= '<ul class="coursepath_otherslot">';
                    }
                }
                $i = 0;
                while (list($id) = each($courses[$id_path][$id_slot])) {
                    $html .= '<li class="path_course ' . ($i % 2 ? 'path_odd' : '') . '">' . '<a class="show_details_more" href="javascript:;" onclick="course_dash(this, \'' . $id . '\',\'info_' . $id_path . '_' . $id . '\', \'' . $can_subs . '\');">' . $lang->def('_DETAILS') . '</a>' . ($course_info[$id]['code'] != '' ? ' [' . $course_info[$id]['code'] . '] ' : '') . $course_info[$id]['name'] . '<div id="info_' . $id_path . '_' . $id . '"></div>' . '</li>';
                    $i++;
                }
                if (!empty($courses[$id_path][$id_slot])) {
                    $html .= '</ul>';
                }
            }
        }
        $html .= '</div>';
        $html .= '</div>';
        $GLOBALS['page']->add($html, 'content');
    }
    $GLOBALS['page']->add($nav_bar->getNavBar($ini), 'content');
}
Ejemplo n.º 14
0
 public function subscribeToCoursePath()
 {
     $id_path = Get::req('id_path', DOTY_INT, 0);
     $id_user = Docebo::user()->getIdSt();
     $query_pathlist = "\n\t\tSELECT path_name, subscribe_method\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_coursepath\n\t\tWHERE id_path = '" . $id_path . "'\n\t\tORDER BY path_name ";
     list($path_name, $subscribe_method) = sql_fetch_row(sql_query($query_pathlist));
     if ($subscribe_method == 1) {
         $waiting = 1;
     } else {
         $waiting = 0;
     }
     $text_query = "\n\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_coursepath_user\n\t\t\t( id_path, idUser, waiting, subscribed_by ) VALUES\n\t\t\t( '" . $id_path . "', '" . $id_user . "', '" . $waiting . "', '" . getLogUserId() . "' )";
     $re_s = sql_query($text_query);
     /////////////////////////
     if ($waiting == 0) {
         require_once _lms_ . '/lib/lib.subscribe.php';
         require_once _lms_ . '/lib/lib.coursepath.php';
         $cpath_man = new CoursePath_Manager();
         $subs_man = new CourseSubscribe_Management();
         $id_path = Get::req('id_path', DOTY_INT, 0);
         $user_selected = unserialize(urldecode(Get::req('users', DOTY_MIXED, array())));
         $courses = $cpath_man->getAllCourses(array($id_path));
         $users_subsc = array($id_user);
         $re &= $subs_man->multipleSubscribe($users_subsc, $courses, 3);
     }
     /*
     		qui non posso intervenire, si devono scegliere gli assesment e le edizioni... da admin ci sono form
     		$course_man = new Man_Course();
     		$assessment = $course_man->getAllCourses(false, 'assessment', $courses);
     		$classroom = $course_man->getAllCourses(false, 'classroom', $courses);
     		$edition = $course_man->getAllCourses(false, 'edition', $courses);
     		if(!empty($assessment))
     		{
     			foreach($assessment as $id_assessment => $assessment_info)
     				sql_query("INSERT INTO %lms_assessment_user (id_assessment, id_user, type_of) VALUES ('".$id_assessment."', '".$id_user."', 'user')");
     			reset($assessment);
     		}
     		if(!empty($array_id_date))
     		{
     			foreach($array_id_date as $id_date)
     				$date_man->addUserToDate($id_date, $id_user, Docebo::user()->getIdSt());
     			reset($array_id_date);
     		}
     		if(!empty($array_id_edition))
     		{
     			foreach($array_id_edition as $id_edition)
     				$edition_man->addUserToEdition($id_edition, $id_user, Docebo::user()->getIdSt());
     			reset($array_id_edition);
     		}
     */
     $res['success'] = true;
     if ($waiting == 1) {
         $res['new_status'] = '<p class="cannot_subscribe">' . Lang::t('_WAITING', 'catalogue') . '</p>';
     } else {
         $res['new_status'] = '<p class="cannot_subscribe">' . Lang::t('_USER_STATUS_SUBS', 'catalogue') . '</p>';
     }
     $res['message'] = $res['message'] = UIFeedback::info(Lang::t('_SUBSCRIPTION_CORRECT', 'catalogue'), true);
     echo $this->json->encode($res);
 }