Example #1
0
$TABLELEARNPATHMODULE = $tbl_lp_rel_learnPath_module;
$TABLEASSET = $tbl_lp_asset;
$TABLEUSERMODULEPROGRESS = $tbl_lp_user_module_progress;
$TABLECOURSUSER = $tbl_rel_course_user;
$TABLEUSER = $tbl_user;
require_once get_path('incRepositorySys') . '/lib/statsUtils.lib.inc.php';
require_once get_path('incRepositorySys') . '/lib/learnPath.lib.inc.php';
$cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : '';
if (get_conf('cllnp_resetByUserAllowed', false) || claro_is_allowed_to_edit()) {
    switch ($cmd) {
        case "resetLearnPath":
            $learnPath_id = isset($_GET['path_id']) ? $_GET['path_id'] : '';
            $user_id = isset($_GET['user_id']) ? $_GET['user_id'] : '';
            if (!empty($learnPath_id) && !empty($user_id)) {
                $dialogBox = new DialogBox();
                if (resetModuleProgressionByPathId($user_id, $learnPath_id)) {
                    $dialogBox->success(get_lang('Learning path reset successful'));
                } else {
                    $dialogBox->error(get_lang('An error occured while resetting learning path ') . $learnPath_id);
                }
            }
            unset($learnPath_id);
            unset($user_id);
            break;
    }
}
$out = '';
if (!empty($dialogBox)) {
    $out .= $dialogBox->render();
    unset($dialogBox);
}
Example #2
0
        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']);
                }
            }
            break;
    }
}
if (claro_is_user_authenticated()) {
    $uidCheckString = "AND UMP.`user_id` = " . (int) claro_get_current_user_id();
} else {
    $uidCheckString = "AND UMP.`user_id` IS NULL ";
}
$sql = "SELECT LPM.`learnPath_module_id`,\n                LPM.`parent`,\n                LPM.`lock`,\n                M.`module_id`,\n                M.`contentType`,\n                M.`name`,\n                UMP.`lesson_status`, UMP.`raw`,\n                UMP.`scoreMax`, UMP.`credit`,\n                A.`path`\n           FROM (`" . $TABLEMODULE . "` AS M,\n                   `" . $TABLELEARNPATHMODULE . "` AS LPM)\n     LEFT JOIN `" . $TABLEUSERMODULEPROGRESS . "` AS UMP\n             ON UMP.`learnPath_module_id` = LPM.`learnPath_module_id`\n             " . $uidCheckString . "\n     LEFT JOIN `" . $TABLEASSET . "` AS A\n            ON M.`startAsset_id` = A.`asset_id`\n          WHERE LPM.`module_id` = M.`module_id`\n            AND LPM.`learnPath_id` = " . (int) $_SESSION['path_id'] . "\n            AND LPM.`visibility` = 'SHOW'\n            AND LPM.`module_id` = M.`module_id`\n       GROUP BY LPM.`module_id`\n       ORDER BY LPM.`rank`";
$extendedList = claro_sql_query_fetch_all($sql);
Example #3
0
function copyLearnPathProgression($user_id_from = 0, $user_id_to = 0, $learnPath_id = 0, $resetLocation = true)
{
    if (empty($learnPath_id) || empty($user_id_from) || empty($user_id_to)) {
        return false;
    }
    $moduleProgressionList = getModuleProgressionList($user_id_from, $learnPath_id);
    if (empty($moduleProgressionList) || !is_array($moduleProgressionList)) {
        return false;
    }
    if (!resetModuleProgressionByPathId($user_id_to, $learnPath_id)) {
        return false;
    }
    foreach ($moduleProgressionList as $moduleProgression) {
        if (!copyModuleProgression($user_id_from, $user_id_to, $learnPath_id, $moduleProgression['learnPath_module_id'], $resetLocation)) {
            return false;
        }
    }
    return true;
}