コード例 #1
0
function delrule(&$url)
{
    checkPerm('mod');
    $id_rule = importVar('id_rule', true, 0);
    require_once $GLOBALS['where_lms'] . '/lib/lib.preassessment.php';
    $rule_man = new AssessmentRule();
    $rule = $rule_man->getRule($id_rule);
    if ($rule_man->deleteRule($id_rule)) {
        Util::jump_to($url->getUrl('&op=modrule&id_assess=' . $rule[RULE_ID_ASSESS] . '&result=ok_delete'));
    } else {
        Util::jump_to($url->getUrl('&op=modrule&id_assess=' . $rule[RULE_ID_ASSESS] . '&result=err_delete'));
    }
}
コード例 #2
0
			"_AREYOUSURE":"' . $lang->def('_DEL') . '",
			"_YES":"' . $lang->def('_CONFIRM') . '",
			"_NO":"' . $lang->def('_UNDO') . '",
			"_NEW_RULE":"' . $lang->def('_ADD_RULE') . '", 
			"_CONFIRM":"' . $lang->def('_CONFIRM') . '", 
			"_UNDO":"' . $lang->def('_UNDO') . '"
		}';
        aout($lang_obj);
        break;
    case "modruleform":
        require_once $GLOBALS['where_lms'] . '/lib/lib.preassessment.php';
        require_once _base_ . '/lib/lib.form.php';
        $lang =& DoceboLanguage::createInstance('standard', 'framework');
        $lang->setGlobal();
        $lang =& DoceboLanguage::createInstance('preassessment', 'framework');
        $rule_man = new AssessmentRule();
        $use_default = importVar('usedef', false, 1);
        $id_rule = importVar('id_rule', true, 0);
        if ($id_rule != 0) {
            // load old data ------------------------------------
            $rule = $rule_man->getRule($id_rule);
            $rule_type = $rule[RULE_TYPE];
            $setting = $rule_man->parseRuleSetting($rule[RULE_TYPE], $rule[RULE_SETTING]);
            $score_type_one = isset($setting[0]) ? $setting[0] : '';
            $score_type_two = isset($setting[1]) ? $setting[1] : '';
        } else {
            $rule_type = $use_default ? RULE_DEFAULT : RULE_GREATER;
            $score_type_one = '';
            $score_type_two = '';
        }
        $arr_question = array();
コード例 #3
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');
}