function pathelem() { checkPerm('view'); require_once _base_ . '/lib/lib.table.php'; require_once $GLOBALS['where_lms'] . '/lib/lib.course.php'; require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php'; $lang =& DoceboLanguage::createInstance('coursepath', 'lms'); $id_path = importVar('id_path', true, 0); $mod_perm = checkPerm('mod', true); $path_man = new CoursePath_Manager(); $course_man = new Man_Course(); $path = $path_man->getCoursepathInfo($id_path); // retriving id of the courses in this path $slots = $path_man->getPathSlot($id_path); $courses = $path_man->getPathElem($id_path); // retrive all i need about courses name if (isset($courses['course_list'])) { $course_info = $course_man->getAllCourses(false, 'all', $courses['course_list']); } else { $course_info = array(); } $area_title = array('index.php?modname=coursepath&op=pathlist' => $lang->def('_COURSEPATH'), $path['path_name']); $GLOBALS['page']->add(getTitleArea($area_title, 'coursepath') . '<div class="std_block">' . getBackUi('index.php?modname=coursepath&op=pathlist', $lang->def('_BACK')), 'content'); if (isset($_GET['result'])) { switch ($_GET['result']) { case "ok": $GLOBALS['page']->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')), 'content'); break; case "err": $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE')), 'content'); break; } } $tb_path = new Table(0, $lang->def('_COURSE_PATH_COURSES_CAPTION'), $lang->def('_COURSE_PATH_COURSES_CAPTION')); $cont_h = array($lang->def('_CODE'), $lang->def('_COURSE_NAME'), $lang->def('_PREREQUISITES')); $type_h = array('coursepath_code', 'coursepath_name', '', 'image'); if ($mod_perm) { $cont_h[] = Get::img('standard/down.png', Lang::t('_DOWN', 'coursepath')); $type_h[] = 'image'; $cont_h[] = Get::img('standard/up.png', Lang::t('_UP', 'coursepath')); $type_h[] = 'image'; $cont_h[] = Get::img('standard/moderate.png', Lang::t('_MOD', 'coursepath')); $type_h[] = 'image'; $cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />'; $type_h[] = 'image'; } $tb_path->setColsStyle($type_h); $tb_path->addHead($cont_h); $slot_number = 0; foreach ($slots as $id_slot => $slot_info) { $tb_path->emptyBody(); $tb_path->emptyFoot(); $i = 0; if (!isset($courses[$id_slot])) { $num_course = 0; } else { $num_course = count($courses[$id_slot]); $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()); $all_course = false; if (isset($admin_courses['course'][0])) { $all_course = 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); } } while (list($id_item, $prerequisites) = each($courses[$id_slot])) { $cont = array($course_info[$id_item]['code'], $course_info[$id_item]['name']); if ($prerequisites != '') { $cont[] = coursePathSubstPrer($prerequisites, $course_info); } else { $cont[] = ''; } if ($mod_perm) { if (in_array($id_item, $admin_courses['course']) || $all_courses) { if ($i != $num_course - 1) { $cont[] = '<a href="index.php?modname=coursepath&op=downelem&id_path=' . $id_path . '&id_course=' . $id_item . '&id_slot=' . $id_slot . '" ' . 'title="' . $lang->def('_MOVE_DOWN') . ' : ' . $course_info[$id_item]['name'] . '">' . Get::img('standard/down.png', Lang::t('_DOWN', 'coursepath')) . '</a>'; } else { $cont[] = ''; } if ($i != 0) { $cont[] = '<a href="index.php?modname=coursepath&op=upelem&id_path=' . $id_path . '&id_course=' . $id_item . '&id_slot=' . $id_slot . '" ' . 'title="' . $lang->def('_MOVE_UP') . ' : ' . $course_info[$id_item]['name'] . '">' . Get::img('standard/up.png', Lang::t('_UP', 'coursepath')) . '</a>'; } else { $cont[] = ''; } $cont[] = '<a href="index.php?modname=coursepath&op=modprerequisites&id_path=' . $id_path . '&id_course=' . $id_item . '&id_slot=' . $id_slot . '" ' . 'title="' . $lang->def('_MOD') . ' : ' . $course_info[$id_item]['name'] . '">' . Get::img('standard/moderate.png', Lang::t('_MOD', 'coursepath') . ' : ' . $course_info[$id_item]['name']) . '</a>'; $cont[] = '<a href="index.php?modname=coursepath&op=delcoursepath&id_path=' . $id_path . '&id_course=' . $id_item . '&id_slot=' . $id_slot . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . $course_info[$id_item]['name'] . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $course_info[$id_item]['name'] . '" /></a>'; } else { $cont[] = ''; $cont[] = ''; $cont[] = ''; $cont[] = ''; } } $tb_path->addBody($cont); $i++; } } // add link if ($mod_perm) { $tb_path->addActionAdd('<a class="ico-wt-sprite subs_import" href="index.php?modname=coursepath&op=importcourse&load=1&id_path=' . $id_path . '&id_slot=' . $id_slot . '" ' . 'title="' . $lang->def('_IMPORT_COURSE') . '">' . '<span>' . $lang->def('_IMPORT_COURSE') . '</span>' . '</a>'); } $GLOBALS['page']->add($tb_path->getTable() . '<br />', 'content'); $slot_number++; } /* $GLOBALS['page']->add( '<a href="index.php?modname=coursepath&op=modslot&id_path='.$id_path.'" ' .'title="'.$lang->def('_NEW_SLOT_TITLE').'">' .'<img src="'.getPathimage().'standard/add.png" alt="'.$lang->def('_ADD').'" />' .$lang->def('_NEW_SLOT') .'</a>' ,'content'); */ $GLOBALS['page']->add(getBackUi('index.php?modname=coursepath&op=pathlist', $lang->def('_BACK')) . '</div>', 'content'); }
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; }
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'); }