Example #1
0
}
// main page
//####################################################################################\\
//############################## MODULE TABLE LIST PREPARATION #######################\\
//####################################################################################\\
if (is_learnpath_accessible((int) $_SESSION['path_id']) && !claro_is_allowed_to_edit()) {
    claro_die(get_lang('Not allowed'));
}
$cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : '';
if (get_conf('cllnp_resetByUserAllowed', false) || claro_is_allowed_to_edit()) {
    switch ($cmd) {
        case "resetModuleProgression":
            $learnPath_module_id = isset($_GET['learnPath_module_id']) ? $_GET['learnPath_module_id'] : '';
            if (!empty($learnPath_module_id) && claro_is_user_authenticated()) {
                $dialogBox = new DialogBox();
                if (resetModuleProgression(claro_get_current_user_id(), $_SESSION['path_id'], $learnPath_module_id)) {
                    $dialogBox->success(get_lang('Module reset successful'));
                } else {
                    $dialogBox->error(get_lang('An error occured while resetting module ') . $learnPath_module_id);
                }
            }
            unset($learnPath_module_id);
            break;
        case "resetLearnPathProgression":
            if (!empty($_SESSION['path_id']) && claro_is_user_authenticated()) {
                $dialogBox = new DialogBox();
                if (resetModuleProgressionByPathId(claro_get_current_user_id(), $_SESSION['path_id'])) {
                    $dialogBox->success(get_lang('Learning path reset successful'));
                } else {
                    $dialogBox->error(get_lang('An error occured while resetting learning path ') . $_SESSION['path_id']);
                }
Example #2
0
function copyModuleProgression($user_id_from = 0, $user_id_to = 0, $learnPath_id = 0, $learnPath_module_id = 0, $resetLocation = true)
{
    if (empty($learnPath_id) || empty($learnPath_module_id) || empty($user_id_from) || empty($user_id_to)) {
        return false;
    }
    $newProgression = getModuleProgression($user_id_from, $learnPath_id, $learnPath_module_id);
    if (!is_array($newProgression)) {
        return false;
    }
    if ($resetLocation) {
        $newProgression['lesson_location'] = '!!!EMPTY_LOCATION!!!';
    }
    if (!resetModuleProgression($user_id_to, $learnPath_id, $learnPath_module_id) || !updateModuleProgression($user_id_to, $newProgression, $learnPath_id, $learnPath_module_id)) {
        return false;
    }
    return true;
}